gold/
[platform/upstream/binutils.git] / gold / ChangeLog
1 2013-10-31  Cary Coutant  <ccoutant@google.com>
2
3         * configure.ac: Fix check for -fmerge-constants.
4         * configure.ac: Regenerate.
5
6 2013-10-30  Roland McGrath  <mcgrathr@google.com>
7
8         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
9         Correct 9-byte nop sequence to match what the assembler generates.
10
11 2013-10-30  Alan Modra  <amodra@gmail.com>
12
13         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
14         ppc64_local_entry_offset, ppc64_local_entry_offset,
15         do_read_symbols): New functions.
16         (Powerpc_relobj::e_flags_, st_other_): New vars.
17         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
18         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
19         (Powerpc_relobj::e_flags_): New var.
20         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
21         and adjust for ELFv2.
22         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
23         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
24         (Powerpc_dynobj::do_find_special_sections): Likewise.
25         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
26         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
27         to ELFv2 local entry.
28         (Target_powerpc::do_relax): No thread safe barriers needed for
29         ELFv2.
30         (Output_data_plt_powerpc::initial_plt_entry_size_,
31         plt_entry_size): Delete.  Replace all uses with
32         first_plt_entry_offset() and plt_entry_size().
33         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
34         reserved_size parm.  Update callers.
35         (Output_data_plt_powerpc::entry_count): Update.
36         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
37         and use Target_powerpc::first_plt_entry_offset().
38         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
39         rename to plt_entry_size.
40         (Output_data_plt_powerpc::add_ifunc_entry,
41         add_local_ifunc_entry): Adjust reloc for ELFv2.
42         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
43         (glink_eh_frame_fde_64v2): New.
44         (Stub_table::plt_call_size): Support ELFv2 sizing.
45         (Output_data_glink::add_eh_frame): Use the new FDE.
46         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
47         (Stub_table::do_write): Write ELFv2 stubs and glink.
48         (Target_powerpc::Relocate::relocate): Replaces nop after call
49         with ld 2,24(1) and adjust local offset destination for ELFv2.
50
51 2013-10-30  Alan Modra  <amodra@gmail.com>
52
53         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
54         (Target_powerpc::Scan::global, local): Likewise.
55         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
56         on all ppc64 @h and @ha relocs.
57
58 2013-10-14  Alan Modra  <amodra@gmail.com>
59
60         * output.h (Output_data_got::add_constant): Tidy.
61         (Output_data_got::add_constant_pair): New function.
62         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
63         methods used so as to first call reserve_ent().
64
65 2013-10-11  Roland McGrath  <mcgrathr@google.com>
66
67         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
68         add_got_entry and add_got_entry_pair.
69
70         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
71         (HAVE_PUBNAMES): Likewise.
72         * configure: Regenerate.
73
74         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
75         * testsuite/Makefile.in: Regenerate.
76
77         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
78         Remove const from declaration.
79         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
80         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
81         * output.h (Output_file_header): Remove const from member target_
82         and corresponding constructor argument.
83         * output.cc (Output_file_header::Output_file_header): Update prototype.
84         (Output_file_header::do_sized_write): Use this->target_ in place
85         of parameters()->target().
86
87         * testsuite/undef_symbol.cc (Foo::get_a): New method.
88
89         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
90         * configure: Regenerate.
91         * Makefile.in: Regenerate.
92         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
93         * testsuite/merge_string_literals_2.c: Likewise.
94         * testsuite/Makefile.am
95         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
96         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
97         literal -fmerge-constants.
98         * testsuite/Makefile.in: Regenerate.
99
100         * i386.cc (Target_i386): Remove unused member dynbss_.
101         * arm.cc (Target_arm): Likewise.
102         * powerpc.cc (Target_powerpc): Likewise.
103         * sparc.cc (Target_sparc): Likewise.
104         * tilegx.cc (Target_tilegx): Likewise.
105         * x86_64.cc (Target_x86_64): Likewise.
106         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
107         type_signature_, type_offset_.
108         * plugin.h (Plugin_hook): Remove unused member layout_.
109         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
110         mapfile_.
111         (Read_member): Remove unused members input_objects_, symtab_,
112         mapfile_, layout_.
113         (Check_library): Remove unused member symtab_.
114         * archive.h (Lib_group): Remove unused member lib_.
115         * archive.cc (Lib_group::Lib_group): Update initializer.
116         * incremental.h (Incremental_binary): Remove unused member target_.
117         (Incremental_script_entry): Removed unused member script_.
118         * layout.h (Write_symbols_task): Remove unused member input_objects_.
119         * icf.h (Icf): Remove unused member num_tracked_relocs.
120
121         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
122         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
123         its only use.
124         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
125
126         * archive.h: Use struct rather than class for forward declaration
127         of Read_symbols_data.
128
129 2013-10-07  Cary Coutant  <ccoutant@google.com>
130
131         PR gold/16010
132         * testsuite/Makefile.am (icf_test): Fix dependencies.
133         (icf_safe_test): Likewise.
134         (icf_safe_so_test): Likewise.
135         (large_symbol_alignment): Add empty _LDADD rule.
136         * testsuite/Makefile.in: Regenerate.
137
138 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
139
140         PR gold/15927
141         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
142         relocation for R_X86_64_32 on x32.
143
144 2013-08-27  Roland McGrath  <mcgrathr@google.com>
145
146         * output.cc (Output_segment::set_section_addresses): Take new
147         Target* argument.  If target->isolate_execinstr() and the segment
148         is executable and starts at a target->abi_pagesize() boundary,
149         pad its end out to a target->abi_pagesize() boundary with code fill.
150         * output.h (Output_segment::set_section_addresses): Update decl.
151         * layout.h (Layout::check_output_data_for_reset_values): Take new
152         argument RELAX_OUTPUTS.
153         (Layout): New member relax_output_list_.
154         (Layout::add_relax_output): New method.
155         * layout.cc (Layout::Layout): Update constructor.
156         (Layout::reset_relax_output): New method.
157         (Layout::clean_up_after_relaxation): Call it.
158         (Layout::prepare_for_relaxation): Update caller.
159         (Layout::set_segment_offsets): Update callers of set_section_addresses.
160         Call reset_relax_output before re-processing segments for
161         isolate_execinstr case.
162         (Layout::write_data): Handle relax_output_list_.
163         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
164         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
165
166 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
167
168         PR binutils/15834
169         * object.h: Fix typos.
170
171 2013-08-16  Roland McGrath  <mcgrathr@google.com>
172
173         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
174         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
175
176 2013-08-07  Cary Coutant  <ccoutant@google.com>
177
178         Revert support for v2 DWP files:
179
180         2013-03-01  Cary Coutant  <ccoutant@google.com>
181
182             Add dwp support for v2 DWARF package file format.
183             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
184             tu_length parameter.  Adjust all callers.
185             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
186             * dwp.cc: Include dwarf.h.
187             (Section_bounds): New struct type.
188             (Unit_set): New struct type.
189             (Dwo_file::Dwo_file): Initialize new data member.
190             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
191             Combine and rename to...
192             (Dwo_file::read_unit_index): ...this.
193             (Dwo_file::sized_read_compunit_index)
194             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
195             (Dwo_file::sized_read_unit_index): ...this.
196             (Dwo_file::copy_section): Remove section_name, is_str_offsets
197             parameters; add section_id parameter.
198             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
199             (Dwo_file::add_unit_set): ...this.
200             (Dwo_file::shndx_map_): Remove.
201             (Dwo_file::sect_offsets_): New data member.
202             (Dwp_output_file::Dwp_output_file): Initialize new data members.
203             (Dwp_output_file::add_section): Rename to...
204             (Dwp_output_file::add_contribution): ...this.
205             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
206             (Dwp_output_file::add_tu_set): Likewise.
207             (Dwp_output_file::Contribution): New type.
208             (Dwp_output_file::Section::contributions): New data member.
209             (Dwp_output_file::Cu_or_tu_set): Remove.
210             (Dwp_output_file::Section::Section): New ctor.
211             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
212             (Dwp_output_file::Dwp_index::Section_table): New type.
213             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
214             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
215             parameter.
216             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
217             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
218             (Dwp_output_file::Dwp_index::section_table): New member function.
219             (Dwp_output_file::Dwp_index::section_table_end): New member function.
220             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
221             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
222             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
223             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
224             (Dwp_output_file::Dwp_index::section_table_): New data member.
225             (Dwp_output_file::Dwp_index::section_mask_): New data member.
226             (Dwp_output_file::add_output_section): New member function.
227             (Dwp_output_file::write_new_section): New member function.
228             (Dwp_output_file::write_contributions): New member function.
229             (Dwp_output_file::section_id_map_): New data member.
230             (class Dwo_id_info_reader): Remove.
231             (class Unit_reader): New class.
232             (get_dwarf_section_name): New function.
233             (Dwo_file::read_executable): Adjust initializations of class data.
234             (Dwo_file::read): Add support for v2 package file format.
235             (Dwo_file::read_unit_index): Likewise.
236             (Dwo_file::sized_read_unit_index): Likewise.
237             (Dwo_file::copy_section): Likewise.
238             (Dwo_file::add_unit_set): Likewise.
239             (Dwp_output_file::add_output_section): Likewise.
240             (Dwp_output_file::add_contribution): Likewise.
241             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
242             for empty slot.
243             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
244             file format.
245             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
246             slot.
247             (Dwp_output_file::initialize): Remove unused function.
248             (Dwp_output_file::finalize): Add support for v2 package file format.
249             (Dwp_output_file::write_index): Likewise.
250             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
251             function prototype.
252
253 2013-07-31  Cary Coutant  <ccoutant@google.com>
254
255         * object.cc (Sized_relobj::do_output_section_address): New function.
256         (Sized_relobj): Instantiate explicitly.
257         * object.h (Object::output_section_address): New function.
258         (Object::do_output_section_address): New function.
259         (Sized_relobj::do_output_section_address): New function.
260         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
261
262 2013-07-30  Cary Coutant  <ccoutant@google.com>
263             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
264
265         * parameters.cc (Parameters::entry): Return target-specific entry
266         symbol name.
267         * target.h (Target::entry_symbol_name): New function.
268         (Target_info::entry_symbol_name): New data member.
269
270         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
271         * i386.cc (Target_i386::i386_info): Likewise.
272         (Target_i386_nacl::i386_nacl_info): Likewise.
273         * sparc.cc (Target_sparc::sparc_info): Likewise.
274         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
275         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
276         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
277         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
278
279 2013-07-22  Sterling Augustine  <saugustine@google.com>
280
281         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
282         Convert parameter shndx to local variable. Add parameters symtab
283         and symtab_size.  Scan over section names.  Find relocation
284         section corresponding to current section.  Create and initialize
285         reloc_mapper_ and reloc_type_.
286         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
287         unit_length to off_t.  Initialize member unit_length_.  Fill in field
288         cu_offset_.
289         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
290         Initialize new fields unit_length_ and cu_offset_.
291         (Dwarf_pubnames_table::read_section): Update prototype.
292         (Dwarf_pubnames_table::cu_offset): New member function.
293         (Dwarf_pubnames_table::subsection_size): Likewise.
294         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
295         New fields.
296         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
297         member functions public.
298         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
299         Update comment.  Rework logic.  Move repeated parts to...
300         (Gdb_index_info_reader::read_pubtable): ...here. New function.
301         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
302         pubtypes_table_, and stmt_list_offset.
303         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
304         Gdb_index::find_pubtype_offset,
305         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
306         (Gdb_index::pubnames_read): Update prototype and rework logic.
307         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
308         Forward declare.
309         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
310         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
311         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
312         Gdb_index::map_pubtable_to_dies):
313         Declare functions.
314         (Gdb_index::pubnames_read): Update declaration.
315         (Gdb_index::Pubname_offset_map): New type.
316         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
317         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
318         Gdb_index::stmt_list_offset): Declare.
319         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
320         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
321         Gdb_index::pubtypes_offset_): Remove.
322
323 2013-07-19  Roland McGrath  <mcgrathr@google.com>
324
325         * options.h (General_options): Add -Trodata-segment option.
326         * parameters.cc (Parameters::check_rodata_segment): New function.
327         (Parameters::set_target_once): Call it.
328         * parameters.h (Parameters): Declare it (private member function).
329         * layout.cc (load_seg_unusable_for_headers): New function, broken
330         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
331         then validate rodata segment rather than text segment.
332         (relaxation_loop_body): Call that.
333         (is_text_segment): New function.  Don't admit a non-executable
334         segment if TARGET->isolate_execinstr().
335         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
336
337 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
338
339         PR gold/15070
340         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
341         * nacl.h (Sniff_file::View::View): Request aligned view.
342
343 2013-07-11  Cary Coutant  <ccoutant@google.com>
344
345         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
346         correct BRLT entry size.
347
348 2013-07-03  Alan Modra  <amodra@gmail.com>
349
350         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
351         comment.
352
353 2013-07-01  Cary Coutant  <ccoutant@google.com>
354
355         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
356         reloc_type_.
357         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
358         (Dwarf_ranges_table::lookup_reloc): New function.
359         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
360         reloc_type_.
361         (Dwarf_ranges_table::lookup_reloc): New function.
362         (Dwarf_ranges_table::reloc_type_): New data member.
363
364 2013-06-27  Jing Yu  <jingyu@google.com>
365
366         PR gold/15662
367         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
368         function.
369         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
370         (Target_powerpc::do_relax): Call the above.
371
372 2013-06-27  Cary Coutant  <ccoutant@google.com>
373
374         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
375         on garbage collected .opd section.
376
377 2013-06-27  Alan Modra  <amodra@gmail.com>
378
379         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
380         is non-zero.
381         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
382         (Target_powerpc::do_function_location): Likewise for loc->shndx.
383
384 2013-06-14  Cary Coutant  <ccoutant@google.com>
385
386         * resolve.cc (Symbol::override_base): Don't override st_type
387         from plugin placeholder symbols.
388         (Symbol_table::resolve): Likewise.
389         (Symbol_table::should_override): Don't complain about TLS mismatch
390         if the TO symbol is a plugin placeholder.
391         * testsuite/Makefile.am (plugin_test_tls): New test.
392         * testsuite/Makefile.in: Regenerate.
393         * testsuite/plugin_test_tls.sh: New test script.
394         * testsuite/two_file_test_2_tls.cc: New test source.
395         * testsuite/two_file_test_tls.cc: New test source.
396
397 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
398
399         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
400         the maximum segment alignment is larger than the page size.
401         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
402         correctly aligns the symbols with large alignemnt.
403         * testsuite/Makefile.in: Regenerate.
404         * testsuite/large_symbol_alignment.cc: New file.
405
406 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
407             Sriraman Tallam  <tmsriram@google.com>
408
409         * options.h (sort_section): New option.
410         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
411         Rename from Input_section_sort_section_name_special_ordering_compare.
412         (Input_section_sort_section_name_compare): New struct.
413         * output.cc (Output_section::Input_section_sort_section_name_compare::
414         operator()): New function.
415         (Output_section::sort_attached_input_sections): Use new sort function
416         for .text if --sort-section=name is specified.
417         * layout.cc (Layout::make_output_section):
418         Add sorting by name when --sort-section=name is specified.
419         * testsuite/Makefile.am (text_section_grouping): Test option
420         --sort-section=name.
421         * testsuite/Makefile.in: Regenerate.
422         * testsuite/section_sorting_name.cc: New file.
423         * testsuite/section_sorting_name.sh: New file.
424
425 2013-05-21  Cary Coutant  <ccoutant@google.com>
426
427         * symtab.h (Symbol::is_cxx_vtable): New function.
428         * target-reloc.h (relocate_section): Check for vtable symbol.
429         * testsuite/Makefile.am (missing_key_func.sh): New test case.
430         * testsuite/Makefile.in: Regenerate.
431         * testsuite/missing_key_func.cc: New test source.
432         * testsuite/missing_key_func.sh: New test script.
433
434 2013-05-21  Cary Coutant  <ccoutant@google.com>
435
436         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
437         type of enclosing symbol.
438         (Relocate_info::location): Check symbol type when describing symbol.
439         * object.h (Symbol_location_info): Remove unused line_number;
440         add enclosing_symbol_type.
441         * testsuite/debug_msg.sh: Adjust expected output.
442
443 2013-05-13  Cary Coutant  <ccoutant@google.com>
444
445         * configure.ac: Export DEFAULT_TARGET.
446         * configure: Regenerate.
447         * Makefile.in: Regenerate.
448         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
449         * testsuite/Makefile.in: Regenerate.
450         * testsuite/debug_msg.sh: Delete duplicate tests.
451         Don't check undef_int error message match for powerpc where the
452         source file and line number aren't available.
453
454 2013-05-10  Roland McGrath  <mcgrathr@google.com>
455
456         * options.h (General_options): Add --rosegment-gap option.
457         * options.cc (finalize): --rosegment-gap implies --rosegment.
458         * layout.cc (set_segment_offsets): Let user option override
459         target->rosegment_gap().
460
461 2013-05-10  Roland McGrath  <mcgrathr@google.com>
462
463         * options.h (General_options): Remove leading space from help
464         messages for -nostdlib and --rosegment.
465
466 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
467
468         PR ld/15365
469         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
470
471 2013-05-03  Alan Modra  <amodra@gmail.com>
472
473         * merge.cc (Output_merge_string::do_add_input_section): Correct
474         scan for number of strings.  Rename vars to avoid shadowing.
475         Include missing terminator in input_size_.
476
477 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
478
479         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
480         Restore empty string handling.
481
482 2013-05-01  Cary Coutant  <ccoutant@google.com>
483
484         * stringpool.cc (Stringpool_template::new_key_offset): Fix
485         uninitialized warning.
486
487 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
488
489         * output.cc (Output_section::add_merge_input_section): Allow
490         to merge sections if the alignment is more than character size.
491         * merge.h (Output_merge_string::Output_merge_string): Remove
492         assert.
493         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
494         only not-null strings. Check the alignment of strings.
495         * stringpool.h
496         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
497         alignment as the argument.
498         (Stringpool_template<Stringpool_char>::addralign_): New class member.
499         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
500         Align non-zero length strings according to the addralign_.
501         (Stringpool_template<Stringpool_char>::set_string_offsets):
502         Updating offsets according to the given alignment.
503         * testsuite/Makefile.am (text_section_grouping): Test if string
504         literals are getting merged.
505         * testsuite/Makefile.in: Regenerate.
506         * testsuite/merge_string_literals_1.c: New file.
507         * testsuite/merge_string_literals_2.c: Ditto.
508         * testsuite/merge_string_literals.sh: Ditto.
509
510 2013-04-26  Ian Lance Taylor  <iant@google.com>
511
512         * target-reloc.h (relocate_section): If the reloc offset is out of
513         range, pass VIEW as NULL to relocate.relocate.
514         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
515         * i386.cc (Target_i386::Relocate::relocate): Likewise.
516         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
517         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
518         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
519         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
520
521 2013-04-26  Geoff Pike  <gpike@chromium.org>
522
523         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
524         * layout.cc (Hash_task): New class.
525         (Layout::queue_build_id_tasks): New function.
526         (Layout::write_build_id): Handle single-thread portion of build ID
527         computation.  (In some cases, all of it is single-threaded.)  Replace
528         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
529         functionality in fewer lines of code.
530         * layout.h (Layout::queue_build_id_tasks): New function declaration.
531         * options.h (General_options): make "--build-id" default to tree
532         rather than sha1.  Add two new options related to --build-id=tree:
533         --build-id-chunk-size-for-treehash and
534         --build-id-min-file-size-for-treehash.
535         * Makefile.am: add testing of --build-id=tree and related new options
536         (these tests will be invoked by "make check").
537         * Makefile.in: Regenerate.
538
539 2013-04-25  Alan Modra  <amodra@gmail.com>
540
541         * configure.tgt: Add powerpcle and powerpc64le.
542
543 2013-04-22  Alan Modra  <amodra@gmail.com>
544
545         PR gold/15355
546         * layout.cc (Layout::segment_precedes): Allow more than one
547         segment with the same type and flags.
548
549 2013-04-15  Cary Coutant  <ccoutant@google.com>
550
551         * layout.cc (Layout::set_relocatable_section_offsets): Don't
552         allocate space in file for BSS sections.
553
554 2013-04-15  Cary Coutant  <ccoutant@google.com>
555
556         * script-sections.cc (Orphan_output_section): Reset address
557         to zero after each orphaned section for relocatable links.
558
559 2013-04-15  Cary Coutant  <ccoutant@google.com>
560
561         * symtab.cc (Symbol_table::sized_write_globals): Subtract
562         section starting address for relocatable link.
563         * testsuite/Makefile.am (script_test_11): New test.
564         * testsuite/Makefile.in: Regenerate.
565         * testsuite/script_test_11.c: New source file.
566         * testsuite/script_test_11.t: New linker script.
567
568 2013-04-13  Alan Modra  <amodra@gmail.com>
569
570         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
571         owner when sections are not adjacent and exceed group size.
572         (Target_powerpc::group_sections): Handle corner case.
573         (Target_powerpc::Branch_info::make_stub): Handle case where
574         stub table doesn't exist due to branches in non-exec sections.
575         (Target_powerpc::Relocate::relocate): Likewise.
576
577 2013-04-11  Alan Modra  <amodra@gmail.com>
578
579         PR gold/15354
580         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
581         .branch_lt to match bfd ld.  Adjust comments throughout file.
582
583 2013-04-04  Ian Lance Taylor  <iant@google.com>
584
585         GCC PR c++/56840
586         * object.cc (do_layout_deferred_sections): Handle .eh_frame
587         sections before checking whether they are included in the link.
588
589 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
590
591         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
592         object before calling the plugin claim_file handler.  Pass the elf
593         object of the archive to the plugin. Delete the elf object if the
594         plugin claims the file.
595
596 2013-03-21  Alan Modra  <amodra@gmail.com>
597
598         * layout.cc (Layout::set_segment_offsets): Accept writable .text
599         segment when omagic.
600
601 2013-03-21  Alan Modra  <amodra@gmail.com>
602
603         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
604         comparison warning.
605         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
606         uninitialized" warning.
607
608 2013-03-20  Alan Modra  <amodra@gmail.com>
609
610         * symtab.h (Symbol::clear_version): New function.
611         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
612         is_needed by weak references.  Clear version for symbols defined
613         in as-needed objects that are not needed.
614
615 2013-03-15  Alan Modra  <amodra@gmail.com>
616
617         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
618         static and public.  Add report_err param.  Return false for data refs.
619         (Target_powerpc::rela_dyn_section): New overloaded function.
620         (Target_powerpc::plt_, iplt_): Elucidate.
621         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
622         (Output_data_plt_powerpc::do_write): Don't write .iplt.
623         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
624         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
625         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
626         push_branch and make_plt_entry for ifunc syms when
627         reloc_needs_plt_for_ifunc.
628         (Target_powerpc::Relocate::relocate): Don't use plt entry value
629         for ifunc unless reloc_needs_plt_for_ifunc.
630
631 2013-03-15  Alan Modra  <amodra@gmail.com>
632
633         * gc.h (gc_process_relocs): Don't look through function descriptors.
634         * icf.cc (get_section_contents): Do so here instead.
635
636 2013-03-13  Alan Modra  <amodra@gmail.com>
637
638         * powerpc.cc (is_branch_reloc): Forward declare.
639         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
640         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
641         false for 64-bit, true for 32-bit non-branch relocs.
642         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
643         * testsuite/Makefile.am (icf_test): Use linker map file instead of
644         nm output.
645         (icf_safe_test): Generate linker map file as well as nm output.
646         (icf_safe_so_test): Likewise.
647         * testsuite/Makefile.in: Regenerate.
648         * testsuite/icf_test.sh: Parse linker map file to determine
649         section folding.
650         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
651         * testsuite/icf_safe_so_test.sh: Likewise.
652         (X86_32_or_ARM_specific_safe_fold): Merge into..
653         (arch_specific_safe_fold): ..this.
654         (X86_64_specific_safe_fold): Delete unused function.
655
656 2013-03-12  Alan Modra  <amodra@gmail.com>
657
658         * gc.h (gc_process_relocs): Look through function descriptors
659         to determine shndx, symvalue and addend used by ICF.  Tidy
660         variable duplication.
661
662 2013-03-11  Alan Modra  <amodra@gmail.com>
663
664         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
665         * layout.cc (Layout_task_runner::run): ..to here.
666         * symtab.h (struct Symbol_location): Extract from..
667         (class Symbol_table): ..here.
668         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
669         * target.h (class Target): Add function_location and
670         do_function_location functions.
671         (class Sized_target): Add do_function_location.
672         * object.h (class Sized_relobj_file): Move find_shdr..
673         (class Object): ..to here.
674         * object.cc: Likewise.  Update to suit.  Instantiate.
675         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
676         * powerpc.cc (class Powerpc_dynobj): New.
677         (Target_powerpc::do_function_location): New function.
678         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
679         (Powerpc_dynobj::do_read_symbols): New function.
680         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
681
682 2013-03-08  Ian Lance Taylor  <iant@google.com>
683
684         * options.cc (General_options::string_to_object_format): Accept
685         "default".
686
687 2013-03-08  Alan Modra  <amodra@gmail.com>
688
689         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
690         pointer to Post_fde.
691         (struct Post_fde): Move definition to here..
692         * ehframe.cc (struct Post_fde): ..from here.
693         (Cie::write): Don't alloc Post_fde.
694         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
695
696 2013-03-07  Alan Modra  <amodra@gmail.com>
697
698         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
699         relocation referencing .LC0.
700         * testsuite/discard_locals_test.sh: Remove FIXMEs.
701
702 2013-03-07  Alan Modra  <amodra@gmail.com>
703
704         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
705         always_inline.  Add assembly for powerpc to avoid GOT.
706
707 2013-03-07  Alan Modra  <amodra@gmail.com>
708
709         * testsuite/script_test_10.sh: Don't test .bss section
710         header number.
711
712 2013-03-06  Alan Modra  <amodra@gmail.com>
713
714         * powerpc.cc (class Powerpc_relobj): Move some member functions.
715         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
716         all callers.  Handle folded sections.
717         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
718         to Powerpc_relobj.
719         (Global_symbol_visitor_opd::operator()): Likewise.
720
721 2013-03-04  Alan Modra  <amodra@gmail.com>
722
723         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
724         * testsuite/Makefile.in: Regenerate.
725
726 2013-03-01  Cary Coutant  <ccoutant@google.com>
727
728         Add dwp support for v2 DWARF package file format.
729         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
730         tu_length parameter.  Adjust all callers.
731         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
732         * dwp.cc: Include dwarf.h.
733         (Section_bounds): New struct type.
734         (Unit_set): New struct type.
735         (Dwo_file::Dwo_file): Initialize new data member.
736         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
737         Combine and rename to...
738         (Dwo_file::read_unit_index): ...this.
739         (Dwo_file::sized_read_compunit_index)
740         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
741         (Dwo_file::sized_read_unit_index): ...this.
742         (Dwo_file::copy_section): Remove section_name, is_str_offsets
743         parameters; add section_id parameter.
744         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
745         (Dwo_file::add_unit_set): ...this.
746         (Dwo_file::shndx_map_): Remove.
747         (Dwo_file::sect_offsets_): New data member.
748         (Dwp_output_file::Dwp_output_file): Initialize new data members.
749         (Dwp_output_file::add_section): Rename to...
750         (Dwp_output_file::add_contribution): ...this.
751         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
752         (Dwp_output_file::add_tu_set): Likewise.
753         (Dwp_output_file::Contribution): New type.
754         (Dwp_output_file::Section::contributions): New data member.
755         (Dwp_output_file::Cu_or_tu_set): Remove.
756         (Dwp_output_file::Section::Section): New ctor.
757         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
758         (Dwp_output_file::Dwp_index::Section_table): New type.
759         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
760         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
761         parameter.
762         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
763         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
764         (Dwp_output_file::Dwp_index::section_table): New member function.
765         (Dwp_output_file::Dwp_index::section_table_end): New member function.
766         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
767         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
768         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
769         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
770         (Dwp_output_file::Dwp_index::section_table_): New data member.
771         (Dwp_output_file::Dwp_index::section_mask_): New data member.
772         (Dwp_output_file::add_output_section): New member function.
773         (Dwp_output_file::write_new_section): New member function.
774         (Dwp_output_file::write_contributions): New member function.
775         (Dwp_output_file::section_id_map_): New data member.
776         (class Dwo_id_info_reader): Remove.
777         (class Unit_reader): New class.
778         (get_dwarf_section_name): New function.
779         (Dwo_file::read_executable): Adjust initializations of class data.
780         (Dwo_file::read): Add support for v2 package file format.
781         (Dwo_file::read_unit_index): Likewise.
782         (Dwo_file::sized_read_unit_index): Likewise.
783         (Dwo_file::copy_section): Likewise.
784         (Dwo_file::add_unit_set): Likewise.
785         (Dwp_output_file::add_output_section): Likewise.
786         (Dwp_output_file::add_contribution): Likewise.
787         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
788         for empty slot.
789         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
790         file format.
791         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
792         slot.
793         (Dwp_output_file::initialize): Remove unused function.
794         (Dwp_output_file::finalize): Add support for v2 package file format.
795         (Dwp_output_file::write_index): Likewise.
796         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
797         function prototype.
798
799 2013-03-01  Cary Coutant  <ccoutant@google.com>
800
801         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
802         function into class definition in header file.
803         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
804         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
805         New function.
806         (Dwarf_info_reader::check_buffer): Move here from .cc file.
807
808 2013-02-28  Alan Modra  <amodra@gmail.com>
809
810         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
811         * target.cc (Target::do_plt_fde_location): New function.
812         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
813         accessor function, and constructor param.
814         (struct Post_fde, Post_fdes): Declare.
815         (Cie::write): Add post_fdes param.
816         * ehframe.cc (Fde::write): Use plt_fde_location.
817         (struct Post_fde): Define.
818         (Cie::write): Stash FDEs added post merge mapping.
819         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
820         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
821         (Eh_frame::do_sized_write): Arrange to write post map FDES after
822         other FDEs.
823         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
824         (Target_powerpc::has_glink): New function.
825         (Target_powerpc::do_relax): Add eh_frame info for stubs.
826         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
827         glink_eh_frame_fde_32, default_fde): New data.
828         (Stub_table::eh_frame_added_): New var.
829         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
830         Make const.
831         (Stub_table::add_eh_frame): New function.
832         (Output_data_glink::add_eh_frame): New function.
833         (Target_powerpc::make_glink_section): Call add_eh_frame.
834
835 2013-02-15  Ian Lance Taylor  <iant@google.com>
836
837         * options.h (DEFINE_uint64_alias): Define.
838         (class General_options): Add -Ttext-segment as an alias for
839         -Ttext.
840
841 2013-02-15  Alan Modra  <amodra@gmail.com>
842
843         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
844         (Stub_table::do_write): ..here, two places.
845         (Stub_table::plt_call_size): Use it here too.
846
847 2013-02-11  Ian Lance Taylor  <iant@google.com>
848
849         * descriptors.cc (Descriptors::close_all): New function.
850         * descriptors.h (class Descriptors): Declare close_all.
851         (close_all_descriptors): New inline function.
852         * plugin.cc: Include "descriptors.h".
853         (Plugin_manager::cleanup): Call close_all_descriptors.
854
855 2013-02-06  Alan Modra  <amodra@gmail.com>
856
857         * README: Update coding style link.
858
859 2013-01-28  Cary Coutant  <ccoutant@google.com>
860
861         * dwp.cc (File_list): New typedef.
862         (Dwo_name_info_reader): New class.
863         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
864         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
865         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
866         (Dwo_file::read_executable): New function.
867         (Dwo_file::read): Move common setup code to ...
868         (Dwo_file::make_object): ... here.
869         (dwp_options): Add --exec/-e.
870         (usage): Likewise.
871         (main): Likewise.
872
873 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
874
875         * layout.cc (Layout::layout): Check for option text_reorder.
876         (Layout::make_output_section): Ditto.
877         * options.h (text_reorder): New option.
878         * output.cc (Input_section_sort_compare): Remove special ordering
879         of section names.
880         (Output_section::
881          Input_section_sort_section_name_special_ordering_compare::
882          operator()): New function.
883         (Output_section::sort_attached_input_sections): Use new sort function
884         for .text.
885         * output.h (Input_section_sort_section_name_special_ordering_compare):
886         New struct.
887         * testsuite/Makefile.am (text_section_grouping): Test option
888         --no-text-reorder
889         * testsuite/Makefile.in: Regenerate.
890         * testsuite/text_section_grouping.sh: Check order of functions without
891         default text reordering.
892
893 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
894
895         * options.h (General_options): Change default to true for new_dtags.
896
897 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
898
899         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
900         when enable_new_dtags is false.  Only add DT_RUNPATH when
901         enable_new_dtags is true.
902
903 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
904
905         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
906         used in declaration and definition consistent.
907         (Target_powerpc::symval_for_branch): Ditto.
908
909 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
910
911         * testsuite/plugin_final_layout.cc: Fix comment.
912
913 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
914
915         * layout.cc (Layout::layout): Do not do default sorting for
916         text sections when section ordering is specified.
917         (make_output_section): Ditto.
918         * testsuite/plugin_final_layout.cc: Name the function sections
919         to catch reordering issues.
920
921 2013-01-15  Alan Modra  <amodra@gmail.com>
922
923         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
924         plt-thread-safe.
925
926 2013-01-15  Alan Modra  <amodra@gmail.com>
927
928         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
929         * testsuite/Makefile.in: Regenerate.
930
931 2013-01-14  Alan Modra  <amodra@gmail.com>
932
933         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
934         * testsuite/Makefile.in: Regenerate.
935
936 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
937
938         PR bfd/14430
939         Fix mingw gold build with plugins enabled
940         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
941         * configure.ac: Export DLOPEN_LIBS and add headers check.
942         * plugin.cc: Handle non-dlfcn case.
943         * Makefile.in: Regenerate.
944         * config.in: Regenerate.
945         * configure: Regenerate.
946         * testsuite/Makefile.in: Regenerate.
947
948 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
949
950         * output.h (sort_attached_input_sections): Change to be public.
951         * script-sections.cc
952         (Output_section_definition::set_section_addresses): Sort
953         attached input sections according to section order before linker
954         script assigns section addresses.
955         (Orphan_output_section::set_section_addresses): Sort
956         attached input sections according to section order before linker
957         script assigns section addresses.
958         * Makefile.am (final_layout.sh): Use a simple linker script to
959         check if section ordering still works.
960         * Makefile.in: Regenerate.
961
962 2013-01-09  Ben Cheng  <bccheng@google.com>
963
964         * arm.cc (Target_arm::attributes_accept_div): New function.
965         (Target_arm::attributes_forbid_div): New function.
966         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
967         attribute using the same new functions as what bfd/elf32_arm.c
968         does.
969
970 2013-01-07  Cary Coutant  <ccoutant@google.com>
971
972         PR gold/14993
973         * output.cc (Output_section::add_input_section): For incremental
974         updates, don't track input sections that are allocated from patch
975         space.
976
977 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
978             Ian Lance Taylor  <iant@google.com>
979
980         PR gold/14897
981         * configure.ac (--enable-ld): Removed.
982         (install_as_default): Set to yes only for --enable-gold=default
983         or --disable-ld.
984         * configure: Regenerated.
985
986 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
987
988         * options.h (General_options): Add -fuse-ld= for GCC linker
989         option compatibility.
990
991 2013-01-04  Cary Coutant  <ccoutant@google.com>
992
993         * configure.ac: Fix typo restoring CXXFLAGS.
994         * configure: Regenerate.
995
996 2013-01-04  Cary Coutant  <ccoutant@google.com>
997
998         * testsuite/Makefile.am (CXXLINK_S): New macro.
999         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1000         * testsuite/Makefile.in: Regenerate.
1001
1002 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1003
1004         * version.cc (print_version): Update copyright year to 2013.
1005
1006 2012-12-20  Ian Lance Taylor  <iant@google.com>
1007
1008         * layout.cc (Layout::special_ordering_of_input_section): New
1009         function.
1010         (Layout::layout): If input section requires special ordering, must
1011         sort input sections.
1012         (Layout::make_output_section): May sort .text input sections.
1013         (Layout::is_section_name_prefix_grouped): Remove.
1014         * layout.h (class Layout): Declare
1015         special_ordering_of_input_section.  Don't declare
1016         is_section_name_prefix_grouped.
1017         * output.cc (Output_section::add_input_section): Revert last
1018         change.
1019         (Output_section::Input_section_sort::match_file_name): Don't crash
1020         if called on output section data.
1021         (Output_section::Input_section_sort_compare): Sort based on
1022         special ordering.
1023         (Output_section::Input_section_sort_section_order_index_compare):
1024         Revert last patch.
1025         (Output_section::sort_attached_input_sections): Likewise.
1026
1027 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1028
1029         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1030         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1031         * output.cc (Output_section::add_input_section): Check if section
1032         name contains special prefix.  Keep input sections to sort such
1033         sections.
1034         (Output_section::Input_section_sort_section_order_index_compare
1035          ::operator()): Group sections according to prefixes.
1036         (Output_section::sort_attached_input_sections): Add condition to
1037         Input_section_entry constructor call.
1038         * testsuite/Makefile.am (text_section_grouping): New test.
1039         * testsuite/Makefile.in: Regenerate.
1040         * testsuite/text_section_grouping.cc: New file.
1041         * testsuite/text_section_grouping.sh: New file.
1042
1043 2012-12-17  Nick Clifton  <nickc@redhat.com>
1044
1045         * Makefile.am: Add copyright notice.
1046         * NEWS: Likewise.
1047         * README: Likewise.
1048         * configure.ac: Likewise.
1049         * ftruncate.c: Likewise.
1050         * Makefile.in: Regenerate.
1051
1052 2012-12-14  Cary Coutant  <ccoutant@google.com>
1053
1054         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1055         --no-as-needed flag.
1056         (exception_separate_shared_12_test): Likewise.
1057         (incremental_copy_test): Likewise.
1058         * testsuite/Makefile.in: Regenerate.
1059
1060 2012-12-14  Cary Coutant  <ccoutant@google.com>
1061
1062         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1063         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1064
1065 2012-12-12  Alan Modra  <amodra@gmail.com>
1066
1067         * powerpc.cc (class Track_tls): New.
1068         (class Relocate, class Scan): Inherit Track_tls.
1069         (Target_powerpc::Scan::local, global): Track tls optimization
1070         and avoid creating plt entry for __tls_get_addr if all uses
1071         are optimized away.
1072         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1073
1074 2012-12-12  Alan Modra  <amodra@gmail.com>
1075
1076         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1077         Replace no_toc_optimize with toc_optimize.
1078         * output.h (Output_section::input_sections): Provide non-const variant.
1079         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1080         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1081         accessors.
1082         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1083         (class Sort_toc_sections): New.
1084         (Target_powerpc::do_finalize_sections): Sort toc sections.
1085         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1086
1087 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1088
1089         * testsuite/binary_unittest.cc (read_all): New function.
1090         (Sized_binary_test): Use it instead of ::read.
1091         * fileread.cc (do_read): Don't assume pread always reads the whole
1092         amount in a single call.
1093
1094 2012-12-10  Alan Modra  <amodra@gmail.com>
1095
1096         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1097         Set EM_PPC64 or EM_PPC here.
1098         (Target_selector_powerpc::do_recognize): Delete.
1099
1100 2012-12-10  Alan Modra  <amodra@gmail.com>
1101
1102         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1103         stub_table_.
1104         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1105
1106 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1107
1108         * testsuite/binary_unittest.cc (Sized_binary_test):
1109         Use open_descriptor rather than ::open.
1110
1111 2012-12-07  Alan Modra  <amodra@gmail.com>
1112
1113         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1114         typedef and invalid_address constant.
1115         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1116         instantiate constants.
1117
1118 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1119
1120         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1121         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1122         * aclocal.m4: Regenerate.
1123         * configure: Regenerate.
1124         * Makefile.in: Regenerate.
1125         * testsuite/Makefile.in: Regenerate.
1126
1127 2012-12-07  Alan Modra  <amodra@gmail.com>
1128
1129         * options.h (General_options): Add no_toc_optimize.
1130         * powerpc.cc (ok_lo_toc_insn): New function.
1131         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1132
1133 2012-12-06  Alan Modra  <amodra@gmail.com>
1134
1135         * options.h (General_options): Add plt_align, plt_static_chain,
1136         plt_thread_safe.  Update stub_group_size help text.
1137         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1138         for new plt_thread_safe_ var.
1139         (use_plt_offset): Correct comments.
1140         (Target_powerpc::do_relax): Look for thread creation symbols to
1141         determine default plt_thread_safe value.  Clear plt call stubs
1142         as well as branch stubs each iteration.
1143         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1144         insn constants.
1145         (l, hi, ha, write_insn): Move earlier.
1146         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1147         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1148         plt stubs too.
1149         (Stub_table::update_size): Adjust.
1150         (Stub_table::prev_size, set_prev_size): Delete.
1151         (Stub_table::stub_align): Let --plt-align affect result.
1152         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1153         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1154         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1155         (Stub_table::do_write): Support more stub variants.
1156
1157 2012-12-04  Alan Modra  <amodra@gmail.com>
1158
1159         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1160         (Target_powerpc::do_define_standard_symbols): New function.
1161
1162 2012-12-03  Alan Modra  <amodra@gmail.com>
1163
1164         * output.h: Formatting, whitespace.
1165
1166 2012-12-03  Alan Modra  <amodra@gmail.com>
1167
1168         * layout.h (Layout::get_executable_sections): Declare.
1169         * layout.cc (Layout::get_executable_sections): New function.
1170         * arm.cc (Target_arm::group_sections): Use it.
1171         (Arm_output_section::group_sections): Delete now redundant test.
1172         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1173         param to handle relative relocs.
1174         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1175         (Output_data_reloc::add_absolute): Adjust.
1176         (Output_data_reloc::add_relative): New function.
1177         (Output_data::reset_data_size): New function.
1178         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1179         (Output_section::set_addralign): New function.
1180         (Output_section::checkpoint_set_addralign): New function.
1181         (Output_section::clear_section_offsets_need_adjustment): New function.
1182         (Output_section::input_sections): Make public.
1183         * powerpc.cc (class Output_data_brlt_powerpc): New.
1184         (class Stub_table, class Stub_control): New.
1185         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1186         stub_table_, set_stub_table, stub_table): New vectors and accessor
1187         functions.
1188         (Target_powerpc::do_may_relax, do_relax, push_branch,
1189         new_stub_table, stub_tables, brlt_section, group_sections,
1190         add_branch_lookup_table, find_branch_lookup_table,
1191         write_branch_lookup_table, make_brlt_section): New functions.
1192         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1193         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1194         branch_info_): New vars.
1195         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1196         make call stubs here.
1197         (Output_data_glink): Remove all call stub handling from this class.
1198         (Target_powerpc::Scan::local, global): Save interesting branch
1199         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1200         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1201         functions on final link.
1202         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1203         Handle long branch destinations too.
1204         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1205         do_plt_address_for_local): Adjust lookup of plt call stubs.
1206
1207 2012-11-30  Alan Modra  <amodra@gmail.com>
1208
1209         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1210         relocs against protected symbols when building 32-bit shared libs.
1211
1212 2012-11-30  Alan Modra  <amodra@gmail.com>
1213
1214         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1215         param.  Call got_section() to make .got.  Update all callers
1216         and their callers and so on.
1217
1218 2012-11-30  Alan Modra  <amodra@gmail.com>
1219
1220         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1221         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1222         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1223         value if it already exists.
1224
1225 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1226
1227         PR gold/14858
1228         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1229
1230 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1231
1232         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1233         than bfc instruction for data sandboxing.
1234
1235 2012-11-08  Alan Modra  <amodra@gmail.com>
1236
1237         * po/POTFILES.in: Regenerate.
1238
1239 2012-11-05  Alan Modra  <amodra@gmail.com>
1240
1241         * configure.ac: Apply 2012-09-10 change to config.in here.
1242         * configure: Regenerate.
1243
1244 2012-11-05  Alan Modra  <amodra@gmail.com>
1245
1246         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1247         (struct Opd_ent): Use "Address" rather than "Offset".
1248         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1249         (Target_powerpc::got_section): Make public.
1250         (Target_powerpc::scan_relocs): Move code setting symbols..
1251         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1252         Create _SDA_BASE_ only when referenced.
1253
1254 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1255
1256         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1257         from last change.
1258
1259 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1260
1261         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1262         for offset_in_output_section parameter.
1263         (Sized_target::relocate_special_relocatable): Likewise.
1264         * arm.cc (Target_arm::relocate_relocs): Likewise.
1265         (Target_arm::relocate_special_relocatable): Likewise.
1266         * i386.cc (Target_i386::relocate_relocs): Likewise.
1267         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1268         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1269         * target-reloc.h (relocate_relocs): Likewise.
1270         * testsuite/testfile.cc (Target_test): Likewise.
1271         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1272         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1273
1274         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1275         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1276
1277         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1278         parameter, which is unused in the [!F_SETFD] case.
1279
1280         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1281         SYMNDX to off_t before comparing it to this->data_size().
1282         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1283         * incremental.cc (Output_section_incremental_inputs::do_write):
1284         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1285
1286         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1287
1288 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1289
1290         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1291         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1292         in EABI_VER5.
1293
1294 2012-10-29  Cary Coutant  <ccoutant@google.com>
1295
1296         * dwp.cc (usage): Add file and exit status parameters;
1297         add --help and --version options.
1298         (print_version): New function.
1299         (main): Add --help and --version options.
1300
1301 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1302
1303         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1304         final_layout_sequence.txt.
1305         * testsuite/Makefile.in: Regenerated.
1306
1307 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1308
1309         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1310         COMPILE generated by automake.
1311         (LINK1): Likewise.
1312         (CXXCOMPILE1): Likewise.
1313         (CXXLINK1): Likewise.
1314         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1315         (LINK): Likewise.
1316         (CXXCOMPILE): Likewise.
1317         (CXXLINK): Likewise.
1318         * testsuite/Makefile.in: Regenerated.
1319
1320 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1321
1322         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1323         on bad fwrite return.
1324
1325 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1326
1327         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1328         on val.
1329
1330 2012-10-23  Cary Coutant  <ccoutant@google.com>
1331
1332         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1333         * testsuite/Makefile.in: Regenerate.
1334         * testsuite/dwp_test.h: New source file.
1335         * testsuite/dwp_test_1.cc: New source file.
1336         * testsuite/dwp_test_1.s: New source file.
1337         * testsuite/dwp_test_1.sh: New source file.
1338         * testsuite/dwp_test_1b.cc: New source file.
1339         * testsuite/dwp_test_1b.s: New source file.
1340         * testsuite/dwp_test_2.cc: New source file.
1341         * testsuite/dwp_test_2.s: New source file.
1342         * testsuite/dwp_test_2.sh: New source file.
1343         * testsuite/dwp_test_main.cc: New source file.
1344         * testsuite/dwp_test_main.s: New source file.
1345
1346 2012-10-23  Cary Coutant  <ccoutant@google.com>
1347
1348         * dwp.h: New header file.
1349         * dwp.cc: New source file.
1350         * gold.h: Move shared declarations to system.h.
1351         * system.h: New header file.
1352         * Makefile.am: Add dwp.
1353         * Makefile.in: Regenerate.
1354
1355 2012-10-23  Cary Coutant  <ccoutant@google.com>
1356
1357         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1358         Dwarf_info_reader::read_from_pointer.
1359         (Dwarf_pubnames_table::read_header): Likewise.
1360         (Dwarf_pubnames_table::next_name): Likewise.
1361         (Dwarf_die::read_attributes): Likewise.
1362         (Dwarf_die::skip_attributes): Likewise.
1363         (Dwarf_info_reader::read_from_pointer): New function template.
1364         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1365         (Dwarf_pubnames_table): Likewise.
1366         (Dwarf_info_reader::read_from_pointer): New function template.
1367         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1368         Dwarf_pubnames_table ctor.
1369
1370 2012-10-23  Cary Coutant  <ccoutant@google.com>
1371
1372         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1373         abbrev_shndx.
1374         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1375         abbrev_shndx_.
1376         (Dwarf_info_reader::set_abbrev_shndx): New method.
1377         (Dwarf_info_reader::abbrev_shndx_): New data member.
1378
1379 2012-10-23  Cary Coutant  <ccoutant@google.com>
1380
1381         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1382         from object, not parameters.
1383         (Dwarf_info_reader::parse): Likewise.
1384         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1385         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1386         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1387         methods.
1388
1389 2012-10-23  Cary Coutant  <ccoutant@google.com>
1390
1391         * fileread.cc (Input_file::Input_file): New constructor.
1392         * fileread.h (class Input_file): Add new constructor.
1393
1394 2012-10-18  Alan Modra  <amodra@gmail.com>
1395
1396         PR gold/14727
1397         * object.cc (Relobj::is_section_name_included): Also match
1398         .sdata personality section.
1399
1400 2012-10-18  Alan Modra  <amodra@gmail.com>
1401
1402         * target-reloc.h (class Default_comdat_behavior): New, package up..
1403         (get_comdat_behaviour): ..this.
1404         (relocate_section): Add Relocate_comdat_behavior template arg,
1405         adjust code to suit.
1406         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1407         (Target_arm::scan_reloc_section): Likewise.
1408         * i386.cc (Target_i386::relocate_section): Likewise.
1409         * sparc.cc (Target_sparc::relocate_section): Likewise.
1410         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1411         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1412         * powerpc.cc (class Relocate_comdat_behavior): New.
1413         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1414         gold::relocate_section with new template arg.
1415
1416 2012-10-18  Alan Modra  <amodra@gmail.com>
1417
1418         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1419         dynamic relocs for GOT_TPREL got entries, without symbol if
1420         resolving locally.
1421         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1422         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1423         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1424
1425 2012-10-17  Alan Modra  <amodra@gmail.com>
1426
1427         PR gold/14726
1428         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1429
1430 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1431
1432         * layout.cc (Layout::include_section): Keep sections marked
1433         SHF_EXCLUDE when doing relocatable links.
1434
1435 2012-10-16  Alan Modra  <amodra@gmail.com>
1436
1437         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1438         (Target_powerpc::do_finalize_sections): Call it.
1439         (Output_data_save_res): New class and supporting functions.
1440         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1441         normal symbols defined in object files.
1442
1443 2012-10-12  Alan Modra  <amodra@gmail.com>
1444
1445         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1446         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1447         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1448         section if scan_opd_relocs not yet called.
1449         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1450
1451 2012-10-12  Alan Modra  <amodra@gmail.com>
1452
1453         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1454         add_local_ifunc_entry): Revert last change.
1455         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1456
1457 2012-10-05  Alan Modra  <amodra@gmail.com>
1458
1459         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1460         do_plt_address_for_global): New functions.
1461         (Output_data_got_powerpc::do_write): Don't segfault when linking
1462         statically.
1463         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1464         add_local_ifunc_entry): Return true on adding entry..
1465         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1466         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1467         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1468         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1469         set up symbols here.
1470         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1471         syms here.  Do so even when no .iplt.  Don't segfault when linking
1472         statically.
1473         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1474         new variants without reloc param.
1475         (Glink_sym_ent::Glink_sym_ent): Likewise.
1476         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1477         reloc when refs will resolve to plt call stub.
1478         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1479         R_PPC_PLTREL24 to resolve locally.
1480         (Target_powerpc::Scan::global): Correct ifunc handling.
1481         (Target_powerpc::Relocate::relocate): Correct local sym glink
1482         lookup.  Don't destroy "value" when we have a plt call stub,
1483         and when checking plt call validity.
1484         (Target_powerpc::do_dynsym_value): Simplify.
1485
1486 2012-10-05  Alan Modra  <amodra@gmail.com>
1487
1488         * i386.cc (Output_data_plt_i386::address_for_global,
1489         address_for_local): Add plt offset to returned value.  Adjust uses.
1490         * sparc.cc (Output_data_plt_sparc::address_for_global,
1491         address_for_local): Likewise.
1492         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1493         address_for_local): Likewise.
1494         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1495         address_for_local): Likewise.
1496         * target.h (Target::plt_address_for_global, plt_address_for_local):
1497         Update comment.
1498         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1499         (Output_data_got::Got_entry::write): Nor here.
1500         * output.h: Comment fix.
1501
1502 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1503
1504         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1505         global_offset_table_ value for larget got.
1506         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1507
1508 2012-09-29  Alan Modra  <amodra@gmail.com>
1509
1510         * powerpc.cc (Target_powerpc::iplt_): New output section.
1511         (Target_powerpc::iplt_section, make_iplt_section,
1512         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1513         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1514         Target_powerpc::plt_entry_count): Count iplt entries too.
1515         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1516         reloc section in constructor.  New params.
1517         (Target_powerpc::make_plt_section): Create reloc section here instead.
1518         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1519         functions.
1520         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1521         (Output_data_glink::add_entry, find_entry): New functions to
1522         deal with local syms.
1523         (Glink_sym_ent): Add support for local syms.
1524         (Output_data_glink::do_write): Handle ifunc plt entries.
1525         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1526         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1527         (Target_powerpc::Relocate::relocate): Likewise.
1528         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1529
1530 2012-09-25  Alan Modra  <amodra@gmail.com>
1531
1532         * object.h (Sized_relobj_file::adjust_local_symbol,
1533         do_adjust_local_symbol): New functions.
1534         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1535         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1536         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1537         and irregular opd entry spacing.
1538         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1539         (Global_symbol_visitor_opd): New functor.
1540         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1541         on deleted opd entries.
1542
1543 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1544
1545         * tilegx.cc: New file.
1546         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1547         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1548         * configure.tgt: Add entries for tilegx*.
1549         * configure.ac: Likewise.
1550         * Makefile.in: Rebuild.
1551         * configure: Likewise.
1552         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1553         tilegx.
1554
1555 2012-09-13  Alan Modra  <amodra@gmail.com>
1556
1557         * target-reloc.h (scan_relocs): Call scan.local for relocs
1558         against symbols in discarded sections.  Pass is_discarded
1559         param.
1560         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1561         Add is_discarded param.
1562         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1563         is_discarded to flag opd entry as discarded.  Don't emit dyn
1564         relocs on such entries.
1565         (Target_powerpc::Scan::global): Similarly detect and handle
1566         such opd entries.
1567         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1568         opd_ent_.  Update all uses.
1569         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1570         (Target_powerpc::relocate_section): Zero out discarded opd
1571         entry relocs.
1572
1573 2012-09-12  Ian Lance Taylor  <iant@google.com>
1574
1575         PR gold/14570
1576         * output.cc: Rename Output_data_got template parameter from size
1577         to got_size for all functions.  Compile all variants of
1578         Output_data_got.
1579         (Output_data_got::Got_entry::write): Correct use of size for
1580         symbol value.  Use local_is_tls rather than casting to
1581         Sized_relobj_file.
1582         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1583         (class Sized_relobj_file): Add do_local_is_tls.
1584         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1585
1586 2012-09-11  Alan Modra  <amodra@gmail.com>
1587
1588         PR gold/14566
1589         * layout.cc (Layout::set_segment_offsets): When using
1590         common-page-size alignment, ensure we are on a new max-page-size
1591         page.
1592         * output.cc (Output_segment::set_section_addresses): Use
1593         abi_pagesize, not common_pagesize for relro boundary.
1594         (Output_segment::set_offset): Likewise.
1595
1596 2012-09-11  Alan Modra  <amodra@gmail.com>
1597
1598         * output.h (Output_data_got::add_global_tls, add_local_tls,
1599         add_local_tls_pair): New functions.
1600         (Output_data_got::add_local_pair_with_rel): Remove second
1601         reloc param.  Expand comment.
1602         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1603         use_plt_or_tls_offset_, similarly for constructor param.
1604         (Output_data_got::Got_entry::write): Add got_index param.
1605         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1606         add_local_tls_pair): New functions.
1607         (Output_data_got::Got_entry::write): Handle tls symbols
1608         with use_plt_or_tls_offset_ set specially.
1609         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1610         (Output_data_got::do_write): Replace iterator with index, pass
1611         index to entry write function.
1612         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1613         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1614         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1615         call.
1616         * i386.cc (Target_i386::Scan::local): Likewise.
1617         * sparc.cc (Target_sparc::Scan::local): Likewise.
1618         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1619         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1620         do_tls_offset_for_global): New functions.
1621         (Target_powerpc::Scan::local): Correct TLS relocations and got
1622         entry values.
1623         (Target_powerpc::Scan::global): Don't emit unnecessary
1624         dynamic relocations on TLS GOT entries.
1625
1626 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1627
1628         * config.in: Disable sanity check for kfreebsd.
1629
1630 2012-09-10  Sterling Augustine  <saugustine@google.com>
1631
1632         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1633         (Gdb_index::pubtypes_read): New parameter.
1634         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1635         to calls.
1636         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1637         pubtypes_object_.
1638
1639 2012-09-09  Alan Modra  <amodra@gmail.com>
1640
1641         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1642         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1643         * gc.h (gc_process_relocs): Call target gc_add_reference.
1644         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1645         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1646         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1647         unnecessary cast.
1648         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1649         to cater for when we don't need code offset.  Update use.
1650         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1651         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1652         set_opd_valid): New functions.
1653         (Target_powerpc::do_gc_add_reference): New function.
1654         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1655         stashed refs.
1656         (Target_powerpc::do_gc_mark_symbol): New function.
1657
1658 2012-09-06  Cary Coutant  <ccoutant@google.com>
1659
1660         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1661         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1662         (Dwarf_die::skip_attributes): Likewise.
1663         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1664         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1665         (main): Call it.
1666         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1667
1668 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1669
1670         * testsuite/script_test_3.t: Add .got.plt output section
1671         statement.
1672         * testsuite/script_test_4.t: Likewise.
1673
1674 2012-09-05  Alan Modra  <amodra@gmail.com>
1675
1676         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1677         update all uses and lose "enum" when using type.
1678
1679 2012-09-05  Alan Modra  <amodra@gmail.com>
1680
1681         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1682         * configure: Regenerate.
1683         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1684         (plugin_final_layout.stdout): Likewise.
1685         (memory_test): Set page sizes to 0x1000.
1686         * testsuite/Makefile.in: Regenerate.
1687         * testsuite/discard_locals_test.sh: Add FIXME comment.
1688         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1689         * testsuite/pr14265.t: Add .got output section statement.
1690         * testsuite/script_test_2.t: Likewise.
1691         * testsuite/script_test_3.t: Likewise.
1692         * testsuite/script_test_4.t: Likewise.
1693         * testsuite/script_test_5.t: Likewise.
1694         * testsuite/script_test_6.t: Likewise.
1695         * testsuite/script_test_7.t: Likewise.
1696         * testsuite/script_test_9.t: Likewise.
1697
1698 2012-09-05  Alan Modra  <amodra@gmail.com>
1699
1700         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1701         (Powerpc_relocate_functions::Status): New typedef.
1702         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1703         (Target_powerpc::Scan::local): Handle REL64.
1704         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1705         for REL32 and REL64.
1706         (Target_powerpc::symval_for_branch): New function, extracted from..
1707         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1708         checks.  Report overflow errors.
1709
1710 2012-09-05  Alan Modra  <amodra@gmail.com>
1711
1712         * object.h (Sized_relobj_file::emit_relocs): Delete.
1713         (Sized_relobj_file::emit_relocs_reltype): Delete.
1714         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1715         relocate_relocs for --emit-relocs.
1716         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1717         * output.h: Update comment.
1718         (Output_segment::first_section): New function.
1719         (Output_segment::first_section_load_address): Use first_section.
1720         * output.cc (Output_segment::first_section): New function extracted..
1721         (Output_segment::first_section_load_address): ..from here.  Delete.
1722         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1723         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1724         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1725         adjust call to target.h function.
1726         * i386.cc (Target_i386): Likewise.
1727         * sparc.cc (Target_sparc): Likewise.
1728         * x86_64.cc (Target_x86_64): Likewise.
1729         * powerpc.cc (Target_powerpc): Likewise.
1730         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1731         first tls section has section symbol for optimised local dynamic
1732         output relocs.
1733         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1734         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1735         optimised tls code.
1736         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1737         Rename to relocate_relocs.  Update error message.
1738
1739 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1740
1741         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1742         --just-symbols.
1743
1744 2012-08-31  Alan Modra  <amodra@gmail.com>
1745
1746         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1747         (Powerpc_relobj::toc_base_offset): New stub function.
1748         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1749         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1750         (Target_powerpc::Relocate::enum skip_tls): New.
1751         (Target_powerpc::call_tls_get_addr_): New var.
1752         (Target_powerpc::is_branch_reloc): Move to file scope.
1753         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1754         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1755         New functions.
1756         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1757         (powerpc_info): Correct common_pagesize for ppc64.
1758         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1759         (Powerpc_relocate_functions): Add overflow check enums and functions.
1760         Add non-shift version of rela, rela_ua.  Delete all rel public
1761         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1762         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1763         addr16_ha3, addr14 functions.
1764         (Output_data_got_powerpc::add_constant_pair): New function.
1765         (Output_data_got_powerpc::got_base_offset): Likewise.
1766         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1767         (instruction constants): Sort, add some more.
1768         (Output_data_glink::do_write): Add and use Address typedef.  Use
1769         object->toc_base_offset() stub for 64-bit.
1770         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1771         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1772         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1773         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1774         Always treat .opd relocs as against locally defined symbol.
1775         Correct condition for RELATIVE relocs.
1776         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1777         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1778         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1779         calculations.  Handle TLS relocs, and more.  Add overflow
1780         checking and adjust for Powerpc_relocate_functions changes.
1781         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1782         Reinstate --emit-relocs code with FIXME.
1783
1784 2012-08-30  Alan Modra  <amodra@gmail.com>
1785
1786         * layout.cc (Layout::set_segment_offsets): Set p_align to
1787         abi_pagesize, not common_pagesize.
1788         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1789         to determine whether file header can go in segment.
1790
1791 2012-08-30  Alan Modra  <amodra@gmail.com>
1792
1793         * output.h (Output_reloc::Output_reloc <output section>): Add
1794         is_relative param.  Adjust calls.
1795         (Output_reloc::add_output_section_relative): New functions.
1796         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1797         is_relative.
1798         (Output_reloc::symbol_value): Handle SECTION_CODE.
1799
1800 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1801
1802         * gold.cc (queue_middle_tasks): Call layout again when unique
1803         segments for sections is desired.
1804         * layout.cc (Layout::Layout): Initialize new members.
1805         (Layout::get_output_section_flags): New function.
1806         (Layout::choose_output_section): Call get_output_section_flags.
1807         (Layout::layout): Make output section for mapping to a unique segment.
1808         (Layout::insert_section_segment_map): New function.
1809         (Layout::attach_allocated_section_to_segment): Make unique segment for
1810         output sections marked so.
1811         (Layout::segment_precedes): Check for unique segments when sorting.
1812         * layout.h (Layout::Unique_segment_info): New struct.
1813         (Layout::Section_segment_map): New typedef.
1814         (Layout::insert_section_segment_map): New function.
1815         (Layout::get_output_section_flags): New function.
1816         (Layout::is_unique_segment_for_sections_specified): New function.
1817         (Layout::set_unique_segment_for_sections_specified): New function.
1818         (Layout::unique_segment_for_sections_specified_): New member.
1819         (Layout::section_segment_map_): New member.
1820         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1821         Rename is_gc_pass_one to is_pass_one.
1822         Rename is_gc_pass_two to is_pass_two.
1823         Rename is_gc_or_icf to is_two_pass.
1824         Check for which pass based on whether symbols data is present.
1825         Make it two pass when unique segments for sections is desired.
1826         * output.cc (Output_section::Output_section): Initialize new
1827         members.
1828         * output.h (Output_section::is_unique_segment): New function.
1829         (Output_section::set_is_unique_segment): New function.
1830         (Output_section::is_unique_segment_): New member.
1831         (Output_section::extra_segment_flags): New function.
1832         (Output_section::set_extra_segment_flags): New function.
1833         (Output_section::extra_segment_flags_): New member.
1834         (Output_section::segment_alignment): New function.
1835         (Output_section::set_segment_alignment): New function.
1836         (Output_section::segment_alignment_): New member.
1837         (Output_segment::Output_segment): Initialize is_unique_segment_.
1838         (Output_segment::is_unique_segment): New function.
1839         (Output_segment::set_is_unique_segment): New function.
1840         (Output_segment::is_unique_segment_): New member.
1841         * plugin.cc (allow_unique_segment_for_sections): New function.
1842         (unique_segment_for_sections): New function.
1843         (Plugin::load): Add new functions to transfer vector.
1844         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1845         * Makefile.in: Regenerate.
1846         * testsuite/plugin_final_layout.sh: Check if unique segment
1847         functionality works.
1848         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1849         are available.
1850         (allow_unique_segment_for_sections): New global.
1851         (unique_segment_for_sections): New global.
1852         (claim_file_hook): Call allow_unique_segment_for_sections.
1853         (all_symbols_read_hook): Call unique_segment_for_sections.
1854
1855 2012-08-22  Cary Coutant  <ccoutant@google.com>
1856
1857         * layout.cc (Layout::include_section): Don't assert on GROUP
1858         sections with --emit-relocs.
1859
1860 2012-08-21  Cary Coutant  <ccoutant@google.com>
1861
1862         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1863         if --export-dynamic-symbol names an undef symbol.
1864
1865 2012-08-18  Alan Modra  <amodra@gmail.com>
1866
1867         * powerpc.cc: Formatting and white space.
1868         (Powerpc_relobj): Rename got2_section_ to special_.
1869         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1870         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1871         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1872         (Target_powerpc): Add Address typedef and invalid_address.  Use
1873         throughout.
1874         (Target_powerpc::is_branch_reloc): New function.
1875         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1876         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1877         for dst_mask, value and addend.
1878         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1879         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1880         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1881         uint16_t for 24-bit offset.  Use get_output_section_offset and
1882         check return.
1883         (Target_powerpc::Scan::local): Handle more relocs.
1884         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1885         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1886         Plug in toc restoring insn after plt calls.  Translate branches
1887         to function descriptor symbols to corresponding entry point.
1888         (Target_powerpc::relocate_for_relocatable): Check return from
1889         get_output_section_offset.
1890         * symtab.h: Comment typo.
1891
1892 2012-08-14  Ian Lance Taylor  <iant@google.com>
1893
1894         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1895         unsupported_relocal_local to call unsupported_reloc_global.
1896
1897 2012-08-14  Nick Clifton  <nickc@redhat.com>
1898
1899         PR ld/14265
1900         * script-sections.cc (Sections_element::output_section_name): Add
1901         keep return parameter.
1902         (Output_section_element::match_name): Add keep return parameter.
1903         Return the value of the keep_ member.
1904         * script-sections.h (class Output_section): Update
1905         output_section_name prototype.
1906         * layout.cc (Layout::keep_input_section): New public member
1907         function.
1908         (Layout::choose_output_section): Pass keep parameter to
1909         output_section_name.
1910         * layout.h (class Layout): Add keep_input_section.
1911         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1912         sections.
1913         * testsuite/Makefile.am: Add a test.
1914         * testsuite/Makefile.in: Regenerate.
1915         * testsuite/pr14265.c: Source file for the test.
1916         * testsuite/pr14265.t: Linker script for the test.
1917         * testsuite/pr14265.sh: Shell script for the test.
1918
1919 2012-08-14  Alan Modra  <amodra@gmail.com>
1920
1921         * target.h (Target::output_section_name): New function.
1922         (Target::do_output_section_name): New function.
1923         * layout.cc (Layout::choose_output_section): Call the above.
1924         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1925
1926 2012-08-14  Alan Modra  <amodra@gmail.com>
1927
1928         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1929         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1930         for replace_constant call.
1931         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1932         (Output_data_glink::do_print_to_mapfile): New function.
1933         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1934         (Target_powerpc::Relocate::relocate): Likewise.
1935
1936 2012-08-14  Alan Modra  <amodra@gmail.com>
1937
1938         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1939         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1940         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1941         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1942         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1943         here.
1944         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1945         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1946         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1947         here.
1948         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1949         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1950
1951 2012-08-12  Alan Modra  <amodra@gmail.com>
1952
1953         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1954         (glink insn constants): Use uint32_t.
1955         (Output_data_glink::add_entry): Use insert, not [] operator.
1956
1957 2012-08-11  Alan Modra  <amodra@gmail.com>
1958
1959         * object.h (Sized_relobj_file::find_shdr): New function.
1960         (Sized_relobj_file::find_special_sections): New function.
1961         * object.cc (Sized_relobj_file::find_shdr): New function.
1962         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1963         (Sized_relobj_file::find_special_sections): New function, split out..
1964         (Sized_relobj_file::do_read_symbols): ..from here.
1965         * output.h (Output_data_got::replace_constant): New function.
1966         (Output_data_got::num_entries): New function.
1967         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1968         (Output_data_got::got_offset): Protected rather than private.
1969         (Output_data_got::replace_got_entry): New function.
1970         * output.cc (Output_data_got::replace_got_entry): New function.
1971         * powerpc.cc (class Powerpc_relobj): New.
1972         (class Powerpc_relocate_functions): Delete all psymval variants or
1973         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1974         Implement _ha functions using corresponding _hi function.
1975         (Powerpc_relobj::find_special_sections): New function.
1976         (Target_powerpc::do_make_elf_object): New function.
1977         (class Output_data_got_powerpc): New.
1978         (class Output_data_glink): New.
1979         (class Powerpc_scan_relocatable_reloc): New.
1980         Many more changes througout file.
1981
1982 2012-08-09  Nick Clifton  <nickc@redhat.com>
1983
1984         * po/vi.po: Updated Vietnamese translation.
1985
1986 2012-08-07  Ian Lance Taylor  <iant@google.com>
1987
1988         * layout.cc (Layout::add_target_dynamic_tags): If
1989         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1990         plt_rel.
1991
1992 2012-07-30  Nick Clifton  <nickc@redhat.com>
1993
1994         * po/gold.pot: Updated template.
1995         * po/es.po: Updated Spanish translation.
1996
1997 2012-07-18  Cary Coutant  <ccoutant@google.com>
1998
1999         PR gold/14344
2000         * configure.ac: Add check for -gpubnames support.
2001         * configure: Regenerate.
2002         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2003         support; force -gno-pubnames.
2004         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2005         support.
2006         (gdb_index_test_4): New test.
2007         * testsuite/Makefile.in: Regenerate.
2008         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2009         * testsuite/gdb_index_test_2.sh: Likewise.
2010         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2011         * testsuite/gdb_index_test_4.sh: New script.
2012         * testsuite/gdb_index_test_comm.sh: New script with common code;
2013         don't look for space after colon.
2014
2015 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2016
2017         * gold.cc (queue_middle_tasks): Update function order only after
2018         deferred objects due to plugins are processed.
2019
2020 2012-07-11  Ian Lance Taylor  <iant@google.com>
2021
2022         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2023         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2024         (Target_arm::scan_reloc_for_stub): Likewise.
2025         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2026         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2027         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2028         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2029         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2030
2031 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2032             Ian Lance Taylor  <iant@google.com>
2033
2034         PR gold/14309
2035         * configure.ac: Test whether std::tr1::hash<off_t> works.
2036         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2037         needed.
2038         * output.h (class Output_fill): Add virtual destructor.
2039         * configure, config.in: Rebuild.
2040
2041 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2042
2043         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2044
2045 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2046
2047         * plugin.cc (Plugin::load): Handle position independent executables.
2048
2049 2012-06-06  Cary Coutant  <ccoutant@google.com>
2050
2051         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2052         add .debug_macro.
2053         (lines_only_debug_sections): Likewise.
2054         (gdb_fast_lookup_sections): New static array.
2055         (is_gdb_debug_section): Rename formal parameter.
2056         (is_lines_only_debug_section): Likewise.
2057         (is_gdb_fast_lookup_section): New function.
2058         (Layout::include_section): Check for ".zdebug_" prefix; pass
2059         section name suffix to is_gdb_debug_section, et al.; check for
2060         fast-lookup sections when building .gdb_index.
2061         * options.h (--strip-debug-gdb): Update GDB version number.
2062
2063 2012-06-06  Cary Coutant  <ccoutant@google.com>
2064
2065         * configure.ac: Add check for fallocate.
2066         * configure: Regenerate.
2067         * config.in: Regenerate.
2068
2069         * options.h (class General_options): Add --mmap-output-file and
2070         --posix-fallocate options.
2071         * output.cc: (posix_fallocate): Remove; replace with...
2072         (gold_fallocate): New function.
2073         (Output_file::map_no_anonymous): Call gold_fallocate.
2074         (Output_file::map): Check --mmap-output-file option.
2075
2076 2012-06-05  Jing Yu  <jingyu@google.com>
2077
2078         * gold.h (textdomain): Add do {} to empty while(0).
2079         (bindtextdomain): Likewise.
2080
2081 2012-06-04  Cary Coutant  <ccoutant@google.com>
2082
2083         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2084         has_dynsym_index.
2085
2086 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2087
2088         * symtab.cc (Symbol_table::define_special_symbol):
2089         Initialize *poldsym to prevent uninitialized variable errors.
2090
2091 2012-05-23  Cary Coutant  <ccoutant@google.com>
2092
2093         * layout.cc (Layout::section_name_mapping): Add rules to handle
2094         exact match on .data.rel.ro.local or .data.rel.ro.
2095         (Layout::output_section_name): Check for exact matches.
2096
2097 2012-05-23  Cary Coutant  <ccoutant@google.com>
2098
2099         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2100         more carefully.
2101
2102 2012-05-22  Cary Coutant  <ccoutant@google.com>
2103
2104         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2105         object before exporting symbol.
2106
2107 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2108
2109         * testsuite/tls_test.cc: Include "config.h" first.
2110         * testsuite/tls_test_c.c: Likewise.
2111
2112 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2113             Nick Clifton  <nickc@redhat.com>
2114
2115         PR 14072
2116         * configure.in: Add check that sysdep.h has been included before
2117         any system header files.
2118         * configure: Regenerate.
2119         * config.in: Regenerate.
2120
2121 2012-05-14  Cary Coutant  <ccoutant@google.com>
2122
2123         * layout.cc (Layout::make_output_section): Mark .tdata section
2124         as RELRO.
2125         * testsuite/relro_test.cc: Add a TLS variable.
2126
2127 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2128
2129         PR gold/14091
2130         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2131         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2132         R_X86_64_64.
2133
2134 2012-05-08  Cary Coutant  <ccoutant@google.com>
2135
2136         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2137         (lines_only_debug_sections): Likewise.
2138
2139 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2140
2141         * nacl.cc: New file.
2142         * nacl.h: New file.
2143         * Makefile.am (CCFILES, HFILES): Add them.
2144         * Makefile.in: Regenerate.
2145         * i386.cc (Output_data_plt_i386_nacl): New class.
2146         (Output_data_plt_i386_nacl_exec): New class.
2147         (Output_data_plt_i386_nacl_dyn): New class.
2148         (Target_i386_nacl): New class.
2149         (Target_selector_i386_nacl): New class.
2150         (target_selector_i386): Use it instead of Target_selector_i386.
2151         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2152         (Target_x86_64_nacl): New class.
2153         (Target_selector_x86_64_nacl): New class.
2154         (target_selector_x86_64, target_selector_x32): Use it instead of
2155         Target_selector_x86_64.
2156         * arm.cc (Output_data_plt_arm_nacl): New class.
2157         (Target_arm_nacl): New class.
2158         (Target_selector_arm_nacl): New class.
2159         (target_selector_arm, target_selector_armbe): Use it instead of
2160         Target_selector_arm.
2161
2162         * target-select.cc (select_target): Take new Input_file* and off_t
2163         arguments, pass them on to recognize method of selector.
2164         * object.cc (make_elf_sized_object): Update caller.
2165         * parameters.cc (parameters_force_valid_target): Likewise.
2166         * incremental.cc (make_sized_incremental_binary): Likewise.
2167         * target-select.h: Update decl.
2168         (Target_selector::recognize): Take new Input_file* argument,
2169         pass it on to do_recognize.
2170         (Target_selector::do_recognize): Take new Input_file* argument.
2171         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2172         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2173         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2174         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2175
2176         * target.h (Target::Target_info): New members isolate_execinstr
2177         and rosegment_gap.
2178         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2179         * arm.cc (Target_arm::arm_info): Update initializer.
2180         * i386.cc (Target_i386::i386_info): Likewise.
2181         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2182         * sparc.cc (Target_sparc::sparc_info): Likewise.
2183         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2184         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2185         * layout.cc (Layout::attach_allocated_section_to_segment):
2186         Take new const Target* argument.  If target->isolate_execinstr(), act
2187         like --rosegment.
2188         (Layout::find_first_load_seg): Take new const Target* argument;
2189         if target->isolate_execinstr(), reject PF_X segments.
2190         (Layout::relaxation_loop_body): Update caller.
2191         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2192         reset file offset to zero when we hit LOAD_SEG, and then do a second
2193         loop over the segments before LOAD_SEG to reassign offsets after
2194         addresses have been determined.  Handle target->rosegment_gap().
2195         (Layout::attach_section_to_segment): Take new const Target* argument;
2196         pass it to attach_allocated_section_to_segment.
2197         (Layout::make_output_section): Update caller.
2198         (Layout::attach_sections_to_segments): Take new const Target* argument;
2199         pass it to attach_section_to_segment.
2200         * gold.cc (queue_middle_tasks): Update caller.
2201         * layout.h (Layout): Update method decls with new arguments.
2202
2203         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2204         Target_info pointer to use.
2205         (Target_arm::do_make_data_plt): New virtual method.
2206         (Target_arm::make_data_plt): New method that calls it.
2207         (Target_arm::make_plt_entry): Use it.
2208         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2209         for the section alignment.
2210         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2211         method.
2212         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2213         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2214         method.
2215         (Output_data_plt_arm::get_plt_entry_size): Call it.
2216         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2217         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2218         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2219         method.
2220         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2221         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2222         method instead of sizeof(plt_entry).
2223         (Output_data_plt_arm::add_entry): Likewise.
2224         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2225         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2226         than static method.
2227         (Target_arm::plt_entry_size): Likewise.
2228         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2229         Move to ...
2230         (Output_data_plt_arm_standard): ... here, new class.
2231         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2232         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2233         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2234
2235         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2236         Take additional argument for the PLT entry size.
2237         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2238         Use get_plt_entry_size method rather than plt_entry_size variable.
2239         (Output_data_plt_x86_64::reserve_slot): Likewise.
2240         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2241         (Output_data_plt_x86_64::add_entry): Likewise.
2242         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2243         (Output_data_plt_x86_64::address_for_global): Likewise.
2244         (Output_data_plt_x86_64::address_for_local): Likewise.
2245         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2246         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2247         Make method non-static.
2248         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2249         method.
2250         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2251         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2252         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2253         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2254         virtual method.
2255         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2256         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2257         virtual method.
2258         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2259         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2260         virtual method.
2261         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2262         (Output_data_plt_x86_64::plt_entry_size)
2263         (Output_data_plt_x86_64::first_plt_entry)
2264         (Output_data_plt_x86_64::plt_entry)
2265         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2266         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2267         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2268         (Output_data_plt_x86_64_standard): ... here, new class.
2269         (Target_x86_64::Target_x86_64): Take optional argument for the
2270         Target_info pointer to use.
2271         (Target_x86_64::do_make_data_plt): New virtual method.
2272         (Target_x86_64::make_data_plt): New method to call it.
2273         (Target_x86_64::init_got_plt_for_update): Use that.
2274         Call this->plt_->add_eh_frame method here.
2275         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2276         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2277         rather than static method.
2278         (Target_x86_64::plt_entry_size): Likewise.
2279         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2280         rather than plt_entry_size variable.  Move guts of PLT filling to...
2281         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2282         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2283         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2284
2285         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2286         additional argument for the section alignment.
2287         Don't do add_eh_frame_for_plt here.
2288         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2289         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2290         variable.
2291         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2292         method.
2293         (Output_data_plt_i386::get_plt_entry_size): Call it.
2294         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2295         (Output_data_plt_i386::add_eh_frame): New method to call it.
2296         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2297         method.
2298         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2299         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2300         method.
2301         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2302         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2303         method instead of plt_entry_size.
2304         (Output_data_plt_i386::plt_entry_size)
2305         (Output_data_plt_i386::plt_eh_frame_fde_size)
2306         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2307         (Output_data_plt_i386_standard): ... here, new class.
2308         (Output_data_plt_i386_exec): New class.
2309         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2310         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2311         (Output_data_plt_i386::exec_plt_entry): Move to ...
2312         (Output_data_plt_i386_exec::plt_entry): ... here.
2313         (Output_data_plt_i386_dyn): New class.
2314         (Output_data_plt_i386::first_plt_entry): Move to ...
2315         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2316         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2317         (Output_data_plt_i386_dyn::plt_entry): ... here.
2318         (Target_i386::Target_i386): Take optional argument for the Target_info
2319         pointer to use.
2320         (Target_i386::do_make_data_plt): New virtual method.
2321         (Target_i386::make_data_plt): New method to call it.
2322         (Target_i386::make_plt_section): Use that.
2323         Call this->plt_->add_eh_frame method here.
2324         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2325         rather than plt_entry_size variable.
2326         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2327         (Output_data_plt_i386::address_for_local): Likewise.
2328         (Output_data_plt_i386::do_write): Likewise.
2329         Move guts of PLT filling to...
2330         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2331         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2332         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2333         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2334
2335 2012-05-01  Cary Coutant  <ccoutant@google.com>
2336
2337         * dwarf_reader.cc (Dwarf_die::read_attributes)
2338         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2339         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2340         * reduced_debug_output.cc
2341         (Output_reduced_debug_info_section::get_die_end): Remove
2342         DW_FORM_GNU_ref_index.  Add default case.
2343
2344 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2345
2346         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2347         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2348         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2349         DW_AT_high_pc as offset from DW_AT_low_pc.
2350
2351         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2352         * testsuite/Makefile.in: Regenerate.
2353         * testsuite/gdb_index_test_3.c: New test source file.
2354         * testsuite/gdb_index_test_3.sh: New test source file.
2355
2356 2012-04-25  Ian Lance Taylor  <iant@google.com>
2357
2358         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2359         pointer.
2360         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2361         as a class, not a struct.
2362         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2363         (Target_arm::apply_cortex_a8_workaround): Likewise.
2364         * gc.h: Declare Reloc_types as a struct, not a class.
2365         * object.h: Declare Symbols_data as a struct.
2366         * reloc.h: Declare Read_relocs_data as a struct.
2367         * target.h: Declare Relocate_info as a struct.
2368
2369 2012-04-24  David S. Miller  <davem@davemloft.net>
2370
2371         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2372         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2373         and R_SPARC_WPLT30.
2374
2375 2012-04-24  Cary Coutant  <ccoutant@google.com>
2376
2377         * incremental-dump.cc (find_input_containing_global): Replace
2378         magic number with symbolic constant.
2379         (dump_incremental_inputs): Update version number.
2380         * incremental.cc (Output_section_incremental_inputs): Update version
2381         number; import symbolic constants from Incremental_inputs_reader.
2382         (Incremental_inputs::create_data_sections): Align relocations
2383         section correctly for 64-bit targets.
2384         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2385         constants; add padding.
2386         (Output_section_incremental_inputs::write_header): Add assert for
2387         header_size.
2388         (Output_section_incremental_inputs::write_input_files): Add assert
2389         for input_entry_size.
2390         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2391         add assert for object_info_size, input_section_entry_size,
2392         global_sym_entry_size.
2393         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2394         for data structure sizes; use them.
2395         (Incremental_input_entry_reader): Import symbolic constants from
2396         Incremental_inputs_reader; use them.
2397
2398 2012-04-23  David S. Miller  <davem@davemloft.net>
2399
2400         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2401         and elf_flags_set_.
2402         (Target_sparc::Target_sparc): Initialize new fields.
2403         (Target_sparc::do_make_elf_object): New function.
2404         (Target_sparc::do_adjust_elf_header): New function.
2405
2406 2012-04-23  Cary Coutant  <ccoutant@google.com>
2407
2408         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2409         CU range table of gdb index.
2410
2411 2012-04-20  David S. Miller  <davem@davemloft.net>
2412
2413         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2414         instead of false.
2415
2416 2012-04-16  David S. Miller  <davem@davemloft.net>
2417
2418         * sparc.cc (Target_sparc::got_address): New function.
2419         (Sparc_relocate_functions::gdop_hix22): New function.
2420         (Sparc_relocate_functions::gdop_lox10): New function.
2421         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2422         relocs.
2423         (Target_sparc::Scan::local): Likewise if the global symbol is not
2424         preemptible and is not IFUNC.
2425         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2426         transformations for local and non-preemptible non-IFUNC global
2427         symbols.
2428
2429         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2430         writing out 64-bit part of ranges.
2431
2432         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2433         -fpic and -fpie respectively.
2434         * Makefile.in: Regenerate.
2435
2436         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2437         (Target_sparc::Target_sparc): Initialize new field.
2438         (Target_sparc::do_plt_section_for_global): New function.
2439         (Target_sparc::do_plt_section_for_local): New function.
2440         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2441         (Target_sparc::make_plt_section): New function, broken out of
2442         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2443         (Target_sparc::make_plt_entry): Call make_plt_section.
2444         (Target_sparc::make_local_ifunc_plt_entry): New function.
2445         (Target_sparc::rela_ifunc_section): New function.
2446         (Target_sparc::plt_section): Remove const.
2447         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2448         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2449         and ifunc_count_ fields.
2450         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2451         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2452         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2453         (Output_data_plt_sparc::rela_ifunc): New function.
2454         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2455         (Output_data_plt_sparc::has_ifunc_section): New function.
2456         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2457         (Output_data_plt_sparc::address_for_global): New function.
2458         (Output_data_plt_sparc::address_for_local): New function.
2459         (Output_data_plt_sparc::plt_index_to_offset): New function.
2460         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2461         and entry_count.
2462         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2463         entry_count.
2464         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2465         R_SPARC_JMP_IREL to switch.
2466         (Target_sparc::Scan::check_non_pic): Likewise.
2467         (Target_sparc::Scan::local): Handle IFUNC symbols.
2468         (Target_sparc::Scan::local): Likewise.
2469         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2470         and plt_address_for_local.
2471         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2472         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2473
2474         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2475         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2476         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2477         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2478         global relocs too.
2479         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2480         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2481         calls.
2482         * sparc.cc (Target_sparc::Scan::global): Likewise.
2483         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2484
2485 2012-04-16  Cary Coutant  <ccoutant@google.com>
2486
2487         * archive.cc (Library_base::should_include_member): Check for
2488         --export-dynamic-symbol.
2489         * options.h (class General_options): Add --export-dynamic-symbol.
2490         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2491         --export-dynamic-symbol.
2492         (Symbol_table::gc_mark_undef_symbols): Likewise.
2493         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2494
2495 2012-04-12  David S. Miller  <davem@davemloft.net>
2496
2497         * sparc.cc (Reloc::wdisp10): New relocation method.
2498         (Reloc::h34): Likewise.
2499         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2500         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2501         R_SPARC_WDISP10.
2502         (Target_sparc::Scan::local): Likewise.
2503         (Target_sparc::Scan::global): Likewise.
2504         (Target_sparc::Relocate::relocate): Likewise.
2505
2506 2012-04-09  Cary Coutant  <ccoutant@google.com>
2507
2508         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2509         low_pc == 0.
2510
2511 2012-04-06  Ian Lance Taylor  <iant@google.com>
2512
2513         * timer.cc: #include <unistd.h>.
2514
2515 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2516
2517         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2518         * config.in: Regenerate.
2519         * configure: Regenerate.
2520
2521 2012-04-05  Nick Clifton  <nickc@redhat.com>
2522
2523         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2524         (AM_LC_MESSAGES): Add.
2525         * aclocal.m4: Regenerate.
2526         * config.in: Regenerate.
2527         * configure: Regenerate.
2528
2529 2012-03-21  Cary Coutant  <ccoutant@google.com>
2530
2531         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2532         * Makefile.in: Regenerate.
2533         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2534         (Sized_elf_reloc_mapper::symbol_section): New function.
2535         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2536         (make_elf_reloc_mapper): New function.
2537         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2538         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2539         (Dwarf_abbrev_table::do_get_abbrev): New function.
2540         (Dwarf_ranges_table::read_ranges_table): New function.
2541         (Dwarf_ranges_table::read_range_list): New function.
2542         (Dwarf_pubnames_table::read_section): New function.
2543         (Dwarf_pubnames_table::read_header): New function.
2544         (Dwarf_pubnames_table::next_name): New function.
2545         (Dwarf_die::Dwarf_die): New function.
2546         (Dwarf_die::read_attributes): New function.
2547         (Dwarf_die::skip_attributes): New function.
2548         (Dwarf_die::set_name): New function.
2549         (Dwarf_die::set_linkage_name): New function.
2550         (Dwarf_die::attribute): New function.
2551         (Dwarf_die::string_attribute): New function.
2552         (Dwarf_die::int_attribute): New function.
2553         (Dwarf_die::uint_attribute): New function.
2554         (Dwarf_die::ref_attribute): New function.
2555         (Dwarf_die::child_offset): New function.
2556         (Dwarf_die::sibling_offset): New function.
2557         (Dwarf_info_reader::check_buffer): New function.
2558         (Dwarf_info_reader::parse): New function.
2559         (Dwarf_info_reader::do_parse): New function.
2560         (Dwarf_info_reader::do_read_string_table): New function.
2561         (Dwarf_info_reader::lookup_reloc): New function.
2562         (Dwarf_info_reader::get_string): New function.
2563         (Dwarf_info_reader::visit_compilation_unit): New function.
2564         (Dwarf_info_reader::visit_type_unit): New function.
2565         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2566         Sized_elf_reloc_mapper.
2567         (Sized_dwarf_line_info::symbol_section): Remove function.
2568         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2569         (Sized_dwarf_line_info::read_line_mappings): Remove object
2570         parameter, adjust callers.
2571         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2572         * dwarf_reader.h: Include <sys/types.h>.
2573         (class Track_relocs): Remove forward declaration.
2574         (class Elf_reloc_mapper): New class.
2575         (class Sized_elf_reloc_mapper): New class.
2576         (class Dwarf_abbrev_table): New class.
2577         (class Dwarf_range_list): New class.
2578         (class Dwarf_ranges_table): New class.
2579         (class Dwarf_pubnames_table): New class.
2580         (class Dwarf_die): New class.
2581         (class Dwarf_info_reader): New class.
2582         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2583         (Sized_dwarf_line_info::symbol_section): Remove member function.
2584         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2585         base class.
2586         * gdb-index.cc: New source file.
2587         * gdb-index.h: New source file.
2588         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2589         and .debug_types sections, call Layout::add_to_gdb_index.
2590         (Sized_relobj_incr::do_section_name): Implement.
2591         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2592         return type; Implement.
2593         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2594         return type.
2595         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2596         parameter list and return type.
2597         (Sized_incr_dynobj::do_section_contents): Likewise.
2598         * layout.cc: Include gdb-index.h.
2599         (Layout::Layout): Initialize gdb_index_data_.
2600         (Layout::init_fixed_output_section): Check for .gdb_index section.
2601         (Layout::add_to_gdb_index): New function. Instantiate.
2602         * layout.h: Add forward declaration for class Gdb_index.
2603         (Layout::add_to_gdb_index): New member function.
2604         (Layout::gdb_index_data_): New data member.
2605         * main.cc: Include gdb-index.h.
2606         (main): Print statistics for gdb index.
2607         * object.cc (Object::section_contents): Move code into
2608         do_section_contents.
2609         (need_decompressed_section): Check for sections needed when building
2610         gdb index.
2611         (build_compressed_section_map): Likewise.
2612         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2613         gdb index.
2614         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2615         sections; call Layout::add_to_gdb_index.
2616         (Sized_relobj_file::do_decompressed_section_contents): Call
2617         do_section_contents directly.
2618         * object.h (Object::do_section_contents): Adjust parameter list and
2619         return type.
2620         (Object::do_decompressed_section_contents): Call do_section_contents
2621         directly.
2622         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2623         return type.
2624         * options.h (class General_options): Add --gdb-index option.
2625         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2626         list and return type.
2627         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2628         * reloc.h (Track_relocs::checkpoint): New function.
2629         (Track_relocs::reset): New function.
2630
2631         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2632         New test cases.
2633         * testsuite/Makefile.in: Regenerate.
2634         * testsuite/gdb_index_test.cc: New test source file.
2635         * testsuite/gdb_index_test_1.sh: New test source file.
2636         * testsuite/gdb_index_test_2.sh: New test source file.
2637
2638 2012-03-19  Doug Kwan  <dougkwan@google.com>
2639
2640         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2641         (Target_arm::do_finalize_sections): Remove code which defines
2642         __exidx_start and __exidx_end.  Make symbol table parameter
2643         anonymous as it is not used.
2644         * gold.cc (queue_middle_tasks): Call target hook to define any
2645         target-specific symbols.
2646         * target.h (Target::define_standard_symbols): New method.
2647         (Target::do_define_standard_symbols): Same.
2648         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2649         * testsuite/Makefile.in: Regenerate.
2650         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2651         and __exidx_end.
2652         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2653         relocations are generated for __exidx_start and __exidx_end.
2654
2655 2012-03-16  Doug Kwan  <dougkwan@google.com>
2656
2657         * testsuite/Makefile.am: Disable test initpri3b.
2658         * testsuite/Makefile.in: Regenerate.
2659
2660 2012-03-15  Doug Kwan  <dougkwan@google.com>
2661
2662         * arm.cc (Target_arm::got_section): Make .got section read-only
2663         if -z now is given.
2664
2665 2012-03-15  Ian Lance Taylor  <iant@google.com>
2666
2667         PR gold/13850
2668         * layout.cc (Layout::make_output_section): Correctly mark
2669         SHT_INIT_ARRAY, et. al., as relro.
2670
2671 2012-03-14  Doug Kwan  <dougkwan@google.com>
2672
2673         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2674         dynamic relocations for protected symbols in shared objects.
2675
2676 2012-03-13  Ian Lance Taylor  <iant@google.com>
2677
2678         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2679         keep the larger alignment.
2680
2681 2012-03-12  Cary Coutant  <ccoutant@google.com>
2682
2683         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2684         handling of DW_LNE_define_file.
2685
2686 2012-03-12  Cary Coutant  <ccoutant@google.com>
2687
2688         * reduced_debug_output.cc
2689         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2690         codes to switch.
2691
2692 2012-02-29  Cary Coutant  <ccoutant@google.com>
2693
2694         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2695
2696 2012-02-29  Cary Coutant  <ccoutant@google.com>
2697
2698         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2699         Call Object::decompressed_section_contents.
2700         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2701         New dtor.
2702         (Sized_dwarf_line_info::buffer_start_): New data member.
2703         * merge.cc (Output_merge_data::do_add_input_section): Call
2704         Object::decompressed_section_contents.
2705         (Output_merge_string::do_add_input_section): Likewise.
2706         * object.cc (need_decompressed_section): New function.
2707         (build_compressed_section_map): Decompress sections needed later.
2708         (Sized_relobj_file::do_decompressed_section_contents): New function.
2709         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2710         * object.h (Object::decompressed_section_contents): New function.
2711         (Object::discard_decompressed_sections): New function.
2712         (Object::do_decompressed_section_contents): New function.
2713         (Object::do_discard_decompressed_sections): New function.
2714         (Compressed_section_info): New type.
2715         (Compressed_section_map): Include decompressed section contents.
2716         (Sized_relobj_file::do_decompressed_section_contents): New function.
2717         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2718
2719 2012-02-16  Cary Coutant  <ccoutant@google.com>
2720
2721         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2722         * testsuite/Makefile.in: Regenerate.
2723
2724 2012-02-14  Cary Coutant  <ccoutant@google.com>
2725
2726         * options.cc (General_options::finalize): Disallow -pie and -static.
2727
2728 2012-02-03  Doug Kwan  <dougkwan@google.com>
2729
2730         * arm.cc (Arm_relocate_functions::abs8,
2731         Arm_relocate_functions::abs16): Use
2732         Bits::has_signed_unsigned_overflow32.
2733         (Arm_relocate_functions::thm_abs8): Correct range of
2734         overflow check.
2735         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2736         in assertions.
2737
2738 2012-02-02  Doug Kwan  <dougkwan@google.com>
2739
2740         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2741         position independent outputs, not just shared objects.
2742
2743 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2744
2745         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2746         * configure: Regenerated.
2747
2748 2012-01-27  Ian Lance Taylor  <iant@google.com>
2749
2750         * reloc.h (Bits): New class with static functions, copied from
2751         namespace utils in arm.cc.
2752         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2753         instead.
2754
2755 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2756
2757         * incremental.cc (write_info_blocks): Correct relocation offset.
2758
2759 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2760
2761         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2762         (Relocate::tls_gd_to_le): Likewise.
2763
2764 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2765
2766         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2767
2768 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2769
2770         * configure.ac: Check if -mcmodel=medium works.
2771         * configure: Regenerated.
2772
2773 2012-01-24  Cary Coutant  <ccoutant@google.com>
2774
2775         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2776         definition and ...
2777         (read_unsigned_LEB_128_x): ... this new function.
2778         (read_signed_LEB_128): Replaced with inline definition and ...
2779         (read_signed_LEB_128_x): ... this new function.
2780         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2781         (read_unsigned_LEB_128): Add inline definition.
2782         (read_signed_LEB_128_x): New function.
2783         (read_signed_LEB_128): Add inline definition.
2784         * testsuite/Makefile.am (leb128_unittest): New unit test.
2785         * testsuite/Makefile.in: Regenerate.
2786         * testsuite/leb128_unittest.cc: New unit test.
2787
2788 2012-01-23  Ian Lance Taylor  <iant@google.com>
2789
2790         PR gold/13617
2791         * i386.cc (Target_i386::do_code_fill): When using a jmp
2792         instruction, pad with nop instructions.
2793         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2794
2795 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2796
2797         * x86_64.cc (gc_process_relocs): Add typename on types used in
2798         template.
2799         (scan_relocs): Likewise.
2800         (relocate_section): Likewise.
2801         (apply_relocation): Likewise.
2802
2803 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2804
2805         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2806         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2807         under x32.
2808
2809 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2810
2811         * x86_64.cc: Initial support for x32.
2812
2813 2012-01-03  Cary Coutant  <ccoutant@google.com>
2814
2815         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2816         Use abstract base class for GOT.
2817         * gold/output.h (class Output_data_got_base): New abstract base class.
2818         (class Output_data_got): Derive from new base class, adjust ctors.
2819         (Output_data_got::reserve_slot): Make virtual; rename to
2820         do_reserve_slot; Adjust callers.
2821         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2822         pointer to abstract base class.
2823         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2824
2825 2011-12-18  Ian Lance Taylor  <iant@google.com>
2826
2827         * object.h (Relobj::local_symbol_value): New function.
2828         (Relobj::local_plt_offset): New function.
2829         (Relobj::local_has_got_offset): New function.
2830         (Relobj::local_got_offset): New function.
2831         (Relobj::set_local_got_offset): New function.
2832         (Relobj::do_local_symbol_value): New pure virtual function.
2833         (Relobj::do_local_plt_offset): Likewise.
2834         (Relobj::do_local_has_got_offset): Likewise.
2835         (Relobj::do_local_got_offset): Likewise.
2836         (Relobj::do_set_local_got_offset): Likewise.
2837         (Sized_relobj::do_local_has_got_offset): Rename from
2838         local_has_got_offset.
2839         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2840         (Sized_relobj::do_set_local_got_offset): Rename from
2841         set_local_got_offset.
2842         (Sized_relobj_file::do_local_plt_offset): Rename from
2843         local_plt_offset.
2844         (Sized_relobj_file::do_local_symbol_value): New function.
2845         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2846         local_plt_offset.
2847         * output.cc (Output_data_got::Got_entry::write): Change object to
2848         Relobj.  Use local_symbol_value.
2849         (Output_data_got::add_global_with_rel): Change rel_dyn to
2850         Output_data_reloc_generic*.  Use add_global_generic.
2851         (Output_data_got::add_global_with_rela): Remove.  Change all
2852         callers to use add_global_with_rel.
2853         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2854         Output_data_reloc_generic*.  Use add_global_generic.
2855         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2856         callers to use add_global_pair_with_rel.
2857         (Output_data_got::add_local): Change object to Relobj*.
2858         (Output_data_got::add_local_plt): Likewise.
2859         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2860         change rel_dyn to Output_data_reloc_generic*.  Use
2861         add_local_generic.
2862         (Output_data_got::add_local_with_rela): Remove.  Change all
2863         callers to use all_local_with_rel.
2864         (Output_data_got::add_local_pair_with_rel): Change object to
2865         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2866         add_output_section_generic.
2867         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2868         callers to use add_local_pair_with_rel.
2869         (Output_data_got::reserve_local): Change object to Relobj*.
2870         * output.h: (class Output_data_reloc_generic): Add pure virtual
2871         declarations for add_global_generic, add_local_generic,
2872         add_output_section_generic.
2873         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2874         functions for Output_data_reloc_generic.  Update declarations for
2875         changes listed in output.cc.
2876         (class Output_data_got): Change template parameter to got_size.
2877         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2878         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2879         function.
2880         (Sized_relobj_incr::do_local_plt_offset): New function.
2881         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2882         add_global_generic.
2883
2884 2011-12-17  Cary Coutant  <ccoutant@google.com>
2885
2886         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2887         * resolve.cc (Symbol_table::resolve): Likewise.
2888         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2889         arrays.
2890         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2891
2892 2011-12-16  Ian Lance Taylor  <iant@google.com>
2893
2894         * output.h (Output_data_reloc_generic::add): Only call
2895         add_dynamic_reloc if this is a dynamic reloc section.
2896
2897 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2898
2899         PR gold/13505
2900         * target-reloc.h (apply_relocation): Replace <64, false> with
2901         <size, big_endian>.
2902
2903 2011-11-25  Nick Clifton  <nickc@redhat.com>
2904
2905         * po/it.po: New Italian translation.
2906
2907 2011-11-17  Sterling Augustine  <saugustine@google.com>
2908
2909         * script.cc (script_include_directive): Implement.
2910         (read_script_file): New local variables name and search_path. Update
2911         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2912         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2913         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2914
2915 2011-11-11  Sterling Augustine  <saugustine@google.com>
2916
2917         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2918         (file_or_sections_cmd): Likewise.
2919
2920 2011-11-11  Doug Kwan  <dougkwan@google.com>
2921
2922         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2923         if --just-symbols is given.
2924
2925 2011-11-10  Doug Kwan  <dougkwan@google.com>
2926
2927         PR gold/13362
2928         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2929         when processing data relocs.
2930         * reloc.h (Relocate_functions::rel_unaligned): New method.
2931         (Relocate_functions::pcrel_unaligned): Ditto.
2932         (Relocate_functions::rel32_unaligned): Ditto.
2933         (Relocate_functions::pcrel32_unaligned): Ditto.
2934
2935 2011-11-09  Doug Kwan  <dougkwan@google.com>
2936
2937         PR gold/13362
2938         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2939         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2940         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2941         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2942         (Relocate_functions::rel_unaligned): New.
2943         (Relocate_functions::rel32_unaligned): New.
2944         * target-reloc.h (relocate_for_relocatable): Add code to handle
2945         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2946         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2947         arm_unaligned_reloc_r): New targets.
2948         * testsuite/Makefile.in: Regenerate.
2949         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2950         linking.
2951
2952 2011-11-02  Ian Lance Taylor  <iant@google.com>
2953
2954         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2955         NATIVE_LINKER.
2956         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2957         * options.cc (General_options::finalize): Use library search path
2958         from configure script if specified.  If not native and no sysroot,
2959         only search TOOLLIBDIR.
2960         * options.h (Search_directory::Search_directory): Change name to
2961         const std::string&.
2962         (General_options::add_to_library_path_with_sysroot): Change arg to
2963         const std::string&.
2964         * configure, Makefile.in, config.in: Rebuild.
2965
2966 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2967
2968         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2969         we are working around the ARM1176 Erratum.
2970         * options.h (General_options::fix_arm1176): Add option.
2971         * testsuite/Makefile.am: Add testcases, and keep current ones
2972         working.
2973         * testsuite/Makefile.in: Regenerate.
2974         * testsuite/arm_fix_1176.s: New file.
2975         * testsuite/arm_fix_1176.sh: Likewise.
2976
2977 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2978
2979         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2980         may_use_blx_.
2981         (Target_arm::may_use_blx): Remove method.
2982         (Target_arm::set_may_use_blx): Likewise.
2983         (Target_arm::may_use_v4t_interworking): New method.
2984         (Target_arm::may_use_v5t_interworking): Likewise.
2985         (Target_arm::may_use_blx_): Remove member variable.
2986         (Arm_relocate_functions::arm_branch_common): Check for v5T
2987         interworking.
2988         (Arm_relocate_functions::thumb_branch_common): Likewise.
2989         (Reloc_stub::stub_type_for_reloc): Likewise.
2990         (Target_arm::do_finalize_sections): Correct interworking checks.
2991         * testsuite/Makefile.am: Add new tests.
2992         * testsuite/Makefile.in: Regenerate.
2993         * testsuite/arm_farcall_arm_arm.s: New test.
2994         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2995         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2996         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2997         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2998         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2999         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3000         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3001
3002 2011-10-31  Cary Coutant  <ccoutant@google.com>
3003
3004         PR gold/13023
3005         * expression.cc (Expression::eval_with_dot): Add
3006         is_section_dot_assignment parameter.
3007         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3008         absolute and assigning to dot within a section.
3009         * script-sections.cc
3010         (Output_section_element_assignment::set_section_addresses): Pass
3011         dot_section to set_if_absolute.
3012         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3013         as is_section_dot_assignment flag to eval_with_dot.
3014         (Output_section_element_dot_assignment::set_section_addresses):
3015         Likewise.
3016         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3017         parameter.  Also set value if relative to dot_section; set the
3018         symbol's output_section.
3019         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3020         parameter.  Adjust all callers.
3021         (Expression::eval_maybe_dot): Likewise.
3022         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3023         Adjust all callers.
3024         * testsuite/script_test_2.t: Test assignment of an absolute value
3025         to dot within an output section element.
3026
3027 2011-10-31  Cary Coutant  <ccoutant@google.com>
3028
3029         * options.h (class General_options): Add --[no-]gnu-unique options.
3030         * symtab.cc (Symbol_table::sized_write_globals): Convert
3031         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3032
3033 2011-10-31  Cary Coutant  <ccoutant@google.com>
3034
3035         PR gold/13359
3036         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3037         unnecessary assertion.
3038         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3039
3040 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3041
3042         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3043         gc_mark_symbol.
3044         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3045         gc_mark_symbol.
3046         Change to just keep the section associated with symbol.
3047         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3048         they are externally visible and --export-dynamic is turned on.
3049         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3050
3051 2011-10-19  Ian Lance Taylor  <iant@google.com>
3052
3053         PR gold/13163
3054         * script-sections.cc
3055         (Output_section_element_dot_assignment::needs_output_section): New
3056         function.
3057
3058 2011-10-19  Ian Lance Taylor  <iant@google.com>
3059
3060         PR gold/13204
3061         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3062         --section-start option was seen.
3063         * options.h (General_options::any_section_start): New function.
3064
3065 2011-10-18  David S. Miller  <davem@davemloft.net>
3066
3067         PR binutils/13301
3068         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3069         member to track relocation locations that have moved during TLS
3070         reloc optimizations.
3071         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3072         (Target_sparc::Relocate::relocate): Adjust view down by 4
3073         bytes if it matches reloc_adjust_addr_.
3074         (Target_sparc::Relocate::relocate_tls): Always move the
3075         __tls_get_addr call delay slot instruction forward 4 bytes when
3076         performing relaxation.
3077
3078 2011-10-18  Cary Coutant  <ccoutant@google.com>
3079
3080         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3081         (Output_file::map_no_anonymous): Check for non-zero
3082         return code from posix_fallocate.
3083
3084 2011-10-17  Cary Coutant  <ccoutant@google.com>
3085
3086         PR gold/13245
3087         * plugin.cc (is_visible_from_outside): Check for symbols
3088         referenced from dynamic objects.
3089         * resolve.cc (Symbol_table::resolve): Don't count references
3090         from dynamic objects as references from real ELF files.
3091         * testsuite/plugin_test_2.sh: Adjust expected result.
3092
3093 2011-10-17  Cary Coutant  <ccoutant@google.com>
3094
3095         * gold.cc: Include timer.h.
3096         (queue_middle_tasks): Stamp time.
3097         (queue_final_tasks): Likewise.
3098         * main.cc (main): Store timer in parameters.  Print timers
3099         for each pass.
3100         * parameters.cc (Parameters::Parameters): Initialize timer_.
3101         (Parameters::set_timer): New function.
3102         (set_parameters_timer): New function.
3103         * parameters.h (Parameters::set_timer): New function.
3104         (Parameters::timer): New function.
3105         (Parameters::timer_): New data member.
3106         (set_parameters_timer): New function.
3107         * timer.cc (Timer::stamp): New function.
3108         (Timer::get_pass_time): New function.
3109         * timer.h (Timer::stamp): New function.
3110         (Timer::get_pass_time): New function.
3111         (Timer::pass_times_): New data member.
3112
3113 2011-10-17  Cary Coutant  <ccoutant@google.com>
3114
3115         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3116         task for members of lib groups.
3117
3118 2011-10-17  Cary Coutant  <ccoutant@google.com>
3119
3120         PR gold/13288
3121         * fileread.cc (File_read::find_view): Add assert.
3122         (File_read::make_view): Move bounds check (replace with assert)...
3123         (File_read::find_or_make_view): ... to here.
3124
3125 2011-10-12  Cary Coutant  <ccoutant@google.com>
3126
3127         * output.cc (Output_file::open_base_file): Handle case where
3128         ::read returns less than requested size.
3129
3130 2011-10-10  Cary Coutant  <ccoutant@google.com>
3131
3132         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3133         Initialize defined_count_.
3134         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3135         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3136         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3137         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3138         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3139         * incremental.h (Sized_relobj_incr::defined_count_): New data
3140         member.
3141         (Sized_incr_dynobj::defined_count_): New data member.
3142         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3143         Return zeroes instead of internal error.
3144
3145 2011-10-10  Cary Coutant  <ccoutant@google.com>
3146
3147         PR gold/13249
3148         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3149         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3150         * output.h (class Output_reloc): Add use_plt_offset flag.
3151         (Output_reloc::type_): Adjust size of bit field.
3152         (Output_reloc::use_plt_offset_): New bit field.
3153         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3154         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3155         flag.  Adjust all callers.
3156         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3157         creating RELATIVE relocations.
3158
3159 2011-10-10  Nick Clifton  <nickc@redhat.com>
3160
3161         * po/es.po: Updated Spanish translation.
3162         * po/fi.po: Updated Finnish translation.
3163
3164 2011-10-03   Diego Novillo  <dnovillo@google.com>
3165
3166         * options.cc (parse_uint): Fix dereference of RETVAL.
3167
3168 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3169
3170         * layout.h (section_order_map_): New member.
3171         (get_section_order_map): New member function.
3172         * output.cc (Output_section::add_input_section): Check for patterns
3173         only when --section-ordering-file is specified.
3174         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3175         output_sections have been formed.
3176         * layout.cc (Layout_Layout): Initialize section_order_map_.
3177         * plugin.cc (update_section_order): Store order in order_map. Do not
3178         update the order.
3179         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3180         * testsuite/Makefile.in: Regenerate.
3181         * testsuite/plugin_section_order.c: New file.
3182         * testsuite/plugin_final_layout.cc: New file.
3183         * testsuite/plugin_final_layout.sh: New file.
3184
3185 2011-09-29  Cary Coutant  <ccoutant@google.com>
3186
3187         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3188         Check for NULL.
3189         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3190         symbols during incremental update.
3191         (Symbol_table::add_from_dynobj): Likewise.
3192
3193 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3194             Ian Lance Taylor  <iant@google.com>
3195
3196         * symtab.cc (Symbol_table::define_special_symbol): Always
3197         canonicalize version string.
3198
3199 2011-09-26  Cary Coutant  <ccoutant@google.com>
3200
3201         * gold.cc (queue_initial_tasks): Move option checks ...
3202         * options.cc (General_options::finalize): ... to here. Disable
3203         some options; make others fatal.
3204
3205 2011-09-26  Cary Coutant  <ccoutant@google.com>
3206
3207         gcc PR lto/47247
3208         * plugin.cc (get_symbols_v2): New function.
3209         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3210         (is_referenced_from_outside): New function.
3211         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3212         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3213         (get_symbols): Pass version parameter.
3214         (get_symbols_v2): New function.
3215         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3216         parameter.
3217         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3218         (onload): Add LDPT_GET_SYMBOLS_V2.
3219         (all_symbols_read_hook): Use get_symbols_v2; check for
3220         LDPR_PREVAILING_DEF_IRONLY_EXP.
3221         * testsuite/plugin_test_3.sh: Update expected results.
3222
3223 2011-09-23  Simon Baldwin  <simonb@google.com>
3224
3225         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3226         configuration options.
3227         * configure: Regenerate.
3228         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3229         * Makefile.in: Regenerate.
3230         * testsuite/Makefile.in: Regenerate.
3231
3232 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3233
3234         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3235
3236 2011-09-19  Cary Coutant  <ccoutant@google.com>
3237
3238         * incremental.cc (can_incremental_update): Fix typo in comment.
3239         * incremental.h (can_incremental_update): Likewise.
3240
3241 2011-09-18  Cary Coutant  <ccoutant@google.com>
3242
3243         * incremental.cc (can_incremental_update): New function.
3244         * incremental.h (can_incremental_update): New function.
3245         * layout.cc (Layout::init_fixed_output_section): Call it.
3246         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3247         * object.cc (Sized_relobj_file::do_layout): Call
3248         can_incremental_update.
3249
3250 2011-09-13  Cary Coutant  <ccoutant@google.com>
3251
3252         * configure.ac: Check for glibc support for gnu_indirect_function
3253         support with static linking, setting automake conditional
3254         IFUNC_STATIC.
3255         * Makefile.in: Regenerate.
3256         * configure: Regenerate.
3257
3258         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3259         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3260         for IFUNC_STATIC.
3261         * testsuite/Makefile.in: Regenerate.
3262
3263 2011-09-13  Cary Coutant  <ccoutant@google.com>
3264
3265         * incremental.cc (Sized_relobj_incr::do_layout): Call
3266         report_comdat_group for kept comdat sections.
3267         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3268         * testsuite/Makefile.in: Regenerate.
3269         * testsuite/incr_comdat_test_1.cc: New source file.
3270         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3271         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3272         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3273
3274 2011-09-13  Ian Lance Taylor  <iant@google.com>
3275
3276         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3277         variable external_symbols_offset.
3278
3279 2011-09-12  Ian Lance Taylor  <iant@google.com>
3280
3281         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3282         triggered if object has no symbols.
3283
3284 2011-09-09  David S. Miller  <davem@davemloft.net>
3285
3286         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3287         (Output_fill_debug_line::do_write): Likewise.
3288
3289 2011-08-29  Cary Coutant  <ccoutant@google.com>
3290
3291         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3292         casts to match formatting specs.
3293         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3294
3295 2011-08-26  Cary Coutant  <ccoutant@google.com>
3296
3297         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3298         remaining hole size when allocating.
3299         (Layout::make_output_section): Set fill methods for debug sections.
3300         * layout.h (Free_list::Free_list_node): Move from private to
3301         public.
3302         (Free_list::set_min_hole_size): New function.
3303         (Free_list::begin, Free_list::end): New functions.
3304         (Free_list::min_hole_): New data member.
3305         * output.cc: Include dwarf.h.
3306         (Output_fill_debug_info::do_minimum_hole_size): New function.
3307         (Output_fill_debug_info::do_write): New function.
3308         (Output_fill_debug_line::do_minimum_hole_size): New function.
3309         (Output_fill_debug_line::do_write): New function.
3310         (Output_section::Output_section): Initialize new data member.
3311         (Output_section::set_final_data_size): Ensure patch space is larger
3312         than minimum hole size.
3313         (Output_section::do_write): Fill holes in debug sections.
3314         * output.h (Output_fill): New class.
3315         (Output_fill_debug_info): New class.
3316         (Output_fill_debug_line): New class.
3317         (Output_section::set_free_space_fill): New function.
3318         (Output_section::free_space_fill_): New data member.
3319         * testsuite/Makefile.am (incremental_test_3): Add
3320         --incremental-patch option.
3321         (incremental_test_4): Likewise.
3322         (incremental_test_5): Likewise.
3323         (incremental_test_6): Likewise.
3324         (incremental_copy_test): Likewise.
3325         (incremental_common_test_1): Likewise.
3326         * testsuite/Makefile.in: Regenerate.
3327
3328 2011-08-26  Nick Clifton  <nickc@redhat.com>
3329
3330         * po/es.po: Updated Spanish translation.
3331
3332 2011-08-01  Cary Coutant  <ccoutant@google.com>
3333
3334         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3335         * gold/testsuite/Makefile.in: Regenerate.
3336         * gold/testsuite/justsyms_exec.c: New source file.
3337         * gold/testsuite/justsyms_lib.c: New source file.
3338
3339 2011-08-01  Cary Coutant  <ccoutant@google.com>
3340
3341         * layout.cc (Layout::set_segment_offsets): Don't realign text
3342         segment if -Ttext was specified.
3343         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3344         file type.
3345         * object.h (Sized_relobj_file::e_type): New function.
3346         (Sized_relobj_file::e_type_): New data member.
3347         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3348         base address for ET_EXEC files.
3349         * target.cc (Target::do_make_elf_object_implementation): Allow
3350         ET_EXEC files with --just-symbols option.
3351
3352 2011-07-28  Cary Coutant  <ccoutant@google.com>
3353
3354         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3355         Add thread_number parameter.
3356         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3357         * workqueue-threads.cc
3358         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3359         current thread if its thread number is greater than desired thread
3360         count.
3361         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3362         Add thread_number parameter.
3363         (Workqueue::should_cancel_thread): Likewise.
3364         (Workqueue::find_runnable_or_wait): Pass thread_number to
3365         should_cancel_thread.
3366         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3367         parameter.
3368
3369 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3370
3371         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3372         only after checking if it cannot be forced local.
3373         * symtab.h (is_externally_visible): Check if the symbol is not forced
3374         local.
3375
3376 2011-07-15  Ian Lance Taylor  <iant@google.com>
3377
3378         * options.h (class General_options): Add --print-output-format.
3379         Move -EL next to -EB, for  better --help output.
3380         * target-select.cc: Include <cstdio>, "options.h", and
3381         "parameters.h".
3382         (Target_selector::do_target_bfd_name): New function.
3383         (print_output_format): New function.
3384         * target-select.h (class Target_selector): Update declarations.
3385         (Target_selector::target_bfd_name): New function.
3386         (print_output_format): Declare.
3387         * main.cc: Include "target-select.h".
3388         (main): Handle --print-output-format.
3389         * gold.cc: Include "target-select.h".
3390         (queue_initial_tasks): Handle --print-output-format when there are
3391         no input files.
3392         * parameters.cc (parameters_force_valid_target): Give a better
3393         error message if -EB/-EL does not match target.
3394         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3395         function.
3396
3397 2011-07-15  Ian Lance Taylor  <iant@google.com>
3398
3399         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3400         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3401         (Output_data_plt_i386::do_write): Write address of .dynamic
3402         section to first entry in .got.plt section.
3403         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3404         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3405         Initialize layout_.
3406         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3407         section to first entry in .got.plt section.
3408         * layout.h (Layout::dynamic_section): New function.
3409
3410 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3411
3412         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3413         to claim_file call.
3414         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3415         input_section_position_, and input_section_glob_.
3416         (read_layout_from_file): Call function section_ordering_specified.
3417         * layout.h (is_section_ordering_specified): New function.
3418         (section_ordering_specified): New function.
3419         (section_ordering_specified_): New boolean member.
3420         * main.cc(main): Call load_plugins after layout object is defined.
3421         * output.cc (Output_section::add_input_section): Use
3422         function section_ordering_specified to check if section ordering is
3423         needed.
3424         * output.cc (Output_section::add_relaxed_input_section): Use
3425         function section_ordering_specified to check if section ordering is
3426         needed.
3427         (Output_section::update_section_layout): New function.
3428         (Output_section::sort_attached_input_sections): Check if input section
3429         must be reordered.
3430         * output.h (Output_section::update_section_layout): New function.
3431         * plugin.cc (get_section_count): New function.
3432         (get_section_type): New function.
3433         (get_section_name): New function.
3434         (get_section_contents): New function.
3435         (update_section_order): New function.
3436         (allow_section_ordering): New function.
3437         (Plugin::load): Add the new interfaces to the transfer vector.
3438         (Plugin_manager::load_plugins): New parameter.
3439         (Plugin_manager::all_symbols_read): New parameter.
3440         (Plugin_manager::claim_file): New parameter. Save the elf object for
3441         unclaimed objects.
3442         (Plugin_manager::get_elf_object): New function.
3443         (Plugin_manager::get_view): Change to directly use the bool to check
3444         if get_view is called from claim_file_hook.
3445         * plugin.h (input_objects): New function
3446         (Plugin__manager::load_plugins): New parameter.
3447         (Plugin_manager::claim_file): New parameter.
3448         (Plugin_manager::get_elf_object): New function.
3449         (Plugin_manager::in_claim_file_handler): New function.
3450         (Plugin_manager::in_claim_file_handler_): New member.
3451         (layout): New function.
3452         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3453         handler with an extra parameter. Make the elf object before calling
3454         claim_file handler.
3455         * testsuite/plugin_test.c (get_section_count): New function pointer.
3456         (get_section_type): New function pointer.
3457         (get_section_name): New function pointer.
3458         (get_section_contents): New function pointer.
3459         (update_section_order): New function pointer.
3460         (allow_section_ordering): New function pointer.
3461         (onload): Check if the new interfaces exist.
3462
3463 2011-07-13  Ian Lance Taylor  <iant@google.com>
3464
3465         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3466         relro section.
3467         * x86_64.cc (Target_x86_64::got_section): Likewise.
3468         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3469         (relro_now_test_SOURCES): New variable.
3470         (relro_now_test_DEPENDENCIES): New variable.
3471         (relro_now_test_LDFLAGS): New variable.
3472         (relro_now_test_LDADD): New variable.
3473         (relro_now_test.so): New target.
3474         * testsuite/Makefile.in: Rebuild.
3475
3476 2011-07-12  Ian Lance Taylor  <iant@google.com>
3477
3478         PR gold/12980
3479         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3480         GLOB_DAT relocation rather than a RELATIVE relocation for a
3481         protected symbol when creating a shared library.
3482         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3483         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3484         * testsuite/protected_main_1.cc (main): Test that protected
3485         function has same address.
3486
3487 2011-07-11  Ian Lance Taylor  <iant@google.com>
3488
3489         PR gold/12979
3490         * options.h (class General_options): Add -Bgroup.
3491         * options.cc (General_options::finalize): If -Bgroup is set,
3492         default to --unresolved-symbols=report-all.
3493         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3494         * target-reloc.h (issue_undefined_symbol_error): Handle
3495         --unresolved-symbols=report-all.
3496
3497 2011-07-08  Ian Lance Taylor  <iant@google.com>
3498
3499         PR gold/11985
3500         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3501         if linker script discards key sections.
3502         (Layout::create_dynamic_symtab): Likewise.
3503         (Layout::assign_local_dynsym_offsets): Likewise.
3504         (Layout::sized_create_version_sections): Likewise.
3505         (Layout::create_interp): Likewise.
3506         (Layout::finish_dynamic_section): Likewise.
3507         (Layout::set_dynamic_symbol_size): Likewise.
3508
3509 2011-07-08  Ian Lance Taylor  <iant@google.com>
3510
3511         PR gold/12386
3512         * options.h (class General_options): Add --unresolved-symbols.
3513         * target-reloc.h (issue_undefined_symbol_error): Check
3514         --unresolved-symbols.  Add comments.
3515
3516 2011-07-08  Ian Lance Taylor  <iant@google.com>
3517
3518         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3519         expression more complex.
3520
3521 2011-07-08  Ian Lance Taylor  <iant@google.com>
3522
3523         PR gold/11317
3524         * target-reloc.h (issue_undefined_symbol_error): New inline
3525         function, broken out of relocate_section.
3526         (relocate_section): Call issue_undefined_symbol_error.
3527         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3528         there is no TLS segment if we are about to issue an undefined
3529         symbol error.
3530         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3531
3532 2011-07-08  Ian Lance Taylor  <iant@google.com>
3533
3534         PR gold/12279
3535         * resolve.cc (Symbol_table::should_override): Add fromtype
3536         parameter.  Change all callers.  Give error when linking together
3537         TLS and non-TLS symbol.
3538         (Symbol_table::should_override_with_special): Add fromtype
3539         parameter.  Change all callers.
3540         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3541         there is no TLS segment if we have reported some errors.
3542         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3543
3544 2011-07-08  Ian Lance Taylor  <iant@google.com>
3545
3546         PR gold/12372
3547         * target.h (Target::plt_address_for_global): New function.
3548         (Target::plt_address_for_local): New function.
3549         (Target::plt_section_for_global): Remove.
3550         (Target::plt_section_for_local): Remove.
3551         (Target::do_plt_address_for_global): New virtual function.
3552         (Target::do_plt_address_for_local): New virtual function.
3553         (Target::do_plt_section_for_global): Remove.
3554         (Target::do_plt_section_for_local): Remove.
3555         (Target::register_global_plt_entry): Add Symbol_table and Layout
3556         parameters.
3557         * output.cc (Output_data_got::Got_entry::write): Use
3558         plt_address_for_global and plt_address_for_local.
3559         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3560         address of output section.
3561         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3562         got_irelative_, and irelative_count_ fields.  Update
3563         declarations.
3564         (Output_data_plt_i386::has_irelative_section): New function.
3565         (Output_data_plt_i386::entry_count): Add irelative_count_.
3566         (Output_data_plt_i386::set_final_data_size): Likewise.
3567         (class Target_i386): Add got_irelative_ and rel_irelative_
3568         fields.  Update declarations.
3569         (Target_i386::Target_i386): Initialize new fields.
3570         (Target_i386::do_plt_address_for_global): New function replacing
3571         do_plt_section_for_global.
3572         (Target_i386::do_plt_address_for_local): New function replacing
3573         do_plt_section_for_local.
3574         (Target_i386::got_section): Create got_irelative_.
3575         (Target_i386::rel_irelative_section): New function.
3576         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3577         fields.  Don't define __rel_iplt_{start,end}.
3578         (Output_data_plt_i386::add_entry): Add symtab and layout
3579         parameters.  Change all callers.  Use different PLT and GOT for
3580         IFUNC symbols.
3581         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3582         layout parameters.  Change all callers.  Use different PLT and
3583         GOT.
3584         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3585         (Output_data_plt_i386::rel_irelative): New function.
3586         (Output_data_plt_i386::address_for_global): New function.
3587         (Output_data_plt_i386::address_for_local): New function.
3588         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3589         IRELATIVE GOT when changing IFUNC GOT entries.
3590         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3591         reloc.
3592         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3593         if we didn't create an IRELATIVE GOT.
3594         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3595         plt_address_for_local.
3596         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3597         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3598         got_irelative_, and irelative_count_ fields.  Update
3599         declarations.
3600         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3601         Initialize new fields.  Remove symtab parameter.  Change all
3602         callers.
3603         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3604         irelative_count_.
3605         (Output_data_plt_x86_64::has_irelative_section): New function.
3606         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3607         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3608         fields.  Update declarations.
3609         (Target_x86_64::Target_x86_64): Initialize new fields.
3610         (Target_x86_64::do_plt_address_for_global): New function replacing
3611         do_plt_section_for_global.
3612         (Target_x86_64::do_plt_address_for_local): New function replacing
3613         do_plt_section_for_local.
3614         (Target_x86_64::got_section): Create got_irelative_.
3615         (Target_x86_64::rela_irelative_section): New function.
3616         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3617         all callers.  Don't create __rel_iplt_{start,end}.
3618         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3619         parameters.  Change all callers.  Use different PLT and GOT for
3620         IFUNC symbols.
3621         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3622         layout parameters.  Change all callers.  Use different PLT and
3623         GOT.
3624         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3625         parameters.  Change all callers.  Use different PLT and GOT for
3626         IFUNC symbols.
3627         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3628         (Output_data_plt_x86_64::rela_irelative): New function.
3629         (Output_data_plt_x86_64::address_for_global): New function.
3630         (Output_data_plt_x86_64::address_for_local): New function.
3631         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3632         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3633         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3634         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3635         parameters.
3636         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3637         reloc.
3638         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3639         symbols if we didn't create an IRELATIVE GOT.
3640         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3641         plt_address_for_local.
3642         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3643         * testsuite/ifuncvar1.c: New test file.
3644         * testsuite/ifuncvar2.c: New test file.
3645         * testsuite/ifuncvar3.c: New test file.
3646         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3647         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3648         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3649         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3650         * testsuite/Makefile.in: Rebuild.
3651
3652 2011-07-07  Cary Coutant  <ccoutant@google.com>
3653
3654         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3655         (two_file_test_1_ndebug.o): Likewise.
3656         (two_file_test_1b_ndebug.o): Likewise.
3657         (two_file_test_2_ndebug.o): Likewise.
3658         (two_file_test_main_ndebug.o): Likewise.
3659         (incremental_test_2): Link with no-debug versions.
3660
3661 2011-07-06  Cary Coutant  <ccoutant@google.com>
3662
3663         * gold/incremental.cc
3664         (Output_section_incremental_inputs::write_info_blocks): Check for
3665         hidden and internal symbols.
3666
3667 2011-07-06  Cary Coutant  <ccoutant@google.com>
3668
3669         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3670         Check disposition for startup file.
3671         (Incremental_inputs::report_command_line): Ignore
3672         --incremental-startup-unchanged option.
3673         * options.cc (General_options::parse_incremental_startup_unchanged):
3674         New function.
3675         (General_options::General_options): Initialize new data member.
3676         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3677         (General_options): Add --incremental-startup-unchanged option.
3678         (General_options::incremental_startup_disposition): New function.
3679         (General_options::incremental_startup_disposition_): New data member.
3680
3681 2011-07-06  Cary Coutant  <ccoutant@google.com>
3682
3683         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3684         input file index to Script_info ctor.
3685         (Sized_incremental_binary::do_file_has_changed): Find the
3686         command-line argument for files named in scripts.
3687         * incremental.h (Script_info::Script_info): New ctor
3688         with input file index.
3689         (Script_info::input_file_index): New function.
3690         (Script_info::input_file_index_): New data member.
3691         (Incremental_binary::get_library): Add const.
3692         (Incremental_binary::get_script_info): Add const.
3693         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3694         * testsuite/Makefile.am (incremental_test_5): New test case.
3695         (incremental_test_6): New test case.
3696         * testsuite/Makefile.in: Regenerate.
3697
3698 2011-07-06  Cary Coutant  <ccoutant@google.com>
3699
3700         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3701         debug output when command lines differ.
3702
3703 2011-07-06  Cary Coutant  <ccoutant@google.com>
3704
3705         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3706         --incremental-patch option.
3707         * layout.cc (Free_list::allocate): Extend allocation beyond original
3708         end if enabled.
3709         (Layout::make_output_section): Mark sections that should get
3710         patch space.
3711         * options.cc (parse_percent): New function.
3712         * options.h (parse_percent): New function.
3713         (DEFINE_percent): New macro.
3714         (General_options): Add --incremental-patch option.
3715         * output.cc (Output_section::Output_section): Initialize new data
3716         members.
3717         (Output_section::add_input_section): Print section name when out
3718         of patch space.
3719         (Output_section::add_output_section_data): Likewise.
3720         (Output_section::set_final_data_size): Add patch space when
3721         doing --incremental-full.
3722         (Output_section::do_reset_address_and_file_offset): Remove patch
3723         space.
3724         (Output_segment::set_section_list_addresses): Print debug output
3725         only if --incremental-update.
3726         * output.h (Output_section::set_is_patch_space_allowed): New function.
3727         (Output_section::is_patch_space_allowed_): New data member.
3728         (Output_section::patch_space_): New data member.
3729         * parameters.cc (Parameters::incremental_full): New function.
3730         * parameters.h (Parameters::incremental_full): New function
3731         * testsuite/Makefile.am (incremental_test_2): Add test for
3732         --incremental-patch option.
3733         * testsuite/Makefile.in: Regenerate.
3734         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3735         (t18): Remove function body.
3736
3737 2011-07-05  Doug Kwan  <dougkwan@google.com>
3738
3739         PR gold/12771
3740         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3741         Arm_Address type for relocation result.
3742         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3743         overflow check.
3744         (Arm_relocate_functions::abs32): Use unaligned access.
3745         (Arm_relocate_functions::rel32): Ditto.
3746         (Arm_relocate_functions::prel31): Ditto.
3747         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3748         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3749         static data relocations.
3750         * testsuite/Makefile.in: Regnerate.
3751         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3752
3753 2011-07-05  Ian Lance Taylor  <iant@google.com>
3754
3755         PR gold/12392
3756         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3757         symbols if necessary.
3758         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3759
3760 2011-07-05  Ian Lance Taylor  <iant@google.com>
3761
3762         PR gold/12952
3763         * resolve.cc (Symbol::override_base_with_special): Simply override
3764         version with special symbol version, ignoring previous version.
3765
3766 2011-07-05  Ian Lance Taylor  <iant@google.com>
3767
3768         * object.cc (Sized_relobj_file::include_section_group): Add
3769         information to comment about signature location.
3770
3771 2011-07-02  Ian Lance Taylor  <iant@google.com>
3772
3773         PR gold/12957
3774         * options.h (class General_options): Add -f and -F.
3775         * options.cc (General_options::finalize): Fatal error if -f/-F
3776         are used without -shared.
3777         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3778
3779 2011-07-02  Ian Lance Taylor  <iant@google.com>
3780
3781         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3782
3783 2011-07-01  Ian Lance Taylor  <iant@google.com>
3784
3785         PR gold/12525
3786         PR gold/12952
3787         * resolve.cc (Symbol::override_base_with_special): Don't override
3788         the version if the overriding symbol has a different name.
3789         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3790         all callers.  If we give an error about an undefined version,
3791         define the base version if necessary.
3792         * dynobj.h (class Versions): Update declaration.
3793         * testsuite/weak_alias_test_5.cc: New file.
3794         * testsuite/weak_alias_test.script: New file.
3795         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3796         and versioned_alias have the right value, and call t2.
3797         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3798         weak_alias_test_5.so.
3799         (weak_alias_test_LDADD): Likewise.
3800         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3801         * testsuite/Makefile.in: Rebuild.
3802
3803 2011-07-01  Ian Lance Taylor  <iant@google.com>
3804
3805         PR gold/12525
3806         * options.h (class General_options): Support -z notext.
3807         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3808         -Wl,-z,notext.
3809         (two_file_shared_nonpic.so): Likewise.
3810         (two_file_shared_mixed.so): Likewise.
3811         (two_file_shared_mixed_1.so): Likewise.
3812         (weak_undef_lib_nonpic.so): Likewise.
3813         (alt/weak_undef_lib_nonpic.so): Likewise.
3814         (tls_test_shared_nonpic.so): Likewise.
3815         * testsuite/Makefile.in: Rebuild.
3816
3817 2011-07-01  Ian Lance Taylor  <iant@google.com>
3818
3819         PR gold/12525
3820         * configure.ac: Test whether static linking works, setting
3821         the automake conditional HAVE_STATIC.
3822         * testsuite/Makefile.am: Disable tests using -static if
3823         HAVE_STATIC is not true.
3824         * configure, testsuite/Makefile.in: Rebuild.
3825
3826 2011-07-01  Ian Lance Taylor  <iant@google.com>
3827
3828         PR gold/12525
3829         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3830         Assert if we see DW_EH_PE_indirect.
3831         * target.h (Target::ehframe_datarel_base): New function.
3832         (Target::do_ehframe_datarel_base): New target function.
3833         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3834         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3835         function.
3836
3837 2011-07-01  Ian Lance Taylor  <iant@google.com>
3838
3839         PR gold/12571
3840         * options.h (class General_options): Add
3841         --ld-generated-unwind-info.
3842         * ehframe.cc (Fde::write): Add address parameter.  Change all
3843         callers.  If associated with PLT, fill in address and size.
3844         (Cie::set_output_offset): Only add merge mapping if there is an
3845         object.
3846         (Cie::write): Add address parameter.  Change all callers.
3847         (Eh_frame::add_ehframe_for_plt): New function.
3848         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3849         input_offset_ fields into union u_, with new plt field.
3850         (Fde::Fde): Adjust for new union field.
3851         (Fde::Fde) [Output_data version]: New constructor.
3852         (Fde::add_mapping): Only add merge mapping if there is an object.
3853         (class Cie): Update declarations.
3854         (class Eh_frame): Declare add_ehframe_for_plt.
3855         * layout.cc (Layout::layout_eh_frame): Break out code into
3856         make_eh_frame_section, and call it.
3857         (Layout::make_eh_frame_section): New function.
3858         (Layout::add_eh_frame_for_plt): New function.
3859         * layout.h (class Layout): Update declarations.
3860         * merge.cc (Merge_map::add_mapping): Add assertion.
3861         * i386.cc: Include "dwarf.h".
3862         (class Output_data_plt_i386): Make first_plt_entry,
3863         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3864         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3865         and plt_eh_frame_fde.
3866         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3867         boundary.  Call add_eh_frame_for_plt if appropriate.
3868         * x86_64.cc: Include "dwarf.h".
3869         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3870         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3871         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3872         and plt_eh_frame_fde.
3873         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3874         appropriate.
3875
3876 2011-06-29  Ian Lance Taylor  <iant@google.com>
3877
3878         PR gold/12629
3879         * object.cc (Sized_relobj_file::layout_section): Change shdr
3880         parameter to be const.
3881         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3882         out of do_layout.
3883         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3884         appropriate.  Call layout_eh_frame_section.
3885         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3886         sections.
3887         * object.h (class Sized_relobj_file): Update declarations.
3888
3889 2011-06-29  Ian Lance Taylor  <iant@google.com>
3890
3891         PR gold/12652
3892         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3893         modifier.
3894         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3895
3896 2011-06-29  Ian Lance Taylor  <iant@google.com>
3897
3898         PR gold/12675
3899         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3900         SHT_X86_64_UNWIND.
3901         * layout.cc (Layout::layout_eh_frame): Likewise.
3902
3903 2011-06-29  Ian Lance Taylor  <iant@google.com>
3904
3905         PR gold/12695
3906         * layout.cc (Layout::symtab_section_shndx): New function.
3907         * layout.h (class Layout): Declare symtab_section_shndx.
3908         * output.cc (Output_section::write_header): Call it.
3909
3910 2011-06-29  Ian Lance Taylor  <iant@google.com>
3911
3912         PR gold/12818
3913         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3914         symbols which are not used in a relocation.
3915
3916 2011-06-28  Ian Lance Taylor  <iant@google.com>
3917
3918         PR gold/12898
3919         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3920         script create indistinguishable segments.
3921         (Layout::set_segment_offsets): Use stable_sort when sorting
3922         segments.  Pass this to Compare_segments constructor.
3923         * layout.h (class Layout): Make segment_precedes non-static.
3924         (class Compare_segments): Change from struct to class.  Add
3925         layout_ field.  Add constructor.
3926         * script-sections.cc
3927         (Script_sections::attach_sections_using_phdrs_clause): Rename
3928         local orphan to is_orphan.  Don't report failure to put empty
3929         section in segment.  On attachment failure, report name of
3930         section, and attach to first PT_LOAD segment.
3931
3932 2011-06-28  Ian Lance Taylor  <iant@google.com>
3933
3934         PR gold/12934
3935         * target-select.cc (Target_selector::Target_selector): Add
3936         emulation parameter.  Change all callers.
3937         (select_target_by_bfd_name): Rename from select_target_by_name.
3938         Change all callers.
3939         (select_target_by_emulation): New function.
3940         (supported_emulation_names): New function.
3941         * target-select.h (class Target_selector): Add emulation_ field.
3942         Update declarations.
3943         (Target_selector::recognize_by_bfd_name): Rename from
3944         recognize_by_name.  Change all callers.
3945         (Target_selector::supported_bfd_names): Rename from
3946         supported_names.  Change all callers.
3947         (Target_selector::recognize_by_emulation): New function.
3948         (Target_selector::supported_emulations): New function.
3949         (Target_selector::emulation): New function.
3950         (Target_selector::do_recognize_by_bfd_name): Rename from
3951         do_recognize_by_name.  Change all callers.
3952         (Target_selector::do_supported_bfd_names): Rename from
3953         do_supported_names.  Change all callers.
3954         (Target_selector::do_recognize_by_emulation): New function.
3955         (Target_selector::do_supported_emulations): New function.
3956         (select_target_by_bfd_name): Change name in declaration.
3957         (select_target_by_emulation): Declare.
3958         (supported_emulation_names): Declare.
3959         * parameters.cc (parameters_force_valid_target): Try to find
3960         target based on emulation from -m option.
3961         * options.h (class General_options): Change doc string for -m.
3962         * options.cc (help): Print emulations.
3963         (General_options::parse_V): Likewise.
3964         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3965         Add emulation parameter.  Change all callers.
3966
3967 2011-06-28  Ian Lance Taylor  <iant@google.com>
3968
3969         * target.h (class Target): Add osabi_ field.
3970         (Target::osabi): New function.
3971         (Target::set_osabi): New function.
3972         (Target::Target): Initialize osabi_.
3973         (Target::do_adjust_elf_header): Make pure virtual.
3974         (Sized_target::do_adjust_elf_header): Declare.
3975         * target.cc (Sized_target::do_adjust_elf_header): New function.
3976         (class Sized_target): Instantiate all versions.
3977         * freebsd.h (class Target_freebsd): Remove.
3978         (Target_selector_freebsd::do_recognize): Call set_osabi on
3979         Target.
3980         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3981         (Target_selector_freebsd::set_osabi): Remove.
3982         * i386.cc (class Target_i386): Inherit from Sized_target rather
3983         than Target_freebsd.
3984         * x86_64.cc (class Target_x86_64): Likewise.
3985
3986 2011-06-28  Ian Lance Taylor  <iant@google.com>
3987
3988         * target.h (Target::can_check_for_function_pointers): Rewrite.
3989         Make non-virtual.
3990         (Target::can_icf_inline_merge_sections): Likewise.
3991         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3992         (Target::Target_info): Add can_icf_inline_merge_sections field.
3993         (Target::do_can_check_for_function_pointers): New virtual
3994         function.
3995         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3996         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3997         from can_check_for_function_pointers, move in file.
3998         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3999         section_may_have_icf_unsafe_poineters, move in file.
4000         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4001         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4002         Rename from can_check_for_function_pointers, move in file.
4003         (Target_i386::can_icf_inline_merge_sections): Remove.
4004         (Target_i386::i386_info): Initialize
4005         can_icf_inline_merge_sections.
4006         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4007         Initialize can_icf_inline_merge_sections.
4008         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4009         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4010         Rename from can_check_for_function_pointers, move in file.
4011         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4012         (Target_x86_64::x86_64_info): Initialize
4013         can_icf_inline_merge_sections.
4014         * testsuite/testfile.cc (Target_test::test_target_info):
4015         Likewise.
4016         * icf.cc (get_section_contents): Correct formatting.
4017
4018 2011-06-27  Ian Lance Taylor  <iant@google.com>
4019
4020         * symtab.cc (Symbol::versioned_name): New function.
4021         (Symbol_table::add_to_final_symtab): Use versioned_name when
4022         appropriate.
4023         (Symbol_table::sized_write_symbol): Likewise.
4024         * symtab.h (class Symbol): Declare versioned_name.
4025         * stringpool.h (class Stringpool_template): Add variant of add
4026         which takes a std::basic_string.
4027         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4028         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4029         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4030         (ver_test_12.o): New target.
4031         * testsuite/Makefile.in: Rebuild.
4032
4033 2011-06-27  Doug Kwan  <dougkwan@google.com>
4034
4035         * arm.cc (Arm_relocate_functions::thm_jump8,
4036         Arm_relocate_functions::thm_jump11): Use a wider signed
4037         type to compute offset.
4038         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4039         arm_thm_jump8.
4040         * testsuite/Makefile.in: Regenerate.
4041         * testsuite/arm_branch_in_range.sh: Check test results of
4042         arm_thm_jump11 and arm_thm_jump8.
4043         * testsuite/arm_thm_jump11.s: New test source file.
4044         * testsuite/arm_thm_jump11.t: New linker script.
4045         * testsuite/arm_thm_jump8.s: New test source file.
4046         * testsuite/arm_thm_jump8.t: New linker script.
4047
4048 2011-06-24  Ian Lance Taylor  <iant@google.com>
4049
4050         * layout.cc: Include "object.h".
4051         (ctors_sections_in_init_array): New static variable.
4052         (Layout::is_ctors_in_init_array): New function.
4053         (Layout::layout): Add entry to ctors_sections_in_init_array if
4054         appropriate.
4055         * layout.h (class Layout): Declare is_ctors_in_init_array.
4056         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4057         is_ctors_reverse_view is set.
4058         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4059         all callers.  Set is_ctors_reverse_view field of View_size.
4060         (Sized_relobj_file::reverse_words): New function.
4061         * object.h (Sized_relobj_file::View_size): Add
4062         is_ctors_reverse_view field.
4063         (class Sized_relobj_file): Update declarations.
4064         * testsuite/initpri3.c: New test.
4065         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4066         initpri3b.
4067         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4068         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4069         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4070         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4071         * testsuite/Makefile.in: Rebuild.
4072
4073 2011-06-24  Cary Coutant  <ccoutant@google.com>
4074
4075         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4076         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4077         (debug_msg_cdebug.err): New targets.
4078         * testsuite/Makefile.in: Regenerate.
4079         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4080         Fix checks for link with shared library.
4081
4082 2011-06-24  Doug Kwan  <dougkwan@google.com>
4083
4084         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4085         skip empty text sections.
4086         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4087
4088 2011-06-22  Ian Lance Taylor  <iant@google.com>
4089
4090         PR gold/12910
4091         * options.h (class General_options): Add --ctors-in-init-array.
4092         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4093         friends as SHT_PROGBITS for merging sections.
4094         (Layout::layout): Remove special handling of .init_array and
4095         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4096         and .dtors if ctors_in_init_array.
4097         (Layout::make_output_section): Force correct section types for
4098         .init_array and friends.  Don't sort if doing relocatable link,
4099         Don't sort .ctors and .dtors if ctors_in_init_array.
4100         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4101         (Layout::output_section_name): Add relobj parameter.  Change all
4102         callers.  Handle .ctors. and .dtors. in code rather than table.
4103         Handle .ctors and .dtors if ctors_in_init_array.
4104         (Layout::match_file_name): New function, moved from output.cc.
4105         * layout.h (class Layout): Update declarations.
4106         * output.cc: Include "layout.h".
4107         (Input_section_sort_entry::get_priority): New function.
4108         (Input_section_sort_entry::match_file_name): Just call
4109         Layout::match_file_name.
4110         (Output_section::Input_section_sort_init_fini_compare::operator()):
4111         Handle .ctors and .dtors.  Sort by explicit priority rather than
4112         by name.
4113         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4114         * testsuite/initpri2.c: New test.
4115         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4116         (check_PROGRAMS): Add initpri2.
4117         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4118         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4119         * configure, testsuite/Makefile.in: Rebuild.
4120
4121 2011-06-19  Ian Lance Taylor  <iant@google.com>
4122
4123         PR gold/12880
4124         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4125         .interp section to a PT_INTERP segment even if we have seen a
4126         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4127         clause in a linker script.
4128         (Layout::finalize): Don't create a .interp section if we've
4129         already create a PT_INTERP segment.
4130         (Layout::create_interp): Always call choose_output_section (revert
4131         patch of 2011-06-17).  Don't create PT_INTERP segment.
4132         * script-sections.cc
4133         (Script_sections::create_note_and_tls_segments): Add a .interp
4134         section to a PT_INTERP segment even if we have seen a
4135         --dynamic-linker option.
4136
4137 2011-06-18  Ian Lance Taylor  <iant@google.com>
4138
4139         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4140         merely because a non-PT_LOAD segment has a dynamic reloc.
4141
4142 2011-06-18  Ian Lance Taylor  <iant@google.com>
4143
4144         * layout.cc (Layout::finish_dynamic_section): Don't create
4145         DT_FLAGS entry if not needed.
4146
4147 2011-06-18  Ian Lance Taylor  <iant@google.com>
4148
4149         PR gold/12745
4150         * layout.cc (Layout::layout_eh_frame): Correct handling of
4151         writable .eh_frame section.
4152
4153 2011-06-17  Ian Lance Taylor  <iant@google.com>
4154
4155         PR gold/12893
4156         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4157         symbol is redefined with the exact same object and value.
4158
4159 2011-06-17  Ian Lance Taylor  <iant@google.com>
4160
4161         PR gold/12880
4162         * layout.h (class Layout): Add interp_segment_ field.
4163         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4164         (Layout::attach_allocated_section_to_segment): If making shared
4165         library, put .interp section in PT_INTERP segment.
4166         (Layout::finalize): Also call create_interp if -dynamic-linker
4167         option was used.
4168         (Layout::create_interp): Assert that there is no PT_INTERP
4169         segment.  If not using a SECTIONS clause, use make_output_section.
4170         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4171         * script-sections.cc
4172         (Script_sections::create_note_and_tls_segments): If making shared
4173         library, put .interp section in PT_INTERP segment.
4174
4175 2011-06-17  Ian Lance Taylor  <iant@google.com>
4176
4177         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4178         when making a shared library.
4179
4180 2011-06-17  Ian Lance Taylor  <iant@google.com>
4181
4182         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4183         parameter.  Change all callers.  Don't issue warning about PC32
4184         against locally defined symbol.
4185
4186 2011-06-16  Ian Lance Taylor  <iant@google.com>
4187
4188         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4189         occurs in same object.
4190
4191 2011-06-14  Alan Modra  <amodra@gmail.com>
4192
4193         * po/POTFILES.in: Regenerate.
4194
4195 2011-06-09  Ian Lance Taylor  <iant@google.com>
4196
4197         * script-sections.cc
4198         (Orphan_output_section::set_section_addresses): For a relocatable
4199         link set address to 0.
4200
4201 2011-06-09  Cary Coutant  <ccoutant@google.com>
4202
4203         PR gold/12804
4204         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4205         used with --compress-debug-sections.
4206         * gold/object.cc (Sized_relobj_file::do_layout): Report
4207         uncompressed size of compressed input sections.
4208
4209 2011-06-08  Cary Coutant  <ccoutant@google.com>
4210
4211         PR gold/12804
4212         * testsuite/two_file_test_2_v1.cc: Change initialization of
4213         v2 to keep it in .data.
4214
4215 2011-06-07  Cary Coutant  <ccoutant@google.com>
4216
4217         * common.cc (Symbol_table::do_allocate_commons_list): Call
4218         gold_fallback.
4219         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4220         (Errors::fallback): New function.
4221         (gold_fallback): New function.
4222         * errors.h (Errors::fallback): New function.
4223         * gold.cc (gold_exit): Change status parameter to enum; adjust
4224         all callers.
4225         (queue_initial_tasks): Call gold_fallback.
4226         * gold.h: Include cstdlib.
4227         (Exit_status): New enum type.
4228         (gold_exit): Change status parameter to enum.
4229         (gold_fallback): New function.
4230         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4231         (Layout::create_symtab_sections): Likewise.
4232         (Layout::create_shdrs): Likewise.
4233         * main.cc (main): Adjust call to gold_exit.
4234         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4235         (Output_data_got::add_got_entry_pair): Likewise.
4236         (Output_section::add_input_section): Likewise.
4237         (Output_section::add_output_section_data): Likewise.
4238         (Output_segment::set_section_list_addresses): Likewise.
4239         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4240
4241 2011-06-07  Cary Coutant  <ccoutant@google.com>
4242
4243         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4244         for incremental links.
4245         * output.cc (Output_segment::set_section_list_addresses): Remove
4246         FIXME and test for TLS or BSS.
4247
4248 2011-06-07  Cary Coutant  <ccoutant@google.com>
4249
4250         * testsuite/Makefile.am: Add incremental_copy_test,
4251         incremental_common_test_1.
4252         * testsuite/Makefile.in: Regenerate.
4253         * testsuite/common_test_1_v1.c: New source file.
4254         * testsuite/common_test_1_v2.c: New source file.
4255         * testsuite/copy_test_v1.cc: New source file.
4256
4257 2011-06-07  Cary Coutant  <ccoutant@google.com>
4258
4259         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4260         update, allocate common from bss section's free list.
4261         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4262         linker-defined symbols.
4263         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4264         Skip GOT and PLT entries that are no longer referenced.
4265         (Output_section_incremental_inputs::write_info_blocks): Mark
4266         linker-defined symbols.
4267         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4268         * output.cc (Output_section::allocate): New function.
4269         * output.h (Output_section::allocate): New function.
4270         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4271         linker-defined symbols.
4272         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4273         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4274         (Symbol::init_base_output_data): Likewise.
4275         (Symbol::init_base_output_segment): Likewise.
4276         (Symbol::init_base_constant): Likewise.
4277         (Sized_symbol::init_output_data): Likewise.
4278         (Sized_symbol::init_output_segment): Likewise.
4279         (Sized_symbol::init_constant): Likewise.
4280         (Symbol_table::do_define_in_output_data): Likewise.
4281         (Symbol_table::do_define_in_output_segment): Likewise.
4282         (Symbol_table::do_define_as_constant): Likewise.
4283         * symtab.h (Symbol::is_predefined): New function.
4284         (Symbol::init_base_output_data): Add is_predefined parameter.
4285         (Symbol::init_base_output_segment): Likewise.
4286         (Symbol::init_base_constant): Likewise.
4287         (Symbol::is_predefined_): New data member.
4288         (Sized_symbol::init_output_data): Add is_predefined parameter.
4289         (Sized_symbol::init_output_segment): Likewise.
4290         (Sized_symbol::init_constant): Likewise.
4291         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4292
4293 2011-06-07  Cary Coutant  <ccoutant@google.com>
4294
4295         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4296         instead of emit_copy_reloc.
4297         (Copy_relocs::emit_copy_reloc): Refactor.
4298         (Copy_relocs::make_copy_reloc): New function.
4299         (Copy_relocs::add_copy_reloc): Remove.
4300         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4301         section.
4302         (Copy_relocs::make_copy_reloc): New function.
4303         (Copy_relocs::add_copy_reloc): Remove.
4304         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4305         unchanged input files.
4306         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4307         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4308         Reserve BSS space for COPY relocations.
4309         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4310         (Output_section_incremental_inputs::write_info_blocks): Record
4311         whether a symbol is copied from a shared object.
4312         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4313         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4314         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4315         (Incremental_input_entry_reader::get_output_symbol_index): Add
4316         is_copy parameter.
4317         (Incremental_binary::emit_copy_relocs): New function.
4318         (Incremental_binary::do_emit_copy_relocs): New function.
4319         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4320         new data member.
4321         (Sized_incremental_binary::add_copy_reloc): New function.
4322         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4323         (Sized_incremental_binary::Copy_reloc): New struct.
4324         (Sized_incremental_binary::Copy_relocs): New typedef.
4325         (Sized_incremental_binary::copy_relocs_): New data member.
4326         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4327         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4328         * target.h (Sized_target::emit_copy_reloc): New function.
4329         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4330
4331 2011-06-02  Cary Coutant  <ccoutant@google.com>
4332
4333         PR gold/12163
4334         * gold/archive.cc (Archive::Archive): Initialize new data member.
4335         (Archive::include_all_members): Return if archive has already been
4336         included.
4337         * gold/archive.h (Archive::include_all_members_): New data member.
4338
4339 2011-06-02  Nick Clifton  <nickc@redhat.com>
4340
4341         * dynobj.h: Fix spelling mistake in comment.
4342         * output.cc: Likewise.
4343
4344 2011-05-31  Doug Kwan  <dougkwan@google.com>
4345             Asier Llano
4346
4347         PR gold/12826
4348         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4349         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4350         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4351         redundant arm_exidx_test.so.
4352         * testsuite/Makefile.in: Regenerate.
4353         (check_SCRIPTS): Add pr12826.sh
4354         (check_DATA): Add pr12826.stdout
4355         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4356         * testsuite/pr12826.sh: New file.
4357         * testsuite/pr12826_1.s: Ditto.
4358         * testsuite/pr12826_1.s: Ditto.
4359
4360 2011-05-30  Ian Lance Taylor  <iant@google.com>
4361
4362         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4363         sections.
4364
4365 2011-05-29  Ian Lance Taylor  <iant@google.com>
4366
4367         PR gold/12804
4368         * testsuite/Makefile.am: Use different file name for two_file_test
4369         temporary file for each incremental test.
4370         * testsuite/Makefile.in: Rebuild.
4371
4372 2011-05-29  Ian Lance Taylor  <iant@google.com>
4373
4374         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4375         binary input file is empty.
4376
4377 2011-05-27  Ian Lance Taylor  <iant@google.com>
4378
4379         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4380         (ver_test_9.so): Likewise.
4381         * testsuite/Makefile.in: Rebuild.
4382
4383 2011-05-26 Cary Coutant  <ccoutant@google.com>
4384
4385         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4386         * incremental.cc (Incremental_inputs::report_input_section): Fix
4387         comment, indentation.
4388         (Incremental_inputs::report_comdat_group): New function.
4389         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4390         of data for incremental input file entry.
4391         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4392         group count, COMDAT group signatures.
4393         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4394         an unchanged input file.
4395         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4396         Initialize new data member.
4397         (Incremental_object_entry::add_comdat_group): New function.
4398         (Incremental_object_entry::get_comdat_group_count): New function.
4399         (Incremental_object_entry::get_comdat_signature_key): New function.
4400         (Incremental_object_entry::groups_): New data member.
4401         (Incremental_inputs::report_comdat_group): New function.
4402         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4403         data for incremental input file entry.
4404         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4405         (Incremental_input_entry_reader::get_input_section): Adjust size of
4406         data for incremental input file entry.
4407         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4408         (Incremental_input_entry_reader::get_comdat_group_signature): New
4409         function.
4410         * object.cc (Sized_relobj::include_section_group): Report kept
4411         COMDAT groups for incremental links.
4412
4413 2011-05-24  David Meyer  <pdox@google.com>
4414
4415         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4416         with name parameter.  Add found_name parameter.
4417         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4418         * dirsearch.h (class Dirsearch): Update declaration.
4419
4420 2011-05-24  Ian Lance Taylor  <iant@google.com>
4421
4422         * archive.cc (Library_base::should_include_member): Pull in object
4423         from archive if it defines the entry symbol.
4424         * parameters.cc (Parameters::entry): New function.
4425         * parameters.h (class Parameters): Declare entry.
4426         * output.h (class Output_file_header): Remove entry_ field.
4427         * output.cc (Output_file_header::Output_file_header): Remove entry
4428         parameter.  Change all callers.
4429         (Output_file_header::entry): Use parameters->entry.
4430         * gold.cc (queue_middle_tasks): Likewise.
4431         * plugin.cc (Plugin_hook::run): Likewise.
4432
4433 2011-05-24 Cary Coutant  <ccoutant@google.com>
4434
4435         * gold.cc (queue_initial_tasks): Pass incremental base filename
4436         to Output_file::open_base_file; don't print error message.
4437         * incremental-dump.cc (main): Adjust call to
4438         Output_file::open_for_modification.
4439         * incremental-dump.cc (main): Likewise.
4440         * incremental.cc (Incremental_inputs::report_command_line):
4441         Ignore --incremental-base option when comparing command lines.
4442         Ignore parameter when given as separate argument.
4443         * options.h (class General_options): Add --incremental-base.
4444         * output.cc (Output_file::Output_file):
4445         (Output_file::open_base_file): Add base_name and writable parameters;
4446         read base file into new file; print error message here.
4447         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4448         callers.
4449         * output.h (Output_file::open_for_modification): Rename to...
4450         (Output_file::open_base_file): ...this; add base_name and
4451         writable parameters; adjust all callers.
4452         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4453         callers.
4454         * testsuite/Makefile.am (incremental_test_4): Test
4455         --incremental-base.
4456         * testsuite/Makefile.in: Regenerate.
4457
4458 2011-05-24 Cary Coutant  <ccoutant@google.com>
4459
4460         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4461         incremental_test_4.
4462         * testsuite/Makefile.in: Regenerate.
4463         * testsuite/two_file_test_1_v1.cc: New test source file.
4464         * testsuite/two_file_test_1b_v1.cc: New test source file.
4465         * testsuite/two_file_test_2_v1.cc: New test source file.
4466
4467 2011-05-24 Cary Coutant  <ccoutant@google.com>
4468
4469         * dynobj.h (Dynobj::do_dynobj): New function.
4470         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4471         flag and soname for shared objects.
4472         * incremental.cc (Incremental_inputs::report_object): Make
4473         either Incremental_object_entry or Incremental_dynobj_entry; add
4474         soname to string table.
4475         (Incremental_inputs::report_input_section): Add assertion.
4476         (Output_section_incremental_inputs::set_final_data_size): Adjust
4477         type of input file entry for shared libraries; adjust size of
4478         shared library info entry.
4479         (Output_section_incremental_inputs::write_input_files): Write
4480         as_needed flag for shared libraries.
4481         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4482         of input file entry for shared libraries; write soname.
4483         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4484         soname from incremental info.
4485         * incremental.h (enum Incremental_input_flags): Add
4486         INCREMENTAL_INPUT_AS_NEEDED.
4487         (Incremental_input_entry::Incremental_input_entry): Initialize new
4488         data member.
4489         (Incremental_input_entry::set_as_needed): New function.
4490         (Incremental_input_entry::as_needed): New function.
4491         (Incremental_input_entry::do_dynobj_entry): New function.
4492         (Incremental_input_entry::as_needed_): New data member.
4493         (Incremental_object_entry::Incremental_object_entry): Don't check
4494         for shared library.
4495         (Incremental_object_entry::do_type): Likewise.
4496         (class Incremental_dynobj_entry): New class.
4497         (Incremental_input_entry_reader::as_needed): New function.
4498         (Incremental_input_entry_reader::get_soname): New function.
4499         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4500         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4501         size of shared library info entry.
4502         * layout.cc (Layout::finish_dynamic_section): Don't test for
4503         incremental link when adding DT_NEEDED entries.
4504         * object.h (Object::Object): Initialize new data member.
4505         (Object::dynobj): New function.
4506         (Object::set_as_needed): New function.
4507         (Object::as_needed): New function.
4508         (Object::do_dynobj): New function.
4509         (Object::as_needed_): New data member.
4510
4511 2011-05-24 Cary Coutant  <ccoutant@google.com>
4512
4513         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4514         info; adjust display of GOT entries.
4515         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4516         vector of input objects; remove file_status_.
4517         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4518         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4519         got_plt reader; call target hooks to reserve GOT entries.
4520         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4521         of input file info header and GOT info entry.
4522         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4523         relocation info.
4524         (Got_plt_view_info::got_descriptor): Remove.
4525         (Got_plt_view_info::sym_index): New data member.
4526         (Got_plt_view_info::input_index): New data member.
4527         (Local_got_offset_visitor::visit): Write input file index.
4528         (Global_got_offset_visitor::visit): Write 0 for input file index.
4529         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4530         with sym_index and input_index.
4531         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4532         incremental info GOT entry; replace got_descriptor with input_index.
4533         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4534         map from input file index to object.
4535         (Sized_relobj_incr::do_layout): Replace direct data member reference
4536         with accessor function.
4537         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4538         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4539         Adjust size of input file info header.
4540         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4541         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4542         (Incremental_input_entry_reader::get_input_section): Adjust size of
4543         input file info header.
4544         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4545         of incremental info GOT entry.
4546         (Incremental_got_plt_reader::get_got_desc): Remove.
4547         (Incremental_got_plt_reader::get_got_symndx): New function.
4548         (Incremental_got_plt_reader::get_got_input_index): New function.
4549         (Sized_incremental_binary::Sized_incremental_binary): Remove
4550         file_status_; add input_objects_.
4551         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4552         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4553         (Sized_incremental_binary::file_is_unchanged): Remove.
4554         (Sized_incremental_binary::set_input_object): New function.
4555         (Sized_incremental_binary::input_object): New function.
4556         (Sized_incremental_binary::file_status_): Remove.
4557         (Sized_incremental_binary::input_objects_): New data member.
4558         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4559         references.
4560         (Sized_relobj_incr::invalid_address): Move to base class.
4561         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4562         class.
4563         (Sized_relobj_incr::do_output_section_offset): Likewise.
4564         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4565         (Sized_relobj_incr::section_offsets_): Likewise.
4566         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4567         function.
4568         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4569         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4570         with accessor function.
4571         (Sized_relobj_file::do_layout): Likewise.
4572         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4573         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4574         (Sized_relobj_file::compute_final_local_value): Replace refs to
4575         section_offsets_ with accessor function.
4576         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4577         * object.h (Relobj::Relobj): Initialize new data members.
4578         (Relobj::add_dyn_reloc): New function.
4579         (Relobj::first_dyn_reloc): New function.
4580         (Relobj::dyn_reloc_count): New function.
4581         (Relobj::first_dyn_reloc_): New data member.
4582         (Relobj::dyn_reloc_count_): New data member.
4583         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4584         references.
4585         (Sized_relobj::Address): New typedef.
4586         (Sized_relobj::invalid_address): Move here from child class.
4587         (Sized_relobj::Sized_relobj): Initialize new data members.
4588         (Sized_relobj::sized_relobj): New function.
4589         (Sized_relobj::is_output_section_offset_invalid): Move here from
4590         child class.
4591         (Sized_relobj::get_output_section_offset): Likewise.
4592         (Sized_relobj::local_has_got_offset): Likewise.
4593         (Sized_relobj::local_got_offset): Likewise.
4594         (Sized_relobj::set_local_got_offset): Likewise.
4595         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4596         (Sized_relobj::clear_got_offsets): New function.
4597         (Sized_relobj::section_offsets): Move here from child class.
4598         (Sized_relobj::do_output_section_offset): Likewise.
4599         (Sized_relobj::do_set_section_offset): Likewise.
4600         (Sized_relobj::Local_got_offsets): Likewise.
4601         (Sized_relobj::local_got_offsets_): Likewise.
4602         (Sized_relobj::section_offsets_): Likewise.
4603         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4604         references.
4605         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4606         class.
4607         (Sized_relobj_file::sized_relobj): New function
4608         (Sized_relobj_file::local_has_got_offset): Move to base class.
4609         (Sized_relobj_file::local_got_offset): Likewise.
4610         (Sized_relobj_file::set_local_got_offset): Likewise.
4611         (Sized_relobj_file::get_output_section_offset): Likewise.
4612         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4613         (Sized_relobj_file::do_output_section_offset): Likewise.
4614         (Sized_relobj_file::do_set_section_offset): Likewise.
4615         (Sized_relobj_file::Local_got_offsets): Likewise.
4616         (Sized_relobj_file::local_got_offsets_): Likewise.
4617         (Sized_relobj_file::section_offsets_): Likewise.
4618         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4619         (all constructors).
4620         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4621         (Output_reloc::get_symbol_index): Likewise.
4622         (Output_reloc::local_section_offset): Likewise.
4623         (Output_reloc::get_address): Likewise.
4624         (Output_reloc::symbol_value): Likewise.
4625         (Output_data_got::reserve_slot): Move to class definition.
4626         (Output_data_got::reserve_local): New function.
4627         (Output_data_got::reserve_slot_for_global): Remove.
4628         (Output_data_got::reserve_global): New function.
4629         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4630         (all constructors, two instantiations).
4631         (Output_reloc::get_relobj): New function (two instantiations).
4632         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4633         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4634         (Output_data_reloc::add_global): Adjust type of relobj.
4635         (Output_data_reloc::add_global_relative): Likewise.
4636         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4637         (Output_data_reloc::add_local): Likewise.
4638         (Output_data_reloc::add_local_relative): Likewise.
4639         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4640         (Output_data_reloc::add_local_section): Likewise.
4641         (Output_data_reloc::add_output_section): Likewise.
4642         (Output_data_reloc::add_absolute): Likewise.
4643         (Output_data_reloc::add_target_specific): Likewise.
4644         (Output_data_got::reserve_slot): Move definition here.
4645         (Output_data_got::reserve_local): New function.
4646         (Output_data_got::reserve_global): New function.
4647         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4648         section_offsets_ with accessor function.
4649         (Sized_relobj_file::write_sections): Likewise.
4650         (Sized_relobj_file::do_relocate_sections): Likewise.
4651         * target.h (Sized_target::reserve_local_got_entry): New function.
4652         (Sized_target::reserve_global_got_entry): New function.
4653         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4654         (Target_x86_64::reserve_global_got_entry): New function.
4655         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4656
4657 2011-05-23 Cary Coutant  <ccoutant@google.com>
4658
4659         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4660         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4661         bit when checking got_type.
4662         * incremental.cc (Sized_incremental_binary::setup_readers):
4663         Store symbol table and string table locations; initialize bit vector
4664         of file status flags.
4665         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4666         unchanged files.
4667         (Sized_incremental_binary::do_process_got_plt): New function.
4668         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4669         (Output_section_incremental_inputs::set_final_data_size): Record
4670         file index for each input file.
4671         (Output_section_incremental_inputs::write_got_plt): Store file index
4672         instead of input entry offset for each GOT entry.
4673         * incremental.h
4674         (Incremental_input_entry::Incremental_input_entry): Initialize new
4675         data member.
4676         (Incremental_input_entry::set_offset): Store file index.
4677         (Incremental_input_entry::get_file_index): New function.
4678         (Incremental_input_entry::file_index_): New data member.
4679         (Incremental_binary::process_got_plt): New function.
4680         (Incremental_binary::do_process_got_plt): New function.
4681         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4682         data members.
4683         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4684         (Sized_incremental_binary::set_file_is_unchanged): New function.
4685         (Sized_incremental_binary::file_is_unchanged): New function.
4686         (Sized_incremental_binary::do_process_got_plt): New function.
4687         (Sized_incremental_binary::file_status_): New data member.
4688         (Sized_incremental_binary::main_symtab_loc_): New data member.
4689         (Sized_incremental_binary::main_strtab_loc_): New data member.
4690         * output.cc (Output_data_got::Got_entry::write): Add case
4691         RESERVED_CODE.
4692         (Output_data_got::add_global): Call add_got_entry.
4693         (Output_data_got::add_global_plt): Likewise.
4694         (Output_data_got::add_global_with_rel): Likewise.
4695         (Output_data_got::add_global_with_rela): Likewise.
4696         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4697         (Output_data_got::add_global_pair_with_rela): Likewise.
4698         (Output_data_got::add_local): Call add_got_entry.
4699         (Output_data_got::add_local_plt): Likewise.
4700         (Output_data_got::add_local_with_rel): Likewise.
4701         (Output_data_got::add_local_with_rela): Likewise.
4702         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4703         (Output_data_got::add_local_pair_with_rela): Likewise.
4704         (Output_data_got::reserve_slot): New function.
4705         (Output_data_got::reserve_slot_for_global): New function.
4706         (Output_data_got::add_got_entry): New function.
4707         (Output_data_got::add_got_entry_pair): New function.
4708         (Output_section::add_output_section_data): Edit FIXME.
4709         * output.h
4710         (Output_section_data_build::Output_section_data_build): New
4711         constructor with size parameter.
4712         (Output_data_space::Output_data_space): Likewise.
4713         (Output_data_got::Output_data_got): Initialize new data member; new
4714         constructor with size parameter.
4715         (Output_data_got::add_constant): Call add_got_entry.
4716         (Output_data_got::reserve_slot): New function.
4717         (Output_data_got::reserve_slot_for_global): New function.
4718         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4719         (Output_data_got::add_got_entry): New function.
4720         (Output_data_got::add_got_entry_pair): New function.
4721         (Output_data_got::free_list_): New data member.
4722         * target.h (Sized_target::init_got_plt_for_update): New function.
4723         (Sized_target::register_global_plt_entry): New function.
4724         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4725         Initialize new data member; call init; add constructor with PLT count.
4726         (Output_data_plt_x86_64::init): New function.
4727         (Output_data_plt_x86_64::add_relocation): New function.
4728         (Output_data_plt_x86_64::reserve_slot): New function.
4729         (Output_data_plt_x86_64::free_list_): New data member.
4730         (Target_x86_64::init_got_plt_for_update): New function.
4731         (Target_x86_64::register_global_plt_entry): New function.
4732         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4733         incremental updates.
4734         (Output_data_plt_x86_64::add_relocation): New function.
4735         * testsuite/object_unittest.cc (Object_test): Set default options.
4736
4737 2011-05-16  Ian Lance Taylor  <iant@google.com>
4738
4739         * options.h (class General_options): Make -i a synonym for -r.
4740
4741 2011-05-16  Ian Lance Taylor  <iant@google.com>
4742
4743         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4744
4745 2011-05-10 Cary Coutant  <ccoutant@google.com>
4746
4747         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4748         strip_all (-s).
4749
4750 2011-05-06  Ian Lance Taylor  <iant@google.com>
4751
4752         * layout.cc (Layout::layout): If the output section flags change,
4753         update the ordering.
4754
4755 2011-04-25 Cary Coutant  <ccoutant@google.com>
4756
4757         * incremental-dump.cc (dump_incremental_inputs): Print local
4758         symbol info for each input file.
4759         * incremental.cc
4760         (Output_section_incremental_inputs::set_final_data_size): Add local
4761         symbol info to input file entries in incremental info.
4762         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4763         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4764         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4765         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4766         implementation.
4767         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4768         (Sized_incr_relobj::do_relocate): Write the local symbols.
4769         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4770         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4771         Adjust size of input file header.
4772         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4773         (Incremental_inputs_reader::get_local_symbol_count): New function.
4774         (Incremental_inputs_reader::get_input_section): Adjust size of input
4775         file header.
4776         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4777         (Sized_incr_relobj::This): New typedef.
4778         (Sized_incr_relobj::sym_size): New const data member.
4779         (Sized_incr_relobj::Local_symbol): New struct.
4780         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4781         (Sized_incr_relobj::do_local_symbol_offset): New function.
4782         (Sized_incr_relobj::local_symbol_count_): New data member.
4783         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4784         (Sized_incr_relobj::local_symbol_index_): New data member.
4785         (Sized_incr_relobj::local_symbol_offset_): New data member.
4786         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4787         (Sized_incr_relobj::local_symbols_): New data member.
4788         * object.h (Relobj::output_local_symbol_count): New function.
4789         (Relobj::local_symbol_offset): New function.
4790         (Relobj::do_output_local_symbol_count): New function.
4791         (Relobj::do_local_symbol_offset): New function.
4792         (Sized_relobj::do_output_local_symbol_count): New function.
4793         (Sized_relobj::do_local_symbol_offset): New function.
4794
4795 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4796
4797         * descriptors.cc (set_close_on_exec): New function.
4798         (Descriptors::open): Use set_close_on_exec.
4799         * output.cc (S_ISLNK): Define if not defined.
4800
4801 2011-04-22 Cary Coutant  <ccoutant@google.com>
4802
4803         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4804         global symbol map.
4805         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4806         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4807         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4808         relocations.
4809         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4810         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4811         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4812         * incremental.h
4813         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4814         function.
4815         (Incremental_binary::apply_incremental_relocs): New function.
4816         (Incremental_binary::do_apply_incremental_relocs): New function.
4817         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4818         data member.
4819         (Sized_incremental_binary::add_global_symbol): New function.
4820         (Sized_incremental_binary::global_symbol): New function.
4821         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4822         (Sized_incremental_binary::symbol_map_): New data member.
4823         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4824         * target.h (Sized_target::apply_relocation): New function.
4825         * target-reloc.h (apply_relocation): New function.
4826         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4827
4828 2011-04-22  Doug Kwan  <dougkwan@google.com>
4829
4830         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4831         flag of a SHT_ARM_EXIDX section.
4832         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4833         * testsuite/Makefile.in: Regenerate.
4834         * testsuite/arm_exidx_test.s: New file.
4835         * testsuite/arm_exidx_test.sh: Same.
4836
4837 2011-04-20 Cary Coutant  <ccoutant@google.com>
4838
4839         PR gold/12689
4840         * archive.h (Incremental_archive_entry::Archive_member):
4841         Initialize arg_serial_ (second constructor).
4842
4843 2011-04-17  Ian Lance Taylor  <iant@google.com>
4844
4845         * object.cc (Relocate_info::location): Simplify location string.
4846         * errors.cc (Errors::error_at_location): Don't print program
4847         name.
4848         (Errors::warning_at_location): Likewise.
4849         (Errors::undefined_symbol): Likewise.
4850         * testsuite/debug_msg.sh: Update accordingly.
4851
4852 2011-04-14 Cary Coutant  <ccoutant@google.com>
4853
4854         * gold/layout.cc (Layout::symtab_section_offset): New function.
4855         * gold/layout.h (Layout::symtab_section_offset): New function.
4856         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4857
4858 2011-04-12  Ian Lance Taylor  <iant@google.com>
4859
4860         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4861         with MREMAP_MAYMOVE.
4862         * output.h (class Output_file): Add map_is_allocated_ field.
4863         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4864         not available, provide stubs.  If mremap is not available, #define
4865         it to gold_mremap.
4866         (MREMAP_MAYMOVE): Define if not defined.
4867         (Output_file::Output_file): Initialize map_is_allocated_.
4868         (Output_file::resize): Check map_is_allocated_.
4869         (Output_file::map_anonymous): If mmap fails, use malloc.
4870         (Output_file::unmap): Don't do anything for an anonymous map.
4871         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4872         is not available, provide stubs.
4873         (File_read::View::~View): Use free rather than delete[].
4874         (File_read::make_view): Use malloc rather than new[].  If mmap
4875         fails, use malloc.
4876         (File_read::find_or_make_view): Use malloc rather than new[].
4877         * gold.h: Remove HAVE_REMAP code.
4878         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4879         exists.  Rename mremap to gold_mremap.  If mmap is not available
4880         don't do anything.
4881         * configure, config.in: Rebuild.
4882
4883 2011-04-11  Ian Lance Taylor  <iant@google.com>
4884
4885         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4886         initialize local variable v.
4887
4888 2011-04-11  Cary Coutant  <ccoutant@google.com>
4889
4890         * archive.cc (Archive::include_member): Adjust call to
4891         report_object.
4892         (Add_archive_symbols::run): Track argument serial numbers.
4893         (Lib_group::include_member): Likewise.
4894         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4895         * archive.h (Incremental_archive_entry::Archive_member):
4896         Initialize arg_serial_.
4897         (Archive_member::arg_serial_): New data member.
4898         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4899         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4900         incremental link.
4901         (Sized_dynobj::do_for_all_local_got_entries): New function.
4902         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4903         function.
4904         * fileread.cc (get_mtime): New function.
4905         * fileread.h (get_mtime): New function.
4906         * gold.cc (queue_initial_tasks): Check for incremental update.
4907         (process_incremental_input): New function.
4908         (queue_middle_tasks): Don't force valid target for incremental
4909         update.
4910         * incremental-dump.cc (find_input_containing_global): Adjust
4911         size of symbol info entry.
4912         (dump_incremental_inputs): Dump argument serial number and
4913         in_system_directory flag; bias shndx by 1; print symbol names
4914         when dumping per-file symbol lists; use new symbol info readers.
4915         * incremental.cc
4916         (Output_section_incremental_inputs:update_data_size): New function.
4917         (Sized_incremental_binary::setup_readers): Setup input readers
4918         for each input file; build maps for files added from libraries
4919         and scripts.
4920         (Sized_incremental_binary::check_input_args): New function.
4921         (Sized_incremental_binary::do_check_inputs): Build map of argument
4922         serial numbers to input arguments.
4923         (Sized_incremental_binary::do_file_has_changed): Rename
4924         do_file_is_unchanged to this; compare file modification times.
4925         (Sized_incremental_binary::do_init_layout): New function.
4926         (Sized_incremental_binary::do_reserve_layout): New function.
4927         (Sized_incremental_binary::do_get_input_reader): Remove.
4928         (Sized_incremental_binary::get_symtab_view): New function.
4929         (Incremental_checker::can_incrementally_link_output_file): Remove.
4930         (Incremental_inputs::report_command_line): Exclude --debug options.
4931         (Incremental_inputs::report_archive_begin): Add parameter; track
4932         argument serial numbers; don't put input file entry for archive
4933         before archive members.
4934         (Incremental_inputs::report_archive_end): Put input file entry
4935         for archive after archive members.
4936         (Incremental_inputs::report_object): Add parameter; track argument
4937         serial numbers and in_system_directory flag.
4938         (Incremental_inputs::report_script): Add parameter; track argument
4939         serial numbers.
4940         (Output_section_incremental_inputs::set_final_data_size): Adjust
4941         size of symbol info entry; check for forwarding symbols.
4942         (Output_section_incremental_inputs::write_input_files): Write
4943         in_system_directory flag and argument serial number.
4944         (Output_section_incremental_inputs::write_info_blocks): Map section
4945         indices between incremental info and original input file; store
4946         input section index for each symbol.
4947         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4948         change operator() to visit().
4949         (class Global_got_offset_visitor): Likewise.
4950         (class Global_symbol_visitor_got_plt):
4951         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4952         classes.
4953         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4954         (Sized_incr_relobj::do_read_symbols): New function.
4955         (Sized_incr_relobj::do_layout): New function.
4956         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4957         (Sized_incr_relobj::do_add_symbols): New function.
4958         (Sized_incr_relobj::do_should_include_member): New function.
4959         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4960         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4961         (Sized_incr_relobj::do_section_size): New function.
4962         (Sized_incr_relobj::do_section_name): New function.
4963         (Sized_incr_relobj::do_section_contents): New function.
4964         (Sized_incr_relobj::do_section_flags): New function.
4965         (Sized_incr_relobj::do_section_entsize): New function.
4966         (Sized_incr_relobj::do_section_address): New function.
4967         (Sized_incr_relobj::do_section_type): New function.
4968         (Sized_incr_relobj::do_section_link): New function.
4969         (Sized_incr_relobj::do_section_info): New function.
4970         (Sized_incr_relobj::do_section_addralign): New function.
4971         (Sized_incr_relobj::do_initialize_xindex): New function.
4972         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4973         (Sized_incr_relobj::do_read_relocs): New function.
4974         (Sized_incr_relobj::do_gc_process_relocs): New function.
4975         (Sized_incr_relobj::do_scan_relocs): New function.
4976         (Sized_incr_relobj::do_count_local_symbols): New function.
4977         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4978         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4979         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4980         (Sized_incr_relobj::do_relocate): New function.
4981         (Sized_incr_relobj::do_set_section_offset): New function.
4982         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4983         (Sized_incr_dynobj::do_read_symbols): New function.
4984         (Sized_incr_dynobj::do_layout): New function.
4985         (Sized_incr_dynobj::do_add_symbols): New function.
4986         (Sized_incr_dynobj::do_should_include_member): New function.
4987         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4988         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4989         (Sized_incr_dynobj::do_section_size): New function.
4990         (Sized_incr_dynobj::do_section_name): New function.
4991         (Sized_incr_dynobj::do_section_contents): New function.
4992         (Sized_incr_dynobj::do_section_flags): New function.
4993         (Sized_incr_dynobj::do_section_entsize): New function.
4994         (Sized_incr_dynobj::do_section_address): New function.
4995         (Sized_incr_dynobj::do_section_type): New function.
4996         (Sized_incr_dynobj::do_section_link): New function.
4997         (Sized_incr_dynobj::do_section_info): New function.
4998         (Sized_incr_dynobj::do_section_addralign): New function.
4999         (Sized_incr_dynobj::do_initialize_xindex): New function.
5000         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5001         (make_sized_incremental_object): New function.
5002         (Incremental_library::copy_unused_symbols): New function.
5003         (Incremental_library::do_for_all_unused_symbols): New function.
5004         * incremental.h (enum Incremental_input_flags): New type.
5005         (class Incremental_checker): Remove.
5006         (Incremental_input_entry::Incremental_input_entry): Add argument
5007         serial number.
5008         (Incremental_input_entry::arg_serial): New function.
5009         (Incremental_input_entry::set_is_in_system_directory): New function.
5010         (Incremental_input_entry::is_in_system_directory): New function.
5011         (Incremental_input_entry::arg_serial_): New data member.
5012         (Incremental_input_entry::is_in_system_directory_): New data member.
5013         (class Script_info): Move here from script.h.
5014         (Script_info::Script_info): Add filename parameter.
5015         (Script_info::filename): New function.
5016         (Script_info::filename_): New data member.
5017         (Incremental_script_entry::Incremental_script_entry): Add argument
5018         serial number.
5019         (Incremental_object_entry::Incremental_object_entry): Likewise.
5020         (Incremental_object_entry::add_input_section): Build list of input
5021         sections with map to original shndx.
5022         (Incremental_object_entry::get_input_section_index): New function.
5023         (Incremental_object_entry::shndx_): New data member.
5024         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5025         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5026         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5027         serial number.
5028         (Incremental_inputs::report_archive_begin): Likewise.
5029         (Incremental_inputs::report_object): Likewise.
5030         (Incremental_inputs::report_script): Likewise.
5031         (class Incremental_global_symbol_reader): New class.
5032         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5033         and store flags and input file type.
5034         (Incremental_input_entry_reader::arg_serial): New function.
5035         (Incremental_input_entry_reader::type): Extract type from flags.
5036         (Incremental_input_entry_reader::is_in_system_directory): New function.
5037         (Incremental_input_entry_reader::get_input_section_count): Call
5038         accessor function for type.
5039         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5040         function for type; adjust size of global symbol entry.
5041         (Incremental_input_entry_reader::get_global_symbol_count): Call
5042         accessor function for type.
5043         (Incremental_input_entry_reader::get_object_count): Likewise.
5044         (Incremental_input_entry_reader::get_object_offset): Likewise.
5045         (Incremental_input_entry_reader::get_member_count): Likewise.
5046         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5047         (Incremental_input_entry_reader::get_member_offset): Likewise.
5048         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5049         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5050         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5051         (Incremental_input_entry_reader::get_global_symbol_reader): New
5052         function.
5053         (Incremental_input_entry_reader::get_output_symbol_index): New
5054         function.
5055         (Incremental_input_entry_reader::type_): Remove.
5056         (Incremental_input_entry_reader::flags_): New data member.
5057         (Incremental_inputs_reader::input_file_offset): New function.
5058         (Incremental_inputs_reader::input_file_index): New function.
5059         (Incremental_inputs_reader::input_file): Call input_file_offset.
5060         (Incremental_inputs_reader::input_file_at_offset): New function.
5061         (Incremental_relocs_reader::get_r_type): Reformat.
5062         (Incremental_relocs_reader::get_r_shndx): Reformat.
5063         (Incremental_relocs_reader::get_r_offset): Reformat.
5064         (Incremental_relocs_reader::data): New function.
5065         (Incremental_binary::Incremental_binary): Initialize new data members.
5066         (Incremental_binary::check_inputs): Add cmdline parameter.
5067         (Incremental_binary::file_is_unchanged): Remove.
5068         (Input_reader::arg_serial): New function.
5069         (Input_reader::get_unused_symbol_count): New function.
5070         (Input_reader::get_unused_symbol): New function.
5071         (Input_reader::do_arg_serial): New function.
5072         (Input_reader::do_get_unused_symbol_count): New function.
5073         (Input_reader::do_get_unused_symbol): New function.
5074         (Incremental_binary::input_file_count): New function.
5075         (Incremental_binary::get_input_reader): Change signature to use
5076         index instead of filename.
5077         (Incremental_binary::file_has_changed): New function.
5078         (Incremental_binary::get_input_argument): New function.
5079         (Incremental_binary::get_library): New function.
5080         (Incremental_binary::get_script_info): New function.
5081         (Incremental_binary::init_layout): New function.
5082         (Incremental_binary::reserve_layout): New function.
5083         (Incremental_binary::output_file): New function.
5084         (Incremental_binary::do_check_inputs): New function.
5085         (Incremental_binary::do_file_is_unchanged): Remove.
5086         (Incremental_binary::do_file_has_changed): New function.
5087         (Incremental_binary::do_init_layout): New function.
5088         (Incremental_binary::do_reserve_layout): New function.
5089         (Incremental_binary::do_input_file_count): New function.
5090         (Incremental_binary::do_get_input_reader): Change signature.
5091         (Incremental_binary::input_args_map_): New data member.
5092         (Incremental_binary::library_map_): New data member.
5093         (Incremental_binary::script_map_): New data member.
5094         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5095         new data members.
5096         (Sized_incremental_binary::output_section): New function.
5097         (Sized_incremental_binary::inputs_reader): Add const.
5098         (Sized_incremental_binary::symtab_reader): Add const.
5099         (Sized_incremental_binary::relocs_reader): Add const.
5100         (Sized_incremental_binary::got_plt_reader): Add const.
5101         (Sized_incremental_binary::get_symtab_view): New function.
5102         (Sized_incremental_binary::Inputs_reader): New typedef.
5103         (Sized_incremental_binary::Input_entry_reader): New typedef.
5104         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5105         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5106         (Sized_incremental_binary::do_file_has_changed): New function.
5107         (Sized_incremental_binary::do_init_layout): New function.
5108         (Sized_incremental_binary::do_reserve_layout): New function.
5109         (Sized_input_reader::Inputs_reader): Remove.
5110         (Sized_input_reader::Input_entry_reader): Remove.
5111         (Sized_input_reader::do_arg_serial): New function.
5112         (Sized_input_reader::do_get_unused_symbol_count): New function.
5113         (Sized_input_reader::do_get_unused_symbol): New function.
5114         (Sized_incremental_binary::do_input_file_count): New function.
5115         (Sized_incremental_binary::do_get_input_reader): Change signature;
5116         use index instead of filename.
5117         (Sized_incremental_binary::section_map_): New data member.
5118         (Sized_incremental_binary::input_entry_readers_): New data member.
5119         (class Sized_incr_relobj): New class.
5120         (class Sized_incr_dynobj): New class.
5121         (make_sized_incremental_object): New function.
5122         (class Incremental_library): New class.
5123         * layout.cc (Free_list::num_lists): New static data member.
5124         (Free_list::num_nodes): New static data member.
5125         (Free_list::num_removes): New static data member.
5126         (Free_list::num_remove_visits): New static data member.
5127         (Free_list::num_allocates): New static data member.
5128         (Free_list::num_allocate_visits): New static data member.
5129         (Free_list::init): New function.
5130         (Free_list::remove): New function.
5131         (Free_list::allocate): New function.
5132         (Free_list::dump): New function.
5133         (Free_list::print_stats): New function.
5134         (Layout_task_runner::run): Resize output file for incremental updates.
5135         (Layout::Layout): Initialize new data members.
5136         (Layout::set_incremental_base): New function.
5137         (Layout::init_fixed_output_section): New function.
5138         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5139         incremental updates.
5140         (Layout::create_gold_note): Do not create gold note section for
5141         incremental updates.
5142         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5143         for incremental updates.
5144         (Layout::set_section_offsets): For incremental updates, allocate space
5145         from free list.
5146         (Layout::create_symtab_sections): Layout with offsets relative to
5147         start of section; for incremental updates, allocate space from free
5148         list.
5149         (Layout::create_shdrs): For incremental updates, allocate space from
5150         free list.
5151         (Layout::finish_dynamic_section): For incremental updates, do not
5152         check --as-needed (fixed in subsequent patch).
5153         * layout.h (class Free_list): New class.
5154         (Layout::set_incremental_base): New function.
5155         (Layout::incremental_base): New function.
5156         (Layout::init_fixed_output_section): New function.
5157         (Layout::allocate): New function.
5158         (Layout::incremental_base_): New data member.
5159         (Layout::free_list_): New data member.
5160         * main.cc (main): Print Free_list statistics.
5161         * object.cc (Relobj::finalize_incremental_relocs): Add
5162         clear_counts parameter; clear counts only when clear_counts is set.
5163         (Sized_relobj::Sized_relobj): Initialize new base class.
5164         (Sized_relobj::do_layout): Don't report special sections.
5165         (Sized_relobj::do_for_all_local_got_entries): New function.
5166         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5167         symtab_off to all symbol table offsets.
5168         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5169         * object.h (class Got_offset_list): Move to top of file.
5170         (Object::Object): Allow case where input_file == NULL.
5171         (Object::~Object): Likewise.
5172         (Object::input_file): Assert that input_file != NULL.
5173         (Object::lock): Allow case where input_file == NULL.
5174         (Object::unlock): Likewise.
5175         (Object::is_locked): Likewise.
5176         (Object::token): Likewise.
5177         (Object::release): Likewise.
5178         (Object::is_incremental): New function.
5179         (Object::get_mtime): New function.
5180         (Object::for_all_local_got_entries): New function.
5181         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5182         (Object::set_is_in_system_directory): New function.
5183         (Object::is_in_system_directory): New function.
5184         (Object::do_is_incremental): New function.
5185         (Object::do_get_mtime): New function.
5186         (Object::do_for_all_local_got_entries): New function.
5187         (Object::is_in_system_directory_): New data member.
5188         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5189         (class Sized_relobj_base): New class.
5190         (class Sized_relobj): Derive from Sized_relobj_base.
5191         (class Sized_relobj::Symbols): Redeclare from base class.
5192         (class Sized_relobj::local_got_offset_list): Remove.
5193         (class Sized_relobj::Output_sections): Redeclare from base class.
5194         (class Sized_relobj::do_for_all_local_got_entries): New function.
5195         (class Sized_relobj::write_local_symbols): Add offset parameter.
5196         (class Sized_relobj::local_symbol_offset_): Update comment.
5197         (class Sized_relobj::local_dynsym_offset_): Update comment.
5198         * options.cc (Input_arguments::add_file): Remove const.
5199         * options.h (Input_file_argument::Input_file_argument):
5200         Initialize arg_serial_ (all constructors).
5201         (Input_file_argument::set_arg_serial): New function.
5202         (Input_file_argument::arg_serial): New function.
5203         (Input_file_argument::arg_serial_): New data member.
5204         (Input_arguments::Input_arguments): Initialize file_count_.
5205         (Input_arguments::add_file): Remove const.
5206         (Input_arguments::number_of_input_files): New function.
5207         (Input_arguments::file_count_): New data member.
5208         (Command_line::number_of_input_files): Call
5209         Input_arguments::number_of_input_files.
5210         * output.cc (Output_segment_headers::Output_segment_headers):
5211         Set current size.
5212         (Output_section::Input_section::current_data_size): New function.
5213         (Output_section::Output_section): Initialize new data members.
5214         (Output_section::add_input_section): Don't do merge sections for
5215         an incremental link; allocate space from free list for an
5216         incremental update.
5217         (Output_section::add_output_section_data): Allocate space from
5218         free list for an incremental update.
5219         (Output_section::update_data_size): New function.
5220         (Output_section::set_fixed_layout): New function.
5221         (Output_section::reserve): New function.
5222         (Output_segment::set_section_addresses): Remove const.
5223         (Output_segment::set_section_list_addresses): Remove const; allocate
5224         space from free list for an incremental update.
5225         (Output_segment::set_offset): Adjust size of RELRO segment for an
5226         incremental update.
5227         * output.h (Output_data::current_data_size): Move here from
5228         child classes.
5229         (Output_data::pre_finalize_data_size): New function.
5230         (Output_data::update_data_size): New function.
5231         (Output_section_headers::update_data_size): new function.
5232         (Output_section_data_build::current_data_size): Move to Output_data.
5233         (Output_data_strtab::update_data_size): New function.
5234         (Output_section::current_data_size): Move to Output_data.
5235         (Output_section::set_fixed_layout): New function.
5236         (Output_section::has_fixed_layout): New function.
5237         (Output_section::reserve): New function.
5238         (Output_section::update_data_size): New function.
5239         (Output_section::has_fixed_layout_): New data member.
5240         (Output_section::free_list_): New data member.
5241         (Output_segment::set_section_addresses): Remove const.
5242         (Output_segment::set_section_list_addresses): Remove const.
5243         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5244         New function.
5245         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5246         New function.
5247         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5248         parameter when calling Add_symbols constructor; store argument
5249         serial number for members of a lib group.
5250         (Add_symbols::locks): Allow case where token == NULL.
5251         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5252         (Read_member::~Read_member): New function.
5253         (Read_member::is_runnable): New function.
5254         (Read_member::locks): New function.
5255         (Read_member::run): New function.
5256         (Check_script::~Check_script): New function.
5257         (Check_script::is_runnable): New function.
5258         (Check_script::locks): New function.
5259         (Check_script::run): New function.
5260         (Check_library::~Check_library): New function.
5261         (Check_library::is_runnable): New function.
5262         (Check_library::locks): New function.
5263         (Check_library::run): New function.
5264         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5265         (Add_symbols::library_): New data member.
5266         (class Read_member): New class.
5267         (class Check_script): New class.
5268         (class Check_library): New class.
5269         * reloc.cc (Read_relocs::is_runnable): Allow case where
5270         token == NULL.
5271         (Read_relocs::locks): Likewise.
5272         (Scan_relocs::locks): Likewise.
5273         (Relocate_task::locks): Likewise.
5274         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5275         to clear counters.
5276         (Sized_relobj::incremental_relocs_scan): Fix comment.
5277         (Sized_relobj::do_relocate): Pass output file offset to
5278         write_local_symbols.
5279         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5280         from class declaration.
5281         * script.cc (read_input_script): Allocate Script_info; pass
5282         argument serial number to report_script.
5283         * script.h (class Script_info): Move to incremental.h.
5284         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5285         * symtab.h (Symbol_table::add_from_incrobj): New function.
5286         (Symbol_table::set_file_offset): New function.
5287
5288 2011-04-05  Cary Coutant  <ccoutant@google.com>
5289
5290         * incremental-dump.cc (dump_incremental_inputs): Change signature
5291         to take a Sized_incremental_binary; change caller.  Use readers
5292         in Sized_incremental_binary.
5293         * incremental.cc
5294         (Sized_incremental_binary::find_incremental_inputs_sections):
5295         Rename do_find_incremental_inputs_sections to this.
5296         (Sized_incremental_binary::setup_readers): New function.
5297         (Sized_incremental_binary::do_check_inputs): Check
5298         has_incremental_info_ flag; move setup code to setup_readers;
5299         use input readers.
5300         (Sized_incremental_binary::do_file_is_unchanged): New function.
5301         (Sized_incremental_binary::do_get_input_reader): New function.
5302         * incremental.h (class Incremental_binary): Move to end of file.
5303         (Incremental_binary::file_is_unchanged): New function.
5304         (Incremental_binary::do_file_is_unchanged): New function.
5305         (Incremental_binary::Input_reader): New class.
5306         (Incremental_binary::get_input_reader): New function.
5307         (class Sized_incremental_binary): Move to end of file.
5308         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5309         input section reader classes.
5310         (Sized_incremental_binary::has_incremental_info): New function.
5311         (Sized_incremental_binary::inputs_reader): New function.
5312         (Sized_incremental_binary::symtab_reader): New function.
5313         (Sized_incremental_binary::relocs_reader): New function.
5314         (Sized_incremental_binary::got_plt_reader): New function.
5315         (Sized_incremental_binary::do_file_is_unchanged): New function.
5316         (Sized_incremental_binary::Sized_input_reader): New class.
5317         (Sized_incremental_binary::get_input_reader): New function.
5318         (Sized_incremental_binary::find_incremental_inputs_sections):
5319         Rename do_find_incremental_inputs_sections to this.
5320         (Sized_incremental_binary::setup_readers): New function.
5321         (Sized_incremental_binary::has_incremental_info_): New data member.
5322         (Sized_incremental_binary::inputs_reader_): New data member.
5323         (Sized_incremental_binary::symtab_reader_): New data member.
5324         (Sized_incremental_binary::relocs_reader_): New data member.
5325         (Sized_incremental_binary::got_plt_reader_): New data member.
5326         (Sized_incremental_binary::current_input_file_): New data member.
5327
5328 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5329
5330         PR gold/12640
5331         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5332         violation.
5333
5334 2011-03-30  Cary Coutant  <ccoutant@google.com>
5335
5336         * archive.cc (Archive::include_member): Adjust call to report_object.
5337         (Add_archive_symbols::run): Add script_info to call to
5338         report_archive_begin.
5339         (Lib_group::include_member): Adjust call to report_object.
5340         (Add_lib_group_symbols::run): Adjust call to report_object.
5341         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5342         blocks.  Add object count for script input files.
5343         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5344         script_info parameter; change all callers.
5345         (Incremental_inputs::report_object): Add script_info parameter;
5346         change all callers.
5347         (Incremental_inputs::report_script): Store backpointer to
5348         incremental info entry.
5349         (Output_section_incremental_inputs::set_final_data_size): Record
5350         additional information for scripts.
5351         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5352         * incremental.h (Incremental_script_entry::add_object): New function.
5353         (Incremental_script_entry::get_object_count): New function.
5354         (Incremental_script_entry::get_object): New function.
5355         (Incremental_script_entry::objects_): New data member; adjust
5356         constructor.
5357         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5358         (Incremental_inputs::report_object): Add script_info parameter.
5359         (Incremental_inputs_reader::get_object_count): New function.
5360         (Incremental_inputs_reader::get_object_offset): New function.
5361         * options.cc (Input_arguments::add_file): Return reference to
5362         new input argument.
5363         * options.h (Input_argument::set_script_info): New function.
5364         (Input_argument::script_info): New function.
5365         (Input_argument::script_info_): New data member; adjust all
5366         constructors.
5367         (Input_file_group::add_file): Return reference to new input argument.
5368         (Input_file_lib::add_file): Likewise.
5369         (Input_arguments::add_file): Likewise.
5370         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5371         * script.cc (Parser_closure::Parser_closure): Add script_info
5372         parameter; adjust all callers.
5373         (Parser_closure::script_info): New function.
5374         (Parser_closure::script_info_): New data member.
5375         (read_input_script): Report scripts earlier to incremental info.
5376         (script_add_file): Set script_info in Input_argument.
5377         (script_add_library): Likewise.
5378         * script.h (Script_options::Script_info): Rewrite class.
5379
5380 2011-03-29  Cary Coutant  <ccoutant@google.com>
5381
5382         * archive.cc (Library_base::should_include_member): Move
5383         method here from class Archive.
5384         (Archive::Archive): Initialize base class.
5385         (Archive::should_include_member): Move to base class.
5386         (Archive::do_for_all_unused_symbols): New function.
5387         (Add_archive_symbols::run): Remove redundant access to
5388         incremental_inputs.
5389         (Lib_group::Lib_group): Initialize base class.
5390         (Lib_group::do_filename): New function.
5391         (Lib_group::include_member): Pass pointer to Lib_group to
5392         report_object.
5393         (Lib_group::do_for_all_unused_symbols): New function.
5394         (Add_lib_group_symbols::run): Report archive information for
5395         incremental links.
5396         * archive.h (class Library_base): New base class.
5397         (class Archive): Derive from Library_base.
5398         (Archive::filename): Move to base class.
5399         (Archive::set_incremental_info): Likewise.
5400         (Archive::incremental_info): Likewise.
5401         (Archive::Should_include): Likewise.
5402         (Archive::should_include_member): Likewise.
5403         (Archive::Armap_entry): Remove.
5404         (Archive::Unused_symbol_iterator): Remove.
5405         (Archive::unused_symbols_begin): Remove.
5406         (Archive::unused_symbols_end): Remove.
5407         (Archive::do_filename): New function.
5408         (Archive::do_get_mtime): New function.
5409         (Archive::do_for_all_unused_symbols): New function.
5410         (Archive::task_): Move to base class.
5411         (Archive::incremental_info_): Likewise.
5412         (class Lib_group): Derive from Library_base.
5413         (Lib_group::do_filename): New function.
5414         (Lib_group::do_get_mtime): New function.
5415         (Lib_group::do_for_all_unused_symbols): New function.
5416         (Lib_group::task_): Move to base class.
5417         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5418         function.
5419         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5420         function.
5421         * incremental.cc (Incremental_inputs::report_archive_begin):
5422         Use Library_base; call library's get_mtime; add incremental inputs
5423         entry before members.
5424         (class Unused_symbol_visitor): New class.
5425         (Incremental_inputs::report_archive_end): Use Library_base; use
5426         visitor class to record unused symbols; don't add incremental inputs
5427         entry after members.
5428         (Incremental_inputs::report_object): Use Library_base.
5429         * incremental.h
5430         (Incremental_archive_entry::Incremental_archive_entry): Remove
5431         unused Archive parameter.
5432         (Incremental_inputs::report_archive_begin): Use Library_base.
5433         (Incremental_inputs::report_archive_end): Likewise.
5434         (Incremental_inputs::report_object): Likewise.
5435         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5436         function.
5437         * object.h (Object::for_all_global_symbols): New function.
5438         (Object::do_for_all_global_symbols): New function.
5439         (Sized_relobj::do_for_all_global_symbols): New function.
5440         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5441         function.
5442         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5443         function.
5444
5445 2011-03-27  Ian Lance Taylor  <iant@google.com>
5446
5447         * archive.cc (Archive::interpret_header): Return -1 if something
5448         goes wrong.  Change callers accordingly.
5449
5450 2011-03-25  Cary Coutant  <ccoutant@google.com>
5451
5452         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5453         * testsuite/Makefile.in: Regenerate.
5454
5455 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5456
5457         * plugin.cc (get_view): New.
5458         (Plugin::load): Pass get_view to the plugin.
5459         (Plugin_manager::get_view): New.
5460
5461 2011-03-21  Ian Lance Taylor  <iant@google.com>
5462
5463         * testsuite/final_layout.sh: Rewrite to not use dc.
5464         * testsuite/relro_test.sh: Fail if dc is not present.
5465
5466 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5467
5468         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5469         Change == to -eq.
5470         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5471         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5472         Change == to -eq.
5473         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5474         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5475
5476 2011-03-14  Ian Lance Taylor  <iant@google.com>
5477
5478         * script-sections.cc (Sort_output_sections::script_compare):
5479         Rename from is_before, change return type.
5480         (Sort_output_sections::operator()): Adjust accordingly.
5481
5482 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5483
5484         PR gold/12572
5485         * testsuite/odr_violation2.cc: Add comment to make all error line
5486         numbers double digits.
5487         * testsuite/debug_msg.sh: Adjust expected errors.
5488
5489 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5490
5491         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5492         but mark earlier ones as non-canonical
5493         (offset_to_iterator): Update search target and example
5494         (do_addr2line): Return extra lines in a vector*
5495         (format_file_lineno): Extract from do_addr2line
5496         (one_addr2line): Add vector* out-param
5497         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5498         when a lineno entry appeared last for its instruction
5499         (Dwarf_line_info): Add vector* out-param
5500         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5501         * symtab.cc (Odr_violation_compare): Include the lineno in the
5502         comparison again.
5503         (linenos_from_loc): New. Combine the canonical line for an
5504         address with its other lines.
5505         (True_if_intersect): New. Helper functor to make
5506         std::set_intersection a query.
5507         (detect_odr_violations): Compare sets of lines instead of just
5508         one line for each function. This became less deterministic, but
5509         has fewer false positives.
5510         * symtab.h: Declarations.
5511         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5512         mix an optimized and non-optimized object in the same binary
5513         (odr_violation2.so): Same.
5514         * testsuite/Makefile.in: Regenerate from Makefile.am.
5515         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5516         * testsuite/debug_msg.sh: Update line numbers and add
5517         assertions.
5518         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5519         non-optimized context.
5520         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5521         isn't inlined, and use OdrDerived in an optimized context.
5522         * testsuite/odr_header1.h: Defines OdrDerived, where
5523         optimization will change the
5524         first-instruction-in-the-destructor's file and line number.
5525         * testsuite/odr_header2.h: Defines OdrBase.
5526
5527 2011-03-09  Ian Lance Taylor  <iant@google.com>
5528
5529         * fileread.cc (File_read::clear_views): Don't delete the whole
5530         file view.
5531
5532 2011-03-08  Ian Lance Taylor  <iant@google.com>
5533
5534         PR gold/12525
5535         * fileread.cc: #include <climits>.
5536         (GOLD_IOV_MAX): Define.
5537         (File_read::read_multiple): Limit number of entries by iov_max.
5538         * fileread.h (class File_read): Always set max_readv_entries to
5539         128.
5540
5541 2011-03-07  Ian Lance Taylor  <iant@google.com>
5542
5543         PR gold/12525
5544         * options.h (class General_options): Add -dy and -dn.
5545
5546 2011-03-02  Cary Coutant  <ccoutant@google.com>
5547
5548         * testsuite/script_test_9.t: Add TLS segment.
5549
5550 2011-03-02  Simon Baldwin  <simonb@google.com>
5551
5552         * configure.ac: Add check for gnu_indirect_function support in
5553         the toolchain building binutils.
5554         * configure: Rebuild.
5555
5556 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5557
5558         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5559         plugin only symbols.
5560         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5561         in plugin files as not needed in the symbol table.
5562
5563 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5564
5565         * output.cc (Output_section::add_input_section): Delay fill
5566         generation for section ordering.
5567
5568 2011-02-09  Ian Lance Taylor  <iant@google.com>
5569
5570         PR gold/12316
5571         * object.h (class Sized_relobj): Remove clear_local_symbols.
5572         * reloc.cc (Sized_relobj::do_relocate): Don't call
5573         clear_local_symbols.
5574
5575 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5576
5577         * plugin.cc (is_visible_from_outside): Return true for symbols
5578         in the -u option.
5579
5580 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5581
5582         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5583         filename.
5584
5585 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5586
5587         * icf.h (is_section_foldable_candidate): Change type of parameter
5588         to std::string.
5589         * icf.cc (Icf::find_identical_sections): Change type of local variable
5590         section_name to be std::string.
5591         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5592
5593 2011-01-25  Ian Lance Taylor  <iant@google.com>
5594
5595         * script.cc (script_add_extern): Rewrite to use
5596         add_symbol_reference.
5597
5598 2011-01-25  Doug Kwan  <dougkwan@google.com>
5599
5600         * icf.cc (get_section_contents): Always lock section's object.
5601
5602 2011-01-24  Ian Lance Taylor  <iant@google.com>
5603
5604         * options.h (class General_options): Accept
5605         --no-detect-odr-violations.
5606
5607 2011-01-24  Ian Lance Taylor  <iant@google.com>
5608
5609         * version.cc (version_string): Bump to 1.11.
5610
5611 2011-01-24  Ian Lance Taylor  <iant@google.com>
5612
5613         * plugin.cc (class Plugin_rescan): Define new class.
5614         (Plugin_manager::claim_file): Set any_claimed_.
5615         (Plugin_manager::save_archive): New function.
5616         (Plugin_manager::save_input_group): New function.
5617         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5618         necessary.
5619         (Plugin_manager::new_undefined_symbol): New function.
5620         (Plugin_manager::rescan): New function.
5621         (Plugin_manager::rescannable_defines): New function.
5622         (Plugin_manager::add_input_file): Set any_added_.
5623         * plugin.h (class Plugin_manager): define new fields rescannable_,
5624         undefined_symbols_, any_claimed_, and any_added_.  Declare
5625         Plugin_rescan as friend.  Declare new functions.
5626         (Plugin_manager::Rescannable): Define type.
5627         (Plugin_manager::Rescannable_list): Define type.
5628         (Plugin_manager::Undefined_symbol_list): Define type.
5629         (Plugin_manager::Plugin_manager): Initialize new fields.
5630         * archive.cc (Archive::defines_symbol): New function.
5631         (Add_archive_symbols::run): Pass archive to plugins if any.
5632         * archive.h (class Archive): Declare defines_symbol.
5633         * readsyms.cc (Input_group::~Input_group): New function.
5634         (Finish_group::run): Pass input_group to plugins if any.
5635         * readsyms.h (class Input_group): Declare destructor.
5636         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5637         any.
5638
5639 2011-01-10  Ian Lance Taylor  <iant@google.com>
5640
5641         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5642         section as relro.
5643         (Layout::set_segment_offsets): Reset increase_relro before calling
5644         set_section_addresses a second time.
5645
5646 2011-01-04  Cary Coutant  <ccoutant@google.com>
5647
5648         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5649         sections before NOBITS sections.
5650
5651 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5652
5653         * version.cc (print_version): Update copyright to 2011.
5654
5655 2010-12-23  Cary Coutant  <ccoutant@google.com>
5656
5657         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5658         of OS to this->add.  Add OD parameter to second form of the function.
5659
5660 2010-12-20  Ian Lance Taylor  <iant@google.com>
5661
5662         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5663         second of two consecutive entries with same offset.
5664
5665 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5666
5667         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5668         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5669         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5670         to avoid unneeded links against $(LDADD).
5671         * testsuite/Makefile.in: Regenerate.
5672
5673 2010-12-15  Ian Lance Taylor  <iant@google.com>
5674
5675         PR gold/12324
5676         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5677         for R_X86_64_32 and R_X86_64_PC32.
5678         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5679         ver_matching_def_pic.o.
5680         (ver_matching_def_pic.o): New target.
5681
5682 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5683
5684         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5685         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5686         Move definition before File_read::View member definitions.
5687         (File_read::View::~View): Initialize and hold lock before
5688         updating current_mapped_bytes.
5689
5690 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5691
5692         * dwarf_reader.cc: Remove outdated comment.
5693         * gold-threads.cc: Fix typo in error message.
5694         * archive.cc: Fix typos in comments.
5695         * archive.h: Likewise.
5696         * arm-reloc-property.cc: Likewise.
5697         * arm-reloc-property.h: Likewise.
5698         * arm-reloc.def: Likewise.
5699         * arm.cc: Likewise.
5700         * attributes.h: Likewise.
5701         * cref.cc: Likewise.
5702         * ehframe.cc: Likewise.
5703         * fileread.h: Likewise.
5704         * gold.h: Likewise.
5705         * i386.cc: Likewise.
5706         * icf.cc: Likewise.
5707         * incremental.h: Likewise.
5708         * int_encoding.cc: Likewise.
5709         * layout.h: Likewise.
5710         * main.cc: Likewise.
5711         * merge.h: Likewise.
5712         * object.cc: Likewise.
5713         * object.h: Likewise.
5714         * options.cc: Likewise.
5715         * readsyms.cc: Likewise.
5716         * reduced_debug_output.cc: Likewise.
5717         * reloc.cc: Likewise.
5718         * script-sections.cc: Likewise.
5719         * sparc.cc: Likewise.
5720         * symtab.h: Likewise.
5721         * target-reloc.h: Likewise.
5722         * target.cc: Likewise.
5723         * target.h: Likewise.
5724         * timer.cc: Likewise.
5725         * timer.h: Likewise.
5726         * x86_64.cc: Likewise.
5727
5728 2010-12-09  Cary Coutant  <ccoutant@google.com>
5729
5730         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5731         stack.
5732         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5733         parameter; change all callers.
5734         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5735         * options.h (warn_execstack): New option.
5736
5737 2010-12-07  Doug Kwan  <dougkwan@google.com>
5738
5739         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5740         like function call relocations.
5741
5742 2010-12-07  Ian Lance Taylor  <iant@google.com>
5743
5744         * archive.cc (Archive::get_elf_object_for_member): Permit
5745         punconfigured to be NULL.
5746         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5747         (Archive::include_member): Pass NULL to get_elf_object_for_member
5748         if we searched for the archive and this is the first included
5749         object.
5750
5751 2010-12-01  Ian Lance Taylor  <iant@google.com>
5752
5753         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5754         track_relocs_type_ field.
5755         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5756         Set track_relocs_type_.
5757         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5758         contents when using RELA relocs.
5759         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5760         reloc_map_.
5761         * reloc.cc (Track_relocs::next_addend): New function.
5762         * reloc.h (class Track_relocs): Declare next_addend.
5763
5764 2010-12-01  Ian Lance Taylor  <iant@google.com>
5765
5766         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5767         virtual destructor.
5768
5769 2010-12-01  Ian Lance Taylor  <iant@google.com>
5770
5771         * README: Update compilers known to work and fail.
5772
5773 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5774
5775         * configure.in: For --enable-gold, handle value `default' instead of
5776         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5777         not the default.
5778         * configure: Regenerate.
5779
5780 2010-11-18  Doug Kwan  <dougkwan@google.com>
5781
5782         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5783         and right_alignment to be zero.  Store result alignment only if it is
5784         greater than existing alignment.
5785
5786 2010-11-16  Cary Coutant  <ccoutant@google.com>
5787
5788         PR gold/12220
5789         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5790         Check for ".zdebug_line".
5791
5792 2010-11-16  Doug Kwan  <dougkwan@google.com>
5793             Cary Coutant  <ccoutant@google.com>
5794
5795         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5796         by reference; adjust all callers.
5797         * output.cc (Output_segment::set_section_addresses): Adjust references
5798         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5799         list is empty.
5800         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5801         end at page boundary.
5802
5803 2010-11-16  Cary Coutant  <ccoutant@google.com>
5804
5805         PR gold/12220
5806         * layout.cc (Layout::choose_output_section): Transform names of
5807         compressed sections even when using a script with a SECTIONS clause.
5808         (Layout::output_section_name): Remove code to transform
5809         compressed debug section names.
5810         * output.cc (Output_section::add_input_section): Use uncompressed
5811         section size when tracking input sections.
5812
5813 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5814
5815         * symtab.h (Symbol::NON_PIC_REF): Remove.
5816         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5817         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5818         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5819         (Symbol::use_plt_offset): Take a flags argument and pass it
5820         directly to needs_dynamic_reloc.  Restrict check for undefined
5821         weak symbols to function calls.
5822         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5823         (Target_arm::Scan::global): Use it.
5824         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5825         (Target_arm::Relocate::relocate): Likewise.
5826         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5827         parameter with an r_type parameter.  Use get_reference_flags
5828         to get the flags.
5829         (Target_arm::Relocate::relocate): Update accordingly.
5830         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5831         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5832         (Target_i386::Scan::global): Likewise.
5833         (Target_i386::Relocate::relocate): Likewise.
5834         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5835         parameter with an r_type parameter.  Use get_reference_flags
5836         to get the flags.
5837         (Target_i386::Relocate::relocate): Update accordingly.
5838         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5839         (Target_powerpc::Scan::global): Use it.
5840         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5841         (Target_powerpc::Relocate::relocate): Likewise.
5842         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5843         (Target_sparc::Scan::global): Use it.
5844         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5845         (Target_sparc::Relocate::relocate): Likewise.
5846         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5847         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5848         (Target_x86_64::Scan::global): Likewise.
5849         (Target_x86_64::Relocate::relocate): Likewise.
5850
5851 2010-11-08  Doug Kwan  <dougkwan@google.com>
5852             Cary Coutant  <ccoutant@google.com>
5853
5854         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5855         (Arm_exidx_merge_section::section_contents_): New data member.
5856         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5857         (Arm_input_section::~Arm_input_section): De-allocate memory.
5858         (Arm_input_section::original_contents_): New data member.
5859         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5860         in parameters instead of calling Object::section_contents without
5861         locking.
5862         (Arm_output_section::group_section): New parameter TASK.  Pass it
5863         to callees that need locking objects.
5864         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5865         to lock EXIDX input sections.  Fix a formatting issue.  Call
5866         Arm_exidx_merged_section::build_contents to create merged section
5867         contents.
5868         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5869         to lock object of stub table owner.
5870         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5871         TEXT_SIZE to initialize data member TEXT_SIZE_.
5872         (Arm_exidx_input_section::addralign): Fix typo in comment.
5873         (Arm_exidx_input_section::text_size): New method.
5874         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5875         that require locking objects.  Lock objects before scanning for stubs
5876         and updating local symbols.
5877         (Arm_input_section<big_endian>::init): Copy contents of original
5878         input section.
5879         (Arm_input_section<big_endian>::do_write): Use saved contents of
5880         original input section instead of calling Object::section_contents
5881         without locking.
5882         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5883         size without calling Object::section_size().
5884         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5885         for size.  Allocate a buffer for merged EXIDX entries.
5886         (Arm_exidx_merged_section::build_contents): New method.
5887         (Arm_exidx_merged_section::do_write): Move merge section contents
5888         building code to Arm_exidx_merged_section::build_contetns.  Write
5889         out contetns in buffer instead of building it on the fly.
5890         (Arm_relobj::make_exidx_input_section): Also pass text section size
5891         to Arm_exidx_input_section constructor.
5892         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5893         (Arm_dynobj::do_read_symbols): Fix memory leak.
5894         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5895         * target.h: (class Task): Add forward declaration.
5896         (Target::relax): Add new parameter TASK and pass it to
5897         Target::do_relax().
5898         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5899
5900 2010-11-05  Cary Coutant  <ccoutant@google.com>
5901
5902         PR gold/10708
5903         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5904         object when reading from the file.
5905         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5906         second layout pass.
5907         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5908         when reading section contents.
5909         (get_section_contents): Likewise.
5910         (icf::find_identical_sections): Likewise.
5911         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5912         object when reading from the file.
5913         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5914         the object when doing deferred section layout.
5915
5916 2010-11-03  Nick Clifton  <nickc@redhat.com>
5917
5918         PR gold/12001
5919         * script.h (class Symbol_assignment: name): New member.  Returns
5920         the name of the symbol.
5921         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5922         Returns true if the given symbol name is on the list of
5923         assignments wating to be processed.
5924         * archive.cc (should_incldue_member): If the symbol is undefined,
5925         check to see if it is on the list of symbols pending assignment.
5926
5927 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5928
5929         * script-sections.cc (Script_sections::find_memory_region): Check
5930         for a NULL output section pointer.
5931
5932 2010-10-29  Doug Kwan  <dougkwan@google.com>
5933
5934         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5935         Output_section::add_relaxed_input_section.
5936         * output.cc (Output_section::add_relaxed_input_section): Add new
5937         arguments LAYOUT and NAME.  Set section order index.
5938         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5939         Copy section order index.
5940         * output.h (Output_section::add_relaxed_input_section): Add new
5941         arguments LAYOUT and NAME.
5942
5943 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5944
5945         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5946         NATIVE_OR_CROSS_LINKER.
5947         * testsuite/Makefile.in: Regenerate.
5948
5949 2010-10-20  Doug Kwan  <dougkwan@google.com>
5950
5951         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5952         without SHF_LINK_ORDER flags.
5953         * layout.cc (Layout::choose_output_section): Do not filter
5954         SHF_LINK_ORDER flag in a relocatable link.
5955
5956 2010-10-17  Cary Coutant  <ccoutant@google.com>
5957
5958         * output.h (Output_segment::set_section_addresses): Change function
5959         signature.  Update all callers.
5960         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5961         sections.
5962         (Output_segment::set_section_addresses): Align after last TLS
5963         section.  Add padding before last relro section instead of after.
5964
5965 2010-10-17  Doug Kwan  <dougkwan@google.com>
5966
5967         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5968         GOT output section to be writable.
5969
5970 2010-10-14  Cary Coutant  <ccoutant@google.com>
5971
5972         * debug.h (DEBUG_INCREMENTAL): New flag.
5973         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5974         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5975         mode.
5976         * incremental.cc (report_command_line): Ignore all forms of
5977         --incremental.
5978         * layout.cc (Layout::Layout): Check parameters for incremental link
5979         mode.
5980         * options.cc (General_options::parse_incremental): New function.
5981         (General_options::parse_no_incremental): New function.
5982         (General_options::parse_incremental_full): New function.
5983         (General_options::parse_incremental_update): New function.
5984         (General_options::incremental_mode_): New data member.
5985         (General_options::finalize): Check incremental_mode_.
5986         * options.h (General_options): Update help text for --incremental.
5987         Add --no-incremental, --incremental-full, --incremental-update.
5988         (General_options::Incremental_mode): New enum type.
5989         (General_options::incremental_mode): New function.
5990         (General_options::incremental_mode_): New data member.
5991         * parameters.cc (Parameters::incremental_mode_): New data member.
5992         (Parameters::set_options): Set incremental_mode_.
5993         (Parameters::set_incremental_full): New function.
5994         (Parameters::incremental): New function.
5995         (Parameters::incremental_update): New function.
5996         (set_parameters_incremental_full): New function.
5997         * parameters.h (Parameters::set_incremental_full): New function.
5998         (Parameters::incremental): New function.
5999         (Parameters::incremental_update): New function.
6000         (Parameters::incremental_mode_): New data member.
6001         (set_parameters_incremental_full): New function.
6002         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6003         incremental link mode.
6004         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6005         (Sized_relobj::do_relocate_sections): Likewise.
6006         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6007         option.
6008         * testsuite/Makefile.in: Regenerate.
6009         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6010
6011 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6012
6013         * script-sections.h (class Script_sections): Make
6014         Sections_elements typedef public.
6015         * script-sections.cc (class Sort_output_sections): Add elements_
6016         field.  Add constructor which sets it; change all callers.
6017         (Sort_output_sections::is_before): New function.
6018         (Sort_output_sections::operator()): Call is_before.
6019         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6020         conditional.
6021         * testsuite/script_test_10.sh: New test. Test script section
6022         order.
6023         * testsuite/script_test_10.t: Likewise.
6024         * testsuite/script_test_10.s: Likewise.
6025         * testsuite/Makefile.am: Wrap the cross linker tests and the
6026         common tests into NATIVE_OR_CROSS_LINKER.
6027         (check_SCRIPTS): Add script_test_10.sh.
6028         (check_DATA): Add script_test_10.stdout.
6029         (script_test_10.o, script_test_10): New targets.
6030         (script_test_10.stdout): New target.
6031         * configure, testsuite/Makefile.in: Regenerate.
6032
6033 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6034
6035         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6036         error for the deprecated relocations.
6037         (Target_arm::Scan::global): Likewise.
6038         (Target_arm::Relocate::relocate): Likewise.
6039
6040 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6041
6042         * fileread.cc (Input_file::find_file): Initialize *found_name
6043         and *namep when using the fallback search for case 4.
6044
6045 2010-10-11  Cary Coutant  <ccoutant@google.com>
6046
6047         * options.h (class General_options): Redefine -z lazy as an alias for
6048         the negation of -z now.
6049
6050 2010-10-11  Ian Lance Taylor  <iant@google.com>
6051
6052         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6053         binding.
6054
6055 2010-10-06  Nick Clifton  <nickc@redhat.com>
6056
6057         * script-sections.cc(class Memory_region): Remove
6058         current_lma_offset_ field.  Rename current_vma_offset_ to
6059         current_offset_.  Add last_section_ field.
6060         (Memory_region::get_current_vma_address): Rename to
6061         get_current_address.
6062         (Memory_region::get_current_lma_address): Delete.
6063         (Memory_region::increment_vma_offset): Rename to
6064         increment_offset.
6065         (Memory_region::increment_lma_offset): Delete.
6066         (Memory_region::attributes_compatible): New method.  Returns
6067         true if the provided section is compatible with the region.
6068         (Memory_region::get_last_section): New method.  Returns the last
6069         section to use the region.
6070         (Memory_region::set_last_section): New method.  Stores the last
6071         section to use the region.
6072         (Script_sections::block_in_region): New method.  Returns true if
6073         a block of memory is contained within a region.
6074         (Script_sections::find_memory_region): New method.  Locates a
6075         memory region to be used to set a VMA or LMA address.
6076         (Output_section_definition::set_section_addresses): Add code to
6077         check for addresses set by memory regions.
6078         (Output_segment::set_section_addresses): Remove memory region
6079         walking code.
6080         (Script_sections::create_segment): Add a warning if a header
6081         segment is created outside of any region.
6082         * script-sections.h (class Script_sections): Add prototypes for
6083         find_memory_region and block_in_region methods.
6084         * testsuite/memory_test.s: Use .long instead of .word.
6085         * testsuite/memory_test.t: Add some more output sections.
6086         * testsuite/memory_test.sh: Update expected output.
6087
6088 2010-10-02  Doug Kwan  <dougkwan@google.com>
6089
6090         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6091         defintion to symtab.h
6092         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6093         declaration to defintion.
6094
6095 2010-10-01  Nick Clifton  <nickc@redhat.com>
6096
6097         * expression.cc (eval): Replace dummy argument with NULL.
6098         (eval_maybe_dot): Check for a NULL result section pointer.
6099         (Symbol_expression::value): Likewise.
6100         (Dot_expression::value): Likewise.
6101         (BINARY_EXPRESSION): Likewise.
6102         (Max_expression::value): Likewise.
6103         (Min_expression::value): Likewise.
6104         (Absolute_expression::value): Likewise.
6105         (Addr_expression::value_from_output_section): Likewise.
6106         (Loaddddr_expression::value_from_output_section): Likewise.
6107         (Segment_start_expression::value): Likewise.
6108         * script-sections.cc
6109         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6110         argument with NULL.
6111         (Sections_elememt_dot_assignment::set_section_addresses):
6112         Likewise.
6113         (Output_data_expression::do_write_to_buffer): Likewise.
6114         (Output_section_definition::finalize_symbols): Likewise.
6115         (Output_section_definition::set_section_addresses): Likewise.
6116
6117 2010-09-30  Doug Kwan  <dougkwan@google.com>
6118
6119         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6120
6121 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6122
6123         * target.h (Target::can_icf_inline_merge_sections): New virtual
6124         function.
6125         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6126         virtual function.
6127         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6128         virtual function.
6129         * icf.cc (get_section_contents): Inline merge sections only when
6130         target allows it.
6131
6132 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6133
6134         * configure: Regenerate.
6135
6136 2010-09-17  Ian Lance Taylor  <iant@google.com>
6137
6138         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6139         * testsuite/Makefile.am (memory_test.o): New target.
6140         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6141         memory_test.t.
6142         * testsuite/Makefile.in: Rebuild.
6143
6144 2010-09-17  Doug Kwan  <dougkwan@google.com>
6145
6146         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6147         defintion if relocation uses GOT entries of the symbol.
6148         * testsuite/icf_safe_test.sh: Fix test.
6149         * testsuite/icf_safe_so_test.sh: Fix test.
6150
6151 2010-09-16  Cary Coutant  <ccoutant@google.com>
6152
6153         * script_sections.cc (class Memory_region): Remove "NULL" from
6154         vector initializations.
6155
6156 2010-09-15  Cary Coutant  <ccoutant@google.com>
6157
6158         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6159         Resolve forwarding symbols.
6160
6161 2010-09-15  Doug Kwan  <dougkwan@google.com>
6162
6163         * gold/testsuite/script_test_3.t: Add ARM special sections.
6164         * gold/testsuite/script_test_4.t: Same.
6165         * gold/testsuite/script_test_5.t: Same.
6166         * gold/testsuite/script_test_6.t: Same.
6167         * gold/testsuite/script_test_7.t: Same.
6168         * gold/testsuite/script_test_7.t: Same.
6169         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6170
6171 2010-09-14  Cary Coutant  <ccoutant@google.com>
6172
6173         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6174         (Target_x86_64::Relocate::relocate_tls): Replace check for
6175         saw_tls_block_reloc_ with test for executable section.
6176
6177 2010-09-12  Cary Coutant  <ccoutant@google.com>
6178
6179         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6180         position-independent executables to shared libraries need dynamic
6181         relocations.
6182         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6183         position-independent executables.
6184         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6185         * testsuite/Makefile.in: Regenerate.
6186
6187 2010-09-10  Nick Clifton  <nickc@redhat.com>
6188
6189         PR gold/11997
6190         * testsuite/memory_test.t: Discard any sections that are not
6191         needed.
6192
6193 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6194
6195         PR gold/11996
6196         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6197         "This::" to work around a bug in gcc 4.2.
6198
6199         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6200
6201 2010-09-09  Rafael Espindola  <espindola@google.com>
6202
6203         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6204         sections with different PF_X flags in the same segment.
6205         (Layout::find_first_load_seg): Search all segments to find the first
6206         one.
6207         * options.h (rosegment): New.
6208
6209 2010-09-08  Rafael Espindola  <espindola@google.com>
6210
6211         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6212
6213 2010-09-08  Doug Kwan  <dougkwan@google.com>
6214
6215         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6216         (Arm_relobj::do_relocate_sections): Add new parameter for output
6217         file to match the parent.
6218         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6219         of local symbols instead of input values.  Update code to track
6220         changes in gold::relocate_section.
6221         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6222         (Sized_relobj::compute_final_local_value_internal): New methods.
6223         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6224         body into private version of Sized_relobj::compute_final_local_value.
6225         Call the inline method.
6226         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6227         merged symbol value if there is one.
6228         (Symbol_value::has_output_value): New method defintiion.
6229         (Sized_relobj::Compute_final_local_value_status): New enum type.
6230         (Sized_relobj::compute_final_local_value): New methods.
6231         (Sized_relobj::compute_final_local_value_internal): New methods.
6232         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6233         and arm_cortex_a8.sh.
6234         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6235         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6236         New tests.
6237         * Makefile.in: Regenerate.
6238         * testsuite/arm_bl_out_of_range.s: Update test.
6239         * testsuite/thumb_bl_out_of_range.s: Ditto.
6240         * testsuite/thumb_blx_out_of_range.s: Ditto.
6241         * testsuite/arm_branch_out_of_range.sh: New file.
6242         * testsuite/arm_cortex_a8.sh: Ditto.
6243         * testsuite/arm_cortex_a8_b.s: Ditto.
6244         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6245         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6246         * testsuite/arm_cortex_a8_bl.s: Ditto.
6247         * testsuite/arm_cortex_a8_blx.s: Ditto.
6248         * testsuite/arm_cortex_a8_local.s: Ditto.
6249         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6250         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6251
6252 2010-09-08  Rafael Espindola  <espindola@google.com>
6253
6254         * Makefile.am (memory_test.stdout): Run readelf with -W.
6255         * Makefile.in: Regenerate.
6256         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6257         64 bit output.
6258
6259 2010-09-08  Rafael Espindola  <espindola@google.com>
6260
6261         * script-sections.cc (Script_sections::add_memory_region): Convert
6262         field precision to int.
6263         * script.cc (script_set_section_region, script_set_section_region):
6264         Convert field precision to int.
6265
6266 2010-09-08  Rafael Espindola  <espindola@google.com>
6267
6268         * arm.cc (do_finalize_sections): Create the __exidx_start and
6269         __exdix_end symbols even when the section is missing.
6270
6271 2010-09-08  Nick Clifton  <nickc@redhat.com>
6272
6273         * README: Remove claim that MEMORY is not supported.
6274         * expression.cc (script_exp_function_origin)
6275         (script_exp_function_length): Move from here to ...
6276         * script.cc: ... here.
6277         (script_set_section_region, script_add_memory)
6278         (script_parse_memory_attr, script_include_directive): New
6279         functions.
6280         * script-sections.cc
6281         (class Memory_region): New class.
6282         (class Output_section_definition): Add set_memory_region,
6283         set_section_vma, set_section_lma and get_section_name methods.
6284         (class Script_Sections): Add add_memory_region,
6285         find_memory_region, find_memory_region_origin,
6286         find_memory_region_length and set_memory_region methods.
6287         Have set_section_addresses method walk the list of set memory
6288         regions.
6289         Extend the print methos to display memory regions.
6290         * script-sections.h: Add prototypes for new methods.
6291         Add enum for MEMORY region attributes.
6292         * yyscript.y: Add support for parsing MEMORY regions.
6293         * script-c.h: Add prototypes for new functions.
6294         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6295         * testsuite/Makefile.in: Regenerate.
6296         * testsuite/memory_test.sh: New script.
6297         * testsuite/memory_test.s: New assembler source file.
6298         * testsuite/memory_test.t: New linker script.
6299
6300 2010-08-27  Doug Kwan  <dougkwan@google.com>
6301
6302         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6303         reference override an existing dynamic weak reference.
6304         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6305         * testsuite/Makefile.in: Regenerate.
6306         * testsuite/dyn_weak_ref.sh: New file.
6307         * testsuite/dyn_weak_ref_1.c: Ditto.
6308         * testsuite/dyn_weak_ref_2.c: Ditto.
6309
6310 2010-08-27  Ian Lance Taylor  <iant@google.com>
6311
6312         * incremental.h (class Incremental_input_entry): Add virtual
6313         destructor.
6314
6315 2010-08-27  Ian Lance Taylor  <iant@google.com>
6316
6317         * testsuite/start_lib_test_3.c: Mark t3 as used.
6318
6319 2010-08-27  Nick Clifton  <nickc@redhat.com>
6320
6321         * options.cc (version_script): Fix small typo in previous
6322         whitespace tidyup.
6323
6324 2010-08-25  Nick Clifton  <nickc@redhat.com>
6325
6326         * archive.cc: Formatting fixes: Remove whitespace between
6327         typename and following asterisk.  Remove whitespace between
6328         function name and opening parenthesis.
6329         * archive.h: Likewise.
6330         * arm.cc: Likewise.
6331         * attributes.cc: Likewise.
6332         * attributes.h: Likewise.
6333         * common.cc: Likewise.
6334         * copy-relocs.cc: Likewise.
6335         * dirsearch.h: Likewise.
6336         * dynobj.cc: Likewise.
6337         * ehframe.cc: Likewise.
6338         * ehframe.h: Likewise.
6339         * expression.cc: Likewise.
6340         * fileread.cc: Likewise.
6341         * fileread.h: Likewise.
6342         * gc.h: Likewise.
6343         * gold-threads.cc: Likewise.
6344         * gold.cc: Likewise.
6345         * i386.cc: Likewise.
6346         * icf.h: Likewise.
6347         * incremental-dump.cc: Likewise.
6348         * incremental.cc: Likewise.
6349         * layout.cc: Likewise.
6350         * layout.h: Likewise.
6351         * main.cc: Likewise.
6352         * merge.cc: Likewise.
6353         * merge.h: Likewise.
6354         * object.cc: Likewise.
6355         * object.h: Likewise.
6356         * options.cc: Likewise.
6357         * options.h: Likewise.
6358         * output.cc: Likewise.
6359         * output.h: Likewise.
6360         * plugin.cc: Likewise.
6361         * plugin.h: Likewise.
6362         * powerpc.cc: Likewise.
6363         * reloc.cc: Likewise.
6364         * script-c.h: Likewise.
6365         * script-sections.cc: Likewise.
6366         * script.cc: Likewise.
6367         * stringpool.cc: Likewise.
6368         * symtab.cc: Likewise.
6369         * symtab.h: Likewise.
6370         * target.cc: Likewise.
6371         * timer.cc: Likewise.
6372         * timer.h: Likewise.
6373         * version.cc: Likewise.
6374         * x86_64.cc: Likewise.
6375
6376 2010-08-24  Nick Clifton  <nickc@redhat.com>
6377
6378         PR 11899
6379         * layout.cc (segment_precedes): Sort segments by their physical
6380         addresses, if they have been set.
6381
6382 2010-08-23  Cary Coutant  <ccoutant@google.com>
6383
6384         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6385         symbols data.
6386         (Lib_group::include_member): Unlock object after deleting its
6387         symbols data.
6388         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6389         the bug fixed here.
6390
6391 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6392             Cary Coutant  <ccoutant@google.com>
6393
6394         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6395         constructor, and set_blocker.
6396         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6397         readsyms_blocker_.
6398         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6399         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6400         * testsuite/Makefile.am (start_lib_test): New test case.
6401         * testsuite/Makefile.in: Regenerate.
6402         * testsuite/start_lib_test_main.c: New file.
6403         * testsuite/start_lib_test_1.c: New file.
6404         * testsuite/start_lib_test_2.c: New file.
6405         * testsuite/start_lib_test_3.c: New file.
6406
6407 2010-08-19  Ian Lance Taylor  <iant@google.com>
6408
6409         * Makefile.in: Rebuild with automake 1.11.1.
6410         * aclocal.m4: Likewise.
6411         * testsuite/Makefile.in: Likewise.
6412
6413 2010-08-19  Ian Lance Taylor  <iant@google.com>
6414
6415         PR 10893
6416         * i386.cc (class Output_data_plt_i386): Update declarations.
6417         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6418         local_ifuncs_ fields.
6419         (Target_i386::do_plt_section_for_global): New function.
6420         (Target_i386::do_plt_section_for_local): New function.
6421         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6422         parameter; change all callers.  Initialize global_ifuncs_ and
6423         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6424         __rel_iplt_end.
6425         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6426         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6427         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6428         symbols.
6429         (Target_i386::make_plt_section): New function, broken out of
6430         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6431         (Target_i386::make_plt_entry): Call make_plt_section.
6432         (Target_i386::make_local_ifunc_plt_entry): New function.
6433         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6434         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6435         R_386_IRELATIVE to switch.
6436         (Target_i386::Scan::global): Likewise.
6437         (Target_i386::Relocate::relocate): Likewise.
6438         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6439         switch.
6440         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6441         (Target_x86_64::do_plt_section_for_global): New function.
6442         (Target_x86_64::do_plt_section_for_local): New function.
6443         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6444         parameter; change all callers.  If doing a static link define
6445         __rela_iplt_start and __rela_iplt_end.
6446         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6447         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6448         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6449         to point to .plt.
6450         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6451         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6452         switch.
6453         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6454         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6455         R_X86_64_IRELATIVE to switch.
6456         (Target_x86_64::Scan::global): Likewise.
6457         (Target_x86_64::Relocate::relocate): Likewise.
6458         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6459         switch.
6460         * target.h (class Target): Add plt_section_for_global and
6461         plt_section_for_local functions.  Add do_plt_section_for_global
6462         and do_plt_section_for_local virtual functions.
6463         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6464         clarifying comments.
6465         (Symbol::use_plt_offset): Handle IFUNC symbol.
6466         * object.cc (Sized_relobj::Sized_relobj): Initialize
6467         local_plt_offsets_.
6468         (Sized_relobj::local_has_plt_offset): New function.
6469         (Sized_relobj::local_plt_offset): New function.
6470         (Sized_relobj::set_local_plt_offset): New function.
6471         (Sized_relobj::do_count): Handle IFUNC symbol.
6472         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6473         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6474         is_ifunc_symbol functions.
6475         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6476         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6477         local_plt_offsets_ field.
6478         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6479         * output.h (class Output_section_data): Add non-const
6480         output_section function.
6481         (class Output_data_got): Update declarations.
6482         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6483         Add use_plt_offset parameter to global and local constructors.
6484         Change all callers.  Change local_sym_index_ field to 31 bits.
6485         Change GSYM_CODE and CONSTANT_CODE accordingly.
6486         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6487         doing a static link don't set sh_link field.
6488         (Output_data_got::Got_entry::write): Use PLT offset if
6489         appropriate.
6490         (Output_data_got::add_global_plt): New function.
6491         (Output_data_got::add_local_plt): New function.
6492         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6493         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6494         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6495         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6496         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6497         IFUNC conditional.
6498         * testsuite/ifunc-sel.h: New file.
6499         * testsuite/ifuncmain1.c: New file.
6500         * testsuite/ifuncmain1vis.c: New file.
6501         * testsuite/ifuncmod1.c: New file.
6502         * testsuite/ifuncdep2.c: New file.
6503         * testsuite/ifuncmain2.c: New file.
6504         * testsuite/ifuncmain3.c: New file.
6505         * testsuite/ifuncmod3.c: New file.
6506         * testsuite/ifuncmain4.c: New file.
6507         * testsuite/ifuncmain5.c: New file.
6508         * testsuite/ifuncmod5.c: New file.
6509         * testsuite/ifuncmain6pie.c: New file.
6510         * testsuite/ifuncmod6.c: New file.
6511         * testsuite/ifuncmain7.c: New file.
6512         * configure, testsuite/Makefile.in: Rebuild.
6513
6514 2010-08-18  Ian Lance Taylor  <iant@google.com>
6515
6516         * incremental.cc
6517         (Output_section_incremental_inputs::write_input_files): Add cast
6518         to avoid signed/unsigned comparison warning.
6519         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6520
6521 2010-08-12  Cary Coutant  <ccoutant@google.com>
6522
6523         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6524
6525 2010-08-13  Ian Lance Taylor  <iant@google.com>
6526
6527         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6528
6529 2010-08-12  Cary Coutant  <ccoutant@google.com>
6530             Doug Kwan  <dougkwan@google.com>
6531
6532         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6533         defintion overrides non-weak undef, remember that the original undef
6534         is not weak.
6535         * symtab.cc (Symbol_table::sized_write_global): For undef without
6536         an original weak binding, set binding to global in output.
6537         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6538         * testsuite/Makefile.in: Regenerate.
6539         * testsuite/strong_ref_weak_def.sh: New file.
6540         * testsuite/strong_ref_weak_def_1.c: Ditto.
6541         * testsuite/strong_ref_weak_def_2.c: Ditto.
6542
6543 2010-08-12  Cary Coutant  <ccoutant@google.com>
6544
6545         * testsuite/incremental_test.sh: Rewrite.
6546         * testsuite/incremental_test_1.c: Rewrite.
6547         * testsuite/incremental_test_2.c: Rewrite.
6548
6549 2010-08-12  Cary Coutant  <ccoutant@google.com>
6550
6551         * arm.cc (Target_arm::got_size): Add const.
6552         (Target_arm::got_entry_count): New function.
6553         (Target_arm::plt_entry_count): New function.
6554         (Target_arm::first_plt_entry_offset): New function.
6555         (Target_arm::plt_entry_size): New function.
6556         (Output_data_plt_arm::entry_count): New function.
6557         (Output_data_plt_arm::first_plt_entry_offset): New function.
6558         (Output_data_plt_arm::get_plt_entry_size): New function.
6559         * i386.cc (Target_i386::got_size): Add const.
6560         (Target_i386::got_entry_count): New function.
6561         (Target_i386::plt_entry_count): New function.
6562         (Target_i386::first_plt_entry_offset): New function.
6563         (Target_i386::plt_entry_size): New function.
6564         (Output_data_plt_i386::entry_count): New function.
6565         (Output_data_plt_i386::first_plt_entry_offset): New function.
6566         (Output_data_plt_i386::get_plt_entry_size): New function.
6567         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6568         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6569         * incremental.cc: Include target.h.
6570         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6571         parameter.  Adjust all callers.  Find incremental_got_plt section.
6572         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6573         section.
6574         (Output_section_incremental_inputs::set_final_data_size): Calculate
6575         size of incremental_got_plt section.
6576         (Output_section_incremental_inputs::do_write): Write the
6577         incremental_got_plt section.
6578         (Got_plt_view_info): New struct.
6579         (Local_got_offset_visitor): New class.
6580         (Global_got_offset_visitor): New class.
6581         (Global_symbol_visitor_got_plt): New class.
6582         (Output_section_incremental_inputs::write_got_plt): New function.
6583         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6584         Add parameter.  Adjust all callers.
6585         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6586         (Incremental_inputs::got_plt_section): New function.
6587         (Incremental_inputs::got_plt_section_): New data member.
6588         (Incremental_got_plt_reader): New class.
6589         * layout.cc (Layout::create_incremental_info_sections): Add the
6590         incremental_got_plt section.
6591         * object.h (Got_offset_list::get_list): New function.
6592         (Got offset_list::for_all_got_offsets): New function.
6593         (Sized_relobj::local_got_offset_list): New function.
6594         * powerpc.cc (Target_powerpc::got_size): Add const.
6595         (Target_powerpc::got_entry_count): New function.
6596         (Target_powerpc::plt_entry_count): New function.
6597         (Target_powerpc::first_plt_entry_offset): New function.
6598         (Target_powerpc::plt_entry_size): New function.
6599         (Output_data_plt_powerpc::entry_count): New function.
6600         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6601         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6602         * sparc.cc (Target_sparc::got_size): Add const.
6603         (Target_sparc::got_entry_count): New function.
6604         (Target_sparc::plt_entry_count): New function.
6605         (Target_sparc::first_plt_entry_offset): New function.
6606         (Target_sparc::plt_entry_size): New function.
6607         (Output_data_plt_sparc::entry_count): New function.
6608         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6609         (Output_data_plt_sparc::get_plt_entry_size): New function.
6610         * symtab.h (Symbol::got_offset_list): New function.
6611         (Symbol_table::for_all_symbols): New function.
6612         * target.h (Sized_target::got_entry_count): New function.
6613         (Sized_target::plt_entry_count): New function.
6614         (Sized_target::plt_entry_size): New function.
6615         * x86_64.cc (Target_x86_64::got_size): Add const.
6616         (Target_x86_64::got_entry_count): New function.
6617         (Target_x86_64::plt_entry_count): New function.
6618         (Target_x86_64::first_plt_entry_offset): New function.
6619         (Target_x86_64::plt_entry_size): New function.
6620         (Output_data_plt_x86_64::entry_count): New function.
6621         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6622         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6623
6624 2010-08-12  Cary Coutant  <ccoutant@google.com>
6625
6626         * archive.cc: Include incremental.h.
6627         (Archive::Archive): Initialize incremental_info_.
6628         (Archive::include_member): Record archive members in incremental info.
6629         (Add_archive_symbols::run): Record begin and end of an archive in
6630         incremental info.
6631         (Lib_group::include_member): Record objects in incremental info.
6632         * archive.h (Incremental_archive_entry): Forward declaration.
6633         (Archive::set_incremental_info): New member function.
6634         (Archive::incremental_info): New member function.
6635         (Archive::Unused_symbol_iterator): New class.
6636         (Archive::unused_symbols_begin): New member function.
6637         (Archive::unused_symbols_end): New member function.
6638         (Archive::incremental_info_): New data member.
6639         * incremental-dump.cc (find_input_containing_global): New function.
6640         (dump_incremental_inputs): Dump new incremental info sections.
6641         * incremental.cc: Include symtab.h.
6642         (Output_section_incremental_inputs): New class.
6643         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6644         new incremental info sections.
6645         (Sized_incremental_binary::do_check_inputs): Likewise.
6646         (Incremental_inputs::report_archive): Remove.
6647         (Incremental_inputs::report_archive_begin): New function.
6648         (Incremental_inputs::report_archive_end): New function.
6649         (Incremental_inputs::report_object): New function.
6650         (Incremental_inputs::finalize_inputs): Remove.
6651         (Incremental_inputs::report_input_section): New function.
6652         (Incremental_inputs::report_script): Rewrite.
6653         (Incremental_inputs::finalize): Do nothing but finalize string table.
6654         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6655         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6656         (Incremental_inputs::create_data_sections): New function.
6657         (Incremental_inputs::relocs_entsize): New function.
6658         (Output_section_incremental_inputs::set_final_data_size): New function.
6659         (Output_section_incremental_inputs::do_write): New function.
6660         (Output_section_incremental_inputs::write_header): New function.
6661         (Output_section_incremental_inputs::write_input_files): New function.
6662         (Output_section_incremental_inputs::write_info_blocks): New function.
6663         (Output_section_incremental_inputs::write_symtab): New function.
6664         * incremental.h (Incremental_script_entry): Forward declaration.
6665         (Incremental_object_entry): Forward declaration.
6666         (Incremental_archive_entry): Forward declaration.
6667         (Incremental_inputs): Forward declaration.
6668         (Incremental_inputs_header_data): Remove.
6669         (Incremental_inputs_header): Remove.
6670         (Incremental_inputs_header_write): Remove.
6671         (Incremental_inputs_entry_data): Remove.
6672         (Incremental_inputs_entry): Remove.
6673         (Incremental_inputs_entry_write): Remove.
6674         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6675         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6676         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6677         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6678         Likewise.
6679         (Incremental_input_entry): New class.
6680         (Incremental_script_entry): New class.
6681         (Incremental_object_entry): New class.
6682         (Incremental_archive_entry): New class.
6683         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6684         (Incremental_inputs::report_inputs): Remove.
6685         (Incremental_inputs::report_archive): Remove.
6686         (Incremental_inputs::report_archive_begin): New function.
6687         (Incremental_inputs::report_archive_end): New function.
6688         (Incremental_inputs::report_object): Change prototype.
6689         (Incremental_inputs::report_input_section): New function.
6690         (Incremental_inputs::report_script): Change prototype.
6691         (Incremental_inputs::get_reloc_count): New function.
6692         (Incremental_inputs::set_reloc_count): New function.
6693         (Incremental_inputs::create_data_sections): New function.
6694         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6695         (Incremental_inputs::inputs_section): New function.
6696         (Incremental_inputs::symtab_section): New function.
6697         (Incremental_inputs::relocs_section): New function.
6698         (Incremental_inputs::get_stringpool): Add const.
6699         (Incremental_inputs::command_line): Add const.
6700         (Incremental_inputs::inputs): Remove.
6701         (Incremental_inputs::command_line_key): New function.
6702         (Incremental_inputs::input_file_count): New function.
6703         (Incremental_inputs::input_files): New function.
6704         (Incremental_inputs::relocs_entsize): New function.
6705         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6706         (Incremental_inputs::finalize_inputs): Remove.
6707         (Incremental_inputs::Input_info): Remove.
6708         (Incremental_inputs::lock_): Remove.
6709         (Incremental_inputs::inputs_): Change type.
6710         (Incremental_inputs::inputs_map_): Remove.
6711         (Incremental_inputs::current_object_entry_): New data member.
6712         (Incremental_inputs::inputs_section_): New data member.
6713         (Incremental_inputs::symtab_section_): New data member.
6714         (Incremental_inputs::relocs_section_): New data member.
6715         (Incremental_inputs::reloc_count_): New data member.
6716         (Incremental_inputs_reader): New class.
6717         (Incremental_symtab_reader): New class.
6718         (Incremental_relocs_reader): New class.
6719         * layout.cc (Layout::finalize): Move finalization of incremental info
6720         and creation of incremental info sections to follow finalization of
6721         symbol table.  Set offsets for postprocessing sections.
6722         (Layout::create_incremental_info_sections): Call
6723         Incremental_inputs::create_data_sections.  Add incremental symtab
6724         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6725         sections to layout after input sections.
6726         * layout.h (struct Timespec): Forward declaration.
6727         (Layout::incremental_inputs): Add const.
6728         (Layout::create_incremental_info_sections): Add parameter.
6729         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6730         * object.cc: Include incremental.h.
6731         (Relobj::finalize_incremental_relocs): New function.
6732         (Sized_relobj::do_layout): Record input sections in incremental info.
6733         * object.h (Object::output_section): New function.
6734         (Object::output_section_offset): Moved from Relobj.
6735         (Object::get_incremental_reloc_base): New function.
6736         (Object::get_incremental_reloc_count): New function.
6737         (Object::do_output_section): New function.
6738         (Object::do_output_section_offset): Moved from Relobj.
6739         (Object::do_get_incremental_reloc_base): New function.
6740         (Object::do_get_incremental_reloc_count): New function.
6741         (Object::Object): Initialize new data members.
6742         (Relobj::output_section): Renamed do_output_section and moved to
6743         protected.
6744         (Relobj::output_section_offset): Moved to Object.
6745         (Relobj::do_get_incremental_reloc_base): New function.
6746         (Relobj::do_get_incremental_reloc_count): New function.
6747         (Relobj::allocate_incremental_reloc_counts): New function.
6748         (Relobj::count_incremental_reloc): New function.
6749         (Relobj::finalize_incremental_relocs): New function.
6750         (Relobj::next_incremental_reloc_index): New function.
6751         (Relobj::reloc_counts_): New data member.
6752         (Relobj::reloc_bases_): New data member.
6753         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6754         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6755         (Sized_relobj::incremental_relocs_scan): New function.
6756         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6757         (Sized_relobj::incremental_relocs_write): New function.
6758         (Sized_relobj::incremental_relocs_write_reltype): New function.
6759         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6760         incremental link.
6761         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6762         archives and object files elsewhere.
6763         (Add_symbols::run): Report object files here.
6764         (Finish_group::run): Report end of archive at end of group.
6765         * reloc.cc: Include layout.h, incremental.h.
6766         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6767         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6768         (Sized_relobj::incremental_relocs_scan): New function.
6769         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6770         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6771         (Sized_relobj::incremental_relocs_write): New function.
6772         (Sized_relobj::incremental_relocs_write_reltype): New function.
6773         * script.cc (read_input_script): Rewrite test for incremental link.
6774         Change call to Incremental_inputs::report_script.
6775         * symtab.h (Symbol_table::first_global_index): New function.
6776         (Symbol_table::output_count): New function.
6777
6778 2010-08-12  Doug Kwan  <dougkwan@google.com>
6779
6780         * arm.cc (Target_arm::merge_object_attributes): Check command line
6781         options --no-wchar-size-warning and --no-enum-size-warning.
6782         * options.h (General_options): Add ld-compatible options
6783         --no-enum-size-warning and --no-wchar-size-warning.
6784
6785 2010-08-04  Ian Lance Taylor  <iant@google.com>
6786
6787         * x86_64.cc (Target_x86_64::Scan::local): Use
6788         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6789         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6790         (Target_x86_64::Scan::global): Likewise.
6791         (Target_x86_64::Relocate::relocate): Likewise.
6792         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6793         Likewise.
6794
6795 2010-08-03  Cary Coutant  <ccoutant@google.com>
6796
6797         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6798         to reserve space in merged_strings vector. Keep total input size
6799         for stats.
6800         (Output_merge_string::do_print_merge_stats): Print total input size.
6801         * merge.h (Output_merge_string): Add input_size_ field.
6802         * stringpool.cc (Stringpool_template::string_length): Move
6803         implementations out of Stringpool_template class and place in
6804         stringpool.h.
6805         * stringpool.h (string_length): Move out of Stringpool_template.
6806
6807 2010-08-03  Ian Lance Taylor  <iant@google.com>
6808
6809         PR 11712
6810         * layout.cc (relaxation_loop_body): If address of load segment is
6811         set, adjust address to include headers if possible.
6812
6813 2010-08-03  Ian Lance Taylor  <iant@google.com>
6814
6815         * version.cc (version_string): Bump to 1.10.
6816
6817 2010-08-03  Ian Lance Taylor  <iant@google.com>
6818
6819         PR 11805
6820         * layout.h (enum Output_section_order): Define.
6821         (class Layout): Update declarations.
6822         * layout.cc (Layout::get_output_section): Add order parameter.
6823         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6824         is_first_non_relro parameters.  Change all callers.
6825         (Layout::choose_output_section): Likewise.
6826         (Layout::add_output_section_data): Likewise.
6827         (Layout::make_output_section): Likewise.  Set order.
6828         (Layout::default_section_order): New function.
6829         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6830         * output.cc (Output_section::Output_section): Initialize order_.
6831         Don't initialize deleted fields.
6832         (Output_segment::Output_segment): Don't initialize deleted
6833         fields.
6834         (Output_segment::add_output_section_to_load): New function
6835         replacing add_output_section.  Change all callers to call this or
6836         add_output_section_to_nonload.
6837         (Output_segment::add_output_section_to_nonload): New function.
6838         (Output_segment::remove_output_section): Rewrite.
6839         (Output_segment::add_initial_output_data): Likewise.
6840         (Output_segment::has_any_data_sections): Likewise.
6841         (Output_segment::is_first_section_relro): Likewise.
6842         (Output_segment::maximum_alignment): Likewise.
6843         (Output_segment::has_dynamic_reloc): New function replacing
6844         dynamic_reloc_count.  Change all callers.
6845         (Output_segment::has_dynamic_reloc_list): New function replacing
6846         dynamic_reloc_count_list.  Change all callers.
6847         (Output_segment::set_section_addresses): Rewrite.
6848         (Output_segment::set_offset): Rewrite.
6849         (Output_segment::find_first_and_last_list): Remove.
6850         (Output_segment::set_tls_offsets): Rewrite.
6851         (Output_segment::first_section_load_address): Likewise.
6852         (Output_segment::output_section_count): Likewise.
6853         (Output_segment::section_with_lowest_load_address): Likewise.
6854         (Output_segment::write_section_headers): Likewise.
6855         (Output_segment::print_sections_to_map): Likewise.
6856         * output.h (class Output_data): Remove dynamic_reloc_count_
6857         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6858         (Output_data::add_dynamic_reloc): Rewrite.
6859         (Output_data::has_dynamic_reloc): New function.
6860         (Output_data::dynamic_reloc_count): Remove.
6861         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6862         is_last_relro_, is_first_non_relro_, is_interp_,
6863         is_dynamic_linker_section_ fields.  Add order and set_order
6864         functions.  Remove is_relro_local, set_is_relro_local,
6865         is_last_relro, set_is_last_relro, is_first_non_relro,
6866         set_is_first_non_relro functions, is_interp, set_is_interp,
6867         is_dynamic_linker_section, and set_is_dynamic_linker_section
6868         functions.
6869         (class Output_segment): Change Output_data_list from std::list to
6870         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6871         output_bss_ fields.  Update declarations.
6872
6873 2010-08-02  Ian Lance Taylor  <iant@google.com>
6874
6875         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6876         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6877         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6878
6879 2010-08-02  Ian Lance Taylor  <iant@google.com>
6880
6881         PR 11855
6882         * script.cc (Script_options::Script_options): Initialize
6883         symbol_definitions_ and symbol_references_.
6884         (Script_options::add_symbol_assignment): Update
6885         symbol_definitions_ and symbol_references_.
6886         (Script_options::add_symbol_reference): New function.
6887         (script_symbol): New function.
6888         * script.h (class Script_options): Add symbol_definitions_ and
6889         symbol_references_ fields.
6890         (Script_options::referenced_const_iterator): New type.
6891         (Script_options::referenced_begin): New function.
6892         (Script_options::referenced_end): New function.
6893         (Script_options::is_referenced): New function.
6894         (Script_options::any_unreferenced): New function.
6895         * script-c.h (script_symbol): Declare.
6896         * yyscript.y (exp): Call script_symbol.
6897         * symtab.cc: Include "script.h".
6898         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6899         Change all callers.  Check symbols referenced by scripts.
6900         (Symbol_table::add_undefined_symbols_from_command_line): Add
6901         layout parameter.  Change all callers.
6902         (Symbol_table::do_add_undefined_symbols_from_command_line):
6903         Likewise.  Break out loop body.  Check symbols referenced by
6904         scripts.
6905         (Symbol_table::add_undefined_symbol_from_command_line): New
6906         function broken out of
6907         do_add_undefined_symbols_from_command_line.
6908         * symtab.h (class Symbol_table): Update declarations.
6909         * archive.cc: Include "layout.h".
6910         (Archive::should_include_member): Add layout parameter.  Change
6911         all callers.  Check for symbol mentioned in expression.
6912         * archive.h (class Archive): Update declaration.
6913         * object.cc (Sized_relobj::do_should_include_member): Add layout
6914         parameter.
6915         * object.h (Object::should_include_member): Add layout parameter.
6916         Change all callers.
6917         (Object::do_should_include_member): Add layout parameter.
6918         (class Sized_relobj): Update declaration.
6919         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6920         parameter.
6921         * dynobj.h (class Sized_dynobj): Update declaration.
6922         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6923         layout parameter.
6924         * plugin.h (class Sized_pluginobj): Update declaration.
6925
6926 2010-08-02  Ian Lance Taylor  <iant@google.com>
6927
6928         PR 11866
6929         * output.cc (Output_segment::set_offset): Search for the first and
6930         last sections rather than assuming that the list is in order.
6931         (Output_segment::find_first_and_last_list): New function.
6932         * output.h (class Output_segment): Update declarations.
6933         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6934         (relro_strip_test_SOURCES): New variable.
6935         (relro_strip_test_DEPENDENCIES): New variable.
6936         (relro_strip_test_LDFLAGS): New variable.
6937         (relro_strip_test_LDADD): New variable.
6938         (relro_strip_test.so): New target.
6939
6940 2010-08-02  Ian Lance Taylor  <iant@google.com>
6941
6942         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6943         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6944         (Target_i386::got_tlsdesc_section): New function.
6945         (Target_i386::got_section): Create space for GOT entries for
6946         TLSDESC relocations.
6947         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6948         R_386_TLS_GOTDESC.
6949         (Target_i386::Scan::global): Likewise.
6950         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6951         using TLSDESC GOT.
6952         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6953         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6954         (Target_x86_64::got_tlsdesc_section): New function.
6955         (Target_x86_64::got_section): Create space for GOT entries for
6956         TLSDESC relocations.
6957         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6958         R_386_TLS_GOTDESC.
6959         (Target_x86_64::Scan::global): Likewise.
6960         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6961         using TLSDESC GOT.
6962
6963 2010-08-02  Ian Lance Taylor  <iant@google.com>
6964
6965         * testsuite/final_layout.sh: Use dc to convert from hex to
6966         decimal.
6967
6968 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6969
6970         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6971         paramter to the call to gold::gc_process_relocs.
6972         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6973         paramter to the call to gold::gc_process_relocs.
6974         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6975         parameter to the call to gold::gc_process_relocs.
6976         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6977         template parameter to the call to gold::gc_process_relocs.
6978         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6979         paramter to the call to gold::gc_process_relocs.
6980         * gc.h (get_embedded_addend_size): New function.
6981         (gc_process_relocs): Save the size of the reloc for use by ICF.
6982         * icf.cc (get_section_contents): Get the addend from the text section
6983         for SHT_REL relocation sections.
6984         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6985         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6986         * int_encoding.h (read_from_pointer): New overloaded function.
6987         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6988         * testsuite/icf_sht_rel_addend_test.sh: New file.
6989         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6990         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6991
6992 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6993
6994         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6995         * Makefile.in: Regenerate.
6996         * testsuite/Makefile.in: Regenerate.
6997
6998 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6999
7000         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7001         * gold/testsuite/debug_msg.cc: Likewise.
7002         * gold/testsuite/odr_violation1.cc
7003         * gold/testsuite/odr_violation2.cc
7004
7005 2010-07-21  Cary Coutant  <ccoutant@google.com>
7006
7007         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7008         string, and length fields.
7009         (Output_merge_string::Merged_strings_list): New type.
7010         (Output_merge_string::Merged_strings_lists): New typedef.
7011         (Output_merge_string): Replace merged_strings_ with
7012         merged_strings_lists_.
7013         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7014         Merged_strings_list per input object and section.  Don't store pointer
7015         to the string.  Don't store length with each merged string entry.
7016         (Output_merge_string::finalize_merged_data): Loop over list of merged
7017         strings lists.  Recompute length of each merged string.
7018
7019 2010-07-15  Cary Coutant  <ccoutant@google.com>
7020
7021         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7022         here.
7023
7024 2010-07-14  Ian Lance Taylor  <iant@google.com>
7025
7026         * descriptors.cc (Descriptors::open): Report correct name in error
7027         message.
7028
7029 2010-07-13  Doug Kwan  <dougkwan@google.com>
7030
7031         * arm.cc (Arm_input_section::Arm_input_section): For a
7032         SHT_ARM_EXIDX section, always keeps the input sections.
7033         (Arm_input_section::set_exidx_section_link): New method.
7034         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7035         has_errors_ to false.
7036         (Arm_exidx_input_section::has_errors,
7037         Arm_exidx_input_section::set_has_errors): New methods.
7038         (Arm_exidx_input_section::has_errors_): New data member.
7039         (Arm_relobj::get_exidx_shndx_list): New method.
7040         (Arm_output_section::append_text_sections_to_list): Do not skip
7041         section without SHF_EXECINSTR.
7042         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7043         errors.
7044         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7045         section header.  Make error messages more verbose.  Check for
7046         a non-executable section linked to an EXIDX section.
7047         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7048         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7049         check that there is no deferred EXIDX section if we exit early.
7050         Instead of not making an EXIDX section in case of an error, make one
7051         and set the has_errors flag of it.
7052         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7053         in a relocatable link.
7054         (Target_arm::do_relax): Look for the EXIDX output section instead of
7055         assuming that it is called .ARM.exidx.
7056         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7057         section list.  Do not check for SHF_EXECINSTR section flags but
7058         skip any input section with errors.
7059         * output.cc (Output_section::Output_section): Initialize
7060         always_keeps_input_sections_ to false.
7061         (Output_section::add_input_section): Check for
7062         always_keeps_input_sections_.
7063         *  output.h (Output_section::always_keeps_input_sections,
7064         Output_section::set_always_keeps_input_sections): New methods.
7065         (Output_section::always_keeps_input_sections): New data member.
7066
7067 2010-07-13  Rafael Espindola  <espindola@google.com>
7068
7069         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7070         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7071
7072 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7073             Ian Lance Taylor  <iant@google.com>
7074
7075         * output.h (Output_section_lookup_maps::add_merge_section):
7076         Correct check of whether value was inserted.
7077         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7078         (Output_section_lookup_maps::add_relaxed_input_section):
7079         Likewise.
7080         * arm.cc (Target_arm::got_section): Remove used local os.
7081         * i386.cc (Target_i386::got_section): Likewise.
7082         * x86_64.cc (Target_x86_64::got_section): Likewise.
7083         * sparc.cc (Target_sparc::got_section): Likewise.
7084         (Target_sparc::relocate): Remove unused local have_got_offset.
7085         * powerpc.cc (Target_powerpc::relocate): Likewise.
7086
7087 2010-07-13  Ian Lance Taylor  <iant@google.com>
7088
7089         * compressed_output.cc (zlib_decompress): Fix signature in
7090         !HAVE_ZLIB_H case.
7091
7092         * archive.cc (Archive::include_member): Unlock an external member
7093         of a thin archive.  Don't bother to delete an object we know is
7094         NULL.
7095
7096 2010-07-12  Cary Coutant  <ccoutant@google.com>
7097
7098         * compressed_output.cc (zlib_decompress): New function.
7099         (get_uncompressed_size): New function.
7100         (decompress_input_section): New function.
7101         * compressed_output.h (get_uncompressed_size): New function.
7102         (decompress_input_section): New function.
7103         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7104         Handle compressed debug sections.
7105         * layout.cc (is_compressed_debug_section): New function.
7106         (Layout::output_section_name): Map compressed section names to
7107         canonical names.
7108         * layout.h (is_compressed_debug_section): New function.
7109         (is_debug_info_section): Recognize compressed debug sections.
7110         * merge.cc: Include compressed_output.h.
7111         (Output_merge_data::do_add_input_section): Handle compressed
7112         debug sections.
7113         (Output_merge_string::do_add_input_section): Handle compressed
7114         debug sections.
7115         * object.cc: Include compressed_output.h.
7116         (Sized_relobj::Sized_relobj): Initialize new data members.
7117         (build_compressed_section_map): New function.
7118         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7119         * object.h (Object::section_is_compressed): New method.
7120         (Object::do_section_is_compressed): New method.
7121         (Sized_relobj::Compressed_section_map): New type.
7122         (Sized_relobj::do_section_is_compressed): New method.
7123         (Sized_relobj::compressed_sections_): New data member.
7124         * output.cc (Output_section::add_input_section): Handle compressed
7125         debug sections.
7126         * reloc.cc: Include compressed_output.h.
7127         (Sized_relobj::write_sections): Handle compressed debug sections.
7128
7129 2010-07-08  Cary Coutant  <ccoutant@google.com>
7130
7131         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7132         weak when resolving to a dynamic def.
7133         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7134         for weak undef/dynamic def cases. Adjust callers.
7135         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7136         undef_binding_weak_.
7137         (Symbol_table::sized_write_globals): Adjust symbol binding.
7138         (Symbol_table::sized_write_symbol): Add binding parameter.
7139         * symtab.h (Symbol::set_undef_binding): New method.
7140         (Symbol::is_undef_binding_weak): New method.
7141         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7142         (Symbol_table::should_override): Add new parameter.
7143         (Symbol_table::sized_write_symbol): Add new parameter.
7144
7145         * testsuite/weak_undef_file1.cc: Add new test case.
7146         * testsuite/weak_undef_file2.cc: Fix header comment.
7147         * testsuite/weak_undef_test.cc: Add new test case.
7148
7149 2010-06-29  Doug Kwan  <dougkwan@google.com>
7150
7151         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7152         Initialize USE_SYMBOL_.
7153         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7154         definition.
7155         (Arm_reloc_property::uses_symbol_): New data member declaration.
7156         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7157         uses symbol value and symbol is undefined but not weakly undefined.
7158
7159 2010-06-28  Rafael Espindola  <espindola@google.com>
7160
7161         * plugin.cc (Plugin::load): Use dlerror.
7162
7163 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7164
7165         * symtab.cc (detect_odr_violations): When reporting an ODR
7166         violation, report an object where the symbol is defined.
7167
7168 2010-06-25  Doug Kwan  <dougkwan@google.com>
7169
7170         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7171         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7172         definition.
7173         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7174         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7175         target hook to detect function points.
7176         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7177         * icf.h (Icf::check_section_for_function_pointers): Change type of
7178         parameter SECTION_NAME to const reference to std::string.  Use
7179         target hook to determine if section may have unsafe pointers.
7180         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7181         method definition.
7182
7183 2010-06-21  Rafael Espindola  <espindola@google.com>
7184
7185         * fileread.cc (Input_file::find_fie): New
7186         (Input_file::open): Use Input_file::find_fie.
7187         * fileread.h (Input_file::find_fie): New
7188         * plugin.cc (set_extra_library_path): New.
7189         (Plugin::load): Add set_extra_library_path to the transfer vector.
7190         (Plugin_manager::set_extra_library_path): New.
7191         (Plugin_manager::add_input_file): Use the extra search path if set.
7192         (set_extra_library_path(): New.
7193         * plugin.h (Plugin_manager): Add set_extra_library_path and
7194         extra_search_path_.
7195
7196 2010-06-19  Cary Coutant  <ccoutant@google.com>
7197
7198         * layout.cc (gdb_sections): Add .debug_types.
7199         (lines_only_debug_sections): Likewise.
7200
7201 2010-06-18  Rafael Espindola  <espindola@google.com>
7202
7203         * plugin.cc (add_input_file,add_input_library)
7204         (Plugin_manager::add_input_file): Make filename arguments const.
7205         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7206         const.
7207
7208 2010-06-16  Doug Kwan  <dougkwan@google.com>
7209
7210         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7211         .ARM.attributes section if we have not merged any input
7212         attributes sections.
7213
7214 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7215
7216         * arm.cc: Allow combining objects with no EABI version
7217         information.
7218
7219 2010-06-15  Rafael Espindola  <espindola@google.com>
7220
7221         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7222
7223 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7224
7225         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7226         (struct iovec): Correct !HAVE_READV definition.
7227
7228 2010-06-10  Cary Coutant  <ccoutant@google.com>
7229
7230         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7231         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7232         reloc sections.
7233         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7234
7235         PR 11683
7236         * symtab.h (Symbol::is_placeholder): New member function.
7237         * target-reloc.h (relocate_section): Check for placeholder symbols.
7238
7239         * testsuite/Makefile.am (plugin_test_8): New test.
7240         (plugin_test_9): New test.
7241         * testsuite/Makefile.in: Regenerate.
7242
7243 2010-06-09  Nick Clifton  <nickc@redhat.com>
7244
7245         * yyscript.y (input_list_element): Allow strings prefixed with
7246         the '-' character.  Treat these as libraries.
7247         * script.cc (script_add_library): New function.  Adds a library
7248         specified by "-l<name>" found in an input script.
7249         * script-c.h: Add prototype for script_add_library.
7250
7251 2010-06-07  Doug Kwan  <dougkwan@google.com>
7252
7253         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7254         Restrict stub-group size to be within long conditional branch
7255         range when working around cortex-A8 erratum.
7256
7257 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7258
7259         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7260         #ifdef typo.
7261
7262 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7263
7264         PR gold/11658
7265         * output.cc
7266         (Output_section::Input_section_sort_entry::compare_section_ordering):
7267         Change to return non-zero correctly.
7268         (Output_section::Input_section_sort_section_order_index_compare
7269         ::operator()): Change to fix ambiguity in comparisons.
7270
7271 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7272
7273         * gold.h (is_wildcard_string): New function.
7274         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7275         (Layout::layout_eh_frame): Ditto.
7276         (Layout::find_section_order_index): New method.
7277         (Layout::read_layout_from_file): New method.
7278         * layout.h (Layout::find_section_order_index): New method.
7279         (Layout::read_layout_from_file): New method.
7280         (Layout::input_section_position_): New private member.
7281         (Layout::input_section_glob_): New private member.
7282         * main.cc (main): Call read_layout_from_file here.
7283         * options.h (--section-ordering-file): New option.
7284         * output.cc (Output_section::input_section_order_specified_): New
7285         member.
7286         (Output_section::Output_section): Initialize new member.
7287         (Output_section::add_input_section): Add new parameter.
7288         Keep input sections when --section-ordering-file is used.
7289         (Output_section::set_final_data_size): Sort input sections when
7290         section ordering file is specified.
7291         (Output_section::Input_section_sort_entry): Add new parameter.
7292         Check sorting type.
7293         (Output_section::Input_section_sort_entry::compare_section_ordering):
7294         New method.
7295         (Output_section::Input_section_sort_compare::operator()): Change to
7296         consider section_order_index.
7297         (Output_section::Input_section_sort_init_fini_compare::operator()):
7298         Change to consider section_order_index.
7299         (Output_section::Input_section_sort_section_order_index_compare
7300         ::operator()): New method.
7301         (Output_section::sort_attached_input_sections): Change to sort
7302         according to section order when specified.
7303         (Output_section::add_input_section<32, true>): Add new parameter.
7304         (Output_section::add_input_section<64, true>): Add new parameter.
7305         (Output_section::add_input_section<32, false>): Add new parameter.
7306         (Output_section::add_input_section<64, false>): Add new parameter.
7307         * output.h (Output_section::add_input_section): Add new parameter.
7308         (Output_section::input_section_order_specified): New
7309         method.
7310         (Output_section::set_input_section_order_specified): New method.
7311         (Input_section::Input_section): Initialize section_order_index_.
7312         (Input_section::section_order_index): New method.
7313         (Input_section::set_section_order_index): New method.
7314         (Input_section::section_order_index_): New member.
7315         (Input_section::Input_section_sort_section_order_index_compare): New
7316         struct.
7317         (Output_section::input_section_order_specified_): New member.
7318         * script-sections.cc (is_wildcard_string): Delete and move modified
7319         method to gold.h.
7320         (Output_section_element_input::Output_section_element_input): Modify
7321         call to is_wildcard_string.
7322         (Output_section_element_input::Input_section_pattern
7323         ::Input_section_pattern): Ditto.
7324         (Output_section_element_input::Output_section_element_input): Ditto.
7325         * testsuite/Makefile.am (final_layout): New test case.
7326         * testsuite/Makefile.in: Regenerate.
7327         * testsuite/final_layout.cc: New file.
7328         * testsuite/final_layout.sh: New file.
7329
7330 2010-06-01  Rafael Espindola  <espindola@google.com>
7331
7332         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7333
7334 2010-06-01  Rafael Espindola  <espindola@google.com>
7335
7336         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7337         visibility of symbols.
7338
7339 2010-05-27  Doug Kwan  <dougkwan@google.com>
7340
7341         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7342         from start of output section instead of address for a local symbol
7343         in a merged or relaxed section when doing a relocatable link.
7344
7345 2010-05-26  Rafael Espindola  <espindola@google.com>
7346
7347         PR 11604
7348         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7349         adding sections the garbage collector removed.
7350         * gold/testsuite/Makefile.am: Add test.
7351         * gold/testsuite/Makefile.in: Regenerate.
7352         * gold/testsuite/plugin_test_7.sh: New.
7353         * gold/testsuite/plugin_test_7_1.c: New.
7354         * gold/testsuite/plugin_test_7_2.c: New.
7355
7356 2010-05-26  Rafael Espindola  <espindola@google.com>
7357
7358         * script-sections.cc (Output_section_definition::set_section_addresses):
7359         Check for --section-start.
7360
7361 2010-05-26  Doug Kwan  <dougkwan@google.com>
7362
7363         * arm.cc (Arm_scan_relocatable_relocs): New class.
7364         (Target_arm::relocate_special_relocatable): New method.
7365         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7366         (Arm_relocate_functions::thumb_branch_common): Same.
7367         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7368         instead of Default_scan_relocatable_relocs.
7369         * target-reloc.h (relocate_for_relocatable): Let target handle
7370         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7371         * target.h (Sized_target::relocate_special_relocatable): New method.
7372
7373 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7374
7375         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7376
7377 2010-05-23  Doug Kwan  <dougkwan@google.com>
7378
7379         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7380         instead of a cast.
7381         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7382         with a direct branch, not a conditional branch, to a stub.
7383         * merge.cc (Output_merge_base::record_input_section): New method
7384         defintion.
7385         (Output_merge_data::do_add_input_section): Record input section if
7386         keeps-input-sections flag is set.
7387         (Output_merge_string::do_add_input_section): Ditto.
7388         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7389         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7390         INPUT_SECTIONS_.
7391         (Output_merge_base::keeps_input_sections,
7392         Output_merge_base::set_keeps_input_sections,
7393         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7394         method definitions.
7395         (Output_merge_base::Input_sections): New type declaration.
7396         (Output_merge_base::input_sections_begin,
7397         Output_merge_base::input_sections_end,
7398         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7399         (Output_merge_base::bool keeps_input_sections_,
7400         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7401         Output_merge_base::input_sections_): New data members.
7402         (Output_merge_data::do_set_keeps_input_sections): New method
7403         defintion.
7404         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7405         * output.cc (Output_section::Input_section::relobj): Move method
7406         defintion from class declaration to here and handle merge sections.
7407         (Output_section::Input_section::shndx): Ditto.
7408         (Output_section::Output_section): Remove initializations of removed
7409         data members and initialize new data member LOOKUP_MAPS_.
7410         (Output_section::add_input_section): Set keeps-input-sections flag
7411         for a newly created merge output section as appropriate.  Adjust code
7412         to use Output_section_lookup_maps class.
7413         (Output_section::add_relaxed_input_section): Adjst code for lookup
7414         maps code refactoring.
7415         (Output_section::add_merge_input_section): Add a new parameter
7416         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7417         class.  If adding input section to a newly created merge output
7418         section fails, remove the new merge section.
7419         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7420         Adjust code for use of the Output_section_lookup_maps class.
7421         (Output_section::find_merge_section): Ditto.
7422         (Output_section::build_lookup_maps): New method defintion.
7423         (Output_section::find_relaxed_input_section): Adjust code to use
7424         Output_section_lookup_maps class.
7425         (Output_section::get_input_sections): Export merge sections.  Adjust
7426         code to use Output_section_lookup_maps class.
7427         (Output_section:::add_script_input_section): Adjust code to use
7428         Output_section_lookup_maps class.  Update lookup maps for merge
7429         sections also.
7430         (Output_section::discard_states): Use Output_section_lookup_maps.
7431         (Output_section::restore_states): Same.
7432         * output.h (Merge_section_properties): Move class defintion out of
7433         Output_section.
7434         (Output_section_lookup_maps): New class.
7435         (Output_section::Input_section::is_merge_section): New method
7436         defintion.
7437         (Output_section::Input_section::relobj): Move defintion out of class
7438         defintion.  Declare method only.
7439         (Output_section::Input_section::shndx): Ditto.
7440         (Output_section::Input_section::output_merge_base): New method defintion.
7441         (Output_section::Input_section::u2_.pomb): New union field.
7442         (Output_section::Merge_section_by_properties_map,
7443         Output_section::Output_section_data_by_input_section_map,
7444         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7445         Remove types.
7446         (Output_section::add_merge_input_section): Add new parameter
7447         KEEPS_INPUT_SECTIONS.
7448         (Output_section::build_lookup_maps): New method declaration.
7449         (Output_section::merge_section_map_,
7450         Output_section::merge_section_by_properties_map_,
7451         Output_section::relaxed_input_section_map_,
7452         Output_section::is_relaxed_input_section_map_valid_): Remove data
7453         members.
7454         (Output_section::lookup_maps_): New data member.
7455
7456 2010-05-21  Doug Kwan  <dougkwan@google.com>
7457
7458         PR gold/11619
7459         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7460         avoid a compilation error.
7461
7462 2010-05-19  Rafael Espindola  <espindola@google.com>
7463
7464         * script-sections.cc (Output_section_definition::allocate_to_segment):
7465         Update the phdrs_list even when the output section is NULL.
7466         * testsuite/Makefile.am: Add test.
7467         * testsuite/Makefile.in: Regenerate.
7468         * testsuite/script_test_9.cc: New.
7469         * testsuite/script_test_9.sh: New.
7470         * testsuite/script_test_9.t: New.
7471
7472 2010-05-19  Doug Kwan  <dougkwan@google.com>
7473
7474         * arm.cc (Arm_input_section::original_size): New method.
7475         (Arm_input_section::do_addralign): Add a cast.
7476         (Arm_input_section::do_output_offset): Remove static cast.
7477         (Arm_input_section::original_addralign,
7478          Arm_input_section::original_size_): Change type to uint32_t.
7479         (Arm_input_section::init): Add safe casts for section alignment
7480         and size.
7481         (Arm_input_section::set_final_data_size): Do not set address and
7482         offset of stub table.
7483         (Arm_output_section::fix_exidx_coverage): Change use of of
7484         Output_section::Simple_input_section to that of
7485         Output_section::Input_section.
7486         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7487         except for the first pass.
7488         * output.cc (Output_section::get_input_sections): Change type of
7489         input_sections to std::list<Input_section>.
7490         (Output_section::add_script_input_section): Rename from
7491         Output_section::add_simple_input_section.  Change type of SIS
7492         parameter from Simple_input_section to Input_section.
7493         * output.h (Output_section::Simple_input_section): Remove class.
7494         (Output_section::Input_section): Change class visibility to public.
7495         (Output_section::Input_section::addralign): Use stored alignments
7496         for special input sections if set.
7497         (Output_section::Input_section::set_addralign): New method.
7498         (Output_section::get_input_sections): Change parameter type from
7499         list of Simple_input_section to list of Input_section.
7500         (Output_section::add_script_input_section): Rename from
7501         Output_section::add_simple_input_section. Change first parameter's
7502         type from Simple_input_section to Input_section and remove the
7503         second and third parameters.
7504         * script-sections.cc (Input_section::Input_section_list): Change
7505         type to list of Output_section::Input_section/
7506         (Input_section_info::Input_section_info): Change parameter type of
7507         INPUT_SECTION to Output_section::Input_section.
7508         (Input_section_info::input_section): Change return type.
7509         (Input_section_info::input_section_): Change type to
7510         Output_section::Input_section.
7511         (Output_section_element_input::set_section_addresses): Adjust code
7512         to use Output_section::Input_section instead of
7513         Output_section::Simple_input_section.  Adjust code for renaming
7514         of Output_section::add_simple_input_section.
7515         (Orphan_output_section::set_section_addresses): Ditto.
7516
7517 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7518
7519         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7520         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7521
7522 2010-05-18  Rafael Espindola  <espindola@google.com>
7523
7524         * options.cc (General_options::finalize): Handle -nostdlib.
7525         * options.h (nostdlib): New option.
7526         * script.cc (script_add_search_dir): Handle -nostdlib.
7527
7528 2010-05-12  Doug Kwan  <dougkwan@google.com>
7529
7530         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7531         attributes section only if there no attributes section after merging.
7532         (Target_arm::merge_object_attributes): Move value of
7533         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7534         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7535         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7536         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7537         and arm_attr_merge_7.stdout.
7538         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7539         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7540         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7541         arm_attr_merge_7b.o): New rules.
7542         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7543         arm_attr_merge_7
7544         * testsuite/Makefile.in: Regenerate.
7545         * testsuite/arm_attr_merge.sh: New file.
7546         * testsuite/arm_attr_merge_[67][ab].s: Same.
7547
7548 2010-05-05  Nick Clifton  <nickc@redhat.com>
7549
7550         * po/es.po: Updated Spanish translation.
7551
7552 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7553
7554         * Makefile.am (install-exec-local): Properly install gold as
7555         default cross linker.
7556         * Makefile.in: Regenerated.
7557
7558 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7559             Nick Clifton  <nickc@redhat.com>
7560
7561         * configure.ac (install_as_default): Define and set to false
7562         unless --enable-gold or --enable-gold=both/gold has been
7563         specified.
7564         * configure: Regenerate.
7565
7566         * Makefile.am (install-exec-local): Install the executable as
7567         'ld.gold'.  If install_as_default is true then also install it as
7568         'ld'.
7569         * Makefile.in: Regenerated.
7570
7571 2010-04-24  Ian Lance Taylor  <iant@google.com>
7572
7573         * layout.cc (Layout::layout_reloc): In relocatable link don't
7574         combine reloc sections for grouped sections.
7575
7576 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7577
7578         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7579         sections that are not ordinary to icf.
7580         * icf.cc (get_section_contents): Handle relocation pointing to section
7581         with no object or shndx information.
7582         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7583         * testsuite/Makefile.in: Regenerate.
7584         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7585         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7586
7587 2010-04-22  Ian Lance Taylor  <iant@google.com>
7588
7589         * expression.cc (Expression::Expression_eval_info): Add
7590         result_alignment_pointer field.
7591         (Expression::eval_with_dot): Add result_alignment_pointer
7592         parameter.  Change all callers.
7593         (Expression::eval_maybe_dot): Likewise.
7594         (class Binary_expression): Add alignment_pointer parameter to
7595         left_value and right_value.  Change all callers.
7596         (BINARY_EXPRESSION): Set result alignment.
7597         (class Trinary_expression): Add alignment_pointer parameter to
7598         arg2_value and arg3_value.  Change all callers.
7599         (Trinary_cond::value): Set result alignment.
7600         (Max_expression::value, Min_expression::value): Likewise.
7601         (Align_expression::value): Likewise.
7602         * script-sections.cc (class Sections_element): Add dot_alignment
7603         parameter to set_section_addresses virtual function.  Update
7604         instantiations.
7605         (class Output_section_element): Likewise.
7606         (Script_sections::create_segments): Add dot_alignment parameter.
7607         Change all callers.
7608         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7609         (Script_sections::set_phdrs_clause_addresses): Likewise.
7610         * script-sections.h: Update declarations.
7611         * script.h: Update declarations.
7612         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7613         min_p_align.
7614         * testsuite/script_test_3.t: Set large alignment.
7615         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7616         segment has expected alignment.
7617
7618 2010-04-22  Nick Clifton  <nickc@redhat.com>
7619
7620         * po/gold.pot: Updated by the Translation project.
7621         * po/vi.po: Updated Vietnamese translation.
7622
7623 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7624
7625         * testsuite/Makefile.am (check_PROGRAMS): Add
7626         icf_virtual_function_folding_test.
7627         * testsuite/Makefile.in: Regenerated.
7628
7629 2010-04-15  Andrew Haley  <aph@redhat.com>
7630
7631         * options.h (merge_exidx_entries): New option.
7632         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7633         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7634         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7635         (Target_arm::merge_exidx_entries): New function.
7636         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7637         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7638         to Arm_exidx_fixup constructor.
7639         Add new arg, merge_exidx_entries.
7640         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7641         Arm_output_section::fix_exidx_coverage.
7642
7643 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7644
7645         * icf.cc (get_section_contents): Check for preemptible functions.
7646         Ignore addend when appropriate.
7647         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7648         section folded.
7649         (add_from_relobj): Check for section folded.
7650         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7651         * symtab.h (should_add_dynsym_entry): Add new parameter.
7652         * target-reloc.h (scan_relocs): Check for section folded.
7653         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7654         Check reloc types for function pointers in shared objects.
7655         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7656         case.
7657         (icf_preemptible_functions_test): New test case.
7658         (icf_string_merge_test): New test case.
7659         * testsuite.Makefile.in: Regenerate.
7660         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7661         bar_glob.  Refactor code.
7662         * testsuite/icf_preemptible_functions_test.cc: New file.
7663         * testsuite/icf_preemptible_functions_test.sh: New file.
7664         * testsuite/icf_string_merge_test.cc: New file.
7665         * testsuite/icf_string_merge_test.sh: New file.
7666         * testsuite/icf_virtual_function_folding_test.cc: New file.
7667         * testsuite/icf_virtual_function_folding_test.sh: New file.
7668
7669 2010-04-14  Doug Kwan  <dougkwan@google.com>
7670
7671         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7672         for local symbol recounting if we remove a section due to ICF.
7673         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7674         there are no regular objects in input.
7675
7676 2010-04-13  Doug Kwan  <dougkwan@google.com>
7677
7678         * arm.cc (Arm_input_section::set_final_data_size): Compute
7679         accurate final data size instead of using current data size.
7680
7681 2010-04-09  Doug Kwan  <dougkwan@google.com>
7682
7683         * layout.cc (Layout::choose_output_section): Handle script section
7684         types.
7685         (Layout::make_output_section_for_script): Add section type parameter.
7686         Handle script section types.
7687         * layout.h (Layout::make_output_section_for_script): Add section
7688         type parameter.
7689         * output.cc (Output_section::Output_section): Initialize data member
7690         is_noload_.
7691         (Output_section::do_reset_address_and_file_offset): Do not set address
7692         to 0 if section is a NOLOAD section.
7693         * output.h (Output_section::is_noload): New method.
7694         (Output_section::set_is_noload): Ditto.
7695         (Output_section::is_noload_): New data member.
7696         * script-c.h (Script_section_type): New enum type.
7697         (struct Parser_output_section_header): Add new file section_type.
7698         * script-sections.cc (Sections_element::output_section_name): Add
7699         parameter for returning script section type.
7700         (Output_section_definition::output_section_name): Ditto.
7701         (Output_section_definition::section_type)P; New method.
7702         (Output_section_definiton::script_section_type_name): Ditto.
7703         (Output_section_definition::script_section_type_): New data member.
7704         (Output_section_definition::Output_section_definition): Initialize
7705         data member Output_section_definition::script_section_type_.
7706         (Output_section_definition::create_sections): Pass script section type
7707         to Layout::make_output_section_for_script.
7708         (Output_section_definition::output_section_name): Return script
7709         section type to caller.
7710         (Output_section_definition::set_section_address): Do not advance
7711         dot value and load address if section type is NOLOAD.  Set address
7712         of NOLOAD sections regardless of section flags.
7713         (Output_section_definition::print): Print section type if it is
7714         not SCRIPT_SECTION_TYPE_NONE.
7715         (Output_section_definition::section_type): New method.
7716         (Output_section_definition::script_section_type_name): Ditto.
7717         (Script_sections::output_section_name): Add new parameter
7718         PSECTION_TYPE for returning script section type.  Pass it to
7719         section elements.  Handle discard sections.
7720         (Sort_output_sections::operator()): Handle NOLOAD sections.
7721         * script-sections.h (Script_sections::Section_type): New enum type.
7722         (Script_sections::output_section_name): Add a new parameter for
7723         returning script section type.
7724         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7725         INFO and NOLOAD.
7726         * yyscript.y (union): Add new field SECTION_TYPE.
7727         (COPY, DSECT, INFO, NOLOAD): New tokens.
7728         (opt_address_and_section_type): Change type to output_section_header.
7729         (section_type): New non-terminal
7730         (section_header): Handle section type.
7731         (opt_address_and_section_type): Return section type value.
7732
7733 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7734
7735         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7736         * testsuite/plugin_common_test_2.c (foo): Likewise.
7737
7738 2010-04-08  Doug Kwan  <dougkwan@google.com>
7739
7740         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7741         Output_merge_data.
7742         * output.cc (Output_section::add_merge_input_section): Simplify
7743         code and return status of Output_merge_base::add_input_section.
7744         Update merge section map only if Output_merge_base::add_input_section
7745         returns true.
7746
7747 2010-04-07  Doug Kwan  <dougkwan@google.com>
7748
7749         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7750         if section is marked as containing instructions but has no mapping
7751         symbols.
7752         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7753         correct section index.
7754         (Arm_relobj::find_linked_text_section): Ditto.
7755
7756 2010-04-07  Cary Coutant  <ccoutant@google.com>
7757
7758         * archive.cc (include_member): Destroy Read_symbols_data object before
7759         releasing file.
7760         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7761         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7762         (Read_symbols_data::~Read_symbols_data) New destructor.
7763         (Section_relocs::Section_relocs) New constructor.
7764         (Section_relocs::~Section_relocs) New destructor.
7765         (Read_relocs_data::Read_relocs_data) New constructor.
7766         (Read_relocs_data::~Read_relocs_data) New destructor.
7767         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7768         pointers to NULL after deleting.
7769
7770 2010-04-07  Doug Kwan  <dougkwan@google.com>
7771
7772         * arm.cc: Replace "endianity" with "endianness" in comments.
7773         (Arm_exidx_cantunwind): Ditto.
7774         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7775         (Arm_relobj::merge_flags_and_attributes): New method.
7776         (Arm_relobj::merge_flags_and_attributes_): New data member.
7777         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7778         (Arm_relobj::scan_sections_for_stubs): Ditto.
7779         (Arm_relobj::do_read_symbols): Check to see if we really want to
7780         merge processor-specific flags and attributes.  Exit early if
7781         an object is empty except for section names and the undefined symbol.
7782         (Target_arm::do_finalize_sections): Move check for ELF format to
7783         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7784         attributes from a regular object only when we have determined that
7785         it is aapropriate.  Do not create an .ARM.attributes section in
7786         output if there is no regular input object.
7787         (Target_arm::merge_processor_specific_flags): Check
7788         --warn-mismatch before printing any error.
7789         (Target_arm::merge_object_attributes): Ditto.
7790         * gold.cc (queue_middle_tasks): Handle the case in which there is
7791         no regular object in input.
7792         * options.cc (General_options::parse_EB): New method.
7793         (General_options::parse_EL): Same.
7794         (General_options::General_options): Initialize endianness_.
7795         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7796         New options.
7797         (General_options::Endianness): New enum.
7798         (General_options::endianness): New method.
7799         (General_options::endianness_): New data member.
7800         * parameters.cc (Parameters::set_options): Check target endianness.
7801         (Parameters::set_target_once): Ditto.
7802         (Parameters::check_target_endianness): New method.
7803         (parameters_force_valid_target): If either -EL or -EB is specified,
7804         use it to define endianness of default target.
7805         * parameters.h (Parameters::check_target_endianness): New method
7806         declaration.
7807         * target.h (class Target): Change "endianity" to "endianness"
7808         in comments.
7809
7810 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7811
7812         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7813         * configure: Regenerate.
7814         * Makefile.in: Regenerate.
7815         * testsuite/Makefile.in: Regenerate.
7816
7817 2010-04-06  Cary Coutant  <ccoutant@google.com>
7818
7819         gcc PR lto/42757
7820         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7821         prevailing definitions of common symbols.
7822         * testsuite/plugin_test_6.sh: New test case.
7823         * testsuite/plugin_common_test_1.c: New test case.
7824         * testsuite/plugin_common_test_2.c: New test case.
7825         * testsuite/Makefile.am (plugin_test_6): New test case.
7826         * testsuite/Makefile.in: Regenerate.
7827
7828 2010-04-06  Nick Clifton  <nickc@redhat.com>
7829
7830         * po/vi.po: New Vietnamese translation.
7831
7832 2010-03-30  Doug Kwan  <dougkwan@google.com>
7833
7834         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7835
7836 2010-03-25  Doug Kwan  <dougkwan@google.com>
7837
7838         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7839         to avoid a conversion warning on a 32-bit host.
7840
7841 2010-03-24  Ian Lance Taylor  <iant@google.com>
7842
7843         * testsuite/script_test_3.t: Add a TLS segment.
7844         * testsuite/Makefile.am (check_PROGRAMS): Add
7845         tls_phdrs_script_test.
7846         (tls_phdrs_script_test_SOURCES): Define.
7847         (tls_phdrs_script_test_DEPENDENCIES): Define.
7848         (tls_phdrs_script_test_LDFLAGS): Define.
7849         (tls_phdrs_script_test_LDADD): Define.
7850         * testsuite/Makefile.in: Rebuild.
7851
7852 2010-03-23  Cary Coutant  <ccoutant@google.com>
7853
7854         * fileread.cc (find_or_make_view): Fix comment.
7855
7856 2010-03-23  Ian Lance Taylor  <iant@google.com>
7857
7858         * script-sections.cc (class Orphan_section_placement): Define
7859         PLACE_TLS and PLACE_TLS_BSS.
7860         (Orphan_section_placement::Orphan_section_placement): Initialize
7861         new places.
7862         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7863         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7864         (tls_script_test_SOURCES): Define.
7865         (tls_script_test_DEPENDENCIES): Define.
7866         (tls_script_test_LDFLAGS): Define.
7867         (tls_script_test_LDADD): Define.
7868         * testsuite/Makefile.in: Rebuild.
7869
7870 2010-03-22  Doug Kwan  <dougkwan@google.com>
7871
7872         * arm.cc (Arm_relocate_functions::abs8,
7873         Arm_relocate_functions::abs16): Use correct check for overflow
7874         specified in the ARM ELF specs.
7875         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7876         target of a BLX instruction specially.
7877         (Reloc_stub::stub_type_for_reloc): Ditto.
7878         (Relocate::relocate): Use symbolic names instead of numeric relocation
7879         codes to report error.
7880         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7881         workaround.
7882         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7883         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7884         thumb2_blx_out_of_range.stdout
7885         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7886         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7887         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7888         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7889         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7890         thumb2_blx_in_range, thumb2_blx_in_range.o,
7891         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7892         thumb2_blx_out_of_range.o): New rules.
7893         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7894         thumb2_blx_in_range and thumb2_blx_out_of_range.
7895         * testsuite/Makefile.in: Regenerate.
7896         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7897         * testsuite/thumb_blx_in_range.s: New file.
7898         * testsuite/thumb_blx_out_of_range.s: New file.
7899
7900 2010-03-22  Rafael Espindola  <espindola@google.com>
7901
7902         * archive.cc (Should_include): Move to archive.h.
7903         (should_include_member): Make it a member of Archive.
7904         (Lib_group): New.
7905         (Add_lib_group_symbols): New.
7906         * archive.h: Include options.h.
7907         (Archive_member): Moved from Archive.
7908         (Should_include): Moved from archive.cc.
7909         (Lib_group): New.
7910         (Add_lib_group_symbols): New.
7911         * dynobj.cc (do_should_include_member): New.
7912         * dynobj.h (do_should_include_member): New.
7913         * gold.cc (queue_initial_tasks): Update call to queue.
7914         * main.cc (main): Print lib group stats.
7915         * object.cc (do_should_include_member): New.
7916         * object.h: Include archive.h.
7917         (Object::should_include_member): New.
7918         (Object::do_should_include_member): New.
7919         (Sized_relobj::do_should_include_member): New.
7920         * options.cc (General_options::parse_start_lib): New.
7921         (General_options::parse_end_lib): New.
7922         (Input_arguments::add_file): Handle lib groups.
7923         (Input_arguments::start_group): Check we are not in a lib.
7924         (Input_arguments::start_lib): New.
7925         (Input_arguments::end_lib): New.
7926         * options.h (General_options): Add start_lib and end_lib.
7927         (Input_argument::lib_): New.
7928         (Input_argument::lib): New.
7929         (Input_argument::is_lib): New.
7930         (Input_file_lib): New.
7931         (Input_arguments::in_lib_): New.
7932         (Input_arguments::in_lib): New.
7933         (Input_arguments::start_lib): New.
7934         (Input_arguments::end_lib_): New.
7935         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7936         in unused members as preempted.
7937         (Sized_pluginobj::do_should_include_member): New.
7938         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7939         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7940         return the blocker.
7941         (Read_symbols::do_whole_lib_group): New.
7942         (Read_symbols::do_lib_group): New.
7943         (Read_symbols::do_read_symbols): Handle lib groups.
7944         (Read_symbols::get_name): Handle lib groups.
7945         * readsyms.h (Read_symbols): Add an archive member pointer.
7946         (Read_symbols::do_whole_lib_group): New.
7947         (Read_symbols::do_lib_group): New.
7948         (Read_symbols::member_): New.
7949         * script.cc (read_input_script): Update call to queue_soon.
7950
7951 2010-03-19  Doug Kwan  <dougkwan@google.com>
7952
7953         * arm.cc (Stub_table::Stub_table): Initialize new data members
7954         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7955         (Stub_table::add_reloc_stub): Assign stub offset and update
7956         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7957         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7958         New data members.
7959         (Stub_table::update_data_size_and_addralign): Use
7960         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7961         instead of going over all reloc stubs.
7962         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7963         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7964         Stringpool_template::offset_ to size of Stringpool_char.
7965         (Stringpool_template::new_key_offset): Remove code to initialize
7966         Stringpool_template::offset_.
7967         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7968         Stringpool_template::offset_ to zero.
7969
7970 2010-03-15  Doug Kwan  <dougkwan@google.com>
7971
7972         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7973         offset_.
7974         (Stringpool_template::new_key_offset): New method.
7975         (Stringpool_template::add_string): Assign offsets when adding new
7976         strings.
7977         (Stringpool_template::set_string_offsets): Do not set string offsets
7978         when not optimizing.
7979         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7980         member size_.
7981         (Chunked_vector::clear): Clear size_.
7982         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7983         (Chunked_vector::size): Return size_.
7984         (Chunked_vector::push_back): Use size_ to find insert position.
7985         (Chunked_vector::size_): New data member.
7986         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7987         (Stringpool_template::new_key_offset): New method declaration.
7988         (Stringpool_template::offset_): New data member.
7989
7990 2010-03-15   Rafael Espindola  <espindola@google.com>
7991
7992         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7993         Add_symbols' constructor.
7994         * readsyms.h (Add_symbols): Remove the input_group member.
7995
7996 2010-03-10  Ian Lance Taylor  <iant@google.com>
7997
7998         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7999         target to ask whether a reference to a symbol requires a stack
8000         split.
8001         * target.h (Target::is_call_to_non_split): New function.
8002         (Target::do_is_call_to_non_split): Declare virtual function.
8003         * target.cc: Include "symtab.h".
8004         (Target::do_is_call_to_non_split): New function.
8005         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8006
8007 2010-03-10  Cary Coutant  <ccoutant@google.com>
8008
8009         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8010         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8011         (File_read::open[2]): Add whole_file_view_ to list of views.
8012         (File_read::make_view): Remove test of whole_file_view_.
8013         (File_read::find_or_make_view): Create whole_file_view_ if
8014         necessary.
8015         (File_read::clear_views): Replace bool parameter with enum;
8016         adjust all callers.  Don't delete views with permanent data;
8017         do delete cached views and views from archives if
8018         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8019         if clearing the corresponding view.
8020         * fileread.h (File_read::Clear_views_mode): New enum.
8021         (File_read::View::is_permanent_view): New method.
8022         (File_read::clear_views): Replace bool parameter
8023         with enum; adjust all callers.
8024         * options.h (General_options): Change keep_files_mapped option;
8025         add map_whole_files.
8026         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8027         releasing the file.
8028         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8029         the file.
8030
8031 2010-03-10  David S. Miller  <davem@davemloft.net>
8032
8033         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8034
8035 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8036
8037         * icf.cc (get_section_contents): Add '@' marker after processing the
8038         merge reloc.
8039
8040 2010-03-08  Doug Kwan  <dougkwan@google.com>
8041
8042         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8043         due to a conversion warning.
8044         (Arm_relobj::update_output_local_symbol_count): Check for local
8045         symbol with unset output index.
8046
8047 2010-03-05  Ian Lance Taylor  <iant@google.com>
8048
8049         * options.h (class General_options): Add --spare-dynamic-tags.
8050         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8051         --spare-dynamic-tags.
8052
8053 2010-03-05  Ian Lance Taylor  <iant@google.com>
8054
8055         * incremental.cc: Include "libiberty.h".
8056
8057 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8058
8059         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8060         function, is_info_ member.
8061         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8062         (Versions::Versions): Update caller.
8063         (Versions::define_base_version): Likewise.
8064         (Versions::add_def): Likewise.
8065
8066 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8067
8068         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8069         (Scan::possible_function_pointer_reloc): New function.
8070         (Scan::local_reloc_may_be_function_pointer): Change to call
8071         possible_function_pointer_reloc.
8072         (Scan::global_reloc_may_be_function_pointer): Ditto.
8073         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8074         relocations in ".data.rel.ro._ZTV" section.
8075         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8076         * testsuite/icf_safe_so_test.cc: Ditto.
8077         * testsuite/icf_safe_test.cc: Ditto.
8078         * testsuite/icf_safe_test.sh: Ditto.
8079
8080 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8081             Ian Lance Taylor  <iant@google.com>
8082
8083         * target-reloc.h (relocate_section): Check the symbol table index
8084         for -1U before setting the local symbol index.
8085         (scan_relocatable_relocs): If copying the relocation, record that
8086         the local symbol is required.
8087         * object.h (Symbol_value::is_output_symtab_index_set): New
8088         function.
8089         (Symbol_value::may_be_discarded_from_output_symtab): New
8090         function.
8091         (Symbol_value::has_output_symtab_entry): New function.
8092         (Symbol_value::needs_output_symtab_entry): Remove.
8093         (Symbol_value::output_symtab_index): Make sure the symbol index is
8094         set.
8095         (Symbol_value::set_output_symtab_index): Make sure the symbol
8096         index is not set.  Make sure the new index is valid.
8097         (Symbol_value::set_must_have_output_symtab_entry): New function.
8098         (Symbol_value::has_output_dynsym_entry): New function.
8099         (Symbol_value::set_output_dynsym_index): Make sure the new index
8100         is valid.
8101         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8102         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8103         local symbol if permitted.
8104         (Sized_relobj::do_finalize_local_symbols): Call
8105         is_output_symtab_index_set rather than needs_output_symtab_entry.
8106         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8107         rather than needs_output_symtab_entry.  Call
8108         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8109         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8110         is_output_symtab_index_set rather than needs_output_symtab_entry.
8111         * testsuite/discard_locals_relocatable_test.c: New file.
8112         * testsuite/discard_locals_test.sh: Test -r.
8113         * testsuite/Makefile.am (check_DATA): Add
8114         discard_locals_relocatable_test1.syms,
8115         discard_local_relocatable_test2.syms.
8116         (MOSTLYCLEANFILES): Likewise.  Also add
8117         discard_locals_relocatable_test1.lout and
8118         discard_locals_relocatable_test2.out.
8119         (discard_locals_relocatable_test1.syms): New target.
8120         (discard_locals_relocatable_test.o): New target.
8121         (discard_locals_relocatable_test1.out): New target.
8122         (discard_locals_relocatable_test2.syms): New target.
8123         (discard_locals_relocatable_test2.out): New target.
8124         (various): Add missing ../ld-new dependencies.
8125         * testsuite/Makefile.in: Rebuild.
8126
8127 2010-03-03  Nick Clifton  <nickc@redhat.com>
8128
8129         * po/fi.po: New Finnish translation.
8130
8131 2010-03-01  Doug Kwan  <dougkwan@google.com>
8132
8133         * layout.cc (Layout::Layout): Force section types of .init_array*,
8134         .preinit_array* and .fini_array* sections.
8135         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8136         Fix check of return value of std::string::find.().
8137         (Output_section::Input_section_sort_compare::operator()): Remove
8138         comment about .init_array.
8139         (Output_section::Input_section_sort_init_fini_compare::operator()):
8140         New method.
8141         (Output_section::sort_attached_input_sections): Handle .init_array
8142         and .fini_array specially.
8143         * output.h (Output_section::Inut_section_sort_compare): Update
8144         comment.
8145         (Output_section::Input_section_sort_init_fini_compare): New struct.
8146
8147 2010-02-26  Doug Kwan  <dougkwan@google.com>
8148
8149         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8150         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8151         * testsuite/debug_msg.sh: Avoid matching source line number for
8152         use of global variable undef_int.
8153
8154 2010-02-26  Doug Kwan  <dougkwan@google.com>
8155
8156         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8157         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8158         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8159         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8160         * options.cc (General_options::General_options): Initialize member
8161         fix_v4bx_.
8162         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8163         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8164         and rm_no_fix_v4bx.stdout
8165         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8166         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8167         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8168         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8169         and arm_no_fix_v4bx.
8170         * Makefile.in: Regenerate.
8171         * testsuite/arm_fix_v4bx.s: New file.
8172         * testsuite/arm_fix_v4bx.sh: Ditto.
8173
8174 2010-02-24  Doug Kwan  <dougkwan@google.com>
8175
8176         * arm.cc (Target_arm::got_section): Make the .got section the first
8177         non RELRO section in the data segment.
8178         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8179         suffixes of section names.
8180
8181 2010-02-24  Doug Kwan  <dougkwan@google.com>
8182
8183         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8184         flags and attributes merging if an input file is a binary file.
8185         * fileread.cc (Input_file::open): Record format of original file.
8186         * fileread.h (Input_file::Format): New enum type.
8187         (Input_file::Input_file): Initialize data member format_.
8188         (Input_file::format): New method definition.
8189         (Input_file::format_):: New data member.
8190
8191 2010-02-24  Doug Kwan  <dougkwan@google.com>
8192
8193         * arm.cc (Arm_output_data_got): New class.
8194         (ARM_TCB_SIZE): New constant
8195         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8196         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8197         If user uses a script with a SECTIONS clause, issue only a warning
8198         for a misplaced EXIDX input section.  Otherwise, issue an error.
8199         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8200         garbage collection.
8201         (Target_arm::got_mode_index_entry): Handle static linking.
8202         (Target_arm::Scan::local): Ditto.
8203         (Target_arm::Scan::global): Ditto.
8204         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8205         all incorrectly implemented relocations.
8206         (Target_arm::fix_exidx_coverage): Pass layout to
8207         Arm_output_section::fix_exidx_coverage.
8208         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8209         from ".ARM.exidx." and ".ARM.extab.".
8210
8211 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8212
8213         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8214         section if it does not already exist.
8215         * attributes.cc (Attributes_section_data::Attributes_section_data):
8216         Don't crash if size is zero.
8217
8218 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8219             Ian Lance Taylor  <iant@google.com>
8220
8221         * gold.cc (queue_middle_tasks): If no input files were opened,
8222         exit.
8223         * workqueue.h (Task_function::Task_function): Assert that there is
8224         a blocker.
8225
8226 2010-02-22  Doug Kwan  <dougkwan@google.com>
8227
8228         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8229         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8230         types to avoid warnings due to different uint64_t implementations
8231         on different hosts.
8232
8233 2010-02-21  Doug Kwan  <dougkwan@google.com>
8234
8235         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8236         handling of the maximum backward branch offset.
8237         (Arm_relocate_functions::thumb_branch_common): Ditto.
8238         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8239         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8240         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8241         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8242         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8243         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8244         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8245         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8246         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8247         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8248         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8249         thumb2_bl_out_of_range.o): New rules.
8250         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8251         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8252         thumb2_bl_out_of_range
8253         * testsuite/Makefile.in: Regenerate.
8254         * testsuite/arm_bl_in_range.s: New file.
8255         * testsuite/arm_bl_out_of_range.s: Ditto.
8256         * testsuite/arm_branch_in_range.sh: Ditto.
8257         * testsuite/arm_branch_range.t: Ditto.
8258         * testsuite/thumb2_branch_range.t: Ditto.
8259         * testsuite/thumb_bl_in_range.s: Ditto.
8260         * testsuite/thumb_bl_out_of_range.s: Ditto.
8261         * testsuite/thumb_branch_range.t: Ditto.
8262
8263 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8264
8265         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8266         Add reloc offset information.
8267         * icf.cc (get_section_contents): Change iterators to point to the new
8268         vectors. Add reloc offset information to the contents.
8269         * icf.h (Icf::Sections_reachable_info): New typedef.
8270         (Icf::Sections_reachable_list): New typedef.
8271         (Icf::Offset_info): New typedef.
8272         (Icf::Reloc_info): New struct typedef.
8273         (Icf::Reloc_info_list): New typedef.
8274         (Icf::symbol_reloc_list): Delete method.
8275         (Icf::addend_reloc_list): Delete method.
8276         (Icf::section_reloc_list): Delete method.
8277         (Icf::reloc_info_list): New method.
8278         (Icf::reloc_info_list_): New member.
8279
8280 2010-02-19  Doug Kwan  <dougkwan@google.com>
8281
8282         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8283         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8284         * arm.cc (Arm_relocation_functions): New forward declaration.
8285         (Target_arm::Target_arm): Initialize new data members
8286         got_mod_index_offset_ and tls_base_symbol_defined_.
8287         (Target_arm::Relocate::relocate_tls): New method.
8288         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8289          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8290         New methods.
8291         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8292         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8293         (Target_arm::got_mod_index_offset_,
8294         Target_arm::tls_base_symbol_defined_): New data members.
8295         (Target_arm::Scan::local, Target::Scan::global,
8296         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8297         relocations.
8298
8299 2010-02-18  Doug Kwan  <dougkwan@google.com>
8300
8301         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8302         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8303         text section as a parameter becuase some broken tools may not set
8304         the link in section header.
8305         (Target_arm::has_got_section): New method.
8306         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8307         without any mapping symbol as data only.  Remove warning.
8308         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8309         link in its section header, try to discover the link by inspecting the
8310         REL31 relocation at the beginning of the section.
8311         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8312         in error message.
8313         (Target_arm::Scan::global): Treat any reference to the symbol
8314         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8315
8316 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8317
8318         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8319         (Scan::global_reloc_may_be_function_pointer): New function.
8320         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8321         (Scan::global_reloc_may_be_function_pointer): New function.
8322         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8323         (Scan::global_reloc_may_be_function_pointer): New function.
8324         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8325         (Scan::global_reloc_may_be_function_pointer): New function.
8326         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8327         (Scan::global_reloc_may_be_function_pointer): New function.
8328         (Scan::possible_function_pointer_reloc): New function.
8329         (Target_x86_64::can_check_for_function_pointers): New function.
8330         * gc.h (gc_process_relocs): Scan relocation types to determine if
8331         function pointers were taken for targets that support it.
8332         * icf.cc (Icf::find_identical_sections): Include functions for
8333         folding in safe ICF whose pointer is not taken.
8334         * icf.h (Secn_fptr_taken_set): New typedef.
8335         (fptr_section_id_): New member.
8336         (section_has_function_pointers): New function.
8337         (set_section_has_function_pointers): New function.
8338         (check_section_for_function_pointers): New function.
8339         * options.h: Fix comment for safe ICF option.
8340         * target.h (can_check_for_function_pointers): New function.
8341         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8342         Modify icf_safe_test for X86-64.
8343         * testsuite/Makefile.in: Regenerate.
8344         * testsuite/icf_safe_so_test.cc: New file.
8345         * testsuite/icf_safe_so_test.sh: New file.
8346         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8347         (main): Change to take pointer to function kept_func_3.
8348         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8349         folding is done correctly for X86-64.
8350
8351 2010-02-12  David S. Miller  <davem@davemloft.net>
8352
8353         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8354         is_symbolless parameter.
8355         (Output_reloc<SHT_REL>::is_symbolless): New.
8356         (Output_reloc<SHT_REL>::is_symbolless_): New.
8357         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8358         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8359         (Output_reloc<SHT_RELA>::is_symbolless): New.
8360         (Output_data_reloc::add_global): Handle is_symbolless.
8361         (Output_data_reloc::add_global_relative): Likewise.
8362         (Output_data_reloc::add_local): Likewise.
8363         (Output_data_reloc::add_local_relative): Likewise.
8364         (Output_data_reloc::add_symbolless_global_addend): New.
8365         (Output_data_reloc::add_symbolless_local_addend): New.
8366         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8367         is_symbolless.
8368         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8369         instead of ->is_relative_
8370         (Output_reloc::write): Likewise.
8371         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8372         (Output_reloc::write_rel): Simplify.
8373
8374         * sparc.cc (Target_sparc::Scan::local): Use
8375         ->add_symbolless_local_addend as needed.
8376         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8377         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8378         based upon relocation offset.
8379
8380 2010-02-11  Doug Kwan  <dougkwan@google.com>
8381
8382         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8383         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8384         beginning of function.
8385         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8386         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8387         parameter is_32bit in calls to should_apply_static_reloc.
8388         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8389         (check_DATA): Add arm_abs_global.stdout.
8390         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8391         arm_abs_global.stdout): New rules.
8392         (MOSTLLYCLEANFILES): Add arm_abs_global
8393         * Makefile.in: Regenerate.
8394         * testsuite/arm_abs_global.s: New file.
8395         * testsuite/arm_abs_global.sh: Ditto.
8396         * testsuite/arm_abs_lib.s: Ditto.
8397
8398 2010-02-11  Ian Lance Taylor  <iant@google.com>
8399
8400         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8401         Read_relocs task.
8402         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8403         Allocate_commons_task first.
8404         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8405         task, rather than symtab_lock_.
8406         (Gc_process_relocs::~Gc_process_relocs): New function.
8407         (Gc_process_relocs::is_runnable): Check this_blocker_.
8408         (Gc_process_relocs::locks): Use next_blocker_ rather than
8409         blocker_.
8410         (Scan_relocs::~Scan_relocs): New function.
8411         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8412         symtab_lock_.
8413         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8414         next_blocker_.
8415         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8416         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8417         constructor accordingly.
8418         (class Gc_process_relocs): Likewise.
8419         (class Scan_relocs): Likewise.
8420         * common.h (class Allocate_commons_task): Remove symtab_lock_
8421         field, and corresponding constructor parameter.
8422         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8423         symtab_lock_.
8424         (Allocate_commons_task::locks): Likewise.
8425
8426 2010-02-11  Ian Lance Taylor  <iant@google.com>
8427
8428         * gold-threads.h (class Once): Define.
8429         (class Initialize_lock): Rewrite as child of Once.
8430         * gold-threads.cc (class Once_initialize): Define.
8431         (once_pointer_control): New static variable.
8432         (once_pointer, once_arg): New static variables.
8433         (c_run_once): New static function.
8434         (Once::Once, Once::run_once, Once::internal_run): New functions.
8435         (class Initialize_lock_once): Remove.
8436         (initialize_lock_control): Remove.
8437         (initialize_lock_pointer): Remove.
8438         (initialize_lock_once): Remove.
8439         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8440         (Initialize_lock::initialize): Rewrite.
8441         (Initialize_lock::do_run_once): New function.
8442         * archive.cc (Archive::interpret_header): Only clear name if it is
8443         not already empty.
8444         * fileread.cc: Include "gold-threads.h"
8445         (file_counts_lock): New static variable.
8446         (file_counts_initialize_lock): Likewise.
8447         (File_read::release): Only increment counts when using --stats.
8448         Use a lock around the increment.
8449         * parameters.cc (class Set_parameters_target_once): Define.
8450         (set_parameters_target_once): New static variable.
8451         (Parameters::Parameters): Move here from parameters.h.
8452         (Parameters::set_target): Rewrite.
8453         (Parameters::set_target_once): New function.
8454         (Parameters::clear_target): Move here and rewrite.
8455         * parameters.h (class Parameters): Update declarations.  Add
8456         set_parameters_target_once_ field.
8457         (Parameters::Parameters): Move to parameters.cc.
8458         (Parameters::clear_target): Likewise.
8459         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8460         task.
8461         (Start_group::~Start_group): New function.
8462         (Start_group::is_runnable): New function.
8463         (Start_group::locks, Start_group::run): New functions.
8464         (Finish_group::run): Change saw_undefined to size_t.
8465         * readsyms.h (class Start_group): Define.
8466         (class Finish_group): Change saw_undefined_ field to size_t.
8467         (Finish_group::Finish_group): Remove saw_undefined and
8468         this_blocker parameters.  Change all callers.
8469         (Finish_group::set_saw_undefined): New function.
8470         (Finish_group::set_blocker): New function.
8471         * symtab.h (class Symbol_table): Change saw_undefined to return
8472         size_t.  Change saw_undefined_ field to size_t.
8473         * target-select.cc (Set_target_once::do_run_once): New function.
8474         (Target_selector::Target_selector): Initialize set_target_once_
8475         field.  Don't initialize lock_ and initialize_lock_ fields.
8476         (Target_selector::instantiate_target): Rewrite.
8477         (Target_selector::set_target): New function.
8478         * target-select.h (class Set_target_once): Define.
8479         (class Target_selector): Update declarations.  Make
8480         Set_target_once a friend.  Remove lock_ and initialize_lock_
8481         fields.  Add set_target_once_ field.
8482
8483 2010-02-10  Ian Lance Taylor  <iant@google.com>
8484
8485         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8486         queueing any tasks.
8487         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8488         (queue_middle_tasks): Add all blockers before queueing any tasks.
8489         (queue_final_tasks): Likewise.
8490         * token.h (Task_token::add_blockers): New function.
8491         * object.h (Input_objects::number_of_relobjs): New function.
8492
8493 2010-02-10  Ian Lance Taylor  <iant@google.com>
8494
8495         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8496         shared, not if not position independent.
8497         * x86_64.cc (Relocate::relocate_tls): Likewise.
8498         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8499         (tls_pie_pic_test): New target.
8500         * testsuite/Makefile.in: Rebuild.
8501
8502         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8503         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8504         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8505         * testsuite/Makefile.in: Rebuild.
8506
8507 2010-02-09  David S. Miller  <davem@davemloft.net>
8508
8509         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8510         R_SPARC_RELATIVE using ->add_local_relative().
8511         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8512
8513         * output.h (Output_data_dynamic::add_section_size): New method
8514         that takes two Output_data objects.
8515         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8516         entry param.  Handle it in initializers.
8517         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8518         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8519         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8520         arg.
8521         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8522         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8523         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8524         for dynrel_includes_plt.
8525         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8526         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8527         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8528         before .rela.plt
8529         (Target_sparc::do_finalize_sections): Update to pass true for
8530         dynrel_includes_plt.
8531         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8532         output before .rela.plt
8533         (Target_powerpc::do_finalize_sections): Update to pass true for
8534         dynrel_includes_plt when 32-bit.
8535
8536 2010-02-08  Doug Kwan  <dougkwan@google.com>
8537
8538         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8539         method.
8540         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8541         Arm_relobj::scan_section_for_cortex_a8_stubs,
8542         Arm_relobj::do_relocation_section): Instead of calling
8543         Output_section::output_address, use faster
8544         Arm_relobj::simple_input_section_output_address.
8545
8546 2010-02-08  David S. Miller  <davem@davemloft.net>
8547
8548         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8549         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8550         relocation helper function.
8551
8552         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8553         just like R_SPARC_GOT{10,13,22}.
8554         (Target_sparc::Scan::local): Likewise.
8555         (Target_sparc::Relocate:relocate): Likewise.
8556
8557 2010-02-06  Ian Lance Taylor  <iant@google.com>
8558
8559         * configure.ac: Rewrite targetobjs duplicate removal code to use
8560         only shell constructs.
8561         * configure: Rebuild.
8562
8563 2010-02-05  Doug Kwan  <dougkwan@google.com>
8564
8565         PR 11247
8566         * arm.cc (Arm_relobj::section_is_scannable): New method.
8567         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8568         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8569
8570 2010-02-04  Doug Kwan  <dougkwan@google.com>
8571
8572         PR 11247
8573         * arm-reloc-property.cc (cstdio): Include.
8574         * configure.ac (targetobjs): Remove duplicates.
8575         * configure: Regenerate.
8576         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8577         big and little endian version for a given address size.
8578
8579 2010-02-03  Doug Kwan  <dougkwan@google.com>
8580
8581         * arm-reloc-property.cc
8582         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8583         definition.
8584         * arm-reloc-property.h
8585         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8586         New method definition.
8587         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8588         declaration.
8589         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8590         overflow to N.
8591         (GOT_PREL): Change implemented to Y.
8592         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8593         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8594         (Arm_relocate_functions::movw_abs_nc): Remove method.
8595         (Arm_relocate_functions::movt_abs): Ditto.
8596         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8597         (Arm_relocate_functions::thm_movt_abs): Ditto.
8598         (Arm_relocate_functions::movw_rel_nc): Ditto.
8599         (Arm_relocate_functions::movw_rel): Ditto.
8600         (Arm_relocate_functions::movt_rel): Ditto.
8601         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8602         (Arm_relocate_functions:thm_movw_rel): Ditto.
8603         (Arm_relocate_functions:thm_movt_rel): Ditto.
8604         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8605         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8606         New method definitions.
8607         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8608         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8609         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8610         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8611         (Target_arm::Relocate::relocate): Check for non-static or
8612         unimplemented relocation code and exit early.  Change calls to
8613         Target_arm::reloc_uses_thumb_bit and
8614         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8615         instead.  Refactor code to handle similar relocations to increase
8616         code sharing.  Remove check for unsupported relocation code in switch
8617         statement.
8618         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8619         relocation property table to find out size.  Change error message to
8620         print out the name of a relocation code instead of the numeric value.
8621         (Target_arm::scan_reloc_for_stub): Use relocation property table
8622         instead of calling Target_arm::reloc_uses_thumb_bit().
8623
8624 2010-02-02  Doug Kwan  <dougkwan@google.com>
8625
8626         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8627         types of relaxed input section.
8628
8629 2010-02-02  Doug Kwan  <dougkwan@google.com>
8630
8631         * Makefile.am (HFILES): Add arm-reloc-property.h.
8632         (DEFFILES): New.
8633         (TARGETSOURCES): Add arm-reloc-property.cc
8634         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8635         (libgold_a_SOURCES): $(DEFFILES)
8636         * Makefile.in: Regenerate.
8637         * arm-reloc-property.cc: New file.
8638         * arm-reloc-property.h: New file.
8639         * arm-reloc.def: New file.
8640         * arm.cc: Update comments.
8641         (arm-reloc-property.h): New included header.
8642         (arm_reloc_property_table): New global variable.
8643         (Target_arm::do_select_as_default_target): New method definition.
8644         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8645         arm-reloc-property to targ_extra_obj.
8646         * parameters.cc (set_parameters_target): Call
8647         Target::select_as_default_target().
8648         * target.h (Target::select_as_default_target): New method definition.
8649         (Target::do_select_as_default_target): Same.
8650
8651 2010-02-01  Doug Kwan  <dougkwan@google.com>
8652
8653         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8654         first_output_text_section_.
8655         (Arm_exidx_fixup::first_output_text_section): New method definition.
8656         (Arm_exidx_fixup::first_output_text_section_): New data member.
8657         (Arm_exidx_fixup::process_exidx_section): Record the first text
8658         output section seen.
8659         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8660         and entsize in output section header.
8661
8662 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8663
8664         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8665         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8666         (Arm_relocate_functions::thm_alu11): New Method.
8667         (Arm_relocate_functions::thm_pc8): New Method.
8668         (Arm_relocate_functions::thm_pc12): New Method.
8669         (Target_arm::Scan::local): Handle the relocations.
8670         (Target_arm::Scan::global): Likewise.
8671         (Target_arm::Relocate::relocate): Likewise.
8672         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8673
8674 2010-01-29  Doug Kwan  <dougkwan@google.com>
8675
8676         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8677         of relocation types as ld.
8678
8679 2010-01-29  Doug Kwan  <dougkwan@google.com>
8680
8681         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8682         to public.
8683         (Arm_relocate_functions::thumb_branch_common): Ditto.
8684         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8685         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8686         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8687         Arm_relocate_functions::jump24): Remove.
8688         (Target_arm::Relocate::relocate): Adjust code to call
8689         Arm_relocation_functions::arm_branch_common and
8690         Arm_relocation_functions::thumb_branch_common instead of their removed
8691         wrappers.  Merge switch-cases together to reduce source code size.
8692
8693 2010-01-29  Doug Kwan  <dougkwan@google.com>
8694
8695         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8696         output_local_symbol_count_needs_update_.
8697         (Arm_relobj::output_local_symbol_count_needs_update,
8698          Arm_relobj::set_output_local_symbol_count_needs_update,
8699          Arm_relobj::update_output_local_symbol_count): New methods.
8700         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8701         member.
8702         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8703         of pointed function as in a R_ARM_PREL31 relocation.
8704         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8705         for output local symbol count updating.
8706         (Target_arm::do_relax): Update output local symbol counts in objects
8707         if necessary.
8708         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8709
8710 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8711
8712         * arm.cc: Added support for the ARM relocations:
8713         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8714         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8715         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8716         movw_prel_nc).
8717         (Arm_relocate_functions::movw_rel): New method.
8718         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8719         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8720         thm_movw_prel_nc).
8721         (Arm_relocate_functions::thm_movw_rel): New method.
8722         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8723         thm_movt_prel).
8724         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8725         relocations.
8726         (Target_arm::Scan::global): Likewise.
8727         (Target_arm::Relocate::relocate): Likewise.
8728         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8729         Likewise.
8730
8731 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8732
8733         * arm.cc: Added support for ARM group relocations.
8734         (Target_arm::reloc_needs_sym_origin): New method.
8735         (Arm_relocate_functions::calc_grp_kn): New method.
8736         (Arm_relocate_functions::calc_grp_residual): New method.
8737         (Arm_relocate_functions::calc_grp_gn): New method.
8738         (Arm_relocate_functions::arm_grp_alu): New Method.
8739         (Arm_relocate_functions::arm_grp_ldr): New Method.
8740         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8741         (Arm_relocate_functions::arm_grp_ldc): New Method.
8742         (Target_arm::Scan::local): Handle the ARM group relocations.
8743         (Target_arm::Scan::global): Likewise.
8744         (Target_arm::Relocate::relocate): Likewise.
8745         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8746         Likewise.
8747
8748 2010-01-26  Doug Kwan  <dougkwan@google.com>
8749
8750         * arm.cc (set): Include.
8751         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8752         pointer type.
8753         (Arm_output_section::Text_section_list): New type.
8754         (Arm_output_section::append_text_sections_to_list): New method.
8755         (Arm_output_section::fix_exidx_coverage): Ditto.
8756         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8757         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8758         Relobj::set_section_offset() instead of
8759         Sized_relobj::invalidate_section_offset().
8760         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8761         parameter for section headers. Ignore relocation sections for
8762         unallocated sections and EXIDX sections.
8763         (Target_arm::fix_exidx_coverage): New method.
8764         (Target_arm::output_section_address_less_than): New type.
8765         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8766         linked text section instead of the EXIDX section.
8767         (Arm_output_section::create_stub_group): Add an assertion to check
8768         that this is not an EXIDX output section.
8769         (Arm_output_section::append_text_sections_to_list): New method.
8770         (Arm_output_section::fix_exidx_coverage): Ditto.
8771         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8772         Arm_relobj::section_needs_reloc_stub_scanning.
8773         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8774         first pass.
8775         (Target_arm::fix_exidx_coverage): New method.
8776         * object.h (Relobj::set_output_section): New method.
8777         (Sized_relobj::invalidate_section_offset): Remove method.
8778         (Sized_relobj::do_invalidate_section_offset): Remove method.
8779         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8780
8781 2010-01-25  Doug Kwan  <dougkwan@google.com>
8782
8783         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8784         Fix warning due to signed and unsigned comparison on a 32-bit host.
8785
8786 2010-01-22  Doug Kwan  <dougkwan@google.com>
8787
8788         * arm.cc (Target_arm::do_relax): Record an output section for section
8789         offset adjustment it contains any stub table that has changed.
8790         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8791         offsets in an output section if necessary.
8792         * output.cc (Output_section::Output_section): Initialize
8793         section_offsets_need_adjustments_.
8794         (Output_section::add_input_section_for_script): Renamed to
8795         Output_section::add_simple_input_section.
8796         (Output_section::save_states): Add a comment.
8797         (Output_section::discard_states): New method defintion.
8798         (Output_section::adjust_section_offsets): Same.
8799         * output.h (Output_section::add_input_section_for_script): Renamed to
8800         Output_section::add_simple_input_section.
8801         (Output_section::discard_states): New method declaration.
8802         (Output_section::adjust_section_offsets): Same.
8803         (Output_section::section_offsets_need_adjustment,
8804         Output_section::set_section_offsets_need_adjustment): New method
8805         definitions.
8806         (Output_section::section_offsets_need_adjustment_): New data member.
8807         * script-sections.cc
8808         (Output_section_element_input::set_section_address): Adjust code for
8809         renaming of Output_section::add_input_section_for_script.
8810         (Orphan_output_section::set_section_address): Same.
8811
8812 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8813
8814         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8815         Fix_v4bx enum values .
8816         * gold/options.h (General_options): New option definitions.
8817         (General_options::fix_v4bx): New method.
8818         (General_options::Fix_v4bx): New enum.
8819         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8820         (General_options::parse_fix_v4bx_interworking): New method.
8821
8822 2010-01-22  Doug Kwan  <dougkwan@google.com>
8823
8824         * arm.cc (Arm_exidx_fixup): New class.
8825
8826 2010-01-21  Doug Kwan  <dougkwan@google.com>
8827
8828         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8829         classes.
8830         (Arm_exidx_section_offset_map): New type.
8831
8832 2010-01-21  Doug Kwan  <dougkwan@google.com>
8833
8834         * arm.cc (Arm_exidx_input_section): New class.
8835         (Arm_relobj::exidx_input_section_by_link,
8836         Arm_relobj::exidx_input_section_by_shndx,
8837         Arm_relobj::make_exidx_input_section): New methods.
8838         (read_arm_attributes_section): Remove.
8839         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8840         information about them.
8841         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8842         to here.
8843
8844 2010-01-20  Doug Kwan  <dougkwan@google.com>
8845
8846         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8847         Input_section_specifier to Section_id.
8848         (Target_arm::new_arm_input_section: Adjust code for change of key
8849         type.
8850         (Target_arm::find_arm_input_section): Ditto.
8851         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8852         (Section_id): Remove.
8853         (Garbage_collection::Section_id_hash): Remove.
8854         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8855         (Section_id): Remove.
8856         (Icf::Section_id_hash): Remove.
8857         * object.h (Section_id, Const_section_id, Section_id_hash,
8858         Const_section_id_hash): New type definitions.
8859         * output.cc (Output_section::add_relaxed_input_section): Change to
8860         use Const_section_id instead of Input_section_specifier as key type.
8861         (Output_section::add_merge_input_section): Ditto.
8862         (Output_section::build_relaxation_map): Change to use Section_id
8863         instead of Input_section_specifier as key type.
8864         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8865         Ditto.
8866         (Output_section::convert_input_sections_to_relaxed_sections): Change
8867         to use Const_section_id instead of Input_section_specifier as key type.
8868         (Output_section::find_merge_section): Ditto.
8869         (Output_section::find_relaxed_input_section): Ditto.
8870         * output.h (Input_section_specifier): Remove class.
8871         (Output_section::Output_section_data_by_input_section_map): Change
8872         key type to Const_section_id.
8873         (Output_section::Output_relaxed_input_section_by_input_section_map):
8874         Ditto.
8875         (Output_section::Relaxation_map): Change key type to Section_id.
8876
8877 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8878
8879         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8880         (class Arm_v4bx_stub): New class.
8881         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8882         (Stub_factory::make_arm_v4bx_stub): New method.
8883         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8884         (Stub_table::empty): Handle v4bx stubs.
8885         (Stub_table::add_arm_v4bx_stub): New method.
8886         (Stub_table::find_arm_v4bx_stub): New method.
8887         (Arm_relocate_functions::v4bx): New method.
8888         (Target_arm::fix_v4bx): New method.
8889         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8890         (Stub_table::relocate_stubs): Likewise.
8891         (Stub_table::do_write): Likewise.
8892         (Stub_table::update_data_size_and_addralign): Likewise.
8893         (Stub_table::finalize_stubs):  Likewise.
8894         (Target_arm::Scan::local): Likewise.
8895         (Target_arm::Scan::global): Likewise.
8896         (Target_arm::do_finalize_sections): Likewise.
8897         (Target_arm::Relocate::relocate): Likewise.
8898         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8899         Likewise.
8900         (Target_arm::scan_reloc_for_stub): Likewise.
8901         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8902
8903 2010-01-19  Ian Lance Taylor  <iant@google.com>
8904
8905         * output.cc (Output_section_headers::do_sized_write): Write large
8906         segment count to sh_info field.
8907         (Output_file_header::do_sized_write): For large segment count,
8908         write PN_XNUM to e_phnum field.
8909
8910 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8911
8912         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8913         (Arm_relocate_functions::thm_jump8): New function.
8914         (Arm_relocate_functions::thm_jump11): New function.
8915         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8916         R_ARM_THM_JUMP11.
8917         (Target_arm::Scan::global): Likewise.
8918         (Target_arm::Relocate::relocate): Likewise.
8919         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8920         Likewise.
8921
8922 2010-01-14  Doug Kwan  <dougkwan@google.com>
8923
8924         * arm.cc (map, utility): Include headers.
8925         (Target_arm::apply_cortex_a8_workaround): New method.
8926         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8927         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8928         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8929         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8930         the --[no-]fix-cortex-a8 command line options.
8931         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8932         (Target_arm::relocate_stub): Use addend in instruction template.
8933         * options.h (DEFINE_bool): Set the user-set flag.
8934         (General_options): Add --[no-]-fix-cortex options.
8935         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8936         : Update fast look-up map after conversion.
8937
8938 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8939
8940         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8941         in the first pass of do_layout.
8942
8943 2010-01-13  Doug Kwan  <dougkwan@google.com>
8944
8945         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8946         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8947         apparent compiler problem of not folding static constant integral
8948         data members of elfcpp::Elf_sizes<32>.
8949
8950 2010-01-13  Doug Kwan  <dougkwan@google.com>
8951
8952         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8953         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8954         Arm_relobj::scan_section_for_cortex_a8_erratum,
8955         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8956         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8957         sections to scan for relocation stubs into a new method
8958         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8959         relocation and Cortex-A8 stub scanning.
8960         (Target_arm::do_relax): Force stubs to be after stubbed sections
8961         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8962         the beginning of a new relaxation pass.  Update a comment.
8963         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8964
8965 2010-01-12  Ian Lance Taylor  <iant@google.com>
8966
8967         * target-reloc.h (visibility_error): New inline function.
8968         (relocate_section): Call visibility_error.
8969         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8970         (MOSTLYCLEANFILES): Likewise.
8971         (protected_4_pic.o, protected_3.err): New targets.
8972         * testsuite/protected_4.cc: New file.
8973
8974 2010-01-12  Doug Kwan  <dougkwan@google.com>
8975
8976         * arm.cc (Cortex_a8_reloc): New class.
8977         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8978         and cortex_a8_relocs_info_.
8979         (Target_arm::fix_cortex_a8): New method definition.
8980         (Target_arm::Cortex_a8_relocs_info): New type.
8981         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8982         New data member declarations.
8983         (Target_arm::scan_reloc_for_stub): Record information about
8984         relocations for THUMB branches that might be exempted from the
8985         Cortex-A8 workaround.
8986         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8987         at the beginning of a relaxation pass.
8988
8989 2010-01-12  Doug Kwan  <dougkwan@google.com>
8990
8991         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8992         (Arm_relobj::Mapping_symbol_position,
8993          Arm_reloj::Mapping_symbol_position_less,
8994          Arm_relobj::Mapping_symbols_info): New types.
8995         (Target_arm::is_mapping_symbol_name): New method definition.
8996         (Arm_relobj::do_count_local_symbols): Save information about mapping
8997         symbols.
8998
8999 2010-01-11  Doug Kwan  <dougkwan@google.com>
9000
9001         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9002         Arm_relocate_functions::thumb32_branch_upper,
9003         Arm_relocate_functions::thumb32_branch_lower,
9004         Arm_relocate_functions::thumb32_cond_branch_offset,
9005         Arm_relocate_functions::thumb32_cond_branch_upper,
9006         Arm_relocate_functions::thumb32_cond_branch_lower,
9007         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9008         branch offset encoding.
9009         (Arm_relocate_functions::thumb_branch_common): Use new branch
9010         offset encoding methods to avoid code duplication.
9011         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9012         (Stub_addend_reader::operator()): Use new branch encoding method
9013         to avoid code duplication.
9014
9015 2010-01-11  Doug Kwan  <dougkwan@google.com>
9016
9017         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9018         (Target_arm::do_finalize_sections): Define special EXIDX section
9019         symbols only if referenced.
9020         * gc.h (Garbage_collection::add_reference): New method.
9021         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9022         code duplication.
9023
9024 2010-01-11  Ian Lance Taylor  <iant@google.com>
9025
9026         * script.cc (Version_script_info::build_expression_list_lookup):
9027         Change complaing about duplicate wildcard match from error to
9028         warning.
9029
9030         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9031         of 2009-12-30.
9032         (Version_script_info::Version_script_info): Initialize globs_,
9033         default_version_, default_is_global_, and exact_.  Don't
9034         initialize globals_ or locals_.
9035         (Version_script_info::build_lookup_tables): Build local symbols
9036         first.
9037         (Version_script_info::unquote): New function.
9038         (Version_script_info::add_exact_match): New function.
9039         (Version_script_info::build_expression_list_lookup): Remove lookup
9040         parameter.  Add is_global parameter.  Change all callers.  Handle
9041         wildcard pattern specially.  Unquote pattern.  Call
9042         add_exact_match.
9043         (Version_script_info::get_name_to_match): New function.
9044         (Version_script_info::get_symbol_version): New function.
9045         (Version_script_info::get_symbol_version_helper): Remove.
9046         (Version_script_info::check_unmatched_names): Call unquote.
9047         * script.h (class Version_script_info): Change get_symbol_version
9048         to be non-inline and add is_global parameter; change all callers.
9049         Rewrite symbol_is_local.  Update declarations.  Define struct
9050         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9051         Remove globals_ and locals_ members.  Add exact_, globs_,
9052         default_version_, is_global_.
9053         (Version_script_info::Glob): Remove pattern, add expression and
9054         is_global.  Update constructor.  Change all callers.
9055         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9056         default version.
9057         (Versions::symbol_section_contents): If a symbol is undefined, or
9058         defined in a dynamic object, set the version index to
9059         VER_NDX_LOCAL.
9060         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9061         symbol_is_local.
9062         (Symbol_table::add_from_pluginobj): Likewise.
9063         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9064
9065 2010-01-11  Doug Kwan  <dougkwan@google.com>
9066
9067         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9068         (incremental_dump_LDADD): Add linking option for libintl.
9069         * Makefile.in: Regenerate.
9070
9071 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9072
9073         PR gold/11144
9074         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9075         instead of -Ds.
9076         * testsuite/Makefile.in: Regenerated.
9077
9078 2010-01-10  Doug Kwan  <dougkwan@google.com>
9079
9080         * options.h (DEFINE_var): Use parentheses around argument varname__
9081         in macro body to avoid any unintended subsequent substitutions.
9082
9083 2010-01-10  Ian Lance Taylor  <iant@google.com>
9084
9085         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9086         candidates before doing symbol resolution.
9087
9088         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9089         ODR candidates if only one is weak.
9090
9091 2010-01-08  Ian Lance Taylor  <iant@google.com>
9092
9093         * script.cc (Version_script_info::build_expression_list_lookup):
9094         Don't warn about ambiguous version, just record the ambiguity.
9095         (Version_script_info::get_symbol_version_helper): Give error if
9096         version is ambiguous.
9097
9098 2010-01-08  Doug Kwan  <dougkwan@google.com>
9099
9100         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9101         prev_data_size_ and prev_addralign_.  Remove initializer for
9102         deleted data member has_been_changed_.
9103         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9104         to determine if the table is empty.
9105         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9106         Remove.
9107         (Stub_table::add_reloc_stub): Define method in class definition
9108         instead of just declaring it there.
9109         (Stub_table::add_cortex_a8_stub): New method definition.
9110         (Stub_table::update_data_size_and_addralign): Ditto.
9111         (Stub_table::finalize_stubs): Ditto.
9112         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9113         (Stub_table::do_addralign_): Return address alignment in the
9114         (Stub_table::do_reset_address_and_file_offset): Define method in
9115         class definition instead of declaring it there.  Set current data
9116         size to be the data size of the previous pass.
9117         (Stub_table::set_final_data_size): Use current data size as the
9118         final data size.
9119         (Stub_table::relocate_stub): Change parameter type of stub from
9120         Reloc_stub pointer to Stub pointer.
9121         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9122         (Stub_table::Cortex_a8_stub_list): New typedef.
9123         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9124          Stub_table::prev_addralign_): New data member.
9125         (Arm_relobj::Arm_relobj): Initialize data member
9126         section_has_cortex_a8_workaround_.
9127         (Arm_relobj::section_has_cortex_a8_workaround,
9128          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9129          definitions.
9130         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9131         declarations.
9132         (Target_arm::relocate_stub): Change parameter type of stub from
9133         Reloc_stub pointer to Stub pointer.
9134         (Insn_template::size, Insn_template::alignment): Handle
9135         THUMB16_SPECIAL_TYPE.
9136         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9137          Stub_table::update_data_size_and_addralign,
9138          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9139         definitions.
9140         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9141         (Stub_table::do_write): Ditto.
9142         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9143
9144 2010-01-08  Ian Lance Taylor  <iant@google.com>
9145
9146         PR 11108
9147         * symtab.h (class Symbol): Remove fields is_target_special_ and
9148         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9149         (Symbol::is_defined_in_discarded_section): New function.
9150         (Symbol::set_is_defined_in_discarded_section): New function.
9151         (Symbol::has_plt_offset): Rewrite.
9152         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9153         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9154         Don't initialize is_target_special_ or has_plt_offset_.
9155         Initialize is_defined_in_discarded_section_.
9156         (Symbol_table::add_from_relobj): If appropriate, set
9157         is_defined_in_discarded_section.
9158         * resolve.cc (Symbol::override_base_with_special): Don't test
9159         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9160         * target-reloc.h (relocate_section): Do special handling for
9161         symbols defined in discarded sections for global symbols as well
9162         as local symbols.
9163
9164 2010-01-08  Ian Lance Taylor  <iant@google.com>
9165
9166         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9167         the SHT_SYMTAB case.
9168
9169 2010-01-08  Ian Lance Taylor  <iant@google.com>
9170
9171         * object.cc (Sized_relobj::do_layout): Don't get confused if
9172         layout_eh_frame returns NULL.
9173
9174 2010-01-08  Ian Lance Taylor  <iant@google.com>
9175
9176         PR 11084
9177         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9178         dynamic symbol table, use the normal symbol table.
9179         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9180         symbol table.
9181
9182 2010-01-08  Ian Lance Taylor  <iant@google.com>
9183
9184         PR 11072
9185         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9186         sections.
9187
9188 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9189
9190         * version.cc (print_version): Change to "Copyright 2010".
9191
9192 2010-01-08  Ian Lance Taylor  <iant@google.com>
9193
9194         PR 10287
9195         PR 11063
9196         * i386.cc (class Target_i386): Change return type of plt_section
9197         to be non-const.
9198         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9199         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9200         tls_desc_rel_ field.
9201         (Output_data_plt_i386::rel_tls_desc): New function.
9202         (Target_i386::rel_tls_desc_section): New function.
9203         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9204         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9205         R_386_TLS_DESC reloc in rel_tls_desc_section.
9206         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9207         Define struct Tlsdesc_info.
9208         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9209         (Target_x86_64::do_reloc_symbol_index): New function.
9210         (Target_x86_64::add_tlsdesc_info): New function.
9211         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9212         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9213         tlsdesc_rel_ field.
9214         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9215         all callers.
9216         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9217         (Target_x86_64::rela_tlsdesc_section): New function.
9218         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9219         handling.
9220         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9221         (Target_x86_64::do_reloc_addend): New function.
9222         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9223         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9224         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9225         (Output_reloc::type): New function.
9226         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9227         (Output_reloc::is_target_specific): New function.
9228         (Output_reloc::target_arg): New function.
9229         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9230         absolute relocs and target specific relocs.
9231         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9232         add_target_specific.
9233         (class Output_data_reloc) [SHT_RELA]: Likewise.
9234         * output.cc (Output_reloc::Output_reloc): Add four new versions
9235         for absolute relocs and target specific relocs.
9236         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9237         (Output_reloc::get_symbol_index): Likewise.
9238         (Output_reloc::local_section_offset): Check that local_sym_index_
9239         is not TARGET_CODE or 0.
9240         (Output_reloc::symbol_value): Likewise.
9241         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9242         reloc.
9243         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9244         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9245         functions.
9246         * layout.cc (add_target_dynamic_tags): Use output section for
9247         DT_PLTRELSZ and DT_JMPREL.
9248
9249 2010-01-07  Ian Lance Taylor  <iant@google.com>
9250
9251         PR 11061
9252         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9253         function.
9254         (class Output_data_reloc_generic): Define.
9255         (class Output_data_reloc_base): Change base class to
9256         Output_data_reloc_generic.  Change add() method to call
9257         bump_relative_reloc_count for a relative reloc.  Remove
9258         sort_relocs_ field.
9259         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9260         to sort_relocs().
9261         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9262         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9263         appropriate.
9264         * layout.h (class Layout): Update declaration.
9265
9266 2010-01-07  Ian Lance Taylor  <iant@google.com>
9267
9268         * output.h (class Output_data): Add const version of
9269         output_section and do_output_section.
9270         (class Output_section_data): Add const version of
9271         do_output_section.
9272         (class Output_section): Likewise.
9273         * layout.cc (Layout::add_target_dynamic_tags): New function.
9274         * layout.h (class Layout): Update declarations.
9275         * arm.cc (Target_arm::do_finalize_sections): Use
9276         add_target_dynamic_tags.
9277         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9278         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9279         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9280         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9281
9282 2010-01-07  Ian Lance Taylor  <iant@google.com>
9283
9284         PR 11042
9285         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9286         object as needed.
9287
9288 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9289             Ian Lance Taylor  <iant@google.com>
9290
9291         PR 11019
9292         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9293         Xindex::read_symtab_xindex.
9294
9295 2010-01-07  Doug Kwan  <dougkwan@google.com>
9296
9297         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9298         (Insn_template::thumb16_bcond_insn): New method declaration.
9299         (Insn_template): Fix spelling.
9300         (Stub::thumb16_special): New method declaration.
9301         (Stub::do_write): Define virtual method which was previously pure
9302         virtual.
9303         (Stub::do_thumb16_special): New method declaration.
9304         (Stub::do_fixed_endian_write): New template member.
9305         (Reloc_stub::do_write): Remove.
9306         (Reloc_stub::do_fixed_endian_write): Remove.
9307         (Cortex_a8_stub): New class definition.
9308         (Stub_factory::make_cortex_a8_stub): New method definition.
9309         (Stub_factory::Stub_factory): Add missing static storage class
9310         qualifier for elf32_arm_stub_a8_veneer_blx.
9311
9312 2010-01-07  Ian Lance Taylor  <iant@google.com>
9313
9314         PR 10980
9315         * options.h (class General_options): Add --warn-unresolved-symbols
9316         and --error-unresolved-symbols.
9317         * errors.cc (Errors::undefined_symbol): Implement
9318         --warn-unresolved-symbols.
9319
9320         * options.h (class General_options): Add -z text and -z textoff.
9321         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9322
9323 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9324
9325         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9326         (Garbage_collection::cident_sections): New function.
9327         (Garbage_collection::add_cident_section): New function.
9328         (Garbage_collection::cident_sections_): New member.
9329         (gc_process_relocs): Add references to sections whose names are C
9330         identifiers.
9331         * gold.h (cident_section_start_prefix): New constant.
9332         (cident_section_stop_prefix): New constant.
9333         (is_cident): New function.
9334         * layout.cc (Layout::define_section_symbols): Replace string constants
9335         with the newly defined constants.
9336         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9337         C identifiers.
9338         * testsuite/Makefile.am: Add gc_orphan_section_test.
9339         * testsuite/Makefile.in: Regenerate.
9340         * testsuite/gc_orphan_section_test.cc: New file.
9341         * testsuite/gc_orphan_section_test.sh: New file.
9342
9343 2010-01-06  Ian Lance Taylor  <iant@google.com>
9344
9345         PR 10980
9346         * options.h (class General_options): Add --warn-shared-textrel.
9347         * layout.cc (Layout::finish_dynamic_section): Implement
9348         --warn-shared-textrel.
9349
9350         PR 10980
9351         * options.h (class General_options): Add --warn-multiple-gp.
9352
9353 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9354
9355         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9356         $(THREADSLIB) and $(LIBDL).
9357         * Makefile.in: Rebuild.
9358
9359 2010-01-06  Ian Lance Taylor  <iant@google.com>
9360
9361         PR 10980
9362         * options.cc (General_options::parse_section_start): New function.
9363         (General_options::section_start): New function.
9364         (General_options::General_options): Initialize all members.
9365         * options.h: Include <map>
9366         (class General_options): Add --section-start.  Add section_starts_
9367         member.
9368         * layout.cc (Layout::attach_allocated_section_to_segment): If
9369         --section-start was used, set the address of the segment.  Remove
9370         local sort_sections.
9371         (Layout::relaxation_loop_body): If the address of the load segment
9372         has been set by --section-start, don't use it.
9373         * output.h (Output_segment::update_flags_for_output_section): New
9374         function.
9375         * output.cc (Output_segment::add_output_section): Call
9376         update_flags_for_output_section.
9377
9378 2010-01-05  Ian Lance Taylor  <iant@google.com>
9379
9380         PR 10980
9381         * options.h (class General_options): Add --undefined-version.
9382         * script.cc (struct Version_expression): Add was_matched_by_symbol
9383         field.
9384         (Version_script_info::matched_symbol): New function.
9385         (Version_script_info::get_symbol_version_helper): Call
9386         matched_symbol.
9387         (Version_script_info::check_unmatched_names): New function.
9388         * script.h (class Version_script_info): Update declarations.
9389         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9390
9391         * options.h (class General_options): Use DEFINE_bool_alias for
9392         allow_multiple_definition.
9393         * resolve.cc (Symbol_table::should_override): Don't test
9394         allow_multiple_definition.
9395
9396         PR 10980
9397         * options.h (class General_options): Add --cref.
9398         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9399         until after printing cref table.
9400         * cref.cc: Include "symtab.h".
9401         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9402         (Cref_table_compare::operator()): New function.
9403         (Cref_inputs::gather_cref): New function.
9404         (filecol): New static const.
9405         (Cref_inputs::print_cref): New function.
9406         (Cref::print_cref): New function.
9407         * cref.h: Include <cstdio>.
9408         (class Cref): Update declarations.
9409         * mapfile.h (Mapfile::file): New function.
9410         * object.h (class Object): Define Symbols.  Declare virtual
9411         do_get_global_symbols.
9412         (Object::get_global_symbols): New function.
9413         * object.cc (Input_objects::add_object): Pass object to cref_ if
9414         --cref.
9415         (Input_objects::archive_start): Likewise.
9416         (Input_objects::archive_stop): Likewise.
9417         (Input_objects::print_cref): New function.
9418         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9419         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9420         --cref.
9421         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9422         function.
9423         * plugin.h (class Sized_pluginobj): Update declarations.
9424
9425 2010-01-05  Ian Lance Taylor  <iant@google.com>
9426
9427         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9428         to is_default_version.  Rename insdef to insdefault.
9429         (Symbol_table::add_from_relobj): Rename def to is_default_version
9430         and local to is_forced_local.
9431         (Symbol_table::add_from_pluginobj): Likewise.
9432         (Symbol_table::add_from_dynobj): Likewise.
9433         (Symbol_table::define_special_symbol): Rename insdef to
9434         insdefault.
9435
9436 2010-01-04  Ian Lance Taylor  <iant@google.com>
9437
9438         PR 10980
9439         * options.h (class General_options): Add
9440         --allow-multiple-definition and -z muldefs.
9441         * resolve.cc (Symbol_table::should_override): Don't warn about a
9442         multiple symbol definition if --allow-multiple-definition or -z
9443         muldefs.
9444
9445         PR 10980
9446         * options.h (class General_options): Add --add-needed and
9447         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9448         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9449         error if --copy-dt-needed-entries aka --add-needed is used and
9450         would cause a change in behaviour.
9451
9452         PR 10980
9453         * options.h (class General_options): Add -G as a short version of
9454         --shared.  Add no-op options -assert, -g, and -i.
9455
9456 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9457
9458         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9459         check for .text or .gnu.linkonce.t sections.
9460         * icf.cc (Icf::find_identical_sections): Ditto.
9461         Change the detection for mangled function name within the section
9462         name.
9463         * icf.h (is_section_foldable_candidate): New function.
9464
9465 2009-12-30  Ian Lance Taylor  <iant@google.com>
9466
9467         PR 10980
9468         * options.h (class General_options): Permit two dashes with
9469         --retain-symbols-file.
9470
9471 2009-12-30  Ian Lance Taylor  <iant@google.com>
9472
9473         PR 10979
9474         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9475         don't put the file header and segment headers in the text
9476         segment.
9477
9478         PR 10979
9479         * common.cc (Sort_commons::operator()): Stabilize sort when both
9480         entries are NULL.
9481         (Symbol_table::do_allocate_commons_list): When allocating common
9482         symbols, skip a symbol which is no longer common.
9483         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9484         an object before checking its type.
9485         * testsuite/common_test_2.c: New file.
9486         * testsuite/common_test_3.c: New file.
9487         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9488         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9489         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9490         (common_test_2_pic.o, common_test_2.so): New targets.
9491         (common_test_3_pic.o, common_test_3.so): New targets.
9492         * testsuite/Makefile.in: Rebuild.
9493
9494         PR 10979
9495         * script.cc (read_input_script): If we see a new SECTIONS clause,
9496         and we have added an input section, give an error.
9497         * layout.h (class Layout): Add have_added_input_section function.
9498         Add have_added_input_section_ field.
9499         * layout.cc (Layout::Layout): Initialize
9500         have_added_input_section_.
9501         (Layout::layout): Set have_added_input_section_.
9502         (Layout::layout_eh_frame): Likewise.
9503
9504 2009-12-30  Ian Lance Taylor  <iant@google.com>
9505
9506         PR 10931
9507         * options.h (class General_options): Add --sort-common option.
9508         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9509         * common.cc (Sort_common): Add sort_order parameter to
9510         constructor.  Add sort_order_ field.
9511         (Sort_commons::operator): Check sort_order_.
9512         (Symbol_table::allocate_commons): Determine the sort order.
9513         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9514         Change all callers.
9515         (Symbol_table::do_allocate_commons_list): Likewise.
9516
9517 2009-12-30  Ian Lance Taylor  <iant@google.com>
9518
9519         PR 10916
9520         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9521         symbols from this object, don't change the visibility of an
9522         undefined symbol.
9523         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9524
9525 2009-12-30  Ian Lance Taylor  <iant@google.com>
9526
9527         PR 10861
9528         * script.h (class Version_script_info): Define Language enum.
9529         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9530         new fields globals_, locals_, and is_finalized_.
9531         * script.cc: Various formatting fixes.
9532         (class Parser_closure): Change language_stack_ from a vector of
9533         std::string to one of Version_script_info::Language.  Adjust all
9534         uses accordingly.
9535         (class Lazy_demangler): Remove.
9536         (struct Version_expression): Change language from std::string to
9537         Version_script_info::Language.
9538         (Version_script_info::Version_script_info): New function.
9539         (Version_script_info::~Version_script_info): Don't call clear.
9540         (Version_script_info::finalize): New function.
9541         (Version_script_info::build_lookup_tables): New function.
9542         (Version_script_info::build_expression_list_lookup): New
9543         function.
9544         (Version_script_info::get_symbol_version_helper): Rewrite to use
9545         lookup tables.
9546         (Version_script_info::print_expression_list): Adjust to use
9547         Version_script_info::Language.
9548         (script_push_lex_into_version_mode): Check that the version script
9549         has not been finalized.
9550         (version_script_push_lang): Change language string to
9551         Version_script_info::Language.
9552         * options.cc (Command_line::version_script): New function.
9553         * options.h (class General_options): Add finalize_dynamic_list
9554         function.  Change version_script from declaration to definition.
9555         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9556         * testsuite/version_script.map: Remove duplicate def of foo.
9557         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9558         version_script.map.
9559         * testsuite/Makefile.in: Rebuild.
9560
9561 2009-12-30  Ian Lance Taylor  <iant@google.com>
9562
9563         PR 10843
9564         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9565         if the input symbol index is 0, make the output symbol index 0.
9566
9567 2009-12-30  Ian Lance Taylor  <iant@google.com>
9568
9569         PR 10670
9570         * options.h (class General_options): Add -x/--discard-all.
9571         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9572         --discard-all.  If the local symbol needs a dynamic entry, check
9573         that before handling --discard-locals.
9574
9575 2009-12-30  Ian Lance Taylor  <iant@google.com>
9576
9577         PR 10450
9578         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9579         flags to PF_R.
9580         (Output_segment::add_output_section): Don't change the flags if
9581         the type is PT_TLS.
9582
9583         PR 10450
9584         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9585         GNU hash table if they need a dynamic value.  Otherwise, don't add
9586         them if they are defined in a dynamic object or are forced local.
9587
9588 2009-12-29  Ian Lance Taylor  <iant@google.com>
9589
9590         PR 10450
9591         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9592         .gnu.hash table for a 32-bit target.
9593
9594         PR 10450
9595         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9596         regular and a dynamic object only needs a dynamic symbol table
9597         entry if it is externally visible.
9598
9599         PR 10450
9600         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9601         constructor.  Add global_offset_table_ field.
9602         (Target_i386::got_section): Set global_offset_table_.
9603         (Target_i386::do_finalize_sections): Set global_offset_table_
9604         size.
9605         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9606         in constructor.  Add global_offset_table_ field.
9607         (Target_x86_64::got_section): Set global_offset_table_.
9608         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9609         size.
9610
9611         * layout.cc (Layout::Layout): Initialize increase_relro_.
9612         (Layout::get_output_section): Add is_relro, is_last_relro, and
9613         is_first_non_relro parameters.  Change all callers.
9614         (Layout::choose_output_section): Likewise.
9615         (Layout::add_output_section_data): Likewise.
9616         (Layout::make_output_section): Likewise.
9617         (Layout::set_segment_offsets): Clear increase_relro when using a
9618         linker script.
9619         * layout.h (class Layout): Add increase_relro method.  Add
9620         increase_relro_ field.  Update declarations.
9621         * output.cc (Output_section::Output_section): Initialize
9622         is_last_relro_ and is_first_non_relro_.
9623         (Output_segment::add_output_section): Group relro sections is
9624         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9625         (Output_segment::maximum_alignment): Remove relro handling.
9626         (Output_segment::set_section_addresses): Add increase_relro
9627         parameter.  Change all callers.  Add initial alignment to align
9628         relro sections on separate page.  Remove old relro handling.
9629         (Output_segment::set_section_list_addresses): Remove in_relro
9630         parameter.  Change all callers.
9631         (Output_segment::set_offset): Add increase parameter.  Change all
9632         callers.  Remove old relro handling.
9633         * output.h (class Output_section): Add new methods: is_last_relro,
9634         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9635         Add is_last_relro_ and is_first_non_relro_ fields.
9636         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9637         Create separate .got.plt section.  Call increase_relro.
9638         * x86_64.cc (Target_x86_64::got_section): Likewise.
9639         * testsuite/relro_script_test.t: Add .got.plt.
9640
9641         PR 10450
9642         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9643         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9644         (Layout::finalize): Call set_dynamic_symbol_size.
9645         (Layout::set_dynamic_symbol_size): New function.
9646         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9647         set_dynamic_symbol_size.
9648
9649         PR 10450
9650         * output.h (class Output_section): Add is_entsize_zero_ field.
9651         * output.cc (Output_section::Output_section): Initialize
9652         is_entsize_zero_.
9653         (Output_section::set_entsize): If two different entsizes are
9654         requested, force it to zero.
9655         (Output_section::add_input_section): Set flags for .debug_str
9656         before updating section flags.  Set entsize.
9657         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9658         and SHF_STRING if all input sections have those flags.
9659
9660 2009-12-29   Rafael Espindola  <espindola@google.com>
9661
9662         * main.cc (main): Fix the sys time reporting.
9663         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9664         reporting.
9665
9666 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9667
9668         * options.cc (General_options::parse_version): Allow -v to exit
9669         without an error if there is nothing to link.
9670
9671 2009-12-29  Ian Lance Taylor  <iant@google.com>
9672
9673         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9674         using a version of gcc before 4.1.
9675         * configure: Rebuild.
9676
9677 2009-12-28  Chris Demetriou  <cgd@google.com>
9678
9679         * attributes.cc (Output_attributes_section_data::do_write): Use
9680         std::vector::front rather than std::vector::data.
9681
9682 2009-12-28  Ian Lance Taylor  <iant@google.com>
9683
9684         * symtab.h (class Symbol_table): Add enum Defined.
9685         * resolve.cc (Symbol_table::should_override): Add defined
9686         parameter.  Change all callers.  Test whether object is NULL
9687         before calling a method on it.
9688         (Symbol_table::report_resolve_problem): Add defined parameter.
9689         Change all callers.
9690         (Symbol_table::should_override_with_special): Likewise.
9691         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9692         parameter.  Change all callers.
9693         (Symbol_table::do_define_in_output_data): Likewise.
9694         (Symbol_table::define_in_output_segment): Likewise.
9695         (Symbol_table::do_define_in_output_segment): Likewise.
9696         (Symbol_table::define_as_constant): Likewise.
9697         (Symbol_table::do_define_as_constant): Likewise.
9698         * script.h (class Symbol_assignment): Add is_defsym parameter to
9699         constructor; change all callers.
9700         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9701         parameter.  Change all callers.  Add is_defsym_ field.
9702         (class Parser_closure): Add parsing_defsym parameter to
9703         constructor; change all callers.  Add parsing_defsym accessor
9704         function.  Add parsing_defsym_ field.
9705
9706 2009-12-28  Ian Lance Taylor  <iant@google.com>
9707
9708         * gold.cc (queue_middle_tasks): Fix formatting.
9709         * object.cc (Relobj::is_section_name_included): Likewise.
9710
9711 2009-12-23  Ian Lance Taylor  <iant@google.com>
9712
9713         * i386.cc (Target_i386::do_calls_non_split): Recognize
9714         -fsplit-stack prologue for a function with a static chain.
9715         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9716         -fsplit-stack prologue when using %r11.
9717
9718 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9719
9720         * options.cc (General_options::parse_version): Make -v continue and do
9721         the link like GNU ld does.
9722
9723 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9724
9725         * Makefile.am (CCFILES): Add timer.cc.
9726         (HFILES): Add timer.h.
9727         * configure.ac: Check for sysconf and times.
9728         * main.cc: include timer.h.
9729         (main): Use Timer instead of get_run_time.
9730         * timer.cc: New.
9731         * timer.h: New.
9732         * workqueue.cc: include timer.h.
9733         (Workqueue::find_and_run_task):
9734         Report user, sys and wall time.
9735         * Makefile.in: Regenerate.
9736         * config.in: Regenerate.
9737         * configure: Regenerate.
9738
9739 2009-12-16  Doug Kwan  <dougkwan@google.com>
9740
9741         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9742         sections.
9743         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9744         relaxed input sections.
9745         * output.cc (Output_section::find_relaxed_input_section): Change
9746         return type to Output_relaxed_input_section pointer.  Adjust code
9747         for new type of relaxed_input_section_map_.
9748         * output.h (Output_section::find_relaxed_input_section): Change
9749         return type to Output_relaxed_input_section pointer.
9750         (Output_section::Output_relaxed_input_section_by_input_section_map):
9751         New type.
9752         (Output_section::relaxed_input_section_map_): Change type to
9753         Output_section::Output_relaxed_input_section_by_input_section_map.
9754         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9755         input section.
9756
9757 2009-12-15  Ian Lance Taylor  <iant@google.com>
9758
9759         * layout.cc (Layout::create_shstrtab): Only write out after input
9760         sections if we are compressing debug sections.
9761
9762 2009-12-15  Ian Lance Taylor  <iant@google.com>
9763
9764         * archive.cc (Archive::add_symbols): Only look up a symbol without
9765         a version if there is, in fact, a version.
9766
9767 2009-12-14  Ian Lance Taylor  <iant@google.com>
9768
9769         Revert -Wshadow changes, all changes from:
9770         2009-12-11  Doug Kwan  <dougkwan@google.com>
9771         2009-12-11  Nick Clifton  <nickc@redhat.com>
9772         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9773
9774 2009-12-11  Doug Kwan  <dougkwan@google.com>
9775
9776         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9777         due to -Wshadow.
9778         * attributes.cc (Object_attribute::size): Ditto.
9779         (Attributes_section_data::size): Ditto.
9780         (Attributes_section_data::Attributes_section_data): Ditto.
9781         (Output_attributes_section_data::do_write): Ditto.
9782         * attributes.h (Object_attribute::set_type): Ditto.
9783         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9784
9785 2009-12-11  Nick Clifton  <nickc@redhat.com>
9786
9787         * archive.cc: Fix shadowed variable warnings.
9788         * arm.cc: Likewise.
9789         * compressed_output.cc: Likewise.
9790         * compressed_output.h: Likewise.
9791         * configure: Likewise.
9792         * dwarf_reader.cc: Likewise.
9793         * dynobj.cc: Likewise.
9794         * dynobj.h: Likewise.
9795         * ehframe.cc: Likewise.
9796         * ehframe.h: Likewise.
9797         * errors.cc: Likewise.
9798         * expression.cc: Likewise.
9799         * fileread.cc: Likewise.
9800         * fileread.h: Likewise.
9801         * freebsd.h: Likewise.
9802         * i386.cc: Likewise.
9803         * icf.cc: Likewise.
9804         * incremental.h: Likewise.
9805         * layout.cc: Likewise.
9806         * layout.h: Likewise.
9807         * mapfile.cc: Likewise.
9808         * merge.cc: Likewise.
9809         * merge.h: Likewise.
9810         * object.cc: Likewise.
9811         * object.h: Likewise.
9812         * options.h: Likewise.
9813         * output.cc: Likewise.
9814         * output.h: Likewise.
9815         * parameters.cc: Likewise.
9816         * plugin.cc: Likewise.
9817         * powerpc.cc: Likewise.
9818         * reduced_debug_output.cc: Likewise.
9819         * reduced_debug_output.h: Likewise.
9820         * reloc.cc: Likewise.
9821         * reloc.h: Likewise.
9822         * resolve.cc: Likewise.
9823         * script-sections.cc: Likewise.
9824         * script.cc: Likewise.
9825         * script.h: Likewise.
9826         * sparc.cc: Likewise.
9827         * symtab.cc: Likewise.
9828         * symtab.h: Likewise.
9829         * target-select.cc: Likewise.
9830         * target-select.h: Likewise.
9831         * token.h: Likewise.
9832         * workqueue.cc: Likewise.
9833         * workqueue.h: Likewise.
9834         * x86_64.cc: Likewise.
9835
9836 2009-12-10  Doug Kwan  <dougkwan@google.com>
9837
9838         * arm.cc (attributes.h): New include.
9839         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9840         (Arm_relobj::~Arm_relobj): Delete object pointed by
9841         attributes_section_data_.
9842         (Arm_relobj::attributes_section_data): New method definition.
9843         (Arm_relobj::attributes_section_data_): New data member declaration.
9844         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9845         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9846         attributes_section_data_.
9847         (Arm_dynobj::attributes_section_data): New method definition.
9848         (Arm_dynobj::attributes_section_data_): New data member declaration.
9849         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9850         initialization value of may_use_blx_ to false.
9851         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9852         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9853         object attributes to compute results instead of hard-coding.
9854         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9855         Target_arm::get_secondary_compatible_arch,
9856         Target_arm::set_secondary_compatible_arch
9857         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9858         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9859         New method declarations.
9860         (Target_arm::get_aeabi_object_attribute): New method definition.
9861         (Target_arm::attributes_section_data_): New data member declaration.
9862         (read_arm_attributes_section): New template definition.
9863         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9864         (Arm_dynobj::do_read_symbols): Ditto.
9865         (Target_arm::do_finalize_sections): Merge attributes sections from
9866         input.  Check for BLX use after attributes section merging.
9867         Fix __exidx_start and __exidx_end visibility.  Create an
9868         .ARM.attributes section if necessary.
9869         (Target_arm::get_secondary_compatible_arch,
9870         Target_arm::set_secondary_compatible_arch,
9871         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9872         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9873         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9874         New method definitions.
9875
9876 2009-12-09  Ian Lance Taylor  <iant@google.com>
9877
9878         * plugin.cc (Plugin::load): Don't cast from void* to a function
9879         pointer.
9880
9881 2009-12-09  Ian Lance Taylor  <iant@google.com>
9882
9883         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9884         information fields.
9885
9886 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9887
9888         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9889         Replace two_file_shared_1.so with two_file_shared_2.so.
9890         * testsuite/Makefile.in: Regenerated.
9891
9892 2009-12-08  Doug Kwan  <dougkwan@google.com>
9893
9894         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9895         (HFILES): Add attributes.h and int_encoding.h.
9896         * Makefile.in: Regenerate.
9897         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9898         function definitions to int_encoding.cc
9899         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9900         prototypes to int_encoding.h
9901         * reduced_debug_output.cc (int_encoding.h): New include.
9902         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9903         function definitions to int_encoding.cc
9904         (insert_into_vector, read_from_pointer): Move template definitions to
9905         int_encoding.h
9906         * attributes.cc: New file.
9907         * attributes.h: New file.
9908         * int_encoding.cc: New file.
9909         * int_encoding.h: New file.
9910
9911 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9912
9913         PR gold/11055
9914         * incremental-dump.cc (dump_incremental_inputs): New.
9915         (main): Use dump_incremental_inputs.
9916
9917 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9918
9919         PR gold/10893
9920         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9921         checking elfcpp::STT_FUNC.
9922         (Target_i386::Relocate::relocate): Likewise.
9923         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9924
9925         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9926         symbols from shared libraries into normal FUNC symbols.
9927
9928         * symtab.h (Symbol): Add is_func and use it.
9929
9930 2009-12-05  Doug Kwan  <dougkwan@google.com>
9931
9932         * arm.cc (Target_arm::arm_info): Initialize new fields
9933         attributes_section and attributes_vendor.
9934         * i386.cc (Target_i386::i386_info): Same.
9935         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9936         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9937         fields attributes_section and attributes_vendor.
9938         * sparc.cc (Target_sparc::sparc_info): Same.
9939         * target.h (Target::attributes_section, Target::attributes_vendor,
9940         Target::is_attributes_section, Target::attribute_arg_type,
9941         Target::attributes_order): New method definitions.
9942         (Target::Target_info::attributes_section,
9943         Target::Target_info::attributes_vendor): New fields.
9944         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9945         virtual method definitions.
9946         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9947         attributes_section and attributes_vendor.
9948         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9949
9950 2009-12-05  Doug Kwan  <dougkwan@google.com>
9951
9952         * arm.cc: Update comments about interworking and stub generation.
9953         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9954         considered as non-PIC.
9955         (Arm_relocate_functions::base_abs): Fix formatting.
9956         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9957         of function to use GOT entry address instead of offset.
9958         (Target_arm::Scan::global): Issue an error if a symbol would need a
9959         PLT does not get one because it is untyped.  Remove code to create
9960         dynamic symbols for relative branches.
9961         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9962         takes unsigned integer instead of boolean.
9963
9964 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9965
9966         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9967         (two_file_test_LDADD): Likewise.
9968         (common_test_1_LDADD): Likewise.
9969         (exception_test_LDADD) Likewise.
9970         (weak_test_LDADD): Likewise.
9971         (many_sections_test_LDADD): Likewise.
9972         (initpri1_LDADD): Likewise.
9973         (script_test_1_LDADD): Likewise.
9974         (script_test_2_LDADD): Likewise.
9975         (justsyms_LDADD): Likewise.
9976         (binary_test_LDADD): Likewise.
9977         (large_LDADD): Likewise.
9978         * testsuite/Makefile.in: Regenerated.
9979
9980 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9981
9982         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9983         (Symbol_table::override_with_special): Likewise.
9984         (Symbol_table::add_from_object): Likewise.
9985
9986 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9987
9988         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9989         Don't set the data_offset twice.
9990
9991 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9992
9993         * testsuite/Makefile.in: Regenerate.
9994
9995 2009-12-03  Doug Kwan  <dougkwan@google.com>
9996
9997         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9998         (Target_arm::do_finalize_sections): Add parameter for symbol table
9999         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10000         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10001         parameter for symbol table pointer.
10002         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10003         an additional parameter for a pointer to symbol table.
10004         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10005         parameter for a symbol table pointer.
10006         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10007         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10008         Ditto.
10009         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10010         parameter for a symbol table pointer.
10011
10012 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10013
10014         * incremental.cc (Incremental_inputs_header)
10015         (Incremental_inputs_header_write, Incremental_inputs_entry)
10016         (Incremental_inputs_entry_write): Move ...
10017         * incremental.h (Incremental_inputs_header)
10018         (Incremental_inputs_header_write, Incremental_inputs_entry)
10019         (Incremental_inputs_entry_write): here.
10020
10021 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10022
10023         * incremental.cc (make_sized_incremental_binary): Set the target.
10024         Error if it is incompatible.
10025         * output.h (Output_file): Add filename method.
10026
10027 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10028
10029         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10030         from the get_* methods.
10031
10032 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10033
10034         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10035         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10036         Write 0 for the data_offset of scripts.
10037
10038 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10039
10040         * testsuite/Makefile.am: Add the incremental_test.sh test.
10041         * testsuite/incremental_test.sh: New.
10042         * testsuite/incremental_test_1.c: New.
10043         * testsuite/incremental_test_2.c: New.
10044
10045 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10046
10047         * incremental-dump.cc (main): Fix typos.
10048
10049 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10050
10051         PR gold/11025
10052         * incremental-dump.cc (main): Use llu to print 64 bit values.
10053
10054 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10055             H.J. Lu  <hongjiu.lu@intel.com>
10056
10057         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10058         $(LIBDL).
10059         (incremental_dump_LDADD): Likewise.
10060         * Makefile.in: Regenerated.
10061
10062 2009-11-25  Doug Kwan  <dougkwan@google.com>
10063
10064         Revert:
10065
10066         2009-11-25  Doug Kwan  <dougkwan@google.com>
10067
10068                 * arm.cc (Target_arm::Target_arm): Move method definition
10069                 outside of class definition.  Add code to handle
10070                 --target1-rel, --target1-abs and --target2= options.
10071                 (Target_arm::get_reloc_reloc_type): Change method to be
10072                 non-static and const.
10073                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10074                 New data member declaration.
10075                 (Target_arm::Scan::local, Target_arm::Scan::global,
10076                 Target_arm::Relocate::relocate,
10077                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10078                 Adjust call to Target_arm::get_real_reloc_type.
10079                 (Target_arm::get_real_reloc_type): Use command line options
10080                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10081                 * options.h (--target1-rel, --target1-abs, --target2): New
10082                 ARM-only options.
10083
10084 2009-11-25  Doug Kwan  <dougkwan@google.com>
10085
10086         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10087         class definition.  Add code to handle --target1-rel, --target1-abs
10088         and --target2= options.
10089         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10090         and const.
10091         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10092         member declaration.
10093         (Target_arm::Scan::local, Target_arm::Scan::global,
10094         Target_arm::Relocate::relocate,
10095         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10096         call to Target_arm::get_real_reloc_type.
10097         (Target_arm::get_real_reloc_type): Use command line options to
10098         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10099         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10100         options.
10101
10102 2009-11-25  Doug Kwan  <dougkwan@google.com>
10103
10104         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10105         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10106         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10107         formatting.
10108         (Arm_relocate_functions::thm_call): Replace body with a call to
10109         Arm_relocate_functions::thumb_branch_common.
10110         (Arm_relocate_functions::thm_jump24,
10111         Arm_relocate_functions::thm_xpc22): New method definitions.
10112         (Arm_relocate_functions::thumb_branch_common): New method definition.
10113         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10114         operator.
10115         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10116         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10117
10118 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10119
10120         * Makefile.am: Build incremental-dump
10121         * Makefile.in: Regenerate.
10122         * incremental-dump.cc: New.
10123         * incremental.cc (Incremental_inputs_header_data,
10124         Incremental_inputs_entry_data): Move to incremental.h
10125         * incremental.h: (Incremental_inputs_header_data,
10126         Incremental_inputs_entry_data): Move from incremental.cc
10127
10128 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10129
10130         * incremental.cc (Incremental_inputs_header,
10131         Incremental_inputs_header_write, Incremental_inputs_entry,
10132         Incremental_inputs_entry_write): Add a typedef with the data type.
10133
10134 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10135
10136         * incremental.cc (Incremental_inputs_header,
10137         Incremental_inputs_header_write, Incremental_inputs_entry,
10138         Incremental_inputs_entry_write): Update comment about which
10139         type has the filed descriptions.
10140
10141 2009-11-15  Doug Kwan  <dougkwan@google.com>
10142
10143         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10144         (Arm_relocate_functions::arm_branch_common): Change method defintion
10145         in class definition to a method declaration and update list of formal
10146         parameters.
10147         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10148         Arm_relocation_functions::jump24): Adjust call to
10149         Arm_relocate_functions::arm_branch_common.  Update list of formal
10150         parameters.
10151         (Arm_relocate_functions::xpc25): New method definition.
10152         (Arm_relocate_functions::arm_branch_common): Move method defintion
10153         out from class definition.  Use stubs for mode-switching and extending
10154         branch ranges.
10155         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10156         specially.  Change code to enable use of stubs in ARM branches.
10157
10158 2009-11-10  Doug Kwan  <dougkwan@google.com>
10159
10160         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10161         in method declaration.
10162         (Target_arm::relocate_stub): New method declaration.
10163         (Target_arm::default_target): Change to return a pointer instead of
10164         a const reference.
10165         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10166         Target_arm::default_target.
10167         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10168         method definition.
10169         (Target_arm::relocate_section): Adjust view.
10170         (Target_arm::relocate_stub): New method definition.
10171
10172 2009-11-10  Doug Kwan  <dougkwan@google.com>
10173
10174         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10175         a format warning.
10176         * incremental.cc (open_incremental_binary): Initialized local
10177         variables to avoid warnings.
10178         * object.cc (make_elf_object): Ditto.
10179         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10180         a format warning.
10181
10182 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10183
10184         PR gold/10930
10185         * testsuite/plugin_test.c: Include "config.h".
10186
10187 2009-11-09  Doug Kwan  <dougkwan@google.com>
10188
10189         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10190         (arm_symbol_value): Remove.
10191         (Arm_relocate_functions::arm_branch_common,
10192         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10193         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10194         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10195         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10196         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10197         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10198         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10199         Arm_relocate_functions::thm_mobw_abs_nc,
10200         Arm_relocate_functions::thm_mov_abs,
10201         Arm_relocate_functions::movw_prel_nc,
10202         Arm_relocate_functions::thm_movt_abs,
10203         Arm_relocate_functions::movt_prel,
10204         Arm_relocate_functions::thm_movw_prel_nc,
10205         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10206         (Target_arm::Relocate::relocate): Only decompose address into two
10207         parts if relocation type uses the thumb-bit and pass the actual
10208         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10209         calls to methods in Arm_relocate_functions for this change.
10210
10211 2009-11-08  Ian Lance Taylor  <iant@google.com>
10212
10213         PR 10925
10214         * reloc.cc: Instantiate
10215         Sized_relobj::initialize_input_to_output_maps and
10216         Sized_relobj:free_input_to_output_maps.
10217
10218 2009-11-06  Ian Lance Taylor  <iant@google.com>
10219
10220         PR 10876
10221         * defstd.cc (in_segment): Set only_if_ref true for "end".
10222
10223 2009-11-06  Doug Kwan  <dougkwan@google.com>
10224
10225         * arm.cc (class Reloc_stub): Correct a comment.
10226         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10227         (Target_arm::scan_section_for_stubs): New method declaration.
10228         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10229         Change methods from private to protected.
10230         (Target_arm::do_may_relax): New method definition.
10231         (Target_arm::do_relax, Target_arm::group_sections,
10232         Target_arm::scan_reloc_for_stub,
10233         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10234         (Target_arm::arm_input_section_map_): New data member declaration.
10235         (Target_arm::scan_reloc_for_stub,
10236         Target_arm::scan_reloc_section_for_stubs,
10237         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10238         Target_arm::do_relax): New method definitions.
10239
10240 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10241
10242         * configure.ac: Check for (struct stat)::st_mtim
10243         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10244         * config.in: Regenerate.
10245         * configure: Regenerate.
10246
10247 2009-11-05  Ian Lance Taylor  <iant@google.com>
10248
10249         PR 10910
10250         * output.cc (Output_segment::add_output_section): Add missing
10251         return statement.
10252
10253 2009-11-04  Ian Lance Taylor  <iant@google.com>
10254
10255         PR 10880
10256         * object.h (class Object): Add is_needed and set_is_needed
10257         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10258         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10259         defined in a dynamic object and referenced by a regular object,
10260         set is_needed for the dynamic object.
10261         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10262         if the file is marked with as_needed and it is not needed.
10263
10264 2009-11-04  Ian Lance Taylor  <iant@google.com>
10265
10266         PR 10887
10267         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10268         tags if data is discarded by linker script.
10269         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10270         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10271         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10272         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10273
10274 2009-11-04  Ian Lance Taylor  <iant@google.com>
10275
10276         * layout.cc (Layout::get_output_section): Add is_interp and
10277         is_dynamic_linker_section parameters.  Change all callers.
10278         (Layout::choose_output_section): Likewise.
10279         (Layout::make_output_section): Likewise.
10280         (Layout::add_output_section_data): Add is_dynamic_linker_section
10281         parameter.  Change all callers.
10282         * layout.h (class Layout): Update declarations.
10283         * output.h (class Output_section): Add is_interp, set_is_interp,
10284         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10285         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10286         generate_code_fills_at_write_ to a bitfield.
10287         * output.cc (Output_section::Output_sections): Initialize new
10288         fields.
10289         (Output_segment::add_output_section): Add do_sort parameter.
10290         Change all callers.
10291
10292 2009-11-03  Ian Lance Taylor  <iant@google.com>
10293
10294         PR 10860
10295         * options.h (class General_options): Add --warn-common.
10296         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10297         merging two common symbols.
10298         (Symbol_table::should_override): Handle --warn-common when merging
10299         a common symbol with a defined symbol.  Use report_resolve_problem
10300         for multiple definitions.
10301         (Symbol_table::report_resolve_problem): New function.
10302         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10303
10304 2009-11-03  Doug Kwan  <dougkwan@google.com>
10305
10306         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10307         stub_factory_.
10308         (Target_arm::stub_factory): New method definition.
10309         (Target_arm::new_arm_input_section,
10310         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10311         Target_arm::reloc_uses_thumb_bit): New method declarations.
10312         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10313         New type definitions.
10314         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10315         member declarations.
10316         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10317         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10318         New method definitions.
10319
10320 2009-11-03  Ian Lance Taylor  <iant@google.com>
10321
10322         * options.h (class General_options): Add --warn_constructors.
10323
10324 2009-11-03  Ian Lance Taylor  <iant@google.com>
10325
10326         PR 10893
10327         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10328         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10329
10330 2009-11-03  Ian Lance Taylor  <iant@google.com>
10331
10332         PR 10895
10333         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10334         --msgid-bugs-address.
10335         (install-pdf): New target.
10336         (install-data_yes): Look up one directory to find mkinstalldirs.
10337
10338 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10339
10340         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10341         tree.
10342
10343 2009-10-30  Doug Kwan  <dougkwan@google.com>
10344
10345         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10346
10347 2009-10-30  Doug Kwan  <dougkwan@google.com>
10348
10349         * arm.cc (Stub_addend_reader): New struct template definition
10350         and partial specializations.
10351         (Stub_addend_reader::operator()): New method definition for a
10352         partially specialized template.
10353
10354 2009-10-30  Doug Kwan  <dougkwan@google.com>
10355
10356         * arm.cc (Arm_relobj::processor_specific_flags): New method
10357         definition.
10358         (Arm_relobj::do_read_symbols): New method declaration.
10359         (Arm_relobj::processor_specific_flags_): New data member declaration.
10360         (Arm_dynobj): New class definition.
10361         (Target_arm::do_finalize_sections): Add input_objects parameter.
10362         (Target_arm::do_adjust_elf_header): New method declaration.
10363         (Target_arm::are_eabi_versions_compatible,
10364         (Target_arm::merge_processor_specific_flags): New method declaration.
10365         (Target_arm::do_make_elf_object): New overloaded method definitions
10366         and declaration.
10367         (Arm_relobj::do_read_symbols): New method definition.
10368         (Arm_dynobj::do_read_symbols): Ditto.
10369         (Target_arm::do_finalize_sections): Add input_objects parameters.
10370         Merge processor-specific flags from all input objects.
10371         (Target_arm::are_eabi_versions_compatible,
10372         Target_arm::merge_processor_specific_flags,
10373         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10374         New method definitions.
10375         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10376         Input_objects pointer type parameter.
10377         * layout.cc (Layout::finalize): Pass input objects to target's.
10378         finalize_sections function.
10379         * output.cc (Output_file_header::do_sized_write): Set ELF file
10380         header's processor-specific flags.
10381         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10382         Input_objects pointer type parameter.
10383         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10384         * target.h (Input_objects): New forward class declaration.
10385         (Target::processor_specific_flags,
10386         Target::are_processor_specific_flags_sect): New method definitions.
10387         (Target::finalize_sections): Add input_objects parameter.
10388         (Target::Target): Initialize processor_specific_flags_ and
10389         are_processor_specific_flags_set_.
10390         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10391         parameter.
10392         (Target::set_processor_specific_flags): New method definition.
10393         (Target::processor_specific_flags_,
10394         Target::are_processor_specific_flags_set_): New data member
10395         declarations.
10396         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10397         Input_objects pointer type parameter.
10398
10399 2009-10-30  Doug Kwan  <dougkwan@google.com>
10400
10401         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10402
10403 2009-10-28  Ian Lance Taylor  <iant@google.com>
10404
10405         * object.h (class Relobj): Drop options parameter from
10406         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10407         do_scan_relocs, do_relocate.  Change all callers.
10408         (class Sized_relobj): Drop options parameters from
10409         do_gc_process_relocs, do_scan_relocs, do_relocate,
10410         do_relocate_sections, relocate_sections, emit_relocs_scan,
10411         emit_relocs_scan_reltype.  Change all callers.
10412         (struct Relocate_info): Remove options field and all references to
10413         it.
10414         * reloc.h (class Read_relocs): Remove options constructor
10415         parameter and options_ field.  Change all callers.
10416         (class Gc_process_relocs, class Scan_relocs): Likewise.
10417         (class Relocate_task): Likewise.
10418         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10419         all callers.
10420         (scan_relocatable_relocs): Likewise.
10421         * target.h (class Sized_target): Remove options parameter from
10422         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10423         all callers.
10424         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10425         callers.
10426         * arm.cc: Update functions to remove options parameters.
10427         * i386.cc: Likewise.
10428         * powerpc.cc: Likewise.
10429         * sparc.cc: Likewise.
10430         * x86_64.cc: Likewise.
10431         * testsuite/testfile.cc: Likewise.
10432
10433 2009-10-28  Doug Kwan  <dougkwan@google.com>
10434
10435         * arm.cc (Arm_relobj): New class definition.
10436         (Arm_relobj::scan_sections_for_stubs,
10437         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10438         New method definitions.
10439
10440 2009-10-28  Cary Coutant  <ccoutant@google.com>
10441
10442         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10443         (Plugin::cleanup_done_): New member.
10444         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10445         (Plugin_manager::cleanup_done_): Remove.
10446         (Plugin_manager::add_input_file): Edit error message.
10447         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10448         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10449
10450 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10451
10452         * fileread.cc: (File_read::View::~View): Use the new
10453         data_ownership_ filed.
10454         (File_read::~File_read): Dispose the new whole_file_view_.
10455         (File_read::open): Mmap the whole file if needed.
10456         (File_read::open): Use whole_file_view_ instead of contents_.
10457         (File_read::find_view): Use whole_file_view_ if applicable.
10458         (File_read::do_read): Use whole_file_view_ instead of contents_.
10459         (File_read::make_view): Use whole_file_view_ instead of contents_,
10460         update File_read::View::View call.
10461         (File_read::find_or_make_view): Update File_read::View::View
10462         call.
10463         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10464         remove contents_
10465         (File_read::View::Data_ownership): New enum.
10466         (File_read::View::View): Replace bool mapped_ with Data_ownership
10467         argument.
10468         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10469         (File_read::View::data_ownership_): New field.
10470         (File_read::contents_): Remove (replaced by whole_file_view_).
10471         (File_read::whole_file_view_): New field.
10472         * options.h (class General_options): Add --keep-files-mapped.
10473
10474 2009-10-27  Cary Coutant  <ccoutant@google.com>
10475
10476         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10477         * testsuite/Makefile.am (plugin_test_5): New test case.
10478         * testsuite/Makefile.in: Regenerate.
10479
10480 2009-10-25  Doug Kwan  <dougkwan@google.com>
10481
10482         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10483         from private to protected to allow access by child class.
10484         (Sized_relobj::do_relocate_sections): New method declaration.
10485         (Sized_relobj::relocate_sections): Virtualize.
10486         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10487         Sized_relobj::relocate_sections.  Instantiate template explicitly
10488         for different target sizes and endianity.
10489
10490 2009-10-24  Doug Kwan  <dougkwan@google.com>
10491
10492         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10493         (Arm_input_section::as_arm_input_section): New method.
10494         (Arm_output_section): New class definition.
10495         (Arm_output_section::create_stub_group,
10496         Arm_output_section::group_sections): New method definitions.
10497
10498 2009-10-22  Doug Kwan  <dougkwan@google.com>
10499
10500         * arm.cc (Arm_input_section): New class definition.
10501         (Arm_input_section::init, Arm_input_section:do_write,
10502         Arm_input_section::set_final_data_size,
10503         Arm_input_section::do_reset_address_and_file_offset): New method
10504         definitions.
10505
10506 2009-10-21  Doug Kwan  <dougkwan@google.com>
10507
10508         * arm.cc (Stub_table, Arm_input_section): New forward class
10509         declarations.
10510         (Stub_table): New class defintion.
10511         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10512         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10513         New method definition.
10514
10515 2009-10-21  Doug Kwan  <dougkwan@google.com>
10516
10517         * arm.cc: Update copyright comments.
10518         (Target_arm): New forward class template declaration.
10519         (Arm_address): New type.
10520         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10521         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10522         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10523         constants.
10524         (Insn_template): Same.
10525         (DEF_STUBS): New macro.
10526         (Stub_type): New enum type.
10527         (Stub_template): New class definition.
10528         (Stub): Same.
10529         (Reloc_stub): Same.
10530         (Stub_factory): Same.
10531         (Target_arm::Target_arm): Initialize may_use_blx_ and
10532         should_force_pic_veneer_.
10533         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10534         Target_arm::should_force_pic_veneer,
10535         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10536         Target_arm::using_thumb_only, Target_arm:;default_target): New
10537         method defintions.
10538         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10539         New data member declarations.
10540         (Insn_template::size, Insn_template::alignment): New method defintions.
10541         (Stub_template::Stub_template): New method definition.
10542         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10543         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10544         (Stub_factory::Stub_factory): New method definition.
10545         * gold.h (string_hash): New template.
10546         * output.h (Input_section_specifier::hash_value): Use
10547         gold::string_hash.
10548         (Input_section_specifier::string_hash): Remove.
10549         * stringpool.cc (Stringpool_template::string_hash): Use
10550         gold::string_hash.
10551
10552 2009-10-20  Doug Kwan  <dougkwan@google.com>
10553
10554         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10555         symbols of relaxed input sections.
10556         * output.h (Output_section::find_relaxed_input_section): Make
10557         method public.
10558
10559 2009-10-16  Doug Kwan  <dougkwan@google.com>
10560
10561         * dynobj.cc (Versions::Versions): Initialize version_script_.
10562         Only insert base version symbol definition for a shared object
10563         if version script defines any version versions.
10564         (Versions::define_base_version): New method definition.
10565         (Versions::add_def): Check that base version is not needed.
10566         (Versions::add_need): Define base version lazily.
10567         * dynobj.h (Versions::define_base_version): New method declaration.
10568         (Versions::needs_base_version_): New data member declaration.
10569         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10570         (check_DATA): Add no_version_test.stdout.
10571         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10572         New make rules.
10573         * testsuite/Makefile.in: Regenerate.
10574         * testsuite/no_version_test.c: New file.
10575         * testsuite/no_version_test.sh: Ditto.
10576
10577 2009-10-16  Doug Kwan  <dougkwan@google.com>
10578
10579         * expression.cc (class Segment_start_expression): New class definition.
10580         (Segment_start_expression::value): New method definition.
10581         (script_exp_function_segment_start): Return a new
10582         Segment_start_expression.
10583         * gold/script-c.h (script_saw_segment_start_expression): New function
10584         prototype.
10585         * script-sections.cc (Script_sections::Script_sections): Initialize
10586         SAW_SEGMENT_START_EXPRESSION_ to false.
10587         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10588         and -Tbbs options to specify section addresses if given in
10589         command line and no SEGMENT_START expression is seen in a script.
10590         * script-sections.h (Script_sections::saw_segment_start_expression,
10591         Script_sections::set_saw_segment_start_expression): New method
10592         definition.
10593         (Script_sections::saw_segment_start_expression_): New data member
10594         declaration.
10595         * script.cc (script_saw_segment_start_expression): New function.
10596         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10597         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10598         script_test_7.sh and script_test_8.sh.
10599         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10600         script_test_8.stdout.
10601         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10602         (script_test_6, script_test_6.stdout, script_test_7,
10603         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10604         * Makefile.in: Regenerate.
10605         * testsuite/script_test_6.sh: New file.
10606         * testsuite/script_test_6.t: Same.
10607         * testsuite/script_test_7.sh: Same.
10608         * testsuite/script_test_7.t: Same.
10609         * testsuite/script_test_8.sh: Same.
10610
10611 2009-10-16  Doug Kwan  <dougkwan@google.com>
10612
10613         * output.cc (Output_segment::set_section_list_address): Cast
10614         expressions to unsigned long long type to avoid format warnings.
10615
10616 2009-10-15  Ian Lance Taylor  <iant@google.com>
10617
10618         * script.cc (Script_options::add_symbol_assignment): Always add a
10619         dot assignment to script_sections_.
10620         * script-sections.cc (Script_sections::add_dot_assignment):
10621         Initialize if necessary.
10622
10623         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10624         program headers with no load segment if there is a linker script.
10625
10626         * layout.cc (Layout::set_segment_offsets): Align the file offset
10627         to the segment aligment for -N or -n with no load segment.
10628         * output.cc (Output_segment::add_output_section): Don't crash if
10629         the first section is a TLS section.
10630         (Output_segment::set_section_list_addresses): Print an error
10631         message if the address moves backward in a linker script.
10632         * script-sections.cc
10633         (Output_section_element_input::set_section_addresses): Don't
10634         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10635         (Orphan_output_section::set_section_addresses): Likewise.
10636
10637 2009-10-15  Doug Kwan  <dougkwan@google.com>
10638
10639         * layout.cc (Layout::finish_dynamic_section): Generate tags
10640         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10641         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10642         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10643
10644 2009-10-14  Ian Lance Taylor  <iant@google.com>
10645
10646         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10647         fields.
10648         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10649         data_shdr fields of relinfo.
10650         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10651         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10652         R_386_TLS_LDO_32, adjust based on section flags.
10653         (Target_i386::Relocate::fix_up_ldo): Remove.
10654
10655 2009-10-13  Ian Lance Taylor  <iant@google.com>
10656
10657         Add support for -pie.
10658         * options.h (class General_options): Add -pie and
10659         --pic-executable.
10660         (General_options::output_is_position_independent): Test -pie.
10661         (General_options::output_is_executable): Return true if not shared
10662         and not relocatable.
10663         (General_options::output_is_pie): Remove.
10664         * options.cc (General_options::finalize): Reject incompatible uses
10665         of -pie.
10666         * gold.cc (queue_middle_tasks): A -pie link is not static.
10667         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10668         * symtab.cc (Symbol::final_value_is_known): Return false if
10669         output_is_position_independent.
10670         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10671         output_is_position_independent.
10672         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10673         output_is_position_independent.
10674         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10675         output_is_position_independent.
10676         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10677         two_file_pie_test.
10678         (basic_pie_test.o, basic_pie_test): New targets.
10679         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10680         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10681         (two_file_pie_test): New target.
10682         * testsuite/Makefile.in: Rebuild.
10683         * README: Remove note saying that -pie is not supported.
10684
10685 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10686
10687         * options.h (class General_options): Add -init and -fini.
10688         * layout.cc (Layout::finish_dynamic_section): Emit
10689         given init and fini functions.
10690
10691 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10692
10693         * gc.h (gc_process_relocs): Check if icf is enabled using new
10694         function.
10695         * gold.cc (queue_initial_tasks): Likewise.
10696         (queue_middle_tasks): Likewise.
10697         * object.cc (do_layout): Likewise.
10698         * symtab.cc (is_section_folded): Likewise.
10699         * main.cc (main): Likewise.
10700         * reloc.cc (Read_relocs::run): Likewise.
10701         (Sized_relobj::do_scan_relocs): Likewise.
10702         * icf.cc (is_function_ctor_or_dtor): New function.
10703         (Icf::find_identical_sections): Check if function is ctor or dtor when
10704         safe icf is chosen.
10705         * options.h (General_options::icf): Change option to be an enum.
10706         (Icf_status): New enum.
10707         (icf_enabled): New method.
10708         (icf_safe_folding): New method.
10709         (set_icf_status): New method.
10710         (icf_status_): New variable.
10711         * (options.cc) (General_options::finalize): Set icf_status_.
10712         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10713         icf_test and icf_keep_unique_test to use the --icf enum flag.
10714         * testsuite/icf_safe_test.sh: New file.
10715         * testsuite/icf_safe_test.cc: New file.
10716
10717 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10718
10719         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10720         includes to gc.h and icf.h.
10721         * arm.cc: Include gc.h.
10722         * gold.cc: Likewise.
10723         * i386.cc: Likewise.
10724         * powerpc.cc: Likewise.
10725         * sparc.cc: Likewise.
10726         * x86_64.cc: Likewise.
10727         * gc.h: Include icf.h.
10728
10729 2009-10-11  Ian Lance Taylor  <iant@google.com>
10730
10731         * plugin.cc: Include "gold.h" before other header files.
10732
10733 2009-10-10  Chris Demetriou  <cgd@google.com>
10734
10735         * options.h (Input_file_argument::Input_file_type): New enum.
10736         (Input_file_argument::is_lib_): Replace with...
10737         (Input_file_argument::type_): New member.
10738         (Input_file_argument::Input_file_argument): Take Input_file_type
10739         'type' rather than boolean 'is_lib' as second argument.
10740         (Input_file_argument::is_lib): Use type_.
10741         (Input_file_argument::is_searched_file): New function.
10742         (Input_file_argument::may_need_search): Handle is_searched_file.
10743         * options.cc (General_options::parse_library): Support -l:filename.
10744         (General_options::parse_just_symbols): Update for Input_file_argument
10745         changes.
10746         (Command_line::process): Likewise.
10747         * archive.cc (Archive::get_file_and_offset): Likewise.
10748         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10749         * script.cc (read_script_file, script_add_file): Likewise.
10750         * fileread.cc (Input_file::Input_file): Likewise.
10751         (Input_file::will_search_for): Handle is_searched_file.
10752         (Input_file::open): Likewise.
10753         * readsyms.cc (Read_symbols::get_name): Likewise.
10754         * testsuite/Makefile.am (searched_file_test): New test.
10755         * testsuite/Makefile.in: Regenerate.
10756         * testsuite/searched_file_test.cc: New file.
10757         * testsuite/searched_file_test_lib.cc: New file.
10758
10759 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10760             Ian Lance Taylor  <iant@google.com>
10761
10762         * descriptor.cc: Include <cstdio> and "binary-io.h".
10763         (Descriptors::open): Open the files in binary mode always.
10764         * script.cc (Lex::get_token): Treat \r as whitespace.
10765
10766 2009-10-09  Ian Lance Taylor  <iant@google.com>
10767
10768         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10769
10770 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10771             Ian Lance Taylor  <iant@google.com>
10772
10773         * configure.ac: Check for readv function also.
10774         * fileread.cc (readv): Define if not HAVE_READV.
10775         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10776         does not exist.
10777         * config.in: Regenerate.
10778         * configure: Regenerate.
10779
10780 2009-10-09  Doug Kwan  <dougkwan@google.com>
10781
10782         * layout.cc (Layout::make_output_section): Call target hook to make
10783         ordinary output section.
10784         (Layout::finalize): Adjust parameter list of call the
10785         Target::may_relax().
10786         * layout.h (class Layout::section_list): New method.
10787         * merge.h (Output_merge_base::entsize): Change visibility to public.
10788         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10789         New methods.
10790         (Output_merge_string::do_is_string): New method.
10791         * object.cc (Sized_relobj::do_setup): renamed from
10792         Sized_relobj::set_up.
10793         * object.h (Sized_relobj::adjust_shndx,
10794         Sized_relobj::initializ_input_to_output_maps,
10795         Sized_relobj::free_input_to_output_maps): Change visibilities to
10796         protected.
10797         (Sized_relobj::setup): Virtualize.
10798         (Sized_relobj::do_setup): New method declaration.
10799         (Sized_relobj::invalidate_section_offset,
10800         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10801         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10802         * options.cc (parse_int): New function.
10803         * options.h (parse_int): New declaration.
10804         (DEFINE_int): New macro.
10805         (stub_group_size): New option.
10806         * output.cc (Output_section::Output_section): Initialize memebers
10807         merge_section_map_, merge_section_by_properties_map_,
10808         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10809         (Output_section::add_input_section): Handled deferred code-fill
10810         generation and remove an old comment.
10811         (Output_section::add_relaxed_input_section): New method definition.
10812         (Output_section::add_merge_input_section): Use merge section by
10813         properties map to speed to search.  Update merge section maps
10814         as appropriate.
10815         (Output_section::build_relaxation_map): New method definition.
10816         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10817         Same.
10818         (Output_section::relax_input_section): Renamed to
10819         Output_section::convert_input_sections_to_relaxed_sections and change
10820         interface to take a vector of pointers to relaxed sections.
10821         (Output_section::find_merge_section,
10822         Output_section::find_relaxed_input_section): New method definitions.
10823         (Output_section::is_input_address_mapped,
10824         Output_section::output_offset, Output_section::output_address):
10825         Use output section data maps to speed up searching.
10826         (Output_section::find_starting_output_address): Add comments.
10827         (Output_section::do_write,
10828         Output_section::write_to_postprocessing_buffer): Do code-fill
10829         generation as appropriate.
10830         (Output_section::get_input_sections): Invalidate relaxed input section
10831         map.
10832         (Output_section::restore_states): Adjust type of checkpoint .
10833         Invalidate relaxed input section map.
10834         * output.h (Output_merge_base): New class declaration.
10835         (Input_section_specifier): New class defintion.
10836         (class Output_relaxed_input_section) Change base class to
10837         Output_section_data_build.
10838         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10839         base class initializer.
10840         (Output_section::add_relaxed_input_section): New method declaration.
10841         (Output_section::Input_section): Change visibility to protected.
10842         (Output_section::Input_section::relobj,
10843         Output_section::Input_section::shndx): Handle relaxed input sections.
10844         Output_section::input_sections) Change visibility to protected.  Also
10845         define overload to return a non-const pointer.
10846         (Output_section::Merge_section_properties): New class defintion.
10847         (Output_section::Merge_section_by_properties_map,
10848         Output_section::Output_section_data_by_input_section_map,
10849         Output_section::Relaxation_map): New types.
10850         (Output_section::relax_input_section): Rename method to
10851         Output_section::convert_input_sections_to_relaxed_sections and change
10852         interface to take a vector of relaxed section pointers.
10853         (Output_section::find_merge_section,
10854         Output_section::find_relaxed_input_section,
10855         Output_section::build_relaxation_map,
10856         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10857         New method declarations.
10858         (Output_section::merge_section_map_
10859         Output_section::merge_section_by_properties_map_,
10860         Output_section::relaxed_input_section_map_,
10861         Output_section::is_relaxed_input_section_map_valid_,
10862         Output_section::generate_code_fills_at_write_): New data members.
10863         * script-sections.cc
10864         (Output_section_element_input::set_section_addresses): Call
10865         current_data_size and addralign methods of relaxed input sections.
10866         (Orphan_output_section::set_section_addresses): Call current_data_size
10867         and addralign methods of relaxed input sections.
10868         * symtab.cc (Symbol_table::compute_final_value): Extract template
10869         from the body of Symbol_table::sized_finalize_symbol.
10870         (Symbol_table::sized_finalized_symbol): Call
10871         Symbol_table::compute_final_value.
10872         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10873         (Symbol_table::compute_final_value): New templated method declaration.
10874         * target.cc (Target::do_make_output_section): New method defintion.
10875         * target.h (Target::make_output_section): New method declaration.
10876         (Target::relax): Add more parameters for input objects, symbol table
10877         and layout.  Adjust call to do_relax.
10878         (Target::do_make_output_section): New method declaration.
10879         (Target::do_relax): Add parameters for input objects, symbol table
10880         and layout.
10881
10882 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10883
10884         * pread.c: Include stdio.h.
10885
10886 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10887
10888         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10889         defined.
10890
10891 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10892
10893         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10894         Change read_shndx type to unsigned int.
10895         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10896         int.
10897         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10898         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10899         Change read_shndx type to unsigned int.
10900         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10901         int.
10902         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10903         * layout.cc (Layout::create_symtab_sections): Cast the result of
10904         local_symcount * symsize to off_t in the gold_assert.
10905
10906 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10907
10908         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10909         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10910         R_ARM_BASE_ABS.
10911         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10912         (Arm_relocate_functions::thm_abs5): New function.
10913         (Arm_relocate_functions::abs12): New function.
10914         (Arm_relocate_functions::abs16): New function.
10915         (Arm_relocate_functions::base_abs): New function.
10916         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10917         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10918         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10919         R_ARM_BASE_ABS.
10920         (Scan::global): Likewise.
10921         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10922         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10923         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10924         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10925         R_ARM_BASE_ABS.
10926
10927 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10928
10929         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10930         (Arm_relocate_functions::movt_prel): New function.
10931         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10932         (Arm_relocate_functions::thm_movt_prel): New function.
10933         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10934         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10935         (Scan::global, Relocate::relocate): Likewise.
10936         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10937
10938 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10939
10940         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10941         Incremental_checker.
10942         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10943         unsigned int.
10944         (class Incremental_inputs_header): New class.
10945         (Incremental_inputs_header_writer): Edit comment.
10946         (Incremental_inputs_entry): New class.
10947         (Incremental_inputs_entry_writer): Edit comment.
10948         (Sized_incremental_binary::do_find_incremental_inputs_section):
10949         Add *strtab_shndx parameter, fill it.
10950         (Sized_incremental_binary::do_check_inputs): New method.
10951         (Incremental_checker::can_incrementally_link_output_file): Use
10952         Sized_incremental_binary::check_inputs.
10953         (Incremental_inputs::report_command_line): Save command line in
10954         command_line_.
10955         * incremental.h:
10956         (Incremental_binary::find_incremental_inputs_section): New
10957         method.
10958         (Incremental_binary::do_find_incremental_inputs_section): Add
10959         strtab_shndx parameter.
10960         (Incremental_binary::do_check_inputs): New pure virtual method.
10961         (Sized_incremental_binary::do_check_inputs): Declare.
10962         (Incremental_checker::Incremental_checker): Add incremental_inputs
10963         parameter, use it to initialize incremental_inputs_.
10964         (Incremental_checker::incremental_inputs_): New field.
10965         (Incremental_checker::command_line): New method.
10966         (Incremental_checker::inputs): New method.
10967         (Incremental_checker::command_line_): New field.
10968
10969 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10970
10971         * incremental.cc: Include <cstdarg> and "target-select.h".
10972         (vexplain_no_incremental): New function.
10973         (explain_no_incremental): New function.
10974         (Incremental_binary::error): New method.
10975         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10976         method.
10977         (make_sized_incremental_binary): New function.
10978         (open_incremental_binary): New function.
10979         (can_incrementally_link_file): Add checks if output is ELF and has
10980         inputs section.
10981         * incremental.h: Include "elfcpp_file.h" and "output.h".
10982         (Incremental_binary): New class.
10983         (Sized_incremental_binary): New class.
10984         (open_incremental_binary): Declare.
10985         * object.cc (is_elf_object): Use
10986         elfcpp::Elf_recognizer::is_elf_file.
10987         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10988         * output.h (Output_file::filesize): New method.
10989
10990 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10991
10992         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10993         New function.
10994         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10995         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10996         function.
10997         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10998         function.
10999         (Arm_relocate_functions::movw_abs_nc): New function.
11000         (Arm_relocate_functions::movt_abs): New function.
11001         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11002         (Arm_relocate_functions::thm_movt_abs): New function.
11003         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11004         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11005         (Scan::global): Likewise.
11006         (Relocate::relocate): Likewise.
11007         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11008
11009 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11010
11011         * arm.cc (Arm_relocate_functions::got_prel) New function.
11012         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11013         (Relocate::relocate): Likewise.
11014         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11015
11016 2009-10-06  Ian Lance Taylor  <iant@google.com>
11017
11018         * options.h (class General_options): Define
11019         split_stack_adjust_size parameter.
11020         * object.h (class Object): Add uses_split_stack_ and
11021         has_no_split_stack_ fields.  Add uses_split_stack and
11022         has_no_split_stack accessor functions.  Declare
11023         handle_split_stack_section.
11024         (class Reloc_symbol_changes): Define.
11025         (class Sized_relobj): Define Function_offsets.  Declare
11026         split_stack_adjust, split_stack_adjust_reltype, and
11027         find_functions.
11028         * object.cc (Object::handle_split_stack_section): New function.
11029         (Sized_relobj::do_layout): Call handle_split_stack_section.
11030         * dynobj.cc (Sized_dynobj::do_layout): Call
11031         handle_split_stack_section.
11032         * reloc.cc (Sized_relobj::relocate_sections): Call
11033         split_stack_adjust for executable sections in split_stack
11034         objects.  Pass reloc_map to relocate_section.
11035         (Sized_relobj::split_stack_adjust): New function.
11036         (Sized_relobj::split_stack_adjust_reltype): New function.
11037         (Sized_relobj::find_functions): New function.
11038         * target-reloc.h: Include "object.h".
11039         (relocate_section): Add reloc_symbol_changes parameter.  Change
11040         all callers.
11041         * target.h (class Target): Add calls_non_split method.  Declare
11042         do_calls_non_split virtual method.  Declare match_view and
11043         set_view_to_nop.
11044         * target.cc: Include "elfcpp.h".
11045         (Target::do_calls_non_split): New function.
11046         (Target::match_view): New function.
11047         (Target::set_view_to_nop): New function.
11048         * gold.cc (queue_middle_tasks): Give an error if mixing
11049         split-stack and non-split-stack objects with -r.
11050         * i386.cc (Target_i386::relocate_section): Add
11051         reloc_symbol_changes parameter.
11052         (Target_i386::do_calls_non_split): New function.
11053         * x86_64.cc (Target_x86_64::relocate_section): Add
11054         reloc_symbol_changes parameter.
11055         (Target_x86_64::do_calls_non_split): New function.
11056         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11057         parameter.
11058         * powerpc.cc (Target_powerpc::relocate_section): Add
11059         reloc_symbol_changes parameter.
11060         * sparc.cc (Target_sparc::relocate_section): Add
11061         reloc_symbol_changes parameter.
11062         * configure.ac: Call AM_CONDITIONAL for the default target.
11063         * configure: Rebuild.
11064         * testsuite/Makefile.am (TEST_AS): New variable.
11065         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11066         (check_DATA): Add split_i386 and split_x86_64 files.
11067         (SPLIT_DEFSYMS): Define.
11068         (split_i386_[1234n].o): New targets.
11069         (split_i386_[124]): New targets.
11070         (split_i386_[1234r].stdout): New targets.
11071         (split_x86_64_[1234n].o): New targets.
11072         (split_x86_64_[124]): New targets.
11073         (split_x86_64_[1234r].stdout): New targets.
11074         (MOSTLYCLEANFILES): Add new executables.
11075         * testsuite/split_i386.sh: New file.
11076         * testsuite/split_x86_64.sh: New file.
11077         * testsuite/split_i386_1.s: New file.
11078         * testsuite/split_i386_2.s: New file.
11079         * testsuite/split_i386_3.s: New file.
11080         * testsuite/split_i386_4.s: New file.
11081         * testsuite/split_i386_n.s: New file.
11082         * testsuite/split_x86_64_1.s: New file.
11083         * testsuite/split_x86_64_2.s: New file.
11084         * testsuite/split_x86_64_3.s: New file.
11085         * testsuite/split_x86_64_4.s: New file.
11086         * testsuite/split_x86_64_n.s: New file.
11087         * testsuite/testfile.cc (Target_test): Update relocation_section
11088         function.
11089         * testsuite/Makefile.in: Rebuild.
11090
11091 2009-10-06  Ian Lance Taylor  <iant@google.com>
11092
11093         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11094         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11095         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11096         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11097         the address on ldo_addrs_.
11098         (Target_i386::Relocate::fix_up_ldo): New function.
11099
11100 2009-10-06   Rafael Espindola  <espindola@google.com>
11101
11102         * plugin.cc (add_input_library): New.
11103         (Plugin::load): Add add_input_library to tv.
11104         (Plugin_manager::add_input_file): Add the is_lib argument.
11105         (add_input_file): Update call to Plugin_manager::add_input_file.
11106         (add_input_library): New.
11107         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11108
11109 2009-09-30  Doug Kwan  <dougkwan@google.com>
11110
11111         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11112         symbol and call Symbol::may_need_copy_reloc to determine if
11113         a copy reloc is needed.
11114         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11115         nocopyreloc is given in command line.
11116         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11117         given in command line.
11118         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11119         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11120         of the removed Target_i386::may_need_copy_reloc.
11121         * options.h (copyreloc): New option with default value false.
11122         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11123         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11124         instead of the removed Target_powerpc::may_need_copy_reloc.
11125         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11126         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11127         instead of the removed Target_sparc::may_need_copy_reloc.
11128         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11129         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11130         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11131         instead of the removed Target_x86_64::may_need_copy_reloc.
11132
11133 2009-09-30  Ian Lance Taylor  <iant@google.com>
11134
11135         * object.h (class Object): Remove target_ field, and target,
11136         sized_target, and set_target methods.
11137         (Object::sized_target): Remove.
11138         (class Sized_relobj): Update declarations.  Remove sized_target.
11139         * object.cc (Sized_relobj::setup): Remove target parameter.
11140         Change all callers.
11141         (Input_objects::add_object): Don't do anything with the target.
11142         (make_elf_sized_object): Add punconfigured parameter.  Change all
11143         callers.  Set or test parameter target.
11144         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11145         Change all callers.
11146         * parameters.cc (Parameters::set_target): Change parameter type to
11147         be non-const.
11148         (Parameters::default_target): Remove.
11149         (set_parameters_target): Change parameter type to be non-const.
11150         (parameters_force_valid_target): New function.
11151         (parameters_clear_target): New function.
11152         * parameters.h (class Parameters): Update declarations.  Remove
11153         default_target method.  Add sized_target and clear_target
11154         methods.  Change target_ to be non-const.
11155         (set_parameters_target): Update declaration.
11156         (parameters_force_valid_target): Declare.
11157         (parameters_clear_target): Declare.
11158         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11159         as NULL if we aren't searching.
11160         (Add_symbols::run): Don't check for compatible target.
11161         * fileread.cc (Input_file::open_binary): Call
11162         parameters_force_valid_target.
11163         * gold.cc (queue_middle_tasks): Likewise.
11164         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11165         set_target on object.
11166         * dynobj.h (class Sized_dynobj): Update declarations.
11167         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11168         make_elf_object returns NULL.
11169         (Archive::include_member): Don't check whether object target is
11170         compatible.
11171         * output.cc (Output_section::add_input_section): Get target from
11172         parameters.
11173         (Output_section::relax_input_section): Likewise.
11174         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11175         parameters.
11176         (Sized_relobj::do_scan_relocs): Likewise.
11177         (Sized_relobj::relocate_sections): Likewise.
11178         * resolve.cc (Symbol_table::resolve): Likewise.
11179         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11180         parameter.  Change all callers.
11181         (Symbol_table::add_from_object): Get target from parameters.
11182         (Symbol_table::add_from_relobj): Don't check object target.
11183         (Symbol_table::add_from_dynobj): Likewise.
11184         (Symbol_table::define_special_symbol): Get target from
11185         parameters.
11186         * symtab.h (class Symbol_table): Update declaration.
11187         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11188         parameter.  Change all callers.  Clear parameter target.
11189         (Binary_test): Test target here.
11190         * testsuite/object_unittest.cc (gold_testsuite): Remove
11191         target_test_pointer parameter.  Change all callers.
11192         (Object_test): Test target here.
11193
11194 2009-09-26  Ian Lance Taylor  <iant@google.com>
11195
11196         * testsuite/initpri1.c: Don't try to use constructor priorities if
11197         compiling with gcc before 4.3.
11198
11199 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11200
11201         * testsuite/retain_symbols_file_test.sh (check_present): Change
11202         output file name to retain_symbols_file_test.stdout.
11203         (check_absent): Likewise.
11204
11205 2009-09-18  Craig Silverstein  <csilvers@google.com>
11206
11207         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11208         * options.cc: Include <cerrno> and <fstream>.
11209         (General_options::finalize): Parse -retain-symbols-file tag.
11210         * options.h: New flag.
11211         (General_options): New method should_retain_symbol, new
11212         variable symbols_to_retain.
11213         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11214         should_retain_symbol map.
11215         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11216         * testsuite/Makefile.in: Regenerate.
11217         * testsuite/retain_symbols_file_test.sh: New file.
11218
11219 2009-09-18  Nick Clifton  <nickc@redhat.com>
11220
11221         * po/es.po: Updated Spanish translation.
11222
11223 2009-09-17  Doug Kwan  <dougkwan@google.com>
11224
11225         * debug.h (DEBUG_RELAXATION): New constant.
11226         (DEBUG_ALL): Add DEBUG_RELAXATION.
11227         (debug_string_to_enum): Add relaxation debug option.
11228         * layout.cc
11229         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11230         Layout::Relaxation_debug_check::read_sections,
11231         Layout::Relaxation_debug_check::read_sections): New method definitions.
11232         (Layout::Layout): Initialize data members
11233         record_output_section_data_from_scrips_,
11234         script_output_section_data_list_ and relaxation_debug_check_.
11235         (Layout::save_segments, Layout::restore_segments,
11236         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11237         Layout::relaxation_loop_body): New method definitions.
11238         (Layout::finalize): Support relaxation.  Move section layout code to
11239         Layout::relaxation_loop_body.
11240         (Layout::set_asection_address_from_script): Move code for orphan
11241         section placement out.
11242         (Layout::place_orphan_sections_in_script): New method definition.
11243         * layout.h (Output_segment_headers, Output_file_header):
11244         New forward class declarations.
11245         (Layout::~Layout): Define.
11246         (Layout::new_output_section_data_from_script): New method definition.
11247         (Layout::place_orphan_sections_in_script): New method declaration.
11248         (Layout::Segment_states): New type declaration.
11249         (Layout::save_segments, Layout::restore_segments,
11250         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11251         Layout::relaxation_loop_body): New method declarations.
11252         (Layout::Output_section_data_list): New type declaration.
11253         (Layout::Relaxation_debug_check): New class definition.
11254         (Layout::record_output_section_data_from_script_,
11255         Layout::script_output_section_data_list_, Layout::segment_states_,
11256         Layout::relaxation_debug_check_): New data members.
11257         * output.cc: (Output_section_headers::do_size): New method definition.
11258         (Output_section_headers::Output_section_headers): Move size
11259         computation to Output_section_headers::do_size.
11260         (Output_segment_headers::do_size): New method definition.
11261         (Output_file_header::Output_file_header): Move size computation to
11262         Output_file_header::do_size and call it.
11263         (Output_file_header::do_size): New method definition.
11264         (Output_data_group::Output_data_group): Adjust call to
11265         Output_section_data.
11266         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11267         (Output_symtab_xindex::do_write): Add array bound check.
11268         (Output_section::Input_section::print_to_mapfile): Handle
11269         RELAXED_INPUT_SECTION_CODE.
11270         (Output_section::Output_section): Initialize data member checkpoint_.
11271         (Output_section::~Output_section): Delete checkpoint object pointed
11272         by checkpoint_.
11273         (Output_section::add_input_section): Always add an Input_section if
11274         relaxing.
11275         (Output_section::add_merge_input_section): Add assert.
11276         (Output_section::relax_input_section): New method definition.
11277         (Output_section::set_final_data_size): Set load address to zero for
11278         an unallocated section.
11279         (Output_section::do_address_and_file_offset_have_reset_values):
11280         New method definition.
11281         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11282         Handle relaxed input section.
11283         (Output_section::sort_attached_input_sections): Checkpoint input
11284         section list lazily.
11285         (Output_section::get_input_sections): Change type of input_sections to
11286         list of Simple_input_section pointers.  Checkpoint input section list
11287         lazily.  Also handle relaxed input sections.
11288         (Output_section::add_input_section_for_script): Take a reference to
11289         a Simple_input_section object instead of Relobj pointer and section
11290         index as parameter.  Handle relaxed input sections.
11291         (Output_section::save_states, Output_section::restore_states): New
11292         method definitions.
11293         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11294         (Output_data::is_data_size_fixed): New method definition.
11295         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11296         if it is fixed.
11297         (Output_data::address_and_file_offset_have_reset_values): New method
11298         definition.
11299         (Output_data::do_address_and_file_offset_have_reset_values): New method
11300         definition.
11301         (Output_data::set_data_size): Check that data size is not fixed.
11302         (Output_data::fix_data_size): New method definition.
11303         (Output_data::is_data_size_fixed_): New data member.
11304         (Output_section_headers::set_final_data_size): New method definition.
11305         (Output_section_headers::do_size): New method declaration.
11306         (Output_segment_headers::set_final_data_size): New method definition.
11307         (Output_segment_headers::do_size): New method declaration.
11308         (Output_file_header::set_final_data_size)::New method definition.
11309         (Output_file_header::do_size)::New method declaration.
11310         (Output_section_data::Output_section_data): Add new parameter
11311         is_data_size_fixed and use it to fix data size.
11312         (Output_data_const::Output_data_const): Adjust call to base class
11313         constructor and fix data size.
11314         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11315         base class constructor and fix data size.
11316         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11317         base class constructor and fix data size.
11318         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11319         class constructor and fix data size.
11320         (Output_data_group::set_final_data_size): New method definition.
11321         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11322         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11323         class constructor and fix data size.
11324         (Output_relaxed_input_section): New class definition.
11325         (Output_section::Simple_input_section): New class definition.
11326         (Output_section::get_input_sections): Adjust parameter list.
11327         (Output_section::add_input_section_for_script): Same.
11328         (Output_section::save_states, Output_section::restore_states,
11329         Output_section::do_address_and_file_offset_have_reset_values,
11330         (Output_section::Input_section::Input_section): Handle
11331         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11332         Output_relaxed_input_section.
11333         (Output_section::Input_section::is_input_section,
11334         Output_section::Input_section::set_output_section): Handle relaxed
11335         input section.
11336         (Output_section::Input_section::is_relaxed_input_section,
11337         Output_section::Input_section::output_section_data,
11338         Output_section::Input_section::relaxed_input_section): New method
11339         definitions.
11340         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11341         value.
11342         (Output_section::Input_section::u1_): Update comments.
11343         (Output_section::Input_section::u2_): Add new union member poris.
11344         (Output_section::Checkpoint_output_section): New classs definition.
11345         (Output_section::relax_input_section): New method declaration.
11346         (Output_section::checkpoint_): New data member.
11347         (Output_segment): Update comments.
11348         (Output_segment::Output_segment): Un-privatize copy constructor.
11349         (Output_segment::operator=): Un-privatize.
11350         * script-sections.cc (Output_section_element::Input_section_list):
11351         Change element type to Output_section::Simple_input_section.
11352         (Output_section_element_dot_assignment::set_section_addresses):
11353         Register output section data for relaxation clean up.
11354         (Output_data_exression::Output_data_expression): Adjust call to base
11355         constructor to fix data size.
11356         (Output_section_element_data::set_section_addresses): Register
11357         Output_data_expression object for relaxation clean up.
11358         (struct Input_section_info): Replace Relobj pointer and section index
11359         pair with Output_section::Simple_input_section and Convert struct to a
11360         class.
11361         (Input_section_sorter::operator()): Adjust access to
11362         Input_section_info data member to use accessors.
11363         (Output_section_element_input::set_section_addresses): Use layout
11364         parameter.  Adjust code to use Output_section::Simple_input_section
11365         and Input_secction_info classes.  Register filler for relaxation
11366         clean up.
11367         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11368         and section index pair with Output_section::Simple_input_section
11369         class.  Adjust code accordingly.
11370         (Phdrs_element::release_segment): New method definition.
11371         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11372         segment list.
11373         (Script_sections::release_segments): New method definition.
11374         * gold/script-sections.h (Script_sections::release_segments): New
11375         method declaration.
11376         * gold/target.h (Target::may_relax, Target::relax,
11377         Target::do_may_relax, Target::do_relax): New method definitions.
11378
11379 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11380
11381         * arm.cc (has_signed_unsigned_overflow): New function.
11382         (Arm_relocate_functions::abs8): New function.
11383         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11384         (Target_arm::Scan::global): Likewise.
11385         (Target_arm::relocate::relocate): Likewise.
11386         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11387         Likewise.
11388
11389 2009-09-16  Cary Coutant  <ccoutant@google.com>
11390
11391         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11392         * testsuite/Makefile.in: Regenerate.
11393
11394 2009-09-11  Nick Clifton  <nickc@redhat.com>
11395
11396         * po/gold.pot: Updated by the Translation project.
11397
11398 2009-09-08  Cary Coutant  <ccoutant@google.com>
11399
11400         * output.cc (Output_file::open): Add execute permission to empty file.
11401         * testsuite/Makefile.am (permission_test): New test.
11402         * testsuite/Makefile.in: Regenerate.
11403
11404 2009-09-02  Ian Lance Taylor  <iant@google.com>
11405
11406         * output.cc (Output_file::resize): Call map_no_anonymous rather
11407         than map.
11408
11409 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11410
11411         * gold.cc: Include "incremental.h".
11412         (queue_initial_tasks): Call Incremental_checker methods.
11413         * incremental.cc: Include "output.h".
11414         (Incremental_checker::can_incrementally_link_output_file): New
11415         method.
11416         * incremental.h (Incremental_checker): New class.
11417
11418         * output.cc (Output_file::open_for_modification): New method.
11419         (Output_file::map_anonymous): Changed return type to bool.  Record
11420         map in base_ field.
11421         (Output_file::map_no_anonymous): New method, broken out of map.
11422         (Output_file::map): Use map_no_anonymous and map_anonymous.
11423         * output.h (class Output_file): Update declarations.
11424
11425 2009-08-24  Cary Coutant  <ccoutant@google.com>
11426
11427         * options.h (Command_line::Pre_options): New class.
11428         (Command_line::pre_options): New member.
11429         * options.cc (gold::options::ready_to_register): New variable.
11430         (One_option::register_option): Do nothing if not registering options.
11431         Assert if same short option registered twice.
11432         (General_options::General_options): Turn off option registration when
11433         done constructing.
11434         (Command_line::Pre_options::Pre_options): New constructor.
11435
11436 2009-08-24  Cary Coutant  <ccoutant@google.com>
11437
11438         * options.h (General_options::no_keep_memory): Remove incorrect
11439         short option.
11440
11441 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11442
11443         * Makefile.am (am__skiplex, am__skipyacc): New.
11444         * Makefile.in: Regenerate.
11445
11446 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11447
11448         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11449         (INCLUDES): ... this.
11450         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11451         (AM_CPPFLAGS): Renamed from ...
11452         (INCLUDE): ... this.
11453         * Makefile.in, testsuite/Makefile.in: Regenerate.
11454
11455         * Makefile.in: Regenerate.
11456         * aclocal.m4: Likewise.
11457         * config.in: Likewise.
11458         * configure: Likewise.
11459         * testsuite/Makefile.in: Likewise.
11460
11461         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11462         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11463         * Makefile.in: Regenerate.
11464         * testsuite/Makefile.in: Regenerate.
11465
11466 2009-08-19  Cary Coutant  <ccoutant@google.com>
11467
11468         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11469         symbols in shared libraries overridden by hidden or internal symbols
11470         in the main program.
11471
11472 2009-08-19  Chris Demetriou  <cgd@google.com>
11473
11474         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11475         checking source file names in error messages.
11476
11477 2009-08-18  Doug Kwan  <dougkwan@google.com>
11478
11479         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11480         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11481         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11482         an elfcpp::Ehdr as parameter.
11483         * object.cc (Object::set_target): Remove the version that looks up
11484         a target and sets it.
11485         (Sized_relobj::setup): Take a Target object instead of
11486         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11487         (make_elf_sized_object): Find target and ask target to
11488         make an ELF object.
11489         * object.h: (Object::set_target): Remove the version that looks up
11490         a target and sets it.
11491         (Sized_relobj::setup): Take a Target object instead of
11492         an elfcpp:Ehdr as parameter.
11493         * target.cc: Include dynobj.h.
11494         (Target::do_make_elf_object_implementation): New.
11495         (Target::do_make_elf_object): New.
11496         * target.h (Target::make_elf_object): New template declaration.
11497         (Target::do_make_elf_object): New method declarations.
11498         (Target::do_make_elf_object_implementation): New template declaration.
11499
11500 2009-08-14  Ian Lance Taylor  <iant@google.com>
11501
11502         * gold.h (FUNCTION_NAME): Define.
11503         (gold_unreachable): Use FUNCTION_NAME.
11504
11505 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11506
11507         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11508         symbol in the --keep-unique list is not found.
11509
11510 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11511
11512         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11513         been maked as --keep-unique.
11514         (Icf::unfold_section): New function.
11515         * icf.h (Icf::unfold_section): New function.
11516         * options.h (General_options::keep_unique): New option.
11517         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11518         * testsuite/Makefile.in: Regenerate.
11519         * testsuite/icf_keep_unique_test.sh: New file.
11520         * testsuite/icf_keep_unique_test.cc: New file.
11521
11522 2009-08-12  Cary Coutant  <ccoutant@google.com>
11523
11524         PR 10471
11525         * resolve.cc (Symbol_table::resolve): Check for references from
11526         dynamic objects to hidden and internal symbols.
11527         * testsuite/Makefile.am (hidden_test.sh): New test.
11528         * testsuite/Makefile.in: Regenerate.
11529         * testsuite/hidden_test.sh: New script.
11530         * testsuite/hidden_test_1.c: New test source.
11531         * testsuite/hidden_test_main.c: New test source.
11532
11533 2009-08-11  Doug Kwan  <dougkwan@google.com>
11534
11535         * arm.cc: Update comments.
11536         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11537         segment to locate the .ARM.exidx section if present.
11538
11539 2009-08-09  Doug Kwan  <dougkwan@google.com>
11540
11541         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11542         patch.
11543
11544 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11545         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11546         compiler warnings.
11547
11548 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11549
11550         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11551         valid tls_segment only for non-debug-section relocations.
11552         * testsuite/Makefile.am: Add gc_tls_test.
11553         * testsuite/Makefile.in: Regenerate.
11554         * testsuite/gc_tls_test.cc: New file.
11555         * testsuite/gc_tls_test.sh: New file.
11556
11557 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11558
11559         * icf.cc: New file.
11560         * icf.h: New file.
11561         * Makefile.am (CCFILES): Add icf.cc.
11562         (HFILES): Add icf.h
11563         * Makefile.in: Regenerate.
11564         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11565         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11566         section, symbol and addend information for the relocs.
11567         * gold.cc (queue_middle_tasks): Call identical code folding.
11568         * gold.h: Add defines for multimap.
11569         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11570         to the call of finalize_local_symbols.
11571         * main.cc (main): Create object of class Icf.
11572         * object.cc (Sized_relobj::do_layout): Allow this function to be
11573         called twice during icf.
11574         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11575         to sections marked as identical by icf.
11576         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11577         when available.
11578         (Sized_relobj::do_section_entsize): New function.
11579         * object.h (Object::section_entsize): New function.
11580         (Object::do_section_entsize): New pure virtual function.
11581         (Relobj::finalize_local_symbols): Add new parameter.
11582         (Relobj::do_section_entsize): New function.
11583         * options.h (General_options::icf): New option.
11584         (General_options::icf_iterations): New option.
11585         (General_options::print_icf_sections): New option.
11586         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11587         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11588         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11589         icf.
11590         * symtab.cc (Symbol_table::is_section_folded): New function.
11591         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11592         to sections marked as identical by icf.
11593         * symtab.h (Symbol_table::set_icf): New function.
11594         (Symbol_table::icf): New function.
11595         (Symbol_table::is_section_folded): New function.
11596         (Symbol_table::icf_): New data member.
11597         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11598         * testsuite/Makefile.am: Add commands to build icf_test.
11599         * testsuite/Makefile.in: Regenerate.
11600         * testsuite/icf_test.sh: New file.
11601         * testsuite/icf_test.cc: New file.
11602
11603 2009-07-24  Chris Demetriou  <cgd@google.com>
11604
11605         * layout.cc (is_compressible_debug_section): Fix incorrect
11606         comment about compressed section names.
11607
11608 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11609
11610         PR 10419
11611         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11612
11613 2009-07-16  Ian Lance Taylor  <iant@google.com>
11614
11615         PR 10400
11616         * layout.h: #include <map>.
11617         (class Kept_section): Change from struct to class.  Add accessors
11618         and setters.  Add section size to Comdat_group mapping.  Change
11619         Comdat_group to std::map.  Add is_comdat_ field.  Add
11620         linkonce_size field in union.
11621         (class Layout): Update declaration of find_or_add_kept_section.
11622         Don't declare find_kept_object.
11623         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11624         parameter.  Add object, shndx, is_comdat, and is_group_name
11625         parameters.  Change all callers.  Adjust for new Kept_section.
11626         (Layout::find_kept_object): Remove.
11627         * object.cc (Sized_relobj::include_section_group): Update use of
11628         Kept_section.  Rename secnum to shndx.  Only record
11629         Kept_comdat_section if sections are the same size.
11630         (Sized_relobj::include_linkonce_section): Update use of
11631         Kept_section.  Only record Kept_comdat_section if sections are the
11632         same size.  Set size of linkonce section.
11633         (Sized_relobj::map_to_kept_section): Update call to
11634         get_kept_comdat_section.
11635         * object.h (class Sized_relobj): Rename fields in
11636         Kept_comdat_section to drop trailing underscores; change object
11637         field to Relobj*.  Change Kept_comdat_section_table to store
11638         struct rather than pointer.
11639         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11640         Add kept_object and kept_shndx parameters.  Change all callers.
11641         (Sized_relobj::get_kept_comdat_section): Change return type to
11642         bool.  Add kept_object and kept_shndx parameters.  Change all
11643         callers.
11644         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11645         Layout::find_or_add_kept_section.
11646
11647 2009-07-09  Ian Lance Taylor  <iant@google.com>
11648
11649         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11650         Reserve space in the hash table.
11651
11652 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11653
11654         * fileread.cc (File_read::get_mtime): New method.
11655         * fileread.h (Timespec): New structure.
11656         (File_read::get_mtime): New method.
11657         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11658         Renamed from timestamp_nsec.
11659         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11660         Elf_Xword.
11661         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11662         timestamp_nsec.
11663         (Incremental_inputs::report_archive): Save mtime; style fix.
11664         (Incremental_inputs::report_obejct): Save mtime; style fix.
11665         (Incremental_inputs::report_script): Save mtime; style fix.
11666         (Incremental_inputs::finalize_inputs): Style fix.
11667         (Incremental_inputs::finalize): Style fix.
11668         (Incremental_inputs::create_input_section_data): Store inputs
11669         mtime.
11670         * incremental.h (Incremental_inputs::report_script): Add mtime
11671         argument.
11672         (Incremental_inputs::Input_info::Input_info): Intialize only one
11673         union member.
11674         (Incremental_inputs::Input_info::archive): Move to nameless
11675         union.
11676         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11677         (Incremental_inputs::Input_info::script): Move to nameless union.
11678         (Incremental_inputs::mtime): New field.
11679         * script.cc (read_input_script): Pass file mtime to
11680         Incremental_input.
11681         * script.h (Script_info::inputs): Style fix.
11682
11683 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11684
11685         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11686         instead of 32.
11687
11688 2009-06-24  Ian Lance Taylor  <iant@google.com>
11689
11690         PR 10156
11691         * layout.cc (Layout::choose_output_section): If we find an
11692         existing section, update the flags.
11693         (Layout::create_notes): New function, broken out of
11694         Layout::finalize.
11695         (Layout::finalize): Don't create note sections.
11696         (Layout::create_note): Don't crash if linker script discards
11697         section.
11698         (Layout::create_gold_note): Likewise.
11699         (Layout::create_build_id): Likewise.  Don't set
11700         after_input_sections on the section.
11701         (Layout::create_executable_stack_info): Remove target parameter.
11702         Change caller.
11703         * layout.h (class Layout): Declare create_notes.  Update
11704         declaration of create_executable_stack_info.
11705         * gold.cc (queue_middle_tasks): Call create_notes.
11706         * output.cc (Output_section::update_flags_for_input_section): Move
11707         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11708         invalid.
11709         * output.h (Output_data::mark_address_invalid): New function.
11710         (class Output_section): Only declare, not define,
11711         update_flags_for_input_section.  Remove set_flags.
11712
11713 2009-06-24  Ian Lance Taylor  <iant@google.com>
11714
11715         * script-sections.cc (Output_section_definition::
11716         set_section_addresses): Rename shadowing local load_address to
11717         laddr.
11718
11719 2009-06-24  Ian Lance Taylor  <iant@google.com>
11720
11721         PR 10244
11722         * reloc.cc (relocate_sections): Skip empty relocation sections.
11723
11724 2009-06-23  Ian Lance Taylor  <iant@google.com>
11725
11726         PR 10156
11727         * layout.cc (Layout::create_note): Use choose_output_section
11728         rather than make_output_section.
11729
11730 2009-06-23  Ian Lance Taylor  <iant@google.com>
11731
11732         PR 10237
11733         * options.cc (General_options::parse_V): Set printed_version_.
11734         (General_options::General_options): Initialize printed_version_.
11735         * options.h (class General_options): Add printed_version_ field.
11736         * gold.cc (queue_initial_tasks): If there are no input files,
11737         don't give a fatal error if we printed the version information.
11738         (queue_middle_tasks): If using -r with a shared object, give a
11739         fatal error rather than an ordinary error.
11740
11741 2009-06-23  Ian Lance Taylor  <iant@google.com>
11742
11743         PR 10219
11744         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11745         (Layout::make_output_section): Set have_stabstr_section_ if we see
11746         a .stab*str section.
11747         (Layout::finalize): Call link_stabs_sections.
11748         (Layout::link_stabs_sections): New file.
11749         * layout.h (class Layout): Add have_stabstr_section_ field.
11750         Declare link_stabs_sections.
11751
11752 2009-06-23  Doug Kwan  <dougkwan@google.com>
11753
11754         * Makefile.am (libgold_a_LIBADD): New.
11755         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11756         * Makefile.in: Regenerate.
11757         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11758         * configure: Regenerate.
11759         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11760         * fileread.cc: Include sys/state.h
11761         * gold.h: Declare memmem and strndup if found missing.
11762         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11763
11764 2009-06-23  Ian Lance Taylor  <iant@google.com>
11765
11766         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11767         * configure: Rebuild.
11768
11769 2009-06-23  Ian Lance Taylor  <iant@google.com>
11770
11771         PR 10147
11772         * object.cc (Object::section_contents): Don't try to get a view if
11773         the section has length zero.
11774         (Object::handle_gnu_warning_section): If the section is empty, use
11775         the name of the section as the warning.
11776
11777 2009-06-23  Ian Lance Taylor  <iant@google.com>
11778
11779         PR 10133
11780         * stringpool.h (class Stringpool_template): Add optimize_ field.
11781         (Stringpool_template::set_optimize): New function.
11782         * stringpool.cc (Stringpool_template::Stringpool_template):
11783         Initialize optimize_ field.
11784         (Stringpool_template::set_string_offsets): Test local optimize
11785         fild rather than parameter.
11786         * layout.cc (Layout::Layout): Call set_optimize on the section
11787         name stringpool.
11788
11789 2009-06-22  Ian Lance Taylor  <iant@google.com>
11790
11791         PR 10030
11792         * yyscript.y: Parse TARGET.
11793         * script.cc (script_set_target): New function.
11794         * script-c.h (script_set_target): Declare.
11795         * options.cc (General_options::string_to_object_format): Rename
11796         from string_to_object_format in anonymous namespace.  Change
11797         callers.
11798         * options.h (class General_options): Declare
11799         string_to_object_format.
11800
11801 2009-06-22  Ian Lance Taylor  <iant@google.com>
11802
11803         * script-sections.cc (Script_sections::create_segments): Don't put
11804         program headers in a PT_LOAD segment if -n or -N.
11805
11806 2009-06-22  Ian Lance Taylor  <iant@google.com>
11807
11808         PR 10141
11809         * options.h (class General_options): Add -z lazy and -z now.  Sort
11810         -z options into alphabetical order.
11811         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11812
11813 2009-06-21  Ian Lance Taylor  <iant@google.com>
11814
11815         * layout.cc (Layout::make_output_section): Call
11816         Target::new_output_section.
11817         (Layout::attach_allocated_section_to_segment): Put large section
11818         sections in a separate load segment with the large segment flag
11819         set.
11820         (Layout::segment_precedes): Sort large data segments after other
11821         load segments.
11822         (align_file_offset): New static function.
11823         (Layout::set_segment_offsets): Use align_file_offset.
11824         * output.h (class Output_section): Add is_small_section_ and
11825         is_large_section_ fields.
11826         (Output_section::is_small_section): New function.
11827         (Output_section::set_is_small_section):  New function.
11828         (Output_section::is_large_section): New function.
11829         (Output_section::set_is_large_section): New function.
11830         (Output_section::is_large_data_section): New function.
11831         (class Output_segment): Add is_large_data_segment_ field.
11832         (Output_segment::is_large_data_segment): New function.
11833         (Output_segment::set_is_large_data_segment): New function.
11834         * output.cc (Output_section::Output_section): Initialize new
11835         fields.
11836         (Output_segment::Output_segment): Likewise.
11837         (Output_segment::add_output_section): Add assertion that large
11838         data sections always go in large data segments.  Force small data
11839         sections to the end of the list of data sections.  Force small BSS
11840         sections to the start of the list of BSS sections.  For large BSS
11841         sections to the end of the list of BSS sections.
11842         * symtab.h (class Symbol): Declare is_common_shndx.
11843         (Symbol::is_defined): Check Symbol::is_common_shndx.
11844         (Symbol::is_common): Likewise.
11845         (class Symbol_table): Define enum Commons_section_type.  Update
11846         declarations.  Add small_commons_ and large_commons_ fields.
11847         * symtab.cc (Symbol::is_common_shndx): New function.
11848         (Symbol_table::Symbol_table): Initialize new fields.
11849         (Symbol_table::add_from_object): Put small and large common
11850         symbols in the right list.
11851         (Symbol_table::sized_finalized_symbol): Check
11852         Symbol::is_common_shndx.
11853         (Symbol_table::sized_write_globals): Likewise.
11854         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11855         common symbol lists.  Don't call do_allocate_commons_list if the
11856         list is empty.
11857         (Symbol_table::do_allocate_commons_list): Remove is_tls
11858         parameter.  Add comons_section_type parameter.  Change all
11859         callers.  Handle small and large common symbols.
11860         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11861         Symbol::is_common_shndx.
11862         * resolve.cc (symbol_to_bits): Likewise.
11863         * target.h (Target::small_common_shndx): New function.
11864         (Target::small_common_section_flags): New function.
11865         (Target::large_common_shndx): New function.
11866         (Target::large_common_section_flags): New function.
11867         (Target::new_output_section): New function.
11868         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11869         small_common_section_flags, and large_common_section_flags
11870         fields.
11871         (Target::do_new_output_section): New virtual function.
11872         * arm.cc (Target_arm::arm_info): Initialize new fields.
11873         * i386.cc (Target_i386::i386_info): Likewise.
11874         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11875         Likewise.
11876         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11877         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11878         (Target_x86_64::do_new_output_section): New function.
11879         * configure.ac: Define conditional MCMODEL_MEDIUM.
11880         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11881         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11882         (large_LDFLAGS): Define.
11883         * testsuite/large.c: New file.
11884         * testsuite/testfile.cc (Target_test::test_target_info):
11885         Initialize new fields.
11886         * configure, testsuite/Makefile.in: Rebuild.
11887
11888 2009-06-05  Doug Kwan  <dougkwan@google.com>
11889
11890         * Makefile.am (CCFILES): Add target.cc.
11891         * Makefile.in: Regenerate.
11892         * i386.cc (class Target_i386): Define new virtual method to
11893         override do_is_local_label_name in parent.
11894         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11895         local symbols if --discard-locals or -X is given.
11896         * options.h (class General_options): Declare new options
11897         '--discard-locals' and '-X' for discarding locals.
11898         * target.h (class Target): Define new methods is_local_label_name.
11899         Declare new virtual method do_is_local_label_name.
11900         * target.cc: New file.
11901         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11902         (check_SCRIPTS): Add discard_locals_test.sh.
11903         (check_DATA): Add discard_local_tests.syms.
11904         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11905         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11906         * testsuite/Makefile.in: Regenerate.
11907         * testsuite/discard_locals_test.c: New file.
11908         * testsuite/discard_locals_test.sh: Same.
11909
11910 2009-06-05  Doug Kwan  <dougkwan@google.com>
11911
11912         * object.cc (Sized_relobj::Sized_relobj): Initialize
11913         discarded_eh_frame_shndx_ to -1U.
11914         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11915         section.
11916         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11917         a discarded .eh_frame section.
11918         (Sized_relobj::do_finalize_local_symbols): Ditto.
11919         * object.h (class Sized_relobj): Declare new member
11920         discarded_eh_frame_shndx_.
11921         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11922         (local_labels_test.o, local_labels_test): New rules.
11923         * testsuite/Makefile.in: Regenerate.
11924
11925 2009-06-04  Doug Kwan  <dougkwan@google.com>
11926
11927         * layout.cc (Layout::section_name_mapping): Add mapping for
11928         special ARM sections.
11929
11930 2009-06-03  Doug Kwan  <dougkwan@google.com>
11931
11932         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11933         (utils::has_overflow): Same.
11934
11935 2009-06-03  Ian Lance Taylor  <iant@google.com>
11936
11937         * layout.cc (Layout::section_name_mapping): New array, replacing
11938         Layout::linkonce_mapping.
11939         (Layout::section_name_mapping_count): New variable, replacing
11940         Layout::linkonce_mapping_count.
11941         (Layout::linkonce_output_name): Remove.
11942         (Layout::output_section_name): Rewrite.
11943         * layout.h (class Layout): Rename Linkonce_mapping to
11944         Section_name_mapping, linkonce_mapping to section_name_mapping,
11945         linkonce_mapping_count to section_name_mapping_count.  Don't
11946         declare linkonce_output_name.
11947
11948 2009-06-03  Doug Kwan  <dougkwan@google.com>
11949
11950         * gold/arm.cc (namespace utils): New.
11951         (Target_arm::reloc_is_non_pic): Define new method.
11952         (class Arm_relocate_functions): New.
11953         (Target_arm::Relocate::relocate): Handle relocation types used by
11954         Android.
11955
11956 2009-06-03  Ian Lance Taylor  <iant@google.com>
11957
11958         * arm.cc (Target_arm::scan::global): Use || instead of |.
11959
11960 2009-06-02  Doug Kwan  <dougkwan@google.com>
11961
11962         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11963         issued_non_pic_error_.
11964         (class Target_arm::Scan): Declare new method check_non_pic.
11965         Define new method symbol_needs_plt_entry.
11966         Declare new data member issued_non_pic_error_.
11967         (class Target_arm::Relocate): Declare new method
11968         should_apply_static_reloc.
11969         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11970         (Target_arm::Scan::check_non_pic): Define new method.
11971         (Target_arm::Scan::local): Handle a small subset of reloc types used
11972         by Android.
11973         (Target_arm::Scan::local): Same.
11974         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11975
11976 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11977
11978         * incremental.cc (Incremental_inputs::report_command_line): Filter
11979         out --incremental-* options.
11980
11981 2009-05-29  Doug Kwan  <dougkwan@google.com>
11982
11983         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11984         template class.
11985         (class Target_arm): Update comment.
11986         (Target_arm::Target_arm): Initialize new data members GOT_,
11987         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11988         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11989         and Target_arm::rel_dyn_section.
11990         Declare new_enum Target_arm::Got_type.
11991         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11992         and DYNBSS_.
11993         Update commments for member do_dynsym_value.
11994         (Target_arm::got_size, Target_arm::plt_section,
11995         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11996         new methods inside class defintion.
11997         (Target_arm::got_section): Define new method.
11998         (Target_arm::rel_dyn_section): Same.
11999         (Output_data_plt_arm): New template class.
12000         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12001         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12002         (Output_data_plt_arm::add_entry): Same.
12003         (Output_data_plt_arm::first_plt_entry): Define new
12004         static data member for PLT instruction template.
12005         (Output_data_plt_arm::plt_entry): Same.
12006         (Output_data_plt_arm::do_write): Define new method.
12007         (Target_arm::make_plt_entry): Same.
12008         (Target_arm::do_finalize_sections): Same.
12009         (Target_arm::do_dynsym_value): Same.
12010
12011 2009-05-28  Doug Kwan  <dougkwan@google.com>
12012
12013         * Makefile.am (TARGETSOURCES): Add arm.cc.
12014         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12015         * Makefile.in: Regenerate.
12016         * arm.cc: New file.
12017         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12018
12019 2009-05-26  Doug Kwan  <dougkwan@google.com>
12020
12021         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12022         (General_options::check_excluded_libs): Strip off directories in
12023         archive name before matching like GNU ld does.
12024         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12025         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12026         (exclude_libs_test_LDFLAGS): Add linker option
12027         -Wl,--exclude-libs,libexclude_libs_test_3
12028         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12029         an explicit archive without using -l.
12030         (alt/libexclude_libs_test_3.a): New make rule.
12031         * testsuite/Makefile.in: Regenerate.
12032         * testsuite/exclude_libs_test.c : Declare lib3_default().
12033         (main): Call it.
12034         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12035         * exclude_libs_test_3.c: New file.
12036
12037 2009-05-26  Nick Clifton  <nickc@redhat.com>
12038
12039         * po/id.po: New Indonesian translation.
12040         * po/gold.pot: Updated template file.
12041
12042 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12043
12044         * testsuite/Makefile.am: Add -ffunction-sections to compile
12045         gc_comdat_test files.  Add -Wl,--gc-sections to build
12046         gc_comdat_test.
12047         * testsuite/Makefile.in: Regenerate.
12048         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12049
12050 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12051
12052         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12053         kept comdat section was garbage collected.
12054         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12055         * testsuite/Makefile.in: Regenerate.
12056         * testsuite/gc_comdat_test.sh: New file.
12057         * testsuite/gc_comdat_test_1.cc: New file.
12058         * testsuite/gc_comdat_test_2.cc: New file.
12059
12060 2009-05-19  Doug Kwan  <dougkwan@google.com>
12061
12062         * archive.cc (Archive::Archive): Move constructor from archive.h
12063         to here.  Initialize no_export_.
12064         (Archive::get_elf_object_for_member): Set no_export flag of object.
12065         * archive.h (Archive::Archive): Move constructor body to
12066         archive.cc.
12067         (Archive::no_export): New method.
12068         (Archive::no_export_): New field.
12069         * object.h (Object::Object): Initialize no_export_ to false.
12070         (Object::no_export, Object::set_no_export): New methods.
12071         (Object::no_export_): New field.
12072         * options.cc (General_options::parse_exclude_libs): New method.
12073         (General_options::check_excluded_libs) Same.
12074         * options.h (exclude_libs): New option.
12075         (General_options::check_excluded_libs): New method declaration.
12076         (General_options::excluded_libs_): New field.
12077         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12078         default or protected visibility if an object has no-export flag set.
12079         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12080         (check_SCRIPTS): Add exclude_libs_test.sh.
12081         (check_DATA): Add exclude_libs_test.syms.
12082         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12083         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12084         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12085         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12086         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12087         libexclude_libs_test_2.a): New rules.
12088         * testsuite/Makefile.in: Regenerate.
12089         * testsuite/exclude_libs_test.c: New file.
12090         * testsuite/exclude_libs_test.sh: Ditto.
12091         * testsuite/exclude_libs_test_1.c: Ditto.
12092         * testsuite/exclude_libs_test_2.c: Ditto.
12093
12094 2009-05-15  Ian Lance Taylor  <iant@google.com>
12095
12096         * configure.ac: Check for declarations for cases where libiberty.h
12097         checks HAVE_DECL_xxx.
12098         * configure, config.in: Rebuild.
12099
12100 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12101
12102         * gold.h (Incremental_argument_list): Remove (invalid) forward
12103         declaration.
12104         * incremental.cc (Incremental_inputs::report_achive): New method.
12105         (Incremental_inputs::report_object): New method.
12106         (Incremental_inputs::report_script): New method.
12107         (Incremental_inputs::finalize_inputs): New method.
12108         (Incremental_inputs::finalize): Call finalize_inputs().
12109         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12110         Create inputs entries.
12111         * incremental.h (Incremental_input_type): New enum.
12112         (Incremental_inputs::Incremental_input): Initialize new fields.
12113         (Incremental_inputs::report_inputs): New method.
12114         (Incremental_inputs::report_achive): New method.
12115         (Incremental_inputs::report_object): New method.
12116         (Incremental_inputs::report_script): New method.
12117         (Incremental_inputs::finalize_inputs): New method.
12118         (Incremental_inputs::Input_info): New struct.
12119         (Incremental_inputs::Input_info_map): New typedef.
12120         (Incremental_inputs::lock_): New field.
12121         (Incremental_inputs::Inputs_): New field.
12122         (Incremental_inputs::Inputs_map): New field.
12123         * main.cc (main): Call Incremental_input::report_inputs.
12124         * options.h (Input_argument_list): Typedef moved from
12125         Input_arguments.
12126         (Input_file_group::Files): Remove, use ::Input_argument_list.
12127         (Input_file_group::Input_argument_list): Remove, use
12128         ::Input_argument_list.
12129         * plugin.cc (Plugin_manager::add_input_file): Add error in
12130         incremental build.
12131         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12132         functions.
12133         * script.cc (read_input_script): Call
12134         Incremental_input::report_script.
12135         * script.h (Script_info): New class.
12136
12137 2009-04-27  Ian Lance Taylor  <iant@google.com>
12138
12139         * x86_64.cc (do_adjust_output_section): Set entsize to
12140         plt_entry_size.
12141
12142 2009-04-23  Elliott Hughes  <enh@google.com>
12143
12144         * output.cc (Output_file::close): After short writes, continue
12145         writing from the correct offset in the buffer being written.
12146
12147 2009-04-23  Chris Demetriou  <cgd@google.com>
12148
12149         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12150         * configure: Regenerate.
12151         * config.in: Regenerate.
12152         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12153         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12154
12155 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12156
12157         * incremental.cc (Incremental_inputs_header_data): Renamed from
12158         Incremental_input_header_data.
12159         (Incremental_inputs_header_data::data_size): New field.
12160         (Incremental_inputs_header_data::put_input_file_count): Renamed
12161         from input_file_count.
12162         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12163         from command_line_offset.
12164         (Incremental_inputs_header_data::put_reserved): Renamed from
12165         put_reserved.
12166         (Incremental_inputs_entry_data): Renamed from
12167         Incremental_input_entry_data.
12168         (Incremental_inputs_entry_data::data_size): New field.
12169         (Incremental_inputs::report_command_line): New method.
12170         (Incremental_inputs::finalize): New method.
12171         (Incremental_inputs::create_incremental_inputs_data): New method.
12172         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12173         * incremental.h: New file.
12174         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12175         (Layout::finalize): Create incremental inputs section in
12176         incremental builds.
12177         (Layout::create_incremental_info_sections): New method.
12178         * layout.h (Layout::incremental_inputs): New method.
12179         (Layout::create_incremental_info_sections): New method.
12180         (Layout::incremental_inputs_): New field.
12181         * main.cc (main): Notify Incremental_input of the command line.
12182
12183 2009-04-01  Ian Lance Taylor  <iant@google.com>
12184             Mikolaj Zalewski  <mikolajz@google.com>
12185
12186         * gold.h (reserve_unordered_map): Define, three versions, one for
12187         each version of Unordered_map.
12188         * layout.cc (Layout::Layout): Remove options parameter.  Add
12189         number_of_input_files parameter.  Don't initialize options_.
12190         Initialize number_of_input_files_ and resized_signatures_.  Move
12191         sections_are_attached_.
12192         (Layout::layout_group): Reserve space for group_signatures_.
12193         (Layout::find_or_add_kept_section): Change name parameter to be a
12194         reference.  Resize signatures_ map when it gets large enough.
12195         (Layout::layout_eh_frame): Use parameters->options() instead of
12196         this->options_.
12197         (Layout::make_output_section): Likewise.
12198         (Layout::attach_allocated_section_to_segment): Likewise.
12199         (Layout::finalize, Layout::create_executable_stack): Likewise.
12200         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12201         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12202         * layout.h (class Layout): Update declarations.  Remove options_
12203         field.  Add number_of_input_files_ and resized_signatures_
12204         fields.  Move sections_are_attached_ field.
12205         * main.cc (main): Pass number of input files to Layout
12206         constructor.  Don't pass options.
12207
12208 2009-03-30  Ian Lance Taylor  <iant@google.com>
12209
12210         * ffsll.c (ffsll): Correct implementation.
12211
12212 2009-03-27  Ian Lance Taylor  <iant@google.com>
12213
12214         * ffsll.c: New file.
12215         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12216         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12217         * ftruncate.c (ftruncate): Declare before definition.
12218         * mremap.c (mremap): Likewise.
12219         * pread.c (pread): Likewise.
12220         * configure, Makefile.in, config.in: Rebuild.
12221
12222         * mremap.c: New file.
12223         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12224         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12225         (mremap): Declare if HAVE_MREMAP is not defined.
12226         * configure, Makefile.in, config.in: Rebuild.
12227
12228 2009-03-27  Cary Coutant  <ccoutant@google.com>
12229
12230         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12231         position independent.
12232         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12233         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12234
12235 2009-03-24  Cary Coutant  <ccoutant@google.com>
12236
12237         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12238         an executable.
12239         (needs_dynamic_reloc): Likewise.
12240
12241 2009-03-24  Ian Lance Taylor  <iant@google.com>
12242
12243         * yyscript.y (file_cmd): Recognize EXTERN.
12244         (extern_name_list, extern_name_list_body): New nonterminals.
12245         * script.cc (script_add_extern): Define.
12246         * script-c.h (script_add_extern): Declare.
12247
12248 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12249
12250         * object.cc (is_elf_object): Define.
12251         * object.h (is_elf_object): Declare.
12252         * archive.cc (Archive::get_elf_object_for_member): Call
12253         is_elf_object.
12254         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12255
12256 2009-03-24  Elliott Hughes  <enh@google.com>
12257
12258         * output.cc (Output_file::map_anonymous): Define.
12259         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12260         try an anonymous one.  Report the size if the mmap fails.
12261         * output.h (class Output_file): Declare map_anonymous.
12262
12263 2009-03-24  Ian Lance Taylor  <iant@google.com>
12264
12265         * target-select.cc (instantiate_target): Don't acquire the lock if
12266         the instantiated_target_ field has already been set.
12267
12268 2009-03-23  Ian Lance Taylor  <iant@google.com>
12269
12270         * gold-threads.h (class Initialize_lock): Define.
12271         * gold-threads.cc (class Initialize_lock_once): Define.
12272         (initialize_lock_control): New static variable.
12273         (initialize_lock_pointer): New static variable.
12274         (initialize_lock_once): New static function.
12275         (Initialize_lock::Initialize_lock): Define.
12276         (Initialize_lock::initialize): Define.
12277         * target-select.h: Include "gold-threads.h".
12278         (class Target_selector): Add lock_ and initialize_lock_ fields.
12279         Don't define instantiate_target, just declare it.
12280         * target-select.cc (Target_selector::Target_selector): Initialize
12281         new fields.
12282         (Target_selector::instantiate_target): Define.
12283         * descriptors.h: Include "gold-threads.h".
12284         (class Descriptors): Add initialize_lock_ field.
12285         * descriptors.cc (Descriptors::Descriptors): Initialize new
12286         field.
12287         (Descriptors::open): Use initialize_lock_ field
12288         * errors.h (class Errors): Add initialize_lock_ field.
12289         * errors.cc (Errors::Errors): Initialize new field.
12290         (Errors::initialize_lock): Use initialize_lock_ field.
12291         * powerpc.cc (class Target_selector_powerpc): Remove
12292         instantiated_target_ field.  In do_recognize call
12293         instantiate_target rather than do_instantiate_target.  In
12294         do_instantiate_target just allocate a new target.
12295         * sparc.cc (class Target_selector_sparc): Likewise.
12296
12297         * freebsd.h: New file.
12298         * i386.cc: Include "freebsd.h".
12299         (Target_i386): Derive from Target_freebsd rather than
12300         Sized_target.
12301         (Target_selector_i386): Derive from Target_selector_freebsd rather
12302         than Target_selector.
12303         * x86_64.cc: Include "freebsd.h".
12304         (Target_x86_64): Derive from Target_freebsd rather than
12305         Sized_target.
12306         (Target_selector_x86_64): Derive from Target_selector_freebsd
12307         rather than Target_selector.
12308         * target.h (class Target): Add adjust_elf_header and
12309         do_adjust_elf_header.
12310         * output.cc (Output_file_header:: do_sized_write): Call target
12311         adjust_elf_header routine.
12312         * configure.tgt: Set targ_osabi.
12313         * configure.ac: Define GOLD_DEFAULT_OSABI.
12314         * parameters.cc (Parameters::default_target): Pass
12315         GOLD_DEFAULT_OSABI to select_target.
12316         * target-select.h (class Target_selector): Make instantiate_target
12317         protected rather than private.
12318         * Makefile.am (HFILES): Add freebsd.h.
12319         * configure, Makefile.in, config.in: Rebuild.
12320
12321         * merge.cc (do_add_input_section): Correct pend value.  Change
12322         message about last entry not being null terminated from error to
12323         warning.
12324
12325 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12326
12327         * incremental.cc: New file.
12328         * Makefile.am (CCFILES): Add incremental.cc.
12329         * Makefile.in: Rebuild.
12330
12331 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12332
12333         * layout.cc (Layout::output_section_name): Preserve names
12334         of '.note.' sections.
12335
12336 2009-03-19  Ian Lance Taylor  <iant@google.com>
12337
12338         * descriptors.cc (Descriptors::open): Check that the options are
12339         valid before using them.
12340
12341 2009-03-18  Ian Lance Taylor  <iant@google.com>
12342
12343         * script-sections.h: Include <list>.
12344         (class Script_sections): Change Sections_elements from std::vector
12345         to std::list.  Typedef public Elements_iterator.  Add
12346         orphan_section_placement_, data_segment_align_start_, and
12347         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12348         field.
12349         * script-sections.cc (class Orphan_section_placement): New class.
12350         (class Sections_element): Add virtual functions is_relro and
12351         orphan_section_init.  Remove virtual function place_orphan_here.
12352         (class Output_section_definition): Add is_relro and
12353         orphan_section_init.  Remove place_orphan_here.
12354         (class Orphan_output_section): Likewise.
12355         (Script_sections::Script_sections): Update for field changes.
12356         (Script_sections::data_segment_align): Set saw_data_segment_align_
12357         and data_segment_align_start_, not data_segment_align_index.
12358         (Script_sections::data_segment_relro_end): Check
12359         saw_data_segment_align_.  Use data_segment_align_start_ rather
12360         than data_segment_align_index_.
12361         (Script_sections::place_orphan): Rewrite to use
12362         Orphan_section_placement.
12363
12364 2009-03-17  Ian Lance Taylor  <iant@google.com>
12365
12366         * archive.cc (Archive::add_symbols): Check for a version attached
12367         to the symbol name in the archive map.
12368         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12369         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12370         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12371         (ver_test_11.a): New target.
12372         * testsuite/Makefile.in: Rebuild.
12373
12374         * configure.ac: Check for chsize and posix_fallocate.  Replace
12375         ftruncate.
12376         * ftruncate.c: New file, from gnulib.
12377         * output.cc (posix_fallocate): Define dummy version if not
12378         HAVE_POSIX_FALLOCATE.
12379         (Output_file::map): Call posix_fallocate rather than lseek and
12380         write.
12381         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12382         * configure, Makefile.in, config.in: Rebuild.
12383
12384 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12385
12386         * layout.h (Layout::create_note): Add section_name parameter.
12387         * layout.cc (Layout::create_note): Likewise.
12388         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12389
12390 2009-03-17  Ian Lance Taylor  <iant@google.com>
12391
12392         * descriptors.cc: Include "options.h".
12393         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12394         (Descriptors::open): Always use O_CLOEXEC when opening a new
12395         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12396         then set FD_CLOEXEC.
12397
12398         * sparc.cc (class Target_sparc): Add has_got_section.
12399         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12400         make sure we have a GOT section.
12401
12402         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12403         (Target_sparc::Scan::local): Likewise.
12404         (Target_sparc::Scan::global): Likewise.
12405         (Target_sparc::Relocate::relocate): Likewise.
12406         (Target_sparc::Relocate::relocate_tls): Likewise.
12407
12408         * symtab.cc (Symbol_table::define_default_version): New function,
12409         broken out of add_from_object.
12410         (Symbol_table::add_from_object): Call define_default_version.
12411         (Symbol_table::define_special_symbol): Add resolve_oldsym
12412         parameter.  Change all callers.  If the version for a symbol comes
12413         from a version script, resolve it with the symbol with the same
12414         name with no version.  Also add the symbol without a version if
12415         appropriate.
12416         (do_define_in_output_data): If resolving with oldsym, don't delete
12417         sym.
12418         (do_define_in_output_segment): Likewise.
12419         (do_define_as_constant): Likewise.
12420         * symtab.h (class Symbol_table): Update declarations.
12421
12422 2009-03-13  Ian Lance Taylor  <iant@google.com>
12423
12424         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12425         (Read_symbols::requeue): New function.
12426         (Read_symbols::do_read_symbols): If make_elf_object fails because
12427         the target type is not configured, and the file was searched for,
12428         issue a warning and retry with the next directory.
12429         (Add_symbols::run): If the file has an incompatible format, and
12430         it was searched for, requeue the Read_symbols task.  On error,
12431         release the object.
12432         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12433         dirindex parameter to constructor.  Change all callers.  Declare
12434         incompatible_warning and requeue.
12435         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12436         input_argument_ and input_group_ fields.  Add them to
12437         constructor.  Change all callers.
12438         (class Read_script): Add dirindex_ field.  Add it to constructor.
12439         Change all callers.
12440         * archive.cc (Archive::setup): Remove input_objects parameter.
12441         Change all callers.
12442         (Archive::get_file_and_offset): Likewise.
12443         (Archive::read_all_symbols): Likewise.
12444         (Archive::read_symbols): Likewise.
12445         (Archive::get_elf_object_for_member): Remove input_objects
12446         parameter.  Add punconfigured parameter.  Change all callers.
12447         (Archive::add_symbols): Change return type to bool.  Check return
12448         value of include_member.
12449         (Archive::include_all_members): Likewise.
12450         (Archive::include_member): Change return type to bool.  Return
12451         false if first included object has incompatible target.  Set
12452         included_member_ field.
12453         (Add_archive_symbols::run): If add_symbols returns false, requeue
12454         Read_symbols task.
12455         * archive.h (class Archive): Add included_member_ field.
12456         Initialize it in constructor.  Add input_file and searched_for
12457         methods.  Update declarations.
12458         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12459         input_argument_ fields.  Add them to constructor.  Change all
12460         callers.
12461         * script.cc: Include "target-select.h".
12462         (class Parser_closure): Add skip_on_incompatible_target_ and
12463         found_incompatible_target_ fields.  Add
12464         skip_on_incompatible_target parameter to constructor.  Change all
12465         callers.  Add methods skip_on_incompatible_target,
12466         clear_skip_on_incompatible_target, found_incompatible_target, and
12467         set_found_incompatible_target.
12468         (read_input_script): Add dirindex parameter.  Change all callers.
12469         If parser finds an incompatible target, requeue Read_symbols
12470         task.
12471         (script_set_symbol): Clear skip_on_incompatible_target in
12472         closure.
12473         (script_add_assertion, script_parse_option): Likewise.
12474         (script_start_sections, script_add_phdr): Likewise.
12475         (script_check_output_format): New function.
12476         * script.h (read_input_script): Update declaration.
12477         * script-c.h (script_check_output_format): Declare.
12478         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12479         (ignore_cmd): Remove OUTPUT_FORMAT.
12480         * fileread.cc (Input_file::Input_file): Add explicit this.
12481         (Input_file::will_search_for): New function.
12482         (Input_file::open): Add pindex parameter.  Change all callers.
12483         * fileread.h (class Input_file): Add input_file_argument method.
12484         Declare will_search_for.  Update declarations.
12485         * object.cc (make_elf_object): Add punconfigured parameter.
12486         Change all callers.
12487         * object.h (class Object): Make input_file public.  Add
12488         searched_for method.
12489         (make_elf_object): Update declaration.
12490         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12491         restart search.
12492         * dirsearch.h (class Dirsearch): Update declaration.
12493         * options.h (class General_options): Add --warn-search-mismatch.
12494         * parameters.cc (Parameters::is_compatible_target): New function.
12495         * parameters.h (class Parameters): Declare is_compatible_target.
12496         * workqueue.cc (Workqueue::add_blocker): New function.
12497         * workqueue.h (class Workqueue): Declare add_blocker.
12498
12499         * fileread.cc (Input_file::open): Remove options parameter.
12500         Change all callers.
12501         (Input_file::open_binary): Likewise.
12502         * script.cc (read_input_script): Likewise.
12503         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12504         options parameter from constructor.  Change all callers.
12505         (class Read_script): Likewise.
12506         * fileread.h (class Input_file): Update declarations.
12507         * script.h (read_input_script): Update declaration.
12508
12509 2009-03-10  Nick Clifton  <nickc@redhat.com>
12510
12511         * po/es.po: New Spanish translation.
12512
12513 2009-03-06  Cary Coutant  <ccoutant@google.com>
12514
12515         * options.cc (parse_short_option): Keep dash_z from registering itself.
12516
12517 2009-03-03  Ian Lance Taylor  <iant@google.com>
12518
12519         PR 9918
12520         * target-reloc.h (relocate_section): Pass output_section to
12521         relocate.
12522         * i386.cc (Target_i386::should_apply_static_reloc): Add
12523         output_section parameter.  Change all callers.
12524         (Target_i386::Relocate::relocate): Add output_section parameter.
12525         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12526         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12527         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12528         * testsuite/two_file_shared.sh: New script.
12529         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12530         (check_DATA): Add two_file_shared.dbg.
12531         (two_file_shared.dbg): New target.
12532         * testsuite/Makefile.in: Rebuild.
12533
12534 2009-03-01  Ian Lance Taylor  <iant@google.com>
12535
12536         * configure.ac: Check for byteswap.h.
12537         * configure: Rebuild.
12538         * config.in: Rebuild.
12539
12540 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12541
12542         * layout.cc (Layout::find_or_add_kept_section): New function.
12543         (Layout::add_comdat): Removed.
12544         * layout.h (struct Kept_section): Move out of class Layout.
12545         Remove trailing underscores from field names.  Add group_sections
12546         field.  Rename group_ field to is_group.  Change all uses.
12547         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12548         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12549         comdat_groups_ field.
12550         (Sized_relobj::include_section_group): Use
12551         find_or_add_kept_section and Kept_section::group_sections.
12552         (Sized_relobj::include_linkonce_section): Likewise.
12553         * object.cc (class Sized_relobj): Don't define Comdat_group or
12554         Comdat_group_table.  Remove find_comdat_group and
12555         add_comdat_group.  Remove comdat_groups_ field.
12556         * plugin.cc (include_comdat_group): Use
12557         Layout::find_or_add_kept_section.
12558
12559 2009-02-28  Ian Lance Taylor  <iant@google.com>
12560
12561         * README: --gc-sections and map files are now supported.  Document
12562         some build requirements.
12563
12564         PR 6992
12565         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12566         relocatable link set the value of the section symbol to zero.
12567         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12568         relocatable link don't include the section address in the local
12569         symbol value.
12570
12571 2009-02-27  Ian Lance Taylor  <iant@google.com>
12572
12573         PR 6811
12574         * options.h (class Search_directory): Add is_system_directory.
12575         (class General_options): Declare is_in_system_directory.
12576         * options.cc (get_relative_sysroot): Make static.
12577         (get_default_sysroot): Make static.
12578         (General_optoins::is_in_system_directory): New function.
12579         * fileread.cc (Input_file::is_in_system_directory): New function.
12580         * fileread.h (class Input_file): Declare is_in_system_directory.
12581         * object.h (class Object): Add is_in_system_directory.
12582         (class Input_objects): Remove system_library_directory_ field.
12583         * object.cc (Input_objects::add_object): Don't set
12584         system_library_directory_.
12585         (input_objects::found_in_system_library_directory): Remove.
12586         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12587         parameter.  Change all callers.
12588         (Symbol_table::sized_write_globals): Likewise.
12589         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12590         Call Object::is_in_system_directory.
12591         * symtab.h (class Symbol_table): Update declarations.
12592
12593         PR 5990
12594         * descriptors.h (Open_descriptor): Add is_on_stack field.
12595         * descriptors.cc (Descriptors::open): If the descriptor is on the
12596         top of the stack, remove it.  Initialize is_on_stack field.
12597         (Descriptors::release): Only add pod to stack if it is not on the
12598         stack already.
12599         (Descriptors::close_some_descriptor): Clear stack_next and
12600         is_on_stack fields.
12601
12602         PR 7091
12603         * output.cc (Output_section::find_starting_output_address): Rename
12604         from starting_output_address; add PADDR parameter; change return
12605         type.
12606         * output.h (class Output_section): Declare
12607         find_starting_output_address instead of starting_output_address.
12608         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12609         section symbol for which we can't find a merge section.
12610
12611         PR 9836
12612         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12613         hidden or internal, force the symbol to be local.
12614         * resolve.cc (Symbol::override_visibility): Define.
12615         (Symbol::override_base): Use override_visibility.
12616         (Symbol_table::resolve): Likewise.
12617         (Symbol::override_base_with_special): Likewise.
12618         (Symbol_table::override_with_special): If the visibility is hidden
12619         or internal, force the symbol to be local.
12620         * symtab.h (class Symbol): Add set_visibility and
12621         override_visibility.
12622         * testsuite/ver_test_1.sh: New file.
12623         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12624         (check_DATA): Add ver_test_1.syms.
12625         (ver_test_1.syms): New target.
12626         * testsuite/Makefile.in: Rebuild.
12627
12628 2009-02-25  Cary Coutant  <ccoutant@google.com>
12629
12630         * layout.cc (Layout::choose_output_section): Don't rename sections
12631         when using a linker script that has a SECTIONS clause.
12632         * Makefile.in: Regenerate.
12633
12634         * testsuite/Makefile.am (script_test_5.sh): New test case.
12635         * testsuite/Makefile.in: Regenerate.
12636         * testsuite/script_test_5.cc: New file.
12637         * testsuite/script_test_5.sh: New file.
12638         * testsuite/script_test_5.t: New file.
12639
12640 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12641
12642         * archive.cc (Archive::include_member): Update calls to add_symbols.
12643         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12644         the Layout argument.
12645         * dynobj.h (do_add_symbols): Add the Layout argument.
12646         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12647         Layout argument.
12648         * object.h (Object::add_symbols): Add the Layout argument.
12649         (Object::do_add_symbols): Add the Layout argument.
12650         (Sized_relobj::do_add_symbols): Add the Layout argument.
12651         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12652         Unify the two versions.
12653         (Add_plugin_symbols): Remove.
12654         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12655         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12656         (Add_plugin_symbols): Remove.
12657         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12658         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12659         (Add_symbols::run): Make it work with Pulginobj.
12660
12661 2009-02-06  Ian Lance Taylor  <iant@google.com>
12662
12663         * object.cc (Sized_relobj::do_layout): Make info message start
12664         with lower case letter.
12665
12666 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12667
12668         * binary.cc: Fix file comment.
12669
12670         * options.h (enum Incremental_disposition): Define.
12671         (class General_options): Add new options: --incremental,
12672         --incremental_changed, --incremental_unchanged,
12673         --incremental_unknown.  Add incremental_disposition_ and
12674         implicit_incremental_ fields.
12675         (General_options::incremental_disposition): New function.
12676         (class Position_dependent_options): Add incremental_disposition
12677         option.
12678         (Position_dependent_options::copy_from_options): Set incremental
12679         dispositions.
12680         * options.cc (General_options::parse_incremental_changed): New
12681         function.
12682         (General_options::parse_incremental_unchanged): New function.
12683         (General_options::parse_incremental_unknown): New function.
12684         (General_options::General_options): Initialize new fields
12685         incremental_disposition_ and implicit_incremental_.
12686         (General_options::finalize): Check for uasge of --incremental-*
12687         without --incremental.
12688
12689 2009-02-06  Chris Demetriou  <cgd@google.com>
12690
12691         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12692         pointer and to report location as the file name associated with
12693         the symbol.
12694         (gold_undefined_symbol_at_location): New function to replace the
12695         old gold_undefined_symbol functionality.
12696         * target-reloc.h (relocate_section): Update to use
12697         gold_undefined_symbol_at_location.
12698         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12699         Call gold_undefined_symbol function rather than gold_error.
12700         * errors.h (Errors::undefined_symbol): Take location as a
12701         string, rather than calculating it from a relocation.
12702         * errors.cc (Errors::fatal): Print "fatal error:" before the
12703         formatted message.
12704         (Errors::error, Errors::error_at_location): Print "error: "
12705         before the formatted message.
12706         (Errors::undefined_symbol): Take location as a string, rather
12707         than calculating it from a relocation.
12708         (gold_undefined_symbol_at_location): New function akin to
12709         old gold_undefined_symbol, calculates location from relocation.
12710         (gold_undefined_symbol): Change to take only a Symbol pointer
12711         and to report location as the file name associated with the symbol.
12712         * testsuite/debug_msg.sh: Update for changed error messages.
12713         * testsuite/undef_symbol.sh: Likewise.
12714
12715 2009-02-04  Duncan Sands  <baldrick@free.fr>
12716
12717         PR 9812
12718         * reduced_debug_output.h
12719         (Output_reduced_debug_abbrev_section::failed): Use format for
12720         gold_warning.
12721         (Output_reduced_debug_info_section::faild): Likewise.
12722
12723 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12724
12725         * script.cc (Lazy_demangler): New class.
12726         (Version_script_info::get_symbol_version_helper): Demangle a
12727         symbol only once.
12728
12729 2009-01-29  Cary Coutant  <ccoutant@google.com>
12730
12731         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12732         to __tls_get_addr.
12733         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12734
12735 2009-01-28  Ian Lance Taylor  <iant@google.com>
12736
12737         * version.cc (version_string): Bump to 1.9.
12738
12739         * gold.h: Include <cstring> and <stdint.h>.
12740         * version.cc: Include <cstdio>.
12741         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12742         warning.
12743         * reduced_debug_output.cc (insert_into_vector): Rename from
12744         Insert_into_vector; change all callers.  Use Swap_unaligned to
12745         avoid aliasing issue; remove union since it is unnecessary.
12746
12747 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12748
12749         * Makefile.am (CCFILES): Add gc.cc.
12750         (HFILES): Add gc.h.
12751         * Makefile.in: Regenerate.
12752         * gold.cc (Gc_runner): New class.
12753         (queue_initial_tasks): Call garbage collection related tasks
12754         when corresponding options are invoked.
12755         (queue_middle_gc_tasks): New function.
12756         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12757         processed early before laying out sections during garbage collection.
12758         * gold.h (queue_middle_gc_tasks): New function.
12759         (is_prefix_of): Move from "layout.cc".
12760         * i386.cc (Target_i386::gc_process_relocs): New function.
12761         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12762         * main.cc (main): Create object of class "Garbage_collection".
12763         * object.cc (Relobj::copy_symbols_data): New function.
12764         (Relobj::is_section_name_included): New function.
12765         (Sized_relobj::do_layout): Allow this function to be called twice
12766         during garbage collection and defer layout of section during the
12767         first call.
12768         * object.h (Relobj::get_symbols_data): New function.
12769         (Relobj::is_section_name_included): New function.
12770         (Relobj::copy_symbols_data): New function.
12771         (Relobj::set_symbols_data): New function.
12772         (Relobj::get_relocs_data): New function.
12773         (Relobj::set_relocs_data): New function.
12774         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12775         (Relobj::gc_process_relocs): New function.
12776         (Relobj::do_gc_process_relocs): New pure virtual function.
12777         (Relobj::sd_): New data member.
12778         (Sized_relobj::is_output_section_offset_invalid): New function.
12779         (Sized_relobj::do_gc_process_relocs): New function.
12780         * options.h (General_options::gc_sections): Modify to not be a no-op.
12781         (General_options::print_gc_sections): New option.
12782         * plugin.cc (Plugin_finish::run): Remove function call to
12783         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12784         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12785         * reloc.cc (Read_relocs::run): Add task to process relocs and
12786         determine unreferenced sections when doing garbage collection.
12787         (Gc_process_relocs): New class.
12788         (Sized_relobj::do_gc_process_relocs): New function.
12789         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12790         sections that are garbage collected.
12791         * reloc.h (Gc_process_relocs): New class.
12792         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12793         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12794         symbols whose corresponding sections are garbage collected.
12795         (Symbol_table::Symbol_table): Add new parameter for the garbage
12796         collection object.
12797         (Symbol_table::gc_mark_undef_symbols): New function.
12798         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12799         (Symbol_table::gc_mark_dyn_syms): New function.
12800         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12801         as garbage.
12802         (Symbol_table::add_from_object): Likewise.
12803         (Symbol_table::add_from_relobj): When building shared objects, do not
12804         treat externally visible symbols as garbage.
12805         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12806         table information for static and relocatable links.
12807         * symtab.h (Symbol_table::set_gc): New function.
12808         (Symbol_table::gc): New function.
12809         (Symbol_table::gc_mark_undef_symbols): New function.
12810         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12811         (Symbol_table::gc_mark_dyn_syms): New function.
12812         (Symbol_table::gc_): New data member.
12813         * target.h (Sized_target::gc_process_relocs): New pure virtual
12814         function.
12815         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12816         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12817
12818 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12819
12820         * options.h (General_options::gc_sections): Define as a no-op for now.
12821         (General_options::no_keep_memory): Ditto.
12822         (General_options::Bshareable): Define.
12823         * options.cc (General_options::finalize): Honor -Bshareable.
12824
12825 2009-01-20  Andreas Schwab  <schwab@suse.de>
12826
12827         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12828         read the value in the contents, since we don't use it.  Use the
12829         template endianness when writing.
12830         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12831
12832 2009-01-19  Andreas Schwab  <schwab@suse.de>
12833
12834         * configure.tgt (powerpc64-*): Fix targ_obj.
12835
12836 2009-01-15  Ian Lance Taylor  <iant@google.com>
12837
12838         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12839         local symbols when stripping all symbols.
12840
12841 2009-01-14  Cary Coutant  <ccoutant@google.com>
12842
12843         * output.cc (Output_reloc): Add explicit instantiations.
12844
12845 2009-01-14  Cary Coutant  <ccoutant@google.com>
12846
12847         * archive.cc (Archive::get_elf_object_for_member): Remove call
12848         to File_read::claim_for_plugin.
12849         * descriptors.cc (Descriptors::open): Remove reference to
12850         is_claimed.
12851         (Descriptors::claim_for_plugin): Remove.
12852         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12853         (Descriptors::is_claimed): Remove.
12854         (claim_descriptor_for_plugin): Remove.
12855         * fileread.cc (File_read::claim_for_plugin): Remove.
12856         * fileread.h (File_read::claim_for_plugin): Remove.
12857         (File_read::descriptor): Reopen descriptor if necessary.
12858         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12859         (Plugin_manager::all_symbols_read): Add task parameter. Change
12860         all callers.
12861         (Plugin_manager::get_input_file): New function.
12862         (Plugin_manager::release_input_file): New function.
12863         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12864         corresponding data member.
12865         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12866         and pass to base constructor. Change all callers.
12867         (get_input_file, release_input_file): New functions.
12868         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12869         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12870         (Plugin_manager::all_symbols_read): Add task parameter.
12871         (Plugin_manager::get_input_file): New function.
12872         (Plugin_manager::release_input_file): New function.
12873         (Plugin_manager::task_): New data member.
12874         (Pluginobj::Pluginobj): Add filesize parameter.
12875         (Pluginobj::filename): New function.
12876         (Pluginobj::descriptor): New function.
12877         (Pluginobj::filesize): New function.
12878         (Pluginobj::filesize_): New data member.
12879         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12880         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12881         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12882
12883         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12884         with archive libraries.
12885         * testsuite/Makefile.in: Regenerate.
12886         * testsuite/plugin_test.c (struct sym_info): New type.
12887         (get_input_file, release_input_file): New static variables.
12888         (onload): Capture new transfer vector entries.
12889         (claim_file_hook): Stop reading at end of file according to filesize.
12890         Factor out parsing of readelf output into separate function.
12891         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12892         APIs and get the source file name from the symbol table.  Convert
12893         source file name to corresponding object file name.  Print info
12894         message when adding new input files.
12895         (parse_readelf_line): New function.
12896         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12897         * testsuite/plugin_test_2.sh: Likewise.
12898         * testsuite/plugin_test_3.sh: Likewise.
12899         * testsuite/plugin_test_4.sh: New test case.
12900
12901 2009-01-07  Ian Lance Taylor  <iant@google.com>
12902
12903         * version.cc (version_string): Bump to 1.8.
12904
12905 2008-12-23  Cary Coutant  <ccoutant@google.com>
12906
12907         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12908         * plugin.cc (Plugin_manager::finish): Rename as
12909         layout_deferred_objects.  Move cleanup to separate function.
12910         (Plugin_manager::cleanup): New function.
12911         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12912         separately.
12913         * plugin.h (Plugin_manager::finish): Rename as
12914         layout_deferred_objects.
12915         (Plugin_manager::cleanup): New function.
12916         (Plugin_manager::cleanup_done): New field.
12917
12918 2008-12-23  Cary Coutant  <ccoutant@google.com>
12919
12920         * plugin.cc (is_visible_from_outside): New function.
12921         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12922         so we don't return "IR only" status for exported symbols or -r links.
12923
12924         * testsuite/Makefile.am (plugin_test_3): New test case.
12925         * testsuite/Makefile.in: Regenerate.
12926         * testsuite/plugin_test_3.sh: New file.
12927
12928 2008-12-22  Cary Coutant  <ccoutant@google.com>
12929
12930         * object.cc (Sized_relobj::layout_section): New function.
12931         (Sized_relobj::do_layout): Defer layout of input sections until after
12932         plugin has provided replacement files.
12933         (Sized_relobj::do_layout_deferred_sections): New function.
12934         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12935         (Relobj::layout_deferred_sections): New function.
12936         (Relobj::do_layout_deferred_sections): New function.
12937         (Sized_relobj::do_layout_deferred_sections): New function.
12938         (Sized_relobj::layout_section): New function.
12939         (Sized_relobj::Deferred_layout): New structure.
12940         (Sized_relobj::deferred_layout_): New field.
12941         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12942         Change all callers.  Layout deferred sections.
12943         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12944         references.
12945         (Plugin_hook::run): Move code from do_plugin_hook inline.
12946         (Plugin_hook::do_plugin_hook): Remove.
12947         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12948         (Plugin_manager::finish): Renamed, was cleanup.
12949         (Plugin_manager::should_defer_layout): New function.
12950         (Plugin_manager::add_deferred_layout_object): New function.
12951         (Plugin_manager::Deferred_layout_list): New type.
12952         (Plugin_manager::deferred_layout_objects_): New field.
12953         (Plugin_hook::do_plugin_hook): Remove.
12954
12955 2008-12-17  Ian Lance Taylor  <iant@google.com>
12956
12957         * options.h (class General_options): Add --no case for
12958         --export-dynamic.
12959
12960 2008-12-16  Cary Coutant  <ccoutant@google.com>
12961
12962         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12963         vector.
12964         (Plugin_manager::claim_file): Create plugin object even if
12965         plugin did not call the add_symbols callback.
12966         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12967         asking for more symbols than were added.
12968         * testsuite/Makefile.am (plugin_test_1): Add test case with
12969         no global symbols.
12970         (empty.syms): New target.
12971         * testsuite/Makefile.in: Regenerate.
12972         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12973         message. Don't call add_symbols if no globals.
12974         (all_symbols_read_hook): Don't provide replacement for empty
12975         claimed file.
12976
12977 2008-12-12  Ian Lance Taylor  <iant@google.com>
12978
12979         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12980         r_type == 0 for a local symbol with r_sym == 0.
12981         (scan_relocatable_relocs): Pass r_sym to
12982         local_non_section_strategy.
12983         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12984         r_sym parameter.
12985
12986         * configure.ac: Update test for TLS descriptors: they are
12987         supported as of glibc 2.9.
12988         * configure: Rebuild.
12989
12990 2008-12-11  Ian Lance Taylor  <iant@google.com>
12991
12992         PR 7091
12993         * target-reloc.h (Default_scan_relocatable_relocs): For each
12994         function, map r_type == 0 to RELOC_DISCARD.
12995
12996 2008-12-10  Cary Coutant  <ccoutant@google.com>
12997
12998         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12999         object to override a kept COMDAT group from a plugin object.
13000
13001 2008-12-09  Ian Lance Taylor  <iant@google.com>
13002
13003         PR 7088
13004         * yyscript.y (file_cmd): Handle INPUT.
13005
13006         * testsuite/initpri1.c: Change all declarations to be full
13007         prototypes by adding void, to avoid compiler warnings.
13008
13009 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13010
13011         * options.cc (General_options::parse_plugin_opt): New.
13012         (General_options::add_plugin): The argument now is just the filename.
13013         (General_options::add_plugin_option): New.
13014         * options.h (plugin_opt): New.
13015         (add_plugin): Change argument name.
13016         (add_plugin_option): New.
13017         * plugin.cc (Plugin::load): Don't parse the plugin option.
13018         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13019         (Plugin::add_option): New.
13020         (Plugin::args_): Change type.
13021         (Plugin::filename_): New.
13022         (Plugin_manager::add_plugin_option): New.
13023         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13024         * testsuite/Makefile.in: Regenerate.
13025
13026 2008-12-05  Cary Coutant  <ccoutant@google.com>
13027
13028         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13029         Handle --strip-lto-sections option.
13030         * options.h (strip_lto_sections): New option.
13031
13032 2008-12-01  Cary Coutant  <ccoutant@google.com>
13033
13034         * plugin.cc (ld_plugin_message): Change format parameter to const.
13035         Fix mismatch between new[] and delete.
13036
13037 2008-11-14  Cary Coutant  <ccoutant@google.com>
13038
13039         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13040         instead of -1U.
13041
13042 2008-11-05  Craig Silverstein  <csilvers@google.com>
13043
13044         * options.cc (General_options::parse_dynamic_list): New function.
13045         * options.h (General_options): New flags dynamic_list,
13046         dynamic_list_data, dynamic_list_cpp_new, and
13047         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13048         (General_options::in_dynamic_list): New function.
13049         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13050         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13051         (Lex::can_continue_name): Likewise.
13052         (yylex): Likewise.
13053         (read_script_file): New parameter script_options.
13054         (read_dynamic_list): New function.
13055         (Script_options::define_dynamic_list): New function.
13056         (dynamic_list_keyword_parsecodes): New variable.
13057         (dynamic_list_keywords): New variable.
13058         * script.h (Script_options::define_dynamic_list): New function
13059         prototype.
13060         (read_dynamic_list): New function prototype.
13061         * symtab.cc (strprefix): New macro.
13062         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13063         dynamic_list_data, dynamic_list_cpp_new, and
13064         dynamic_list_cpp_typeinfo.
13065         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13066         (dynamic_list_expr): New rule.
13067         (dynamic_list_nodes): Likewise.
13068         (dynamic_list_node): Likewise.
13069         * testsuite/Makefile.am (dynamic_list): New test.
13070         * testsuite/Makefile.in: Regenerated.
13071         * testsuite/dynamic_list.t: New file.
13072         * testsuite/dynamic_list.sh: New file.
13073
13074 2008-11-05  Craig Silverstein  <csilvers@google.com>
13075
13076         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13077         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13078         (t11_last): Likewise.
13079         * testsuite/ver_test_6.c (main): Likewise.
13080
13081 2008-10-07  Cary Coutant  <ccoutant@google.com>
13082
13083         * options.c (General_options::finalize): Add check for -static and
13084         -shared.
13085         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13086         is not empty.
13087
13088 2008-10-02  Cary Coutant  <ccoutant@google.com>
13089
13090         * plugin.cc (make_sized_plugin_object): Fix conditional
13091         compilation to work when not all targets are enabled.
13092
13093 2008-09-29  Cary Coutant  <ccoutant@google.com>
13094
13095         * archive.cc (Archive::get_file_and_offset): Use filename instead
13096         of name to get library path.
13097         (Archive::include_member): Unlock external member of a thin archive.
13098
13099         * testsuite/Makefile.am (TEST_AR): New variable.
13100         (thin_archive_test_1): New test.
13101         (thin_archive_test_2): New test.
13102         * testsuite/Makefile.in: Regenerate.
13103         * testsuite/thin_archive_main.cc: New file.
13104         * testsuite/thin_archive_test_1.cc: New file.
13105         * testsuite/thin_archive_test_2.cc: New file.
13106         * testsuite/thin_archive_test_3.cc: New file.
13107         * testsuite/thin_archive_test_4.cc: New file.
13108
13109 2008-09-29  Cary Coutant  <ccoutant@google.com>
13110
13111         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13112         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13113         instead of -1U.
13114         (Sized_relobj::do_finalize_local_symbols): Likewise.
13115         (Sized_relobj::map_to_kept_section): Likewise.
13116         * object.h (Sized_relobj::invalid_address): New constant.
13117         (Sized_relobj::do_output_section_offset): Check for invalid_address
13118         and return -1ULL.
13119         * output.cc (Output_reloc::local_section_offset): Use constant
13120         invalid_address instead of -1U.
13121         (Output_reloc::get_address): Likewise.
13122         (Output_section::output_address): Change -1U to -1ULL.
13123         * output.h (Output_reloc::invalid_address): New constant.
13124         * reloc.cc (Sized_relobj::write_sections): Use constant
13125         invalid_address instead of -1U.
13126         (Sized_relobj::relocate_sections): Likewise.
13127         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13128         values for merge sections.
13129         * target-reloc.h (relocate_for_relocatable): Use constant
13130         invalid_address instead of -1U.
13131
13132 2008-09-19  Cary Coutant  <ccoutant@google.com>
13133
13134         Add plugin functionality for link-time optimization (LTO).
13135         * configure.ac (plugins): Add --enable-plugins option.
13136         * configure: Regenerate.
13137         * config.in: Regenerate.
13138         * Makefile.am (LIBDL): New variable.
13139         (CCFILES): Add plugin.cc.
13140         (HFILES): Add plugin.h.
13141         (ldadd_var): Add LIBDL.
13142         * Makefile.in: Regenerate.
13143
13144         * archive.cc: Include "plugin.h".
13145         (Archive::setup): Don't preread archive symbols when using a plugin.
13146         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13147         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13148         files.
13149         (Archive::include_member): Add symbols from plugin objects.
13150         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13151         * descriptors.cc (Descriptors::open): Check for file descriptors
13152         abandoned by plugins.
13153         (Descriptors::claim_for_plugin): New function.
13154         * descriptors.h (Descriptors::claim_for_plugin): New function.
13155         (Open_descriptor::is_claimed): New field.
13156         (claim_descriptor_for_plugin): New function.
13157         * fileread.cc (File_read::claim_for_plugin): New function.
13158         * fileread.h (File_read::claim_for_plugin): New function.
13159         (File_read::descriptor): New function.
13160         * gold.cc: Include "plugin.h".
13161         (queue_initial_tasks): Add task to call plugin hooks for generating
13162         new object files.
13163         * main.cc: Include "plugin.h".
13164         (main): Load plugin libraries.
13165         * object.h (Pluginobj): Declare.
13166         (Object::pluginobj): New function.
13167         (Object::do_pluginobj): New function.
13168         (Object::set_target): New function.
13169         * options.cc: Include "plugin.h".
13170         (General_options::parse_plugin): New function.
13171         (General_options::General_options): Initialize plugins_ field.
13172         (General_options::add_plugin): New function.
13173         * options.h (Plugin_manager): Declare.
13174         (General_options): Add --plugin option.
13175         (General_options::has_plugins): New function.
13176         (General_options::plugins): New function.
13177         (General_options::add_plugin): New function.
13178         (General_options::plugins_): New field.
13179         * plugin.cc: New file.
13180         * plugin.h: New file.
13181         * readsyms.cc: Include "plugin.h".
13182         (Read_symbols::do_read_symbols): Check for archive before checking
13183         for ELF file.  Call plugin hooks to claim files.
13184         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13185         from a real object file; force override when processing replacement
13186         files.
13187         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13188         (Symbol::init_base_object): Likewise.
13189         (Symbol::init_base_output_data): Likewise.
13190         (Symbol::init_base_output_segment): Likewise.
13191         (Symbol::init_base_constant): Likewise.
13192         (Symbol::init_base_undefined): Likewise.
13193         (Symbol::output_section): Assert that object is not a plugin.
13194         (Symbol_table::add_from_pluginobj): New function.
13195         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13196         undefined.
13197         (Symbol_table::sized_write_globals): Likewise.
13198         (Symbol_table::add_from_pluginobj): Instantiate template.
13199         * symtab.h (Sized_pluginobj): Declare.
13200         (Symbol::in_real_elf): New function.
13201         (Symbol::set_in_real_elf): New function.
13202         (Symbol::in_real_elf_): New field.
13203         (Symbol_table::add_from_pluginobj): New function.
13204
13205         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13206         (LIBDL): New variable.
13207         (LDADD): Add LIBDL.
13208         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13209         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13210         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13211         (MOSTLYCLEANFILES): Likewise.
13212         * testsuite/Makefile.in: Regenerate.
13213         * testsuite/plugin_test.c: New file.
13214         * testsuite/plugin_test_1.sh: New file.
13215         * testsuite/plugin_test_2.sh: New file.
13216
13217 2008-09-16  Ian Lance Taylor  <iant@google.com>
13218
13219         * target-reloc.h (relocate_section): Check whether a symbol is
13220         defined by the ABI before reporting an undefined symbol error.
13221         * target.h (Target::is_defined_by_abi): Make parameter const.
13222         (Target::do_is_defined_by_abi): Likewise.
13223         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13224         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13225         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13226         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13227         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13228         * testsuite/Makefile.in: Rebuild.
13229
13230         * fileread.cc (make_view): Add casts to avoid warning.
13231
13232 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13233
13234         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13235         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13236
13237 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13238
13239         * options.h (General_options::output_is_executable): New.
13240         (General_options::output_is_pie): New.
13241         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13242         for shared libraries.
13243         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13244
13245 2008-09-11  Chris Demetriou  <cgd@google.com>
13246
13247         * options.h (origin): New -z option.
13248         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13249         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13250         in DT_FLAGS_1.
13251
13252 2008-09-05  Cary Coutant  <ccoutant@google.com>
13253
13254         * fileread.cc (File_read::make_view): Add check for attempt to map
13255         beyond end of file.
13256
13257 2008-09-05  Cary Coutant  <ccoutant@google.com>
13258
13259         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13260         explicit instantiations.
13261
13262 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13263
13264         PR gold/6858
13265         * options.cc (General_options::finalize): Allow undefined symbols
13266         in shlibs if linking -shared.
13267
13268         PR gold/6859
13269         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13270         symbols as not needing a dynsym entry.
13271
13272 2008-08-20  Craig Silverstein  <csilvers@google.com>
13273
13274         * fileread.cc (File_read::open): Do not lock the file unless it
13275         was successfully opened.
13276
13277 2008-08-14  Cary Coutant  <ccoutant@google.com>
13278
13279         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13280         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13281         * testsuite/tls_test.cc (struct int128): 128-bit struct
13282         for testing TLS relocs with non-zero addend.
13283         (v12): New TLS variable.
13284         (t12): New test.
13285         (t_last): Add check for v12.
13286         * testsuite/tls_test.h (t12): New function.
13287         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13288
13289 2008-08-13  Ian Lance Taylor  <iant@google.com>
13290
13291         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13292         set tls_segment_ or relro_segment_.
13293         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13294         when appropriate.
13295         * output.h (Output_section::clear_is_relro): New function.
13296         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13297         sections specially even when output_data_ is empty.
13298         (Output_segment::maximum_alignment): When first section is relro,
13299         only force alignment for PT_LOAD segments.
13300         * script.cc (script_data_segment_align): New function.
13301         (script_data_segment_relro_end): New function.
13302         * script-c.h (script_data_segment_align): Declare.
13303         (script_data_segment_relro_end): Declare.
13304         * script-sections.h (class Script_sections): Declare
13305         data_segment_align and data_segment_relro_end.  Add fields
13306         segment_align_index_ and saw_relro_end_.
13307         * script-sections.cc (class Sections_element): Add set_is_relro
13308         virtual function.  Add new bool* parameter to place_orphan_here.
13309         Add get_output_section virtual function.
13310         (class Output_section_definition): Add set_is_relro.  Add new
13311         bool* parameter to place_orphan_here.  Add get_output_section.
13312         Add is_relro_ field.
13313         (Output_section_definition::Output_section_definition): Initialize
13314         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13315         and is_relro_ fields.
13316         (Output_section_definition::place_orphan_here): Add is_relro
13317         parameter.
13318         (Output_section_definition::set_section_addresses): Set relro for
13319         output section.
13320         (Output_section_definition::alternate_constraint): Likewise.
13321         (class Orphan_output_section): Add new bool* parameter to
13322         place_orphan_here.  Add get_output_section.
13323         (Orphan_output_section::place_orphan_here): Add is_relro
13324         parameter.
13325         (Script_sections::Script_sections): Initialize
13326         data_segment_align_index_ and saw_relro_end_.
13327         (Script_sections::data_segment_align): New function.
13328         (Script_sections::data_segment_relro_end): New function.
13329         (Script_sections::place_orphan): Set or clear is_relro.
13330         (Script_sections::set_section_addresses): Force alignment of first
13331         TLS section.
13332         * yyscript.y (exp): Call script_data_segment_align and
13333         script_data_segment_relro_end.
13334         * testsuite/relro_script_test.t: New file.
13335         * testsuite/relro_test.cc (using_script): Declare.
13336         (t1, t2): Test using_script.
13337         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13338         (relro_script_test_SOURCES): Define.
13339         (relro_script_test_DEPENDENCIES): Define.
13340         (relro_script_test_LDFLAGS): Define.
13341         (relro_script_test_LDADD): Define.
13342         (relro_script_test.so): New target.
13343         * testsuite/Makefile.in: Rebuild.
13344
13345 2008-08-06  Cary Coutant <ccoutant@google.com>
13346
13347         * archive.cc (Archive::total_archives, Archive::total_members)
13348         (Archive::total_members_loaded): New variables.
13349         (Archive::setup): Add parameter.  Add option to preread
13350         archive symbols.
13351         (Archive::read_armap): Add counter.
13352         (Archive::get_file_and_offset): New function.
13353         (Archive::get_elf_object_for_member): New function.
13354         (Archive::read_all_symbols): New function.
13355         (Archive::read_symbols): New function.
13356         (Archive::add_symbols): Add counters.
13357         (Archive::include_all_members): Use armap to find members if it's
13358         already built.
13359         (Archive::include_member): Skip reading symbols if already read.
13360         Factored code into Archive::get_file_and_offset and
13361         Archive::get_elf_object_for_member.  Changed call to
13362         Mapfile::report_include_archive_member.
13363         (Archive::print_stats): New function.
13364         * archive.h: Declare Object and Read_symbols_data classes.
13365         (Archive::Archive): Add initializers for new members.
13366         (Archive::setup): Add parameter.
13367         (Archive::print_stats): New function.
13368         (Archive::total_archives, Archive::total_members)
13369         (Archive::total_members_loaded): New variables.
13370         (Archive::get_file_and_offset): New function.
13371         (Archive::get_elf_object_for_member): New function.
13372         (Archive::read_all_symbols): New function.
13373         (Archive::read_symbols): New function.
13374         (Archive::Archive_member): New class.
13375         (Archive::members_): New member.
13376         (Archive::num_members_): New member.
13377         * main.cc: Include archive.h.
13378         (main): Call Archive::print_stats.
13379         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13380         archive parameter; member_name is now the fully-decorated name.
13381         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13382         * options.h: (General_options): Add --preread-archive-symbols option.
13383         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13384         Archive::setup.
13385
13386 2008-08-04  Ian Lance Taylor  <iant@google.com>
13387
13388         * symtab.h (Symbol::use_plt_offset): New function.
13389         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13390         * powerpc.cc (Relocate::relocate): Likewise.
13391         * sparc.cc (Relocate::relocate): Likewise.
13392         * x86_64.cc (Relocate::relocate): Likewise.
13393         * testsuite/weak_plt.sh: New test.
13394         * testsuite/weak_plt_main.cc: New test.
13395         * testsuite/weak_plt_shared.cc: New test.
13396         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13397         (check_PROGRAMS): Add weak_plt.
13398         (check_DATA): Add weak_plt_shared.so.
13399         (weak_plt_main_pic.o, weak_plt): New targets.
13400         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13401         * testsuite/Makefile.in: Rebuild.
13402
13403         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13404         gcctestdir/ld.
13405         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13406         * testsuite/Makefile.in: Rebuild.
13407
13408 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13409
13410         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13411         * Makefile.in: Regenerate.
13412         * po/POTFILES.in: Regenerate.
13413
13414 2008-07-29  Ian Lance Taylor  <iant@google.com>
13415
13416         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13417         symbols before other symbols.
13418         * testsuite/script_test_2.cc (test_addr): Declare.
13419         (test_addr_alias): Declare.
13420         (main): Check that test_addr and test_addr_alias have the right
13421         values.
13422         * testsuite/script_test_2.t: Define test_addr_alias and
13423         test_addr.
13424
13425 2008-07-24  Ian Lance Taylor  <iant@google.com>
13426
13427         PR 5990
13428         * descriptors.cc: New file.
13429         * descriptors.h: New file.
13430         * gold-threads.h (class Hold_optional_lock): New class.
13431         * fileread.cc: Include "descriptors.h".
13432         (File_read::~File_read): Release descriptor rather than closing
13433         it.
13434         (File_read::open) [file]: Call open_descriptor rather than open.
13435         Set is_descriptor_opened_.
13436         (File_read::open) [memory]: Assert that descriptor is not open.
13437         (File_read::reopen_descriptor): New function.
13438         (File_read::release): Release descriptor.
13439         (File_read::do_read): Make non-const.  Reopen descriptor.
13440         (File_read::read): Make non-const.
13441         (File_read::make_view): Reopen descriptor.
13442         (File_read::do_readv): Likewise.
13443         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13444         Update declarations.
13445         * layout.cc: Include "descriptors.h".
13446         (Layout::create_build_id): Use open_descriptor rather than open.
13447         * output.cc: Include "descriptors.h".
13448         (Output_file::open): Use open_descriptor rather than open.
13449         * archive.cc (Archive::const_iterator): Change Archive to be
13450         non-const.
13451         (Archive::begin, Archive::end): Make non-const.
13452         (Archive::count_members): Likewise.
13453         * archive.h (class Archive): Update declarations.
13454         * object.h (Object::read): Make non-const.
13455         * Makefile.am (CCFILES): Add descriptors.cc.
13456         (HFILES): Add descriptors.h.
13457         * Makefile.in: Rebuild.
13458
13459         PR 6716
13460         * gold.h: Always include <clocale>.  Add Solaris workarounds
13461         following code in binutils/sysdep.h.
13462
13463         PR 6048
13464         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13465         this->eh_frame_hdr_ is NULL before using it.
13466
13467         * dynobj.cc (Versions::Versions): Update comment.
13468
13469         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13470         the base version name.
13471
13472         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13473         array size plus one.
13474         (Stringpool_template::set_string_offsets): Subtract one from key
13475         before using it as an array index.
13476         (Stringpool_template::get_offset_with_length): Likewise.
13477         (Stringpool_template::write_to_buffer): Likewise.
13478         * stringpool.h (Stringpool_template::get_offset_from_key):
13479         Likewise.
13480
13481 2008-07-23  Ian Lance Taylor  <iant@google.com>
13482
13483         PR 6658
13484         * object.h (Merged_symbol_value::value): Do our best to handle a
13485         negative addend.
13486
13487         PR 6647
13488         * script.cc (Version_script_info::get_versions): Don't add empty
13489         version tag to return value.
13490         (Version_script_info::get_symbol_version_helper): Change return
13491         type to bool.  Add pversion parameter.  Change all callers.
13492         (script_register_vers_node): Don't require a non-NULL tag.
13493         * script.h (class Version_script_info): Update declarations.
13494         (Version_script_info::get_symbol_version): Change return type to
13495         bool.  Add version parameter.  Change all callers.
13496         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13497         handling.  Handle an empty version from a version script.
13498         (Symbol_table::define_special_symbol): Likewise.
13499         * testsuite/ver_test_10.script: New file.
13500         * testsuite/ver_test_10.sh: New file.
13501         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13502         (check_DATA): Add ver_test_10.syms.
13503         (ver_test_10.syms, ver_test_10.so): New target.
13504         * testsuite/Makefile.in: Rebuild.
13505
13506 2008-07-23  Simon Baldwin  <simonb@google.com>
13507
13508         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13509         to zero for undefined symbols from dynamic libraries.
13510
13511 2008-07-23  Ian Lance Taylor  <iant@google.com>
13512
13513         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13514         Change all callers.
13515         * symtab.h (class Symbol_table): Update declaration.
13516         * testsuite/ver_test_9.cc: New file.
13517         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13518         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13519         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13520         (ver_test_9.so, ver_test_9.o): New targets.
13521         * testsuite/Makefile.in: Rebuild.
13522
13523 2008-07-22  Ian Lance Taylor  <iant@google.com>
13524
13525         * options.h (class General_options): Define --check-sections.
13526         * layout.cc (Layout::set_segment_offsets): Handle
13527         --check-sections.
13528
13529         * options.h (class General_options): Define -n/--nmagic and
13530         -N/--omagic.
13531         * options.cc (General_options::finalize): For -n/--nmagic or
13532         -N/--omagic, set -static.
13533         * layout.cc (Layout::attach_allocated_section_to_segment): If
13534         -N/--omagic, don't put read-only and read-write sections in
13535         different segments.
13536         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13537         finding a read-only segment.
13538         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13539         don't set the minimum segment alignment to the common page size,
13540         and don't set the file offset to the address modulo the page size.
13541         * script-sections.cc (Script_sections::create_segments): If
13542         -n/--omagic, don't put read-only and read-write sections in
13543         different segments.
13544
13545         * cref.cc: New file.
13546         * cref.h: New file.
13547         * options.h (class General_options): Add --print-symbol-counts.
13548         * main.cc (main): Issue defined symbol report if requested.
13549         * archive.cc (Archive::interpret_header): Make into a const member
13550         function.
13551         (Archive::add_symbols): Call Input_objects::archive_start and
13552         archive_stop.
13553         (Archive::const_iterator): Define new class.
13554         (Archive::begin, Archive::end): New functions.
13555         (Archive::include_all_members): Rewrite to use iterator.
13556         (Archive::count_members): New function.
13557         * archive.h (class Archive): Update declarations.
13558         (Archive::filename): New function.
13559         * object.cc: Include "cref.h".
13560         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13561         (Sized_relobj::do_get_global_symbol_counts): New function.
13562         (Input_objects::add_object): Add object to cross-referencer.
13563         (Input_objects::archive_start): New function.
13564         (Input_objects::archive_stop): New function.
13565         (Input_objects::print_symbol_counts): New function.
13566         * object.h: Declare Cref and Archive.
13567         (Object::get_global_symbol_counts): New function.
13568         (Object::do_get_global_symbol_counts): New pure virtual function.
13569         (class Sized_relobj): Add defined_count_ field.  Update
13570         declarations.
13571         (class Input_objects): Add cref_ field.  Update constructor.
13572         Update declarations.
13573         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13574         defined_count_.
13575         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13576         symbol counts.
13577         (Sized_dynobj::do_get_global_symbol_counts): New function.
13578         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13579         defined_count_.  Update declarations.  Define Symbols typedef.
13580         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13581         parameter.  Change all callers.
13582         (Symbol_table::add_from_dynobj): Add sympointers and defined
13583         parameters.  Change all callers.
13584         * symtab.h (class Symbol_table): Update declarations.
13585         * Makefile.am (CCFILES): Add cref.cc.
13586         (HFILES): Add cref.h.
13587         * Makefile.in: Rebuild.
13588
13589 2008-07-22  Simon Baldwin  <simonb@google.com>
13590
13591         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13592         to zero when writing undefined symbols.
13593
13594 2008-07-22  Ian Lance Taylor  <iant@google.com>
13595
13596         * output.cc (Output_section::add_input_section): Don't try to
13597         merge empty merge sections.
13598
13599 2008-07-21  Craig Silverstein  <csilvers@google.com>
13600
13601         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13602         Include symbol version in error message.
13603
13604 2008-07-20  Chris Demetriou  <cgd@google.com>
13605
13606         * configure.ac (gold_cv_c_random_seed): New configured variable.
13607         (RANDOM_SEED_CFLAGS): New substituted variable.
13608         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13609         * configure: Rebuild.
13610         * Makefile.in: Likewise.
13611         * testsuite/Makefile.in: Likewise.
13612
13613 2008-07-18  Ian Lance Taylor  <iant@google.com>
13614
13615         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13616         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13617         * testsuite/ver_test_main.cc (main): Call t4.
13618         (t4, t4_2a): Define.
13619         * testsuite/ver_test_2.cc (t4_2): Define.
13620         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13621         * testsuite/ver_test_4.cc (t4_2a): Define.
13622         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13623         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13624
13625 2008-07-17  Ian Lance Taylor  <iant@google.com>
13626
13627         * dynobj.cc (Versions::add_def): If we give an error about a
13628         missing version, go ahead and create the version anyhow.
13629
13630 2008-07-10  Ian Lance Taylor  <iant@google.com>
13631
13632         Handle output sections with more than 0x7fffffff bytes.
13633         * object.h (class Relobj): Change map_to_output_ to
13634         output_sections_, and just keep a section pointer.  Change all
13635         uses.  Move comdat group support to Sized_relobj.
13636         (Relobj::is_section_specially_mapped): Remove.
13637         (Relobj::output_section): Remove poff parameter.  Change all
13638         callers.
13639         (Relobj::output_section_offset): New function.
13640         (Relobj::set_section_offset): Rewrite.
13641         (Relobj::map_to_output): Remove.
13642         (Relobj::output_sections): New function.
13643         (Relobj::do_output_section_offset): New pure virtual function.
13644         (Relobj::do_set_section_offset): Likewise.
13645         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13646         group support from Relobj.  Update declarations.
13647         (Sized_relobj::get_output_section_offset): New function.
13648         (Sized_relobj::do_output_section_offset): New function.
13649         (Sized_relobj::do_set_section_offset): New function.
13650         * object.cc (Relobj::output_section_address): Remove.
13651         (Sized_relobj::Sized_relobj): Initialize new fields.
13652         (Sized_relobj::include_section_group): Cast find_kept_object to
13653         Sized_relobj.
13654         (Sized_relobj::include_linkonce_section): Likewise.
13655         (Sized_relobj::do_layout): Use separate arrays for output section
13656         and output offset.
13657         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13658         output_sections.
13659         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13660         output_sections and section_offsets.
13661         (Sized_relobj::write_local_symbols): Likewise.
13662         (map_to_kept_section): Compute output address directly.
13663         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13664         output_sections and section_offsets.
13665         (Sized_relobj::write_sections): Likewise.
13666         (Sized_relobj::relocate_sections): Likewise.
13667         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13668         * output.h (class Output_reloc): Update declarations.  Change
13669         u2_.relobj to Sized_relobj*.
13670         (class Output_data_reloc): Change add functions to use
13671         Sized_relobj*.
13672         * output.cc (Output_reloc::Output_reloc): Change relobj to
13673         Sized_relobj*.
13674         (Output_reloc::local_section_offset): Change return type to
13675         Elf_Addr.  Use get_output_section_offset.
13676         (Output_reloc::get_address): Likewise.
13677         (Output_section::is_input_address_mapped): Don't call
13678         is_section_specially_mapped.
13679         (Output_section::output_offset): Likewise.
13680         (Output_section::output_address): Likewise.
13681         (Output_section::starting_output_address): Likewise.
13682         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13683         parameter to Sized_relobj*.
13684         (Copy_relocs::need_copy_reloc): Likewise.
13685         (Copy_relocs::save): Likewise.
13686         * copy-relocs.h (class Copy_relocs): Update declarations.
13687         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13688         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13689         * target-reloc.h (relocate_for_relocatable): Change
13690         offset_in_output_section type to Elf_Addr.  Change code that uses
13691         it as well.
13692         * layout.cc (Layout::layout): Always set *off.
13693         * mapfile.cc (Mapfile::print_input_section): Use
13694         output_section_offset.
13695         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13696         Sized_relobj*.
13697         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13698         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13699         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13700
13701 2008-07-03  Ian Lance Taylor  <iant@google.com>
13702
13703         * layout.cc (Layout::include_section): Do not discard unrecognized
13704         SHT_STRTAB sections.
13705
13706 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13707
13708         * script.cc (Lex::can_continue_name): Make '?' allowable in
13709         version-script names.
13710         * testsuite/version_script.map: Change glob pattern to use '?'
13711
13712 2008-06-30  Manish Singh  <yosh@gimp.org>
13713
13714         PR 6585
13715         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13716         Correct typo.
13717
13718 2008-06-30  Ian Lance Taylor  <iant@google.com>
13719
13720         PR 6660
13721         PR 6682
13722         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13723         versions]: Don't try to read the value in the contents, since we
13724         don't use it.  Use the template endianness when writing.
13725
13726 2008-06-25  Cary Coutant  <ccoutant@google.com>
13727
13728         * fileread.cc (File_read::make_view): Assert on zero-length view.
13729         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13730         symbol table when there are no symbols to read.
13731
13732 2008-06-23  Craig Silverstein  <csilvers@google.com>
13733
13734         * version.cc (version_string): Bump to 1.7
13735
13736 2008-06-18  Craig Silverstein  <csilvers@google.com>
13737
13738         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13739         constant 0xFFFF to type Valtype.
13740         (Powerpc_relocate_functions::rel16_ha): Likewise.
13741
13742 2008-06-17  Ian Lance Taylor  <iant@google.com>
13743
13744         * output.h (Output_section::Input_section): Initialize p2align_ to
13745         zero for Output_section_data constructors.
13746         (Output_section::Input_section::addralign): If not an input
13747         section, return the alignment of the Output_section_data.
13748         * testsuite/copy_test.cc: New file.
13749         * testsuite/copy_test_1.cc: New file.
13750         * testsuite/copy_test_2.cc: New file.
13751         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13752         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13753         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13754         (copy_test_1_pic.o, copy_test_1.so): New targets.
13755         (copy_test_2_pic.o, copy_test_2.so): New targets.
13756         * testsuite/Makefile.in: Rebuild.
13757
13758         * script-sections.cc (Script_sections::place_orphan): Initialize
13759         local variable exact.
13760
13761 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13762
13763         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13764
13765 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13766             David S. Miller  <davem@davemloft.net>
13767
13768         * powerpc.cc: New file.
13769         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13770         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13771         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13772         * Makefile.in: Rebuild.
13773
13774 2008-06-09  Ian Lance Taylor  <iant@google.com>
13775
13776         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13777         <exception>.
13778         (throwing, orig_terminate): New static variables.
13779         (terminate_handler): New static function.
13780         (t2): Set terminate handler.
13781
13782 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13783
13784         PR 6584
13785         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13786         alignment.
13787
13788 2008-05-30  Cary Coutant  <ccoutant@google.com>
13789
13790         * archive.cc (Archive::include_all_members) Correct to step
13791         over symbol table and extended name table in thin archives.
13792
13793 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13794
13795         PR 6407
13796         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13797         calculation.
13798
13799 2008-05-28  Caleb Howe  <cshowe@google.com>
13800
13801         * reduced_debug_output.cc: New file.
13802         * reduced_debug_output.h: New file.
13803         * options.h (class General_options): Add --strip-debug-non-line.
13804         * options.cc (General_options::finalize): Add strip_debug_non_line
13805         to the strip heirarchy.
13806         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13807         fields.
13808         * layout.cc: Include "reduced_debug_output.h".
13809         (Layout::Layout): Initialize new fields.
13810         (line_only_debug_sections): New static array.
13811         (is_lines_only_debug_sections): New static inline function.
13812         (Layout::include_section): Handle --strip-debug-non-line.
13813         (Layout::make_output_section): If --strip-debug-non-line, build
13814         new output sections for .debug_abbrev and .debug_info.
13815         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13816         gold.  Warn about possible overflow.
13817         (read_signed_LEB_128): Likewise.
13818         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13819         (read_signed_LEB_128): Declare.
13820         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13821         (HFILES): Add reduced_debug_output.h.
13822         * Makefile.in: Rebuild.
13823
13824 2008-05-21  Ian Lance Taylor  <iant@google.com>
13825
13826         * mapfile.cc: New file.
13827         * mapfile.h: New file.
13828         * options.h (class General_options): Add -M/--print-map and -Map.
13829         * options.cc (General_options::finalize): Make -M equivalent to
13830         -Map -.
13831         * main.cc: Include <cstdio> and "mapfile.h".
13832         (main): Open mapfile if requested.
13833         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13834         constructor.  Change caller.
13835         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13836         (queue_middle_tasks): Likewise.
13837         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13838         declarations.
13839         * archive.cc: Include "mapfile.h".
13840         (Archive::add_symbols): Add mapfile parameter.  Change all
13841         callers.  Pass mapfile, symbol, and reason to include_member.
13842         (Archive::include_all_members): Add mapfile parameter.  Change all
13843         callers.
13844         (Archive::include_member): Add mapfile, sym, and why parameters.
13845         Change all callers.  Report inclusion to map file.
13846         * archive.h: Include "fileread.h".
13847         (class Archive): Update declarations.
13848         (Archive::file): New const method.
13849         (class Add_archive_symbols): Add mapfile_ field.  Update
13850         constructor.  Change all callers.
13851         * readsyms.h (class Read_symbols): Likewise.
13852         (class Finish_group): Likewise.
13853         (class Read_script): Likewise.
13854         * common.cc: Include "mapfile.h".
13855         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13856         all callers.
13857         (Symbol_table::do_allocate_commons): Likewise.
13858         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13859         symbol allocation to mapfile.
13860         * common.h (class Allocate_commons_task): Add mapfile_ field.
13861         Update constructor.  Change all callers.
13862         * symtab.h (class Symbol_table): Update declarations.
13863         * layout.cc: Include "mapfile.h".
13864         (Layout_task_runner::run): Print information to mapfile.
13865         (Layout::create_gold_note): Change Output_data_fixed_space to
13866         Output_data_zero_fill.
13867         (Layout::create_build_id): Likewise.
13868         (Layout::print_to_mapfile): New function.
13869         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13870         constructor.  Change caller.
13871         (class Layout): Declare print_to_mapfile.
13872         * output.cc (Output_section::Input_section::print_to_mapfile): New
13873         function.
13874         (Output_section::add_input_section): If producing a map, always
13875         add to input_sections_ list.
13876         (Output_section::do_print_to_mapfile): New function.
13877         (Output_segment::print_sections_to_mapfile): New function.
13878         (Output_segment::print_section_list_to_mapfile): New function.
13879         * output.h: Include "mapfile.h".
13880         (Output_data::print_to_mapfile): New function.
13881         (Output_data::do_print_to_mapfile): New virtual function.
13882         (Output_segment_headers::do_print_to_mapfile): New function.
13883         (Output_file_header::do_print_to_mapfile): New function.
13884         (Output_data_const::do_print_to_mapfile): New function.
13885         (class Output_data_const_buffer): Add map_name_ field.  Update
13886         constructor.  Change all callers.  Add do_print_to_mapfile
13887         function.
13888         (class Output_data_fixed_space): Likewise.
13889         (class Output_data_space): Likewise.
13890         (class Output_data_zero_fill): New class.
13891         (Output_data_strtab::do_print_to_mapfile): New function.
13892         (Output_data_reloc_base::do_print_to_mapfile): New function.
13893         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13894         (Output_data_group::do_print_to_mapfile): New function.
13895         (Output_data_got::do_print_to_mapfile): New function.
13896         (Output_data_dynamic::do_print_to_mapfile): New function.
13897         (Output_symtab_xindex::do_print_to_mapfile): New function.
13898         (class Output_section): Declare do_print_to_mapflie.  Declare
13899         print_to_mapfile in Input_section.
13900         (class Output_segment): Declare new functions.
13901         * object.h (Sized_relobj::symbol_count): New function.
13902         * script-sections.cc
13903         (Output_section_element_dot_assignment::set_section_addresses):
13904         Change Output_data_fixed_space to Output_data_zero_fill.
13905         (Output_data_expression::do_print_to_mapfile): New function.
13906         * script.cc (read_input_script): Add mapfile parameter.  Change
13907         all callers.
13908         * script.h (read_input_script): Update declaration.
13909         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13910         (Eh_frame::do_print_to_mapfile): New function.
13911         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13912         (Output_merge_string::do_print_to_mapfile): New function.
13913         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13914         function.
13915         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13916         function.
13917         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13918         function.
13919         * Makefile.am (CCFILES): Add mapfile.cc.
13920         (HFILES): Add mapfile.h.
13921         * Makefile.in: Rebuild.
13922
13923 2008-05-19  Ian Lance Taylor  <iant@google.com>
13924
13925         * options.h (class General_options): Add -z relro.
13926         * layout.cc (Layout::Layout): Initialize relro_segment_.
13927         (Layout::add_output_section_data): Return the output section.
13928         (Layout::make_output_section): Rcognize relro sections and mark
13929         them appropriately.
13930         (Layout::attach_allocated_section_to_segment): Put relro sections
13931         in a PT_GNU_RELRO segment.
13932         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13933         section as relro.
13934         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13935         PT_TLS segments.
13936         (Layout::linkonce_mapping): Map d.rel.ro.local to
13937         .data.rel.ro.local.
13938         (Layout::output_section_name): Us .data.rel.ro.local for any
13939         section which begins with that.
13940         * layout.h (class Layout): Update add_output_section_data
13941         declaration.  Add relro_segment_ field.
13942         * output.cc (Output_section::Output_section): Initialize is_relro_
13943         and is_relro_local_ fields.
13944         (Output_segment::add_output_section): Group relro sections.
13945         (Output_segment::is_first_section_relro): New function.
13946         (Output_segment::maximum_alignment): If there is a relro section,
13947         align the segment to the common page size.
13948         (Output_segment::set_section_addresses): Track whether we are
13949         looking at relro sections.  If the last section is a relro
13950         section, align to the common page size.
13951         (Output_segment::set_section_list_addresses): Add in_relro
13952         parameter.  Change all callers.  Align to the page size when
13953         moving from relro to non-relro section.
13954         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13955         segment.
13956         * output.h (class Output_section): Add is_relro_ and
13957         is_relro_local_ fields.
13958         (Output_section::is_relro): New function.
13959         (Output_section::set_is_relro): New function.
13960         (Output_section::is_relro_local): New function.
13961         (Output_section::set_is_relro_local): New function.
13962         (class Output_segment): Update declarations.
13963         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13964         * sparc.cc (Target_sparc::got_section): Likewise.
13965         * x86_64.cc (Target_x86_64::got_section): Likewise.
13966         * testsuite/relro_test_main.cc: New file.
13967         * testsuite/relro_test.cc: New file.
13968         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13969         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13970         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13971         (relro_test.so, relro_test_pic.o): New targets.
13972         * testsuite/Makefile.in: Rebuild.
13973
13974 2008-05-16  Ian Lance Taylor  <iant@google.com>
13975
13976         * output.cc (Output_segment::add_output_section): Remove front
13977         parameter.
13978         * output.h (class Output_segment): Remove
13979         add_initial_output_section and overloaded add_output_section.
13980         Update declaration of remaining add_output_section.
13981         * layout.cc (Layout::create_interp): Call add_output_section
13982         rather than add_initial_output_section.
13983         (Layout::finish_dynamic_section): Likewise.
13984
13985         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13986         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13987         know the dynamic type.
13988         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13989         field.  Initialize it in constructor.
13990         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13991         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13992         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13993         reloc.
13994
13995         * output.cc (Output_reloc::get_address): Change return type to
13996         Elf_Addr.
13997         * output.h (class Output_reloc): Update get_address declaration.
13998         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13999         for section addresses.
14000
14001 2008-05-09  Ian Lance Taylor  <iant@google.com>
14002
14003         PR 6493
14004         * gold.cc (gold_nomem): Use return value of write.
14005
14006 2008-05-08  Ian Lance Taylor  <iant@google.com>
14007
14008         * symtab.c (Symbol::init_base_output_data): Add version
14009         parameter.  Change all callers.
14010         (Symbol::init_base_output_segment): Likewise.
14011         (Symbol::init_base_constant): Likewise.
14012         (Symbol::init_base_undefined): Likewise.
14013         (Sized_symbol::init_output_data): Likewise.
14014         (Sized_symbol::init_output_segment): Likewise.
14015         (Sized_symbol::init_constant): Likewise.
14016         (Sized_symbol::init_undefined): Likewise.
14017         (Symbol_table::do_define_in_output_data): If the new symbol has a
14018         version, mark it as the default.
14019         (Symbol_table::do_define_in_output_segment): Likewise.
14020         (Symbol_table::do_define_as_constant): Likewise.
14021         * symtab.h (class Symbol): Update declarations.
14022         (class Sized_symbol): Likewise.
14023         * resolve.cc (Symbol::override_version): New function.
14024         (Symbol::override_base): Call override_version.
14025         (Symbol::override_base_with_special): Likewise.
14026         * testsuite/ver_script_8.script: New file.
14027         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14028         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14029         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14030         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14031
14032 2008-05-06  Ian Lance Taylor  <iant@google.com>
14033
14034         PR 6049
14035         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14036         functions.
14037         (class General_options): Remove existing --undefined, and add
14038         --no-undefined instead.  Add new --undefined as synonym for -u.
14039         * archive.cc (Archive::add_symbols): Check whether symbol was
14040         named with -u.
14041         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14042         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14043         all uses.  Add IS_UNDEFINED.  Update declarations to split
14044         different versions of init_base.  Declare init_base_undefined.
14045         (Symbol::is_defined): Handle IS_UNDEFINED.
14046         (Symbol::is_undefined): Likewise.
14047         (Symbol::is_weak_undefined): Call is_undefined.
14048         (Symbol::is_absolute): Handle IS_CONSTANT.
14049         (class Sized_symbol): Update declarations to split different
14050         versions of init.  Declare init_undefined.
14051         (class Symbol_table): Declare new functions.
14052         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14053         Change all callers.
14054         (Symbol::init_base_output_data): Likewise.
14055         (Symbol::init_base_output_segment): Likewise.
14056         (Symbol::init_base_constant): Likewise.
14057         (Symbol::init_base_undefined): New function.
14058         (Sized_symbol::init_object): Rename from init.  Change all
14059         callers.
14060         (Sized_symbol::init_output_data): Likewise.
14061         (Sized_symbol::init_output_segment): Likewise.
14062         (Sized_symbol::init_constant): Likewise.
14063         (Sized_symbol::init_undefined): New function.
14064         (Symbol_table::add_undefined_symbols_from_command_line): New
14065         function.
14066         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14067         function.
14068         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14069         (Symbol::output_section): Likewise.
14070         (Symbol::set_output_section): Likewise.
14071         (Symbol_table::sized_finalize_symbol): Likewise.
14072         (Symbol_table::sized_write_globals): Likewise.
14073         * resolve.cc (Symbol_table::should_override): Likewise.
14074         (Symbol::override_base_with_special): Likewise.
14075
14076         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14077         symbol, change it to have default visibility.
14078         * testsuite/protected_1.cc: New file.
14079         * testsuite/protected_2.cc: New file.
14080         * testsuite/protected_3.cc: New file.
14081         * testsuite/protected_main_1.cc: New file.
14082         * testsuite/protected_main_2.cc: New file.
14083         * testsuite/protected_main_3.cc: New file.
14084         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14085         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14086         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14087         (protected_1.so): New target.
14088         (protected_1_pic.o, protected_2_pic.o): New targets.
14089         (protected_3_pic.o): New target.
14090         (check_PROGRAMS): Add protected_2.
14091         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14092         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14093         * testsuite/Makefile.in: Rebuild.
14094
14095         * options.h (DEFINE_var): Add set_user_set_##varname__.
14096         (DEFINE_bool_alias): New macro.
14097         (class General_options): Define -Bstatic using DEFINE_bool_alias
14098         rather than DEFINE_special.  Add --undefined as an alias for -z
14099         defs.
14100         * options.cc (General_options::parse_Bstatic): Remove.
14101
14102         * options.h (class General_options): Add --fatal-warnings.
14103         * main.cc (main): Implement --fatal-warnings.
14104         * errors.h (Errors::warning_count): New function.
14105
14106         * options.h (class General_options): Add -Bsymbolic-functions.
14107         * symtab.h (Symbol::is_preemptible): Check for
14108         -Bsymbolic-functions.
14109
14110 2008-05-05  Ian Lance Taylor  <iant@google.com>
14111
14112         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14113         as noVARNAME rather than no-VARNAME.
14114         (class General_options): Add option -z combreloc.
14115         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14116         get_address.
14117         (Output_reloc::sort_before) [SHT_REL]: New function.
14118         (Output_reloc::sort_before) [SHT_RELA]: New function.
14119         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14120         Sort_relocs_comparison.
14121         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14122         parameter.  Change all callers.
14123         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14124         sort_relocs parameter.  Change all callers.
14125         * output.cc (Output_reloc::get_address): New function, broken out
14126         of write_rel.
14127         (Output_reloc::write_rel): Call it.
14128         (Output_reloc::compare): New function.
14129         (Output_data_reloc_base::do_write): Optionally sort relocs.
14130
14131         * configure.ac: If targ_extra_obj is set, link it in.
14132         * configure.tgt: Initialize all variables.
14133         (x86_64*): Set targ_extra_obj and targ_extra_size.
14134         * configure: Rebuild.
14135
14136         * object.cc (Sized_relobj::include_section_group): Adjust section
14137         indexes read from group data.  Build vector to pass to
14138         layout_group.
14139         * layout.cc (Layout::layout_group): Add flags and shndxes
14140         parameters.  Remove contents parameter.  Change caller.  Update
14141         explicit instantiations.
14142         * layout.h (class Layout): Update layout_group declaration.
14143         * output.cc (Output_data_group::Output_data_group): Add flags and
14144         input_shndxes parameters.  Remove contents parameter.  Change
14145         caller.
14146         (Output_data_group::do_write): Change input_sections_ to
14147         input_shndxes_.
14148         * output.h (class Output_data_group): Update constructor
14149         declaration.  Rename input_sections_ to input_shndxes_.
14150         * testsuite/many_sections_test.cc: Add template.
14151
14152 2008-04-30  Cary Coutant  <ccoutant@google.com>
14153
14154         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14155
14156         * layout.cc (Layout::include_section): Refactored check for debug
14157         info section.
14158         (Layout::add_comdat): Add new parameters.  Change type
14159         of signature parameter.  Add object and shndx to signatures table.
14160         (Layout::find_kept_object): New function.
14161         * layout.h: Include <cstring>.
14162         (Layout::is_debug_info_section): New function.
14163         (Layout::add_comdat): Add new parameters.
14164         (Layout::find_kept_object): New function.
14165         (Layout::Kept_section): New struct.
14166         (Layout::Signatures): Change type of map range.
14167         * object.cc (Relobj::output_section_address): New function.
14168         (Sized_relobj::include_section_group): Add new parameters.  Change
14169         calls to Layout::add_comdat.  Change to build table of kept comdat
14170         groups and table mapping discarded sections to kept sections.
14171         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14172         (Sized_relobj::do_layout): Change calls to include_section_group and
14173         include_linkonce_section.
14174         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14175         value to zero when section is discarded.
14176         (Sized_relobj::map_to_kept_section): New function.
14177         * object.h (Relobj::output_section_address): New function.
14178         (Relobj::Comdat_group): New type.
14179         (Relobj::find_comdat_group): New function.
14180         (Relobj::Comdat_group_table): New type.
14181         (Relobj::Kept_comdat_section): New type.
14182         (Relobj::Kept_comdat_section_table): New type.
14183         (Relobj::add_comdat_group): New function.
14184         (Relobj::set_kept_comdat_section): New function.
14185         (Relobj::get_kept_comdat_section): New function.
14186         (Relobj::comdat_groups_): New field.
14187         (Relobj::kept_comdat_sections_): New field.
14188         (Symbol_value::input_value): Update comment.
14189         (Sized_relobj::map_to_kept_section) New function.
14190         (Sized_relobj::include_linkonce_section): Add new parameter.
14191         * target-reloc.h (Comdat_behavior): New type.
14192         (get_comdat_behavior): New function.
14193         (relocate_section): Add code to map a discarded section to the
14194         corresponding kept section when applying a relocation.
14195
14196 2008-04-30  Craig Silverstein  <csilvers@google.com>
14197
14198         * dwarf_reader.cc (next_generation_count): New static var.
14199         (Addr2line_cache_entry): New struct.
14200         (addr2line_cache): New static var.
14201         (Dwarf_line_info::one_addr2line): Added caching.
14202         (Dwarf_line_info::clear_addr2line_cache): New function.
14203         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14204         cache-size parameter.
14205         (Dwarf_line_info::one_addr2line_cache): New function.
14206         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14207         new cache-size argument to one_addr2line(), and clear cache.
14208
14209 2008-04-28  Cary Coutant  <ccoutant@google.com>
14210
14211         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14212         R_386_PC8 relocations.
14213
14214 2008-04-23  Ian Lance Taylor  <iant@google.com>
14215
14216         * object.cc (Sized_relobj::include_section_group): Check for
14217         invalid section group.
14218
14219         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14220         header size.
14221
14222         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14223         than read for file header.
14224         * archive.cc (Archive::include_member): Likewise.
14225
14226 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14227
14228         * aclocal.m4: Regenerate.
14229         * configure: Regenerate.
14230
14231 2008-04-19  Ian Lance Taylor  <iant@google.com>
14232
14233         * version.cc (version_string): Bump to 1.6.
14234
14235         * testsuite/Makefile.am (many_sections_r_test): New target.
14236         (many_sections_r_test_SOURCES): Remove.
14237         (many_sections_r_test_DEPENDENCIES): Remove.
14238         (many_sections_r_test_LDFLAGS): Remove.
14239         (many_sections_r_test_LDADD): Remove.
14240
14241         * object.cc (Sized_relobj::do_add_symbols): Always pass
14242         local_symbol_count_ to add_from_relobj.
14243
14244         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14245         every thousand variables.
14246         * testsuite/Makefile.in: Rebuild.
14247
14248         * object.cc (Xindex::initialize_symtab_xindex): New function.
14249         (Xindex::read_symtab_xindex): New function.
14250         (Xindex::sym_xindex_to_shndx): New function.
14251         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14252         available.
14253         (Sized_relobj::do_initialize_xindex): New function.
14254         (Sized_relobj::do_read_symbols): Adjust section links.
14255         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14256         parameter.  Change all callers.
14257         (Sized_relobj::include_section_group): Adjust section links and
14258         symbol section indexes.
14259         (Sized_relobj::do_layout): Adjust section links.
14260         (Sized_relobj::do_count_local_symbols): Adjust section links and
14261         symbol section indexes.
14262         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14263         ordinary and special symbols.
14264         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14265         dynsym_xindex parameters.  Change all callers.  Adjust section
14266         links.  Use SHN_XINDEX when needed.
14267         (Sized_relobj::get_symbol_location_info): Adjust section links.
14268         Don't get fooled by special symbols.
14269         * object.h (class Xindex): Define.
14270         (class Object): Add xindex_ parameter.  Declare virtual functoin
14271         do_initialize_xindex.
14272         (Object::adjust_sym_shndx): New function.
14273         (Object::set_xindex): New protected function.
14274         (class Symbol_value): Add is_ordinary_shndx_ field.
14275         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14276         (Symbol_value::value): Assert ordinary section.
14277         (Symbol_value::initialize_input_to_output_map): Likewise.
14278         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14279         Change all callers.
14280         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14281         all callers.
14282         (class Sized_relobj): Update declarations.
14283         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14284         parameter.  Change all callers.
14285         (Sized_relobj::adjust_shndx): New function.
14286         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14287         field.
14288         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14289         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14290         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14291         (Sized_dynobj::read_dynsym_section): Adjust section links.
14292         (Sized_dynobj::read_dynamic): Likewise.
14293         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14294         section links.
14295         (Sized_dynobj::do_initialize_xindex): New function.
14296         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14297         do_initialize_xindex.
14298         (Sized_dynobj::adjust_shndx): New function.
14299         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14300         dynsym_xindex_ fields.
14301         (Layout::finalize): Add a call to set_section_indexes before
14302         creating the symtab sections.
14303         (Layout::set_section_indexes): Don't do anything if the section
14304         already has a section index.
14305         (Layout::create_symtab_sections): Add shnum parameter.  Change
14306         caller.  Create .symtab_shndx section if needed.
14307         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14308         caller.
14309         (Layout::allocated_output_section_count): New function.
14310         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14311         needed.
14312         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14313         fields.  Update declarations.
14314         (Layout::symtab_xindex): New function.
14315         (Layout::dynsym_xindex): New function.
14316         (class Write_symbols_task): Add layout_ field.
14317         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14318         Change caller.
14319         * output.cc (Output_section_headers::Output_section_headers): Add
14320         shstrtab_section parameter.  Change all callers.
14321         (Output_section_headers::do_sized_write): Store overflow values
14322         for section count and section string table section index in
14323         section header zero.
14324         (Output_file_header::do_sized_write): Check for overflow of
14325         section count and section string table section index.
14326         (Output_symtab_xindex::do_write): New function.
14327         (Output_symtab_xindex::endian_do_write): New function.
14328         * output.h (class Output_section_headers): Add shstrtab_section_.
14329         Update declarations.
14330         (class Output_symtab_xindex): Define.
14331         (Output_section::has_out_shndx): New function.
14332         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14333         field.
14334         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14335         Change all callers.
14336         (Sized_symbol::init): Likewise.
14337         (Symbol::output_section): Check for ordinary symbol.
14338         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14339         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14340         callers.
14341         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14342         Change all callers.  Simplify handling of symbols from sections
14343         not included in the link.
14344         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14345         distinction.
14346         (Weak_alias_sorter::operator()): Assert that symbols are
14347         ordinary.
14348         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14349         distinction.
14350         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14351         parameters.  Change all callers.
14352         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14353         symbol distinction.  Use SHN_XINDEX when needed.
14354         (Symbol_table::write_section_symbol): Add symtab_xindex
14355         parameter.  Change all callers.
14356         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14357         SHN_XINDEX when needed.
14358         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14359         declarations.
14360         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14361         (Symbol::is_defined): Check is_ordinary.
14362         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14363         (Symbol::is_absolute, Symbol::is_common): Likewise.
14364         (class Sized_symbol): Update declarations.
14365         (class Symbol_table): Update declarations.
14366         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14367         parameters.  Change all callers.
14368         (Sized_symbol::override): Likewise.
14369         (Symbol_table::override): Likewise.
14370         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14371         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14372         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14373         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14374         to be in an ordinary section.
14375         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14376         object and is_ordinary parameters.  Change all callers.
14377         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14378         Change all callers.  Don't add undefined or non-ordinary symbols
14379         to reloc_map_.
14380         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14381         Change all callers.
14382         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14383         declarations.
14384         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14385         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14386         (Sized_relobj::relocate_sections): Likewise.
14387         * target-reloc.h (scan_relocs): Adjust section symbol index.
14388         (scan_relocatable_relocs): Likewise.
14389         * i386.cc (Scan::local): Check for ordinary symbols.
14390         * sparc.cc (Scan::local): Likewise.
14391         * x86_64.cc (Scan::local): Likewise.
14392         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14393         to symbol_section_and_value.
14394         * testsuite/many_sections_test.cc: New file.
14395         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14396         (check_PROGRAMS): Add many_sections_test.
14397         (many_sections_test_SOURCES): Define.
14398         (many_sections_test_DEPENDENCIES): Define.
14399         (many_sections_test_LDFLAGS): Define.
14400         (BUILT_SOURCES): Add many_sections_define.h.
14401         (many_sections_define.h): New target.
14402         (BUILT_SOURCES): Add many_sections_check.h.
14403         (many_sections_check.h): New target.
14404         (check_PROGRAMS): Add many_sections_r_test.
14405         (many_sections_r_test_SOURCES): Define.
14406         (many_sections_r_test_DEPENDENCIES): Define.
14407         (many_sections_r_test_LDFLAGS): Define.
14408         (many_sections_r_test_LDADD): Define.
14409         (many_sections_r_test.o): New target.
14410         * testsuite/Makefile.in: Rebuild.
14411
14412 2008-04-17  Cary Coutant  <ccoutant@google.com>
14413
14414         * errors.cc (Errors::info): New function.
14415         (gold_info): New function.
14416         * errors.h (Errors::info): New function.
14417         * gold.h (gold_info): New function.
14418         * object.cc (Input_objects::add_object): Print trace output.
14419         * options.cc (options::parse_set): New function.
14420         (General_options::parse_wrap): Deleted.
14421         (General_options::General_options): Deleted initializer.
14422         * options.h (options::String_set): New typedef.
14423         (options::parse_set): New function.
14424         (DEFINE_set): New macro.
14425         (General_options::wrap): Changed to use DEFINE_set. Changed
14426         callers of any_wrap_symbols and is_wrap_symbol.
14427         (General_options::trace, General_options::trace_symbol):
14428         New options.
14429         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14430         (General_options::wrap_symbols_): Deleted.
14431         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14432
14433 2008-04-17  David S. Miller  <davem@davemloft.net>
14434
14435         * options.cc (General_options::parse_V): New function.
14436         * options.h: Add entries for -V and -Qy.
14437
14438 2008-04-17  Ian Lance Taylor  <iant@google.com>
14439
14440         * common.cc (Symbol_table::allocate_commons): Remove options
14441         parameter.  Change caller.
14442         (Symbol_table::do_allocate_commons): Remove options parameter.
14443         Change caller.  Just call do_allocate_commons_list twice.
14444         (Symbol_table::do_allocate_commons_list): New function, broken out
14445         of do_allocate_commons.
14446         * common.h (class Allocate_commons_task): Remove options_ field.
14447         Update constructor.
14448         * symtab.cc (Symbol_table::Symbol_table): Initialize
14449         tls_commons_.
14450         (Symbol_table::add_from_object): Put TLS common symbols on
14451         tls_commons_ list.
14452         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14453         which are IN_OUTPUT_DATA.
14454         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14455         allocate_commons and do_allocate_commons declarations.  Declare
14456         do_allocate_commons_list.
14457         * gold.cc (queue_middle_tasks): Update creation of
14458         Allocate_commons_task to not pass options.
14459         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14460         (TLS_TEST_C_FLAGS): New variable.
14461         (tls_test_c_pic.o): New target.
14462         (tls_test_shared.so): Link in tls_test_c_pic.o.
14463         (tls_test_c_pic_ie.o): New target.
14464         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14465         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14466         (tls_test_c.o): New target.
14467         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14468         (tls_pic_test_LDADD): Likewise.
14469         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14470         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14471         (tls_test_c_gnu2.o): New target.
14472         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14473         tls_test_c_gnu2.o.
14474         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14475         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14476         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14477         * testsuite/tls_test.cc: Include "config.h".
14478         (t_last): Call t11_last.
14479         * testsuite/tls_test.h (t11, t11_last): Declare.
14480         * testsuite/tls_test_c.c: New file.
14481         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14482         * configure.ac: Check for OpenMP support.
14483         * configure, config.in, Makefile.in: Rebuild.
14484         * testsuite/Makefile.in: Rebuild.
14485
14486 2008-04-16  Cary Coutant  <ccoutant@google.com>
14487
14488         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14489         (Target_i386::tls_base_symbol_defined_): New field.
14490         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14491         (Target_i386::Scan::global): Likewise.
14492         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14493         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14494         (Target_x86_64::tls_base_symbol_defined_): New field.
14495         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14496         (Target_x86_64::Scan::global): Likewise.
14497
14498 2008-04-16  Cary Coutant  <ccoutant@google.com>
14499
14500         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14501         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14502         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14503         building shared libraries.
14504         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14505         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14506         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14507         * testsuite/Makefile.in: Rebuild.
14508         * testsuite/weak_undef.h: New file.
14509         * testsuite/weak_undef_file1.cc: Add extra test cases.
14510         * testsuite/weak_undef_file2.cc: Likewise.
14511         * testsuite/weak_undef_test.cc: Likewise.
14512
14513 2008-04-16  David S. Miller  <davem@davemloft.net>
14514
14515         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14516         Add issued_non_pic_error_ field.  Declare check_non_pic.
14517         (Target_sparc::Scan::check_non_pic): New function.
14518         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14519         (Target_sparc::Scan::global): Likewise.
14520
14521         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14522         * configure: Rebuild.
14523
14524         * options.h (DEFINE_enable): New macro.
14525         (new_dtags): New enable option.
14526         (initfirst, interpose, loadfltr, nodefaultlib,
14527         nodelete, nodlopen, nodump): New -z options.
14528         * layout.cc (Layout:finish_dynamic_section): If new
14529         dtags enabled, emit DT_RUNPATH.  Also, emit a
14530         DT_FLAGS_1 containing any specified -z flags.
14531
14532 2008-04-16  Ian Lance Taylor  <iant@google.com>
14533
14534         * copy-relocs.cc: New file.
14535         * copy-relocs.h: New file.
14536         * reloc.cc: Remove Copy_relocs code.
14537         * reloc.h: Likewise.
14538         * reloc-types.h (struct Reloc_types) [both versions]: Add
14539         get_reloc_addend_noerror.
14540         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14541         variants of add_global which take an addend which must be zero.
14542         * i386.cc: Include "copy-relocs.h".
14543         (class Target_i386): Change type of copy_relocs_ to variable,
14544         update initializer.
14545         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14546         Change all callers.
14547         (Target_i386::do_finalize_sections): Change handling of
14548         copy_relocs_.
14549         * sparc.cc: Include "copy-relocs.h".
14550         (class Target_sparc): Change type of copy_relocs_ to variable,
14551         update initializer.
14552         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14553         Change all callers.
14554         (Target_sparc::do_finalize_sections): Change handling of
14555         copy_relocs_.
14556         * x86_64.cc: Include "copy-relocs.h".
14557         (class Target_x86_64): Change type of copy_relocs_ to variable,
14558         update initializer.
14559         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14560         class.  Change all callers.
14561         (Target_x86_64::do_finalize_sections): Change handling of
14562         copy_relocs_.
14563         * Makefile.am (CCFILES): Add copy-relocs.cc.
14564         (HFILES): Add copy-relocs.h.
14565
14566         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14567
14568         * testsuite/script_test_4.sh: Permit leading zeroes.
14569
14570 2008-04-15  Ian Lance Taylor  <iant@google.com>
14571
14572         * script-sections.cc (Script_sections::create_segments): Use
14573         header_size_adjustment even when there is enough room for the
14574         headers.
14575         * testsuite/script_test_4.sh: New file.
14576         * testsuite/script_test_4.t: New file.
14577         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14578         (check_DATA): Add script_test_4.stdout.
14579         (MOSTLYCLEANFILES): Likewise.
14580         (script_test_4): New target.
14581         (script_test_4.stdout): New target.
14582         * testsuite/Makefile.in: Rebuild.
14583
14584         * sparc.cc: Add definitions for Output_data_plt_sparc class
14585         constants.
14586
14587 2008-04-14  David S. Miller  <davem@davemloft.net>
14588
14589         * sparc.cc: New file.
14590         * Makefile.am (TARGETSOURCES): Add sparc.cc
14591         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14592         * configure.tgt: Document targ_extra_size and
14593         targ_extra_big_endian.  Add entries for sparc-* and
14594         sparc64-*.
14595         * configure.ac: Handle targ_extra_size and
14596         targ_extra_big_endian.
14597         * Makefile.in: Rebuild.
14598         * configure: Likewise.
14599         * po/POTFILES.in: Likewise.
14600         * po/gold.pot: Likewise.
14601
14602 2008-04-14  Ian Lance Taylor  <iant@google.com>
14603
14604         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14605         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14606         in the name/type/flags to section mapping.  Don't call
14607         allocate_output_section.
14608         (Layout::choose_output_section): Change parameter from adjust_name
14609         to is_input_section.  Don't permit input sections after sections
14610         are attached to segments.  Don't call allocate_output_section.
14611         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14612         not write_enable_output_section.
14613         (Layout::make_output_section): Don't push to
14614         unattached_section_list_ nor call attach_to_segment.  Call
14615         attach_section_to_segment if sections are attached.
14616         (Layout::attach_sections_to_segments): New function.
14617         (Layout::attach_section_to_segment): New function.
14618         (Layout::attach_allocated_section_to_segment): Rename from
14619         attach_to_segment.  Remove flags parameter.
14620         (Layout::allocate_output_section): Remove function.
14621         (Layout::write_enable_output_section): Remove function.
14622         * layout.h (class Layout): Update for above changes.  Add new
14623         field sections_are_attached_.
14624         * output.h (Output_section::update_flags_for_input_section): New
14625         function.
14626         * output.cc (Output_section::add_input_section): Call
14627         update_flags_for_input_section.
14628         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14629
14630 2008-04-11  Cary Coutant  <ccoutant@google.com>
14631
14632         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14633         thought unnecessary.
14634         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14635
14636 2008-04-11  Ian Lance Taylor  <iant@google.com>
14637
14638         * output.h (class Output_section_data): Remove inline definition
14639         of set_addralign.
14640         * output.cc (Output_section_data::set_addralign): New function.
14641
14642 2008-04-11  Cary Coutant  <ccoutant@google.com>
14643
14644         Add support for TLS descriptors for i386 and x86_64.
14645         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14646         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14647         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14648         GOT_TYPE_TLS_DESC.
14649         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14650         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14651         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14652         relocations.
14653         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14654         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14655         Fix problem with initial-exec relocations.
14656         (Target_i386::Relocate::relocate_tls): Likewise.
14657         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14658         relaxation.
14659         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14660         support for section-plus-offset dynamic table entries.
14661         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14662         (Output_data_dynamic::Dynamic_entry): Add support for
14663         section-plus-offset dynamic table entries.
14664         (Output_data_dynamic::Classification): Likewise.
14665         (Output_data_dynamic::classification_): Renamed offset_.
14666         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14667         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14668         (Target_x86_64::make_plt_section): New function.
14669         (Target_x86_64::reserve_tlsdesc_entries): New function.
14670         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14671         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14672         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14673         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14674         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14675         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14676         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14677         add extra PLT entry for TLS descriptors.
14678         (Output_data_plt_x86_64::got_): New field.
14679         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14680         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14681         fields.
14682         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14683         descriptors.
14684         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14685         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14686         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14687         R_386_TLS_DESC_CALL relocations.
14688         (Target_x86_64::Scan::global): Likewise.
14689         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14690         for TLS descriptors.
14691         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14692         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14693         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14694         GD-to-IE relaxation.
14695         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14696         and TLS_DESCRIPTORS.
14697         * Makefile.in: Rebuild.
14698         * configure: Rebuild.
14699         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14700         (tls_test_shared2.so): New target.
14701         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14702         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14703         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14704         (tls_shared_gd_to_ie_test_LDADD): New variable.
14705         (tls_shared_gnu2_gd_to_ie_test): New target.
14706         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14707         New targets.
14708         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14709         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14710         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14711         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14712         (tls_shared_gnu2_test): New target.
14713         (tls_test_gnu2_shared.so): New target.
14714         (tls_shared_gnu2_test_SOURCES): New variable.
14715         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14716         (tls_shared_gnu2_test_LDFLAGS): New variable.
14717         (tls_shared_gnu2_test_LDADD): New variable.
14718         * testsuite/Makefile.in: Rebuild.
14719         * testsuite/Makefile.
14720
14721 2008-04-11  Ian Lance Taylor  <iant@google.com>
14722
14723         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14724         justsyms.t.
14725         * testsuite/Makefile.in: Rebuild.
14726
14727         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14728         long.
14729         * testsuite/script_test_2.cc (main): Adjust test.
14730
14731 2008-04-11  David S. Miller  <davem@davemloft.net>
14732             Ian Lance Taylor  <iant@google.com>
14733
14734         * options.h (General_options): Add entries for '-Y' and
14735         '-relax'.
14736         * options.cc (General_options:finalize): If -Y was used, add those
14737         entries to the library path instead of the default "/lib" and
14738         "/usr/lib".
14739
14740 2008-04-11  David S. Miller  <davem@davemloft.net>
14741
14742         * testsuite/justsyms.t: Start at 0x100.
14743         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14744         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14745         long.
14746         * testsuite/script_test_2.cc: Adjust string and section length
14747         checks.
14748
14749 2008-04-09  Ian Lance Taylor  <iant@google.com>
14750
14751         PR gold/5996
14752         * script-sections.cc (Sections_element::allocate_to_segment): Add
14753         orphan parameter.
14754         (Output_section_definition::allocate_to_segment): Likewise.
14755         (Orphan_output_section::allocate_to_segment): Likewise.
14756         (Script_sections::attach_sections_using_phdrs_clause): Don't
14757         propagate non-PT_LOAD segments to orphan sections.
14758         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14759         readelf rather than objdump.
14760         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14761         .interp section and PT_INTERP segment are the same size.
14762         * testsuite/Makefile.in: Rebuild.
14763
14764         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14765         aliases for symbols defined in the same object.
14766         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14767         (weak_alias_test_SOURCES): New variable.
14768         (weak_alias_test_DEPENDENCIES): New variable.
14769         (weak_alias_test_LDFLAGS): New variable.
14770         (weak_alias_test_LDADD): New variable.
14771         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14772         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14773         (weak_alias_test_3.o): New target.
14774         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14775         * testsuite/weak_alias_test_main.cc: New file.
14776         * testsuite/weak_alias_test_1.cc: New file.
14777         * testsuite/weak_alias_test_2.cc: New file.
14778         * testsuite/weak_alias_test_3.cc: New file.
14779
14780 2008-04-08  Ian Lance Taylor  <iant@google.com>
14781
14782         * options.h (class General_options): Add --noinhibit-exec option.
14783         * main.cc (main): Check --noinhibit-exec.
14784
14785         * options.h (class General_options): Define --wrap as a special
14786         option.  Add wrap_symbols_ field.
14787         (General_options::any_wrap_symbols): New function.
14788         (General_options::is_wrap_symbol): New function.
14789         * options.cc (General_options::parse_wrap): New function.
14790         (General_options::General_options): Initialize wrap_symbols_.
14791         * symtab.cc (Symbol_table::wrap_symbol): New function.
14792         (Symbol_table::add_from_object): Handle --wrap.
14793         * symtab.h (class Symbol_table): Declare wrap_symbol.
14794         * target.h (Target::wrap_char): New function.
14795         (Target::Target_info): Add wrap_char field.
14796         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14797         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14798         * testsuite/testfile.cc (Target_test::test_target_info):
14799         Likewise.
14800
14801         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14802         there is one.
14803
14804         * layout.h (class Layout): Add added_eh_frame_data_ field.
14805         * layout.cc (Layout::Layout): Initialize new field.
14806         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14807         output section until we find a section we merged successfully.
14808         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14809         that the size be non-zero.
14810
14811         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14812         qualifier.
14813
14814 2008-04-08  Craig Silverstein  <csilvers@google.com>
14815
14816         * configure.ac: Export new conditional variable HAVE_ZLIB.
14817         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14818         on HAVE_ZLIB.
14819         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14820         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14821
14822 2008-04-07  Ian Lance Taylor  <iant@google.com>
14823
14824         * version.cc (version_string): Set to "1.5".
14825
14826         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14827         Add issued_non_pic_error_ field.  Declare check_non_pic.
14828         (Target_x86_64::Scan::check_non_pic): New function.
14829         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14830         (Target_x86_64::Scan::global): Likewise.
14831
14832         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14833         addend parameter.  Change caller.  Handle merge sections.
14834         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14835         Address to Addend.  Don't add in the result of
14836         local_section_offset, pass down the addend and use the returned
14837         value.
14838         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14839         Update declarations of local_section_offset and symbol_value.
14840         * testsuite/two_file_test_1.cc (t18): New function.
14841         * testsuite/two_file_test_2.cc (f18): New function.
14842         * testsuite/two_file_test_main.cc (main): Call t18.
14843         * testsuite/two_file_test.h (t18, f18): Declare.
14844
14845         * configure.ac: Don't test for objdump, c++filt, or readelf.
14846         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14847         conditionals.
14848         (TEST_READELF): New variable.
14849         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14850         (check_PROGRAMS): Add two_file_strip_test.
14851         (two_file_strip_test): New target.
14852         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14853         (two_file_same_shared_strip_test_SOURCES): New variable.
14854         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14855         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14856         (two_file_same_shared_strip_test_LDADD): New variable.
14857         (two_file_shared_strip.so): New target.
14858         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14859         (ver_test_5.syms, ver_test_7.syms): Likewise.
14860         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14861         (strip_test_3.stdout): Use TEST_OBJDUMP.
14862         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14863
14864 2008-04-04  Cary Coutant  <ccoutant@google.com>
14865
14866         * symtab.h (Symbol::is_weak_undefined): New function.
14867         (Symbol::is_strong_undefined): New function.
14868         (Symbol::is_absolute): New function.
14869         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14870         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14871         absolute symbols.
14872         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14873         (weak_undef_test): New target.
14874         * testsuite/Makefile.in: Rebuild.
14875         * testsuite/weak_undef_file1.cc: New file.
14876         * testsuite/weak_undef_file2.cc: New file.
14877         * testsuite/weak_undef_test.cc: New file.
14878
14879 2008-04-03  Craig Silverstein  <csilvers@google.com>
14880
14881         * compressed_output.h (class Output_compressed_section): Use
14882         unsigned buffer.
14883         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14884         add zlib header.
14885         (zlib_compressed_suffix): Removed.
14886         (Output_compressed_section::set_final_data_size): Use unsigned
14887         buffers.
14888         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14889         Fix linker invocation.
14890         (flagstest_o_specialfile_and_compress_debug_sections):
14891         Likewise.
14892         * testsuite/Makefile.in: Regenerated.
14893
14894 2008-04-02  David S. Miller  <davem@davemloft.net>
14895
14896         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14897         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14898
14899 2008-04-02  Craig Silverstein  <csilvers@google.com>
14900
14901         * TODO: New file.
14902
14903 2008-04-02  Ian Lance Taylor  <iant@google.com>
14904
14905         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14906         parameters.  Update for new key type to views_.  Change all
14907         callers.
14908         (File_read::read): Adjust for byteshift in returned view.
14909         (File_read::add_view): New function, broken out of
14910         find_and_make_view.
14911         (File_read::make_view): New function, broken out of
14912         find_and_make_view.
14913         (File_read::find_or_make_view): Add offset and aligned
14914         parameters.  Rewrite accordingly.  Change all callers.
14915         (File_read::get_view): Add offset and aligned parameters.  Adjust
14916         for byteshift in return value.
14917         (File_read::get_lasting_view): Likewise.
14918         * fileread.h (class File_read): Update declarations.
14919         (class File_read::View): Add byteshift_ field.  Add byteshift to
14920         constructor.  Add byteshift method.
14921         * archive.h (Archive::clear_uncached_views): New function.
14922         (Archive::get_view): Add aligned parameter.  Change all callers.
14923         * object.h (Object::get_view): Add aligned parameter.  Change all
14924         callers.
14925         (Object::get_lasting_view): Likewise.
14926
14927         * fileread.cc (File_read::release): Don't call clear_views if
14928         there are multiple objects.
14929         * fileread.h (File_read::clear_uncached_views): New function.
14930         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14931         on the archive.
14932
14933 2008-03-31  Cary Coutant  <ccoutant@google.com>
14934
14935         Add thin archive support.
14936         * archive.cc (Archive::armagt): New const.
14937         (Archive::setup): Remove task parameter and calls to unlock.
14938         (Archive::unlock_nested_archives): New function.
14939         (Archive::read_header): Add nested_off parameter. Change
14940         all callers.
14941         (Archive::interpret_header): Likewise.
14942         (Archive::include_all_members): Change to handle thin
14943         archives.
14944         (Archive::include_member): Likewise.
14945         * archive.h (Archive::Archive): Add new parameters and
14946         initializers.
14947         (Archive::armagt): New const.
14948         (Archive::setup): Remove task parameter.
14949         (Archive::unlock_nested_archives): New function.
14950         (Archive::read_header): Add nested_off parameter.
14951         (Archive::interpret_header): Likewise.
14952         (Archive::Nested_archive_table): New typedef.
14953         (Archive::is_thin_archive_): New field.
14954         (Archive::nested_archives_): New field.
14955         (Archive::options_): New field.
14956         (Archive::dirpath_): New field.
14957         (Archive::task_): New field.
14958         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14959         for thin archives.  Pass additional parameters to
14960         Archive::Archive.  Unlock the archive file after calling
14961         Archive::setup.
14962
14963 2008-03-29  Ian Lance Taylor  <iant@google.com>
14964
14965         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14966         version symbol to be local.
14967         * testsuite/ver_test_4.sh: New file.
14968         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14969         (check_DATA): Add ver_test_4.syms.
14970         (ver_test_4.syms): New target.
14971         * testsuite/Makefile.in: Rebuild.
14972
14973         * output.cc
14974         (Output_section::Input_section_sort_entry::has_priority): New
14975         function.
14976         (Output_section::Input_section_sort_entry::match_file_name): New
14977         function.
14978         (Output_section::Input_section_sort_entry::match_section_name):
14979         Remove.
14980         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14981         Remove.
14982         (Output_section::Input_section_sort_entry::match_section_file):
14983         Remove.
14984         (Output_section::Input_section_sort_compare::operator()): Rewrite
14985         using new Input_section_sort_entry functions.  Sort crtbegin and
14986         crtend first.  Sort sections with no priority before sections with
14987         a priority.
14988         * testsuite/initpri1.c (d3): Check j != 4.
14989         (cd5): New constructor/destructor function.
14990         (main): Check j != 2.
14991
14992         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14993         new symbol when resolving, don't call set_is_default.
14994         * testsuite/ver_test_7.cc: New file.
14995         * testsuite/ver_test_7.sh: New file.
14996         * testsuite/Makefile.am (ver_test_7.so): New target.
14997         (ver_test_7.o): New target.
14998         (check_SCRIPTS): Add ver_test_7.sh.
14999         (check_DATA): Add ver_test_7.syms.
15000         (ver_test_7.syms): New target.
15001
15002 2008-03-28  Ian Lance Taylor  <iant@google.com>
15003
15004         * layout.cc (Layout::layout): If we see an input section with a
15005         name that needs sorting, set the must_sort flag for the output
15006         section.
15007         (Layout::make_output_section): If the name of the output section
15008         indicates that it might require sorting, set the may_sort flag.
15009         * output.h (Output_section::may_sort_attached_input_sections): New
15010         function.
15011         (Output_section::set_may_sort_attached_input_sections): New
15012         function.
15013         (Output_section::must_sort_attached_input_sections): New
15014         function.
15015         (Output_section::set_must_sort_attached_input_sections): New
15016         function.
15017         (class Output_section): Declare Input_section_sort_entry.  Define
15018         Input_section_sort_compare.  Declare
15019         sort_attached_input_sections.  Add new fields:
15020         may_sort_attached_input_sections_,
15021         must_sort_attached_input_sections_,
15022         attached_input_sections_are_sorted_.
15023         * output.cc (Output_section::Output_section): Initialize new
15024         fields.
15025         (Output_section::add_input_section): Add an entry to
15026         input_sections_ if may_sort or must_sort are true.
15027         (Output_section::set_final_data_size): Call
15028         sort_attached_input_sections if necessary.
15029         (Output_section::Input_section_sort_entry): Define new class.
15030         (Output_section::Input_section_sort_compare::operator()): New
15031         function.
15032         (Output_section::sort_attached_input_sections): New function.
15033         * configure.ac: Check whether the compiler supports constructor
15034         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15035         * testsuite/initpri1.c: New file.
15036         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15037         CONSTRUCTOR_PRIORITY.
15038         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15039         (initpri1_LDFLAGS): New variable.
15040         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15041
15042 2008-03-27  Ian Lance Taylor  <iant@google.com>
15043
15044         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15045         * testsuite/common_test_1.c: New file.
15046         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15047         (common_test_1_SOURCES): New variable.
15048         (common_test_1_DEPENDENCIES): New variable.
15049         (common_test_1_LDFLAGS): New variable.
15050
15051         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15052         and commons_ correctly when NAME/VERSION does not override
15053         NAME/NULL.
15054         * testsuite/ver_test_6.c: New file.
15055         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15056         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15057         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15058
15059 2008-03-26  Ian Lance Taylor  <iant@google.com>
15060
15061         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15062         of an undefined symbol from a version script.
15063         * testsuite/Makefile.am (ver_test_5.so): New target.
15064         (ver_test_5.o): New target.
15065         (check_SCRIPTS): Add ver_test_5.sh.
15066         (check_DATA): Add ver_test_5.syms.
15067         (ver_test_5.syms): New target.
15068         * testsuite/ver_test_5.cc: New file.
15069         * testsuite/ver_test_5.script: New file.
15070         * testsuite/ver_test_5.sh: New file.
15071         * Makefile.in, testsuite/Makefile.in: Rebuild.
15072
15073         PR gold/5986
15074         Fix problems building gold with gcc 4.3.0.
15075         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15076         (gold_error_at_location, gold_warning_at_location): Use it.
15077         * configure.ac: Check whether we can compile and use a template
15078         function with a printf attribute.
15079         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15080         when jumping over bytes.
15081         * object.cc: Instantiate Object::read_section_data.
15082         * debug.h: Include <cstring>
15083         * dwarf_reader.cc: Include <algorithm>
15084         * main.cc: Include <cstring>.
15085         * options.cc: Include <cstring>.
15086         * output.cc: Include <cstring>.
15087         * script.cc: Include <cstring>.
15088         * script.h: Include <string>.
15089         * symtab.cc: Include <cstring> and <algorithm>.
15090         * target-select.cc: Include <cstring>.
15091         * version.cc: Include <string>.
15092         * testsuite/testmain.cc: Include <cstdlib>.
15093         * configure, config.in: Rebuild.
15094
15095 2008-03-25  Ian Lance Taylor  <iant@google.com>
15096
15097         * options.cc: Include "../bfd/bfdver.h".
15098         (options::help): Print bug reporting address.
15099
15100         * version.cc (print_version): Adjust output for current value of
15101         BFD_VERSION_STRING.
15102
15103         * NEWS: New file.
15104
15105         * options.cc (options::help): Print list of supported targets.
15106         * target-select.h: Include <vector>.
15107         (class Target_selector): Make machine_, size_, and is_big_endian_
15108         fields const.  Add bfd_name_ and instantiated_target_ fields.
15109         (Target_selector::Target_selector): Add bfd_name parameter.
15110         (Target_selector::recognize): Make non-virtual, call
15111         do_recognize.
15112         (Target_selector::recognize_by_name): Make non-virtual, call
15113         do_recognize_by_name.
15114         (Target_selector::supported_names): New function.
15115         (Target_selector::bfd_name): New function.
15116         (Target_selector::do_instantiate_target): New pure virtual
15117         function.
15118         (Target_selector::do_recognize): New virtual function.
15119         (Target_selector::do_recognize_by_name): New virtual function.
15120         (Target_selector::instantiate_target): New private function.
15121         (supported_target_names): Declare.
15122         * target-select.cc (Target_selector::Target_selector): Update for
15123         new parameter and fields.
15124         (select_target_by_name): Check that the name matches before
15125         calling recognize_by_name.
15126         (supported_target_names): New function.
15127         * i386.cc (class Target_selector_i386): Update Target_selector
15128         constructor call.  Remove recognize and recognize_by_name.  Add
15129         do_instantiate_target.
15130         * x86_64.cc (class Target_selector_x86_64): Likewise.
15131         * testsuite/testfile.cc (class Target_selector_test): Update for
15132         changes to Target_selector.
15133
15134         * README: Rewrite, with some notes on unsupported features.
15135
15136 2008-03-24  Cary Coutant  <ccoutant@google.com>
15137
15138         * i386.cc (Target_i386::Got_type): New enum declaration.
15139         (Target_i386::Scan::local): Updated callers of Output_data_got
15140         member functions.
15141         (Target_i386::Scan::global): Likewise.
15142         (Target_i386::Relocate::relocate): Likewise.
15143         (Target_i386::Relocate::relocate_tls): Likewise.
15144         * object.h (Got_offset_list): New class.
15145         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15146         (Sized_relobj::local_got_offset): Likewise.
15147         (Sized_relobj::set_local_got_offset): Likewise.
15148         (Sized_relobj::local_has_tls_got_offset): Removed.
15149         (Sized_relobj::local_tls_got_offset): Removed.
15150         (Sized_relobj::set_local_tls_got_offset): Removed.
15151         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15152         * output.cc (Output_data_got::add_global): Added got_type parameter.
15153         (Output_data_got::add_global_with_rel): Likewise.
15154         (Output_data_got::add_global_with_rela): Likewise.
15155         (Output_data_got::add_global_pair_with_rel): New function.
15156         (Output_data_got::add_global_pair_with_rela): New function.
15157         (Output_data_got::add_local): Added got_type parameter.
15158         (Output_data_got::add_local_with_rel): Likewise.
15159         (Output_data_got::add_local_with_rela): Likewise.
15160         (Output_data_got::add_local_pair_with_rel): New function.
15161         (Output_data_got::add_local_pair_with_rela): New function.
15162         (Output_data_got::add_global_tls): Removed.
15163         (Output_data_got::add_global_tls_with_rel): Removed.
15164         (Output_data_got::add_global_tls_with_rela): Removed.
15165         (Output_data_got::add_local_tls): Removed.
15166         (Output_data_got::add_local_tls_with_rel): Removed.
15167         (Output_data_got::add_local_tls_with_rela): Removed.
15168         * output.h (Output_data_got::add_global): Added got_type parameter.
15169         (Output_data_got::add_global_with_rel): Likewise.
15170         (Output_data_got::add_global_with_rela): Likewise.
15171         (Output_data_got::add_global_pair_with_rel): New function.
15172         (Output_data_got::add_global_pair_with_rela): New function.
15173         (Output_data_got::add_local): Added got_type parameter.
15174         (Output_data_got::add_local_with_rel): Likewise.
15175         (Output_data_got::add_local_with_rela): Likewise.
15176         (Output_data_got::add_local_pair_with_rel): New function.
15177         (Output_data_got::add_local_pair_with_rela): New function.
15178         (Output_data_got::add_global_tls): Removed.
15179         (Output_data_got::add_global_tls_with_rel): Removed.
15180         (Output_data_got::add_global_tls_with_rela): Removed.
15181         (Output_data_got::add_local_tls): Removed.
15182         (Output_data_got::add_local_tls_with_rel): Removed.
15183         (Output_data_got::add_local_tls_with_rela): Removed.
15184         * resolve.cc (Symbol::override_base_with_special): Removed
15185         reference to has_got_offset_ field.
15186         * symtab.cc (Symbol::init_fields): Replaced initialization
15187         of got_offset_ with got_offsets_.  Removed initialization
15188         of has_got_offset_
15189         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15190         (Symbol::got_offset): Likewise.
15191         (Symbol::set_got_offset): Likewise.
15192         (Symbol::has_tls_got_offset): Removed.
15193         (Symbol::tls_got_offset): Removed.
15194         (Symbol::set_tls_got_offset): Removed.
15195         (Symbol::got_offset_): Removed.
15196         (Symbol::tls_mod_got_offset_): Removed.
15197         (Symbol::tls_pair_got_offset_): Removed.
15198         (Symbol::got_offsets_): New field.
15199         (Symbol::has_got_offset): Removed.
15200         (Symbol::has_tls_mod_got_offset): Removed.
15201         (Symbol::has_tls_pair_got_offset): Removed.
15202         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15203         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15204         member functions.
15205         (Target_x86_64::Scan::global): Likewise.
15206         (Target_x86_64::Relocate::relocate): Likewise.
15207         (Target_x86_64::Relocate::relocate_tls): Likewise.
15208
15209 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15210
15211         * yyscript.y: Fix spelling error in comment.
15212
15213 2008-03-24  Ian Lance Taylor  <iant@google.com>
15214
15215         * options.h (class General_options): Define build_id option.
15216         * layout.h (class Layout): Declare write_build_id, create_note,
15217         create_build_id.  Add build_id_note_ member.
15218         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15219         "libiberty.h", "md5.h", "sha1.h".
15220         (Layout::Layout): Initialize eh_frame_data_,
15221         eh_frame_hdr_section_, and build_id_note_.
15222         (Layout::finalize): Call create_build_id.
15223         (Layout::create_note): New function, broken out of
15224         Layout::create_gold_note.
15225         (Layout::create_gold_note): Call create_note.
15226         (Layout::create_build_id): New function.
15227         (Layout::write_build_id): New function.
15228         (Close_task_runner::run): Call write_build_id.
15229
15230         * x86_64.cc: Correct license to GPLv3.
15231
15232 2008-03-23  Ian Lance Taylor  <iant@google.com>
15233
15234         * options.cc: Include "demangle.h".
15235         (parse_optional_string): New function.
15236         (parse_long_option): Handle takes_optional_argument.
15237         (parse_short_option): Update dash_z initializer.  Handle
15238         takes_optional_argument.
15239         (General_options::General_options): Initialize do_demangle_.
15240         (General_options::finalize): Set do_demangle_.  Handle demangling
15241         style.
15242         * options.h (parse_optional_string): Declare.
15243         (struct One_option): Add optional_arg field.  Update constructor.
15244         Update call constructor calls.  Add takes_optional_argument
15245         function.
15246         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15247         (DEFINE_optional_string): Define.
15248         (General_options::demangle): Change from DEFINE_bool to
15249         DEFINE_optional_string.
15250         (General_options::no_demangle): New function.
15251         (General_options::do_demangle): New function.
15252         (General_options::set_do_demangle): New function.
15253         (General_options::execstack_status_): Move definition to end of
15254         class definition.
15255         (General_options::static_): Likewise.
15256         (General_options::do_demangle_): New field.
15257         * object.cc (big_endian>::get_symbol_location_info): Call
15258         Options::do_demangle, not Options::demangle.
15259         * symtab.cc (demangle): Likewise.
15260
15261 2008-03-22  Ian Lance Taylor  <iant@google.com>
15262
15263         * gold.h: Include <cstddef> and <sys/types.h>
15264         * options.h: Include <cstring>.
15265
15266 2008-03-21  Ian Lance Taylor  <iant@google.com>
15267
15268         * Added source code to GNU binutils.
15269 \f
15270 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15271
15272 Copying and distribution of this file, with or without modification,
15273 are permitted in any medium without royalty provided the copyright
15274 notice and this notice are preserved.
15275
15276 Local Variables:
15277 mode: change-log
15278 left-margin: 8
15279 fill-column: 74
15280 version-control: never
15281 End: