Restore support for dwp v2 DWARF package file format.
[external/binutils.git] / gold / ChangeLog
1 2013-10-31  Cary Coutant  <ccoutant@google.com>
2
3         Restore support for dwp v2 DWARF package file format.
4
5         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
6         tu_length parameter.  Adjust all callers.
7         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
8         * dwp.cc: Include dwarf.h.
9         (Section_bounds): New struct type.
10         (Unit_set): New struct type.
11         (Dwo_file::Dwo_file): Initialize new data member.
12         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
13         Combine and rename to...
14         (Dwo_file::read_unit_index): ...this.
15         (Dwo_file::sized_read_compunit_index)
16         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
17         (Dwo_file::sized_read_unit_index): ...this.
18         (Dwo_file::copy_section): Remove section_name, is_str_offsets
19         parameters; add section_id parameter.
20         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
21         (Dwo_file::add_unit_set): ...this.
22         (Dwo_file::shndx_map_): Remove.
23         (Dwo_file::sect_offsets_): New data member.
24         (Dwp_output_file::Dwp_output_file): Initialize new data members.
25         (Dwp_output_file::add_section): Rename to...
26         (Dwp_output_file::add_contribution): ...this.
27         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
28         (Dwp_output_file::add_tu_set): Likewise.
29         (Dwp_output_file::Contribution): New type.
30         (Dwp_output_file::Section::contributions): New data member.
31         (Dwp_output_file::Cu_or_tu_set): Remove.
32         (Dwp_output_file::Section::Section): New ctor.
33         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
34         (Dwp_output_file::Dwp_index::Section_table): New type.
35         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
36         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
37         parameter.
38         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
39         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
40         (Dwp_output_file::Dwp_index::section_table): New member function.
41         (Dwp_output_file::Dwp_index::section_table_end): New member function.
42         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
43         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
44         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
45         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
46         (Dwp_output_file::Dwp_index::section_table_): New data member.
47         (Dwp_output_file::Dwp_index::section_mask_): New data member.
48         (Dwp_output_file::add_output_section): New member function.
49         (Dwp_output_file::write_new_section): New member function.
50         (Dwp_output_file::write_contributions): New member function.
51         (Dwp_output_file::section_id_map_): New data member.
52         (class Dwo_id_info_reader): Remove.
53         (class Unit_reader): New class.
54         (get_dwarf_section_name): New function.
55         (Dwo_file::read_executable): Adjust initializations of class data.
56         (Dwo_file::read): Add support for v2 package file format.
57         (Dwo_file::read_unit_index): Likewise.
58         (Dwo_file::sized_read_unit_index): Likewise.
59         (Dwo_file::copy_section): Likewise.
60         (Dwo_file::add_unit_set): Likewise.
61         (Dwp_output_file::add_output_section): Likewise.
62         (Dwp_output_file::add_contribution): Likewise.
63         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
64         for empty slot.
65         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
66         file format.
67         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
68         slot.
69         (Dwp_output_file::initialize): Remove unused function.
70         (Dwp_output_file::finalize): Add support for v2 package file format.
71         (Dwp_output_file::write_index): Likewise.
72         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
73         function prototype.
74
75 2013-10-31  Cary Coutant  <ccoutant@google.com>
76
77         * configure.ac: Fix check for -fmerge-constants.
78         * configure.ac: Regenerate.
79
80 2013-10-30  Roland McGrath  <mcgrathr@google.com>
81
82         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
83         Correct 9-byte nop sequence to match what the assembler generates.
84
85 2013-10-30  Alan Modra  <amodra@gmail.com>
86
87         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
88         ppc64_local_entry_offset, ppc64_local_entry_offset,
89         do_read_symbols): New functions.
90         (Powerpc_relobj::e_flags_, st_other_): New vars.
91         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
92         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
93         (Powerpc_relobj::e_flags_): New var.
94         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
95         and adjust for ELFv2.
96         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
97         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
98         (Powerpc_dynobj::do_find_special_sections): Likewise.
99         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
100         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
101         to ELFv2 local entry.
102         (Target_powerpc::do_relax): No thread safe barriers needed for
103         ELFv2.
104         (Output_data_plt_powerpc::initial_plt_entry_size_,
105         plt_entry_size): Delete.  Replace all uses with
106         first_plt_entry_offset() and plt_entry_size().
107         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
108         reserved_size parm.  Update callers.
109         (Output_data_plt_powerpc::entry_count): Update.
110         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
111         and use Target_powerpc::first_plt_entry_offset().
112         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
113         rename to plt_entry_size.
114         (Output_data_plt_powerpc::add_ifunc_entry,
115         add_local_ifunc_entry): Adjust reloc for ELFv2.
116         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
117         (glink_eh_frame_fde_64v2): New.
118         (Stub_table::plt_call_size): Support ELFv2 sizing.
119         (Output_data_glink::add_eh_frame): Use the new FDE.
120         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
121         (Stub_table::do_write): Write ELFv2 stubs and glink.
122         (Target_powerpc::Relocate::relocate): Replaces nop after call
123         with ld 2,24(1) and adjust local offset destination for ELFv2.
124
125 2013-10-30  Alan Modra  <amodra@gmail.com>
126
127         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
128         (Target_powerpc::Scan::global, local): Likewise.
129         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
130         on all ppc64 @h and @ha relocs.
131
132 2013-10-14  Alan Modra  <amodra@gmail.com>
133
134         * output.h (Output_data_got::add_constant): Tidy.
135         (Output_data_got::add_constant_pair): New function.
136         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
137         methods used so as to first call reserve_ent().
138
139 2013-10-11  Roland McGrath  <mcgrathr@google.com>
140
141         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
142         add_got_entry and add_got_entry_pair.
143
144         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
145         (HAVE_PUBNAMES): Likewise.
146         * configure: Regenerate.
147
148         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
149         * testsuite/Makefile.in: Regenerate.
150
151         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
152         Remove const from declaration.
153         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
154         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
155         * output.h (Output_file_header): Remove const from member target_
156         and corresponding constructor argument.
157         * output.cc (Output_file_header::Output_file_header): Update prototype.
158         (Output_file_header::do_sized_write): Use this->target_ in place
159         of parameters()->target().
160
161         * testsuite/undef_symbol.cc (Foo::get_a): New method.
162
163         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
164         * configure: Regenerate.
165         * Makefile.in: Regenerate.
166         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
167         * testsuite/merge_string_literals_2.c: Likewise.
168         * testsuite/Makefile.am
169         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
170         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
171         literal -fmerge-constants.
172         * testsuite/Makefile.in: Regenerate.
173
174         * i386.cc (Target_i386): Remove unused member dynbss_.
175         * arm.cc (Target_arm): Likewise.
176         * powerpc.cc (Target_powerpc): Likewise.
177         * sparc.cc (Target_sparc): Likewise.
178         * tilegx.cc (Target_tilegx): Likewise.
179         * x86_64.cc (Target_x86_64): Likewise.
180         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
181         type_signature_, type_offset_.
182         * plugin.h (Plugin_hook): Remove unused member layout_.
183         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
184         mapfile_.
185         (Read_member): Remove unused members input_objects_, symtab_,
186         mapfile_, layout_.
187         (Check_library): Remove unused member symtab_.
188         * archive.h (Lib_group): Remove unused member lib_.
189         * archive.cc (Lib_group::Lib_group): Update initializer.
190         * incremental.h (Incremental_binary): Remove unused member target_.
191         (Incremental_script_entry): Removed unused member script_.
192         * layout.h (Write_symbols_task): Remove unused member input_objects_.
193         * icf.h (Icf): Remove unused member num_tracked_relocs.
194
195         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
196         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
197         its only use.
198         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
199
200         * archive.h: Use struct rather than class for forward declaration
201         of Read_symbols_data.
202
203 2013-10-07  Cary Coutant  <ccoutant@google.com>
204
205         PR gold/16010
206         * testsuite/Makefile.am (icf_test): Fix dependencies.
207         (icf_safe_test): Likewise.
208         (icf_safe_so_test): Likewise.
209         (large_symbol_alignment): Add empty _LDADD rule.
210         * testsuite/Makefile.in: Regenerate.
211
212 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
213
214         PR gold/15927
215         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
216         relocation for R_X86_64_32 on x32.
217
218 2013-08-27  Roland McGrath  <mcgrathr@google.com>
219
220         * output.cc (Output_segment::set_section_addresses): Take new
221         Target* argument.  If target->isolate_execinstr() and the segment
222         is executable and starts at a target->abi_pagesize() boundary,
223         pad its end out to a target->abi_pagesize() boundary with code fill.
224         * output.h (Output_segment::set_section_addresses): Update decl.
225         * layout.h (Layout::check_output_data_for_reset_values): Take new
226         argument RELAX_OUTPUTS.
227         (Layout): New member relax_output_list_.
228         (Layout::add_relax_output): New method.
229         * layout.cc (Layout::Layout): Update constructor.
230         (Layout::reset_relax_output): New method.
231         (Layout::clean_up_after_relaxation): Call it.
232         (Layout::prepare_for_relaxation): Update caller.
233         (Layout::set_segment_offsets): Update callers of set_section_addresses.
234         Call reset_relax_output before re-processing segments for
235         isolate_execinstr case.
236         (Layout::write_data): Handle relax_output_list_.
237         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
238         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
239
240 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
241
242         PR binutils/15834
243         * object.h: Fix typos.
244
245 2013-08-16  Roland McGrath  <mcgrathr@google.com>
246
247         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
248         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
249
250 2013-08-07  Cary Coutant  <ccoutant@google.com>
251
252         Revert support for v2 DWP files:
253
254         2013-03-01  Cary Coutant  <ccoutant@google.com>
255
256             Add dwp support for v2 DWARF package file format.
257             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
258             tu_length parameter.  Adjust all callers.
259             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
260             * dwp.cc: Include dwarf.h.
261             (Section_bounds): New struct type.
262             (Unit_set): New struct type.
263             (Dwo_file::Dwo_file): Initialize new data member.
264             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
265             Combine and rename to...
266             (Dwo_file::read_unit_index): ...this.
267             (Dwo_file::sized_read_compunit_index)
268             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
269             (Dwo_file::sized_read_unit_index): ...this.
270             (Dwo_file::copy_section): Remove section_name, is_str_offsets
271             parameters; add section_id parameter.
272             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
273             (Dwo_file::add_unit_set): ...this.
274             (Dwo_file::shndx_map_): Remove.
275             (Dwo_file::sect_offsets_): New data member.
276             (Dwp_output_file::Dwp_output_file): Initialize new data members.
277             (Dwp_output_file::add_section): Rename to...
278             (Dwp_output_file::add_contribution): ...this.
279             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
280             (Dwp_output_file::add_tu_set): Likewise.
281             (Dwp_output_file::Contribution): New type.
282             (Dwp_output_file::Section::contributions): New data member.
283             (Dwp_output_file::Cu_or_tu_set): Remove.
284             (Dwp_output_file::Section::Section): New ctor.
285             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
286             (Dwp_output_file::Dwp_index::Section_table): New type.
287             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
288             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
289             parameter.
290             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
291             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
292             (Dwp_output_file::Dwp_index::section_table): New member function.
293             (Dwp_output_file::Dwp_index::section_table_end): New member function.
294             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
295             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
296             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
297             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
298             (Dwp_output_file::Dwp_index::section_table_): New data member.
299             (Dwp_output_file::Dwp_index::section_mask_): New data member.
300             (Dwp_output_file::add_output_section): New member function.
301             (Dwp_output_file::write_new_section): New member function.
302             (Dwp_output_file::write_contributions): New member function.
303             (Dwp_output_file::section_id_map_): New data member.
304             (class Dwo_id_info_reader): Remove.
305             (class Unit_reader): New class.
306             (get_dwarf_section_name): New function.
307             (Dwo_file::read_executable): Adjust initializations of class data.
308             (Dwo_file::read): Add support for v2 package file format.
309             (Dwo_file::read_unit_index): Likewise.
310             (Dwo_file::sized_read_unit_index): Likewise.
311             (Dwo_file::copy_section): Likewise.
312             (Dwo_file::add_unit_set): Likewise.
313             (Dwp_output_file::add_output_section): Likewise.
314             (Dwp_output_file::add_contribution): Likewise.
315             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
316             for empty slot.
317             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
318             file format.
319             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
320             slot.
321             (Dwp_output_file::initialize): Remove unused function.
322             (Dwp_output_file::finalize): Add support for v2 package file format.
323             (Dwp_output_file::write_index): Likewise.
324             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
325             function prototype.
326
327 2013-07-31  Cary Coutant  <ccoutant@google.com>
328
329         * object.cc (Sized_relobj::do_output_section_address): New function.
330         (Sized_relobj): Instantiate explicitly.
331         * object.h (Object::output_section_address): New function.
332         (Object::do_output_section_address): New function.
333         (Sized_relobj::do_output_section_address): New function.
334         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
335
336 2013-07-30  Cary Coutant  <ccoutant@google.com>
337             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
338
339         * parameters.cc (Parameters::entry): Return target-specific entry
340         symbol name.
341         * target.h (Target::entry_symbol_name): New function.
342         (Target_info::entry_symbol_name): New data member.
343
344         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
345         * i386.cc (Target_i386::i386_info): Likewise.
346         (Target_i386_nacl::i386_nacl_info): Likewise.
347         * sparc.cc (Target_sparc::sparc_info): Likewise.
348         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
349         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
350         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
351         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
352
353 2013-07-22  Sterling Augustine  <saugustine@google.com>
354
355         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
356         Convert parameter shndx to local variable. Add parameters symtab
357         and symtab_size.  Scan over section names.  Find relocation
358         section corresponding to current section.  Create and initialize
359         reloc_mapper_ and reloc_type_.
360         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
361         unit_length to off_t.  Initialize member unit_length_.  Fill in field
362         cu_offset_.
363         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
364         Initialize new fields unit_length_ and cu_offset_.
365         (Dwarf_pubnames_table::read_section): Update prototype.
366         (Dwarf_pubnames_table::cu_offset): New member function.
367         (Dwarf_pubnames_table::subsection_size): Likewise.
368         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
369         New fields.
370         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
371         member functions public.
372         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
373         Update comment.  Rework logic.  Move repeated parts to...
374         (Gdb_index_info_reader::read_pubtable): ...here. New function.
375         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
376         pubtypes_table_, and stmt_list_offset.
377         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
378         Gdb_index::find_pubtype_offset,
379         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
380         (Gdb_index::pubnames_read): Update prototype and rework logic.
381         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
382         Forward declare.
383         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
384         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
385         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
386         Gdb_index::map_pubtable_to_dies):
387         Declare functions.
388         (Gdb_index::pubnames_read): Update declaration.
389         (Gdb_index::Pubname_offset_map): New type.
390         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
391         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
392         Gdb_index::stmt_list_offset): Declare.
393         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
394         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
395         Gdb_index::pubtypes_offset_): Remove.
396
397 2013-07-19  Roland McGrath  <mcgrathr@google.com>
398
399         * options.h (General_options): Add -Trodata-segment option.
400         * parameters.cc (Parameters::check_rodata_segment): New function.
401         (Parameters::set_target_once): Call it.
402         * parameters.h (Parameters): Declare it (private member function).
403         * layout.cc (load_seg_unusable_for_headers): New function, broken
404         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
405         then validate rodata segment rather than text segment.
406         (relaxation_loop_body): Call that.
407         (is_text_segment): New function.  Don't admit a non-executable
408         segment if TARGET->isolate_execinstr().
409         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
410
411 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
412
413         PR gold/15070
414         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
415         * nacl.h (Sniff_file::View::View): Request aligned view.
416
417 2013-07-11  Cary Coutant  <ccoutant@google.com>
418
419         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
420         correct BRLT entry size.
421
422 2013-07-03  Alan Modra  <amodra@gmail.com>
423
424         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
425         comment.
426
427 2013-07-01  Cary Coutant  <ccoutant@google.com>
428
429         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
430         reloc_type_.
431         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
432         (Dwarf_ranges_table::lookup_reloc): New function.
433         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
434         reloc_type_.
435         (Dwarf_ranges_table::lookup_reloc): New function.
436         (Dwarf_ranges_table::reloc_type_): New data member.
437
438 2013-06-27  Jing Yu  <jingyu@google.com>
439
440         PR gold/15662
441         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
442         function.
443         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
444         (Target_powerpc::do_relax): Call the above.
445
446 2013-06-27  Cary Coutant  <ccoutant@google.com>
447
448         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
449         on garbage collected .opd section.
450
451 2013-06-27  Alan Modra  <amodra@gmail.com>
452
453         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
454         is non-zero.
455         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
456         (Target_powerpc::do_function_location): Likewise for loc->shndx.
457
458 2013-06-14  Cary Coutant  <ccoutant@google.com>
459
460         * resolve.cc (Symbol::override_base): Don't override st_type
461         from plugin placeholder symbols.
462         (Symbol_table::resolve): Likewise.
463         (Symbol_table::should_override): Don't complain about TLS mismatch
464         if the TO symbol is a plugin placeholder.
465         * testsuite/Makefile.am (plugin_test_tls): New test.
466         * testsuite/Makefile.in: Regenerate.
467         * testsuite/plugin_test_tls.sh: New test script.
468         * testsuite/two_file_test_2_tls.cc: New test source.
469         * testsuite/two_file_test_tls.cc: New test source.
470
471 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
472
473         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
474         the maximum segment alignment is larger than the page size.
475         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
476         correctly aligns the symbols with large alignemnt.
477         * testsuite/Makefile.in: Regenerate.
478         * testsuite/large_symbol_alignment.cc: New file.
479
480 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
481             Sriraman Tallam  <tmsriram@google.com>
482
483         * options.h (sort_section): New option.
484         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
485         Rename from Input_section_sort_section_name_special_ordering_compare.
486         (Input_section_sort_section_name_compare): New struct.
487         * output.cc (Output_section::Input_section_sort_section_name_compare::
488         operator()): New function.
489         (Output_section::sort_attached_input_sections): Use new sort function
490         for .text if --sort-section=name is specified.
491         * layout.cc (Layout::make_output_section):
492         Add sorting by name when --sort-section=name is specified.
493         * testsuite/Makefile.am (text_section_grouping): Test option
494         --sort-section=name.
495         * testsuite/Makefile.in: Regenerate.
496         * testsuite/section_sorting_name.cc: New file.
497         * testsuite/section_sorting_name.sh: New file.
498
499 2013-05-21  Cary Coutant  <ccoutant@google.com>
500
501         * symtab.h (Symbol::is_cxx_vtable): New function.
502         * target-reloc.h (relocate_section): Check for vtable symbol.
503         * testsuite/Makefile.am (missing_key_func.sh): New test case.
504         * testsuite/Makefile.in: Regenerate.
505         * testsuite/missing_key_func.cc: New test source.
506         * testsuite/missing_key_func.sh: New test script.
507
508 2013-05-21  Cary Coutant  <ccoutant@google.com>
509
510         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
511         type of enclosing symbol.
512         (Relocate_info::location): Check symbol type when describing symbol.
513         * object.h (Symbol_location_info): Remove unused line_number;
514         add enclosing_symbol_type.
515         * testsuite/debug_msg.sh: Adjust expected output.
516
517 2013-05-13  Cary Coutant  <ccoutant@google.com>
518
519         * configure.ac: Export DEFAULT_TARGET.
520         * configure: Regenerate.
521         * Makefile.in: Regenerate.
522         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
523         * testsuite/Makefile.in: Regenerate.
524         * testsuite/debug_msg.sh: Delete duplicate tests.
525         Don't check undef_int error message match for powerpc where the
526         source file and line number aren't available.
527
528 2013-05-10  Roland McGrath  <mcgrathr@google.com>
529
530         * options.h (General_options): Add --rosegment-gap option.
531         * options.cc (finalize): --rosegment-gap implies --rosegment.
532         * layout.cc (set_segment_offsets): Let user option override
533         target->rosegment_gap().
534
535 2013-05-10  Roland McGrath  <mcgrathr@google.com>
536
537         * options.h (General_options): Remove leading space from help
538         messages for -nostdlib and --rosegment.
539
540 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
541
542         PR ld/15365
543         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
544
545 2013-05-03  Alan Modra  <amodra@gmail.com>
546
547         * merge.cc (Output_merge_string::do_add_input_section): Correct
548         scan for number of strings.  Rename vars to avoid shadowing.
549         Include missing terminator in input_size_.
550
551 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
552
553         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
554         Restore empty string handling.
555
556 2013-05-01  Cary Coutant  <ccoutant@google.com>
557
558         * stringpool.cc (Stringpool_template::new_key_offset): Fix
559         uninitialized warning.
560
561 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
562
563         * output.cc (Output_section::add_merge_input_section): Allow
564         to merge sections if the alignment is more than character size.
565         * merge.h (Output_merge_string::Output_merge_string): Remove
566         assert.
567         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
568         only not-null strings. Check the alignment of strings.
569         * stringpool.h
570         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
571         alignment as the argument.
572         (Stringpool_template<Stringpool_char>::addralign_): New class member.
573         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
574         Align non-zero length strings according to the addralign_.
575         (Stringpool_template<Stringpool_char>::set_string_offsets):
576         Updating offsets according to the given alignment.
577         * testsuite/Makefile.am (text_section_grouping): Test if string
578         literals are getting merged.
579         * testsuite/Makefile.in: Regenerate.
580         * testsuite/merge_string_literals_1.c: New file.
581         * testsuite/merge_string_literals_2.c: Ditto.
582         * testsuite/merge_string_literals.sh: Ditto.
583
584 2013-04-26  Ian Lance Taylor  <iant@google.com>
585
586         * target-reloc.h (relocate_section): If the reloc offset is out of
587         range, pass VIEW as NULL to relocate.relocate.
588         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
589         * i386.cc (Target_i386::Relocate::relocate): Likewise.
590         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
591         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
592         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
593         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
594
595 2013-04-26  Geoff Pike  <gpike@chromium.org>
596
597         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
598         * layout.cc (Hash_task): New class.
599         (Layout::queue_build_id_tasks): New function.
600         (Layout::write_build_id): Handle single-thread portion of build ID
601         computation.  (In some cases, all of it is single-threaded.)  Replace
602         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
603         functionality in fewer lines of code.
604         * layout.h (Layout::queue_build_id_tasks): New function declaration.
605         * options.h (General_options): make "--build-id" default to tree
606         rather than sha1.  Add two new options related to --build-id=tree:
607         --build-id-chunk-size-for-treehash and
608         --build-id-min-file-size-for-treehash.
609         * Makefile.am: add testing of --build-id=tree and related new options
610         (these tests will be invoked by "make check").
611         * Makefile.in: Regenerate.
612
613 2013-04-25  Alan Modra  <amodra@gmail.com>
614
615         * configure.tgt: Add powerpcle and powerpc64le.
616
617 2013-04-22  Alan Modra  <amodra@gmail.com>
618
619         PR gold/15355
620         * layout.cc (Layout::segment_precedes): Allow more than one
621         segment with the same type and flags.
622
623 2013-04-15  Cary Coutant  <ccoutant@google.com>
624
625         * layout.cc (Layout::set_relocatable_section_offsets): Don't
626         allocate space in file for BSS sections.
627
628 2013-04-15  Cary Coutant  <ccoutant@google.com>
629
630         * script-sections.cc (Orphan_output_section): Reset address
631         to zero after each orphaned section for relocatable links.
632
633 2013-04-15  Cary Coutant  <ccoutant@google.com>
634
635         * symtab.cc (Symbol_table::sized_write_globals): Subtract
636         section starting address for relocatable link.
637         * testsuite/Makefile.am (script_test_11): New test.
638         * testsuite/Makefile.in: Regenerate.
639         * testsuite/script_test_11.c: New source file.
640         * testsuite/script_test_11.t: New linker script.
641
642 2013-04-13  Alan Modra  <amodra@gmail.com>
643
644         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
645         owner when sections are not adjacent and exceed group size.
646         (Target_powerpc::group_sections): Handle corner case.
647         (Target_powerpc::Branch_info::make_stub): Handle case where
648         stub table doesn't exist due to branches in non-exec sections.
649         (Target_powerpc::Relocate::relocate): Likewise.
650
651 2013-04-11  Alan Modra  <amodra@gmail.com>
652
653         PR gold/15354
654         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
655         .branch_lt to match bfd ld.  Adjust comments throughout file.
656
657 2013-04-04  Ian Lance Taylor  <iant@google.com>
658
659         GCC PR c++/56840
660         * object.cc (do_layout_deferred_sections): Handle .eh_frame
661         sections before checking whether they are included in the link.
662
663 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
664
665         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
666         object before calling the plugin claim_file handler.  Pass the elf
667         object of the archive to the plugin. Delete the elf object if the
668         plugin claims the file.
669
670 2013-03-21  Alan Modra  <amodra@gmail.com>
671
672         * layout.cc (Layout::set_segment_offsets): Accept writable .text
673         segment when omagic.
674
675 2013-03-21  Alan Modra  <amodra@gmail.com>
676
677         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
678         comparison warning.
679         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
680         uninitialized" warning.
681
682 2013-03-20  Alan Modra  <amodra@gmail.com>
683
684         * symtab.h (Symbol::clear_version): New function.
685         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
686         is_needed by weak references.  Clear version for symbols defined
687         in as-needed objects that are not needed.
688
689 2013-03-15  Alan Modra  <amodra@gmail.com>
690
691         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
692         static and public.  Add report_err param.  Return false for data refs.
693         (Target_powerpc::rela_dyn_section): New overloaded function.
694         (Target_powerpc::plt_, iplt_): Elucidate.
695         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
696         (Output_data_plt_powerpc::do_write): Don't write .iplt.
697         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
698         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
699         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
700         push_branch and make_plt_entry for ifunc syms when
701         reloc_needs_plt_for_ifunc.
702         (Target_powerpc::Relocate::relocate): Don't use plt entry value
703         for ifunc unless reloc_needs_plt_for_ifunc.
704
705 2013-03-15  Alan Modra  <amodra@gmail.com>
706
707         * gc.h (gc_process_relocs): Don't look through function descriptors.
708         * icf.cc (get_section_contents): Do so here instead.
709
710 2013-03-13  Alan Modra  <amodra@gmail.com>
711
712         * powerpc.cc (is_branch_reloc): Forward declare.
713         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
714         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
715         false for 64-bit, true for 32-bit non-branch relocs.
716         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
717         * testsuite/Makefile.am (icf_test): Use linker map file instead of
718         nm output.
719         (icf_safe_test): Generate linker map file as well as nm output.
720         (icf_safe_so_test): Likewise.
721         * testsuite/Makefile.in: Regenerate.
722         * testsuite/icf_test.sh: Parse linker map file to determine
723         section folding.
724         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
725         * testsuite/icf_safe_so_test.sh: Likewise.
726         (X86_32_or_ARM_specific_safe_fold): Merge into..
727         (arch_specific_safe_fold): ..this.
728         (X86_64_specific_safe_fold): Delete unused function.
729
730 2013-03-12  Alan Modra  <amodra@gmail.com>
731
732         * gc.h (gc_process_relocs): Look through function descriptors
733         to determine shndx, symvalue and addend used by ICF.  Tidy
734         variable duplication.
735
736 2013-03-11  Alan Modra  <amodra@gmail.com>
737
738         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
739         * layout.cc (Layout_task_runner::run): ..to here.
740         * symtab.h (struct Symbol_location): Extract from..
741         (class Symbol_table): ..here.
742         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
743         * target.h (class Target): Add function_location and
744         do_function_location functions.
745         (class Sized_target): Add do_function_location.
746         * object.h (class Sized_relobj_file): Move find_shdr..
747         (class Object): ..to here.
748         * object.cc: Likewise.  Update to suit.  Instantiate.
749         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
750         * powerpc.cc (class Powerpc_dynobj): New.
751         (Target_powerpc::do_function_location): New function.
752         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
753         (Powerpc_dynobj::do_read_symbols): New function.
754         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
755
756 2013-03-08  Ian Lance Taylor  <iant@google.com>
757
758         * options.cc (General_options::string_to_object_format): Accept
759         "default".
760
761 2013-03-08  Alan Modra  <amodra@gmail.com>
762
763         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
764         pointer to Post_fde.
765         (struct Post_fde): Move definition to here..
766         * ehframe.cc (struct Post_fde): ..from here.
767         (Cie::write): Don't alloc Post_fde.
768         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
769
770 2013-03-07  Alan Modra  <amodra@gmail.com>
771
772         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
773         relocation referencing .LC0.
774         * testsuite/discard_locals_test.sh: Remove FIXMEs.
775
776 2013-03-07  Alan Modra  <amodra@gmail.com>
777
778         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
779         always_inline.  Add assembly for powerpc to avoid GOT.
780
781 2013-03-07  Alan Modra  <amodra@gmail.com>
782
783         * testsuite/script_test_10.sh: Don't test .bss section
784         header number.
785
786 2013-03-06  Alan Modra  <amodra@gmail.com>
787
788         * powerpc.cc (class Powerpc_relobj): Move some member functions.
789         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
790         all callers.  Handle folded sections.
791         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
792         to Powerpc_relobj.
793         (Global_symbol_visitor_opd::operator()): Likewise.
794
795 2013-03-04  Alan Modra  <amodra@gmail.com>
796
797         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
798         * testsuite/Makefile.in: Regenerate.
799
800 2013-03-01  Cary Coutant  <ccoutant@google.com>
801
802         Add dwp support for v2 DWARF package file format.
803         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
804         tu_length parameter.  Adjust all callers.
805         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
806         * dwp.cc: Include dwarf.h.
807         (Section_bounds): New struct type.
808         (Unit_set): New struct type.
809         (Dwo_file::Dwo_file): Initialize new data member.
810         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
811         Combine and rename to...
812         (Dwo_file::read_unit_index): ...this.
813         (Dwo_file::sized_read_compunit_index)
814         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
815         (Dwo_file::sized_read_unit_index): ...this.
816         (Dwo_file::copy_section): Remove section_name, is_str_offsets
817         parameters; add section_id parameter.
818         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
819         (Dwo_file::add_unit_set): ...this.
820         (Dwo_file::shndx_map_): Remove.
821         (Dwo_file::sect_offsets_): New data member.
822         (Dwp_output_file::Dwp_output_file): Initialize new data members.
823         (Dwp_output_file::add_section): Rename to...
824         (Dwp_output_file::add_contribution): ...this.
825         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
826         (Dwp_output_file::add_tu_set): Likewise.
827         (Dwp_output_file::Contribution): New type.
828         (Dwp_output_file::Section::contributions): New data member.
829         (Dwp_output_file::Cu_or_tu_set): Remove.
830         (Dwp_output_file::Section::Section): New ctor.
831         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
832         (Dwp_output_file::Dwp_index::Section_table): New type.
833         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
834         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
835         parameter.
836         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
837         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
838         (Dwp_output_file::Dwp_index::section_table): New member function.
839         (Dwp_output_file::Dwp_index::section_table_end): New member function.
840         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
841         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
842         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
843         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
844         (Dwp_output_file::Dwp_index::section_table_): New data member.
845         (Dwp_output_file::Dwp_index::section_mask_): New data member.
846         (Dwp_output_file::add_output_section): New member function.
847         (Dwp_output_file::write_new_section): New member function.
848         (Dwp_output_file::write_contributions): New member function.
849         (Dwp_output_file::section_id_map_): New data member.
850         (class Dwo_id_info_reader): Remove.
851         (class Unit_reader): New class.
852         (get_dwarf_section_name): New function.
853         (Dwo_file::read_executable): Adjust initializations of class data.
854         (Dwo_file::read): Add support for v2 package file format.
855         (Dwo_file::read_unit_index): Likewise.
856         (Dwo_file::sized_read_unit_index): Likewise.
857         (Dwo_file::copy_section): Likewise.
858         (Dwo_file::add_unit_set): Likewise.
859         (Dwp_output_file::add_output_section): Likewise.
860         (Dwp_output_file::add_contribution): Likewise.
861         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
862         for empty slot.
863         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
864         file format.
865         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
866         slot.
867         (Dwp_output_file::initialize): Remove unused function.
868         (Dwp_output_file::finalize): Add support for v2 package file format.
869         (Dwp_output_file::write_index): Likewise.
870         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
871         function prototype.
872
873 2013-03-01  Cary Coutant  <ccoutant@google.com>
874
875         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
876         function into class definition in header file.
877         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
878         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
879         New function.
880         (Dwarf_info_reader::check_buffer): Move here from .cc file.
881
882 2013-02-28  Alan Modra  <amodra@gmail.com>
883
884         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
885         * target.cc (Target::do_plt_fde_location): New function.
886         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
887         accessor function, and constructor param.
888         (struct Post_fde, Post_fdes): Declare.
889         (Cie::write): Add post_fdes param.
890         * ehframe.cc (Fde::write): Use plt_fde_location.
891         (struct Post_fde): Define.
892         (Cie::write): Stash FDEs added post merge mapping.
893         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
894         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
895         (Eh_frame::do_sized_write): Arrange to write post map FDES after
896         other FDEs.
897         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
898         (Target_powerpc::has_glink): New function.
899         (Target_powerpc::do_relax): Add eh_frame info for stubs.
900         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
901         glink_eh_frame_fde_32, default_fde): New data.
902         (Stub_table::eh_frame_added_): New var.
903         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
904         Make const.
905         (Stub_table::add_eh_frame): New function.
906         (Output_data_glink::add_eh_frame): New function.
907         (Target_powerpc::make_glink_section): Call add_eh_frame.
908
909 2013-02-15  Ian Lance Taylor  <iant@google.com>
910
911         * options.h (DEFINE_uint64_alias): Define.
912         (class General_options): Add -Ttext-segment as an alias for
913         -Ttext.
914
915 2013-02-15  Alan Modra  <amodra@gmail.com>
916
917         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
918         (Stub_table::do_write): ..here, two places.
919         (Stub_table::plt_call_size): Use it here too.
920
921 2013-02-11  Ian Lance Taylor  <iant@google.com>
922
923         * descriptors.cc (Descriptors::close_all): New function.
924         * descriptors.h (class Descriptors): Declare close_all.
925         (close_all_descriptors): New inline function.
926         * plugin.cc: Include "descriptors.h".
927         (Plugin_manager::cleanup): Call close_all_descriptors.
928
929 2013-02-06  Alan Modra  <amodra@gmail.com>
930
931         * README: Update coding style link.
932
933 2013-01-28  Cary Coutant  <ccoutant@google.com>
934
935         * dwp.cc (File_list): New typedef.
936         (Dwo_name_info_reader): New class.
937         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
938         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
939         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
940         (Dwo_file::read_executable): New function.
941         (Dwo_file::read): Move common setup code to ...
942         (Dwo_file::make_object): ... here.
943         (dwp_options): Add --exec/-e.
944         (usage): Likewise.
945         (main): Likewise.
946
947 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
948
949         * layout.cc (Layout::layout): Check for option text_reorder.
950         (Layout::make_output_section): Ditto.
951         * options.h (text_reorder): New option.
952         * output.cc (Input_section_sort_compare): Remove special ordering
953         of section names.
954         (Output_section::
955          Input_section_sort_section_name_special_ordering_compare::
956          operator()): New function.
957         (Output_section::sort_attached_input_sections): Use new sort function
958         for .text.
959         * output.h (Input_section_sort_section_name_special_ordering_compare):
960         New struct.
961         * testsuite/Makefile.am (text_section_grouping): Test option
962         --no-text-reorder
963         * testsuite/Makefile.in: Regenerate.
964         * testsuite/text_section_grouping.sh: Check order of functions without
965         default text reordering.
966
967 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
968
969         * options.h (General_options): Change default to true for new_dtags.
970
971 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
972
973         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
974         when enable_new_dtags is false.  Only add DT_RUNPATH when
975         enable_new_dtags is true.
976
977 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
978
979         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
980         used in declaration and definition consistent.
981         (Target_powerpc::symval_for_branch): Ditto.
982
983 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
984
985         * testsuite/plugin_final_layout.cc: Fix comment.
986
987 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
988
989         * layout.cc (Layout::layout): Do not do default sorting for
990         text sections when section ordering is specified.
991         (make_output_section): Ditto.
992         * testsuite/plugin_final_layout.cc: Name the function sections
993         to catch reordering issues.
994
995 2013-01-15  Alan Modra  <amodra@gmail.com>
996
997         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
998         plt-thread-safe.
999
1000 2013-01-15  Alan Modra  <amodra@gmail.com>
1001
1002         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1003         * testsuite/Makefile.in: Regenerate.
1004
1005 2013-01-14  Alan Modra  <amodra@gmail.com>
1006
1007         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1008         * testsuite/Makefile.in: Regenerate.
1009
1010 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1011
1012         PR bfd/14430
1013         Fix mingw gold build with plugins enabled
1014         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1015         * configure.ac: Export DLOPEN_LIBS and add headers check.
1016         * plugin.cc: Handle non-dlfcn case.
1017         * Makefile.in: Regenerate.
1018         * config.in: Regenerate.
1019         * configure: Regenerate.
1020         * testsuite/Makefile.in: Regenerate.
1021
1022 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1023
1024         * output.h (sort_attached_input_sections): Change to be public.
1025         * script-sections.cc
1026         (Output_section_definition::set_section_addresses): Sort
1027         attached input sections according to section order before linker
1028         script assigns section addresses.
1029         (Orphan_output_section::set_section_addresses): Sort
1030         attached input sections according to section order before linker
1031         script assigns section addresses.
1032         * Makefile.am (final_layout.sh): Use a simple linker script to
1033         check if section ordering still works.
1034         * Makefile.in: Regenerate.
1035
1036 2013-01-09  Ben Cheng  <bccheng@google.com>
1037
1038         * arm.cc (Target_arm::attributes_accept_div): New function.
1039         (Target_arm::attributes_forbid_div): New function.
1040         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1041         attribute using the same new functions as what bfd/elf32_arm.c
1042         does.
1043
1044 2013-01-07  Cary Coutant  <ccoutant@google.com>
1045
1046         PR gold/14993
1047         * output.cc (Output_section::add_input_section): For incremental
1048         updates, don't track input sections that are allocated from patch
1049         space.
1050
1051 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1052             Ian Lance Taylor  <iant@google.com>
1053
1054         PR gold/14897
1055         * configure.ac (--enable-ld): Removed.
1056         (install_as_default): Set to yes only for --enable-gold=default
1057         or --disable-ld.
1058         * configure: Regenerated.
1059
1060 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1061
1062         * options.h (General_options): Add -fuse-ld= for GCC linker
1063         option compatibility.
1064
1065 2013-01-04  Cary Coutant  <ccoutant@google.com>
1066
1067         * configure.ac: Fix typo restoring CXXFLAGS.
1068         * configure: Regenerate.
1069
1070 2013-01-04  Cary Coutant  <ccoutant@google.com>
1071
1072         * testsuite/Makefile.am (CXXLINK_S): New macro.
1073         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1074         * testsuite/Makefile.in: Regenerate.
1075
1076 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1077
1078         * version.cc (print_version): Update copyright year to 2013.
1079
1080 2012-12-20  Ian Lance Taylor  <iant@google.com>
1081
1082         * layout.cc (Layout::special_ordering_of_input_section): New
1083         function.
1084         (Layout::layout): If input section requires special ordering, must
1085         sort input sections.
1086         (Layout::make_output_section): May sort .text input sections.
1087         (Layout::is_section_name_prefix_grouped): Remove.
1088         * layout.h (class Layout): Declare
1089         special_ordering_of_input_section.  Don't declare
1090         is_section_name_prefix_grouped.
1091         * output.cc (Output_section::add_input_section): Revert last
1092         change.
1093         (Output_section::Input_section_sort::match_file_name): Don't crash
1094         if called on output section data.
1095         (Output_section::Input_section_sort_compare): Sort based on
1096         special ordering.
1097         (Output_section::Input_section_sort_section_order_index_compare):
1098         Revert last patch.
1099         (Output_section::sort_attached_input_sections): Likewise.
1100
1101 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1102
1103         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1104         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1105         * output.cc (Output_section::add_input_section): Check if section
1106         name contains special prefix.  Keep input sections to sort such
1107         sections.
1108         (Output_section::Input_section_sort_section_order_index_compare
1109          ::operator()): Group sections according to prefixes.
1110         (Output_section::sort_attached_input_sections): Add condition to
1111         Input_section_entry constructor call.
1112         * testsuite/Makefile.am (text_section_grouping): New test.
1113         * testsuite/Makefile.in: Regenerate.
1114         * testsuite/text_section_grouping.cc: New file.
1115         * testsuite/text_section_grouping.sh: New file.
1116
1117 2012-12-17  Nick Clifton  <nickc@redhat.com>
1118
1119         * Makefile.am: Add copyright notice.
1120         * NEWS: Likewise.
1121         * README: Likewise.
1122         * configure.ac: Likewise.
1123         * ftruncate.c: Likewise.
1124         * Makefile.in: Regenerate.
1125
1126 2012-12-14  Cary Coutant  <ccoutant@google.com>
1127
1128         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1129         --no-as-needed flag.
1130         (exception_separate_shared_12_test): Likewise.
1131         (incremental_copy_test): Likewise.
1132         * testsuite/Makefile.in: Regenerate.
1133
1134 2012-12-14  Cary Coutant  <ccoutant@google.com>
1135
1136         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1137         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1138
1139 2012-12-12  Alan Modra  <amodra@gmail.com>
1140
1141         * powerpc.cc (class Track_tls): New.
1142         (class Relocate, class Scan): Inherit Track_tls.
1143         (Target_powerpc::Scan::local, global): Track tls optimization
1144         and avoid creating plt entry for __tls_get_addr if all uses
1145         are optimized away.
1146         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1147
1148 2012-12-12  Alan Modra  <amodra@gmail.com>
1149
1150         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1151         Replace no_toc_optimize with toc_optimize.
1152         * output.h (Output_section::input_sections): Provide non-const variant.
1153         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1154         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1155         accessors.
1156         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1157         (class Sort_toc_sections): New.
1158         (Target_powerpc::do_finalize_sections): Sort toc sections.
1159         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1160
1161 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1162
1163         * testsuite/binary_unittest.cc (read_all): New function.
1164         (Sized_binary_test): Use it instead of ::read.
1165         * fileread.cc (do_read): Don't assume pread always reads the whole
1166         amount in a single call.
1167
1168 2012-12-10  Alan Modra  <amodra@gmail.com>
1169
1170         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1171         Set EM_PPC64 or EM_PPC here.
1172         (Target_selector_powerpc::do_recognize): Delete.
1173
1174 2012-12-10  Alan Modra  <amodra@gmail.com>
1175
1176         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1177         stub_table_.
1178         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1179
1180 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1181
1182         * testsuite/binary_unittest.cc (Sized_binary_test):
1183         Use open_descriptor rather than ::open.
1184
1185 2012-12-07  Alan Modra  <amodra@gmail.com>
1186
1187         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1188         typedef and invalid_address constant.
1189         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1190         instantiate constants.
1191
1192 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1193
1194         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1195         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1196         * aclocal.m4: Regenerate.
1197         * configure: Regenerate.
1198         * Makefile.in: Regenerate.
1199         * testsuite/Makefile.in: Regenerate.
1200
1201 2012-12-07  Alan Modra  <amodra@gmail.com>
1202
1203         * options.h (General_options): Add no_toc_optimize.
1204         * powerpc.cc (ok_lo_toc_insn): New function.
1205         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1206
1207 2012-12-06  Alan Modra  <amodra@gmail.com>
1208
1209         * options.h (General_options): Add plt_align, plt_static_chain,
1210         plt_thread_safe.  Update stub_group_size help text.
1211         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1212         for new plt_thread_safe_ var.
1213         (use_plt_offset): Correct comments.
1214         (Target_powerpc::do_relax): Look for thread creation symbols to
1215         determine default plt_thread_safe value.  Clear plt call stubs
1216         as well as branch stubs each iteration.
1217         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1218         insn constants.
1219         (l, hi, ha, write_insn): Move earlier.
1220         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1221         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1222         plt stubs too.
1223         (Stub_table::update_size): Adjust.
1224         (Stub_table::prev_size, set_prev_size): Delete.
1225         (Stub_table::stub_align): Let --plt-align affect result.
1226         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1227         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1228         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1229         (Stub_table::do_write): Support more stub variants.
1230
1231 2012-12-04  Alan Modra  <amodra@gmail.com>
1232
1233         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1234         (Target_powerpc::do_define_standard_symbols): New function.
1235
1236 2012-12-03  Alan Modra  <amodra@gmail.com>
1237
1238         * output.h: Formatting, whitespace.
1239
1240 2012-12-03  Alan Modra  <amodra@gmail.com>
1241
1242         * layout.h (Layout::get_executable_sections): Declare.
1243         * layout.cc (Layout::get_executable_sections): New function.
1244         * arm.cc (Target_arm::group_sections): Use it.
1245         (Arm_output_section::group_sections): Delete now redundant test.
1246         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1247         param to handle relative relocs.
1248         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1249         (Output_data_reloc::add_absolute): Adjust.
1250         (Output_data_reloc::add_relative): New function.
1251         (Output_data::reset_data_size): New function.
1252         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1253         (Output_section::set_addralign): New function.
1254         (Output_section::checkpoint_set_addralign): New function.
1255         (Output_section::clear_section_offsets_need_adjustment): New function.
1256         (Output_section::input_sections): Make public.
1257         * powerpc.cc (class Output_data_brlt_powerpc): New.
1258         (class Stub_table, class Stub_control): New.
1259         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1260         stub_table_, set_stub_table, stub_table): New vectors and accessor
1261         functions.
1262         (Target_powerpc::do_may_relax, do_relax, push_branch,
1263         new_stub_table, stub_tables, brlt_section, group_sections,
1264         add_branch_lookup_table, find_branch_lookup_table,
1265         write_branch_lookup_table, make_brlt_section): New functions.
1266         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1267         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1268         branch_info_): New vars.
1269         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1270         make call stubs here.
1271         (Output_data_glink): Remove all call stub handling from this class.
1272         (Target_powerpc::Scan::local, global): Save interesting branch
1273         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1274         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1275         functions on final link.
1276         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1277         Handle long branch destinations too.
1278         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1279         do_plt_address_for_local): Adjust lookup of plt call stubs.
1280
1281 2012-11-30  Alan Modra  <amodra@gmail.com>
1282
1283         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1284         relocs against protected symbols when building 32-bit shared libs.
1285
1286 2012-11-30  Alan Modra  <amodra@gmail.com>
1287
1288         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1289         param.  Call got_section() to make .got.  Update all callers
1290         and their callers and so on.
1291
1292 2012-11-30  Alan Modra  <amodra@gmail.com>
1293
1294         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1295         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1296         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1297         value if it already exists.
1298
1299 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1300
1301         PR gold/14858
1302         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1303
1304 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1305
1306         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1307         than bfc instruction for data sandboxing.
1308
1309 2012-11-08  Alan Modra  <amodra@gmail.com>
1310
1311         * po/POTFILES.in: Regenerate.
1312
1313 2012-11-05  Alan Modra  <amodra@gmail.com>
1314
1315         * configure.ac: Apply 2012-09-10 change to config.in here.
1316         * configure: Regenerate.
1317
1318 2012-11-05  Alan Modra  <amodra@gmail.com>
1319
1320         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1321         (struct Opd_ent): Use "Address" rather than "Offset".
1322         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1323         (Target_powerpc::got_section): Make public.
1324         (Target_powerpc::scan_relocs): Move code setting symbols..
1325         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1326         Create _SDA_BASE_ only when referenced.
1327
1328 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1329
1330         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1331         from last change.
1332
1333 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1334
1335         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1336         for offset_in_output_section parameter.
1337         (Sized_target::relocate_special_relocatable): Likewise.
1338         * arm.cc (Target_arm::relocate_relocs): Likewise.
1339         (Target_arm::relocate_special_relocatable): Likewise.
1340         * i386.cc (Target_i386::relocate_relocs): Likewise.
1341         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1342         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1343         * target-reloc.h (relocate_relocs): Likewise.
1344         * testsuite/testfile.cc (Target_test): Likewise.
1345         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1346         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1347
1348         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1349         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1350
1351         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1352         parameter, which is unused in the [!F_SETFD] case.
1353
1354         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1355         SYMNDX to off_t before comparing it to this->data_size().
1356         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1357         * incremental.cc (Output_section_incremental_inputs::do_write):
1358         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1359
1360         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1361
1362 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1363
1364         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1365         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1366         in EABI_VER5.
1367
1368 2012-10-29  Cary Coutant  <ccoutant@google.com>
1369
1370         * dwp.cc (usage): Add file and exit status parameters;
1371         add --help and --version options.
1372         (print_version): New function.
1373         (main): Add --help and --version options.
1374
1375 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1376
1377         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1378         final_layout_sequence.txt.
1379         * testsuite/Makefile.in: Regenerated.
1380
1381 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1382
1383         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1384         COMPILE generated by automake.
1385         (LINK1): Likewise.
1386         (CXXCOMPILE1): Likewise.
1387         (CXXLINK1): Likewise.
1388         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1389         (LINK): Likewise.
1390         (CXXCOMPILE): Likewise.
1391         (CXXLINK): Likewise.
1392         * testsuite/Makefile.in: Regenerated.
1393
1394 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1395
1396         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1397         on bad fwrite return.
1398
1399 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1400
1401         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1402         on val.
1403
1404 2012-10-23  Cary Coutant  <ccoutant@google.com>
1405
1406         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1407         * testsuite/Makefile.in: Regenerate.
1408         * testsuite/dwp_test.h: New source file.
1409         * testsuite/dwp_test_1.cc: New source file.
1410         * testsuite/dwp_test_1.s: New source file.
1411         * testsuite/dwp_test_1.sh: New source file.
1412         * testsuite/dwp_test_1b.cc: New source file.
1413         * testsuite/dwp_test_1b.s: New source file.
1414         * testsuite/dwp_test_2.cc: New source file.
1415         * testsuite/dwp_test_2.s: New source file.
1416         * testsuite/dwp_test_2.sh: New source file.
1417         * testsuite/dwp_test_main.cc: New source file.
1418         * testsuite/dwp_test_main.s: New source file.
1419
1420 2012-10-23  Cary Coutant  <ccoutant@google.com>
1421
1422         * dwp.h: New header file.
1423         * dwp.cc: New source file.
1424         * gold.h: Move shared declarations to system.h.
1425         * system.h: New header file.
1426         * Makefile.am: Add dwp.
1427         * Makefile.in: Regenerate.
1428
1429 2012-10-23  Cary Coutant  <ccoutant@google.com>
1430
1431         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1432         Dwarf_info_reader::read_from_pointer.
1433         (Dwarf_pubnames_table::read_header): Likewise.
1434         (Dwarf_pubnames_table::next_name): Likewise.
1435         (Dwarf_die::read_attributes): Likewise.
1436         (Dwarf_die::skip_attributes): Likewise.
1437         (Dwarf_info_reader::read_from_pointer): New function template.
1438         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1439         (Dwarf_pubnames_table): Likewise.
1440         (Dwarf_info_reader::read_from_pointer): New function template.
1441         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1442         Dwarf_pubnames_table ctor.
1443
1444 2012-10-23  Cary Coutant  <ccoutant@google.com>
1445
1446         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1447         abbrev_shndx.
1448         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1449         abbrev_shndx_.
1450         (Dwarf_info_reader::set_abbrev_shndx): New method.
1451         (Dwarf_info_reader::abbrev_shndx_): New data member.
1452
1453 2012-10-23  Cary Coutant  <ccoutant@google.com>
1454
1455         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1456         from object, not parameters.
1457         (Dwarf_info_reader::parse): Likewise.
1458         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1459         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1460         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1461         methods.
1462
1463 2012-10-23  Cary Coutant  <ccoutant@google.com>
1464
1465         * fileread.cc (Input_file::Input_file): New constructor.
1466         * fileread.h (class Input_file): Add new constructor.
1467
1468 2012-10-18  Alan Modra  <amodra@gmail.com>
1469
1470         PR gold/14727
1471         * object.cc (Relobj::is_section_name_included): Also match
1472         .sdata personality section.
1473
1474 2012-10-18  Alan Modra  <amodra@gmail.com>
1475
1476         * target-reloc.h (class Default_comdat_behavior): New, package up..
1477         (get_comdat_behaviour): ..this.
1478         (relocate_section): Add Relocate_comdat_behavior template arg,
1479         adjust code to suit.
1480         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1481         (Target_arm::scan_reloc_section): Likewise.
1482         * i386.cc (Target_i386::relocate_section): Likewise.
1483         * sparc.cc (Target_sparc::relocate_section): Likewise.
1484         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1485         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1486         * powerpc.cc (class Relocate_comdat_behavior): New.
1487         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1488         gold::relocate_section with new template arg.
1489
1490 2012-10-18  Alan Modra  <amodra@gmail.com>
1491
1492         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1493         dynamic relocs for GOT_TPREL got entries, without symbol if
1494         resolving locally.
1495         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1496         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1497         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1498
1499 2012-10-17  Alan Modra  <amodra@gmail.com>
1500
1501         PR gold/14726
1502         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1503
1504 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1505
1506         * layout.cc (Layout::include_section): Keep sections marked
1507         SHF_EXCLUDE when doing relocatable links.
1508
1509 2012-10-16  Alan Modra  <amodra@gmail.com>
1510
1511         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1512         (Target_powerpc::do_finalize_sections): Call it.
1513         (Output_data_save_res): New class and supporting functions.
1514         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1515         normal symbols defined in object files.
1516
1517 2012-10-12  Alan Modra  <amodra@gmail.com>
1518
1519         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1520         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1521         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1522         section if scan_opd_relocs not yet called.
1523         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1524
1525 2012-10-12  Alan Modra  <amodra@gmail.com>
1526
1527         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1528         add_local_ifunc_entry): Revert last change.
1529         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1530
1531 2012-10-05  Alan Modra  <amodra@gmail.com>
1532
1533         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1534         do_plt_address_for_global): New functions.
1535         (Output_data_got_powerpc::do_write): Don't segfault when linking
1536         statically.
1537         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1538         add_local_ifunc_entry): Return true on adding entry..
1539         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1540         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1541         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1542         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1543         set up symbols here.
1544         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1545         syms here.  Do so even when no .iplt.  Don't segfault when linking
1546         statically.
1547         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1548         new variants without reloc param.
1549         (Glink_sym_ent::Glink_sym_ent): Likewise.
1550         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1551         reloc when refs will resolve to plt call stub.
1552         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1553         R_PPC_PLTREL24 to resolve locally.
1554         (Target_powerpc::Scan::global): Correct ifunc handling.
1555         (Target_powerpc::Relocate::relocate): Correct local sym glink
1556         lookup.  Don't destroy "value" when we have a plt call stub,
1557         and when checking plt call validity.
1558         (Target_powerpc::do_dynsym_value): Simplify.
1559
1560 2012-10-05  Alan Modra  <amodra@gmail.com>
1561
1562         * i386.cc (Output_data_plt_i386::address_for_global,
1563         address_for_local): Add plt offset to returned value.  Adjust uses.
1564         * sparc.cc (Output_data_plt_sparc::address_for_global,
1565         address_for_local): Likewise.
1566         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1567         address_for_local): Likewise.
1568         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1569         address_for_local): Likewise.
1570         * target.h (Target::plt_address_for_global, plt_address_for_local):
1571         Update comment.
1572         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1573         (Output_data_got::Got_entry::write): Nor here.
1574         * output.h: Comment fix.
1575
1576 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1577
1578         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1579         global_offset_table_ value for larget got.
1580         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1581
1582 2012-09-29  Alan Modra  <amodra@gmail.com>
1583
1584         * powerpc.cc (Target_powerpc::iplt_): New output section.
1585         (Target_powerpc::iplt_section, make_iplt_section,
1586         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1587         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1588         Target_powerpc::plt_entry_count): Count iplt entries too.
1589         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1590         reloc section in constructor.  New params.
1591         (Target_powerpc::make_plt_section): Create reloc section here instead.
1592         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1593         functions.
1594         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1595         (Output_data_glink::add_entry, find_entry): New functions to
1596         deal with local syms.
1597         (Glink_sym_ent): Add support for local syms.
1598         (Output_data_glink::do_write): Handle ifunc plt entries.
1599         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1600         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1601         (Target_powerpc::Relocate::relocate): Likewise.
1602         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1603
1604 2012-09-25  Alan Modra  <amodra@gmail.com>
1605
1606         * object.h (Sized_relobj_file::adjust_local_symbol,
1607         do_adjust_local_symbol): New functions.
1608         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1609         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1610         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1611         and irregular opd entry spacing.
1612         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1613         (Global_symbol_visitor_opd): New functor.
1614         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1615         on deleted opd entries.
1616
1617 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1618
1619         * tilegx.cc: New file.
1620         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1621         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1622         * configure.tgt: Add entries for tilegx*.
1623         * configure.ac: Likewise.
1624         * Makefile.in: Rebuild.
1625         * configure: Likewise.
1626         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1627         tilegx.
1628
1629 2012-09-13  Alan Modra  <amodra@gmail.com>
1630
1631         * target-reloc.h (scan_relocs): Call scan.local for relocs
1632         against symbols in discarded sections.  Pass is_discarded
1633         param.
1634         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1635         Add is_discarded param.
1636         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1637         is_discarded to flag opd entry as discarded.  Don't emit dyn
1638         relocs on such entries.
1639         (Target_powerpc::Scan::global): Similarly detect and handle
1640         such opd entries.
1641         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1642         opd_ent_.  Update all uses.
1643         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1644         (Target_powerpc::relocate_section): Zero out discarded opd
1645         entry relocs.
1646
1647 2012-09-12  Ian Lance Taylor  <iant@google.com>
1648
1649         PR gold/14570
1650         * output.cc: Rename Output_data_got template parameter from size
1651         to got_size for all functions.  Compile all variants of
1652         Output_data_got.
1653         (Output_data_got::Got_entry::write): Correct use of size for
1654         symbol value.  Use local_is_tls rather than casting to
1655         Sized_relobj_file.
1656         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1657         (class Sized_relobj_file): Add do_local_is_tls.
1658         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1659
1660 2012-09-11  Alan Modra  <amodra@gmail.com>
1661
1662         PR gold/14566
1663         * layout.cc (Layout::set_segment_offsets): When using
1664         common-page-size alignment, ensure we are on a new max-page-size
1665         page.
1666         * output.cc (Output_segment::set_section_addresses): Use
1667         abi_pagesize, not common_pagesize for relro boundary.
1668         (Output_segment::set_offset): Likewise.
1669
1670 2012-09-11  Alan Modra  <amodra@gmail.com>
1671
1672         * output.h (Output_data_got::add_global_tls, add_local_tls,
1673         add_local_tls_pair): New functions.
1674         (Output_data_got::add_local_pair_with_rel): Remove second
1675         reloc param.  Expand comment.
1676         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1677         use_plt_or_tls_offset_, similarly for constructor param.
1678         (Output_data_got::Got_entry::write): Add got_index param.
1679         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1680         add_local_tls_pair): New functions.
1681         (Output_data_got::Got_entry::write): Handle tls symbols
1682         with use_plt_or_tls_offset_ set specially.
1683         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1684         (Output_data_got::do_write): Replace iterator with index, pass
1685         index to entry write function.
1686         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1687         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1688         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1689         call.
1690         * i386.cc (Target_i386::Scan::local): Likewise.
1691         * sparc.cc (Target_sparc::Scan::local): Likewise.
1692         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1693         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1694         do_tls_offset_for_global): New functions.
1695         (Target_powerpc::Scan::local): Correct TLS relocations and got
1696         entry values.
1697         (Target_powerpc::Scan::global): Don't emit unnecessary
1698         dynamic relocations on TLS GOT entries.
1699
1700 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1701
1702         * config.in: Disable sanity check for kfreebsd.
1703
1704 2012-09-10  Sterling Augustine  <saugustine@google.com>
1705
1706         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1707         (Gdb_index::pubtypes_read): New parameter.
1708         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1709         to calls.
1710         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1711         pubtypes_object_.
1712
1713 2012-09-09  Alan Modra  <amodra@gmail.com>
1714
1715         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1716         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1717         * gc.h (gc_process_relocs): Call target gc_add_reference.
1718         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1719         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1720         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1721         unnecessary cast.
1722         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1723         to cater for when we don't need code offset.  Update use.
1724         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1725         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1726         set_opd_valid): New functions.
1727         (Target_powerpc::do_gc_add_reference): New function.
1728         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1729         stashed refs.
1730         (Target_powerpc::do_gc_mark_symbol): New function.
1731
1732 2012-09-06  Cary Coutant  <ccoutant@google.com>
1733
1734         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1735         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1736         (Dwarf_die::skip_attributes): Likewise.
1737         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1738         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1739         (main): Call it.
1740         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1741
1742 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1743
1744         * testsuite/script_test_3.t: Add .got.plt output section
1745         statement.
1746         * testsuite/script_test_4.t: Likewise.
1747
1748 2012-09-05  Alan Modra  <amodra@gmail.com>
1749
1750         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1751         update all uses and lose "enum" when using type.
1752
1753 2012-09-05  Alan Modra  <amodra@gmail.com>
1754
1755         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1756         * configure: Regenerate.
1757         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1758         (plugin_final_layout.stdout): Likewise.
1759         (memory_test): Set page sizes to 0x1000.
1760         * testsuite/Makefile.in: Regenerate.
1761         * testsuite/discard_locals_test.sh: Add FIXME comment.
1762         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1763         * testsuite/pr14265.t: Add .got output section statement.
1764         * testsuite/script_test_2.t: Likewise.
1765         * testsuite/script_test_3.t: Likewise.
1766         * testsuite/script_test_4.t: Likewise.
1767         * testsuite/script_test_5.t: Likewise.
1768         * testsuite/script_test_6.t: Likewise.
1769         * testsuite/script_test_7.t: Likewise.
1770         * testsuite/script_test_9.t: Likewise.
1771
1772 2012-09-05  Alan Modra  <amodra@gmail.com>
1773
1774         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1775         (Powerpc_relocate_functions::Status): New typedef.
1776         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1777         (Target_powerpc::Scan::local): Handle REL64.
1778         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1779         for REL32 and REL64.
1780         (Target_powerpc::symval_for_branch): New function, extracted from..
1781         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1782         checks.  Report overflow errors.
1783
1784 2012-09-05  Alan Modra  <amodra@gmail.com>
1785
1786         * object.h (Sized_relobj_file::emit_relocs): Delete.
1787         (Sized_relobj_file::emit_relocs_reltype): Delete.
1788         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1789         relocate_relocs for --emit-relocs.
1790         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1791         * output.h: Update comment.
1792         (Output_segment::first_section): New function.
1793         (Output_segment::first_section_load_address): Use first_section.
1794         * output.cc (Output_segment::first_section): New function extracted..
1795         (Output_segment::first_section_load_address): ..from here.  Delete.
1796         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1797         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1798         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1799         adjust call to target.h function.
1800         * i386.cc (Target_i386): Likewise.
1801         * sparc.cc (Target_sparc): Likewise.
1802         * x86_64.cc (Target_x86_64): Likewise.
1803         * powerpc.cc (Target_powerpc): Likewise.
1804         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1805         first tls section has section symbol for optimised local dynamic
1806         output relocs.
1807         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1808         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1809         optimised tls code.
1810         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1811         Rename to relocate_relocs.  Update error message.
1812
1813 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1814
1815         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1816         --just-symbols.
1817
1818 2012-08-31  Alan Modra  <amodra@gmail.com>
1819
1820         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1821         (Powerpc_relobj::toc_base_offset): New stub function.
1822         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1823         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1824         (Target_powerpc::Relocate::enum skip_tls): New.
1825         (Target_powerpc::call_tls_get_addr_): New var.
1826         (Target_powerpc::is_branch_reloc): Move to file scope.
1827         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1828         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1829         New functions.
1830         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1831         (powerpc_info): Correct common_pagesize for ppc64.
1832         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1833         (Powerpc_relocate_functions): Add overflow check enums and functions.
1834         Add non-shift version of rela, rela_ua.  Delete all rel public
1835         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1836         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1837         addr16_ha3, addr14 functions.
1838         (Output_data_got_powerpc::add_constant_pair): New function.
1839         (Output_data_got_powerpc::got_base_offset): Likewise.
1840         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1841         (instruction constants): Sort, add some more.
1842         (Output_data_glink::do_write): Add and use Address typedef.  Use
1843         object->toc_base_offset() stub for 64-bit.
1844         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1845         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1846         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1847         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1848         Always treat .opd relocs as against locally defined symbol.
1849         Correct condition for RELATIVE relocs.
1850         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1851         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1852         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1853         calculations.  Handle TLS relocs, and more.  Add overflow
1854         checking and adjust for Powerpc_relocate_functions changes.
1855         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1856         Reinstate --emit-relocs code with FIXME.
1857
1858 2012-08-30  Alan Modra  <amodra@gmail.com>
1859
1860         * layout.cc (Layout::set_segment_offsets): Set p_align to
1861         abi_pagesize, not common_pagesize.
1862         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1863         to determine whether file header can go in segment.
1864
1865 2012-08-30  Alan Modra  <amodra@gmail.com>
1866
1867         * output.h (Output_reloc::Output_reloc <output section>): Add
1868         is_relative param.  Adjust calls.
1869         (Output_reloc::add_output_section_relative): New functions.
1870         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1871         is_relative.
1872         (Output_reloc::symbol_value): Handle SECTION_CODE.
1873
1874 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1875
1876         * gold.cc (queue_middle_tasks): Call layout again when unique
1877         segments for sections is desired.
1878         * layout.cc (Layout::Layout): Initialize new members.
1879         (Layout::get_output_section_flags): New function.
1880         (Layout::choose_output_section): Call get_output_section_flags.
1881         (Layout::layout): Make output section for mapping to a unique segment.
1882         (Layout::insert_section_segment_map): New function.
1883         (Layout::attach_allocated_section_to_segment): Make unique segment for
1884         output sections marked so.
1885         (Layout::segment_precedes): Check for unique segments when sorting.
1886         * layout.h (Layout::Unique_segment_info): New struct.
1887         (Layout::Section_segment_map): New typedef.
1888         (Layout::insert_section_segment_map): New function.
1889         (Layout::get_output_section_flags): New function.
1890         (Layout::is_unique_segment_for_sections_specified): New function.
1891         (Layout::set_unique_segment_for_sections_specified): New function.
1892         (Layout::unique_segment_for_sections_specified_): New member.
1893         (Layout::section_segment_map_): New member.
1894         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1895         Rename is_gc_pass_one to is_pass_one.
1896         Rename is_gc_pass_two to is_pass_two.
1897         Rename is_gc_or_icf to is_two_pass.
1898         Check for which pass based on whether symbols data is present.
1899         Make it two pass when unique segments for sections is desired.
1900         * output.cc (Output_section::Output_section): Initialize new
1901         members.
1902         * output.h (Output_section::is_unique_segment): New function.
1903         (Output_section::set_is_unique_segment): New function.
1904         (Output_section::is_unique_segment_): New member.
1905         (Output_section::extra_segment_flags): New function.
1906         (Output_section::set_extra_segment_flags): New function.
1907         (Output_section::extra_segment_flags_): New member.
1908         (Output_section::segment_alignment): New function.
1909         (Output_section::set_segment_alignment): New function.
1910         (Output_section::segment_alignment_): New member.
1911         (Output_segment::Output_segment): Initialize is_unique_segment_.
1912         (Output_segment::is_unique_segment): New function.
1913         (Output_segment::set_is_unique_segment): New function.
1914         (Output_segment::is_unique_segment_): New member.
1915         * plugin.cc (allow_unique_segment_for_sections): New function.
1916         (unique_segment_for_sections): New function.
1917         (Plugin::load): Add new functions to transfer vector.
1918         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1919         * Makefile.in: Regenerate.
1920         * testsuite/plugin_final_layout.sh: Check if unique segment
1921         functionality works.
1922         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1923         are available.
1924         (allow_unique_segment_for_sections): New global.
1925         (unique_segment_for_sections): New global.
1926         (claim_file_hook): Call allow_unique_segment_for_sections.
1927         (all_symbols_read_hook): Call unique_segment_for_sections.
1928
1929 2012-08-22  Cary Coutant  <ccoutant@google.com>
1930
1931         * layout.cc (Layout::include_section): Don't assert on GROUP
1932         sections with --emit-relocs.
1933
1934 2012-08-21  Cary Coutant  <ccoutant@google.com>
1935
1936         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1937         if --export-dynamic-symbol names an undef symbol.
1938
1939 2012-08-18  Alan Modra  <amodra@gmail.com>
1940
1941         * powerpc.cc: Formatting and white space.
1942         (Powerpc_relobj): Rename got2_section_ to special_.
1943         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1944         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1945         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1946         (Target_powerpc): Add Address typedef and invalid_address.  Use
1947         throughout.
1948         (Target_powerpc::is_branch_reloc): New function.
1949         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1950         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1951         for dst_mask, value and addend.
1952         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1953         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1954         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1955         uint16_t for 24-bit offset.  Use get_output_section_offset and
1956         check return.
1957         (Target_powerpc::Scan::local): Handle more relocs.
1958         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1959         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1960         Plug in toc restoring insn after plt calls.  Translate branches
1961         to function descriptor symbols to corresponding entry point.
1962         (Target_powerpc::relocate_for_relocatable): Check return from
1963         get_output_section_offset.
1964         * symtab.h: Comment typo.
1965
1966 2012-08-14  Ian Lance Taylor  <iant@google.com>
1967
1968         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1969         unsupported_relocal_local to call unsupported_reloc_global.
1970
1971 2012-08-14  Nick Clifton  <nickc@redhat.com>
1972
1973         PR ld/14265
1974         * script-sections.cc (Sections_element::output_section_name): Add
1975         keep return parameter.
1976         (Output_section_element::match_name): Add keep return parameter.
1977         Return the value of the keep_ member.
1978         * script-sections.h (class Output_section): Update
1979         output_section_name prototype.
1980         * layout.cc (Layout::keep_input_section): New public member
1981         function.
1982         (Layout::choose_output_section): Pass keep parameter to
1983         output_section_name.
1984         * layout.h (class Layout): Add keep_input_section.
1985         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1986         sections.
1987         * testsuite/Makefile.am: Add a test.
1988         * testsuite/Makefile.in: Regenerate.
1989         * testsuite/pr14265.c: Source file for the test.
1990         * testsuite/pr14265.t: Linker script for the test.
1991         * testsuite/pr14265.sh: Shell script for the test.
1992
1993 2012-08-14  Alan Modra  <amodra@gmail.com>
1994
1995         * target.h (Target::output_section_name): New function.
1996         (Target::do_output_section_name): New function.
1997         * layout.cc (Layout::choose_output_section): Call the above.
1998         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1999
2000 2012-08-14  Alan Modra  <amodra@gmail.com>
2001
2002         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2003         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2004         for replace_constant call.
2005         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2006         (Output_data_glink::do_print_to_mapfile): New function.
2007         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2008         (Target_powerpc::Relocate::relocate): Likewise.
2009
2010 2012-08-14  Alan Modra  <amodra@gmail.com>
2011
2012         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2013         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2014         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2015         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2016         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2017         here.
2018         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2019         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2020         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2021         here.
2022         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2023         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2024
2025 2012-08-12  Alan Modra  <amodra@gmail.com>
2026
2027         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2028         (glink insn constants): Use uint32_t.
2029         (Output_data_glink::add_entry): Use insert, not [] operator.
2030
2031 2012-08-11  Alan Modra  <amodra@gmail.com>
2032
2033         * object.h (Sized_relobj_file::find_shdr): New function.
2034         (Sized_relobj_file::find_special_sections): New function.
2035         * object.cc (Sized_relobj_file::find_shdr): New function.
2036         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2037         (Sized_relobj_file::find_special_sections): New function, split out..
2038         (Sized_relobj_file::do_read_symbols): ..from here.
2039         * output.h (Output_data_got::replace_constant): New function.
2040         (Output_data_got::num_entries): New function.
2041         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2042         (Output_data_got::got_offset): Protected rather than private.
2043         (Output_data_got::replace_got_entry): New function.
2044         * output.cc (Output_data_got::replace_got_entry): New function.
2045         * powerpc.cc (class Powerpc_relobj): New.
2046         (class Powerpc_relocate_functions): Delete all psymval variants or
2047         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2048         Implement _ha functions using corresponding _hi function.
2049         (Powerpc_relobj::find_special_sections): New function.
2050         (Target_powerpc::do_make_elf_object): New function.
2051         (class Output_data_got_powerpc): New.
2052         (class Output_data_glink): New.
2053         (class Powerpc_scan_relocatable_reloc): New.
2054         Many more changes througout file.
2055
2056 2012-08-09  Nick Clifton  <nickc@redhat.com>
2057
2058         * po/vi.po: Updated Vietnamese translation.
2059
2060 2012-08-07  Ian Lance Taylor  <iant@google.com>
2061
2062         * layout.cc (Layout::add_target_dynamic_tags): If
2063         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2064         plt_rel.
2065
2066 2012-07-30  Nick Clifton  <nickc@redhat.com>
2067
2068         * po/gold.pot: Updated template.
2069         * po/es.po: Updated Spanish translation.
2070
2071 2012-07-18  Cary Coutant  <ccoutant@google.com>
2072
2073         PR gold/14344
2074         * configure.ac: Add check for -gpubnames support.
2075         * configure: Regenerate.
2076         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2077         support; force -gno-pubnames.
2078         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2079         support.
2080         (gdb_index_test_4): New test.
2081         * testsuite/Makefile.in: Regenerate.
2082         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2083         * testsuite/gdb_index_test_2.sh: Likewise.
2084         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2085         * testsuite/gdb_index_test_4.sh: New script.
2086         * testsuite/gdb_index_test_comm.sh: New script with common code;
2087         don't look for space after colon.
2088
2089 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2090
2091         * gold.cc (queue_middle_tasks): Update function order only after
2092         deferred objects due to plugins are processed.
2093
2094 2012-07-11  Ian Lance Taylor  <iant@google.com>
2095
2096         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2097         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2098         (Target_arm::scan_reloc_for_stub): Likewise.
2099         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2100         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2101         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2102         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2103         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2104
2105 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2106             Ian Lance Taylor  <iant@google.com>
2107
2108         PR gold/14309
2109         * configure.ac: Test whether std::tr1::hash<off_t> works.
2110         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2111         needed.
2112         * output.h (class Output_fill): Add virtual destructor.
2113         * configure, config.in: Rebuild.
2114
2115 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2116
2117         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2118
2119 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2120
2121         * plugin.cc (Plugin::load): Handle position independent executables.
2122
2123 2012-06-06  Cary Coutant  <ccoutant@google.com>
2124
2125         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2126         add .debug_macro.
2127         (lines_only_debug_sections): Likewise.
2128         (gdb_fast_lookup_sections): New static array.
2129         (is_gdb_debug_section): Rename formal parameter.
2130         (is_lines_only_debug_section): Likewise.
2131         (is_gdb_fast_lookup_section): New function.
2132         (Layout::include_section): Check for ".zdebug_" prefix; pass
2133         section name suffix to is_gdb_debug_section, et al.; check for
2134         fast-lookup sections when building .gdb_index.
2135         * options.h (--strip-debug-gdb): Update GDB version number.
2136
2137 2012-06-06  Cary Coutant  <ccoutant@google.com>
2138
2139         * configure.ac: Add check for fallocate.
2140         * configure: Regenerate.
2141         * config.in: Regenerate.
2142
2143         * options.h (class General_options): Add --mmap-output-file and
2144         --posix-fallocate options.
2145         * output.cc: (posix_fallocate): Remove; replace with...
2146         (gold_fallocate): New function.
2147         (Output_file::map_no_anonymous): Call gold_fallocate.
2148         (Output_file::map): Check --mmap-output-file option.
2149
2150 2012-06-05  Jing Yu  <jingyu@google.com>
2151
2152         * gold.h (textdomain): Add do {} to empty while(0).
2153         (bindtextdomain): Likewise.
2154
2155 2012-06-04  Cary Coutant  <ccoutant@google.com>
2156
2157         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2158         has_dynsym_index.
2159
2160 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2161
2162         * symtab.cc (Symbol_table::define_special_symbol):
2163         Initialize *poldsym to prevent uninitialized variable errors.
2164
2165 2012-05-23  Cary Coutant  <ccoutant@google.com>
2166
2167         * layout.cc (Layout::section_name_mapping): Add rules to handle
2168         exact match on .data.rel.ro.local or .data.rel.ro.
2169         (Layout::output_section_name): Check for exact matches.
2170
2171 2012-05-23  Cary Coutant  <ccoutant@google.com>
2172
2173         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2174         more carefully.
2175
2176 2012-05-22  Cary Coutant  <ccoutant@google.com>
2177
2178         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2179         object before exporting symbol.
2180
2181 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2182
2183         * testsuite/tls_test.cc: Include "config.h" first.
2184         * testsuite/tls_test_c.c: Likewise.
2185
2186 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2187             Nick Clifton  <nickc@redhat.com>
2188
2189         PR 14072
2190         * configure.in: Add check that sysdep.h has been included before
2191         any system header files.
2192         * configure: Regenerate.
2193         * config.in: Regenerate.
2194
2195 2012-05-14  Cary Coutant  <ccoutant@google.com>
2196
2197         * layout.cc (Layout::make_output_section): Mark .tdata section
2198         as RELRO.
2199         * testsuite/relro_test.cc: Add a TLS variable.
2200
2201 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2202
2203         PR gold/14091
2204         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2205         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2206         R_X86_64_64.
2207
2208 2012-05-08  Cary Coutant  <ccoutant@google.com>
2209
2210         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2211         (lines_only_debug_sections): Likewise.
2212
2213 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2214
2215         * nacl.cc: New file.
2216         * nacl.h: New file.
2217         * Makefile.am (CCFILES, HFILES): Add them.
2218         * Makefile.in: Regenerate.
2219         * i386.cc (Output_data_plt_i386_nacl): New class.
2220         (Output_data_plt_i386_nacl_exec): New class.
2221         (Output_data_plt_i386_nacl_dyn): New class.
2222         (Target_i386_nacl): New class.
2223         (Target_selector_i386_nacl): New class.
2224         (target_selector_i386): Use it instead of Target_selector_i386.
2225         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2226         (Target_x86_64_nacl): New class.
2227         (Target_selector_x86_64_nacl): New class.
2228         (target_selector_x86_64, target_selector_x32): Use it instead of
2229         Target_selector_x86_64.
2230         * arm.cc (Output_data_plt_arm_nacl): New class.
2231         (Target_arm_nacl): New class.
2232         (Target_selector_arm_nacl): New class.
2233         (target_selector_arm, target_selector_armbe): Use it instead of
2234         Target_selector_arm.
2235
2236         * target-select.cc (select_target): Take new Input_file* and off_t
2237         arguments, pass them on to recognize method of selector.
2238         * object.cc (make_elf_sized_object): Update caller.
2239         * parameters.cc (parameters_force_valid_target): Likewise.
2240         * incremental.cc (make_sized_incremental_binary): Likewise.
2241         * target-select.h: Update decl.
2242         (Target_selector::recognize): Take new Input_file* argument,
2243         pass it on to do_recognize.
2244         (Target_selector::do_recognize): Take new Input_file* argument.
2245         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2246         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2247         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2248         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2249
2250         * target.h (Target::Target_info): New members isolate_execinstr
2251         and rosegment_gap.
2252         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2253         * arm.cc (Target_arm::arm_info): Update initializer.
2254         * i386.cc (Target_i386::i386_info): Likewise.
2255         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2256         * sparc.cc (Target_sparc::sparc_info): Likewise.
2257         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2258         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2259         * layout.cc (Layout::attach_allocated_section_to_segment):
2260         Take new const Target* argument.  If target->isolate_execinstr(), act
2261         like --rosegment.
2262         (Layout::find_first_load_seg): Take new const Target* argument;
2263         if target->isolate_execinstr(), reject PF_X segments.
2264         (Layout::relaxation_loop_body): Update caller.
2265         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2266         reset file offset to zero when we hit LOAD_SEG, and then do a second
2267         loop over the segments before LOAD_SEG to reassign offsets after
2268         addresses have been determined.  Handle target->rosegment_gap().
2269         (Layout::attach_section_to_segment): Take new const Target* argument;
2270         pass it to attach_allocated_section_to_segment.
2271         (Layout::make_output_section): Update caller.
2272         (Layout::attach_sections_to_segments): Take new const Target* argument;
2273         pass it to attach_section_to_segment.
2274         * gold.cc (queue_middle_tasks): Update caller.
2275         * layout.h (Layout): Update method decls with new arguments.
2276
2277         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2278         Target_info pointer to use.
2279         (Target_arm::do_make_data_plt): New virtual method.
2280         (Target_arm::make_data_plt): New method that calls it.
2281         (Target_arm::make_plt_entry): Use it.
2282         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2283         for the section alignment.
2284         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2285         method.
2286         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2287         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2288         method.
2289         (Output_data_plt_arm::get_plt_entry_size): Call it.
2290         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2291         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2292         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2293         method.
2294         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2295         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2296         method instead of sizeof(plt_entry).
2297         (Output_data_plt_arm::add_entry): Likewise.
2298         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2299         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2300         than static method.
2301         (Target_arm::plt_entry_size): Likewise.
2302         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2303         Move to ...
2304         (Output_data_plt_arm_standard): ... here, new class.
2305         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2306         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2307         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2308
2309         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2310         Take additional argument for the PLT entry size.
2311         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2312         Use get_plt_entry_size method rather than plt_entry_size variable.
2313         (Output_data_plt_x86_64::reserve_slot): Likewise.
2314         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2315         (Output_data_plt_x86_64::add_entry): Likewise.
2316         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2317         (Output_data_plt_x86_64::address_for_global): Likewise.
2318         (Output_data_plt_x86_64::address_for_local): Likewise.
2319         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2320         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2321         Make method non-static.
2322         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2323         method.
2324         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2325         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2326         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2327         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2328         virtual method.
2329         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2330         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2331         virtual method.
2332         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2333         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2334         virtual method.
2335         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2336         (Output_data_plt_x86_64::plt_entry_size)
2337         (Output_data_plt_x86_64::first_plt_entry)
2338         (Output_data_plt_x86_64::plt_entry)
2339         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2340         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2341         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2342         (Output_data_plt_x86_64_standard): ... here, new class.
2343         (Target_x86_64::Target_x86_64): Take optional argument for the
2344         Target_info pointer to use.
2345         (Target_x86_64::do_make_data_plt): New virtual method.
2346         (Target_x86_64::make_data_plt): New method to call it.
2347         (Target_x86_64::init_got_plt_for_update): Use that.
2348         Call this->plt_->add_eh_frame method here.
2349         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2350         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2351         rather than static method.
2352         (Target_x86_64::plt_entry_size): Likewise.
2353         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2354         rather than plt_entry_size variable.  Move guts of PLT filling to...
2355         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2356         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2357         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2358
2359         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2360         additional argument for the section alignment.
2361         Don't do add_eh_frame_for_plt here.
2362         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2363         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2364         variable.
2365         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2366         method.
2367         (Output_data_plt_i386::get_plt_entry_size): Call it.
2368         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2369         (Output_data_plt_i386::add_eh_frame): New method to call it.
2370         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2371         method.
2372         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2373         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2374         method.
2375         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2376         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2377         method instead of plt_entry_size.
2378         (Output_data_plt_i386::plt_entry_size)
2379         (Output_data_plt_i386::plt_eh_frame_fde_size)
2380         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2381         (Output_data_plt_i386_standard): ... here, new class.
2382         (Output_data_plt_i386_exec): New class.
2383         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2384         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2385         (Output_data_plt_i386::exec_plt_entry): Move to ...
2386         (Output_data_plt_i386_exec::plt_entry): ... here.
2387         (Output_data_plt_i386_dyn): New class.
2388         (Output_data_plt_i386::first_plt_entry): Move to ...
2389         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2390         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2391         (Output_data_plt_i386_dyn::plt_entry): ... here.
2392         (Target_i386::Target_i386): Take optional argument for the Target_info
2393         pointer to use.
2394         (Target_i386::do_make_data_plt): New virtual method.
2395         (Target_i386::make_data_plt): New method to call it.
2396         (Target_i386::make_plt_section): Use that.
2397         Call this->plt_->add_eh_frame method here.
2398         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2399         rather than plt_entry_size variable.
2400         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2401         (Output_data_plt_i386::address_for_local): Likewise.
2402         (Output_data_plt_i386::do_write): Likewise.
2403         Move guts of PLT filling to...
2404         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2405         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2406         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2407         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2408
2409 2012-05-01  Cary Coutant  <ccoutant@google.com>
2410
2411         * dwarf_reader.cc (Dwarf_die::read_attributes)
2412         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2413         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2414         * reduced_debug_output.cc
2415         (Output_reduced_debug_info_section::get_die_end): Remove
2416         DW_FORM_GNU_ref_index.  Add default case.
2417
2418 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2419
2420         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2421         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2422         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2423         DW_AT_high_pc as offset from DW_AT_low_pc.
2424
2425         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2426         * testsuite/Makefile.in: Regenerate.
2427         * testsuite/gdb_index_test_3.c: New test source file.
2428         * testsuite/gdb_index_test_3.sh: New test source file.
2429
2430 2012-04-25  Ian Lance Taylor  <iant@google.com>
2431
2432         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2433         pointer.
2434         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2435         as a class, not a struct.
2436         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2437         (Target_arm::apply_cortex_a8_workaround): Likewise.
2438         * gc.h: Declare Reloc_types as a struct, not a class.
2439         * object.h: Declare Symbols_data as a struct.
2440         * reloc.h: Declare Read_relocs_data as a struct.
2441         * target.h: Declare Relocate_info as a struct.
2442
2443 2012-04-24  David S. Miller  <davem@davemloft.net>
2444
2445         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2446         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2447         and R_SPARC_WPLT30.
2448
2449 2012-04-24  Cary Coutant  <ccoutant@google.com>
2450
2451         * incremental-dump.cc (find_input_containing_global): Replace
2452         magic number with symbolic constant.
2453         (dump_incremental_inputs): Update version number.
2454         * incremental.cc (Output_section_incremental_inputs): Update version
2455         number; import symbolic constants from Incremental_inputs_reader.
2456         (Incremental_inputs::create_data_sections): Align relocations
2457         section correctly for 64-bit targets.
2458         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2459         constants; add padding.
2460         (Output_section_incremental_inputs::write_header): Add assert for
2461         header_size.
2462         (Output_section_incremental_inputs::write_input_files): Add assert
2463         for input_entry_size.
2464         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2465         add assert for object_info_size, input_section_entry_size,
2466         global_sym_entry_size.
2467         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2468         for data structure sizes; use them.
2469         (Incremental_input_entry_reader): Import symbolic constants from
2470         Incremental_inputs_reader; use them.
2471
2472 2012-04-23  David S. Miller  <davem@davemloft.net>
2473
2474         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2475         and elf_flags_set_.
2476         (Target_sparc::Target_sparc): Initialize new fields.
2477         (Target_sparc::do_make_elf_object): New function.
2478         (Target_sparc::do_adjust_elf_header): New function.
2479
2480 2012-04-23  Cary Coutant  <ccoutant@google.com>
2481
2482         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2483         CU range table of gdb index.
2484
2485 2012-04-20  David S. Miller  <davem@davemloft.net>
2486
2487         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2488         instead of false.
2489
2490 2012-04-16  David S. Miller  <davem@davemloft.net>
2491
2492         * sparc.cc (Target_sparc::got_address): New function.
2493         (Sparc_relocate_functions::gdop_hix22): New function.
2494         (Sparc_relocate_functions::gdop_lox10): New function.
2495         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2496         relocs.
2497         (Target_sparc::Scan::local): Likewise if the global symbol is not
2498         preemptible and is not IFUNC.
2499         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2500         transformations for local and non-preemptible non-IFUNC global
2501         symbols.
2502
2503         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2504         writing out 64-bit part of ranges.
2505
2506         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2507         -fpic and -fpie respectively.
2508         * Makefile.in: Regenerate.
2509
2510         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2511         (Target_sparc::Target_sparc): Initialize new field.
2512         (Target_sparc::do_plt_section_for_global): New function.
2513         (Target_sparc::do_plt_section_for_local): New function.
2514         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2515         (Target_sparc::make_plt_section): New function, broken out of
2516         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2517         (Target_sparc::make_plt_entry): Call make_plt_section.
2518         (Target_sparc::make_local_ifunc_plt_entry): New function.
2519         (Target_sparc::rela_ifunc_section): New function.
2520         (Target_sparc::plt_section): Remove const.
2521         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2522         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2523         and ifunc_count_ fields.
2524         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2525         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2526         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2527         (Output_data_plt_sparc::rela_ifunc): New function.
2528         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2529         (Output_data_plt_sparc::has_ifunc_section): New function.
2530         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2531         (Output_data_plt_sparc::address_for_global): New function.
2532         (Output_data_plt_sparc::address_for_local): New function.
2533         (Output_data_plt_sparc::plt_index_to_offset): New function.
2534         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2535         and entry_count.
2536         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2537         entry_count.
2538         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2539         R_SPARC_JMP_IREL to switch.
2540         (Target_sparc::Scan::check_non_pic): Likewise.
2541         (Target_sparc::Scan::local): Handle IFUNC symbols.
2542         (Target_sparc::Scan::local): Likewise.
2543         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2544         and plt_address_for_local.
2545         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2546         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2547
2548         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2549         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2550         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2551         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2552         global relocs too.
2553         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2554         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2555         calls.
2556         * sparc.cc (Target_sparc::Scan::global): Likewise.
2557         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2558
2559 2012-04-16  Cary Coutant  <ccoutant@google.com>
2560
2561         * archive.cc (Library_base::should_include_member): Check for
2562         --export-dynamic-symbol.
2563         * options.h (class General_options): Add --export-dynamic-symbol.
2564         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2565         --export-dynamic-symbol.
2566         (Symbol_table::gc_mark_undef_symbols): Likewise.
2567         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2568
2569 2012-04-12  David S. Miller  <davem@davemloft.net>
2570
2571         * sparc.cc (Reloc::wdisp10): New relocation method.
2572         (Reloc::h34): Likewise.
2573         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2574         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2575         R_SPARC_WDISP10.
2576         (Target_sparc::Scan::local): Likewise.
2577         (Target_sparc::Scan::global): Likewise.
2578         (Target_sparc::Relocate::relocate): Likewise.
2579
2580 2012-04-09  Cary Coutant  <ccoutant@google.com>
2581
2582         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2583         low_pc == 0.
2584
2585 2012-04-06  Ian Lance Taylor  <iant@google.com>
2586
2587         * timer.cc: #include <unistd.h>.
2588
2589 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2590
2591         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2592         * config.in: Regenerate.
2593         * configure: Regenerate.
2594
2595 2012-04-05  Nick Clifton  <nickc@redhat.com>
2596
2597         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2598         (AM_LC_MESSAGES): Add.
2599         * aclocal.m4: Regenerate.
2600         * config.in: Regenerate.
2601         * configure: Regenerate.
2602
2603 2012-03-21  Cary Coutant  <ccoutant@google.com>
2604
2605         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2606         * Makefile.in: Regenerate.
2607         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2608         (Sized_elf_reloc_mapper::symbol_section): New function.
2609         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2610         (make_elf_reloc_mapper): New function.
2611         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2612         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2613         (Dwarf_abbrev_table::do_get_abbrev): New function.
2614         (Dwarf_ranges_table::read_ranges_table): New function.
2615         (Dwarf_ranges_table::read_range_list): New function.
2616         (Dwarf_pubnames_table::read_section): New function.
2617         (Dwarf_pubnames_table::read_header): New function.
2618         (Dwarf_pubnames_table::next_name): New function.
2619         (Dwarf_die::Dwarf_die): New function.
2620         (Dwarf_die::read_attributes): New function.
2621         (Dwarf_die::skip_attributes): New function.
2622         (Dwarf_die::set_name): New function.
2623         (Dwarf_die::set_linkage_name): New function.
2624         (Dwarf_die::attribute): New function.
2625         (Dwarf_die::string_attribute): New function.
2626         (Dwarf_die::int_attribute): New function.
2627         (Dwarf_die::uint_attribute): New function.
2628         (Dwarf_die::ref_attribute): New function.
2629         (Dwarf_die::child_offset): New function.
2630         (Dwarf_die::sibling_offset): New function.
2631         (Dwarf_info_reader::check_buffer): New function.
2632         (Dwarf_info_reader::parse): New function.
2633         (Dwarf_info_reader::do_parse): New function.
2634         (Dwarf_info_reader::do_read_string_table): New function.
2635         (Dwarf_info_reader::lookup_reloc): New function.
2636         (Dwarf_info_reader::get_string): New function.
2637         (Dwarf_info_reader::visit_compilation_unit): New function.
2638         (Dwarf_info_reader::visit_type_unit): New function.
2639         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2640         Sized_elf_reloc_mapper.
2641         (Sized_dwarf_line_info::symbol_section): Remove function.
2642         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2643         (Sized_dwarf_line_info::read_line_mappings): Remove object
2644         parameter, adjust callers.
2645         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2646         * dwarf_reader.h: Include <sys/types.h>.
2647         (class Track_relocs): Remove forward declaration.
2648         (class Elf_reloc_mapper): New class.
2649         (class Sized_elf_reloc_mapper): New class.
2650         (class Dwarf_abbrev_table): New class.
2651         (class Dwarf_range_list): New class.
2652         (class Dwarf_ranges_table): New class.
2653         (class Dwarf_pubnames_table): New class.
2654         (class Dwarf_die): New class.
2655         (class Dwarf_info_reader): New class.
2656         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2657         (Sized_dwarf_line_info::symbol_section): Remove member function.
2658         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2659         base class.
2660         * gdb-index.cc: New source file.
2661         * gdb-index.h: New source file.
2662         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2663         and .debug_types sections, call Layout::add_to_gdb_index.
2664         (Sized_relobj_incr::do_section_name): Implement.
2665         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2666         return type; Implement.
2667         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2668         return type.
2669         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2670         parameter list and return type.
2671         (Sized_incr_dynobj::do_section_contents): Likewise.
2672         * layout.cc: Include gdb-index.h.
2673         (Layout::Layout): Initialize gdb_index_data_.
2674         (Layout::init_fixed_output_section): Check for .gdb_index section.
2675         (Layout::add_to_gdb_index): New function. Instantiate.
2676         * layout.h: Add forward declaration for class Gdb_index.
2677         (Layout::add_to_gdb_index): New member function.
2678         (Layout::gdb_index_data_): New data member.
2679         * main.cc: Include gdb-index.h.
2680         (main): Print statistics for gdb index.
2681         * object.cc (Object::section_contents): Move code into
2682         do_section_contents.
2683         (need_decompressed_section): Check for sections needed when building
2684         gdb index.
2685         (build_compressed_section_map): Likewise.
2686         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2687         gdb index.
2688         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2689         sections; call Layout::add_to_gdb_index.
2690         (Sized_relobj_file::do_decompressed_section_contents): Call
2691         do_section_contents directly.
2692         * object.h (Object::do_section_contents): Adjust parameter list and
2693         return type.
2694         (Object::do_decompressed_section_contents): Call do_section_contents
2695         directly.
2696         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2697         return type.
2698         * options.h (class General_options): Add --gdb-index option.
2699         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2700         list and return type.
2701         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2702         * reloc.h (Track_relocs::checkpoint): New function.
2703         (Track_relocs::reset): New function.
2704
2705         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2706         New test cases.
2707         * testsuite/Makefile.in: Regenerate.
2708         * testsuite/gdb_index_test.cc: New test source file.
2709         * testsuite/gdb_index_test_1.sh: New test source file.
2710         * testsuite/gdb_index_test_2.sh: New test source file.
2711
2712 2012-03-19  Doug Kwan  <dougkwan@google.com>
2713
2714         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2715         (Target_arm::do_finalize_sections): Remove code which defines
2716         __exidx_start and __exidx_end.  Make symbol table parameter
2717         anonymous as it is not used.
2718         * gold.cc (queue_middle_tasks): Call target hook to define any
2719         target-specific symbols.
2720         * target.h (Target::define_standard_symbols): New method.
2721         (Target::do_define_standard_symbols): Same.
2722         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2723         * testsuite/Makefile.in: Regenerate.
2724         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2725         and __exidx_end.
2726         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2727         relocations are generated for __exidx_start and __exidx_end.
2728
2729 2012-03-16  Doug Kwan  <dougkwan@google.com>
2730
2731         * testsuite/Makefile.am: Disable test initpri3b.
2732         * testsuite/Makefile.in: Regenerate.
2733
2734 2012-03-15  Doug Kwan  <dougkwan@google.com>
2735
2736         * arm.cc (Target_arm::got_section): Make .got section read-only
2737         if -z now is given.
2738
2739 2012-03-15  Ian Lance Taylor  <iant@google.com>
2740
2741         PR gold/13850
2742         * layout.cc (Layout::make_output_section): Correctly mark
2743         SHT_INIT_ARRAY, et. al., as relro.
2744
2745 2012-03-14  Doug Kwan  <dougkwan@google.com>
2746
2747         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2748         dynamic relocations for protected symbols in shared objects.
2749
2750 2012-03-13  Ian Lance Taylor  <iant@google.com>
2751
2752         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2753         keep the larger alignment.
2754
2755 2012-03-12  Cary Coutant  <ccoutant@google.com>
2756
2757         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2758         handling of DW_LNE_define_file.
2759
2760 2012-03-12  Cary Coutant  <ccoutant@google.com>
2761
2762         * reduced_debug_output.cc
2763         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2764         codes to switch.
2765
2766 2012-02-29  Cary Coutant  <ccoutant@google.com>
2767
2768         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2769
2770 2012-02-29  Cary Coutant  <ccoutant@google.com>
2771
2772         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2773         Call Object::decompressed_section_contents.
2774         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2775         New dtor.
2776         (Sized_dwarf_line_info::buffer_start_): New data member.
2777         * merge.cc (Output_merge_data::do_add_input_section): Call
2778         Object::decompressed_section_contents.
2779         (Output_merge_string::do_add_input_section): Likewise.
2780         * object.cc (need_decompressed_section): New function.
2781         (build_compressed_section_map): Decompress sections needed later.
2782         (Sized_relobj_file::do_decompressed_section_contents): New function.
2783         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2784         * object.h (Object::decompressed_section_contents): New function.
2785         (Object::discard_decompressed_sections): New function.
2786         (Object::do_decompressed_section_contents): New function.
2787         (Object::do_discard_decompressed_sections): New function.
2788         (Compressed_section_info): New type.
2789         (Compressed_section_map): Include decompressed section contents.
2790         (Sized_relobj_file::do_decompressed_section_contents): New function.
2791         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2792
2793 2012-02-16  Cary Coutant  <ccoutant@google.com>
2794
2795         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2796         * testsuite/Makefile.in: Regenerate.
2797
2798 2012-02-14  Cary Coutant  <ccoutant@google.com>
2799
2800         * options.cc (General_options::finalize): Disallow -pie and -static.
2801
2802 2012-02-03  Doug Kwan  <dougkwan@google.com>
2803
2804         * arm.cc (Arm_relocate_functions::abs8,
2805         Arm_relocate_functions::abs16): Use
2806         Bits::has_signed_unsigned_overflow32.
2807         (Arm_relocate_functions::thm_abs8): Correct range of
2808         overflow check.
2809         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2810         in assertions.
2811
2812 2012-02-02  Doug Kwan  <dougkwan@google.com>
2813
2814         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2815         position independent outputs, not just shared objects.
2816
2817 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2818
2819         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2820         * configure: Regenerated.
2821
2822 2012-01-27  Ian Lance Taylor  <iant@google.com>
2823
2824         * reloc.h (Bits): New class with static functions, copied from
2825         namespace utils in arm.cc.
2826         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2827         instead.
2828
2829 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2830
2831         * incremental.cc (write_info_blocks): Correct relocation offset.
2832
2833 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2834
2835         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2836         (Relocate::tls_gd_to_le): Likewise.
2837
2838 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2839
2840         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2841
2842 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2843
2844         * configure.ac: Check if -mcmodel=medium works.
2845         * configure: Regenerated.
2846
2847 2012-01-24  Cary Coutant  <ccoutant@google.com>
2848
2849         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2850         definition and ...
2851         (read_unsigned_LEB_128_x): ... this new function.
2852         (read_signed_LEB_128): Replaced with inline definition and ...
2853         (read_signed_LEB_128_x): ... this new function.
2854         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2855         (read_unsigned_LEB_128): Add inline definition.
2856         (read_signed_LEB_128_x): New function.
2857         (read_signed_LEB_128): Add inline definition.
2858         * testsuite/Makefile.am (leb128_unittest): New unit test.
2859         * testsuite/Makefile.in: Regenerate.
2860         * testsuite/leb128_unittest.cc: New unit test.
2861
2862 2012-01-23  Ian Lance Taylor  <iant@google.com>
2863
2864         PR gold/13617
2865         * i386.cc (Target_i386::do_code_fill): When using a jmp
2866         instruction, pad with nop instructions.
2867         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2868
2869 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2870
2871         * x86_64.cc (gc_process_relocs): Add typename on types used in
2872         template.
2873         (scan_relocs): Likewise.
2874         (relocate_section): Likewise.
2875         (apply_relocation): Likewise.
2876
2877 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2878
2879         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2880         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2881         under x32.
2882
2883 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2884
2885         * x86_64.cc: Initial support for x32.
2886
2887 2012-01-03  Cary Coutant  <ccoutant@google.com>
2888
2889         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2890         Use abstract base class for GOT.
2891         * gold/output.h (class Output_data_got_base): New abstract base class.
2892         (class Output_data_got): Derive from new base class, adjust ctors.
2893         (Output_data_got::reserve_slot): Make virtual; rename to
2894         do_reserve_slot; Adjust callers.
2895         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2896         pointer to abstract base class.
2897         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2898
2899 2011-12-18  Ian Lance Taylor  <iant@google.com>
2900
2901         * object.h (Relobj::local_symbol_value): New function.
2902         (Relobj::local_plt_offset): New function.
2903         (Relobj::local_has_got_offset): New function.
2904         (Relobj::local_got_offset): New function.
2905         (Relobj::set_local_got_offset): New function.
2906         (Relobj::do_local_symbol_value): New pure virtual function.
2907         (Relobj::do_local_plt_offset): Likewise.
2908         (Relobj::do_local_has_got_offset): Likewise.
2909         (Relobj::do_local_got_offset): Likewise.
2910         (Relobj::do_set_local_got_offset): Likewise.
2911         (Sized_relobj::do_local_has_got_offset): Rename from
2912         local_has_got_offset.
2913         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2914         (Sized_relobj::do_set_local_got_offset): Rename from
2915         set_local_got_offset.
2916         (Sized_relobj_file::do_local_plt_offset): Rename from
2917         local_plt_offset.
2918         (Sized_relobj_file::do_local_symbol_value): New function.
2919         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2920         local_plt_offset.
2921         * output.cc (Output_data_got::Got_entry::write): Change object to
2922         Relobj.  Use local_symbol_value.
2923         (Output_data_got::add_global_with_rel): Change rel_dyn to
2924         Output_data_reloc_generic*.  Use add_global_generic.
2925         (Output_data_got::add_global_with_rela): Remove.  Change all
2926         callers to use add_global_with_rel.
2927         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2928         Output_data_reloc_generic*.  Use add_global_generic.
2929         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2930         callers to use add_global_pair_with_rel.
2931         (Output_data_got::add_local): Change object to Relobj*.
2932         (Output_data_got::add_local_plt): Likewise.
2933         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2934         change rel_dyn to Output_data_reloc_generic*.  Use
2935         add_local_generic.
2936         (Output_data_got::add_local_with_rela): Remove.  Change all
2937         callers to use all_local_with_rel.
2938         (Output_data_got::add_local_pair_with_rel): Change object to
2939         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2940         add_output_section_generic.
2941         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2942         callers to use add_local_pair_with_rel.
2943         (Output_data_got::reserve_local): Change object to Relobj*.
2944         * output.h: (class Output_data_reloc_generic): Add pure virtual
2945         declarations for add_global_generic, add_local_generic,
2946         add_output_section_generic.
2947         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2948         functions for Output_data_reloc_generic.  Update declarations for
2949         changes listed in output.cc.
2950         (class Output_data_got): Change template parameter to got_size.
2951         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2952         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2953         function.
2954         (Sized_relobj_incr::do_local_plt_offset): New function.
2955         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2956         add_global_generic.
2957
2958 2011-12-17  Cary Coutant  <ccoutant@google.com>
2959
2960         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2961         * resolve.cc (Symbol_table::resolve): Likewise.
2962         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2963         arrays.
2964         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2965
2966 2011-12-16  Ian Lance Taylor  <iant@google.com>
2967
2968         * output.h (Output_data_reloc_generic::add): Only call
2969         add_dynamic_reloc if this is a dynamic reloc section.
2970
2971 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2972
2973         PR gold/13505
2974         * target-reloc.h (apply_relocation): Replace <64, false> with
2975         <size, big_endian>.
2976
2977 2011-11-25  Nick Clifton  <nickc@redhat.com>
2978
2979         * po/it.po: New Italian translation.
2980
2981 2011-11-17  Sterling Augustine  <saugustine@google.com>
2982
2983         * script.cc (script_include_directive): Implement.
2984         (read_script_file): New local variables name and search_path. Update
2985         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2986         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2987         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2988
2989 2011-11-11  Sterling Augustine  <saugustine@google.com>
2990
2991         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2992         (file_or_sections_cmd): Likewise.
2993
2994 2011-11-11  Doug Kwan  <dougkwan@google.com>
2995
2996         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2997         if --just-symbols is given.
2998
2999 2011-11-10  Doug Kwan  <dougkwan@google.com>
3000
3001         PR gold/13362
3002         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3003         when processing data relocs.
3004         * reloc.h (Relocate_functions::rel_unaligned): New method.
3005         (Relocate_functions::pcrel_unaligned): Ditto.
3006         (Relocate_functions::rel32_unaligned): Ditto.
3007         (Relocate_functions::pcrel32_unaligned): Ditto.
3008
3009 2011-11-09  Doug Kwan  <dougkwan@google.com>
3010
3011         PR gold/13362
3012         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3013         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3014         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3015         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3016         (Relocate_functions::rel_unaligned): New.
3017         (Relocate_functions::rel32_unaligned): New.
3018         * target-reloc.h (relocate_for_relocatable): Add code to handle
3019         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3020         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3021         arm_unaligned_reloc_r): New targets.
3022         * testsuite/Makefile.in: Regenerate.
3023         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3024         linking.
3025
3026 2011-11-02  Ian Lance Taylor  <iant@google.com>
3027
3028         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3029         NATIVE_LINKER.
3030         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3031         * options.cc (General_options::finalize): Use library search path
3032         from configure script if specified.  If not native and no sysroot,
3033         only search TOOLLIBDIR.
3034         * options.h (Search_directory::Search_directory): Change name to
3035         const std::string&.
3036         (General_options::add_to_library_path_with_sysroot): Change arg to
3037         const std::string&.
3038         * configure, Makefile.in, config.in: Rebuild.
3039
3040 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3041
3042         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3043         we are working around the ARM1176 Erratum.
3044         * options.h (General_options::fix_arm1176): Add option.
3045         * testsuite/Makefile.am: Add testcases, and keep current ones
3046         working.
3047         * testsuite/Makefile.in: Regenerate.
3048         * testsuite/arm_fix_1176.s: New file.
3049         * testsuite/arm_fix_1176.sh: Likewise.
3050
3051 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3052
3053         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3054         may_use_blx_.
3055         (Target_arm::may_use_blx): Remove method.
3056         (Target_arm::set_may_use_blx): Likewise.
3057         (Target_arm::may_use_v4t_interworking): New method.
3058         (Target_arm::may_use_v5t_interworking): Likewise.
3059         (Target_arm::may_use_blx_): Remove member variable.
3060         (Arm_relocate_functions::arm_branch_common): Check for v5T
3061         interworking.
3062         (Arm_relocate_functions::thumb_branch_common): Likewise.
3063         (Reloc_stub::stub_type_for_reloc): Likewise.
3064         (Target_arm::do_finalize_sections): Correct interworking checks.
3065         * testsuite/Makefile.am: Add new tests.
3066         * testsuite/Makefile.in: Regenerate.
3067         * testsuite/arm_farcall_arm_arm.s: New test.
3068         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3069         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3070         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3071         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3072         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3073         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3074         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3075
3076 2011-10-31  Cary Coutant  <ccoutant@google.com>
3077
3078         PR gold/13023
3079         * expression.cc (Expression::eval_with_dot): Add
3080         is_section_dot_assignment parameter.
3081         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3082         absolute and assigning to dot within a section.
3083         * script-sections.cc
3084         (Output_section_element_assignment::set_section_addresses): Pass
3085         dot_section to set_if_absolute.
3086         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3087         as is_section_dot_assignment flag to eval_with_dot.
3088         (Output_section_element_dot_assignment::set_section_addresses):
3089         Likewise.
3090         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3091         parameter.  Also set value if relative to dot_section; set the
3092         symbol's output_section.
3093         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3094         parameter.  Adjust all callers.
3095         (Expression::eval_maybe_dot): Likewise.
3096         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3097         Adjust all callers.
3098         * testsuite/script_test_2.t: Test assignment of an absolute value
3099         to dot within an output section element.
3100
3101 2011-10-31  Cary Coutant  <ccoutant@google.com>
3102
3103         * options.h (class General_options): Add --[no-]gnu-unique options.
3104         * symtab.cc (Symbol_table::sized_write_globals): Convert
3105         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3106
3107 2011-10-31  Cary Coutant  <ccoutant@google.com>
3108
3109         PR gold/13359
3110         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3111         unnecessary assertion.
3112         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3113
3114 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3115
3116         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3117         gc_mark_symbol.
3118         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3119         gc_mark_symbol.
3120         Change to just keep the section associated with symbol.
3121         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3122         they are externally visible and --export-dynamic is turned on.
3123         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3124
3125 2011-10-19  Ian Lance Taylor  <iant@google.com>
3126
3127         PR gold/13163
3128         * script-sections.cc
3129         (Output_section_element_dot_assignment::needs_output_section): New
3130         function.
3131
3132 2011-10-19  Ian Lance Taylor  <iant@google.com>
3133
3134         PR gold/13204
3135         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3136         --section-start option was seen.
3137         * options.h (General_options::any_section_start): New function.
3138
3139 2011-10-18  David S. Miller  <davem@davemloft.net>
3140
3141         PR binutils/13301
3142         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3143         member to track relocation locations that have moved during TLS
3144         reloc optimizations.
3145         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3146         (Target_sparc::Relocate::relocate): Adjust view down by 4
3147         bytes if it matches reloc_adjust_addr_.
3148         (Target_sparc::Relocate::relocate_tls): Always move the
3149         __tls_get_addr call delay slot instruction forward 4 bytes when
3150         performing relaxation.
3151
3152 2011-10-18  Cary Coutant  <ccoutant@google.com>
3153
3154         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3155         (Output_file::map_no_anonymous): Check for non-zero
3156         return code from posix_fallocate.
3157
3158 2011-10-17  Cary Coutant  <ccoutant@google.com>
3159
3160         PR gold/13245
3161         * plugin.cc (is_visible_from_outside): Check for symbols
3162         referenced from dynamic objects.
3163         * resolve.cc (Symbol_table::resolve): Don't count references
3164         from dynamic objects as references from real ELF files.
3165         * testsuite/plugin_test_2.sh: Adjust expected result.
3166
3167 2011-10-17  Cary Coutant  <ccoutant@google.com>
3168
3169         * gold.cc: Include timer.h.
3170         (queue_middle_tasks): Stamp time.
3171         (queue_final_tasks): Likewise.
3172         * main.cc (main): Store timer in parameters.  Print timers
3173         for each pass.
3174         * parameters.cc (Parameters::Parameters): Initialize timer_.
3175         (Parameters::set_timer): New function.
3176         (set_parameters_timer): New function.
3177         * parameters.h (Parameters::set_timer): New function.
3178         (Parameters::timer): New function.
3179         (Parameters::timer_): New data member.
3180         (set_parameters_timer): New function.
3181         * timer.cc (Timer::stamp): New function.
3182         (Timer::get_pass_time): New function.
3183         * timer.h (Timer::stamp): New function.
3184         (Timer::get_pass_time): New function.
3185         (Timer::pass_times_): New data member.
3186
3187 2011-10-17  Cary Coutant  <ccoutant@google.com>
3188
3189         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3190         task for members of lib groups.
3191
3192 2011-10-17  Cary Coutant  <ccoutant@google.com>
3193
3194         PR gold/13288
3195         * fileread.cc (File_read::find_view): Add assert.
3196         (File_read::make_view): Move bounds check (replace with assert)...
3197         (File_read::find_or_make_view): ... to here.
3198
3199 2011-10-12  Cary Coutant  <ccoutant@google.com>
3200
3201         * output.cc (Output_file::open_base_file): Handle case where
3202         ::read returns less than requested size.
3203
3204 2011-10-10  Cary Coutant  <ccoutant@google.com>
3205
3206         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3207         Initialize defined_count_.
3208         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3209         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3210         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3211         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3212         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3213         * incremental.h (Sized_relobj_incr::defined_count_): New data
3214         member.
3215         (Sized_incr_dynobj::defined_count_): New data member.
3216         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3217         Return zeroes instead of internal error.
3218
3219 2011-10-10  Cary Coutant  <ccoutant@google.com>
3220
3221         PR gold/13249
3222         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3223         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3224         * output.h (class Output_reloc): Add use_plt_offset flag.
3225         (Output_reloc::type_): Adjust size of bit field.
3226         (Output_reloc::use_plt_offset_): New bit field.
3227         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3228         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3229         flag.  Adjust all callers.
3230         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3231         creating RELATIVE relocations.
3232
3233 2011-10-10  Nick Clifton  <nickc@redhat.com>
3234
3235         * po/es.po: Updated Spanish translation.
3236         * po/fi.po: Updated Finnish translation.
3237
3238 2011-10-03   Diego Novillo  <dnovillo@google.com>
3239
3240         * options.cc (parse_uint): Fix dereference of RETVAL.
3241
3242 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3243
3244         * layout.h (section_order_map_): New member.
3245         (get_section_order_map): New member function.
3246         * output.cc (Output_section::add_input_section): Check for patterns
3247         only when --section-ordering-file is specified.
3248         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3249         output_sections have been formed.
3250         * layout.cc (Layout_Layout): Initialize section_order_map_.
3251         * plugin.cc (update_section_order): Store order in order_map. Do not
3252         update the order.
3253         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3254         * testsuite/Makefile.in: Regenerate.
3255         * testsuite/plugin_section_order.c: New file.
3256         * testsuite/plugin_final_layout.cc: New file.
3257         * testsuite/plugin_final_layout.sh: New file.
3258
3259 2011-09-29  Cary Coutant  <ccoutant@google.com>
3260
3261         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3262         Check for NULL.
3263         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3264         symbols during incremental update.
3265         (Symbol_table::add_from_dynobj): Likewise.
3266
3267 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3268             Ian Lance Taylor  <iant@google.com>
3269
3270         * symtab.cc (Symbol_table::define_special_symbol): Always
3271         canonicalize version string.
3272
3273 2011-09-26  Cary Coutant  <ccoutant@google.com>
3274
3275         * gold.cc (queue_initial_tasks): Move option checks ...
3276         * options.cc (General_options::finalize): ... to here. Disable
3277         some options; make others fatal.
3278
3279 2011-09-26  Cary Coutant  <ccoutant@google.com>
3280
3281         gcc PR lto/47247
3282         * plugin.cc (get_symbols_v2): New function.
3283         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3284         (is_referenced_from_outside): New function.
3285         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3286         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3287         (get_symbols): Pass version parameter.
3288         (get_symbols_v2): New function.
3289         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3290         parameter.
3291         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3292         (onload): Add LDPT_GET_SYMBOLS_V2.
3293         (all_symbols_read_hook): Use get_symbols_v2; check for
3294         LDPR_PREVAILING_DEF_IRONLY_EXP.
3295         * testsuite/plugin_test_3.sh: Update expected results.
3296
3297 2011-09-23  Simon Baldwin  <simonb@google.com>
3298
3299         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3300         configuration options.
3301         * configure: Regenerate.
3302         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3303         * Makefile.in: Regenerate.
3304         * testsuite/Makefile.in: Regenerate.
3305
3306 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3307
3308         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3309
3310 2011-09-19  Cary Coutant  <ccoutant@google.com>
3311
3312         * incremental.cc (can_incremental_update): Fix typo in comment.
3313         * incremental.h (can_incremental_update): Likewise.
3314
3315 2011-09-18  Cary Coutant  <ccoutant@google.com>
3316
3317         * incremental.cc (can_incremental_update): New function.
3318         * incremental.h (can_incremental_update): New function.
3319         * layout.cc (Layout::init_fixed_output_section): Call it.
3320         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3321         * object.cc (Sized_relobj_file::do_layout): Call
3322         can_incremental_update.
3323
3324 2011-09-13  Cary Coutant  <ccoutant@google.com>
3325
3326         * configure.ac: Check for glibc support for gnu_indirect_function
3327         support with static linking, setting automake conditional
3328         IFUNC_STATIC.
3329         * Makefile.in: Regenerate.
3330         * configure: Regenerate.
3331
3332         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3333         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3334         for IFUNC_STATIC.
3335         * testsuite/Makefile.in: Regenerate.
3336
3337 2011-09-13  Cary Coutant  <ccoutant@google.com>
3338
3339         * incremental.cc (Sized_relobj_incr::do_layout): Call
3340         report_comdat_group for kept comdat sections.
3341         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3342         * testsuite/Makefile.in: Regenerate.
3343         * testsuite/incr_comdat_test_1.cc: New source file.
3344         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3345         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3346         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3347
3348 2011-09-13  Ian Lance Taylor  <iant@google.com>
3349
3350         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3351         variable external_symbols_offset.
3352
3353 2011-09-12  Ian Lance Taylor  <iant@google.com>
3354
3355         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3356         triggered if object has no symbols.
3357
3358 2011-09-09  David S. Miller  <davem@davemloft.net>
3359
3360         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3361         (Output_fill_debug_line::do_write): Likewise.
3362
3363 2011-08-29  Cary Coutant  <ccoutant@google.com>
3364
3365         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3366         casts to match formatting specs.
3367         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3368
3369 2011-08-26  Cary Coutant  <ccoutant@google.com>
3370
3371         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3372         remaining hole size when allocating.
3373         (Layout::make_output_section): Set fill methods for debug sections.
3374         * layout.h (Free_list::Free_list_node): Move from private to
3375         public.
3376         (Free_list::set_min_hole_size): New function.
3377         (Free_list::begin, Free_list::end): New functions.
3378         (Free_list::min_hole_): New data member.
3379         * output.cc: Include dwarf.h.
3380         (Output_fill_debug_info::do_minimum_hole_size): New function.
3381         (Output_fill_debug_info::do_write): New function.
3382         (Output_fill_debug_line::do_minimum_hole_size): New function.
3383         (Output_fill_debug_line::do_write): New function.
3384         (Output_section::Output_section): Initialize new data member.
3385         (Output_section::set_final_data_size): Ensure patch space is larger
3386         than minimum hole size.
3387         (Output_section::do_write): Fill holes in debug sections.
3388         * output.h (Output_fill): New class.
3389         (Output_fill_debug_info): New class.
3390         (Output_fill_debug_line): New class.
3391         (Output_section::set_free_space_fill): New function.
3392         (Output_section::free_space_fill_): New data member.
3393         * testsuite/Makefile.am (incremental_test_3): Add
3394         --incremental-patch option.
3395         (incremental_test_4): Likewise.
3396         (incremental_test_5): Likewise.
3397         (incremental_test_6): Likewise.
3398         (incremental_copy_test): Likewise.
3399         (incremental_common_test_1): Likewise.
3400         * testsuite/Makefile.in: Regenerate.
3401
3402 2011-08-26  Nick Clifton  <nickc@redhat.com>
3403
3404         * po/es.po: Updated Spanish translation.
3405
3406 2011-08-01  Cary Coutant  <ccoutant@google.com>
3407
3408         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3409         * gold/testsuite/Makefile.in: Regenerate.
3410         * gold/testsuite/justsyms_exec.c: New source file.
3411         * gold/testsuite/justsyms_lib.c: New source file.
3412
3413 2011-08-01  Cary Coutant  <ccoutant@google.com>
3414
3415         * layout.cc (Layout::set_segment_offsets): Don't realign text
3416         segment if -Ttext was specified.
3417         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3418         file type.
3419         * object.h (Sized_relobj_file::e_type): New function.
3420         (Sized_relobj_file::e_type_): New data member.
3421         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3422         base address for ET_EXEC files.
3423         * target.cc (Target::do_make_elf_object_implementation): Allow
3424         ET_EXEC files with --just-symbols option.
3425
3426 2011-07-28  Cary Coutant  <ccoutant@google.com>
3427
3428         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3429         Add thread_number parameter.
3430         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3431         * workqueue-threads.cc
3432         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3433         current thread if its thread number is greater than desired thread
3434         count.
3435         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3436         Add thread_number parameter.
3437         (Workqueue::should_cancel_thread): Likewise.
3438         (Workqueue::find_runnable_or_wait): Pass thread_number to
3439         should_cancel_thread.
3440         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3441         parameter.
3442
3443 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3444
3445         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3446         only after checking if it cannot be forced local.
3447         * symtab.h (is_externally_visible): Check if the symbol is not forced
3448         local.
3449
3450 2011-07-15  Ian Lance Taylor  <iant@google.com>
3451
3452         * options.h (class General_options): Add --print-output-format.
3453         Move -EL next to -EB, for  better --help output.
3454         * target-select.cc: Include <cstdio>, "options.h", and
3455         "parameters.h".
3456         (Target_selector::do_target_bfd_name): New function.
3457         (print_output_format): New function.
3458         * target-select.h (class Target_selector): Update declarations.
3459         (Target_selector::target_bfd_name): New function.
3460         (print_output_format): Declare.
3461         * main.cc: Include "target-select.h".
3462         (main): Handle --print-output-format.
3463         * gold.cc: Include "target-select.h".
3464         (queue_initial_tasks): Handle --print-output-format when there are
3465         no input files.
3466         * parameters.cc (parameters_force_valid_target): Give a better
3467         error message if -EB/-EL does not match target.
3468         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3469         function.
3470
3471 2011-07-15  Ian Lance Taylor  <iant@google.com>
3472
3473         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3474         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3475         (Output_data_plt_i386::do_write): Write address of .dynamic
3476         section to first entry in .got.plt section.
3477         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3478         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3479         Initialize layout_.
3480         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3481         section to first entry in .got.plt section.
3482         * layout.h (Layout::dynamic_section): New function.
3483
3484 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3485
3486         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3487         to claim_file call.
3488         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3489         input_section_position_, and input_section_glob_.
3490         (read_layout_from_file): Call function section_ordering_specified.
3491         * layout.h (is_section_ordering_specified): New function.
3492         (section_ordering_specified): New function.
3493         (section_ordering_specified_): New boolean member.
3494         * main.cc(main): Call load_plugins after layout object is defined.
3495         * output.cc (Output_section::add_input_section): Use
3496         function section_ordering_specified to check if section ordering is
3497         needed.
3498         * output.cc (Output_section::add_relaxed_input_section): Use
3499         function section_ordering_specified to check if section ordering is
3500         needed.
3501         (Output_section::update_section_layout): New function.
3502         (Output_section::sort_attached_input_sections): Check if input section
3503         must be reordered.
3504         * output.h (Output_section::update_section_layout): New function.
3505         * plugin.cc (get_section_count): New function.
3506         (get_section_type): New function.
3507         (get_section_name): New function.
3508         (get_section_contents): New function.
3509         (update_section_order): New function.
3510         (allow_section_ordering): New function.
3511         (Plugin::load): Add the new interfaces to the transfer vector.
3512         (Plugin_manager::load_plugins): New parameter.
3513         (Plugin_manager::all_symbols_read): New parameter.
3514         (Plugin_manager::claim_file): New parameter. Save the elf object for
3515         unclaimed objects.
3516         (Plugin_manager::get_elf_object): New function.
3517         (Plugin_manager::get_view): Change to directly use the bool to check
3518         if get_view is called from claim_file_hook.
3519         * plugin.h (input_objects): New function
3520         (Plugin__manager::load_plugins): New parameter.
3521         (Plugin_manager::claim_file): New parameter.
3522         (Plugin_manager::get_elf_object): New function.
3523         (Plugin_manager::in_claim_file_handler): New function.
3524         (Plugin_manager::in_claim_file_handler_): New member.
3525         (layout): New function.
3526         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3527         handler with an extra parameter. Make the elf object before calling
3528         claim_file handler.
3529         * testsuite/plugin_test.c (get_section_count): New function pointer.
3530         (get_section_type): New function pointer.
3531         (get_section_name): New function pointer.
3532         (get_section_contents): New function pointer.
3533         (update_section_order): New function pointer.
3534         (allow_section_ordering): New function pointer.
3535         (onload): Check if the new interfaces exist.
3536
3537 2011-07-13  Ian Lance Taylor  <iant@google.com>
3538
3539         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3540         relro section.
3541         * x86_64.cc (Target_x86_64::got_section): Likewise.
3542         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3543         (relro_now_test_SOURCES): New variable.
3544         (relro_now_test_DEPENDENCIES): New variable.
3545         (relro_now_test_LDFLAGS): New variable.
3546         (relro_now_test_LDADD): New variable.
3547         (relro_now_test.so): New target.
3548         * testsuite/Makefile.in: Rebuild.
3549
3550 2011-07-12  Ian Lance Taylor  <iant@google.com>
3551
3552         PR gold/12980
3553         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3554         GLOB_DAT relocation rather than a RELATIVE relocation for a
3555         protected symbol when creating a shared library.
3556         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3557         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3558         * testsuite/protected_main_1.cc (main): Test that protected
3559         function has same address.
3560
3561 2011-07-11  Ian Lance Taylor  <iant@google.com>
3562
3563         PR gold/12979
3564         * options.h (class General_options): Add -Bgroup.
3565         * options.cc (General_options::finalize): If -Bgroup is set,
3566         default to --unresolved-symbols=report-all.
3567         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3568         * target-reloc.h (issue_undefined_symbol_error): Handle
3569         --unresolved-symbols=report-all.
3570
3571 2011-07-08  Ian Lance Taylor  <iant@google.com>
3572
3573         PR gold/11985
3574         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3575         if linker script discards key sections.
3576         (Layout::create_dynamic_symtab): Likewise.
3577         (Layout::assign_local_dynsym_offsets): Likewise.
3578         (Layout::sized_create_version_sections): Likewise.
3579         (Layout::create_interp): Likewise.
3580         (Layout::finish_dynamic_section): Likewise.
3581         (Layout::set_dynamic_symbol_size): Likewise.
3582
3583 2011-07-08  Ian Lance Taylor  <iant@google.com>
3584
3585         PR gold/12386
3586         * options.h (class General_options): Add --unresolved-symbols.
3587         * target-reloc.h (issue_undefined_symbol_error): Check
3588         --unresolved-symbols.  Add comments.
3589
3590 2011-07-08  Ian Lance Taylor  <iant@google.com>
3591
3592         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3593         expression more complex.
3594
3595 2011-07-08  Ian Lance Taylor  <iant@google.com>
3596
3597         PR gold/11317
3598         * target-reloc.h (issue_undefined_symbol_error): New inline
3599         function, broken out of relocate_section.
3600         (relocate_section): Call issue_undefined_symbol_error.
3601         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3602         there is no TLS segment if we are about to issue an undefined
3603         symbol error.
3604         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3605
3606 2011-07-08  Ian Lance Taylor  <iant@google.com>
3607
3608         PR gold/12279
3609         * resolve.cc (Symbol_table::should_override): Add fromtype
3610         parameter.  Change all callers.  Give error when linking together
3611         TLS and non-TLS symbol.
3612         (Symbol_table::should_override_with_special): Add fromtype
3613         parameter.  Change all callers.
3614         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3615         there is no TLS segment if we have reported some errors.
3616         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3617
3618 2011-07-08  Ian Lance Taylor  <iant@google.com>
3619
3620         PR gold/12372
3621         * target.h (Target::plt_address_for_global): New function.
3622         (Target::plt_address_for_local): New function.
3623         (Target::plt_section_for_global): Remove.
3624         (Target::plt_section_for_local): Remove.
3625         (Target::do_plt_address_for_global): New virtual function.
3626         (Target::do_plt_address_for_local): New virtual function.
3627         (Target::do_plt_section_for_global): Remove.
3628         (Target::do_plt_section_for_local): Remove.
3629         (Target::register_global_plt_entry): Add Symbol_table and Layout
3630         parameters.
3631         * output.cc (Output_data_got::Got_entry::write): Use
3632         plt_address_for_global and plt_address_for_local.
3633         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3634         address of output section.
3635         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3636         got_irelative_, and irelative_count_ fields.  Update
3637         declarations.
3638         (Output_data_plt_i386::has_irelative_section): New function.
3639         (Output_data_plt_i386::entry_count): Add irelative_count_.
3640         (Output_data_plt_i386::set_final_data_size): Likewise.
3641         (class Target_i386): Add got_irelative_ and rel_irelative_
3642         fields.  Update declarations.
3643         (Target_i386::Target_i386): Initialize new fields.
3644         (Target_i386::do_plt_address_for_global): New function replacing
3645         do_plt_section_for_global.
3646         (Target_i386::do_plt_address_for_local): New function replacing
3647         do_plt_section_for_local.
3648         (Target_i386::got_section): Create got_irelative_.
3649         (Target_i386::rel_irelative_section): New function.
3650         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3651         fields.  Don't define __rel_iplt_{start,end}.
3652         (Output_data_plt_i386::add_entry): Add symtab and layout
3653         parameters.  Change all callers.  Use different PLT and GOT for
3654         IFUNC symbols.
3655         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3656         layout parameters.  Change all callers.  Use different PLT and
3657         GOT.
3658         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3659         (Output_data_plt_i386::rel_irelative): New function.
3660         (Output_data_plt_i386::address_for_global): New function.
3661         (Output_data_plt_i386::address_for_local): New function.
3662         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3663         IRELATIVE GOT when changing IFUNC GOT entries.
3664         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3665         reloc.
3666         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3667         if we didn't create an IRELATIVE GOT.
3668         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3669         plt_address_for_local.
3670         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3671         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3672         got_irelative_, and irelative_count_ fields.  Update
3673         declarations.
3674         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3675         Initialize new fields.  Remove symtab parameter.  Change all
3676         callers.
3677         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3678         irelative_count_.
3679         (Output_data_plt_x86_64::has_irelative_section): New function.
3680         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3681         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3682         fields.  Update declarations.
3683         (Target_x86_64::Target_x86_64): Initialize new fields.
3684         (Target_x86_64::do_plt_address_for_global): New function replacing
3685         do_plt_section_for_global.
3686         (Target_x86_64::do_plt_address_for_local): New function replacing
3687         do_plt_section_for_local.
3688         (Target_x86_64::got_section): Create got_irelative_.
3689         (Target_x86_64::rela_irelative_section): New function.
3690         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3691         all callers.  Don't create __rel_iplt_{start,end}.
3692         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3693         parameters.  Change all callers.  Use different PLT and GOT for
3694         IFUNC symbols.
3695         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3696         layout parameters.  Change all callers.  Use different PLT and
3697         GOT.
3698         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3699         parameters.  Change all callers.  Use different PLT and GOT for
3700         IFUNC symbols.
3701         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3702         (Output_data_plt_x86_64::rela_irelative): New function.
3703         (Output_data_plt_x86_64::address_for_global): New function.
3704         (Output_data_plt_x86_64::address_for_local): New function.
3705         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3706         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3707         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3708         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3709         parameters.
3710         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3711         reloc.
3712         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3713         symbols if we didn't create an IRELATIVE GOT.
3714         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3715         plt_address_for_local.
3716         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3717         * testsuite/ifuncvar1.c: New test file.
3718         * testsuite/ifuncvar2.c: New test file.
3719         * testsuite/ifuncvar3.c: New test file.
3720         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3721         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3722         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3723         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3724         * testsuite/Makefile.in: Rebuild.
3725
3726 2011-07-07  Cary Coutant  <ccoutant@google.com>
3727
3728         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3729         (two_file_test_1_ndebug.o): Likewise.
3730         (two_file_test_1b_ndebug.o): Likewise.
3731         (two_file_test_2_ndebug.o): Likewise.
3732         (two_file_test_main_ndebug.o): Likewise.
3733         (incremental_test_2): Link with no-debug versions.
3734
3735 2011-07-06  Cary Coutant  <ccoutant@google.com>
3736
3737         * gold/incremental.cc
3738         (Output_section_incremental_inputs::write_info_blocks): Check for
3739         hidden and internal symbols.
3740
3741 2011-07-06  Cary Coutant  <ccoutant@google.com>
3742
3743         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3744         Check disposition for startup file.
3745         (Incremental_inputs::report_command_line): Ignore
3746         --incremental-startup-unchanged option.
3747         * options.cc (General_options::parse_incremental_startup_unchanged):
3748         New function.
3749         (General_options::General_options): Initialize new data member.
3750         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3751         (General_options): Add --incremental-startup-unchanged option.
3752         (General_options::incremental_startup_disposition): New function.
3753         (General_options::incremental_startup_disposition_): New data member.
3754
3755 2011-07-06  Cary Coutant  <ccoutant@google.com>
3756
3757         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3758         input file index to Script_info ctor.
3759         (Sized_incremental_binary::do_file_has_changed): Find the
3760         command-line argument for files named in scripts.
3761         * incremental.h (Script_info::Script_info): New ctor
3762         with input file index.
3763         (Script_info::input_file_index): New function.
3764         (Script_info::input_file_index_): New data member.
3765         (Incremental_binary::get_library): Add const.
3766         (Incremental_binary::get_script_info): Add const.
3767         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3768         * testsuite/Makefile.am (incremental_test_5): New test case.
3769         (incremental_test_6): New test case.
3770         * testsuite/Makefile.in: Regenerate.
3771
3772 2011-07-06  Cary Coutant  <ccoutant@google.com>
3773
3774         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3775         debug output when command lines differ.
3776
3777 2011-07-06  Cary Coutant  <ccoutant@google.com>
3778
3779         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3780         --incremental-patch option.
3781         * layout.cc (Free_list::allocate): Extend allocation beyond original
3782         end if enabled.
3783         (Layout::make_output_section): Mark sections that should get
3784         patch space.
3785         * options.cc (parse_percent): New function.
3786         * options.h (parse_percent): New function.
3787         (DEFINE_percent): New macro.
3788         (General_options): Add --incremental-patch option.
3789         * output.cc (Output_section::Output_section): Initialize new data
3790         members.
3791         (Output_section::add_input_section): Print section name when out
3792         of patch space.
3793         (Output_section::add_output_section_data): Likewise.
3794         (Output_section::set_final_data_size): Add patch space when
3795         doing --incremental-full.
3796         (Output_section::do_reset_address_and_file_offset): Remove patch
3797         space.
3798         (Output_segment::set_section_list_addresses): Print debug output
3799         only if --incremental-update.
3800         * output.h (Output_section::set_is_patch_space_allowed): New function.
3801         (Output_section::is_patch_space_allowed_): New data member.
3802         (Output_section::patch_space_): New data member.
3803         * parameters.cc (Parameters::incremental_full): New function.
3804         * parameters.h (Parameters::incremental_full): New function
3805         * testsuite/Makefile.am (incremental_test_2): Add test for
3806         --incremental-patch option.
3807         * testsuite/Makefile.in: Regenerate.
3808         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3809         (t18): Remove function body.
3810
3811 2011-07-05  Doug Kwan  <dougkwan@google.com>
3812
3813         PR gold/12771
3814         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3815         Arm_Address type for relocation result.
3816         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3817         overflow check.
3818         (Arm_relocate_functions::abs32): Use unaligned access.
3819         (Arm_relocate_functions::rel32): Ditto.
3820         (Arm_relocate_functions::prel31): Ditto.
3821         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3822         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3823         static data relocations.
3824         * testsuite/Makefile.in: Regnerate.
3825         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3826
3827 2011-07-05  Ian Lance Taylor  <iant@google.com>
3828
3829         PR gold/12392
3830         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3831         symbols if necessary.
3832         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3833
3834 2011-07-05  Ian Lance Taylor  <iant@google.com>
3835
3836         PR gold/12952
3837         * resolve.cc (Symbol::override_base_with_special): Simply override
3838         version with special symbol version, ignoring previous version.
3839
3840 2011-07-05  Ian Lance Taylor  <iant@google.com>
3841
3842         * object.cc (Sized_relobj_file::include_section_group): Add
3843         information to comment about signature location.
3844
3845 2011-07-02  Ian Lance Taylor  <iant@google.com>
3846
3847         PR gold/12957
3848         * options.h (class General_options): Add -f and -F.
3849         * options.cc (General_options::finalize): Fatal error if -f/-F
3850         are used without -shared.
3851         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3852
3853 2011-07-02  Ian Lance Taylor  <iant@google.com>
3854
3855         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3856
3857 2011-07-01  Ian Lance Taylor  <iant@google.com>
3858
3859         PR gold/12525
3860         PR gold/12952
3861         * resolve.cc (Symbol::override_base_with_special): Don't override
3862         the version if the overriding symbol has a different name.
3863         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3864         all callers.  If we give an error about an undefined version,
3865         define the base version if necessary.
3866         * dynobj.h (class Versions): Update declaration.
3867         * testsuite/weak_alias_test_5.cc: New file.
3868         * testsuite/weak_alias_test.script: New file.
3869         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3870         and versioned_alias have the right value, and call t2.
3871         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3872         weak_alias_test_5.so.
3873         (weak_alias_test_LDADD): Likewise.
3874         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3875         * testsuite/Makefile.in: Rebuild.
3876
3877 2011-07-01  Ian Lance Taylor  <iant@google.com>
3878
3879         PR gold/12525
3880         * options.h (class General_options): Support -z notext.
3881         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3882         -Wl,-z,notext.
3883         (two_file_shared_nonpic.so): Likewise.
3884         (two_file_shared_mixed.so): Likewise.
3885         (two_file_shared_mixed_1.so): Likewise.
3886         (weak_undef_lib_nonpic.so): Likewise.
3887         (alt/weak_undef_lib_nonpic.so): Likewise.
3888         (tls_test_shared_nonpic.so): Likewise.
3889         * testsuite/Makefile.in: Rebuild.
3890
3891 2011-07-01  Ian Lance Taylor  <iant@google.com>
3892
3893         PR gold/12525
3894         * configure.ac: Test whether static linking works, setting
3895         the automake conditional HAVE_STATIC.
3896         * testsuite/Makefile.am: Disable tests using -static if
3897         HAVE_STATIC is not true.
3898         * configure, testsuite/Makefile.in: Rebuild.
3899
3900 2011-07-01  Ian Lance Taylor  <iant@google.com>
3901
3902         PR gold/12525
3903         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3904         Assert if we see DW_EH_PE_indirect.
3905         * target.h (Target::ehframe_datarel_base): New function.
3906         (Target::do_ehframe_datarel_base): New target function.
3907         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3908         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3909         function.
3910
3911 2011-07-01  Ian Lance Taylor  <iant@google.com>
3912
3913         PR gold/12571
3914         * options.h (class General_options): Add
3915         --ld-generated-unwind-info.
3916         * ehframe.cc (Fde::write): Add address parameter.  Change all
3917         callers.  If associated with PLT, fill in address and size.
3918         (Cie::set_output_offset): Only add merge mapping if there is an
3919         object.
3920         (Cie::write): Add address parameter.  Change all callers.
3921         (Eh_frame::add_ehframe_for_plt): New function.
3922         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3923         input_offset_ fields into union u_, with new plt field.
3924         (Fde::Fde): Adjust for new union field.
3925         (Fde::Fde) [Output_data version]: New constructor.
3926         (Fde::add_mapping): Only add merge mapping if there is an object.
3927         (class Cie): Update declarations.
3928         (class Eh_frame): Declare add_ehframe_for_plt.
3929         * layout.cc (Layout::layout_eh_frame): Break out code into
3930         make_eh_frame_section, and call it.
3931         (Layout::make_eh_frame_section): New function.
3932         (Layout::add_eh_frame_for_plt): New function.
3933         * layout.h (class Layout): Update declarations.
3934         * merge.cc (Merge_map::add_mapping): Add assertion.
3935         * i386.cc: Include "dwarf.h".
3936         (class Output_data_plt_i386): Make first_plt_entry,
3937         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3938         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3939         and plt_eh_frame_fde.
3940         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3941         boundary.  Call add_eh_frame_for_plt if appropriate.
3942         * x86_64.cc: Include "dwarf.h".
3943         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3944         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3945         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3946         and plt_eh_frame_fde.
3947         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3948         appropriate.
3949
3950 2011-06-29  Ian Lance Taylor  <iant@google.com>
3951
3952         PR gold/12629
3953         * object.cc (Sized_relobj_file::layout_section): Change shdr
3954         parameter to be const.
3955         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3956         out of do_layout.
3957         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3958         appropriate.  Call layout_eh_frame_section.
3959         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3960         sections.
3961         * object.h (class Sized_relobj_file): Update declarations.
3962
3963 2011-06-29  Ian Lance Taylor  <iant@google.com>
3964
3965         PR gold/12652
3966         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3967         modifier.
3968         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3969
3970 2011-06-29  Ian Lance Taylor  <iant@google.com>
3971
3972         PR gold/12675
3973         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3974         SHT_X86_64_UNWIND.
3975         * layout.cc (Layout::layout_eh_frame): Likewise.
3976
3977 2011-06-29  Ian Lance Taylor  <iant@google.com>
3978
3979         PR gold/12695
3980         * layout.cc (Layout::symtab_section_shndx): New function.
3981         * layout.h (class Layout): Declare symtab_section_shndx.
3982         * output.cc (Output_section::write_header): Call it.
3983
3984 2011-06-29  Ian Lance Taylor  <iant@google.com>
3985
3986         PR gold/12818
3987         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3988         symbols which are not used in a relocation.
3989
3990 2011-06-28  Ian Lance Taylor  <iant@google.com>
3991
3992         PR gold/12898
3993         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3994         script create indistinguishable segments.
3995         (Layout::set_segment_offsets): Use stable_sort when sorting
3996         segments.  Pass this to Compare_segments constructor.
3997         * layout.h (class Layout): Make segment_precedes non-static.
3998         (class Compare_segments): Change from struct to class.  Add
3999         layout_ field.  Add constructor.
4000         * script-sections.cc
4001         (Script_sections::attach_sections_using_phdrs_clause): Rename
4002         local orphan to is_orphan.  Don't report failure to put empty
4003         section in segment.  On attachment failure, report name of
4004         section, and attach to first PT_LOAD segment.
4005
4006 2011-06-28  Ian Lance Taylor  <iant@google.com>
4007
4008         PR gold/12934
4009         * target-select.cc (Target_selector::Target_selector): Add
4010         emulation parameter.  Change all callers.
4011         (select_target_by_bfd_name): Rename from select_target_by_name.
4012         Change all callers.
4013         (select_target_by_emulation): New function.
4014         (supported_emulation_names): New function.
4015         * target-select.h (class Target_selector): Add emulation_ field.
4016         Update declarations.
4017         (Target_selector::recognize_by_bfd_name): Rename from
4018         recognize_by_name.  Change all callers.
4019         (Target_selector::supported_bfd_names): Rename from
4020         supported_names.  Change all callers.
4021         (Target_selector::recognize_by_emulation): New function.
4022         (Target_selector::supported_emulations): New function.
4023         (Target_selector::emulation): New function.
4024         (Target_selector::do_recognize_by_bfd_name): Rename from
4025         do_recognize_by_name.  Change all callers.
4026         (Target_selector::do_supported_bfd_names): Rename from
4027         do_supported_names.  Change all callers.
4028         (Target_selector::do_recognize_by_emulation): New function.
4029         (Target_selector::do_supported_emulations): New function.
4030         (select_target_by_bfd_name): Change name in declaration.
4031         (select_target_by_emulation): Declare.
4032         (supported_emulation_names): Declare.
4033         * parameters.cc (parameters_force_valid_target): Try to find
4034         target based on emulation from -m option.
4035         * options.h (class General_options): Change doc string for -m.
4036         * options.cc (help): Print emulations.
4037         (General_options::parse_V): Likewise.
4038         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4039         Add emulation parameter.  Change all callers.
4040
4041 2011-06-28  Ian Lance Taylor  <iant@google.com>
4042
4043         * target.h (class Target): Add osabi_ field.
4044         (Target::osabi): New function.
4045         (Target::set_osabi): New function.
4046         (Target::Target): Initialize osabi_.
4047         (Target::do_adjust_elf_header): Make pure virtual.
4048         (Sized_target::do_adjust_elf_header): Declare.
4049         * target.cc (Sized_target::do_adjust_elf_header): New function.
4050         (class Sized_target): Instantiate all versions.
4051         * freebsd.h (class Target_freebsd): Remove.
4052         (Target_selector_freebsd::do_recognize): Call set_osabi on
4053         Target.
4054         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4055         (Target_selector_freebsd::set_osabi): Remove.
4056         * i386.cc (class Target_i386): Inherit from Sized_target rather
4057         than Target_freebsd.
4058         * x86_64.cc (class Target_x86_64): Likewise.
4059
4060 2011-06-28  Ian Lance Taylor  <iant@google.com>
4061
4062         * target.h (Target::can_check_for_function_pointers): Rewrite.
4063         Make non-virtual.
4064         (Target::can_icf_inline_merge_sections): Likewise.
4065         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4066         (Target::Target_info): Add can_icf_inline_merge_sections field.
4067         (Target::do_can_check_for_function_pointers): New virtual
4068         function.
4069         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4070         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4071         from can_check_for_function_pointers, move in file.
4072         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4073         section_may_have_icf_unsafe_poineters, move in file.
4074         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4075         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4076         Rename from can_check_for_function_pointers, move in file.
4077         (Target_i386::can_icf_inline_merge_sections): Remove.
4078         (Target_i386::i386_info): Initialize
4079         can_icf_inline_merge_sections.
4080         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4081         Initialize can_icf_inline_merge_sections.
4082         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4083         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4084         Rename from can_check_for_function_pointers, move in file.
4085         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4086         (Target_x86_64::x86_64_info): Initialize
4087         can_icf_inline_merge_sections.
4088         * testsuite/testfile.cc (Target_test::test_target_info):
4089         Likewise.
4090         * icf.cc (get_section_contents): Correct formatting.
4091
4092 2011-06-27  Ian Lance Taylor  <iant@google.com>
4093
4094         * symtab.cc (Symbol::versioned_name): New function.
4095         (Symbol_table::add_to_final_symtab): Use versioned_name when
4096         appropriate.
4097         (Symbol_table::sized_write_symbol): Likewise.
4098         * symtab.h (class Symbol): Declare versioned_name.
4099         * stringpool.h (class Stringpool_template): Add variant of add
4100         which takes a std::basic_string.
4101         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4102         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4103         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4104         (ver_test_12.o): New target.
4105         * testsuite/Makefile.in: Rebuild.
4106
4107 2011-06-27  Doug Kwan  <dougkwan@google.com>
4108
4109         * arm.cc (Arm_relocate_functions::thm_jump8,
4110         Arm_relocate_functions::thm_jump11): Use a wider signed
4111         type to compute offset.
4112         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4113         arm_thm_jump8.
4114         * testsuite/Makefile.in: Regenerate.
4115         * testsuite/arm_branch_in_range.sh: Check test results of
4116         arm_thm_jump11 and arm_thm_jump8.
4117         * testsuite/arm_thm_jump11.s: New test source file.
4118         * testsuite/arm_thm_jump11.t: New linker script.
4119         * testsuite/arm_thm_jump8.s: New test source file.
4120         * testsuite/arm_thm_jump8.t: New linker script.
4121
4122 2011-06-24  Ian Lance Taylor  <iant@google.com>
4123
4124         * layout.cc: Include "object.h".
4125         (ctors_sections_in_init_array): New static variable.
4126         (Layout::is_ctors_in_init_array): New function.
4127         (Layout::layout): Add entry to ctors_sections_in_init_array if
4128         appropriate.
4129         * layout.h (class Layout): Declare is_ctors_in_init_array.
4130         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4131         is_ctors_reverse_view is set.
4132         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4133         all callers.  Set is_ctors_reverse_view field of View_size.
4134         (Sized_relobj_file::reverse_words): New function.
4135         * object.h (Sized_relobj_file::View_size): Add
4136         is_ctors_reverse_view field.
4137         (class Sized_relobj_file): Update declarations.
4138         * testsuite/initpri3.c: New test.
4139         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4140         initpri3b.
4141         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4142         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4143         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4144         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4145         * testsuite/Makefile.in: Rebuild.
4146
4147 2011-06-24  Cary Coutant  <ccoutant@google.com>
4148
4149         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4150         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4151         (debug_msg_cdebug.err): New targets.
4152         * testsuite/Makefile.in: Regenerate.
4153         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4154         Fix checks for link with shared library.
4155
4156 2011-06-24  Doug Kwan  <dougkwan@google.com>
4157
4158         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4159         skip empty text sections.
4160         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4161
4162 2011-06-22  Ian Lance Taylor  <iant@google.com>
4163
4164         PR gold/12910
4165         * options.h (class General_options): Add --ctors-in-init-array.
4166         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4167         friends as SHT_PROGBITS for merging sections.
4168         (Layout::layout): Remove special handling of .init_array and
4169         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4170         and .dtors if ctors_in_init_array.
4171         (Layout::make_output_section): Force correct section types for
4172         .init_array and friends.  Don't sort if doing relocatable link,
4173         Don't sort .ctors and .dtors if ctors_in_init_array.
4174         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4175         (Layout::output_section_name): Add relobj parameter.  Change all
4176         callers.  Handle .ctors. and .dtors. in code rather than table.
4177         Handle .ctors and .dtors if ctors_in_init_array.
4178         (Layout::match_file_name): New function, moved from output.cc.
4179         * layout.h (class Layout): Update declarations.
4180         * output.cc: Include "layout.h".
4181         (Input_section_sort_entry::get_priority): New function.
4182         (Input_section_sort_entry::match_file_name): Just call
4183         Layout::match_file_name.
4184         (Output_section::Input_section_sort_init_fini_compare::operator()):
4185         Handle .ctors and .dtors.  Sort by explicit priority rather than
4186         by name.
4187         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4188         * testsuite/initpri2.c: New test.
4189         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4190         (check_PROGRAMS): Add initpri2.
4191         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4192         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4193         * configure, testsuite/Makefile.in: Rebuild.
4194
4195 2011-06-19  Ian Lance Taylor  <iant@google.com>
4196
4197         PR gold/12880
4198         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4199         .interp section to a PT_INTERP segment even if we have seen a
4200         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4201         clause in a linker script.
4202         (Layout::finalize): Don't create a .interp section if we've
4203         already create a PT_INTERP segment.
4204         (Layout::create_interp): Always call choose_output_section (revert
4205         patch of 2011-06-17).  Don't create PT_INTERP segment.
4206         * script-sections.cc
4207         (Script_sections::create_note_and_tls_segments): Add a .interp
4208         section to a PT_INTERP segment even if we have seen a
4209         --dynamic-linker option.
4210
4211 2011-06-18  Ian Lance Taylor  <iant@google.com>
4212
4213         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4214         merely because a non-PT_LOAD segment has a dynamic reloc.
4215
4216 2011-06-18  Ian Lance Taylor  <iant@google.com>
4217
4218         * layout.cc (Layout::finish_dynamic_section): Don't create
4219         DT_FLAGS entry if not needed.
4220
4221 2011-06-18  Ian Lance Taylor  <iant@google.com>
4222
4223         PR gold/12745
4224         * layout.cc (Layout::layout_eh_frame): Correct handling of
4225         writable .eh_frame section.
4226
4227 2011-06-17  Ian Lance Taylor  <iant@google.com>
4228
4229         PR gold/12893
4230         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4231         symbol is redefined with the exact same object and value.
4232
4233 2011-06-17  Ian Lance Taylor  <iant@google.com>
4234
4235         PR gold/12880
4236         * layout.h (class Layout): Add interp_segment_ field.
4237         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4238         (Layout::attach_allocated_section_to_segment): If making shared
4239         library, put .interp section in PT_INTERP segment.
4240         (Layout::finalize): Also call create_interp if -dynamic-linker
4241         option was used.
4242         (Layout::create_interp): Assert that there is no PT_INTERP
4243         segment.  If not using a SECTIONS clause, use make_output_section.
4244         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4245         * script-sections.cc
4246         (Script_sections::create_note_and_tls_segments): If making shared
4247         library, put .interp section in PT_INTERP segment.
4248
4249 2011-06-17  Ian Lance Taylor  <iant@google.com>
4250
4251         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4252         when making a shared library.
4253
4254 2011-06-17  Ian Lance Taylor  <iant@google.com>
4255
4256         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4257         parameter.  Change all callers.  Don't issue warning about PC32
4258         against locally defined symbol.
4259
4260 2011-06-16  Ian Lance Taylor  <iant@google.com>
4261
4262         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4263         occurs in same object.
4264
4265 2011-06-14  Alan Modra  <amodra@gmail.com>
4266
4267         * po/POTFILES.in: Regenerate.
4268
4269 2011-06-09  Ian Lance Taylor  <iant@google.com>
4270
4271         * script-sections.cc
4272         (Orphan_output_section::set_section_addresses): For a relocatable
4273         link set address to 0.
4274
4275 2011-06-09  Cary Coutant  <ccoutant@google.com>
4276
4277         PR gold/12804
4278         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4279         used with --compress-debug-sections.
4280         * gold/object.cc (Sized_relobj_file::do_layout): Report
4281         uncompressed size of compressed input sections.
4282
4283 2011-06-08  Cary Coutant  <ccoutant@google.com>
4284
4285         PR gold/12804
4286         * testsuite/two_file_test_2_v1.cc: Change initialization of
4287         v2 to keep it in .data.
4288
4289 2011-06-07  Cary Coutant  <ccoutant@google.com>
4290
4291         * common.cc (Symbol_table::do_allocate_commons_list): Call
4292         gold_fallback.
4293         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4294         (Errors::fallback): New function.
4295         (gold_fallback): New function.
4296         * errors.h (Errors::fallback): New function.
4297         * gold.cc (gold_exit): Change status parameter to enum; adjust
4298         all callers.
4299         (queue_initial_tasks): Call gold_fallback.
4300         * gold.h: Include cstdlib.
4301         (Exit_status): New enum type.
4302         (gold_exit): Change status parameter to enum.
4303         (gold_fallback): New function.
4304         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4305         (Layout::create_symtab_sections): Likewise.
4306         (Layout::create_shdrs): Likewise.
4307         * main.cc (main): Adjust call to gold_exit.
4308         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4309         (Output_data_got::add_got_entry_pair): Likewise.
4310         (Output_section::add_input_section): Likewise.
4311         (Output_section::add_output_section_data): Likewise.
4312         (Output_segment::set_section_list_addresses): Likewise.
4313         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4314
4315 2011-06-07  Cary Coutant  <ccoutant@google.com>
4316
4317         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4318         for incremental links.
4319         * output.cc (Output_segment::set_section_list_addresses): Remove
4320         FIXME and test for TLS or BSS.
4321
4322 2011-06-07  Cary Coutant  <ccoutant@google.com>
4323
4324         * testsuite/Makefile.am: Add incremental_copy_test,
4325         incremental_common_test_1.
4326         * testsuite/Makefile.in: Regenerate.
4327         * testsuite/common_test_1_v1.c: New source file.
4328         * testsuite/common_test_1_v2.c: New source file.
4329         * testsuite/copy_test_v1.cc: New source file.
4330
4331 2011-06-07  Cary Coutant  <ccoutant@google.com>
4332
4333         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4334         update, allocate common from bss section's free list.
4335         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4336         linker-defined symbols.
4337         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4338         Skip GOT and PLT entries that are no longer referenced.
4339         (Output_section_incremental_inputs::write_info_blocks): Mark
4340         linker-defined symbols.
4341         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4342         * output.cc (Output_section::allocate): New function.
4343         * output.h (Output_section::allocate): New function.
4344         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4345         linker-defined symbols.
4346         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4347         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4348         (Symbol::init_base_output_data): Likewise.
4349         (Symbol::init_base_output_segment): Likewise.
4350         (Symbol::init_base_constant): Likewise.
4351         (Sized_symbol::init_output_data): Likewise.
4352         (Sized_symbol::init_output_segment): Likewise.
4353         (Sized_symbol::init_constant): Likewise.
4354         (Symbol_table::do_define_in_output_data): Likewise.
4355         (Symbol_table::do_define_in_output_segment): Likewise.
4356         (Symbol_table::do_define_as_constant): Likewise.
4357         * symtab.h (Symbol::is_predefined): New function.
4358         (Symbol::init_base_output_data): Add is_predefined parameter.
4359         (Symbol::init_base_output_segment): Likewise.
4360         (Symbol::init_base_constant): Likewise.
4361         (Symbol::is_predefined_): New data member.
4362         (Sized_symbol::init_output_data): Add is_predefined parameter.
4363         (Sized_symbol::init_output_segment): Likewise.
4364         (Sized_symbol::init_constant): Likewise.
4365         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4366
4367 2011-06-07  Cary Coutant  <ccoutant@google.com>
4368
4369         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4370         instead of emit_copy_reloc.
4371         (Copy_relocs::emit_copy_reloc): Refactor.
4372         (Copy_relocs::make_copy_reloc): New function.
4373         (Copy_relocs::add_copy_reloc): Remove.
4374         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4375         section.
4376         (Copy_relocs::make_copy_reloc): New function.
4377         (Copy_relocs::add_copy_reloc): Remove.
4378         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4379         unchanged input files.
4380         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4381         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4382         Reserve BSS space for COPY relocations.
4383         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4384         (Output_section_incremental_inputs::write_info_blocks): Record
4385         whether a symbol is copied from a shared object.
4386         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4387         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4388         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4389         (Incremental_input_entry_reader::get_output_symbol_index): Add
4390         is_copy parameter.
4391         (Incremental_binary::emit_copy_relocs): New function.
4392         (Incremental_binary::do_emit_copy_relocs): New function.
4393         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4394         new data member.
4395         (Sized_incremental_binary::add_copy_reloc): New function.
4396         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4397         (Sized_incremental_binary::Copy_reloc): New struct.
4398         (Sized_incremental_binary::Copy_relocs): New typedef.
4399         (Sized_incremental_binary::copy_relocs_): New data member.
4400         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4401         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4402         * target.h (Sized_target::emit_copy_reloc): New function.
4403         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4404
4405 2011-06-02  Cary Coutant  <ccoutant@google.com>
4406
4407         PR gold/12163
4408         * gold/archive.cc (Archive::Archive): Initialize new data member.
4409         (Archive::include_all_members): Return if archive has already been
4410         included.
4411         * gold/archive.h (Archive::include_all_members_): New data member.
4412
4413 2011-06-02  Nick Clifton  <nickc@redhat.com>
4414
4415         * dynobj.h: Fix spelling mistake in comment.
4416         * output.cc: Likewise.
4417
4418 2011-05-31  Doug Kwan  <dougkwan@google.com>
4419             Asier Llano
4420
4421         PR gold/12826
4422         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4423         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4424         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4425         redundant arm_exidx_test.so.
4426         * testsuite/Makefile.in: Regenerate.
4427         (check_SCRIPTS): Add pr12826.sh
4428         (check_DATA): Add pr12826.stdout
4429         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4430         * testsuite/pr12826.sh: New file.
4431         * testsuite/pr12826_1.s: Ditto.
4432         * testsuite/pr12826_1.s: Ditto.
4433
4434 2011-05-30  Ian Lance Taylor  <iant@google.com>
4435
4436         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4437         sections.
4438
4439 2011-05-29  Ian Lance Taylor  <iant@google.com>
4440
4441         PR gold/12804
4442         * testsuite/Makefile.am: Use different file name for two_file_test
4443         temporary file for each incremental test.
4444         * testsuite/Makefile.in: Rebuild.
4445
4446 2011-05-29  Ian Lance Taylor  <iant@google.com>
4447
4448         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4449         binary input file is empty.
4450
4451 2011-05-27  Ian Lance Taylor  <iant@google.com>
4452
4453         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4454         (ver_test_9.so): Likewise.
4455         * testsuite/Makefile.in: Rebuild.
4456
4457 2011-05-26 Cary Coutant  <ccoutant@google.com>
4458
4459         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4460         * incremental.cc (Incremental_inputs::report_input_section): Fix
4461         comment, indentation.
4462         (Incremental_inputs::report_comdat_group): New function.
4463         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4464         of data for incremental input file entry.
4465         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4466         group count, COMDAT group signatures.
4467         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4468         an unchanged input file.
4469         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4470         Initialize new data member.
4471         (Incremental_object_entry::add_comdat_group): New function.
4472         (Incremental_object_entry::get_comdat_group_count): New function.
4473         (Incremental_object_entry::get_comdat_signature_key): New function.
4474         (Incremental_object_entry::groups_): New data member.
4475         (Incremental_inputs::report_comdat_group): New function.
4476         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4477         data for incremental input file entry.
4478         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4479         (Incremental_input_entry_reader::get_input_section): Adjust size of
4480         data for incremental input file entry.
4481         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4482         (Incremental_input_entry_reader::get_comdat_group_signature): New
4483         function.
4484         * object.cc (Sized_relobj::include_section_group): Report kept
4485         COMDAT groups for incremental links.
4486
4487 2011-05-24  David Meyer  <pdox@google.com>
4488
4489         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4490         with name parameter.  Add found_name parameter.
4491         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4492         * dirsearch.h (class Dirsearch): Update declaration.
4493
4494 2011-05-24  Ian Lance Taylor  <iant@google.com>
4495
4496         * archive.cc (Library_base::should_include_member): Pull in object
4497         from archive if it defines the entry symbol.
4498         * parameters.cc (Parameters::entry): New function.
4499         * parameters.h (class Parameters): Declare entry.
4500         * output.h (class Output_file_header): Remove entry_ field.
4501         * output.cc (Output_file_header::Output_file_header): Remove entry
4502         parameter.  Change all callers.
4503         (Output_file_header::entry): Use parameters->entry.
4504         * gold.cc (queue_middle_tasks): Likewise.
4505         * plugin.cc (Plugin_hook::run): Likewise.
4506
4507 2011-05-24 Cary Coutant  <ccoutant@google.com>
4508
4509         * gold.cc (queue_initial_tasks): Pass incremental base filename
4510         to Output_file::open_base_file; don't print error message.
4511         * incremental-dump.cc (main): Adjust call to
4512         Output_file::open_for_modification.
4513         * incremental-dump.cc (main): Likewise.
4514         * incremental.cc (Incremental_inputs::report_command_line):
4515         Ignore --incremental-base option when comparing command lines.
4516         Ignore parameter when given as separate argument.
4517         * options.h (class General_options): Add --incremental-base.
4518         * output.cc (Output_file::Output_file):
4519         (Output_file::open_base_file): Add base_name and writable parameters;
4520         read base file into new file; print error message here.
4521         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4522         callers.
4523         * output.h (Output_file::open_for_modification): Rename to...
4524         (Output_file::open_base_file): ...this; add base_name and
4525         writable parameters; adjust all callers.
4526         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4527         callers.
4528         * testsuite/Makefile.am (incremental_test_4): Test
4529         --incremental-base.
4530         * testsuite/Makefile.in: Regenerate.
4531
4532 2011-05-24 Cary Coutant  <ccoutant@google.com>
4533
4534         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4535         incremental_test_4.
4536         * testsuite/Makefile.in: Regenerate.
4537         * testsuite/two_file_test_1_v1.cc: New test source file.
4538         * testsuite/two_file_test_1b_v1.cc: New test source file.
4539         * testsuite/two_file_test_2_v1.cc: New test source file.
4540
4541 2011-05-24 Cary Coutant  <ccoutant@google.com>
4542
4543         * dynobj.h (Dynobj::do_dynobj): New function.
4544         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4545         flag and soname for shared objects.
4546         * incremental.cc (Incremental_inputs::report_object): Make
4547         either Incremental_object_entry or Incremental_dynobj_entry; add
4548         soname to string table.
4549         (Incremental_inputs::report_input_section): Add assertion.
4550         (Output_section_incremental_inputs::set_final_data_size): Adjust
4551         type of input file entry for shared libraries; adjust size of
4552         shared library info entry.
4553         (Output_section_incremental_inputs::write_input_files): Write
4554         as_needed flag for shared libraries.
4555         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4556         of input file entry for shared libraries; write soname.
4557         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4558         soname from incremental info.
4559         * incremental.h (enum Incremental_input_flags): Add
4560         INCREMENTAL_INPUT_AS_NEEDED.
4561         (Incremental_input_entry::Incremental_input_entry): Initialize new
4562         data member.
4563         (Incremental_input_entry::set_as_needed): New function.
4564         (Incremental_input_entry::as_needed): New function.
4565         (Incremental_input_entry::do_dynobj_entry): New function.
4566         (Incremental_input_entry::as_needed_): New data member.
4567         (Incremental_object_entry::Incremental_object_entry): Don't check
4568         for shared library.
4569         (Incremental_object_entry::do_type): Likewise.
4570         (class Incremental_dynobj_entry): New class.
4571         (Incremental_input_entry_reader::as_needed): New function.
4572         (Incremental_input_entry_reader::get_soname): New function.
4573         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4574         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4575         size of shared library info entry.
4576         * layout.cc (Layout::finish_dynamic_section): Don't test for
4577         incremental link when adding DT_NEEDED entries.
4578         * object.h (Object::Object): Initialize new data member.
4579         (Object::dynobj): New function.
4580         (Object::set_as_needed): New function.
4581         (Object::as_needed): New function.
4582         (Object::do_dynobj): New function.
4583         (Object::as_needed_): New data member.
4584
4585 2011-05-24 Cary Coutant  <ccoutant@google.com>
4586
4587         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4588         info; adjust display of GOT entries.
4589         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4590         vector of input objects; remove file_status_.
4591         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4592         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4593         got_plt reader; call target hooks to reserve GOT entries.
4594         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4595         of input file info header and GOT info entry.
4596         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4597         relocation info.
4598         (Got_plt_view_info::got_descriptor): Remove.
4599         (Got_plt_view_info::sym_index): New data member.
4600         (Got_plt_view_info::input_index): New data member.
4601         (Local_got_offset_visitor::visit): Write input file index.
4602         (Global_got_offset_visitor::visit): Write 0 for input file index.
4603         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4604         with sym_index and input_index.
4605         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4606         incremental info GOT entry; replace got_descriptor with input_index.
4607         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4608         map from input file index to object.
4609         (Sized_relobj_incr::do_layout): Replace direct data member reference
4610         with accessor function.
4611         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4612         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4613         Adjust size of input file info header.
4614         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4615         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4616         (Incremental_input_entry_reader::get_input_section): Adjust size of
4617         input file info header.
4618         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4619         of incremental info GOT entry.
4620         (Incremental_got_plt_reader::get_got_desc): Remove.
4621         (Incremental_got_plt_reader::get_got_symndx): New function.
4622         (Incremental_got_plt_reader::get_got_input_index): New function.
4623         (Sized_incremental_binary::Sized_incremental_binary): Remove
4624         file_status_; add input_objects_.
4625         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4626         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4627         (Sized_incremental_binary::file_is_unchanged): Remove.
4628         (Sized_incremental_binary::set_input_object): New function.
4629         (Sized_incremental_binary::input_object): New function.
4630         (Sized_incremental_binary::file_status_): Remove.
4631         (Sized_incremental_binary::input_objects_): New data member.
4632         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4633         references.
4634         (Sized_relobj_incr::invalid_address): Move to base class.
4635         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4636         class.
4637         (Sized_relobj_incr::do_output_section_offset): Likewise.
4638         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4639         (Sized_relobj_incr::section_offsets_): Likewise.
4640         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4641         function.
4642         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4643         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4644         with accessor function.
4645         (Sized_relobj_file::do_layout): Likewise.
4646         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4647         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4648         (Sized_relobj_file::compute_final_local_value): Replace refs to
4649         section_offsets_ with accessor function.
4650         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4651         * object.h (Relobj::Relobj): Initialize new data members.
4652         (Relobj::add_dyn_reloc): New function.
4653         (Relobj::first_dyn_reloc): New function.
4654         (Relobj::dyn_reloc_count): New function.
4655         (Relobj::first_dyn_reloc_): New data member.
4656         (Relobj::dyn_reloc_count_): New data member.
4657         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4658         references.
4659         (Sized_relobj::Address): New typedef.
4660         (Sized_relobj::invalid_address): Move here from child class.
4661         (Sized_relobj::Sized_relobj): Initialize new data members.
4662         (Sized_relobj::sized_relobj): New function.
4663         (Sized_relobj::is_output_section_offset_invalid): Move here from
4664         child class.
4665         (Sized_relobj::get_output_section_offset): Likewise.
4666         (Sized_relobj::local_has_got_offset): Likewise.
4667         (Sized_relobj::local_got_offset): Likewise.
4668         (Sized_relobj::set_local_got_offset): Likewise.
4669         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4670         (Sized_relobj::clear_got_offsets): New function.
4671         (Sized_relobj::section_offsets): Move here from child class.
4672         (Sized_relobj::do_output_section_offset): Likewise.
4673         (Sized_relobj::do_set_section_offset): Likewise.
4674         (Sized_relobj::Local_got_offsets): Likewise.
4675         (Sized_relobj::local_got_offsets_): Likewise.
4676         (Sized_relobj::section_offsets_): Likewise.
4677         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4678         references.
4679         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4680         class.
4681         (Sized_relobj_file::sized_relobj): New function
4682         (Sized_relobj_file::local_has_got_offset): Move to base class.
4683         (Sized_relobj_file::local_got_offset): Likewise.
4684         (Sized_relobj_file::set_local_got_offset): Likewise.
4685         (Sized_relobj_file::get_output_section_offset): Likewise.
4686         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4687         (Sized_relobj_file::do_output_section_offset): Likewise.
4688         (Sized_relobj_file::do_set_section_offset): Likewise.
4689         (Sized_relobj_file::Local_got_offsets): Likewise.
4690         (Sized_relobj_file::local_got_offsets_): Likewise.
4691         (Sized_relobj_file::section_offsets_): Likewise.
4692         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4693         (all constructors).
4694         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4695         (Output_reloc::get_symbol_index): Likewise.
4696         (Output_reloc::local_section_offset): Likewise.
4697         (Output_reloc::get_address): Likewise.
4698         (Output_reloc::symbol_value): Likewise.
4699         (Output_data_got::reserve_slot): Move to class definition.
4700         (Output_data_got::reserve_local): New function.
4701         (Output_data_got::reserve_slot_for_global): Remove.
4702         (Output_data_got::reserve_global): New function.
4703         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4704         (all constructors, two instantiations).
4705         (Output_reloc::get_relobj): New function (two instantiations).
4706         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4707         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4708         (Output_data_reloc::add_global): Adjust type of relobj.
4709         (Output_data_reloc::add_global_relative): Likewise.
4710         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4711         (Output_data_reloc::add_local): Likewise.
4712         (Output_data_reloc::add_local_relative): Likewise.
4713         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4714         (Output_data_reloc::add_local_section): Likewise.
4715         (Output_data_reloc::add_output_section): Likewise.
4716         (Output_data_reloc::add_absolute): Likewise.
4717         (Output_data_reloc::add_target_specific): Likewise.
4718         (Output_data_got::reserve_slot): Move definition here.
4719         (Output_data_got::reserve_local): New function.
4720         (Output_data_got::reserve_global): New function.
4721         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4722         section_offsets_ with accessor function.
4723         (Sized_relobj_file::write_sections): Likewise.
4724         (Sized_relobj_file::do_relocate_sections): Likewise.
4725         * target.h (Sized_target::reserve_local_got_entry): New function.
4726         (Sized_target::reserve_global_got_entry): New function.
4727         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4728         (Target_x86_64::reserve_global_got_entry): New function.
4729         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4730
4731 2011-05-23 Cary Coutant  <ccoutant@google.com>
4732
4733         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4734         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4735         bit when checking got_type.
4736         * incremental.cc (Sized_incremental_binary::setup_readers):
4737         Store symbol table and string table locations; initialize bit vector
4738         of file status flags.
4739         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4740         unchanged files.
4741         (Sized_incremental_binary::do_process_got_plt): New function.
4742         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4743         (Output_section_incremental_inputs::set_final_data_size): Record
4744         file index for each input file.
4745         (Output_section_incremental_inputs::write_got_plt): Store file index
4746         instead of input entry offset for each GOT entry.
4747         * incremental.h
4748         (Incremental_input_entry::Incremental_input_entry): Initialize new
4749         data member.
4750         (Incremental_input_entry::set_offset): Store file index.
4751         (Incremental_input_entry::get_file_index): New function.
4752         (Incremental_input_entry::file_index_): New data member.
4753         (Incremental_binary::process_got_plt): New function.
4754         (Incremental_binary::do_process_got_plt): New function.
4755         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4756         data members.
4757         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4758         (Sized_incremental_binary::set_file_is_unchanged): New function.
4759         (Sized_incremental_binary::file_is_unchanged): New function.
4760         (Sized_incremental_binary::do_process_got_plt): New function.
4761         (Sized_incremental_binary::file_status_): New data member.
4762         (Sized_incremental_binary::main_symtab_loc_): New data member.
4763         (Sized_incremental_binary::main_strtab_loc_): New data member.
4764         * output.cc (Output_data_got::Got_entry::write): Add case
4765         RESERVED_CODE.
4766         (Output_data_got::add_global): Call add_got_entry.
4767         (Output_data_got::add_global_plt): Likewise.
4768         (Output_data_got::add_global_with_rel): Likewise.
4769         (Output_data_got::add_global_with_rela): Likewise.
4770         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4771         (Output_data_got::add_global_pair_with_rela): Likewise.
4772         (Output_data_got::add_local): Call add_got_entry.
4773         (Output_data_got::add_local_plt): Likewise.
4774         (Output_data_got::add_local_with_rel): Likewise.
4775         (Output_data_got::add_local_with_rela): Likewise.
4776         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4777         (Output_data_got::add_local_pair_with_rela): Likewise.
4778         (Output_data_got::reserve_slot): New function.
4779         (Output_data_got::reserve_slot_for_global): New function.
4780         (Output_data_got::add_got_entry): New function.
4781         (Output_data_got::add_got_entry_pair): New function.
4782         (Output_section::add_output_section_data): Edit FIXME.
4783         * output.h
4784         (Output_section_data_build::Output_section_data_build): New
4785         constructor with size parameter.
4786         (Output_data_space::Output_data_space): Likewise.
4787         (Output_data_got::Output_data_got): Initialize new data member; new
4788         constructor with size parameter.
4789         (Output_data_got::add_constant): Call add_got_entry.
4790         (Output_data_got::reserve_slot): New function.
4791         (Output_data_got::reserve_slot_for_global): New function.
4792         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4793         (Output_data_got::add_got_entry): New function.
4794         (Output_data_got::add_got_entry_pair): New function.
4795         (Output_data_got::free_list_): New data member.
4796         * target.h (Sized_target::init_got_plt_for_update): New function.
4797         (Sized_target::register_global_plt_entry): New function.
4798         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4799         Initialize new data member; call init; add constructor with PLT count.
4800         (Output_data_plt_x86_64::init): New function.
4801         (Output_data_plt_x86_64::add_relocation): New function.
4802         (Output_data_plt_x86_64::reserve_slot): New function.
4803         (Output_data_plt_x86_64::free_list_): New data member.
4804         (Target_x86_64::init_got_plt_for_update): New function.
4805         (Target_x86_64::register_global_plt_entry): New function.
4806         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4807         incremental updates.
4808         (Output_data_plt_x86_64::add_relocation): New function.
4809         * testsuite/object_unittest.cc (Object_test): Set default options.
4810
4811 2011-05-16  Ian Lance Taylor  <iant@google.com>
4812
4813         * options.h (class General_options): Make -i a synonym for -r.
4814
4815 2011-05-16  Ian Lance Taylor  <iant@google.com>
4816
4817         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4818
4819 2011-05-10 Cary Coutant  <ccoutant@google.com>
4820
4821         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4822         strip_all (-s).
4823
4824 2011-05-06  Ian Lance Taylor  <iant@google.com>
4825
4826         * layout.cc (Layout::layout): If the output section flags change,
4827         update the ordering.
4828
4829 2011-04-25 Cary Coutant  <ccoutant@google.com>
4830
4831         * incremental-dump.cc (dump_incremental_inputs): Print local
4832         symbol info for each input file.
4833         * incremental.cc
4834         (Output_section_incremental_inputs::set_final_data_size): Add local
4835         symbol info to input file entries in incremental info.
4836         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4837         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4838         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4839         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4840         implementation.
4841         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4842         (Sized_incr_relobj::do_relocate): Write the local symbols.
4843         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4844         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4845         Adjust size of input file header.
4846         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4847         (Incremental_inputs_reader::get_local_symbol_count): New function.
4848         (Incremental_inputs_reader::get_input_section): Adjust size of input
4849         file header.
4850         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4851         (Sized_incr_relobj::This): New typedef.
4852         (Sized_incr_relobj::sym_size): New const data member.
4853         (Sized_incr_relobj::Local_symbol): New struct.
4854         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4855         (Sized_incr_relobj::do_local_symbol_offset): New function.
4856         (Sized_incr_relobj::local_symbol_count_): New data member.
4857         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4858         (Sized_incr_relobj::local_symbol_index_): New data member.
4859         (Sized_incr_relobj::local_symbol_offset_): New data member.
4860         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4861         (Sized_incr_relobj::local_symbols_): New data member.
4862         * object.h (Relobj::output_local_symbol_count): New function.
4863         (Relobj::local_symbol_offset): New function.
4864         (Relobj::do_output_local_symbol_count): New function.
4865         (Relobj::do_local_symbol_offset): New function.
4866         (Sized_relobj::do_output_local_symbol_count): New function.
4867         (Sized_relobj::do_local_symbol_offset): New function.
4868
4869 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4870
4871         * descriptors.cc (set_close_on_exec): New function.
4872         (Descriptors::open): Use set_close_on_exec.
4873         * output.cc (S_ISLNK): Define if not defined.
4874
4875 2011-04-22 Cary Coutant  <ccoutant@google.com>
4876
4877         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4878         global symbol map.
4879         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4880         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4881         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4882         relocations.
4883         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4884         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4885         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4886         * incremental.h
4887         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4888         function.
4889         (Incremental_binary::apply_incremental_relocs): New function.
4890         (Incremental_binary::do_apply_incremental_relocs): New function.
4891         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4892         data member.
4893         (Sized_incremental_binary::add_global_symbol): New function.
4894         (Sized_incremental_binary::global_symbol): New function.
4895         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4896         (Sized_incremental_binary::symbol_map_): New data member.
4897         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4898         * target.h (Sized_target::apply_relocation): New function.
4899         * target-reloc.h (apply_relocation): New function.
4900         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4901
4902 2011-04-22  Doug Kwan  <dougkwan@google.com>
4903
4904         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4905         flag of a SHT_ARM_EXIDX section.
4906         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4907         * testsuite/Makefile.in: Regenerate.
4908         * testsuite/arm_exidx_test.s: New file.
4909         * testsuite/arm_exidx_test.sh: Same.
4910
4911 2011-04-20 Cary Coutant  <ccoutant@google.com>
4912
4913         PR gold/12689
4914         * archive.h (Incremental_archive_entry::Archive_member):
4915         Initialize arg_serial_ (second constructor).
4916
4917 2011-04-17  Ian Lance Taylor  <iant@google.com>
4918
4919         * object.cc (Relocate_info::location): Simplify location string.
4920         * errors.cc (Errors::error_at_location): Don't print program
4921         name.
4922         (Errors::warning_at_location): Likewise.
4923         (Errors::undefined_symbol): Likewise.
4924         * testsuite/debug_msg.sh: Update accordingly.
4925
4926 2011-04-14 Cary Coutant  <ccoutant@google.com>
4927
4928         * gold/layout.cc (Layout::symtab_section_offset): New function.
4929         * gold/layout.h (Layout::symtab_section_offset): New function.
4930         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4931
4932 2011-04-12  Ian Lance Taylor  <iant@google.com>
4933
4934         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4935         with MREMAP_MAYMOVE.
4936         * output.h (class Output_file): Add map_is_allocated_ field.
4937         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4938         not available, provide stubs.  If mremap is not available, #define
4939         it to gold_mremap.
4940         (MREMAP_MAYMOVE): Define if not defined.
4941         (Output_file::Output_file): Initialize map_is_allocated_.
4942         (Output_file::resize): Check map_is_allocated_.
4943         (Output_file::map_anonymous): If mmap fails, use malloc.
4944         (Output_file::unmap): Don't do anything for an anonymous map.
4945         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4946         is not available, provide stubs.
4947         (File_read::View::~View): Use free rather than delete[].
4948         (File_read::make_view): Use malloc rather than new[].  If mmap
4949         fails, use malloc.
4950         (File_read::find_or_make_view): Use malloc rather than new[].
4951         * gold.h: Remove HAVE_REMAP code.
4952         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4953         exists.  Rename mremap to gold_mremap.  If mmap is not available
4954         don't do anything.
4955         * configure, config.in: Rebuild.
4956
4957 2011-04-11  Ian Lance Taylor  <iant@google.com>
4958
4959         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4960         initialize local variable v.
4961
4962 2011-04-11  Cary Coutant  <ccoutant@google.com>
4963
4964         * archive.cc (Archive::include_member): Adjust call to
4965         report_object.
4966         (Add_archive_symbols::run): Track argument serial numbers.
4967         (Lib_group::include_member): Likewise.
4968         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4969         * archive.h (Incremental_archive_entry::Archive_member):
4970         Initialize arg_serial_.
4971         (Archive_member::arg_serial_): New data member.
4972         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4973         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4974         incremental link.
4975         (Sized_dynobj::do_for_all_local_got_entries): New function.
4976         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4977         function.
4978         * fileread.cc (get_mtime): New function.
4979         * fileread.h (get_mtime): New function.
4980         * gold.cc (queue_initial_tasks): Check for incremental update.
4981         (process_incremental_input): New function.
4982         (queue_middle_tasks): Don't force valid target for incremental
4983         update.
4984         * incremental-dump.cc (find_input_containing_global): Adjust
4985         size of symbol info entry.
4986         (dump_incremental_inputs): Dump argument serial number and
4987         in_system_directory flag; bias shndx by 1; print symbol names
4988         when dumping per-file symbol lists; use new symbol info readers.
4989         * incremental.cc
4990         (Output_section_incremental_inputs:update_data_size): New function.
4991         (Sized_incremental_binary::setup_readers): Setup input readers
4992         for each input file; build maps for files added from libraries
4993         and scripts.
4994         (Sized_incremental_binary::check_input_args): New function.
4995         (Sized_incremental_binary::do_check_inputs): Build map of argument
4996         serial numbers to input arguments.
4997         (Sized_incremental_binary::do_file_has_changed): Rename
4998         do_file_is_unchanged to this; compare file modification times.
4999         (Sized_incremental_binary::do_init_layout): New function.
5000         (Sized_incremental_binary::do_reserve_layout): New function.
5001         (Sized_incremental_binary::do_get_input_reader): Remove.
5002         (Sized_incremental_binary::get_symtab_view): New function.
5003         (Incremental_checker::can_incrementally_link_output_file): Remove.
5004         (Incremental_inputs::report_command_line): Exclude --debug options.
5005         (Incremental_inputs::report_archive_begin): Add parameter; track
5006         argument serial numbers; don't put input file entry for archive
5007         before archive members.
5008         (Incremental_inputs::report_archive_end): Put input file entry
5009         for archive after archive members.
5010         (Incremental_inputs::report_object): Add parameter; track argument
5011         serial numbers and in_system_directory flag.
5012         (Incremental_inputs::report_script): Add parameter; track argument
5013         serial numbers.
5014         (Output_section_incremental_inputs::set_final_data_size): Adjust
5015         size of symbol info entry; check for forwarding symbols.
5016         (Output_section_incremental_inputs::write_input_files): Write
5017         in_system_directory flag and argument serial number.
5018         (Output_section_incremental_inputs::write_info_blocks): Map section
5019         indices between incremental info and original input file; store
5020         input section index for each symbol.
5021         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5022         change operator() to visit().
5023         (class Global_got_offset_visitor): Likewise.
5024         (class Global_symbol_visitor_got_plt):
5025         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5026         classes.
5027         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5028         (Sized_incr_relobj::do_read_symbols): New function.
5029         (Sized_incr_relobj::do_layout): New function.
5030         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5031         (Sized_incr_relobj::do_add_symbols): New function.
5032         (Sized_incr_relobj::do_should_include_member): New function.
5033         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5034         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5035         (Sized_incr_relobj::do_section_size): New function.
5036         (Sized_incr_relobj::do_section_name): New function.
5037         (Sized_incr_relobj::do_section_contents): New function.
5038         (Sized_incr_relobj::do_section_flags): New function.
5039         (Sized_incr_relobj::do_section_entsize): New function.
5040         (Sized_incr_relobj::do_section_address): New function.
5041         (Sized_incr_relobj::do_section_type): New function.
5042         (Sized_incr_relobj::do_section_link): New function.
5043         (Sized_incr_relobj::do_section_info): New function.
5044         (Sized_incr_relobj::do_section_addralign): New function.
5045         (Sized_incr_relobj::do_initialize_xindex): New function.
5046         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5047         (Sized_incr_relobj::do_read_relocs): New function.
5048         (Sized_incr_relobj::do_gc_process_relocs): New function.
5049         (Sized_incr_relobj::do_scan_relocs): New function.
5050         (Sized_incr_relobj::do_count_local_symbols): New function.
5051         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5052         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5053         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5054         (Sized_incr_relobj::do_relocate): New function.
5055         (Sized_incr_relobj::do_set_section_offset): New function.
5056         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5057         (Sized_incr_dynobj::do_read_symbols): New function.
5058         (Sized_incr_dynobj::do_layout): New function.
5059         (Sized_incr_dynobj::do_add_symbols): New function.
5060         (Sized_incr_dynobj::do_should_include_member): New function.
5061         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5062         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5063         (Sized_incr_dynobj::do_section_size): New function.
5064         (Sized_incr_dynobj::do_section_name): New function.
5065         (Sized_incr_dynobj::do_section_contents): New function.
5066         (Sized_incr_dynobj::do_section_flags): New function.
5067         (Sized_incr_dynobj::do_section_entsize): New function.
5068         (Sized_incr_dynobj::do_section_address): New function.
5069         (Sized_incr_dynobj::do_section_type): New function.
5070         (Sized_incr_dynobj::do_section_link): New function.
5071         (Sized_incr_dynobj::do_section_info): New function.
5072         (Sized_incr_dynobj::do_section_addralign): New function.
5073         (Sized_incr_dynobj::do_initialize_xindex): New function.
5074         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5075         (make_sized_incremental_object): New function.
5076         (Incremental_library::copy_unused_symbols): New function.
5077         (Incremental_library::do_for_all_unused_symbols): New function.
5078         * incremental.h (enum Incremental_input_flags): New type.
5079         (class Incremental_checker): Remove.
5080         (Incremental_input_entry::Incremental_input_entry): Add argument
5081         serial number.
5082         (Incremental_input_entry::arg_serial): New function.
5083         (Incremental_input_entry::set_is_in_system_directory): New function.
5084         (Incremental_input_entry::is_in_system_directory): New function.
5085         (Incremental_input_entry::arg_serial_): New data member.
5086         (Incremental_input_entry::is_in_system_directory_): New data member.
5087         (class Script_info): Move here from script.h.
5088         (Script_info::Script_info): Add filename parameter.
5089         (Script_info::filename): New function.
5090         (Script_info::filename_): New data member.
5091         (Incremental_script_entry::Incremental_script_entry): Add argument
5092         serial number.
5093         (Incremental_object_entry::Incremental_object_entry): Likewise.
5094         (Incremental_object_entry::add_input_section): Build list of input
5095         sections with map to original shndx.
5096         (Incremental_object_entry::get_input_section_index): New function.
5097         (Incremental_object_entry::shndx_): New data member.
5098         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5099         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5100         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5101         serial number.
5102         (Incremental_inputs::report_archive_begin): Likewise.
5103         (Incremental_inputs::report_object): Likewise.
5104         (Incremental_inputs::report_script): Likewise.
5105         (class Incremental_global_symbol_reader): New class.
5106         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5107         and store flags and input file type.
5108         (Incremental_input_entry_reader::arg_serial): New function.
5109         (Incremental_input_entry_reader::type): Extract type from flags.
5110         (Incremental_input_entry_reader::is_in_system_directory): New function.
5111         (Incremental_input_entry_reader::get_input_section_count): Call
5112         accessor function for type.
5113         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5114         function for type; adjust size of global symbol entry.
5115         (Incremental_input_entry_reader::get_global_symbol_count): Call
5116         accessor function for type.
5117         (Incremental_input_entry_reader::get_object_count): Likewise.
5118         (Incremental_input_entry_reader::get_object_offset): Likewise.
5119         (Incremental_input_entry_reader::get_member_count): Likewise.
5120         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5121         (Incremental_input_entry_reader::get_member_offset): Likewise.
5122         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5123         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5124         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5125         (Incremental_input_entry_reader::get_global_symbol_reader): New
5126         function.
5127         (Incremental_input_entry_reader::get_output_symbol_index): New
5128         function.
5129         (Incremental_input_entry_reader::type_): Remove.
5130         (Incremental_input_entry_reader::flags_): New data member.
5131         (Incremental_inputs_reader::input_file_offset): New function.
5132         (Incremental_inputs_reader::input_file_index): New function.
5133         (Incremental_inputs_reader::input_file): Call input_file_offset.
5134         (Incremental_inputs_reader::input_file_at_offset): New function.
5135         (Incremental_relocs_reader::get_r_type): Reformat.
5136         (Incremental_relocs_reader::get_r_shndx): Reformat.
5137         (Incremental_relocs_reader::get_r_offset): Reformat.
5138         (Incremental_relocs_reader::data): New function.
5139         (Incremental_binary::Incremental_binary): Initialize new data members.
5140         (Incremental_binary::check_inputs): Add cmdline parameter.
5141         (Incremental_binary::file_is_unchanged): Remove.
5142         (Input_reader::arg_serial): New function.
5143         (Input_reader::get_unused_symbol_count): New function.
5144         (Input_reader::get_unused_symbol): New function.
5145         (Input_reader::do_arg_serial): New function.
5146         (Input_reader::do_get_unused_symbol_count): New function.
5147         (Input_reader::do_get_unused_symbol): New function.
5148         (Incremental_binary::input_file_count): New function.
5149         (Incremental_binary::get_input_reader): Change signature to use
5150         index instead of filename.
5151         (Incremental_binary::file_has_changed): New function.
5152         (Incremental_binary::get_input_argument): New function.
5153         (Incremental_binary::get_library): New function.
5154         (Incremental_binary::get_script_info): New function.
5155         (Incremental_binary::init_layout): New function.
5156         (Incremental_binary::reserve_layout): New function.
5157         (Incremental_binary::output_file): New function.
5158         (Incremental_binary::do_check_inputs): New function.
5159         (Incremental_binary::do_file_is_unchanged): Remove.
5160         (Incremental_binary::do_file_has_changed): New function.
5161         (Incremental_binary::do_init_layout): New function.
5162         (Incremental_binary::do_reserve_layout): New function.
5163         (Incremental_binary::do_input_file_count): New function.
5164         (Incremental_binary::do_get_input_reader): Change signature.
5165         (Incremental_binary::input_args_map_): New data member.
5166         (Incremental_binary::library_map_): New data member.
5167         (Incremental_binary::script_map_): New data member.
5168         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5169         new data members.
5170         (Sized_incremental_binary::output_section): New function.
5171         (Sized_incremental_binary::inputs_reader): Add const.
5172         (Sized_incremental_binary::symtab_reader): Add const.
5173         (Sized_incremental_binary::relocs_reader): Add const.
5174         (Sized_incremental_binary::got_plt_reader): Add const.
5175         (Sized_incremental_binary::get_symtab_view): New function.
5176         (Sized_incremental_binary::Inputs_reader): New typedef.
5177         (Sized_incremental_binary::Input_entry_reader): New typedef.
5178         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5179         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5180         (Sized_incremental_binary::do_file_has_changed): New function.
5181         (Sized_incremental_binary::do_init_layout): New function.
5182         (Sized_incremental_binary::do_reserve_layout): New function.
5183         (Sized_input_reader::Inputs_reader): Remove.
5184         (Sized_input_reader::Input_entry_reader): Remove.
5185         (Sized_input_reader::do_arg_serial): New function.
5186         (Sized_input_reader::do_get_unused_symbol_count): New function.
5187         (Sized_input_reader::do_get_unused_symbol): New function.
5188         (Sized_incremental_binary::do_input_file_count): New function.
5189         (Sized_incremental_binary::do_get_input_reader): Change signature;
5190         use index instead of filename.
5191         (Sized_incremental_binary::section_map_): New data member.
5192         (Sized_incremental_binary::input_entry_readers_): New data member.
5193         (class Sized_incr_relobj): New class.
5194         (class Sized_incr_dynobj): New class.
5195         (make_sized_incremental_object): New function.
5196         (class Incremental_library): New class.
5197         * layout.cc (Free_list::num_lists): New static data member.
5198         (Free_list::num_nodes): New static data member.
5199         (Free_list::num_removes): New static data member.
5200         (Free_list::num_remove_visits): New static data member.
5201         (Free_list::num_allocates): New static data member.
5202         (Free_list::num_allocate_visits): New static data member.
5203         (Free_list::init): New function.
5204         (Free_list::remove): New function.
5205         (Free_list::allocate): New function.
5206         (Free_list::dump): New function.
5207         (Free_list::print_stats): New function.
5208         (Layout_task_runner::run): Resize output file for incremental updates.
5209         (Layout::Layout): Initialize new data members.
5210         (Layout::set_incremental_base): New function.
5211         (Layout::init_fixed_output_section): New function.
5212         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5213         incremental updates.
5214         (Layout::create_gold_note): Do not create gold note section for
5215         incremental updates.
5216         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5217         for incremental updates.
5218         (Layout::set_section_offsets): For incremental updates, allocate space
5219         from free list.
5220         (Layout::create_symtab_sections): Layout with offsets relative to
5221         start of section; for incremental updates, allocate space from free
5222         list.
5223         (Layout::create_shdrs): For incremental updates, allocate space from
5224         free list.
5225         (Layout::finish_dynamic_section): For incremental updates, do not
5226         check --as-needed (fixed in subsequent patch).
5227         * layout.h (class Free_list): New class.
5228         (Layout::set_incremental_base): New function.
5229         (Layout::incremental_base): New function.
5230         (Layout::init_fixed_output_section): New function.
5231         (Layout::allocate): New function.
5232         (Layout::incremental_base_): New data member.
5233         (Layout::free_list_): New data member.
5234         * main.cc (main): Print Free_list statistics.
5235         * object.cc (Relobj::finalize_incremental_relocs): Add
5236         clear_counts parameter; clear counts only when clear_counts is set.
5237         (Sized_relobj::Sized_relobj): Initialize new base class.
5238         (Sized_relobj::do_layout): Don't report special sections.
5239         (Sized_relobj::do_for_all_local_got_entries): New function.
5240         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5241         symtab_off to all symbol table offsets.
5242         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5243         * object.h (class Got_offset_list): Move to top of file.
5244         (Object::Object): Allow case where input_file == NULL.
5245         (Object::~Object): Likewise.
5246         (Object::input_file): Assert that input_file != NULL.
5247         (Object::lock): Allow case where input_file == NULL.
5248         (Object::unlock): Likewise.
5249         (Object::is_locked): Likewise.
5250         (Object::token): Likewise.
5251         (Object::release): Likewise.
5252         (Object::is_incremental): New function.
5253         (Object::get_mtime): New function.
5254         (Object::for_all_local_got_entries): New function.
5255         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5256         (Object::set_is_in_system_directory): New function.
5257         (Object::is_in_system_directory): New function.
5258         (Object::do_is_incremental): New function.
5259         (Object::do_get_mtime): New function.
5260         (Object::do_for_all_local_got_entries): New function.
5261         (Object::is_in_system_directory_): New data member.
5262         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5263         (class Sized_relobj_base): New class.
5264         (class Sized_relobj): Derive from Sized_relobj_base.
5265         (class Sized_relobj::Symbols): Redeclare from base class.
5266         (class Sized_relobj::local_got_offset_list): Remove.
5267         (class Sized_relobj::Output_sections): Redeclare from base class.
5268         (class Sized_relobj::do_for_all_local_got_entries): New function.
5269         (class Sized_relobj::write_local_symbols): Add offset parameter.
5270         (class Sized_relobj::local_symbol_offset_): Update comment.
5271         (class Sized_relobj::local_dynsym_offset_): Update comment.
5272         * options.cc (Input_arguments::add_file): Remove const.
5273         * options.h (Input_file_argument::Input_file_argument):
5274         Initialize arg_serial_ (all constructors).
5275         (Input_file_argument::set_arg_serial): New function.
5276         (Input_file_argument::arg_serial): New function.
5277         (Input_file_argument::arg_serial_): New data member.
5278         (Input_arguments::Input_arguments): Initialize file_count_.
5279         (Input_arguments::add_file): Remove const.
5280         (Input_arguments::number_of_input_files): New function.
5281         (Input_arguments::file_count_): New data member.
5282         (Command_line::number_of_input_files): Call
5283         Input_arguments::number_of_input_files.
5284         * output.cc (Output_segment_headers::Output_segment_headers):
5285         Set current size.
5286         (Output_section::Input_section::current_data_size): New function.
5287         (Output_section::Output_section): Initialize new data members.
5288         (Output_section::add_input_section): Don't do merge sections for
5289         an incremental link; allocate space from free list for an
5290         incremental update.
5291         (Output_section::add_output_section_data): Allocate space from
5292         free list for an incremental update.
5293         (Output_section::update_data_size): New function.
5294         (Output_section::set_fixed_layout): New function.
5295         (Output_section::reserve): New function.
5296         (Output_segment::set_section_addresses): Remove const.
5297         (Output_segment::set_section_list_addresses): Remove const; allocate
5298         space from free list for an incremental update.
5299         (Output_segment::set_offset): Adjust size of RELRO segment for an
5300         incremental update.
5301         * output.h (Output_data::current_data_size): Move here from
5302         child classes.
5303         (Output_data::pre_finalize_data_size): New function.
5304         (Output_data::update_data_size): New function.
5305         (Output_section_headers::update_data_size): new function.
5306         (Output_section_data_build::current_data_size): Move to Output_data.
5307         (Output_data_strtab::update_data_size): New function.
5308         (Output_section::current_data_size): Move to Output_data.
5309         (Output_section::set_fixed_layout): New function.
5310         (Output_section::has_fixed_layout): New function.
5311         (Output_section::reserve): New function.
5312         (Output_section::update_data_size): New function.
5313         (Output_section::has_fixed_layout_): New data member.
5314         (Output_section::free_list_): New data member.
5315         (Output_segment::set_section_addresses): Remove const.
5316         (Output_segment::set_section_list_addresses): Remove const.
5317         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5318         New function.
5319         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5320         New function.
5321         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5322         parameter when calling Add_symbols constructor; store argument
5323         serial number for members of a lib group.
5324         (Add_symbols::locks): Allow case where token == NULL.
5325         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5326         (Read_member::~Read_member): New function.
5327         (Read_member::is_runnable): New function.
5328         (Read_member::locks): New function.
5329         (Read_member::run): New function.
5330         (Check_script::~Check_script): New function.
5331         (Check_script::is_runnable): New function.
5332         (Check_script::locks): New function.
5333         (Check_script::run): New function.
5334         (Check_library::~Check_library): New function.
5335         (Check_library::is_runnable): New function.
5336         (Check_library::locks): New function.
5337         (Check_library::run): New function.
5338         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5339         (Add_symbols::library_): New data member.
5340         (class Read_member): New class.
5341         (class Check_script): New class.
5342         (class Check_library): New class.
5343         * reloc.cc (Read_relocs::is_runnable): Allow case where
5344         token == NULL.
5345         (Read_relocs::locks): Likewise.
5346         (Scan_relocs::locks): Likewise.
5347         (Relocate_task::locks): Likewise.
5348         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5349         to clear counters.
5350         (Sized_relobj::incremental_relocs_scan): Fix comment.
5351         (Sized_relobj::do_relocate): Pass output file offset to
5352         write_local_symbols.
5353         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5354         from class declaration.
5355         * script.cc (read_input_script): Allocate Script_info; pass
5356         argument serial number to report_script.
5357         * script.h (class Script_info): Move to incremental.h.
5358         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5359         * symtab.h (Symbol_table::add_from_incrobj): New function.
5360         (Symbol_table::set_file_offset): New function.
5361
5362 2011-04-05  Cary Coutant  <ccoutant@google.com>
5363
5364         * incremental-dump.cc (dump_incremental_inputs): Change signature
5365         to take a Sized_incremental_binary; change caller.  Use readers
5366         in Sized_incremental_binary.
5367         * incremental.cc
5368         (Sized_incremental_binary::find_incremental_inputs_sections):
5369         Rename do_find_incremental_inputs_sections to this.
5370         (Sized_incremental_binary::setup_readers): New function.
5371         (Sized_incremental_binary::do_check_inputs): Check
5372         has_incremental_info_ flag; move setup code to setup_readers;
5373         use input readers.
5374         (Sized_incremental_binary::do_file_is_unchanged): New function.
5375         (Sized_incremental_binary::do_get_input_reader): New function.
5376         * incremental.h (class Incremental_binary): Move to end of file.
5377         (Incremental_binary::file_is_unchanged): New function.
5378         (Incremental_binary::do_file_is_unchanged): New function.
5379         (Incremental_binary::Input_reader): New class.
5380         (Incremental_binary::get_input_reader): New function.
5381         (class Sized_incremental_binary): Move to end of file.
5382         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5383         input section reader classes.
5384         (Sized_incremental_binary::has_incremental_info): New function.
5385         (Sized_incremental_binary::inputs_reader): New function.
5386         (Sized_incremental_binary::symtab_reader): New function.
5387         (Sized_incremental_binary::relocs_reader): New function.
5388         (Sized_incremental_binary::got_plt_reader): New function.
5389         (Sized_incremental_binary::do_file_is_unchanged): New function.
5390         (Sized_incremental_binary::Sized_input_reader): New class.
5391         (Sized_incremental_binary::get_input_reader): New function.
5392         (Sized_incremental_binary::find_incremental_inputs_sections):
5393         Rename do_find_incremental_inputs_sections to this.
5394         (Sized_incremental_binary::setup_readers): New function.
5395         (Sized_incremental_binary::has_incremental_info_): New data member.
5396         (Sized_incremental_binary::inputs_reader_): New data member.
5397         (Sized_incremental_binary::symtab_reader_): New data member.
5398         (Sized_incremental_binary::relocs_reader_): New data member.
5399         (Sized_incremental_binary::got_plt_reader_): New data member.
5400         (Sized_incremental_binary::current_input_file_): New data member.
5401
5402 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5403
5404         PR gold/12640
5405         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5406         violation.
5407
5408 2011-03-30  Cary Coutant  <ccoutant@google.com>
5409
5410         * archive.cc (Archive::include_member): Adjust call to report_object.
5411         (Add_archive_symbols::run): Add script_info to call to
5412         report_archive_begin.
5413         (Lib_group::include_member): Adjust call to report_object.
5414         (Add_lib_group_symbols::run): Adjust call to report_object.
5415         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5416         blocks.  Add object count for script input files.
5417         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5418         script_info parameter; change all callers.
5419         (Incremental_inputs::report_object): Add script_info parameter;
5420         change all callers.
5421         (Incremental_inputs::report_script): Store backpointer to
5422         incremental info entry.
5423         (Output_section_incremental_inputs::set_final_data_size): Record
5424         additional information for scripts.
5425         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5426         * incremental.h (Incremental_script_entry::add_object): New function.
5427         (Incremental_script_entry::get_object_count): New function.
5428         (Incremental_script_entry::get_object): New function.
5429         (Incremental_script_entry::objects_): New data member; adjust
5430         constructor.
5431         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5432         (Incremental_inputs::report_object): Add script_info parameter.
5433         (Incremental_inputs_reader::get_object_count): New function.
5434         (Incremental_inputs_reader::get_object_offset): New function.
5435         * options.cc (Input_arguments::add_file): Return reference to
5436         new input argument.
5437         * options.h (Input_argument::set_script_info): New function.
5438         (Input_argument::script_info): New function.
5439         (Input_argument::script_info_): New data member; adjust all
5440         constructors.
5441         (Input_file_group::add_file): Return reference to new input argument.
5442         (Input_file_lib::add_file): Likewise.
5443         (Input_arguments::add_file): Likewise.
5444         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5445         * script.cc (Parser_closure::Parser_closure): Add script_info
5446         parameter; adjust all callers.
5447         (Parser_closure::script_info): New function.
5448         (Parser_closure::script_info_): New data member.
5449         (read_input_script): Report scripts earlier to incremental info.
5450         (script_add_file): Set script_info in Input_argument.
5451         (script_add_library): Likewise.
5452         * script.h (Script_options::Script_info): Rewrite class.
5453
5454 2011-03-29  Cary Coutant  <ccoutant@google.com>
5455
5456         * archive.cc (Library_base::should_include_member): Move
5457         method here from class Archive.
5458         (Archive::Archive): Initialize base class.
5459         (Archive::should_include_member): Move to base class.
5460         (Archive::do_for_all_unused_symbols): New function.
5461         (Add_archive_symbols::run): Remove redundant access to
5462         incremental_inputs.
5463         (Lib_group::Lib_group): Initialize base class.
5464         (Lib_group::do_filename): New function.
5465         (Lib_group::include_member): Pass pointer to Lib_group to
5466         report_object.
5467         (Lib_group::do_for_all_unused_symbols): New function.
5468         (Add_lib_group_symbols::run): Report archive information for
5469         incremental links.
5470         * archive.h (class Library_base): New base class.
5471         (class Archive): Derive from Library_base.
5472         (Archive::filename): Move to base class.
5473         (Archive::set_incremental_info): Likewise.
5474         (Archive::incremental_info): Likewise.
5475         (Archive::Should_include): Likewise.
5476         (Archive::should_include_member): Likewise.
5477         (Archive::Armap_entry): Remove.
5478         (Archive::Unused_symbol_iterator): Remove.
5479         (Archive::unused_symbols_begin): Remove.
5480         (Archive::unused_symbols_end): Remove.
5481         (Archive::do_filename): New function.
5482         (Archive::do_get_mtime): New function.
5483         (Archive::do_for_all_unused_symbols): New function.
5484         (Archive::task_): Move to base class.
5485         (Archive::incremental_info_): Likewise.
5486         (class Lib_group): Derive from Library_base.
5487         (Lib_group::do_filename): New function.
5488         (Lib_group::do_get_mtime): New function.
5489         (Lib_group::do_for_all_unused_symbols): New function.
5490         (Lib_group::task_): Move to base class.
5491         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5492         function.
5493         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5494         function.
5495         * incremental.cc (Incremental_inputs::report_archive_begin):
5496         Use Library_base; call library's get_mtime; add incremental inputs
5497         entry before members.
5498         (class Unused_symbol_visitor): New class.
5499         (Incremental_inputs::report_archive_end): Use Library_base; use
5500         visitor class to record unused symbols; don't add incremental inputs
5501         entry after members.
5502         (Incremental_inputs::report_object): Use Library_base.
5503         * incremental.h
5504         (Incremental_archive_entry::Incremental_archive_entry): Remove
5505         unused Archive parameter.
5506         (Incremental_inputs::report_archive_begin): Use Library_base.
5507         (Incremental_inputs::report_archive_end): Likewise.
5508         (Incremental_inputs::report_object): Likewise.
5509         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5510         function.
5511         * object.h (Object::for_all_global_symbols): New function.
5512         (Object::do_for_all_global_symbols): New function.
5513         (Sized_relobj::do_for_all_global_symbols): New function.
5514         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5515         function.
5516         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5517         function.
5518
5519 2011-03-27  Ian Lance Taylor  <iant@google.com>
5520
5521         * archive.cc (Archive::interpret_header): Return -1 if something
5522         goes wrong.  Change callers accordingly.
5523
5524 2011-03-25  Cary Coutant  <ccoutant@google.com>
5525
5526         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5527         * testsuite/Makefile.in: Regenerate.
5528
5529 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5530
5531         * plugin.cc (get_view): New.
5532         (Plugin::load): Pass get_view to the plugin.
5533         (Plugin_manager::get_view): New.
5534
5535 2011-03-21  Ian Lance Taylor  <iant@google.com>
5536
5537         * testsuite/final_layout.sh: Rewrite to not use dc.
5538         * testsuite/relro_test.sh: Fail if dc is not present.
5539
5540 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5541
5542         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5543         Change == to -eq.
5544         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5545         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5546         Change == to -eq.
5547         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5548         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5549
5550 2011-03-14  Ian Lance Taylor  <iant@google.com>
5551
5552         * script-sections.cc (Sort_output_sections::script_compare):
5553         Rename from is_before, change return type.
5554         (Sort_output_sections::operator()): Adjust accordingly.
5555
5556 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5557
5558         PR gold/12572
5559         * testsuite/odr_violation2.cc: Add comment to make all error line
5560         numbers double digits.
5561         * testsuite/debug_msg.sh: Adjust expected errors.
5562
5563 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5564
5565         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5566         but mark earlier ones as non-canonical
5567         (offset_to_iterator): Update search target and example
5568         (do_addr2line): Return extra lines in a vector*
5569         (format_file_lineno): Extract from do_addr2line
5570         (one_addr2line): Add vector* out-param
5571         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5572         when a lineno entry appeared last for its instruction
5573         (Dwarf_line_info): Add vector* out-param
5574         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5575         * symtab.cc (Odr_violation_compare): Include the lineno in the
5576         comparison again.
5577         (linenos_from_loc): New. Combine the canonical line for an
5578         address with its other lines.
5579         (True_if_intersect): New. Helper functor to make
5580         std::set_intersection a query.
5581         (detect_odr_violations): Compare sets of lines instead of just
5582         one line for each function. This became less deterministic, but
5583         has fewer false positives.
5584         * symtab.h: Declarations.
5585         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5586         mix an optimized and non-optimized object in the same binary
5587         (odr_violation2.so): Same.
5588         * testsuite/Makefile.in: Regenerate from Makefile.am.
5589         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5590         * testsuite/debug_msg.sh: Update line numbers and add
5591         assertions.
5592         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5593         non-optimized context.
5594         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5595         isn't inlined, and use OdrDerived in an optimized context.
5596         * testsuite/odr_header1.h: Defines OdrDerived, where
5597         optimization will change the
5598         first-instruction-in-the-destructor's file and line number.
5599         * testsuite/odr_header2.h: Defines OdrBase.
5600
5601 2011-03-09  Ian Lance Taylor  <iant@google.com>
5602
5603         * fileread.cc (File_read::clear_views): Don't delete the whole
5604         file view.
5605
5606 2011-03-08  Ian Lance Taylor  <iant@google.com>
5607
5608         PR gold/12525
5609         * fileread.cc: #include <climits>.
5610         (GOLD_IOV_MAX): Define.
5611         (File_read::read_multiple): Limit number of entries by iov_max.
5612         * fileread.h (class File_read): Always set max_readv_entries to
5613         128.
5614
5615 2011-03-07  Ian Lance Taylor  <iant@google.com>
5616
5617         PR gold/12525
5618         * options.h (class General_options): Add -dy and -dn.
5619
5620 2011-03-02  Cary Coutant  <ccoutant@google.com>
5621
5622         * testsuite/script_test_9.t: Add TLS segment.
5623
5624 2011-03-02  Simon Baldwin  <simonb@google.com>
5625
5626         * configure.ac: Add check for gnu_indirect_function support in
5627         the toolchain building binutils.
5628         * configure: Rebuild.
5629
5630 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5631
5632         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5633         plugin only symbols.
5634         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5635         in plugin files as not needed in the symbol table.
5636
5637 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5638
5639         * output.cc (Output_section::add_input_section): Delay fill
5640         generation for section ordering.
5641
5642 2011-02-09  Ian Lance Taylor  <iant@google.com>
5643
5644         PR gold/12316
5645         * object.h (class Sized_relobj): Remove clear_local_symbols.
5646         * reloc.cc (Sized_relobj::do_relocate): Don't call
5647         clear_local_symbols.
5648
5649 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5650
5651         * plugin.cc (is_visible_from_outside): Return true for symbols
5652         in the -u option.
5653
5654 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5655
5656         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5657         filename.
5658
5659 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5660
5661         * icf.h (is_section_foldable_candidate): Change type of parameter
5662         to std::string.
5663         * icf.cc (Icf::find_identical_sections): Change type of local variable
5664         section_name to be std::string.
5665         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5666
5667 2011-01-25  Ian Lance Taylor  <iant@google.com>
5668
5669         * script.cc (script_add_extern): Rewrite to use
5670         add_symbol_reference.
5671
5672 2011-01-25  Doug Kwan  <dougkwan@google.com>
5673
5674         * icf.cc (get_section_contents): Always lock section's object.
5675
5676 2011-01-24  Ian Lance Taylor  <iant@google.com>
5677
5678         * options.h (class General_options): Accept
5679         --no-detect-odr-violations.
5680
5681 2011-01-24  Ian Lance Taylor  <iant@google.com>
5682
5683         * version.cc (version_string): Bump to 1.11.
5684
5685 2011-01-24  Ian Lance Taylor  <iant@google.com>
5686
5687         * plugin.cc (class Plugin_rescan): Define new class.
5688         (Plugin_manager::claim_file): Set any_claimed_.
5689         (Plugin_manager::save_archive): New function.
5690         (Plugin_manager::save_input_group): New function.
5691         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5692         necessary.
5693         (Plugin_manager::new_undefined_symbol): New function.
5694         (Plugin_manager::rescan): New function.
5695         (Plugin_manager::rescannable_defines): New function.
5696         (Plugin_manager::add_input_file): Set any_added_.
5697         * plugin.h (class Plugin_manager): define new fields rescannable_,
5698         undefined_symbols_, any_claimed_, and any_added_.  Declare
5699         Plugin_rescan as friend.  Declare new functions.
5700         (Plugin_manager::Rescannable): Define type.
5701         (Plugin_manager::Rescannable_list): Define type.
5702         (Plugin_manager::Undefined_symbol_list): Define type.
5703         (Plugin_manager::Plugin_manager): Initialize new fields.
5704         * archive.cc (Archive::defines_symbol): New function.
5705         (Add_archive_symbols::run): Pass archive to plugins if any.
5706         * archive.h (class Archive): Declare defines_symbol.
5707         * readsyms.cc (Input_group::~Input_group): New function.
5708         (Finish_group::run): Pass input_group to plugins if any.
5709         * readsyms.h (class Input_group): Declare destructor.
5710         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5711         any.
5712
5713 2011-01-10  Ian Lance Taylor  <iant@google.com>
5714
5715         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5716         section as relro.
5717         (Layout::set_segment_offsets): Reset increase_relro before calling
5718         set_section_addresses a second time.
5719
5720 2011-01-04  Cary Coutant  <ccoutant@google.com>
5721
5722         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5723         sections before NOBITS sections.
5724
5725 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5726
5727         * version.cc (print_version): Update copyright to 2011.
5728
5729 2010-12-23  Cary Coutant  <ccoutant@google.com>
5730
5731         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5732         of OS to this->add.  Add OD parameter to second form of the function.
5733
5734 2010-12-20  Ian Lance Taylor  <iant@google.com>
5735
5736         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5737         second of two consecutive entries with same offset.
5738
5739 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5740
5741         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5742         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5743         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5744         to avoid unneeded links against $(LDADD).
5745         * testsuite/Makefile.in: Regenerate.
5746
5747 2010-12-15  Ian Lance Taylor  <iant@google.com>
5748
5749         PR gold/12324
5750         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5751         for R_X86_64_32 and R_X86_64_PC32.
5752         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5753         ver_matching_def_pic.o.
5754         (ver_matching_def_pic.o): New target.
5755
5756 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5757
5758         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5759         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5760         Move definition before File_read::View member definitions.
5761         (File_read::View::~View): Initialize and hold lock before
5762         updating current_mapped_bytes.
5763
5764 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5765
5766         * dwarf_reader.cc: Remove outdated comment.
5767         * gold-threads.cc: Fix typo in error message.
5768         * archive.cc: Fix typos in comments.
5769         * archive.h: Likewise.
5770         * arm-reloc-property.cc: Likewise.
5771         * arm-reloc-property.h: Likewise.
5772         * arm-reloc.def: Likewise.
5773         * arm.cc: Likewise.
5774         * attributes.h: Likewise.
5775         * cref.cc: Likewise.
5776         * ehframe.cc: Likewise.
5777         * fileread.h: Likewise.
5778         * gold.h: Likewise.
5779         * i386.cc: Likewise.
5780         * icf.cc: Likewise.
5781         * incremental.h: Likewise.
5782         * int_encoding.cc: Likewise.
5783         * layout.h: Likewise.
5784         * main.cc: Likewise.
5785         * merge.h: Likewise.
5786         * object.cc: Likewise.
5787         * object.h: Likewise.
5788         * options.cc: Likewise.
5789         * readsyms.cc: Likewise.
5790         * reduced_debug_output.cc: Likewise.
5791         * reloc.cc: Likewise.
5792         * script-sections.cc: Likewise.
5793         * sparc.cc: Likewise.
5794         * symtab.h: Likewise.
5795         * target-reloc.h: Likewise.
5796         * target.cc: Likewise.
5797         * target.h: Likewise.
5798         * timer.cc: Likewise.
5799         * timer.h: Likewise.
5800         * x86_64.cc: Likewise.
5801
5802 2010-12-09  Cary Coutant  <ccoutant@google.com>
5803
5804         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5805         stack.
5806         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5807         parameter; change all callers.
5808         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5809         * options.h (warn_execstack): New option.
5810
5811 2010-12-07  Doug Kwan  <dougkwan@google.com>
5812
5813         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5814         like function call relocations.
5815
5816 2010-12-07  Ian Lance Taylor  <iant@google.com>
5817
5818         * archive.cc (Archive::get_elf_object_for_member): Permit
5819         punconfigured to be NULL.
5820         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5821         (Archive::include_member): Pass NULL to get_elf_object_for_member
5822         if we searched for the archive and this is the first included
5823         object.
5824
5825 2010-12-01  Ian Lance Taylor  <iant@google.com>
5826
5827         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5828         track_relocs_type_ field.
5829         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5830         Set track_relocs_type_.
5831         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5832         contents when using RELA relocs.
5833         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5834         reloc_map_.
5835         * reloc.cc (Track_relocs::next_addend): New function.
5836         * reloc.h (class Track_relocs): Declare next_addend.
5837
5838 2010-12-01  Ian Lance Taylor  <iant@google.com>
5839
5840         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5841         virtual destructor.
5842
5843 2010-12-01  Ian Lance Taylor  <iant@google.com>
5844
5845         * README: Update compilers known to work and fail.
5846
5847 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5848
5849         * configure.in: For --enable-gold, handle value `default' instead of
5850         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5851         not the default.
5852         * configure: Regenerate.
5853
5854 2010-11-18  Doug Kwan  <dougkwan@google.com>
5855
5856         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5857         and right_alignment to be zero.  Store result alignment only if it is
5858         greater than existing alignment.
5859
5860 2010-11-16  Cary Coutant  <ccoutant@google.com>
5861
5862         PR gold/12220
5863         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5864         Check for ".zdebug_line".
5865
5866 2010-11-16  Doug Kwan  <dougkwan@google.com>
5867             Cary Coutant  <ccoutant@google.com>
5868
5869         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5870         by reference; adjust all callers.
5871         * output.cc (Output_segment::set_section_addresses): Adjust references
5872         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5873         list is empty.
5874         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5875         end at page boundary.
5876
5877 2010-11-16  Cary Coutant  <ccoutant@google.com>
5878
5879         PR gold/12220
5880         * layout.cc (Layout::choose_output_section): Transform names of
5881         compressed sections even when using a script with a SECTIONS clause.
5882         (Layout::output_section_name): Remove code to transform
5883         compressed debug section names.
5884         * output.cc (Output_section::add_input_section): Use uncompressed
5885         section size when tracking input sections.
5886
5887 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5888
5889         * symtab.h (Symbol::NON_PIC_REF): Remove.
5890         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5891         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5892         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5893         (Symbol::use_plt_offset): Take a flags argument and pass it
5894         directly to needs_dynamic_reloc.  Restrict check for undefined
5895         weak symbols to function calls.
5896         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5897         (Target_arm::Scan::global): Use it.
5898         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5899         (Target_arm::Relocate::relocate): Likewise.
5900         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5901         parameter with an r_type parameter.  Use get_reference_flags
5902         to get the flags.
5903         (Target_arm::Relocate::relocate): Update accordingly.
5904         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5905         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5906         (Target_i386::Scan::global): Likewise.
5907         (Target_i386::Relocate::relocate): Likewise.
5908         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5909         parameter with an r_type parameter.  Use get_reference_flags
5910         to get the flags.
5911         (Target_i386::Relocate::relocate): Update accordingly.
5912         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5913         (Target_powerpc::Scan::global): Use it.
5914         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5915         (Target_powerpc::Relocate::relocate): Likewise.
5916         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5917         (Target_sparc::Scan::global): Use it.
5918         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5919         (Target_sparc::Relocate::relocate): Likewise.
5920         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5921         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5922         (Target_x86_64::Scan::global): Likewise.
5923         (Target_x86_64::Relocate::relocate): Likewise.
5924
5925 2010-11-08  Doug Kwan  <dougkwan@google.com>
5926             Cary Coutant  <ccoutant@google.com>
5927
5928         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5929         (Arm_exidx_merge_section::section_contents_): New data member.
5930         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5931         (Arm_input_section::~Arm_input_section): De-allocate memory.
5932         (Arm_input_section::original_contents_): New data member.
5933         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5934         in parameters instead of calling Object::section_contents without
5935         locking.
5936         (Arm_output_section::group_section): New parameter TASK.  Pass it
5937         to callees that need locking objects.
5938         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5939         to lock EXIDX input sections.  Fix a formatting issue.  Call
5940         Arm_exidx_merged_section::build_contents to create merged section
5941         contents.
5942         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5943         to lock object of stub table owner.
5944         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5945         TEXT_SIZE to initialize data member TEXT_SIZE_.
5946         (Arm_exidx_input_section::addralign): Fix typo in comment.
5947         (Arm_exidx_input_section::text_size): New method.
5948         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5949         that require locking objects.  Lock objects before scanning for stubs
5950         and updating local symbols.
5951         (Arm_input_section<big_endian>::init): Copy contents of original
5952         input section.
5953         (Arm_input_section<big_endian>::do_write): Use saved contents of
5954         original input section instead of calling Object::section_contents
5955         without locking.
5956         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5957         size without calling Object::section_size().
5958         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5959         for size.  Allocate a buffer for merged EXIDX entries.
5960         (Arm_exidx_merged_section::build_contents): New method.
5961         (Arm_exidx_merged_section::do_write): Move merge section contents
5962         building code to Arm_exidx_merged_section::build_contetns.  Write
5963         out contetns in buffer instead of building it on the fly.
5964         (Arm_relobj::make_exidx_input_section): Also pass text section size
5965         to Arm_exidx_input_section constructor.
5966         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5967         (Arm_dynobj::do_read_symbols): Fix memory leak.
5968         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5969         * target.h: (class Task): Add forward declaration.
5970         (Target::relax): Add new parameter TASK and pass it to
5971         Target::do_relax().
5972         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5973
5974 2010-11-05  Cary Coutant  <ccoutant@google.com>
5975
5976         PR gold/10708
5977         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5978         object when reading from the file.
5979         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5980         second layout pass.
5981         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5982         when reading section contents.
5983         (get_section_contents): Likewise.
5984         (icf::find_identical_sections): Likewise.
5985         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5986         object when reading from the file.
5987         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5988         the object when doing deferred section layout.
5989
5990 2010-11-03  Nick Clifton  <nickc@redhat.com>
5991
5992         PR gold/12001
5993         * script.h (class Symbol_assignment: name): New member.  Returns
5994         the name of the symbol.
5995         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5996         Returns true if the given symbol name is on the list of
5997         assignments wating to be processed.
5998         * archive.cc (should_incldue_member): If the symbol is undefined,
5999         check to see if it is on the list of symbols pending assignment.
6000
6001 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6002
6003         * script-sections.cc (Script_sections::find_memory_region): Check
6004         for a NULL output section pointer.
6005
6006 2010-10-29  Doug Kwan  <dougkwan@google.com>
6007
6008         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6009         Output_section::add_relaxed_input_section.
6010         * output.cc (Output_section::add_relaxed_input_section): Add new
6011         arguments LAYOUT and NAME.  Set section order index.
6012         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6013         Copy section order index.
6014         * output.h (Output_section::add_relaxed_input_section): Add new
6015         arguments LAYOUT and NAME.
6016
6017 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6018
6019         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6020         NATIVE_OR_CROSS_LINKER.
6021         * testsuite/Makefile.in: Regenerate.
6022
6023 2010-10-20  Doug Kwan  <dougkwan@google.com>
6024
6025         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6026         without SHF_LINK_ORDER flags.
6027         * layout.cc (Layout::choose_output_section): Do not filter
6028         SHF_LINK_ORDER flag in a relocatable link.
6029
6030 2010-10-17  Cary Coutant  <ccoutant@google.com>
6031
6032         * output.h (Output_segment::set_section_addresses): Change function
6033         signature.  Update all callers.
6034         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6035         sections.
6036         (Output_segment::set_section_addresses): Align after last TLS
6037         section.  Add padding before last relro section instead of after.
6038
6039 2010-10-17  Doug Kwan  <dougkwan@google.com>
6040
6041         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6042         GOT output section to be writable.
6043
6044 2010-10-14  Cary Coutant  <ccoutant@google.com>
6045
6046         * debug.h (DEBUG_INCREMENTAL): New flag.
6047         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6048         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6049         mode.
6050         * incremental.cc (report_command_line): Ignore all forms of
6051         --incremental.
6052         * layout.cc (Layout::Layout): Check parameters for incremental link
6053         mode.
6054         * options.cc (General_options::parse_incremental): New function.
6055         (General_options::parse_no_incremental): New function.
6056         (General_options::parse_incremental_full): New function.
6057         (General_options::parse_incremental_update): New function.
6058         (General_options::incremental_mode_): New data member.
6059         (General_options::finalize): Check incremental_mode_.
6060         * options.h (General_options): Update help text for --incremental.
6061         Add --no-incremental, --incremental-full, --incremental-update.
6062         (General_options::Incremental_mode): New enum type.
6063         (General_options::incremental_mode): New function.
6064         (General_options::incremental_mode_): New data member.
6065         * parameters.cc (Parameters::incremental_mode_): New data member.
6066         (Parameters::set_options): Set incremental_mode_.
6067         (Parameters::set_incremental_full): New function.
6068         (Parameters::incremental): New function.
6069         (Parameters::incremental_update): New function.
6070         (set_parameters_incremental_full): New function.
6071         * parameters.h (Parameters::set_incremental_full): New function.
6072         (Parameters::incremental): New function.
6073         (Parameters::incremental_update): New function.
6074         (Parameters::incremental_mode_): New data member.
6075         (set_parameters_incremental_full): New function.
6076         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6077         incremental link mode.
6078         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6079         (Sized_relobj::do_relocate_sections): Likewise.
6080         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6081         option.
6082         * testsuite/Makefile.in: Regenerate.
6083         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6084
6085 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6086
6087         * script-sections.h (class Script_sections): Make
6088         Sections_elements typedef public.
6089         * script-sections.cc (class Sort_output_sections): Add elements_
6090         field.  Add constructor which sets it; change all callers.
6091         (Sort_output_sections::is_before): New function.
6092         (Sort_output_sections::operator()): Call is_before.
6093         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6094         conditional.
6095         * testsuite/script_test_10.sh: New test. Test script section
6096         order.
6097         * testsuite/script_test_10.t: Likewise.
6098         * testsuite/script_test_10.s: Likewise.
6099         * testsuite/Makefile.am: Wrap the cross linker tests and the
6100         common tests into NATIVE_OR_CROSS_LINKER.
6101         (check_SCRIPTS): Add script_test_10.sh.
6102         (check_DATA): Add script_test_10.stdout.
6103         (script_test_10.o, script_test_10): New targets.
6104         (script_test_10.stdout): New target.
6105         * configure, testsuite/Makefile.in: Regenerate.
6106
6107 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6108
6109         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6110         error for the deprecated relocations.
6111         (Target_arm::Scan::global): Likewise.
6112         (Target_arm::Relocate::relocate): Likewise.
6113
6114 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6115
6116         * fileread.cc (Input_file::find_file): Initialize *found_name
6117         and *namep when using the fallback search for case 4.
6118
6119 2010-10-11  Cary Coutant  <ccoutant@google.com>
6120
6121         * options.h (class General_options): Redefine -z lazy as an alias for
6122         the negation of -z now.
6123
6124 2010-10-11  Ian Lance Taylor  <iant@google.com>
6125
6126         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6127         binding.
6128
6129 2010-10-06  Nick Clifton  <nickc@redhat.com>
6130
6131         * script-sections.cc(class Memory_region): Remove
6132         current_lma_offset_ field.  Rename current_vma_offset_ to
6133         current_offset_.  Add last_section_ field.
6134         (Memory_region::get_current_vma_address): Rename to
6135         get_current_address.
6136         (Memory_region::get_current_lma_address): Delete.
6137         (Memory_region::increment_vma_offset): Rename to
6138         increment_offset.
6139         (Memory_region::increment_lma_offset): Delete.
6140         (Memory_region::attributes_compatible): New method.  Returns
6141         true if the provided section is compatible with the region.
6142         (Memory_region::get_last_section): New method.  Returns the last
6143         section to use the region.
6144         (Memory_region::set_last_section): New method.  Stores the last
6145         section to use the region.
6146         (Script_sections::block_in_region): New method.  Returns true if
6147         a block of memory is contained within a region.
6148         (Script_sections::find_memory_region): New method.  Locates a
6149         memory region to be used to set a VMA or LMA address.
6150         (Output_section_definition::set_section_addresses): Add code to
6151         check for addresses set by memory regions.
6152         (Output_segment::set_section_addresses): Remove memory region
6153         walking code.
6154         (Script_sections::create_segment): Add a warning if a header
6155         segment is created outside of any region.
6156         * script-sections.h (class Script_sections): Add prototypes for
6157         find_memory_region and block_in_region methods.
6158         * testsuite/memory_test.s: Use .long instead of .word.
6159         * testsuite/memory_test.t: Add some more output sections.
6160         * testsuite/memory_test.sh: Update expected output.
6161
6162 2010-10-02  Doug Kwan  <dougkwan@google.com>
6163
6164         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6165         defintion to symtab.h
6166         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6167         declaration to defintion.
6168
6169 2010-10-01  Nick Clifton  <nickc@redhat.com>
6170
6171         * expression.cc (eval): Replace dummy argument with NULL.
6172         (eval_maybe_dot): Check for a NULL result section pointer.
6173         (Symbol_expression::value): Likewise.
6174         (Dot_expression::value): Likewise.
6175         (BINARY_EXPRESSION): Likewise.
6176         (Max_expression::value): Likewise.
6177         (Min_expression::value): Likewise.
6178         (Absolute_expression::value): Likewise.
6179         (Addr_expression::value_from_output_section): Likewise.
6180         (Loaddddr_expression::value_from_output_section): Likewise.
6181         (Segment_start_expression::value): Likewise.
6182         * script-sections.cc
6183         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6184         argument with NULL.
6185         (Sections_elememt_dot_assignment::set_section_addresses):
6186         Likewise.
6187         (Output_data_expression::do_write_to_buffer): Likewise.
6188         (Output_section_definition::finalize_symbols): Likewise.
6189         (Output_section_definition::set_section_addresses): Likewise.
6190
6191 2010-09-30  Doug Kwan  <dougkwan@google.com>
6192
6193         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6194
6195 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6196
6197         * target.h (Target::can_icf_inline_merge_sections): New virtual
6198         function.
6199         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6200         virtual function.
6201         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6202         virtual function.
6203         * icf.cc (get_section_contents): Inline merge sections only when
6204         target allows it.
6205
6206 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6207
6208         * configure: Regenerate.
6209
6210 2010-09-17  Ian Lance Taylor  <iant@google.com>
6211
6212         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6213         * testsuite/Makefile.am (memory_test.o): New target.
6214         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6215         memory_test.t.
6216         * testsuite/Makefile.in: Rebuild.
6217
6218 2010-09-17  Doug Kwan  <dougkwan@google.com>
6219
6220         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6221         defintion if relocation uses GOT entries of the symbol.
6222         * testsuite/icf_safe_test.sh: Fix test.
6223         * testsuite/icf_safe_so_test.sh: Fix test.
6224
6225 2010-09-16  Cary Coutant  <ccoutant@google.com>
6226
6227         * script_sections.cc (class Memory_region): Remove "NULL" from
6228         vector initializations.
6229
6230 2010-09-15  Cary Coutant  <ccoutant@google.com>
6231
6232         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6233         Resolve forwarding symbols.
6234
6235 2010-09-15  Doug Kwan  <dougkwan@google.com>
6236
6237         * gold/testsuite/script_test_3.t: Add ARM special sections.
6238         * gold/testsuite/script_test_4.t: Same.
6239         * gold/testsuite/script_test_5.t: Same.
6240         * gold/testsuite/script_test_6.t: Same.
6241         * gold/testsuite/script_test_7.t: Same.
6242         * gold/testsuite/script_test_7.t: Same.
6243         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6244
6245 2010-09-14  Cary Coutant  <ccoutant@google.com>
6246
6247         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6248         (Target_x86_64::Relocate::relocate_tls): Replace check for
6249         saw_tls_block_reloc_ with test for executable section.
6250
6251 2010-09-12  Cary Coutant  <ccoutant@google.com>
6252
6253         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6254         position-independent executables to shared libraries need dynamic
6255         relocations.
6256         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6257         position-independent executables.
6258         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6259         * testsuite/Makefile.in: Regenerate.
6260
6261 2010-09-10  Nick Clifton  <nickc@redhat.com>
6262
6263         PR gold/11997
6264         * testsuite/memory_test.t: Discard any sections that are not
6265         needed.
6266
6267 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6268
6269         PR gold/11996
6270         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6271         "This::" to work around a bug in gcc 4.2.
6272
6273         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6274
6275 2010-09-09  Rafael Espindola  <espindola@google.com>
6276
6277         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6278         sections with different PF_X flags in the same segment.
6279         (Layout::find_first_load_seg): Search all segments to find the first
6280         one.
6281         * options.h (rosegment): New.
6282
6283 2010-09-08  Rafael Espindola  <espindola@google.com>
6284
6285         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6286
6287 2010-09-08  Doug Kwan  <dougkwan@google.com>
6288
6289         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6290         (Arm_relobj::do_relocate_sections): Add new parameter for output
6291         file to match the parent.
6292         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6293         of local symbols instead of input values.  Update code to track
6294         changes in gold::relocate_section.
6295         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6296         (Sized_relobj::compute_final_local_value_internal): New methods.
6297         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6298         body into private version of Sized_relobj::compute_final_local_value.
6299         Call the inline method.
6300         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6301         merged symbol value if there is one.
6302         (Symbol_value::has_output_value): New method defintiion.
6303         (Sized_relobj::Compute_final_local_value_status): New enum type.
6304         (Sized_relobj::compute_final_local_value): New methods.
6305         (Sized_relobj::compute_final_local_value_internal): New methods.
6306         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6307         and arm_cortex_a8.sh.
6308         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6309         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6310         New tests.
6311         * Makefile.in: Regenerate.
6312         * testsuite/arm_bl_out_of_range.s: Update test.
6313         * testsuite/thumb_bl_out_of_range.s: Ditto.
6314         * testsuite/thumb_blx_out_of_range.s: Ditto.
6315         * testsuite/arm_branch_out_of_range.sh: New file.
6316         * testsuite/arm_cortex_a8.sh: Ditto.
6317         * testsuite/arm_cortex_a8_b.s: Ditto.
6318         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6319         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6320         * testsuite/arm_cortex_a8_bl.s: Ditto.
6321         * testsuite/arm_cortex_a8_blx.s: Ditto.
6322         * testsuite/arm_cortex_a8_local.s: Ditto.
6323         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6324         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6325
6326 2010-09-08  Rafael Espindola  <espindola@google.com>
6327
6328         * Makefile.am (memory_test.stdout): Run readelf with -W.
6329         * Makefile.in: Regenerate.
6330         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6331         64 bit output.
6332
6333 2010-09-08  Rafael Espindola  <espindola@google.com>
6334
6335         * script-sections.cc (Script_sections::add_memory_region): Convert
6336         field precision to int.
6337         * script.cc (script_set_section_region, script_set_section_region):
6338         Convert field precision to int.
6339
6340 2010-09-08  Rafael Espindola  <espindola@google.com>
6341
6342         * arm.cc (do_finalize_sections): Create the __exidx_start and
6343         __exdix_end symbols even when the section is missing.
6344
6345 2010-09-08  Nick Clifton  <nickc@redhat.com>
6346
6347         * README: Remove claim that MEMORY is not supported.
6348         * expression.cc (script_exp_function_origin)
6349         (script_exp_function_length): Move from here to ...
6350         * script.cc: ... here.
6351         (script_set_section_region, script_add_memory)
6352         (script_parse_memory_attr, script_include_directive): New
6353         functions.
6354         * script-sections.cc
6355         (class Memory_region): New class.
6356         (class Output_section_definition): Add set_memory_region,
6357         set_section_vma, set_section_lma and get_section_name methods.
6358         (class Script_Sections): Add add_memory_region,
6359         find_memory_region, find_memory_region_origin,
6360         find_memory_region_length and set_memory_region methods.
6361         Have set_section_addresses method walk the list of set memory
6362         regions.
6363         Extend the print methos to display memory regions.
6364         * script-sections.h: Add prototypes for new methods.
6365         Add enum for MEMORY region attributes.
6366         * yyscript.y: Add support for parsing MEMORY regions.
6367         * script-c.h: Add prototypes for new functions.
6368         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6369         * testsuite/Makefile.in: Regenerate.
6370         * testsuite/memory_test.sh: New script.
6371         * testsuite/memory_test.s: New assembler source file.
6372         * testsuite/memory_test.t: New linker script.
6373
6374 2010-08-27  Doug Kwan  <dougkwan@google.com>
6375
6376         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6377         reference override an existing dynamic weak reference.
6378         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6379         * testsuite/Makefile.in: Regenerate.
6380         * testsuite/dyn_weak_ref.sh: New file.
6381         * testsuite/dyn_weak_ref_1.c: Ditto.
6382         * testsuite/dyn_weak_ref_2.c: Ditto.
6383
6384 2010-08-27  Ian Lance Taylor  <iant@google.com>
6385
6386         * incremental.h (class Incremental_input_entry): Add virtual
6387         destructor.
6388
6389 2010-08-27  Ian Lance Taylor  <iant@google.com>
6390
6391         * testsuite/start_lib_test_3.c: Mark t3 as used.
6392
6393 2010-08-27  Nick Clifton  <nickc@redhat.com>
6394
6395         * options.cc (version_script): Fix small typo in previous
6396         whitespace tidyup.
6397
6398 2010-08-25  Nick Clifton  <nickc@redhat.com>
6399
6400         * archive.cc: Formatting fixes: Remove whitespace between
6401         typename and following asterisk.  Remove whitespace between
6402         function name and opening parenthesis.
6403         * archive.h: Likewise.
6404         * arm.cc: Likewise.
6405         * attributes.cc: Likewise.
6406         * attributes.h: Likewise.
6407         * common.cc: Likewise.
6408         * copy-relocs.cc: Likewise.
6409         * dirsearch.h: Likewise.
6410         * dynobj.cc: Likewise.
6411         * ehframe.cc: Likewise.
6412         * ehframe.h: Likewise.
6413         * expression.cc: Likewise.
6414         * fileread.cc: Likewise.
6415         * fileread.h: Likewise.
6416         * gc.h: Likewise.
6417         * gold-threads.cc: Likewise.
6418         * gold.cc: Likewise.
6419         * i386.cc: Likewise.
6420         * icf.h: Likewise.
6421         * incremental-dump.cc: Likewise.
6422         * incremental.cc: Likewise.
6423         * layout.cc: Likewise.
6424         * layout.h: Likewise.
6425         * main.cc: Likewise.
6426         * merge.cc: Likewise.
6427         * merge.h: Likewise.
6428         * object.cc: Likewise.
6429         * object.h: Likewise.
6430         * options.cc: Likewise.
6431         * options.h: Likewise.
6432         * output.cc: Likewise.
6433         * output.h: Likewise.
6434         * plugin.cc: Likewise.
6435         * plugin.h: Likewise.
6436         * powerpc.cc: Likewise.
6437         * reloc.cc: Likewise.
6438         * script-c.h: Likewise.
6439         * script-sections.cc: Likewise.
6440         * script.cc: Likewise.
6441         * stringpool.cc: Likewise.
6442         * symtab.cc: Likewise.
6443         * symtab.h: Likewise.
6444         * target.cc: Likewise.
6445         * timer.cc: Likewise.
6446         * timer.h: Likewise.
6447         * version.cc: Likewise.
6448         * x86_64.cc: Likewise.
6449
6450 2010-08-24  Nick Clifton  <nickc@redhat.com>
6451
6452         PR 11899
6453         * layout.cc (segment_precedes): Sort segments by their physical
6454         addresses, if they have been set.
6455
6456 2010-08-23  Cary Coutant  <ccoutant@google.com>
6457
6458         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6459         symbols data.
6460         (Lib_group::include_member): Unlock object after deleting its
6461         symbols data.
6462         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6463         the bug fixed here.
6464
6465 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6466             Cary Coutant  <ccoutant@google.com>
6467
6468         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6469         constructor, and set_blocker.
6470         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6471         readsyms_blocker_.
6472         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6473         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6474         * testsuite/Makefile.am (start_lib_test): New test case.
6475         * testsuite/Makefile.in: Regenerate.
6476         * testsuite/start_lib_test_main.c: New file.
6477         * testsuite/start_lib_test_1.c: New file.
6478         * testsuite/start_lib_test_2.c: New file.
6479         * testsuite/start_lib_test_3.c: New file.
6480
6481 2010-08-19  Ian Lance Taylor  <iant@google.com>
6482
6483         * Makefile.in: Rebuild with automake 1.11.1.
6484         * aclocal.m4: Likewise.
6485         * testsuite/Makefile.in: Likewise.
6486
6487 2010-08-19  Ian Lance Taylor  <iant@google.com>
6488
6489         PR 10893
6490         * i386.cc (class Output_data_plt_i386): Update declarations.
6491         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6492         local_ifuncs_ fields.
6493         (Target_i386::do_plt_section_for_global): New function.
6494         (Target_i386::do_plt_section_for_local): New function.
6495         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6496         parameter; change all callers.  Initialize global_ifuncs_ and
6497         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6498         __rel_iplt_end.
6499         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6500         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6501         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6502         symbols.
6503         (Target_i386::make_plt_section): New function, broken out of
6504         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6505         (Target_i386::make_plt_entry): Call make_plt_section.
6506         (Target_i386::make_local_ifunc_plt_entry): New function.
6507         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6508         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6509         R_386_IRELATIVE to switch.
6510         (Target_i386::Scan::global): Likewise.
6511         (Target_i386::Relocate::relocate): Likewise.
6512         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6513         switch.
6514         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6515         (Target_x86_64::do_plt_section_for_global): New function.
6516         (Target_x86_64::do_plt_section_for_local): New function.
6517         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6518         parameter; change all callers.  If doing a static link define
6519         __rela_iplt_start and __rela_iplt_end.
6520         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6521         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6522         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6523         to point to .plt.
6524         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6525         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6526         switch.
6527         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6528         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6529         R_X86_64_IRELATIVE to switch.
6530         (Target_x86_64::Scan::global): Likewise.
6531         (Target_x86_64::Relocate::relocate): Likewise.
6532         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6533         switch.
6534         * target.h (class Target): Add plt_section_for_global and
6535         plt_section_for_local functions.  Add do_plt_section_for_global
6536         and do_plt_section_for_local virtual functions.
6537         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6538         clarifying comments.
6539         (Symbol::use_plt_offset): Handle IFUNC symbol.
6540         * object.cc (Sized_relobj::Sized_relobj): Initialize
6541         local_plt_offsets_.
6542         (Sized_relobj::local_has_plt_offset): New function.
6543         (Sized_relobj::local_plt_offset): New function.
6544         (Sized_relobj::set_local_plt_offset): New function.
6545         (Sized_relobj::do_count): Handle IFUNC symbol.
6546         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6547         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6548         is_ifunc_symbol functions.
6549         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6550         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6551         local_plt_offsets_ field.
6552         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6553         * output.h (class Output_section_data): Add non-const
6554         output_section function.
6555         (class Output_data_got): Update declarations.
6556         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6557         Add use_plt_offset parameter to global and local constructors.
6558         Change all callers.  Change local_sym_index_ field to 31 bits.
6559         Change GSYM_CODE and CONSTANT_CODE accordingly.
6560         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6561         doing a static link don't set sh_link field.
6562         (Output_data_got::Got_entry::write): Use PLT offset if
6563         appropriate.
6564         (Output_data_got::add_global_plt): New function.
6565         (Output_data_got::add_local_plt): New function.
6566         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6567         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6568         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6569         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6570         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6571         IFUNC conditional.
6572         * testsuite/ifunc-sel.h: New file.
6573         * testsuite/ifuncmain1.c: New file.
6574         * testsuite/ifuncmain1vis.c: New file.
6575         * testsuite/ifuncmod1.c: New file.
6576         * testsuite/ifuncdep2.c: New file.
6577         * testsuite/ifuncmain2.c: New file.
6578         * testsuite/ifuncmain3.c: New file.
6579         * testsuite/ifuncmod3.c: New file.
6580         * testsuite/ifuncmain4.c: New file.
6581         * testsuite/ifuncmain5.c: New file.
6582         * testsuite/ifuncmod5.c: New file.
6583         * testsuite/ifuncmain6pie.c: New file.
6584         * testsuite/ifuncmod6.c: New file.
6585         * testsuite/ifuncmain7.c: New file.
6586         * configure, testsuite/Makefile.in: Rebuild.
6587
6588 2010-08-18  Ian Lance Taylor  <iant@google.com>
6589
6590         * incremental.cc
6591         (Output_section_incremental_inputs::write_input_files): Add cast
6592         to avoid signed/unsigned comparison warning.
6593         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6594
6595 2010-08-12  Cary Coutant  <ccoutant@google.com>
6596
6597         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6598
6599 2010-08-13  Ian Lance Taylor  <iant@google.com>
6600
6601         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6602
6603 2010-08-12  Cary Coutant  <ccoutant@google.com>
6604             Doug Kwan  <dougkwan@google.com>
6605
6606         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6607         defintion overrides non-weak undef, remember that the original undef
6608         is not weak.
6609         * symtab.cc (Symbol_table::sized_write_global): For undef without
6610         an original weak binding, set binding to global in output.
6611         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6612         * testsuite/Makefile.in: Regenerate.
6613         * testsuite/strong_ref_weak_def.sh: New file.
6614         * testsuite/strong_ref_weak_def_1.c: Ditto.
6615         * testsuite/strong_ref_weak_def_2.c: Ditto.
6616
6617 2010-08-12  Cary Coutant  <ccoutant@google.com>
6618
6619         * testsuite/incremental_test.sh: Rewrite.
6620         * testsuite/incremental_test_1.c: Rewrite.
6621         * testsuite/incremental_test_2.c: Rewrite.
6622
6623 2010-08-12  Cary Coutant  <ccoutant@google.com>
6624
6625         * arm.cc (Target_arm::got_size): Add const.
6626         (Target_arm::got_entry_count): New function.
6627         (Target_arm::plt_entry_count): New function.
6628         (Target_arm::first_plt_entry_offset): New function.
6629         (Target_arm::plt_entry_size): New function.
6630         (Output_data_plt_arm::entry_count): New function.
6631         (Output_data_plt_arm::first_plt_entry_offset): New function.
6632         (Output_data_plt_arm::get_plt_entry_size): New function.
6633         * i386.cc (Target_i386::got_size): Add const.
6634         (Target_i386::got_entry_count): New function.
6635         (Target_i386::plt_entry_count): New function.
6636         (Target_i386::first_plt_entry_offset): New function.
6637         (Target_i386::plt_entry_size): New function.
6638         (Output_data_plt_i386::entry_count): New function.
6639         (Output_data_plt_i386::first_plt_entry_offset): New function.
6640         (Output_data_plt_i386::get_plt_entry_size): New function.
6641         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6642         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6643         * incremental.cc: Include target.h.
6644         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6645         parameter.  Adjust all callers.  Find incremental_got_plt section.
6646         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6647         section.
6648         (Output_section_incremental_inputs::set_final_data_size): Calculate
6649         size of incremental_got_plt section.
6650         (Output_section_incremental_inputs::do_write): Write the
6651         incremental_got_plt section.
6652         (Got_plt_view_info): New struct.
6653         (Local_got_offset_visitor): New class.
6654         (Global_got_offset_visitor): New class.
6655         (Global_symbol_visitor_got_plt): New class.
6656         (Output_section_incremental_inputs::write_got_plt): New function.
6657         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6658         Add parameter.  Adjust all callers.
6659         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6660         (Incremental_inputs::got_plt_section): New function.
6661         (Incremental_inputs::got_plt_section_): New data member.
6662         (Incremental_got_plt_reader): New class.
6663         * layout.cc (Layout::create_incremental_info_sections): Add the
6664         incremental_got_plt section.
6665         * object.h (Got_offset_list::get_list): New function.
6666         (Got offset_list::for_all_got_offsets): New function.
6667         (Sized_relobj::local_got_offset_list): New function.
6668         * powerpc.cc (Target_powerpc::got_size): Add const.
6669         (Target_powerpc::got_entry_count): New function.
6670         (Target_powerpc::plt_entry_count): New function.
6671         (Target_powerpc::first_plt_entry_offset): New function.
6672         (Target_powerpc::plt_entry_size): New function.
6673         (Output_data_plt_powerpc::entry_count): New function.
6674         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6675         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6676         * sparc.cc (Target_sparc::got_size): Add const.
6677         (Target_sparc::got_entry_count): New function.
6678         (Target_sparc::plt_entry_count): New function.
6679         (Target_sparc::first_plt_entry_offset): New function.
6680         (Target_sparc::plt_entry_size): New function.
6681         (Output_data_plt_sparc::entry_count): New function.
6682         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6683         (Output_data_plt_sparc::get_plt_entry_size): New function.
6684         * symtab.h (Symbol::got_offset_list): New function.
6685         (Symbol_table::for_all_symbols): New function.
6686         * target.h (Sized_target::got_entry_count): New function.
6687         (Sized_target::plt_entry_count): New function.
6688         (Sized_target::plt_entry_size): New function.
6689         * x86_64.cc (Target_x86_64::got_size): Add const.
6690         (Target_x86_64::got_entry_count): New function.
6691         (Target_x86_64::plt_entry_count): New function.
6692         (Target_x86_64::first_plt_entry_offset): New function.
6693         (Target_x86_64::plt_entry_size): New function.
6694         (Output_data_plt_x86_64::entry_count): New function.
6695         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6696         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6697
6698 2010-08-12  Cary Coutant  <ccoutant@google.com>
6699
6700         * archive.cc: Include incremental.h.
6701         (Archive::Archive): Initialize incremental_info_.
6702         (Archive::include_member): Record archive members in incremental info.
6703         (Add_archive_symbols::run): Record begin and end of an archive in
6704         incremental info.
6705         (Lib_group::include_member): Record objects in incremental info.
6706         * archive.h (Incremental_archive_entry): Forward declaration.
6707         (Archive::set_incremental_info): New member function.
6708         (Archive::incremental_info): New member function.
6709         (Archive::Unused_symbol_iterator): New class.
6710         (Archive::unused_symbols_begin): New member function.
6711         (Archive::unused_symbols_end): New member function.
6712         (Archive::incremental_info_): New data member.
6713         * incremental-dump.cc (find_input_containing_global): New function.
6714         (dump_incremental_inputs): Dump new incremental info sections.
6715         * incremental.cc: Include symtab.h.
6716         (Output_section_incremental_inputs): New class.
6717         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6718         new incremental info sections.
6719         (Sized_incremental_binary::do_check_inputs): Likewise.
6720         (Incremental_inputs::report_archive): Remove.
6721         (Incremental_inputs::report_archive_begin): New function.
6722         (Incremental_inputs::report_archive_end): New function.
6723         (Incremental_inputs::report_object): New function.
6724         (Incremental_inputs::finalize_inputs): Remove.
6725         (Incremental_inputs::report_input_section): New function.
6726         (Incremental_inputs::report_script): Rewrite.
6727         (Incremental_inputs::finalize): Do nothing but finalize string table.
6728         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6729         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6730         (Incremental_inputs::create_data_sections): New function.
6731         (Incremental_inputs::relocs_entsize): New function.
6732         (Output_section_incremental_inputs::set_final_data_size): New function.
6733         (Output_section_incremental_inputs::do_write): New function.
6734         (Output_section_incremental_inputs::write_header): New function.
6735         (Output_section_incremental_inputs::write_input_files): New function.
6736         (Output_section_incremental_inputs::write_info_blocks): New function.
6737         (Output_section_incremental_inputs::write_symtab): New function.
6738         * incremental.h (Incremental_script_entry): Forward declaration.
6739         (Incremental_object_entry): Forward declaration.
6740         (Incremental_archive_entry): Forward declaration.
6741         (Incremental_inputs): Forward declaration.
6742         (Incremental_inputs_header_data): Remove.
6743         (Incremental_inputs_header): Remove.
6744         (Incremental_inputs_header_write): Remove.
6745         (Incremental_inputs_entry_data): Remove.
6746         (Incremental_inputs_entry): Remove.
6747         (Incremental_inputs_entry_write): Remove.
6748         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6749         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6750         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6751         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6752         Likewise.
6753         (Incremental_input_entry): New class.
6754         (Incremental_script_entry): New class.
6755         (Incremental_object_entry): New class.
6756         (Incremental_archive_entry): New class.
6757         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6758         (Incremental_inputs::report_inputs): Remove.
6759         (Incremental_inputs::report_archive): Remove.
6760         (Incremental_inputs::report_archive_begin): New function.
6761         (Incremental_inputs::report_archive_end): New function.
6762         (Incremental_inputs::report_object): Change prototype.
6763         (Incremental_inputs::report_input_section): New function.
6764         (Incremental_inputs::report_script): Change prototype.
6765         (Incremental_inputs::get_reloc_count): New function.
6766         (Incremental_inputs::set_reloc_count): New function.
6767         (Incremental_inputs::create_data_sections): New function.
6768         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6769         (Incremental_inputs::inputs_section): New function.
6770         (Incremental_inputs::symtab_section): New function.
6771         (Incremental_inputs::relocs_section): New function.
6772         (Incremental_inputs::get_stringpool): Add const.
6773         (Incremental_inputs::command_line): Add const.
6774         (Incremental_inputs::inputs): Remove.
6775         (Incremental_inputs::command_line_key): New function.
6776         (Incremental_inputs::input_file_count): New function.
6777         (Incremental_inputs::input_files): New function.
6778         (Incremental_inputs::relocs_entsize): New function.
6779         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6780         (Incremental_inputs::finalize_inputs): Remove.
6781         (Incremental_inputs::Input_info): Remove.
6782         (Incremental_inputs::lock_): Remove.
6783         (Incremental_inputs::inputs_): Change type.
6784         (Incremental_inputs::inputs_map_): Remove.
6785         (Incremental_inputs::current_object_entry_): New data member.
6786         (Incremental_inputs::inputs_section_): New data member.
6787         (Incremental_inputs::symtab_section_): New data member.
6788         (Incremental_inputs::relocs_section_): New data member.
6789         (Incremental_inputs::reloc_count_): New data member.
6790         (Incremental_inputs_reader): New class.
6791         (Incremental_symtab_reader): New class.
6792         (Incremental_relocs_reader): New class.
6793         * layout.cc (Layout::finalize): Move finalization of incremental info
6794         and creation of incremental info sections to follow finalization of
6795         symbol table.  Set offsets for postprocessing sections.
6796         (Layout::create_incremental_info_sections): Call
6797         Incremental_inputs::create_data_sections.  Add incremental symtab
6798         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6799         sections to layout after input sections.
6800         * layout.h (struct Timespec): Forward declaration.
6801         (Layout::incremental_inputs): Add const.
6802         (Layout::create_incremental_info_sections): Add parameter.
6803         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6804         * object.cc: Include incremental.h.
6805         (Relobj::finalize_incremental_relocs): New function.
6806         (Sized_relobj::do_layout): Record input sections in incremental info.
6807         * object.h (Object::output_section): New function.
6808         (Object::output_section_offset): Moved from Relobj.
6809         (Object::get_incremental_reloc_base): New function.
6810         (Object::get_incremental_reloc_count): New function.
6811         (Object::do_output_section): New function.
6812         (Object::do_output_section_offset): Moved from Relobj.
6813         (Object::do_get_incremental_reloc_base): New function.
6814         (Object::do_get_incremental_reloc_count): New function.
6815         (Object::Object): Initialize new data members.
6816         (Relobj::output_section): Renamed do_output_section and moved to
6817         protected.
6818         (Relobj::output_section_offset): Moved to Object.
6819         (Relobj::do_get_incremental_reloc_base): New function.
6820         (Relobj::do_get_incremental_reloc_count): New function.
6821         (Relobj::allocate_incremental_reloc_counts): New function.
6822         (Relobj::count_incremental_reloc): New function.
6823         (Relobj::finalize_incremental_relocs): New function.
6824         (Relobj::next_incremental_reloc_index): New function.
6825         (Relobj::reloc_counts_): New data member.
6826         (Relobj::reloc_bases_): New data member.
6827         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6828         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6829         (Sized_relobj::incremental_relocs_scan): New function.
6830         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6831         (Sized_relobj::incremental_relocs_write): New function.
6832         (Sized_relobj::incremental_relocs_write_reltype): New function.
6833         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6834         incremental link.
6835         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6836         archives and object files elsewhere.
6837         (Add_symbols::run): Report object files here.
6838         (Finish_group::run): Report end of archive at end of group.
6839         * reloc.cc: Include layout.h, incremental.h.
6840         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6841         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6842         (Sized_relobj::incremental_relocs_scan): New function.
6843         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6844         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6845         (Sized_relobj::incremental_relocs_write): New function.
6846         (Sized_relobj::incremental_relocs_write_reltype): New function.
6847         * script.cc (read_input_script): Rewrite test for incremental link.
6848         Change call to Incremental_inputs::report_script.
6849         * symtab.h (Symbol_table::first_global_index): New function.
6850         (Symbol_table::output_count): New function.
6851
6852 2010-08-12  Doug Kwan  <dougkwan@google.com>
6853
6854         * arm.cc (Target_arm::merge_object_attributes): Check command line
6855         options --no-wchar-size-warning and --no-enum-size-warning.
6856         * options.h (General_options): Add ld-compatible options
6857         --no-enum-size-warning and --no-wchar-size-warning.
6858
6859 2010-08-04  Ian Lance Taylor  <iant@google.com>
6860
6861         * x86_64.cc (Target_x86_64::Scan::local): Use
6862         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6863         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6864         (Target_x86_64::Scan::global): Likewise.
6865         (Target_x86_64::Relocate::relocate): Likewise.
6866         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6867         Likewise.
6868
6869 2010-08-03  Cary Coutant  <ccoutant@google.com>
6870
6871         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6872         to reserve space in merged_strings vector. Keep total input size
6873         for stats.
6874         (Output_merge_string::do_print_merge_stats): Print total input size.
6875         * merge.h (Output_merge_string): Add input_size_ field.
6876         * stringpool.cc (Stringpool_template::string_length): Move
6877         implementations out of Stringpool_template class and place in
6878         stringpool.h.
6879         * stringpool.h (string_length): Move out of Stringpool_template.
6880
6881 2010-08-03  Ian Lance Taylor  <iant@google.com>
6882
6883         PR 11712
6884         * layout.cc (relaxation_loop_body): If address of load segment is
6885         set, adjust address to include headers if possible.
6886
6887 2010-08-03  Ian Lance Taylor  <iant@google.com>
6888
6889         * version.cc (version_string): Bump to 1.10.
6890
6891 2010-08-03  Ian Lance Taylor  <iant@google.com>
6892
6893         PR 11805
6894         * layout.h (enum Output_section_order): Define.
6895         (class Layout): Update declarations.
6896         * layout.cc (Layout::get_output_section): Add order parameter.
6897         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6898         is_first_non_relro parameters.  Change all callers.
6899         (Layout::choose_output_section): Likewise.
6900         (Layout::add_output_section_data): Likewise.
6901         (Layout::make_output_section): Likewise.  Set order.
6902         (Layout::default_section_order): New function.
6903         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6904         * output.cc (Output_section::Output_section): Initialize order_.
6905         Don't initialize deleted fields.
6906         (Output_segment::Output_segment): Don't initialize deleted
6907         fields.
6908         (Output_segment::add_output_section_to_load): New function
6909         replacing add_output_section.  Change all callers to call this or
6910         add_output_section_to_nonload.
6911         (Output_segment::add_output_section_to_nonload): New function.
6912         (Output_segment::remove_output_section): Rewrite.
6913         (Output_segment::add_initial_output_data): Likewise.
6914         (Output_segment::has_any_data_sections): Likewise.
6915         (Output_segment::is_first_section_relro): Likewise.
6916         (Output_segment::maximum_alignment): Likewise.
6917         (Output_segment::has_dynamic_reloc): New function replacing
6918         dynamic_reloc_count.  Change all callers.
6919         (Output_segment::has_dynamic_reloc_list): New function replacing
6920         dynamic_reloc_count_list.  Change all callers.
6921         (Output_segment::set_section_addresses): Rewrite.
6922         (Output_segment::set_offset): Rewrite.
6923         (Output_segment::find_first_and_last_list): Remove.
6924         (Output_segment::set_tls_offsets): Rewrite.
6925         (Output_segment::first_section_load_address): Likewise.
6926         (Output_segment::output_section_count): Likewise.
6927         (Output_segment::section_with_lowest_load_address): Likewise.
6928         (Output_segment::write_section_headers): Likewise.
6929         (Output_segment::print_sections_to_map): Likewise.
6930         * output.h (class Output_data): Remove dynamic_reloc_count_
6931         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6932         (Output_data::add_dynamic_reloc): Rewrite.
6933         (Output_data::has_dynamic_reloc): New function.
6934         (Output_data::dynamic_reloc_count): Remove.
6935         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6936         is_last_relro_, is_first_non_relro_, is_interp_,
6937         is_dynamic_linker_section_ fields.  Add order and set_order
6938         functions.  Remove is_relro_local, set_is_relro_local,
6939         is_last_relro, set_is_last_relro, is_first_non_relro,
6940         set_is_first_non_relro functions, is_interp, set_is_interp,
6941         is_dynamic_linker_section, and set_is_dynamic_linker_section
6942         functions.
6943         (class Output_segment): Change Output_data_list from std::list to
6944         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6945         output_bss_ fields.  Update declarations.
6946
6947 2010-08-02  Ian Lance Taylor  <iant@google.com>
6948
6949         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6950         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6951         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6952
6953 2010-08-02  Ian Lance Taylor  <iant@google.com>
6954
6955         PR 11855
6956         * script.cc (Script_options::Script_options): Initialize
6957         symbol_definitions_ and symbol_references_.
6958         (Script_options::add_symbol_assignment): Update
6959         symbol_definitions_ and symbol_references_.
6960         (Script_options::add_symbol_reference): New function.
6961         (script_symbol): New function.
6962         * script.h (class Script_options): Add symbol_definitions_ and
6963         symbol_references_ fields.
6964         (Script_options::referenced_const_iterator): New type.
6965         (Script_options::referenced_begin): New function.
6966         (Script_options::referenced_end): New function.
6967         (Script_options::is_referenced): New function.
6968         (Script_options::any_unreferenced): New function.
6969         * script-c.h (script_symbol): Declare.
6970         * yyscript.y (exp): Call script_symbol.
6971         * symtab.cc: Include "script.h".
6972         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6973         Change all callers.  Check symbols referenced by scripts.
6974         (Symbol_table::add_undefined_symbols_from_command_line): Add
6975         layout parameter.  Change all callers.
6976         (Symbol_table::do_add_undefined_symbols_from_command_line):
6977         Likewise.  Break out loop body.  Check symbols referenced by
6978         scripts.
6979         (Symbol_table::add_undefined_symbol_from_command_line): New
6980         function broken out of
6981         do_add_undefined_symbols_from_command_line.
6982         * symtab.h (class Symbol_table): Update declarations.
6983         * archive.cc: Include "layout.h".
6984         (Archive::should_include_member): Add layout parameter.  Change
6985         all callers.  Check for symbol mentioned in expression.
6986         * archive.h (class Archive): Update declaration.
6987         * object.cc (Sized_relobj::do_should_include_member): Add layout
6988         parameter.
6989         * object.h (Object::should_include_member): Add layout parameter.
6990         Change all callers.
6991         (Object::do_should_include_member): Add layout parameter.
6992         (class Sized_relobj): Update declaration.
6993         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6994         parameter.
6995         * dynobj.h (class Sized_dynobj): Update declaration.
6996         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6997         layout parameter.
6998         * plugin.h (class Sized_pluginobj): Update declaration.
6999
7000 2010-08-02  Ian Lance Taylor  <iant@google.com>
7001
7002         PR 11866
7003         * output.cc (Output_segment::set_offset): Search for the first and
7004         last sections rather than assuming that the list is in order.
7005         (Output_segment::find_first_and_last_list): New function.
7006         * output.h (class Output_segment): Update declarations.
7007         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7008         (relro_strip_test_SOURCES): New variable.
7009         (relro_strip_test_DEPENDENCIES): New variable.
7010         (relro_strip_test_LDFLAGS): New variable.
7011         (relro_strip_test_LDADD): New variable.
7012         (relro_strip_test.so): New target.
7013
7014 2010-08-02  Ian Lance Taylor  <iant@google.com>
7015
7016         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7017         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7018         (Target_i386::got_tlsdesc_section): New function.
7019         (Target_i386::got_section): Create space for GOT entries for
7020         TLSDESC relocations.
7021         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7022         R_386_TLS_GOTDESC.
7023         (Target_i386::Scan::global): Likewise.
7024         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7025         using TLSDESC GOT.
7026         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7027         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7028         (Target_x86_64::got_tlsdesc_section): New function.
7029         (Target_x86_64::got_section): Create space for GOT entries for
7030         TLSDESC relocations.
7031         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7032         R_386_TLS_GOTDESC.
7033         (Target_x86_64::Scan::global): Likewise.
7034         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7035         using TLSDESC GOT.
7036
7037 2010-08-02  Ian Lance Taylor  <iant@google.com>
7038
7039         * testsuite/final_layout.sh: Use dc to convert from hex to
7040         decimal.
7041
7042 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7043
7044         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7045         paramter to the call to gold::gc_process_relocs.
7046         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7047         paramter to the call to gold::gc_process_relocs.
7048         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7049         parameter to the call to gold::gc_process_relocs.
7050         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7051         template parameter to the call to gold::gc_process_relocs.
7052         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7053         paramter to the call to gold::gc_process_relocs.
7054         * gc.h (get_embedded_addend_size): New function.
7055         (gc_process_relocs): Save the size of the reloc for use by ICF.
7056         * icf.cc (get_section_contents): Get the addend from the text section
7057         for SHT_REL relocation sections.
7058         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7059         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7060         * int_encoding.h (read_from_pointer): New overloaded function.
7061         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7062         * testsuite/icf_sht_rel_addend_test.sh: New file.
7063         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7064         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7065
7066 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7067
7068         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7069         * Makefile.in: Regenerate.
7070         * testsuite/Makefile.in: Regenerate.
7071
7072 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7073
7074         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7075         * gold/testsuite/debug_msg.cc: Likewise.
7076         * gold/testsuite/odr_violation1.cc
7077         * gold/testsuite/odr_violation2.cc
7078
7079 2010-07-21  Cary Coutant  <ccoutant@google.com>
7080
7081         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7082         string, and length fields.
7083         (Output_merge_string::Merged_strings_list): New type.
7084         (Output_merge_string::Merged_strings_lists): New typedef.
7085         (Output_merge_string): Replace merged_strings_ with
7086         merged_strings_lists_.
7087         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7088         Merged_strings_list per input object and section.  Don't store pointer
7089         to the string.  Don't store length with each merged string entry.
7090         (Output_merge_string::finalize_merged_data): Loop over list of merged
7091         strings lists.  Recompute length of each merged string.
7092
7093 2010-07-15  Cary Coutant  <ccoutant@google.com>
7094
7095         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7096         here.
7097
7098 2010-07-14  Ian Lance Taylor  <iant@google.com>
7099
7100         * descriptors.cc (Descriptors::open): Report correct name in error
7101         message.
7102
7103 2010-07-13  Doug Kwan  <dougkwan@google.com>
7104
7105         * arm.cc (Arm_input_section::Arm_input_section): For a
7106         SHT_ARM_EXIDX section, always keeps the input sections.
7107         (Arm_input_section::set_exidx_section_link): New method.
7108         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7109         has_errors_ to false.
7110         (Arm_exidx_input_section::has_errors,
7111         Arm_exidx_input_section::set_has_errors): New methods.
7112         (Arm_exidx_input_section::has_errors_): New data member.
7113         (Arm_relobj::get_exidx_shndx_list): New method.
7114         (Arm_output_section::append_text_sections_to_list): Do not skip
7115         section without SHF_EXECINSTR.
7116         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7117         errors.
7118         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7119         section header.  Make error messages more verbose.  Check for
7120         a non-executable section linked to an EXIDX section.
7121         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7122         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7123         check that there is no deferred EXIDX section if we exit early.
7124         Instead of not making an EXIDX section in case of an error, make one
7125         and set the has_errors flag of it.
7126         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7127         in a relocatable link.
7128         (Target_arm::do_relax): Look for the EXIDX output section instead of
7129         assuming that it is called .ARM.exidx.
7130         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7131         section list.  Do not check for SHF_EXECINSTR section flags but
7132         skip any input section with errors.
7133         * output.cc (Output_section::Output_section): Initialize
7134         always_keeps_input_sections_ to false.
7135         (Output_section::add_input_section): Check for
7136         always_keeps_input_sections_.
7137         *  output.h (Output_section::always_keeps_input_sections,
7138         Output_section::set_always_keeps_input_sections): New methods.
7139         (Output_section::always_keeps_input_sections): New data member.
7140
7141 2010-07-13  Rafael Espindola  <espindola@google.com>
7142
7143         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7144         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7145
7146 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7147             Ian Lance Taylor  <iant@google.com>
7148
7149         * output.h (Output_section_lookup_maps::add_merge_section):
7150         Correct check of whether value was inserted.
7151         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7152         (Output_section_lookup_maps::add_relaxed_input_section):
7153         Likewise.
7154         * arm.cc (Target_arm::got_section): Remove used local os.
7155         * i386.cc (Target_i386::got_section): Likewise.
7156         * x86_64.cc (Target_x86_64::got_section): Likewise.
7157         * sparc.cc (Target_sparc::got_section): Likewise.
7158         (Target_sparc::relocate): Remove unused local have_got_offset.
7159         * powerpc.cc (Target_powerpc::relocate): Likewise.
7160
7161 2010-07-13  Ian Lance Taylor  <iant@google.com>
7162
7163         * compressed_output.cc (zlib_decompress): Fix signature in
7164         !HAVE_ZLIB_H case.
7165
7166         * archive.cc (Archive::include_member): Unlock an external member
7167         of a thin archive.  Don't bother to delete an object we know is
7168         NULL.
7169
7170 2010-07-12  Cary Coutant  <ccoutant@google.com>
7171
7172         * compressed_output.cc (zlib_decompress): New function.
7173         (get_uncompressed_size): New function.
7174         (decompress_input_section): New function.
7175         * compressed_output.h (get_uncompressed_size): New function.
7176         (decompress_input_section): New function.
7177         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7178         Handle compressed debug sections.
7179         * layout.cc (is_compressed_debug_section): New function.
7180         (Layout::output_section_name): Map compressed section names to
7181         canonical names.
7182         * layout.h (is_compressed_debug_section): New function.
7183         (is_debug_info_section): Recognize compressed debug sections.
7184         * merge.cc: Include compressed_output.h.
7185         (Output_merge_data::do_add_input_section): Handle compressed
7186         debug sections.
7187         (Output_merge_string::do_add_input_section): Handle compressed
7188         debug sections.
7189         * object.cc: Include compressed_output.h.
7190         (Sized_relobj::Sized_relobj): Initialize new data members.
7191         (build_compressed_section_map): New function.
7192         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7193         * object.h (Object::section_is_compressed): New method.
7194         (Object::do_section_is_compressed): New method.
7195         (Sized_relobj::Compressed_section_map): New type.
7196         (Sized_relobj::do_section_is_compressed): New method.
7197         (Sized_relobj::compressed_sections_): New data member.
7198         * output.cc (Output_section::add_input_section): Handle compressed
7199         debug sections.
7200         * reloc.cc: Include compressed_output.h.
7201         (Sized_relobj::write_sections): Handle compressed debug sections.
7202
7203 2010-07-08  Cary Coutant  <ccoutant@google.com>
7204
7205         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7206         weak when resolving to a dynamic def.
7207         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7208         for weak undef/dynamic def cases. Adjust callers.
7209         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7210         undef_binding_weak_.
7211         (Symbol_table::sized_write_globals): Adjust symbol binding.
7212         (Symbol_table::sized_write_symbol): Add binding parameter.
7213         * symtab.h (Symbol::set_undef_binding): New method.
7214         (Symbol::is_undef_binding_weak): New method.
7215         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7216         (Symbol_table::should_override): Add new parameter.
7217         (Symbol_table::sized_write_symbol): Add new parameter.
7218
7219         * testsuite/weak_undef_file1.cc: Add new test case.
7220         * testsuite/weak_undef_file2.cc: Fix header comment.
7221         * testsuite/weak_undef_test.cc: Add new test case.
7222
7223 2010-06-29  Doug Kwan  <dougkwan@google.com>
7224
7225         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7226         Initialize USE_SYMBOL_.
7227         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7228         definition.
7229         (Arm_reloc_property::uses_symbol_): New data member declaration.
7230         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7231         uses symbol value and symbol is undefined but not weakly undefined.
7232
7233 2010-06-28  Rafael Espindola  <espindola@google.com>
7234
7235         * plugin.cc (Plugin::load): Use dlerror.
7236
7237 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7238
7239         * symtab.cc (detect_odr_violations): When reporting an ODR
7240         violation, report an object where the symbol is defined.
7241
7242 2010-06-25  Doug Kwan  <dougkwan@google.com>
7243
7244         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7245         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7246         definition.
7247         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7248         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7249         target hook to detect function points.
7250         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7251         * icf.h (Icf::check_section_for_function_pointers): Change type of
7252         parameter SECTION_NAME to const reference to std::string.  Use
7253         target hook to determine if section may have unsafe pointers.
7254         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7255         method definition.
7256
7257 2010-06-21  Rafael Espindola  <espindola@google.com>
7258
7259         * fileread.cc (Input_file::find_fie): New
7260         (Input_file::open): Use Input_file::find_fie.
7261         * fileread.h (Input_file::find_fie): New
7262         * plugin.cc (set_extra_library_path): New.
7263         (Plugin::load): Add set_extra_library_path to the transfer vector.
7264         (Plugin_manager::set_extra_library_path): New.
7265         (Plugin_manager::add_input_file): Use the extra search path if set.
7266         (set_extra_library_path(): New.
7267         * plugin.h (Plugin_manager): Add set_extra_library_path and
7268         extra_search_path_.
7269
7270 2010-06-19  Cary Coutant  <ccoutant@google.com>
7271
7272         * layout.cc (gdb_sections): Add .debug_types.
7273         (lines_only_debug_sections): Likewise.
7274
7275 2010-06-18  Rafael Espindola  <espindola@google.com>
7276
7277         * plugin.cc (add_input_file,add_input_library)
7278         (Plugin_manager::add_input_file): Make filename arguments const.
7279         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7280         const.
7281
7282 2010-06-16  Doug Kwan  <dougkwan@google.com>
7283
7284         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7285         .ARM.attributes section if we have not merged any input
7286         attributes sections.
7287
7288 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7289
7290         * arm.cc: Allow combining objects with no EABI version
7291         information.
7292
7293 2010-06-15  Rafael Espindola  <espindola@google.com>
7294
7295         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7296
7297 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7298
7299         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7300         (struct iovec): Correct !HAVE_READV definition.
7301
7302 2010-06-10  Cary Coutant  <ccoutant@google.com>
7303
7304         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7305         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7306         reloc sections.
7307         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7308
7309         PR 11683
7310         * symtab.h (Symbol::is_placeholder): New member function.
7311         * target-reloc.h (relocate_section): Check for placeholder symbols.
7312
7313         * testsuite/Makefile.am (plugin_test_8): New test.
7314         (plugin_test_9): New test.
7315         * testsuite/Makefile.in: Regenerate.
7316
7317 2010-06-09  Nick Clifton  <nickc@redhat.com>
7318
7319         * yyscript.y (input_list_element): Allow strings prefixed with
7320         the '-' character.  Treat these as libraries.
7321         * script.cc (script_add_library): New function.  Adds a library
7322         specified by "-l<name>" found in an input script.
7323         * script-c.h: Add prototype for script_add_library.
7324
7325 2010-06-07  Doug Kwan  <dougkwan@google.com>
7326
7327         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7328         Restrict stub-group size to be within long conditional branch
7329         range when working around cortex-A8 erratum.
7330
7331 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7332
7333         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7334         #ifdef typo.
7335
7336 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7337
7338         PR gold/11658
7339         * output.cc
7340         (Output_section::Input_section_sort_entry::compare_section_ordering):
7341         Change to return non-zero correctly.
7342         (Output_section::Input_section_sort_section_order_index_compare
7343         ::operator()): Change to fix ambiguity in comparisons.
7344
7345 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7346
7347         * gold.h (is_wildcard_string): New function.
7348         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7349         (Layout::layout_eh_frame): Ditto.
7350         (Layout::find_section_order_index): New method.
7351         (Layout::read_layout_from_file): New method.
7352         * layout.h (Layout::find_section_order_index): New method.
7353         (Layout::read_layout_from_file): New method.
7354         (Layout::input_section_position_): New private member.
7355         (Layout::input_section_glob_): New private member.
7356         * main.cc (main): Call read_layout_from_file here.
7357         * options.h (--section-ordering-file): New option.
7358         * output.cc (Output_section::input_section_order_specified_): New
7359         member.
7360         (Output_section::Output_section): Initialize new member.
7361         (Output_section::add_input_section): Add new parameter.
7362         Keep input sections when --section-ordering-file is used.
7363         (Output_section::set_final_data_size): Sort input sections when
7364         section ordering file is specified.
7365         (Output_section::Input_section_sort_entry): Add new parameter.
7366         Check sorting type.
7367         (Output_section::Input_section_sort_entry::compare_section_ordering):
7368         New method.
7369         (Output_section::Input_section_sort_compare::operator()): Change to
7370         consider section_order_index.
7371         (Output_section::Input_section_sort_init_fini_compare::operator()):
7372         Change to consider section_order_index.
7373         (Output_section::Input_section_sort_section_order_index_compare
7374         ::operator()): New method.
7375         (Output_section::sort_attached_input_sections): Change to sort
7376         according to section order when specified.
7377         (Output_section::add_input_section<32, true>): Add new parameter.
7378         (Output_section::add_input_section<64, true>): Add new parameter.
7379         (Output_section::add_input_section<32, false>): Add new parameter.
7380         (Output_section::add_input_section<64, false>): Add new parameter.
7381         * output.h (Output_section::add_input_section): Add new parameter.
7382         (Output_section::input_section_order_specified): New
7383         method.
7384         (Output_section::set_input_section_order_specified): New method.
7385         (Input_section::Input_section): Initialize section_order_index_.
7386         (Input_section::section_order_index): New method.
7387         (Input_section::set_section_order_index): New method.
7388         (Input_section::section_order_index_): New member.
7389         (Input_section::Input_section_sort_section_order_index_compare): New
7390         struct.
7391         (Output_section::input_section_order_specified_): New member.
7392         * script-sections.cc (is_wildcard_string): Delete and move modified
7393         method to gold.h.
7394         (Output_section_element_input::Output_section_element_input): Modify
7395         call to is_wildcard_string.
7396         (Output_section_element_input::Input_section_pattern
7397         ::Input_section_pattern): Ditto.
7398         (Output_section_element_input::Output_section_element_input): Ditto.
7399         * testsuite/Makefile.am (final_layout): New test case.
7400         * testsuite/Makefile.in: Regenerate.
7401         * testsuite/final_layout.cc: New file.
7402         * testsuite/final_layout.sh: New file.
7403
7404 2010-06-01  Rafael Espindola  <espindola@google.com>
7405
7406         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7407
7408 2010-06-01  Rafael Espindola  <espindola@google.com>
7409
7410         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7411         visibility of symbols.
7412
7413 2010-05-27  Doug Kwan  <dougkwan@google.com>
7414
7415         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7416         from start of output section instead of address for a local symbol
7417         in a merged or relaxed section when doing a relocatable link.
7418
7419 2010-05-26  Rafael Espindola  <espindola@google.com>
7420
7421         PR 11604
7422         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7423         adding sections the garbage collector removed.
7424         * gold/testsuite/Makefile.am: Add test.
7425         * gold/testsuite/Makefile.in: Regenerate.
7426         * gold/testsuite/plugin_test_7.sh: New.
7427         * gold/testsuite/plugin_test_7_1.c: New.
7428         * gold/testsuite/plugin_test_7_2.c: New.
7429
7430 2010-05-26  Rafael Espindola  <espindola@google.com>
7431
7432         * script-sections.cc (Output_section_definition::set_section_addresses):
7433         Check for --section-start.
7434
7435 2010-05-26  Doug Kwan  <dougkwan@google.com>
7436
7437         * arm.cc (Arm_scan_relocatable_relocs): New class.
7438         (Target_arm::relocate_special_relocatable): New method.
7439         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7440         (Arm_relocate_functions::thumb_branch_common): Same.
7441         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7442         instead of Default_scan_relocatable_relocs.
7443         * target-reloc.h (relocate_for_relocatable): Let target handle
7444         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7445         * target.h (Sized_target::relocate_special_relocatable): New method.
7446
7447 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7448
7449         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7450
7451 2010-05-23  Doug Kwan  <dougkwan@google.com>
7452
7453         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7454         instead of a cast.
7455         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7456         with a direct branch, not a conditional branch, to a stub.
7457         * merge.cc (Output_merge_base::record_input_section): New method
7458         defintion.
7459         (Output_merge_data::do_add_input_section): Record input section if
7460         keeps-input-sections flag is set.
7461         (Output_merge_string::do_add_input_section): Ditto.
7462         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7463         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7464         INPUT_SECTIONS_.
7465         (Output_merge_base::keeps_input_sections,
7466         Output_merge_base::set_keeps_input_sections,
7467         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7468         method definitions.
7469         (Output_merge_base::Input_sections): New type declaration.
7470         (Output_merge_base::input_sections_begin,
7471         Output_merge_base::input_sections_end,
7472         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7473         (Output_merge_base::bool keeps_input_sections_,
7474         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7475         Output_merge_base::input_sections_): New data members.
7476         (Output_merge_data::do_set_keeps_input_sections): New method
7477         defintion.
7478         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7479         * output.cc (Output_section::Input_section::relobj): Move method
7480         defintion from class declaration to here and handle merge sections.
7481         (Output_section::Input_section::shndx): Ditto.
7482         (Output_section::Output_section): Remove initializations of removed
7483         data members and initialize new data member LOOKUP_MAPS_.
7484         (Output_section::add_input_section): Set keeps-input-sections flag
7485         for a newly created merge output section as appropriate.  Adjust code
7486         to use Output_section_lookup_maps class.
7487         (Output_section::add_relaxed_input_section): Adjst code for lookup
7488         maps code refactoring.
7489         (Output_section::add_merge_input_section): Add a new parameter
7490         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7491         class.  If adding input section to a newly created merge output
7492         section fails, remove the new merge section.
7493         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7494         Adjust code for use of the Output_section_lookup_maps class.
7495         (Output_section::find_merge_section): Ditto.
7496         (Output_section::build_lookup_maps): New method defintion.
7497         (Output_section::find_relaxed_input_section): Adjust code to use
7498         Output_section_lookup_maps class.
7499         (Output_section::get_input_sections): Export merge sections.  Adjust
7500         code to use Output_section_lookup_maps class.
7501         (Output_section:::add_script_input_section): Adjust code to use
7502         Output_section_lookup_maps class.  Update lookup maps for merge
7503         sections also.
7504         (Output_section::discard_states): Use Output_section_lookup_maps.
7505         (Output_section::restore_states): Same.
7506         * output.h (Merge_section_properties): Move class defintion out of
7507         Output_section.
7508         (Output_section_lookup_maps): New class.
7509         (Output_section::Input_section::is_merge_section): New method
7510         defintion.
7511         (Output_section::Input_section::relobj): Move defintion out of class
7512         defintion.  Declare method only.
7513         (Output_section::Input_section::shndx): Ditto.
7514         (Output_section::Input_section::output_merge_base): New method defintion.
7515         (Output_section::Input_section::u2_.pomb): New union field.
7516         (Output_section::Merge_section_by_properties_map,
7517         Output_section::Output_section_data_by_input_section_map,
7518         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7519         Remove types.
7520         (Output_section::add_merge_input_section): Add new parameter
7521         KEEPS_INPUT_SECTIONS.
7522         (Output_section::build_lookup_maps): New method declaration.
7523         (Output_section::merge_section_map_,
7524         Output_section::merge_section_by_properties_map_,
7525         Output_section::relaxed_input_section_map_,
7526         Output_section::is_relaxed_input_section_map_valid_): Remove data
7527         members.
7528         (Output_section::lookup_maps_): New data member.
7529
7530 2010-05-21  Doug Kwan  <dougkwan@google.com>
7531
7532         PR gold/11619
7533         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7534         avoid a compilation error.
7535
7536 2010-05-19  Rafael Espindola  <espindola@google.com>
7537
7538         * script-sections.cc (Output_section_definition::allocate_to_segment):
7539         Update the phdrs_list even when the output section is NULL.
7540         * testsuite/Makefile.am: Add test.
7541         * testsuite/Makefile.in: Regenerate.
7542         * testsuite/script_test_9.cc: New.
7543         * testsuite/script_test_9.sh: New.
7544         * testsuite/script_test_9.t: New.
7545
7546 2010-05-19  Doug Kwan  <dougkwan@google.com>
7547
7548         * arm.cc (Arm_input_section::original_size): New method.
7549         (Arm_input_section::do_addralign): Add a cast.
7550         (Arm_input_section::do_output_offset): Remove static cast.
7551         (Arm_input_section::original_addralign,
7552          Arm_input_section::original_size_): Change type to uint32_t.
7553         (Arm_input_section::init): Add safe casts for section alignment
7554         and size.
7555         (Arm_input_section::set_final_data_size): Do not set address and
7556         offset of stub table.
7557         (Arm_output_section::fix_exidx_coverage): Change use of of
7558         Output_section::Simple_input_section to that of
7559         Output_section::Input_section.
7560         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7561         except for the first pass.
7562         * output.cc (Output_section::get_input_sections): Change type of
7563         input_sections to std::list<Input_section>.
7564         (Output_section::add_script_input_section): Rename from
7565         Output_section::add_simple_input_section.  Change type of SIS
7566         parameter from Simple_input_section to Input_section.
7567         * output.h (Output_section::Simple_input_section): Remove class.
7568         (Output_section::Input_section): Change class visibility to public.
7569         (Output_section::Input_section::addralign): Use stored alignments
7570         for special input sections if set.
7571         (Output_section::Input_section::set_addralign): New method.
7572         (Output_section::get_input_sections): Change parameter type from
7573         list of Simple_input_section to list of Input_section.
7574         (Output_section::add_script_input_section): Rename from
7575         Output_section::add_simple_input_section. Change first parameter's
7576         type from Simple_input_section to Input_section and remove the
7577         second and third parameters.
7578         * script-sections.cc (Input_section::Input_section_list): Change
7579         type to list of Output_section::Input_section/
7580         (Input_section_info::Input_section_info): Change parameter type of
7581         INPUT_SECTION to Output_section::Input_section.
7582         (Input_section_info::input_section): Change return type.
7583         (Input_section_info::input_section_): Change type to
7584         Output_section::Input_section.
7585         (Output_section_element_input::set_section_addresses): Adjust code
7586         to use Output_section::Input_section instead of
7587         Output_section::Simple_input_section.  Adjust code for renaming
7588         of Output_section::add_simple_input_section.
7589         (Orphan_output_section::set_section_addresses): Ditto.
7590
7591 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7592
7593         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7594         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7595
7596 2010-05-18  Rafael Espindola  <espindola@google.com>
7597
7598         * options.cc (General_options::finalize): Handle -nostdlib.
7599         * options.h (nostdlib): New option.
7600         * script.cc (script_add_search_dir): Handle -nostdlib.
7601
7602 2010-05-12  Doug Kwan  <dougkwan@google.com>
7603
7604         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7605         attributes section only if there no attributes section after merging.
7606         (Target_arm::merge_object_attributes): Move value of
7607         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7608         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7609         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7610         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7611         and arm_attr_merge_7.stdout.
7612         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7613         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7614         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7615         arm_attr_merge_7b.o): New rules.
7616         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7617         arm_attr_merge_7
7618         * testsuite/Makefile.in: Regenerate.
7619         * testsuite/arm_attr_merge.sh: New file.
7620         * testsuite/arm_attr_merge_[67][ab].s: Same.
7621
7622 2010-05-05  Nick Clifton  <nickc@redhat.com>
7623
7624         * po/es.po: Updated Spanish translation.
7625
7626 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7627
7628         * Makefile.am (install-exec-local): Properly install gold as
7629         default cross linker.
7630         * Makefile.in: Regenerated.
7631
7632 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7633             Nick Clifton  <nickc@redhat.com>
7634
7635         * configure.ac (install_as_default): Define and set to false
7636         unless --enable-gold or --enable-gold=both/gold has been
7637         specified.
7638         * configure: Regenerate.
7639
7640         * Makefile.am (install-exec-local): Install the executable as
7641         'ld.gold'.  If install_as_default is true then also install it as
7642         'ld'.
7643         * Makefile.in: Regenerated.
7644
7645 2010-04-24  Ian Lance Taylor  <iant@google.com>
7646
7647         * layout.cc (Layout::layout_reloc): In relocatable link don't
7648         combine reloc sections for grouped sections.
7649
7650 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7651
7652         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7653         sections that are not ordinary to icf.
7654         * icf.cc (get_section_contents): Handle relocation pointing to section
7655         with no object or shndx information.
7656         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7657         * testsuite/Makefile.in: Regenerate.
7658         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7659         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7660
7661 2010-04-22  Ian Lance Taylor  <iant@google.com>
7662
7663         * expression.cc (Expression::Expression_eval_info): Add
7664         result_alignment_pointer field.
7665         (Expression::eval_with_dot): Add result_alignment_pointer
7666         parameter.  Change all callers.
7667         (Expression::eval_maybe_dot): Likewise.
7668         (class Binary_expression): Add alignment_pointer parameter to
7669         left_value and right_value.  Change all callers.
7670         (BINARY_EXPRESSION): Set result alignment.
7671         (class Trinary_expression): Add alignment_pointer parameter to
7672         arg2_value and arg3_value.  Change all callers.
7673         (Trinary_cond::value): Set result alignment.
7674         (Max_expression::value, Min_expression::value): Likewise.
7675         (Align_expression::value): Likewise.
7676         * script-sections.cc (class Sections_element): Add dot_alignment
7677         parameter to set_section_addresses virtual function.  Update
7678         instantiations.
7679         (class Output_section_element): Likewise.
7680         (Script_sections::create_segments): Add dot_alignment parameter.
7681         Change all callers.
7682         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7683         (Script_sections::set_phdrs_clause_addresses): Likewise.
7684         * script-sections.h: Update declarations.
7685         * script.h: Update declarations.
7686         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7687         min_p_align.
7688         * testsuite/script_test_3.t: Set large alignment.
7689         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7690         segment has expected alignment.
7691
7692 2010-04-22  Nick Clifton  <nickc@redhat.com>
7693
7694         * po/gold.pot: Updated by the Translation project.
7695         * po/vi.po: Updated Vietnamese translation.
7696
7697 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7698
7699         * testsuite/Makefile.am (check_PROGRAMS): Add
7700         icf_virtual_function_folding_test.
7701         * testsuite/Makefile.in: Regenerated.
7702
7703 2010-04-15  Andrew Haley  <aph@redhat.com>
7704
7705         * options.h (merge_exidx_entries): New option.
7706         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7707         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7708         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7709         (Target_arm::merge_exidx_entries): New function.
7710         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7711         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7712         to Arm_exidx_fixup constructor.
7713         Add new arg, merge_exidx_entries.
7714         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7715         Arm_output_section::fix_exidx_coverage.
7716
7717 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7718
7719         * icf.cc (get_section_contents): Check for preemptible functions.
7720         Ignore addend when appropriate.
7721         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7722         section folded.
7723         (add_from_relobj): Check for section folded.
7724         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7725         * symtab.h (should_add_dynsym_entry): Add new parameter.
7726         * target-reloc.h (scan_relocs): Check for section folded.
7727         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7728         Check reloc types for function pointers in shared objects.
7729         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7730         case.
7731         (icf_preemptible_functions_test): New test case.
7732         (icf_string_merge_test): New test case.
7733         * testsuite.Makefile.in: Regenerate.
7734         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7735         bar_glob.  Refactor code.
7736         * testsuite/icf_preemptible_functions_test.cc: New file.
7737         * testsuite/icf_preemptible_functions_test.sh: New file.
7738         * testsuite/icf_string_merge_test.cc: New file.
7739         * testsuite/icf_string_merge_test.sh: New file.
7740         * testsuite/icf_virtual_function_folding_test.cc: New file.
7741         * testsuite/icf_virtual_function_folding_test.sh: New file.
7742
7743 2010-04-14  Doug Kwan  <dougkwan@google.com>
7744
7745         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7746         for local symbol recounting if we remove a section due to ICF.
7747         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7748         there are no regular objects in input.
7749
7750 2010-04-13  Doug Kwan  <dougkwan@google.com>
7751
7752         * arm.cc (Arm_input_section::set_final_data_size): Compute
7753         accurate final data size instead of using current data size.
7754
7755 2010-04-09  Doug Kwan  <dougkwan@google.com>
7756
7757         * layout.cc (Layout::choose_output_section): Handle script section
7758         types.
7759         (Layout::make_output_section_for_script): Add section type parameter.
7760         Handle script section types.
7761         * layout.h (Layout::make_output_section_for_script): Add section
7762         type parameter.
7763         * output.cc (Output_section::Output_section): Initialize data member
7764         is_noload_.
7765         (Output_section::do_reset_address_and_file_offset): Do not set address
7766         to 0 if section is a NOLOAD section.
7767         * output.h (Output_section::is_noload): New method.
7768         (Output_section::set_is_noload): Ditto.
7769         (Output_section::is_noload_): New data member.
7770         * script-c.h (Script_section_type): New enum type.
7771         (struct Parser_output_section_header): Add new file section_type.
7772         * script-sections.cc (Sections_element::output_section_name): Add
7773         parameter for returning script section type.
7774         (Output_section_definition::output_section_name): Ditto.
7775         (Output_section_definition::section_type)P; New method.
7776         (Output_section_definiton::script_section_type_name): Ditto.
7777         (Output_section_definition::script_section_type_): New data member.
7778         (Output_section_definition::Output_section_definition): Initialize
7779         data member Output_section_definition::script_section_type_.
7780         (Output_section_definition::create_sections): Pass script section type
7781         to Layout::make_output_section_for_script.
7782         (Output_section_definition::output_section_name): Return script
7783         section type to caller.
7784         (Output_section_definition::set_section_address): Do not advance
7785         dot value and load address if section type is NOLOAD.  Set address
7786         of NOLOAD sections regardless of section flags.
7787         (Output_section_definition::print): Print section type if it is
7788         not SCRIPT_SECTION_TYPE_NONE.
7789         (Output_section_definition::section_type): New method.
7790         (Output_section_definition::script_section_type_name): Ditto.
7791         (Script_sections::output_section_name): Add new parameter
7792         PSECTION_TYPE for returning script section type.  Pass it to
7793         section elements.  Handle discard sections.
7794         (Sort_output_sections::operator()): Handle NOLOAD sections.
7795         * script-sections.h (Script_sections::Section_type): New enum type.
7796         (Script_sections::output_section_name): Add a new parameter for
7797         returning script section type.
7798         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7799         INFO and NOLOAD.
7800         * yyscript.y (union): Add new field SECTION_TYPE.
7801         (COPY, DSECT, INFO, NOLOAD): New tokens.
7802         (opt_address_and_section_type): Change type to output_section_header.
7803         (section_type): New non-terminal
7804         (section_header): Handle section type.
7805         (opt_address_and_section_type): Return section type value.
7806
7807 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7808
7809         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7810         * testsuite/plugin_common_test_2.c (foo): Likewise.
7811
7812 2010-04-08  Doug Kwan  <dougkwan@google.com>
7813
7814         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7815         Output_merge_data.
7816         * output.cc (Output_section::add_merge_input_section): Simplify
7817         code and return status of Output_merge_base::add_input_section.
7818         Update merge section map only if Output_merge_base::add_input_section
7819         returns true.
7820
7821 2010-04-07  Doug Kwan  <dougkwan@google.com>
7822
7823         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7824         if section is marked as containing instructions but has no mapping
7825         symbols.
7826         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7827         correct section index.
7828         (Arm_relobj::find_linked_text_section): Ditto.
7829
7830 2010-04-07  Cary Coutant  <ccoutant@google.com>
7831
7832         * archive.cc (include_member): Destroy Read_symbols_data object before
7833         releasing file.
7834         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7835         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7836         (Read_symbols_data::~Read_symbols_data) New destructor.
7837         (Section_relocs::Section_relocs) New constructor.
7838         (Section_relocs::~Section_relocs) New destructor.
7839         (Read_relocs_data::Read_relocs_data) New constructor.
7840         (Read_relocs_data::~Read_relocs_data) New destructor.
7841         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7842         pointers to NULL after deleting.
7843
7844 2010-04-07  Doug Kwan  <dougkwan@google.com>
7845
7846         * arm.cc: Replace "endianity" with "endianness" in comments.
7847         (Arm_exidx_cantunwind): Ditto.
7848         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7849         (Arm_relobj::merge_flags_and_attributes): New method.
7850         (Arm_relobj::merge_flags_and_attributes_): New data member.
7851         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7852         (Arm_relobj::scan_sections_for_stubs): Ditto.
7853         (Arm_relobj::do_read_symbols): Check to see if we really want to
7854         merge processor-specific flags and attributes.  Exit early if
7855         an object is empty except for section names and the undefined symbol.
7856         (Target_arm::do_finalize_sections): Move check for ELF format to
7857         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7858         attributes from a regular object only when we have determined that
7859         it is aapropriate.  Do not create an .ARM.attributes section in
7860         output if there is no regular input object.
7861         (Target_arm::merge_processor_specific_flags): Check
7862         --warn-mismatch before printing any error.
7863         (Target_arm::merge_object_attributes): Ditto.
7864         * gold.cc (queue_middle_tasks): Handle the case in which there is
7865         no regular object in input.
7866         * options.cc (General_options::parse_EB): New method.
7867         (General_options::parse_EL): Same.
7868         (General_options::General_options): Initialize endianness_.
7869         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7870         New options.
7871         (General_options::Endianness): New enum.
7872         (General_options::endianness): New method.
7873         (General_options::endianness_): New data member.
7874         * parameters.cc (Parameters::set_options): Check target endianness.
7875         (Parameters::set_target_once): Ditto.
7876         (Parameters::check_target_endianness): New method.
7877         (parameters_force_valid_target): If either -EL or -EB is specified,
7878         use it to define endianness of default target.
7879         * parameters.h (Parameters::check_target_endianness): New method
7880         declaration.
7881         * target.h (class Target): Change "endianity" to "endianness"
7882         in comments.
7883
7884 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7885
7886         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7887         * configure: Regenerate.
7888         * Makefile.in: Regenerate.
7889         * testsuite/Makefile.in: Regenerate.
7890
7891 2010-04-06  Cary Coutant  <ccoutant@google.com>
7892
7893         gcc PR lto/42757
7894         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7895         prevailing definitions of common symbols.
7896         * testsuite/plugin_test_6.sh: New test case.
7897         * testsuite/plugin_common_test_1.c: New test case.
7898         * testsuite/plugin_common_test_2.c: New test case.
7899         * testsuite/Makefile.am (plugin_test_6): New test case.
7900         * testsuite/Makefile.in: Regenerate.
7901
7902 2010-04-06  Nick Clifton  <nickc@redhat.com>
7903
7904         * po/vi.po: New Vietnamese translation.
7905
7906 2010-03-30  Doug Kwan  <dougkwan@google.com>
7907
7908         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7909
7910 2010-03-25  Doug Kwan  <dougkwan@google.com>
7911
7912         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7913         to avoid a conversion warning on a 32-bit host.
7914
7915 2010-03-24  Ian Lance Taylor  <iant@google.com>
7916
7917         * testsuite/script_test_3.t: Add a TLS segment.
7918         * testsuite/Makefile.am (check_PROGRAMS): Add
7919         tls_phdrs_script_test.
7920         (tls_phdrs_script_test_SOURCES): Define.
7921         (tls_phdrs_script_test_DEPENDENCIES): Define.
7922         (tls_phdrs_script_test_LDFLAGS): Define.
7923         (tls_phdrs_script_test_LDADD): Define.
7924         * testsuite/Makefile.in: Rebuild.
7925
7926 2010-03-23  Cary Coutant  <ccoutant@google.com>
7927
7928         * fileread.cc (find_or_make_view): Fix comment.
7929
7930 2010-03-23  Ian Lance Taylor  <iant@google.com>
7931
7932         * script-sections.cc (class Orphan_section_placement): Define
7933         PLACE_TLS and PLACE_TLS_BSS.
7934         (Orphan_section_placement::Orphan_section_placement): Initialize
7935         new places.
7936         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7937         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7938         (tls_script_test_SOURCES): Define.
7939         (tls_script_test_DEPENDENCIES): Define.
7940         (tls_script_test_LDFLAGS): Define.
7941         (tls_script_test_LDADD): Define.
7942         * testsuite/Makefile.in: Rebuild.
7943
7944 2010-03-22  Doug Kwan  <dougkwan@google.com>
7945
7946         * arm.cc (Arm_relocate_functions::abs8,
7947         Arm_relocate_functions::abs16): Use correct check for overflow
7948         specified in the ARM ELF specs.
7949         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7950         target of a BLX instruction specially.
7951         (Reloc_stub::stub_type_for_reloc): Ditto.
7952         (Relocate::relocate): Use symbolic names instead of numeric relocation
7953         codes to report error.
7954         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7955         workaround.
7956         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7957         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7958         thumb2_blx_out_of_range.stdout
7959         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7960         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7961         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7962         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7963         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7964         thumb2_blx_in_range, thumb2_blx_in_range.o,
7965         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7966         thumb2_blx_out_of_range.o): New rules.
7967         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7968         thumb2_blx_in_range and thumb2_blx_out_of_range.
7969         * testsuite/Makefile.in: Regenerate.
7970         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7971         * testsuite/thumb_blx_in_range.s: New file.
7972         * testsuite/thumb_blx_out_of_range.s: New file.
7973
7974 2010-03-22  Rafael Espindola  <espindola@google.com>
7975
7976         * archive.cc (Should_include): Move to archive.h.
7977         (should_include_member): Make it a member of Archive.
7978         (Lib_group): New.
7979         (Add_lib_group_symbols): New.
7980         * archive.h: Include options.h.
7981         (Archive_member): Moved from Archive.
7982         (Should_include): Moved from archive.cc.
7983         (Lib_group): New.
7984         (Add_lib_group_symbols): New.
7985         * dynobj.cc (do_should_include_member): New.
7986         * dynobj.h (do_should_include_member): New.
7987         * gold.cc (queue_initial_tasks): Update call to queue.
7988         * main.cc (main): Print lib group stats.
7989         * object.cc (do_should_include_member): New.
7990         * object.h: Include archive.h.
7991         (Object::should_include_member): New.
7992         (Object::do_should_include_member): New.
7993         (Sized_relobj::do_should_include_member): New.
7994         * options.cc (General_options::parse_start_lib): New.
7995         (General_options::parse_end_lib): New.
7996         (Input_arguments::add_file): Handle lib groups.
7997         (Input_arguments::start_group): Check we are not in a lib.
7998         (Input_arguments::start_lib): New.
7999         (Input_arguments::end_lib): New.
8000         * options.h (General_options): Add start_lib and end_lib.
8001         (Input_argument::lib_): New.
8002         (Input_argument::lib): New.
8003         (Input_argument::is_lib): New.
8004         (Input_file_lib): New.
8005         (Input_arguments::in_lib_): New.
8006         (Input_arguments::in_lib): New.
8007         (Input_arguments::start_lib): New.
8008         (Input_arguments::end_lib_): New.
8009         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8010         in unused members as preempted.
8011         (Sized_pluginobj::do_should_include_member): New.
8012         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8013         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8014         return the blocker.
8015         (Read_symbols::do_whole_lib_group): New.
8016         (Read_symbols::do_lib_group): New.
8017         (Read_symbols::do_read_symbols): Handle lib groups.
8018         (Read_symbols::get_name): Handle lib groups.
8019         * readsyms.h (Read_symbols): Add an archive member pointer.
8020         (Read_symbols::do_whole_lib_group): New.
8021         (Read_symbols::do_lib_group): New.
8022         (Read_symbols::member_): New.
8023         * script.cc (read_input_script): Update call to queue_soon.
8024
8025 2010-03-19  Doug Kwan  <dougkwan@google.com>
8026
8027         * arm.cc (Stub_table::Stub_table): Initialize new data members
8028         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8029         (Stub_table::add_reloc_stub): Assign stub offset and update
8030         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8031         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8032         New data members.
8033         (Stub_table::update_data_size_and_addralign): Use
8034         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8035         instead of going over all reloc stubs.
8036         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8037         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8038         Stringpool_template::offset_ to size of Stringpool_char.
8039         (Stringpool_template::new_key_offset): Remove code to initialize
8040         Stringpool_template::offset_.
8041         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8042         Stringpool_template::offset_ to zero.
8043
8044 2010-03-15  Doug Kwan  <dougkwan@google.com>
8045
8046         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8047         offset_.
8048         (Stringpool_template::new_key_offset): New method.
8049         (Stringpool_template::add_string): Assign offsets when adding new
8050         strings.
8051         (Stringpool_template::set_string_offsets): Do not set string offsets
8052         when not optimizing.
8053         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8054         member size_.
8055         (Chunked_vector::clear): Clear size_.
8056         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8057         (Chunked_vector::size): Return size_.
8058         (Chunked_vector::push_back): Use size_ to find insert position.
8059         (Chunked_vector::size_): New data member.
8060         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8061         (Stringpool_template::new_key_offset): New method declaration.
8062         (Stringpool_template::offset_): New data member.
8063
8064 2010-03-15   Rafael Espindola  <espindola@google.com>
8065
8066         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8067         Add_symbols' constructor.
8068         * readsyms.h (Add_symbols): Remove the input_group member.
8069
8070 2010-03-10  Ian Lance Taylor  <iant@google.com>
8071
8072         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8073         target to ask whether a reference to a symbol requires a stack
8074         split.
8075         * target.h (Target::is_call_to_non_split): New function.
8076         (Target::do_is_call_to_non_split): Declare virtual function.
8077         * target.cc: Include "symtab.h".
8078         (Target::do_is_call_to_non_split): New function.
8079         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8080
8081 2010-03-10  Cary Coutant  <ccoutant@google.com>
8082
8083         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8084         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8085         (File_read::open[2]): Add whole_file_view_ to list of views.
8086         (File_read::make_view): Remove test of whole_file_view_.
8087         (File_read::find_or_make_view): Create whole_file_view_ if
8088         necessary.
8089         (File_read::clear_views): Replace bool parameter with enum;
8090         adjust all callers.  Don't delete views with permanent data;
8091         do delete cached views and views from archives if
8092         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8093         if clearing the corresponding view.
8094         * fileread.h (File_read::Clear_views_mode): New enum.
8095         (File_read::View::is_permanent_view): New method.
8096         (File_read::clear_views): Replace bool parameter
8097         with enum; adjust all callers.
8098         * options.h (General_options): Change keep_files_mapped option;
8099         add map_whole_files.
8100         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8101         releasing the file.
8102         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8103         the file.
8104
8105 2010-03-10  David S. Miller  <davem@davemloft.net>
8106
8107         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8108
8109 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8110
8111         * icf.cc (get_section_contents): Add '@' marker after processing the
8112         merge reloc.
8113
8114 2010-03-08  Doug Kwan  <dougkwan@google.com>
8115
8116         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8117         due to a conversion warning.
8118         (Arm_relobj::update_output_local_symbol_count): Check for local
8119         symbol with unset output index.
8120
8121 2010-03-05  Ian Lance Taylor  <iant@google.com>
8122
8123         * options.h (class General_options): Add --spare-dynamic-tags.
8124         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8125         --spare-dynamic-tags.
8126
8127 2010-03-05  Ian Lance Taylor  <iant@google.com>
8128
8129         * incremental.cc: Include "libiberty.h".
8130
8131 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8132
8133         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8134         function, is_info_ member.
8135         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8136         (Versions::Versions): Update caller.
8137         (Versions::define_base_version): Likewise.
8138         (Versions::add_def): Likewise.
8139
8140 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8141
8142         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8143         (Scan::possible_function_pointer_reloc): New function.
8144         (Scan::local_reloc_may_be_function_pointer): Change to call
8145         possible_function_pointer_reloc.
8146         (Scan::global_reloc_may_be_function_pointer): Ditto.
8147         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8148         relocations in ".data.rel.ro._ZTV" section.
8149         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8150         * testsuite/icf_safe_so_test.cc: Ditto.
8151         * testsuite/icf_safe_test.cc: Ditto.
8152         * testsuite/icf_safe_test.sh: Ditto.
8153
8154 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8155             Ian Lance Taylor  <iant@google.com>
8156
8157         * target-reloc.h (relocate_section): Check the symbol table index
8158         for -1U before setting the local symbol index.
8159         (scan_relocatable_relocs): If copying the relocation, record that
8160         the local symbol is required.
8161         * object.h (Symbol_value::is_output_symtab_index_set): New
8162         function.
8163         (Symbol_value::may_be_discarded_from_output_symtab): New
8164         function.
8165         (Symbol_value::has_output_symtab_entry): New function.
8166         (Symbol_value::needs_output_symtab_entry): Remove.
8167         (Symbol_value::output_symtab_index): Make sure the symbol index is
8168         set.
8169         (Symbol_value::set_output_symtab_index): Make sure the symbol
8170         index is not set.  Make sure the new index is valid.
8171         (Symbol_value::set_must_have_output_symtab_entry): New function.
8172         (Symbol_value::has_output_dynsym_entry): New function.
8173         (Symbol_value::set_output_dynsym_index): Make sure the new index
8174         is valid.
8175         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8176         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8177         local symbol if permitted.
8178         (Sized_relobj::do_finalize_local_symbols): Call
8179         is_output_symtab_index_set rather than needs_output_symtab_entry.
8180         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8181         rather than needs_output_symtab_entry.  Call
8182         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8183         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8184         is_output_symtab_index_set rather than needs_output_symtab_entry.
8185         * testsuite/discard_locals_relocatable_test.c: New file.
8186         * testsuite/discard_locals_test.sh: Test -r.
8187         * testsuite/Makefile.am (check_DATA): Add
8188         discard_locals_relocatable_test1.syms,
8189         discard_local_relocatable_test2.syms.
8190         (MOSTLYCLEANFILES): Likewise.  Also add
8191         discard_locals_relocatable_test1.lout and
8192         discard_locals_relocatable_test2.out.
8193         (discard_locals_relocatable_test1.syms): New target.
8194         (discard_locals_relocatable_test.o): New target.
8195         (discard_locals_relocatable_test1.out): New target.
8196         (discard_locals_relocatable_test2.syms): New target.
8197         (discard_locals_relocatable_test2.out): New target.
8198         (various): Add missing ../ld-new dependencies.
8199         * testsuite/Makefile.in: Rebuild.
8200
8201 2010-03-03  Nick Clifton  <nickc@redhat.com>
8202
8203         * po/fi.po: New Finnish translation.
8204
8205 2010-03-01  Doug Kwan  <dougkwan@google.com>
8206
8207         * layout.cc (Layout::Layout): Force section types of .init_array*,
8208         .preinit_array* and .fini_array* sections.
8209         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8210         Fix check of return value of std::string::find.().
8211         (Output_section::Input_section_sort_compare::operator()): Remove
8212         comment about .init_array.
8213         (Output_section::Input_section_sort_init_fini_compare::operator()):
8214         New method.
8215         (Output_section::sort_attached_input_sections): Handle .init_array
8216         and .fini_array specially.
8217         * output.h (Output_section::Inut_section_sort_compare): Update
8218         comment.
8219         (Output_section::Input_section_sort_init_fini_compare): New struct.
8220
8221 2010-02-26  Doug Kwan  <dougkwan@google.com>
8222
8223         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8224         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8225         * testsuite/debug_msg.sh: Avoid matching source line number for
8226         use of global variable undef_int.
8227
8228 2010-02-26  Doug Kwan  <dougkwan@google.com>
8229
8230         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8231         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8232         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8233         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8234         * options.cc (General_options::General_options): Initialize member
8235         fix_v4bx_.
8236         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8237         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8238         and rm_no_fix_v4bx.stdout
8239         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8240         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8241         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8242         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8243         and arm_no_fix_v4bx.
8244         * Makefile.in: Regenerate.
8245         * testsuite/arm_fix_v4bx.s: New file.
8246         * testsuite/arm_fix_v4bx.sh: Ditto.
8247
8248 2010-02-24  Doug Kwan  <dougkwan@google.com>
8249
8250         * arm.cc (Target_arm::got_section): Make the .got section the first
8251         non RELRO section in the data segment.
8252         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8253         suffixes of section names.
8254
8255 2010-02-24  Doug Kwan  <dougkwan@google.com>
8256
8257         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8258         flags and attributes merging if an input file is a binary file.
8259         * fileread.cc (Input_file::open): Record format of original file.
8260         * fileread.h (Input_file::Format): New enum type.
8261         (Input_file::Input_file): Initialize data member format_.
8262         (Input_file::format): New method definition.
8263         (Input_file::format_):: New data member.
8264
8265 2010-02-24  Doug Kwan  <dougkwan@google.com>
8266
8267         * arm.cc (Arm_output_data_got): New class.
8268         (ARM_TCB_SIZE): New constant
8269         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8270         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8271         If user uses a script with a SECTIONS clause, issue only a warning
8272         for a misplaced EXIDX input section.  Otherwise, issue an error.
8273         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8274         garbage collection.
8275         (Target_arm::got_mode_index_entry): Handle static linking.
8276         (Target_arm::Scan::local): Ditto.
8277         (Target_arm::Scan::global): Ditto.
8278         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8279         all incorrectly implemented relocations.
8280         (Target_arm::fix_exidx_coverage): Pass layout to
8281         Arm_output_section::fix_exidx_coverage.
8282         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8283         from ".ARM.exidx." and ".ARM.extab.".
8284
8285 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8286
8287         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8288         section if it does not already exist.
8289         * attributes.cc (Attributes_section_data::Attributes_section_data):
8290         Don't crash if size is zero.
8291
8292 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8293             Ian Lance Taylor  <iant@google.com>
8294
8295         * gold.cc (queue_middle_tasks): If no input files were opened,
8296         exit.
8297         * workqueue.h (Task_function::Task_function): Assert that there is
8298         a blocker.
8299
8300 2010-02-22  Doug Kwan  <dougkwan@google.com>
8301
8302         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8303         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8304         types to avoid warnings due to different uint64_t implementations
8305         on different hosts.
8306
8307 2010-02-21  Doug Kwan  <dougkwan@google.com>
8308
8309         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8310         handling of the maximum backward branch offset.
8311         (Arm_relocate_functions::thumb_branch_common): Ditto.
8312         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8313         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8314         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8315         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8316         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8317         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8318         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8319         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8320         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8321         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8322         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8323         thumb2_bl_out_of_range.o): New rules.
8324         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8325         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8326         thumb2_bl_out_of_range
8327         * testsuite/Makefile.in: Regenerate.
8328         * testsuite/arm_bl_in_range.s: New file.
8329         * testsuite/arm_bl_out_of_range.s: Ditto.
8330         * testsuite/arm_branch_in_range.sh: Ditto.
8331         * testsuite/arm_branch_range.t: Ditto.
8332         * testsuite/thumb2_branch_range.t: Ditto.
8333         * testsuite/thumb_bl_in_range.s: Ditto.
8334         * testsuite/thumb_bl_out_of_range.s: Ditto.
8335         * testsuite/thumb_branch_range.t: Ditto.
8336
8337 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8338
8339         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8340         Add reloc offset information.
8341         * icf.cc (get_section_contents): Change iterators to point to the new
8342         vectors. Add reloc offset information to the contents.
8343         * icf.h (Icf::Sections_reachable_info): New typedef.
8344         (Icf::Sections_reachable_list): New typedef.
8345         (Icf::Offset_info): New typedef.
8346         (Icf::Reloc_info): New struct typedef.
8347         (Icf::Reloc_info_list): New typedef.
8348         (Icf::symbol_reloc_list): Delete method.
8349         (Icf::addend_reloc_list): Delete method.
8350         (Icf::section_reloc_list): Delete method.
8351         (Icf::reloc_info_list): New method.
8352         (Icf::reloc_info_list_): New member.
8353
8354 2010-02-19  Doug Kwan  <dougkwan@google.com>
8355
8356         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8357         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8358         * arm.cc (Arm_relocation_functions): New forward declaration.
8359         (Target_arm::Target_arm): Initialize new data members
8360         got_mod_index_offset_ and tls_base_symbol_defined_.
8361         (Target_arm::Relocate::relocate_tls): New method.
8362         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8363          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8364         New methods.
8365         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8366         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8367         (Target_arm::got_mod_index_offset_,
8368         Target_arm::tls_base_symbol_defined_): New data members.
8369         (Target_arm::Scan::local, Target::Scan::global,
8370         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8371         relocations.
8372
8373 2010-02-18  Doug Kwan  <dougkwan@google.com>
8374
8375         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8376         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8377         text section as a parameter becuase some broken tools may not set
8378         the link in section header.
8379         (Target_arm::has_got_section): New method.
8380         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8381         without any mapping symbol as data only.  Remove warning.
8382         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8383         link in its section header, try to discover the link by inspecting the
8384         REL31 relocation at the beginning of the section.
8385         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8386         in error message.
8387         (Target_arm::Scan::global): Treat any reference to the symbol
8388         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8389
8390 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8391
8392         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8393         (Scan::global_reloc_may_be_function_pointer): New function.
8394         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8395         (Scan::global_reloc_may_be_function_pointer): New function.
8396         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8397         (Scan::global_reloc_may_be_function_pointer): New function.
8398         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8399         (Scan::global_reloc_may_be_function_pointer): New function.
8400         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8401         (Scan::global_reloc_may_be_function_pointer): New function.
8402         (Scan::possible_function_pointer_reloc): New function.
8403         (Target_x86_64::can_check_for_function_pointers): New function.
8404         * gc.h (gc_process_relocs): Scan relocation types to determine if
8405         function pointers were taken for targets that support it.
8406         * icf.cc (Icf::find_identical_sections): Include functions for
8407         folding in safe ICF whose pointer is not taken.
8408         * icf.h (Secn_fptr_taken_set): New typedef.
8409         (fptr_section_id_): New member.
8410         (section_has_function_pointers): New function.
8411         (set_section_has_function_pointers): New function.
8412         (check_section_for_function_pointers): New function.
8413         * options.h: Fix comment for safe ICF option.
8414         * target.h (can_check_for_function_pointers): New function.
8415         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8416         Modify icf_safe_test for X86-64.
8417         * testsuite/Makefile.in: Regenerate.
8418         * testsuite/icf_safe_so_test.cc: New file.
8419         * testsuite/icf_safe_so_test.sh: New file.
8420         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8421         (main): Change to take pointer to function kept_func_3.
8422         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8423         folding is done correctly for X86-64.
8424
8425 2010-02-12  David S. Miller  <davem@davemloft.net>
8426
8427         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8428         is_symbolless parameter.
8429         (Output_reloc<SHT_REL>::is_symbolless): New.
8430         (Output_reloc<SHT_REL>::is_symbolless_): New.
8431         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8432         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8433         (Output_reloc<SHT_RELA>::is_symbolless): New.
8434         (Output_data_reloc::add_global): Handle is_symbolless.
8435         (Output_data_reloc::add_global_relative): Likewise.
8436         (Output_data_reloc::add_local): Likewise.
8437         (Output_data_reloc::add_local_relative): Likewise.
8438         (Output_data_reloc::add_symbolless_global_addend): New.
8439         (Output_data_reloc::add_symbolless_local_addend): New.
8440         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8441         is_symbolless.
8442         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8443         instead of ->is_relative_
8444         (Output_reloc::write): Likewise.
8445         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8446         (Output_reloc::write_rel): Simplify.
8447
8448         * sparc.cc (Target_sparc::Scan::local): Use
8449         ->add_symbolless_local_addend as needed.
8450         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8451         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8452         based upon relocation offset.
8453
8454 2010-02-11  Doug Kwan  <dougkwan@google.com>
8455
8456         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8457         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8458         beginning of function.
8459         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8460         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8461         parameter is_32bit in calls to should_apply_static_reloc.
8462         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8463         (check_DATA): Add arm_abs_global.stdout.
8464         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8465         arm_abs_global.stdout): New rules.
8466         (MOSTLLYCLEANFILES): Add arm_abs_global
8467         * Makefile.in: Regenerate.
8468         * testsuite/arm_abs_global.s: New file.
8469         * testsuite/arm_abs_global.sh: Ditto.
8470         * testsuite/arm_abs_lib.s: Ditto.
8471
8472 2010-02-11  Ian Lance Taylor  <iant@google.com>
8473
8474         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8475         Read_relocs task.
8476         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8477         Allocate_commons_task first.
8478         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8479         task, rather than symtab_lock_.
8480         (Gc_process_relocs::~Gc_process_relocs): New function.
8481         (Gc_process_relocs::is_runnable): Check this_blocker_.
8482         (Gc_process_relocs::locks): Use next_blocker_ rather than
8483         blocker_.
8484         (Scan_relocs::~Scan_relocs): New function.
8485         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8486         symtab_lock_.
8487         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8488         next_blocker_.
8489         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8490         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8491         constructor accordingly.
8492         (class Gc_process_relocs): Likewise.
8493         (class Scan_relocs): Likewise.
8494         * common.h (class Allocate_commons_task): Remove symtab_lock_
8495         field, and corresponding constructor parameter.
8496         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8497         symtab_lock_.
8498         (Allocate_commons_task::locks): Likewise.
8499
8500 2010-02-11  Ian Lance Taylor  <iant@google.com>
8501
8502         * gold-threads.h (class Once): Define.
8503         (class Initialize_lock): Rewrite as child of Once.
8504         * gold-threads.cc (class Once_initialize): Define.
8505         (once_pointer_control): New static variable.
8506         (once_pointer, once_arg): New static variables.
8507         (c_run_once): New static function.
8508         (Once::Once, Once::run_once, Once::internal_run): New functions.
8509         (class Initialize_lock_once): Remove.
8510         (initialize_lock_control): Remove.
8511         (initialize_lock_pointer): Remove.
8512         (initialize_lock_once): Remove.
8513         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8514         (Initialize_lock::initialize): Rewrite.
8515         (Initialize_lock::do_run_once): New function.
8516         * archive.cc (Archive::interpret_header): Only clear name if it is
8517         not already empty.
8518         * fileread.cc: Include "gold-threads.h"
8519         (file_counts_lock): New static variable.
8520         (file_counts_initialize_lock): Likewise.
8521         (File_read::release): Only increment counts when using --stats.
8522         Use a lock around the increment.
8523         * parameters.cc (class Set_parameters_target_once): Define.
8524         (set_parameters_target_once): New static variable.
8525         (Parameters::Parameters): Move here from parameters.h.
8526         (Parameters::set_target): Rewrite.
8527         (Parameters::set_target_once): New function.
8528         (Parameters::clear_target): Move here and rewrite.
8529         * parameters.h (class Parameters): Update declarations.  Add
8530         set_parameters_target_once_ field.
8531         (Parameters::Parameters): Move to parameters.cc.
8532         (Parameters::clear_target): Likewise.
8533         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8534         task.
8535         (Start_group::~Start_group): New function.
8536         (Start_group::is_runnable): New function.
8537         (Start_group::locks, Start_group::run): New functions.
8538         (Finish_group::run): Change saw_undefined to size_t.
8539         * readsyms.h (class Start_group): Define.
8540         (class Finish_group): Change saw_undefined_ field to size_t.
8541         (Finish_group::Finish_group): Remove saw_undefined and
8542         this_blocker parameters.  Change all callers.
8543         (Finish_group::set_saw_undefined): New function.
8544         (Finish_group::set_blocker): New function.
8545         * symtab.h (class Symbol_table): Change saw_undefined to return
8546         size_t.  Change saw_undefined_ field to size_t.
8547         * target-select.cc (Set_target_once::do_run_once): New function.
8548         (Target_selector::Target_selector): Initialize set_target_once_
8549         field.  Don't initialize lock_ and initialize_lock_ fields.
8550         (Target_selector::instantiate_target): Rewrite.
8551         (Target_selector::set_target): New function.
8552         * target-select.h (class Set_target_once): Define.
8553         (class Target_selector): Update declarations.  Make
8554         Set_target_once a friend.  Remove lock_ and initialize_lock_
8555         fields.  Add set_target_once_ field.
8556
8557 2010-02-10  Ian Lance Taylor  <iant@google.com>
8558
8559         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8560         queueing any tasks.
8561         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8562         (queue_middle_tasks): Add all blockers before queueing any tasks.
8563         (queue_final_tasks): Likewise.
8564         * token.h (Task_token::add_blockers): New function.
8565         * object.h (Input_objects::number_of_relobjs): New function.
8566
8567 2010-02-10  Ian Lance Taylor  <iant@google.com>
8568
8569         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8570         shared, not if not position independent.
8571         * x86_64.cc (Relocate::relocate_tls): Likewise.
8572         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8573         (tls_pie_pic_test): New target.
8574         * testsuite/Makefile.in: Rebuild.
8575
8576         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8577         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8578         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8579         * testsuite/Makefile.in: Rebuild.
8580
8581 2010-02-09  David S. Miller  <davem@davemloft.net>
8582
8583         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8584         R_SPARC_RELATIVE using ->add_local_relative().
8585         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8586
8587         * output.h (Output_data_dynamic::add_section_size): New method
8588         that takes two Output_data objects.
8589         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8590         entry param.  Handle it in initializers.
8591         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8592         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8593         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8594         arg.
8595         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8596         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8597         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8598         for dynrel_includes_plt.
8599         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8600         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8601         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8602         before .rela.plt
8603         (Target_sparc::do_finalize_sections): Update to pass true for
8604         dynrel_includes_plt.
8605         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8606         output before .rela.plt
8607         (Target_powerpc::do_finalize_sections): Update to pass true for
8608         dynrel_includes_plt when 32-bit.
8609
8610 2010-02-08  Doug Kwan  <dougkwan@google.com>
8611
8612         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8613         method.
8614         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8615         Arm_relobj::scan_section_for_cortex_a8_stubs,
8616         Arm_relobj::do_relocation_section): Instead of calling
8617         Output_section::output_address, use faster
8618         Arm_relobj::simple_input_section_output_address.
8619
8620 2010-02-08  David S. Miller  <davem@davemloft.net>
8621
8622         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8623         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8624         relocation helper function.
8625
8626         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8627         just like R_SPARC_GOT{10,13,22}.
8628         (Target_sparc::Scan::local): Likewise.
8629         (Target_sparc::Relocate:relocate): Likewise.
8630
8631 2010-02-06  Ian Lance Taylor  <iant@google.com>
8632
8633         * configure.ac: Rewrite targetobjs duplicate removal code to use
8634         only shell constructs.
8635         * configure: Rebuild.
8636
8637 2010-02-05  Doug Kwan  <dougkwan@google.com>
8638
8639         PR 11247
8640         * arm.cc (Arm_relobj::section_is_scannable): New method.
8641         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8642         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8643
8644 2010-02-04  Doug Kwan  <dougkwan@google.com>
8645
8646         PR 11247
8647         * arm-reloc-property.cc (cstdio): Include.
8648         * configure.ac (targetobjs): Remove duplicates.
8649         * configure: Regenerate.
8650         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8651         big and little endian version for a given address size.
8652
8653 2010-02-03  Doug Kwan  <dougkwan@google.com>
8654
8655         * arm-reloc-property.cc
8656         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8657         definition.
8658         * arm-reloc-property.h
8659         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8660         New method definition.
8661         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8662         declaration.
8663         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8664         overflow to N.
8665         (GOT_PREL): Change implemented to Y.
8666         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8667         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8668         (Arm_relocate_functions::movw_abs_nc): Remove method.
8669         (Arm_relocate_functions::movt_abs): Ditto.
8670         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8671         (Arm_relocate_functions::thm_movt_abs): Ditto.
8672         (Arm_relocate_functions::movw_rel_nc): Ditto.
8673         (Arm_relocate_functions::movw_rel): Ditto.
8674         (Arm_relocate_functions::movt_rel): Ditto.
8675         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8676         (Arm_relocate_functions:thm_movw_rel): Ditto.
8677         (Arm_relocate_functions:thm_movt_rel): Ditto.
8678         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8679         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8680         New method definitions.
8681         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8682         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8683         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8684         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8685         (Target_arm::Relocate::relocate): Check for non-static or
8686         unimplemented relocation code and exit early.  Change calls to
8687         Target_arm::reloc_uses_thumb_bit and
8688         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8689         instead.  Refactor code to handle similar relocations to increase
8690         code sharing.  Remove check for unsupported relocation code in switch
8691         statement.
8692         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8693         relocation property table to find out size.  Change error message to
8694         print out the name of a relocation code instead of the numeric value.
8695         (Target_arm::scan_reloc_for_stub): Use relocation property table
8696         instead of calling Target_arm::reloc_uses_thumb_bit().
8697
8698 2010-02-02  Doug Kwan  <dougkwan@google.com>
8699
8700         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8701         types of relaxed input section.
8702
8703 2010-02-02  Doug Kwan  <dougkwan@google.com>
8704
8705         * Makefile.am (HFILES): Add arm-reloc-property.h.
8706         (DEFFILES): New.
8707         (TARGETSOURCES): Add arm-reloc-property.cc
8708         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8709         (libgold_a_SOURCES): $(DEFFILES)
8710         * Makefile.in: Regenerate.
8711         * arm-reloc-property.cc: New file.
8712         * arm-reloc-property.h: New file.
8713         * arm-reloc.def: New file.
8714         * arm.cc: Update comments.
8715         (arm-reloc-property.h): New included header.
8716         (arm_reloc_property_table): New global variable.
8717         (Target_arm::do_select_as_default_target): New method definition.
8718         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8719         arm-reloc-property to targ_extra_obj.
8720         * parameters.cc (set_parameters_target): Call
8721         Target::select_as_default_target().
8722         * target.h (Target::select_as_default_target): New method definition.
8723         (Target::do_select_as_default_target): Same.
8724
8725 2010-02-01  Doug Kwan  <dougkwan@google.com>
8726
8727         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8728         first_output_text_section_.
8729         (Arm_exidx_fixup::first_output_text_section): New method definition.
8730         (Arm_exidx_fixup::first_output_text_section_): New data member.
8731         (Arm_exidx_fixup::process_exidx_section): Record the first text
8732         output section seen.
8733         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8734         and entsize in output section header.
8735
8736 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8737
8738         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8739         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8740         (Arm_relocate_functions::thm_alu11): New Method.
8741         (Arm_relocate_functions::thm_pc8): New Method.
8742         (Arm_relocate_functions::thm_pc12): New Method.
8743         (Target_arm::Scan::local): Handle the relocations.
8744         (Target_arm::Scan::global): Likewise.
8745         (Target_arm::Relocate::relocate): Likewise.
8746         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8747
8748 2010-01-29  Doug Kwan  <dougkwan@google.com>
8749
8750         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8751         of relocation types as ld.
8752
8753 2010-01-29  Doug Kwan  <dougkwan@google.com>
8754
8755         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8756         to public.
8757         (Arm_relocate_functions::thumb_branch_common): Ditto.
8758         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8759         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8760         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8761         Arm_relocate_functions::jump24): Remove.
8762         (Target_arm::Relocate::relocate): Adjust code to call
8763         Arm_relocation_functions::arm_branch_common and
8764         Arm_relocation_functions::thumb_branch_common instead of their removed
8765         wrappers.  Merge switch-cases together to reduce source code size.
8766
8767 2010-01-29  Doug Kwan  <dougkwan@google.com>
8768
8769         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8770         output_local_symbol_count_needs_update_.
8771         (Arm_relobj::output_local_symbol_count_needs_update,
8772          Arm_relobj::set_output_local_symbol_count_needs_update,
8773          Arm_relobj::update_output_local_symbol_count): New methods.
8774         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8775         member.
8776         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8777         of pointed function as in a R_ARM_PREL31 relocation.
8778         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8779         for output local symbol count updating.
8780         (Target_arm::do_relax): Update output local symbol counts in objects
8781         if necessary.
8782         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8783
8784 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8785
8786         * arm.cc: Added support for the ARM relocations:
8787         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8788         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8789         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8790         movw_prel_nc).
8791         (Arm_relocate_functions::movw_rel): New method.
8792         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8793         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8794         thm_movw_prel_nc).
8795         (Arm_relocate_functions::thm_movw_rel): New method.
8796         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8797         thm_movt_prel).
8798         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8799         relocations.
8800         (Target_arm::Scan::global): Likewise.
8801         (Target_arm::Relocate::relocate): Likewise.
8802         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8803         Likewise.
8804
8805 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8806
8807         * arm.cc: Added support for ARM group relocations.
8808         (Target_arm::reloc_needs_sym_origin): New method.
8809         (Arm_relocate_functions::calc_grp_kn): New method.
8810         (Arm_relocate_functions::calc_grp_residual): New method.
8811         (Arm_relocate_functions::calc_grp_gn): New method.
8812         (Arm_relocate_functions::arm_grp_alu): New Method.
8813         (Arm_relocate_functions::arm_grp_ldr): New Method.
8814         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8815         (Arm_relocate_functions::arm_grp_ldc): New Method.
8816         (Target_arm::Scan::local): Handle the ARM group relocations.
8817         (Target_arm::Scan::global): Likewise.
8818         (Target_arm::Relocate::relocate): Likewise.
8819         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8820         Likewise.
8821
8822 2010-01-26  Doug Kwan  <dougkwan@google.com>
8823
8824         * arm.cc (set): Include.
8825         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8826         pointer type.
8827         (Arm_output_section::Text_section_list): New type.
8828         (Arm_output_section::append_text_sections_to_list): New method.
8829         (Arm_output_section::fix_exidx_coverage): Ditto.
8830         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8831         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8832         Relobj::set_section_offset() instead of
8833         Sized_relobj::invalidate_section_offset().
8834         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8835         parameter for section headers. Ignore relocation sections for
8836         unallocated sections and EXIDX sections.
8837         (Target_arm::fix_exidx_coverage): New method.
8838         (Target_arm::output_section_address_less_than): New type.
8839         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8840         linked text section instead of the EXIDX section.
8841         (Arm_output_section::create_stub_group): Add an assertion to check
8842         that this is not an EXIDX output section.
8843         (Arm_output_section::append_text_sections_to_list): New method.
8844         (Arm_output_section::fix_exidx_coverage): Ditto.
8845         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8846         Arm_relobj::section_needs_reloc_stub_scanning.
8847         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8848         first pass.
8849         (Target_arm::fix_exidx_coverage): New method.
8850         * object.h (Relobj::set_output_section): New method.
8851         (Sized_relobj::invalidate_section_offset): Remove method.
8852         (Sized_relobj::do_invalidate_section_offset): Remove method.
8853         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8854
8855 2010-01-25  Doug Kwan  <dougkwan@google.com>
8856
8857         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8858         Fix warning due to signed and unsigned comparison on a 32-bit host.
8859
8860 2010-01-22  Doug Kwan  <dougkwan@google.com>
8861
8862         * arm.cc (Target_arm::do_relax): Record an output section for section
8863         offset adjustment it contains any stub table that has changed.
8864         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8865         offsets in an output section if necessary.
8866         * output.cc (Output_section::Output_section): Initialize
8867         section_offsets_need_adjustments_.
8868         (Output_section::add_input_section_for_script): Renamed to
8869         Output_section::add_simple_input_section.
8870         (Output_section::save_states): Add a comment.
8871         (Output_section::discard_states): New method defintion.
8872         (Output_section::adjust_section_offsets): Same.
8873         * output.h (Output_section::add_input_section_for_script): Renamed to
8874         Output_section::add_simple_input_section.
8875         (Output_section::discard_states): New method declaration.
8876         (Output_section::adjust_section_offsets): Same.
8877         (Output_section::section_offsets_need_adjustment,
8878         Output_section::set_section_offsets_need_adjustment): New method
8879         definitions.
8880         (Output_section::section_offsets_need_adjustment_): New data member.
8881         * script-sections.cc
8882         (Output_section_element_input::set_section_address): Adjust code for
8883         renaming of Output_section::add_input_section_for_script.
8884         (Orphan_output_section::set_section_address): Same.
8885
8886 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8887
8888         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8889         Fix_v4bx enum values .
8890         * gold/options.h (General_options): New option definitions.
8891         (General_options::fix_v4bx): New method.
8892         (General_options::Fix_v4bx): New enum.
8893         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8894         (General_options::parse_fix_v4bx_interworking): New method.
8895
8896 2010-01-22  Doug Kwan  <dougkwan@google.com>
8897
8898         * arm.cc (Arm_exidx_fixup): New class.
8899
8900 2010-01-21  Doug Kwan  <dougkwan@google.com>
8901
8902         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8903         classes.
8904         (Arm_exidx_section_offset_map): New type.
8905
8906 2010-01-21  Doug Kwan  <dougkwan@google.com>
8907
8908         * arm.cc (Arm_exidx_input_section): New class.
8909         (Arm_relobj::exidx_input_section_by_link,
8910         Arm_relobj::exidx_input_section_by_shndx,
8911         Arm_relobj::make_exidx_input_section): New methods.
8912         (read_arm_attributes_section): Remove.
8913         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8914         information about them.
8915         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8916         to here.
8917
8918 2010-01-20  Doug Kwan  <dougkwan@google.com>
8919
8920         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8921         Input_section_specifier to Section_id.
8922         (Target_arm::new_arm_input_section: Adjust code for change of key
8923         type.
8924         (Target_arm::find_arm_input_section): Ditto.
8925         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8926         (Section_id): Remove.
8927         (Garbage_collection::Section_id_hash): Remove.
8928         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8929         (Section_id): Remove.
8930         (Icf::Section_id_hash): Remove.
8931         * object.h (Section_id, Const_section_id, Section_id_hash,
8932         Const_section_id_hash): New type definitions.
8933         * output.cc (Output_section::add_relaxed_input_section): Change to
8934         use Const_section_id instead of Input_section_specifier as key type.
8935         (Output_section::add_merge_input_section): Ditto.
8936         (Output_section::build_relaxation_map): Change to use Section_id
8937         instead of Input_section_specifier as key type.
8938         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8939         Ditto.
8940         (Output_section::convert_input_sections_to_relaxed_sections): Change
8941         to use Const_section_id instead of Input_section_specifier as key type.
8942         (Output_section::find_merge_section): Ditto.
8943         (Output_section::find_relaxed_input_section): Ditto.
8944         * output.h (Input_section_specifier): Remove class.
8945         (Output_section::Output_section_data_by_input_section_map): Change
8946         key type to Const_section_id.
8947         (Output_section::Output_relaxed_input_section_by_input_section_map):
8948         Ditto.
8949         (Output_section::Relaxation_map): Change key type to Section_id.
8950
8951 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8952
8953         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8954         (class Arm_v4bx_stub): New class.
8955         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8956         (Stub_factory::make_arm_v4bx_stub): New method.
8957         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8958         (Stub_table::empty): Handle v4bx stubs.
8959         (Stub_table::add_arm_v4bx_stub): New method.
8960         (Stub_table::find_arm_v4bx_stub): New method.
8961         (Arm_relocate_functions::v4bx): New method.
8962         (Target_arm::fix_v4bx): New method.
8963         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8964         (Stub_table::relocate_stubs): Likewise.
8965         (Stub_table::do_write): Likewise.
8966         (Stub_table::update_data_size_and_addralign): Likewise.
8967         (Stub_table::finalize_stubs):  Likewise.
8968         (Target_arm::Scan::local): Likewise.
8969         (Target_arm::Scan::global): Likewise.
8970         (Target_arm::do_finalize_sections): Likewise.
8971         (Target_arm::Relocate::relocate): Likewise.
8972         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8973         Likewise.
8974         (Target_arm::scan_reloc_for_stub): Likewise.
8975         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8976
8977 2010-01-19  Ian Lance Taylor  <iant@google.com>
8978
8979         * output.cc (Output_section_headers::do_sized_write): Write large
8980         segment count to sh_info field.
8981         (Output_file_header::do_sized_write): For large segment count,
8982         write PN_XNUM to e_phnum field.
8983
8984 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8985
8986         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8987         (Arm_relocate_functions::thm_jump8): New function.
8988         (Arm_relocate_functions::thm_jump11): New function.
8989         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8990         R_ARM_THM_JUMP11.
8991         (Target_arm::Scan::global): Likewise.
8992         (Target_arm::Relocate::relocate): Likewise.
8993         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8994         Likewise.
8995
8996 2010-01-14  Doug Kwan  <dougkwan@google.com>
8997
8998         * arm.cc (map, utility): Include headers.
8999         (Target_arm::apply_cortex_a8_workaround): New method.
9000         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9001         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9002         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9003         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9004         the --[no-]fix-cortex-a8 command line options.
9005         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9006         (Target_arm::relocate_stub): Use addend in instruction template.
9007         * options.h (DEFINE_bool): Set the user-set flag.
9008         (General_options): Add --[no-]-fix-cortex options.
9009         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9010         : Update fast look-up map after conversion.
9011
9012 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9013
9014         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9015         in the first pass of do_layout.
9016
9017 2010-01-13  Doug Kwan  <dougkwan@google.com>
9018
9019         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9020         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9021         apparent compiler problem of not folding static constant integral
9022         data members of elfcpp::Elf_sizes<32>.
9023
9024 2010-01-13  Doug Kwan  <dougkwan@google.com>
9025
9026         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9027         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9028         Arm_relobj::scan_section_for_cortex_a8_erratum,
9029         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9030         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9031         sections to scan for relocation stubs into a new method
9032         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9033         relocation and Cortex-A8 stub scanning.
9034         (Target_arm::do_relax): Force stubs to be after stubbed sections
9035         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9036         the beginning of a new relaxation pass.  Update a comment.
9037         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9038
9039 2010-01-12  Ian Lance Taylor  <iant@google.com>
9040
9041         * target-reloc.h (visibility_error): New inline function.
9042         (relocate_section): Call visibility_error.
9043         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9044         (MOSTLYCLEANFILES): Likewise.
9045         (protected_4_pic.o, protected_3.err): New targets.
9046         * testsuite/protected_4.cc: New file.
9047
9048 2010-01-12  Doug Kwan  <dougkwan@google.com>
9049
9050         * arm.cc (Cortex_a8_reloc): New class.
9051         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9052         and cortex_a8_relocs_info_.
9053         (Target_arm::fix_cortex_a8): New method definition.
9054         (Target_arm::Cortex_a8_relocs_info): New type.
9055         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9056         New data member declarations.
9057         (Target_arm::scan_reloc_for_stub): Record information about
9058         relocations for THUMB branches that might be exempted from the
9059         Cortex-A8 workaround.
9060         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9061         at the beginning of a relaxation pass.
9062
9063 2010-01-12  Doug Kwan  <dougkwan@google.com>
9064
9065         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9066         (Arm_relobj::Mapping_symbol_position,
9067          Arm_reloj::Mapping_symbol_position_less,
9068          Arm_relobj::Mapping_symbols_info): New types.
9069         (Target_arm::is_mapping_symbol_name): New method definition.
9070         (Arm_relobj::do_count_local_symbols): Save information about mapping
9071         symbols.
9072
9073 2010-01-11  Doug Kwan  <dougkwan@google.com>
9074
9075         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9076         Arm_relocate_functions::thumb32_branch_upper,
9077         Arm_relocate_functions::thumb32_branch_lower,
9078         Arm_relocate_functions::thumb32_cond_branch_offset,
9079         Arm_relocate_functions::thumb32_cond_branch_upper,
9080         Arm_relocate_functions::thumb32_cond_branch_lower,
9081         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9082         branch offset encoding.
9083         (Arm_relocate_functions::thumb_branch_common): Use new branch
9084         offset encoding methods to avoid code duplication.
9085         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9086         (Stub_addend_reader::operator()): Use new branch encoding method
9087         to avoid code duplication.
9088
9089 2010-01-11  Doug Kwan  <dougkwan@google.com>
9090
9091         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9092         (Target_arm::do_finalize_sections): Define special EXIDX section
9093         symbols only if referenced.
9094         * gc.h (Garbage_collection::add_reference): New method.
9095         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9096         code duplication.
9097
9098 2010-01-11  Ian Lance Taylor  <iant@google.com>
9099
9100         * script.cc (Version_script_info::build_expression_list_lookup):
9101         Change complaing about duplicate wildcard match from error to
9102         warning.
9103
9104         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9105         of 2009-12-30.
9106         (Version_script_info::Version_script_info): Initialize globs_,
9107         default_version_, default_is_global_, and exact_.  Don't
9108         initialize globals_ or locals_.
9109         (Version_script_info::build_lookup_tables): Build local symbols
9110         first.
9111         (Version_script_info::unquote): New function.
9112         (Version_script_info::add_exact_match): New function.
9113         (Version_script_info::build_expression_list_lookup): Remove lookup
9114         parameter.  Add is_global parameter.  Change all callers.  Handle
9115         wildcard pattern specially.  Unquote pattern.  Call
9116         add_exact_match.
9117         (Version_script_info::get_name_to_match): New function.
9118         (Version_script_info::get_symbol_version): New function.
9119         (Version_script_info::get_symbol_version_helper): Remove.
9120         (Version_script_info::check_unmatched_names): Call unquote.
9121         * script.h (class Version_script_info): Change get_symbol_version
9122         to be non-inline and add is_global parameter; change all callers.
9123         Rewrite symbol_is_local.  Update declarations.  Define struct
9124         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9125         Remove globals_ and locals_ members.  Add exact_, globs_,
9126         default_version_, is_global_.
9127         (Version_script_info::Glob): Remove pattern, add expression and
9128         is_global.  Update constructor.  Change all callers.
9129         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9130         default version.
9131         (Versions::symbol_section_contents): If a symbol is undefined, or
9132         defined in a dynamic object, set the version index to
9133         VER_NDX_LOCAL.
9134         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9135         symbol_is_local.
9136         (Symbol_table::add_from_pluginobj): Likewise.
9137         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9138
9139 2010-01-11  Doug Kwan  <dougkwan@google.com>
9140
9141         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9142         (incremental_dump_LDADD): Add linking option for libintl.
9143         * Makefile.in: Regenerate.
9144
9145 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9146
9147         PR gold/11144
9148         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9149         instead of -Ds.
9150         * testsuite/Makefile.in: Regenerated.
9151
9152 2010-01-10  Doug Kwan  <dougkwan@google.com>
9153
9154         * options.h (DEFINE_var): Use parentheses around argument varname__
9155         in macro body to avoid any unintended subsequent substitutions.
9156
9157 2010-01-10  Ian Lance Taylor  <iant@google.com>
9158
9159         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9160         candidates before doing symbol resolution.
9161
9162         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9163         ODR candidates if only one is weak.
9164
9165 2010-01-08  Ian Lance Taylor  <iant@google.com>
9166
9167         * script.cc (Version_script_info::build_expression_list_lookup):
9168         Don't warn about ambiguous version, just record the ambiguity.
9169         (Version_script_info::get_symbol_version_helper): Give error if
9170         version is ambiguous.
9171
9172 2010-01-08  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9175         prev_data_size_ and prev_addralign_.  Remove initializer for
9176         deleted data member has_been_changed_.
9177         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9178         to determine if the table is empty.
9179         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9180         Remove.
9181         (Stub_table::add_reloc_stub): Define method in class definition
9182         instead of just declaring it there.
9183         (Stub_table::add_cortex_a8_stub): New method definition.
9184         (Stub_table::update_data_size_and_addralign): Ditto.
9185         (Stub_table::finalize_stubs): Ditto.
9186         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9187         (Stub_table::do_addralign_): Return address alignment in the
9188         (Stub_table::do_reset_address_and_file_offset): Define method in
9189         class definition instead of declaring it there.  Set current data
9190         size to be the data size of the previous pass.
9191         (Stub_table::set_final_data_size): Use current data size as the
9192         final data size.
9193         (Stub_table::relocate_stub): Change parameter type of stub from
9194         Reloc_stub pointer to Stub pointer.
9195         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9196         (Stub_table::Cortex_a8_stub_list): New typedef.
9197         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9198          Stub_table::prev_addralign_): New data member.
9199         (Arm_relobj::Arm_relobj): Initialize data member
9200         section_has_cortex_a8_workaround_.
9201         (Arm_relobj::section_has_cortex_a8_workaround,
9202          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9203          definitions.
9204         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9205         declarations.
9206         (Target_arm::relocate_stub): Change parameter type of stub from
9207         Reloc_stub pointer to Stub pointer.
9208         (Insn_template::size, Insn_template::alignment): Handle
9209         THUMB16_SPECIAL_TYPE.
9210         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9211          Stub_table::update_data_size_and_addralign,
9212          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9213         definitions.
9214         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9215         (Stub_table::do_write): Ditto.
9216         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9217
9218 2010-01-08  Ian Lance Taylor  <iant@google.com>
9219
9220         PR 11108
9221         * symtab.h (class Symbol): Remove fields is_target_special_ and
9222         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9223         (Symbol::is_defined_in_discarded_section): New function.
9224         (Symbol::set_is_defined_in_discarded_section): New function.
9225         (Symbol::has_plt_offset): Rewrite.
9226         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9227         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9228         Don't initialize is_target_special_ or has_plt_offset_.
9229         Initialize is_defined_in_discarded_section_.
9230         (Symbol_table::add_from_relobj): If appropriate, set
9231         is_defined_in_discarded_section.
9232         * resolve.cc (Symbol::override_base_with_special): Don't test
9233         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9234         * target-reloc.h (relocate_section): Do special handling for
9235         symbols defined in discarded sections for global symbols as well
9236         as local symbols.
9237
9238 2010-01-08  Ian Lance Taylor  <iant@google.com>
9239
9240         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9241         the SHT_SYMTAB case.
9242
9243 2010-01-08  Ian Lance Taylor  <iant@google.com>
9244
9245         * object.cc (Sized_relobj::do_layout): Don't get confused if
9246         layout_eh_frame returns NULL.
9247
9248 2010-01-08  Ian Lance Taylor  <iant@google.com>
9249
9250         PR 11084
9251         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9252         dynamic symbol table, use the normal symbol table.
9253         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9254         symbol table.
9255
9256 2010-01-08  Ian Lance Taylor  <iant@google.com>
9257
9258         PR 11072
9259         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9260         sections.
9261
9262 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9263
9264         * version.cc (print_version): Change to "Copyright 2010".
9265
9266 2010-01-08  Ian Lance Taylor  <iant@google.com>
9267
9268         PR 10287
9269         PR 11063
9270         * i386.cc (class Target_i386): Change return type of plt_section
9271         to be non-const.
9272         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9273         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9274         tls_desc_rel_ field.
9275         (Output_data_plt_i386::rel_tls_desc): New function.
9276         (Target_i386::rel_tls_desc_section): New function.
9277         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9278         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9279         R_386_TLS_DESC reloc in rel_tls_desc_section.
9280         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9281         Define struct Tlsdesc_info.
9282         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9283         (Target_x86_64::do_reloc_symbol_index): New function.
9284         (Target_x86_64::add_tlsdesc_info): New function.
9285         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9286         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9287         tlsdesc_rel_ field.
9288         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9289         all callers.
9290         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9291         (Target_x86_64::rela_tlsdesc_section): New function.
9292         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9293         handling.
9294         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9295         (Target_x86_64::do_reloc_addend): New function.
9296         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9297         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9298         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9299         (Output_reloc::type): New function.
9300         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9301         (Output_reloc::is_target_specific): New function.
9302         (Output_reloc::target_arg): New function.
9303         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9304         absolute relocs and target specific relocs.
9305         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9306         add_target_specific.
9307         (class Output_data_reloc) [SHT_RELA]: Likewise.
9308         * output.cc (Output_reloc::Output_reloc): Add four new versions
9309         for absolute relocs and target specific relocs.
9310         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9311         (Output_reloc::get_symbol_index): Likewise.
9312         (Output_reloc::local_section_offset): Check that local_sym_index_
9313         is not TARGET_CODE or 0.
9314         (Output_reloc::symbol_value): Likewise.
9315         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9316         reloc.
9317         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9318         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9319         functions.
9320         * layout.cc (add_target_dynamic_tags): Use output section for
9321         DT_PLTRELSZ and DT_JMPREL.
9322
9323 2010-01-07  Ian Lance Taylor  <iant@google.com>
9324
9325         PR 11061
9326         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9327         function.
9328         (class Output_data_reloc_generic): Define.
9329         (class Output_data_reloc_base): Change base class to
9330         Output_data_reloc_generic.  Change add() method to call
9331         bump_relative_reloc_count for a relative reloc.  Remove
9332         sort_relocs_ field.
9333         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9334         to sort_relocs().
9335         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9336         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9337         appropriate.
9338         * layout.h (class Layout): Update declaration.
9339
9340 2010-01-07  Ian Lance Taylor  <iant@google.com>
9341
9342         * output.h (class Output_data): Add const version of
9343         output_section and do_output_section.
9344         (class Output_section_data): Add const version of
9345         do_output_section.
9346         (class Output_section): Likewise.
9347         * layout.cc (Layout::add_target_dynamic_tags): New function.
9348         * layout.h (class Layout): Update declarations.
9349         * arm.cc (Target_arm::do_finalize_sections): Use
9350         add_target_dynamic_tags.
9351         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9352         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9353         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9354         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9355
9356 2010-01-07  Ian Lance Taylor  <iant@google.com>
9357
9358         PR 11042
9359         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9360         object as needed.
9361
9362 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9363             Ian Lance Taylor  <iant@google.com>
9364
9365         PR 11019
9366         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9367         Xindex::read_symtab_xindex.
9368
9369 2010-01-07  Doug Kwan  <dougkwan@google.com>
9370
9371         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9372         (Insn_template::thumb16_bcond_insn): New method declaration.
9373         (Insn_template): Fix spelling.
9374         (Stub::thumb16_special): New method declaration.
9375         (Stub::do_write): Define virtual method which was previously pure
9376         virtual.
9377         (Stub::do_thumb16_special): New method declaration.
9378         (Stub::do_fixed_endian_write): New template member.
9379         (Reloc_stub::do_write): Remove.
9380         (Reloc_stub::do_fixed_endian_write): Remove.
9381         (Cortex_a8_stub): New class definition.
9382         (Stub_factory::make_cortex_a8_stub): New method definition.
9383         (Stub_factory::Stub_factory): Add missing static storage class
9384         qualifier for elf32_arm_stub_a8_veneer_blx.
9385
9386 2010-01-07  Ian Lance Taylor  <iant@google.com>
9387
9388         PR 10980
9389         * options.h (class General_options): Add --warn-unresolved-symbols
9390         and --error-unresolved-symbols.
9391         * errors.cc (Errors::undefined_symbol): Implement
9392         --warn-unresolved-symbols.
9393
9394         * options.h (class General_options): Add -z text and -z textoff.
9395         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9396
9397 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9398
9399         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9400         (Garbage_collection::cident_sections): New function.
9401         (Garbage_collection::add_cident_section): New function.
9402         (Garbage_collection::cident_sections_): New member.
9403         (gc_process_relocs): Add references to sections whose names are C
9404         identifiers.
9405         * gold.h (cident_section_start_prefix): New constant.
9406         (cident_section_stop_prefix): New constant.
9407         (is_cident): New function.
9408         * layout.cc (Layout::define_section_symbols): Replace string constants
9409         with the newly defined constants.
9410         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9411         C identifiers.
9412         * testsuite/Makefile.am: Add gc_orphan_section_test.
9413         * testsuite/Makefile.in: Regenerate.
9414         * testsuite/gc_orphan_section_test.cc: New file.
9415         * testsuite/gc_orphan_section_test.sh: New file.
9416
9417 2010-01-06  Ian Lance Taylor  <iant@google.com>
9418
9419         PR 10980
9420         * options.h (class General_options): Add --warn-shared-textrel.
9421         * layout.cc (Layout::finish_dynamic_section): Implement
9422         --warn-shared-textrel.
9423
9424         PR 10980
9425         * options.h (class General_options): Add --warn-multiple-gp.
9426
9427 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9428
9429         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9430         $(THREADSLIB) and $(LIBDL).
9431         * Makefile.in: Rebuild.
9432
9433 2010-01-06  Ian Lance Taylor  <iant@google.com>
9434
9435         PR 10980
9436         * options.cc (General_options::parse_section_start): New function.
9437         (General_options::section_start): New function.
9438         (General_options::General_options): Initialize all members.
9439         * options.h: Include <map>
9440         (class General_options): Add --section-start.  Add section_starts_
9441         member.
9442         * layout.cc (Layout::attach_allocated_section_to_segment): If
9443         --section-start was used, set the address of the segment.  Remove
9444         local sort_sections.
9445         (Layout::relaxation_loop_body): If the address of the load segment
9446         has been set by --section-start, don't use it.
9447         * output.h (Output_segment::update_flags_for_output_section): New
9448         function.
9449         * output.cc (Output_segment::add_output_section): Call
9450         update_flags_for_output_section.
9451
9452 2010-01-05  Ian Lance Taylor  <iant@google.com>
9453
9454         PR 10980
9455         * options.h (class General_options): Add --undefined-version.
9456         * script.cc (struct Version_expression): Add was_matched_by_symbol
9457         field.
9458         (Version_script_info::matched_symbol): New function.
9459         (Version_script_info::get_symbol_version_helper): Call
9460         matched_symbol.
9461         (Version_script_info::check_unmatched_names): New function.
9462         * script.h (class Version_script_info): Update declarations.
9463         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9464
9465         * options.h (class General_options): Use DEFINE_bool_alias for
9466         allow_multiple_definition.
9467         * resolve.cc (Symbol_table::should_override): Don't test
9468         allow_multiple_definition.
9469
9470         PR 10980
9471         * options.h (class General_options): Add --cref.
9472         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9473         until after printing cref table.
9474         * cref.cc: Include "symtab.h".
9475         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9476         (Cref_table_compare::operator()): New function.
9477         (Cref_inputs::gather_cref): New function.
9478         (filecol): New static const.
9479         (Cref_inputs::print_cref): New function.
9480         (Cref::print_cref): New function.
9481         * cref.h: Include <cstdio>.
9482         (class Cref): Update declarations.
9483         * mapfile.h (Mapfile::file): New function.
9484         * object.h (class Object): Define Symbols.  Declare virtual
9485         do_get_global_symbols.
9486         (Object::get_global_symbols): New function.
9487         * object.cc (Input_objects::add_object): Pass object to cref_ if
9488         --cref.
9489         (Input_objects::archive_start): Likewise.
9490         (Input_objects::archive_stop): Likewise.
9491         (Input_objects::print_cref): New function.
9492         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9493         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9494         --cref.
9495         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9496         function.
9497         * plugin.h (class Sized_pluginobj): Update declarations.
9498
9499 2010-01-05  Ian Lance Taylor  <iant@google.com>
9500
9501         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9502         to is_default_version.  Rename insdef to insdefault.
9503         (Symbol_table::add_from_relobj): Rename def to is_default_version
9504         and local to is_forced_local.
9505         (Symbol_table::add_from_pluginobj): Likewise.
9506         (Symbol_table::add_from_dynobj): Likewise.
9507         (Symbol_table::define_special_symbol): Rename insdef to
9508         insdefault.
9509
9510 2010-01-04  Ian Lance Taylor  <iant@google.com>
9511
9512         PR 10980
9513         * options.h (class General_options): Add
9514         --allow-multiple-definition and -z muldefs.
9515         * resolve.cc (Symbol_table::should_override): Don't warn about a
9516         multiple symbol definition if --allow-multiple-definition or -z
9517         muldefs.
9518
9519         PR 10980
9520         * options.h (class General_options): Add --add-needed and
9521         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9522         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9523         error if --copy-dt-needed-entries aka --add-needed is used and
9524         would cause a change in behaviour.
9525
9526         PR 10980
9527         * options.h (class General_options): Add -G as a short version of
9528         --shared.  Add no-op options -assert, -g, and -i.
9529
9530 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9531
9532         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9533         check for .text or .gnu.linkonce.t sections.
9534         * icf.cc (Icf::find_identical_sections): Ditto.
9535         Change the detection for mangled function name within the section
9536         name.
9537         * icf.h (is_section_foldable_candidate): New function.
9538
9539 2009-12-30  Ian Lance Taylor  <iant@google.com>
9540
9541         PR 10980
9542         * options.h (class General_options): Permit two dashes with
9543         --retain-symbols-file.
9544
9545 2009-12-30  Ian Lance Taylor  <iant@google.com>
9546
9547         PR 10979
9548         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9549         don't put the file header and segment headers in the text
9550         segment.
9551
9552         PR 10979
9553         * common.cc (Sort_commons::operator()): Stabilize sort when both
9554         entries are NULL.
9555         (Symbol_table::do_allocate_commons_list): When allocating common
9556         symbols, skip a symbol which is no longer common.
9557         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9558         an object before checking its type.
9559         * testsuite/common_test_2.c: New file.
9560         * testsuite/common_test_3.c: New file.
9561         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9562         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9563         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9564         (common_test_2_pic.o, common_test_2.so): New targets.
9565         (common_test_3_pic.o, common_test_3.so): New targets.
9566         * testsuite/Makefile.in: Rebuild.
9567
9568         PR 10979
9569         * script.cc (read_input_script): If we see a new SECTIONS clause,
9570         and we have added an input section, give an error.
9571         * layout.h (class Layout): Add have_added_input_section function.
9572         Add have_added_input_section_ field.
9573         * layout.cc (Layout::Layout): Initialize
9574         have_added_input_section_.
9575         (Layout::layout): Set have_added_input_section_.
9576         (Layout::layout_eh_frame): Likewise.
9577
9578 2009-12-30  Ian Lance Taylor  <iant@google.com>
9579
9580         PR 10931
9581         * options.h (class General_options): Add --sort-common option.
9582         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9583         * common.cc (Sort_common): Add sort_order parameter to
9584         constructor.  Add sort_order_ field.
9585         (Sort_commons::operator): Check sort_order_.
9586         (Symbol_table::allocate_commons): Determine the sort order.
9587         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9588         Change all callers.
9589         (Symbol_table::do_allocate_commons_list): Likewise.
9590
9591 2009-12-30  Ian Lance Taylor  <iant@google.com>
9592
9593         PR 10916
9594         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9595         symbols from this object, don't change the visibility of an
9596         undefined symbol.
9597         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9598
9599 2009-12-30  Ian Lance Taylor  <iant@google.com>
9600
9601         PR 10861
9602         * script.h (class Version_script_info): Define Language enum.
9603         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9604         new fields globals_, locals_, and is_finalized_.
9605         * script.cc: Various formatting fixes.
9606         (class Parser_closure): Change language_stack_ from a vector of
9607         std::string to one of Version_script_info::Language.  Adjust all
9608         uses accordingly.
9609         (class Lazy_demangler): Remove.
9610         (struct Version_expression): Change language from std::string to
9611         Version_script_info::Language.
9612         (Version_script_info::Version_script_info): New function.
9613         (Version_script_info::~Version_script_info): Don't call clear.
9614         (Version_script_info::finalize): New function.
9615         (Version_script_info::build_lookup_tables): New function.
9616         (Version_script_info::build_expression_list_lookup): New
9617         function.
9618         (Version_script_info::get_symbol_version_helper): Rewrite to use
9619         lookup tables.
9620         (Version_script_info::print_expression_list): Adjust to use
9621         Version_script_info::Language.
9622         (script_push_lex_into_version_mode): Check that the version script
9623         has not been finalized.
9624         (version_script_push_lang): Change language string to
9625         Version_script_info::Language.
9626         * options.cc (Command_line::version_script): New function.
9627         * options.h (class General_options): Add finalize_dynamic_list
9628         function.  Change version_script from declaration to definition.
9629         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9630         * testsuite/version_script.map: Remove duplicate def of foo.
9631         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9632         version_script.map.
9633         * testsuite/Makefile.in: Rebuild.
9634
9635 2009-12-30  Ian Lance Taylor  <iant@google.com>
9636
9637         PR 10843
9638         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9639         if the input symbol index is 0, make the output symbol index 0.
9640
9641 2009-12-30  Ian Lance Taylor  <iant@google.com>
9642
9643         PR 10670
9644         * options.h (class General_options): Add -x/--discard-all.
9645         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9646         --discard-all.  If the local symbol needs a dynamic entry, check
9647         that before handling --discard-locals.
9648
9649 2009-12-30  Ian Lance Taylor  <iant@google.com>
9650
9651         PR 10450
9652         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9653         flags to PF_R.
9654         (Output_segment::add_output_section): Don't change the flags if
9655         the type is PT_TLS.
9656
9657         PR 10450
9658         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9659         GNU hash table if they need a dynamic value.  Otherwise, don't add
9660         them if they are defined in a dynamic object or are forced local.
9661
9662 2009-12-29  Ian Lance Taylor  <iant@google.com>
9663
9664         PR 10450
9665         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9666         .gnu.hash table for a 32-bit target.
9667
9668         PR 10450
9669         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9670         regular and a dynamic object only needs a dynamic symbol table
9671         entry if it is externally visible.
9672
9673         PR 10450
9674         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9675         constructor.  Add global_offset_table_ field.
9676         (Target_i386::got_section): Set global_offset_table_.
9677         (Target_i386::do_finalize_sections): Set global_offset_table_
9678         size.
9679         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9680         in constructor.  Add global_offset_table_ field.
9681         (Target_x86_64::got_section): Set global_offset_table_.
9682         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9683         size.
9684
9685         * layout.cc (Layout::Layout): Initialize increase_relro_.
9686         (Layout::get_output_section): Add is_relro, is_last_relro, and
9687         is_first_non_relro parameters.  Change all callers.
9688         (Layout::choose_output_section): Likewise.
9689         (Layout::add_output_section_data): Likewise.
9690         (Layout::make_output_section): Likewise.
9691         (Layout::set_segment_offsets): Clear increase_relro when using a
9692         linker script.
9693         * layout.h (class Layout): Add increase_relro method.  Add
9694         increase_relro_ field.  Update declarations.
9695         * output.cc (Output_section::Output_section): Initialize
9696         is_last_relro_ and is_first_non_relro_.
9697         (Output_segment::add_output_section): Group relro sections is
9698         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9699         (Output_segment::maximum_alignment): Remove relro handling.
9700         (Output_segment::set_section_addresses): Add increase_relro
9701         parameter.  Change all callers.  Add initial alignment to align
9702         relro sections on separate page.  Remove old relro handling.
9703         (Output_segment::set_section_list_addresses): Remove in_relro
9704         parameter.  Change all callers.
9705         (Output_segment::set_offset): Add increase parameter.  Change all
9706         callers.  Remove old relro handling.
9707         * output.h (class Output_section): Add new methods: is_last_relro,
9708         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9709         Add is_last_relro_ and is_first_non_relro_ fields.
9710         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9711         Create separate .got.plt section.  Call increase_relro.
9712         * x86_64.cc (Target_x86_64::got_section): Likewise.
9713         * testsuite/relro_script_test.t: Add .got.plt.
9714
9715         PR 10450
9716         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9717         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9718         (Layout::finalize): Call set_dynamic_symbol_size.
9719         (Layout::set_dynamic_symbol_size): New function.
9720         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9721         set_dynamic_symbol_size.
9722
9723         PR 10450
9724         * output.h (class Output_section): Add is_entsize_zero_ field.
9725         * output.cc (Output_section::Output_section): Initialize
9726         is_entsize_zero_.
9727         (Output_section::set_entsize): If two different entsizes are
9728         requested, force it to zero.
9729         (Output_section::add_input_section): Set flags for .debug_str
9730         before updating section flags.  Set entsize.
9731         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9732         and SHF_STRING if all input sections have those flags.
9733
9734 2009-12-29   Rafael Espindola  <espindola@google.com>
9735
9736         * main.cc (main): Fix the sys time reporting.
9737         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9738         reporting.
9739
9740 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9741
9742         * options.cc (General_options::parse_version): Allow -v to exit
9743         without an error if there is nothing to link.
9744
9745 2009-12-29  Ian Lance Taylor  <iant@google.com>
9746
9747         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9748         using a version of gcc before 4.1.
9749         * configure: Rebuild.
9750
9751 2009-12-28  Chris Demetriou  <cgd@google.com>
9752
9753         * attributes.cc (Output_attributes_section_data::do_write): Use
9754         std::vector::front rather than std::vector::data.
9755
9756 2009-12-28  Ian Lance Taylor  <iant@google.com>
9757
9758         * symtab.h (class Symbol_table): Add enum Defined.
9759         * resolve.cc (Symbol_table::should_override): Add defined
9760         parameter.  Change all callers.  Test whether object is NULL
9761         before calling a method on it.
9762         (Symbol_table::report_resolve_problem): Add defined parameter.
9763         Change all callers.
9764         (Symbol_table::should_override_with_special): Likewise.
9765         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9766         parameter.  Change all callers.
9767         (Symbol_table::do_define_in_output_data): Likewise.
9768         (Symbol_table::define_in_output_segment): Likewise.
9769         (Symbol_table::do_define_in_output_segment): Likewise.
9770         (Symbol_table::define_as_constant): Likewise.
9771         (Symbol_table::do_define_as_constant): Likewise.
9772         * script.h (class Symbol_assignment): Add is_defsym parameter to
9773         constructor; change all callers.
9774         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9775         parameter.  Change all callers.  Add is_defsym_ field.
9776         (class Parser_closure): Add parsing_defsym parameter to
9777         constructor; change all callers.  Add parsing_defsym accessor
9778         function.  Add parsing_defsym_ field.
9779
9780 2009-12-28  Ian Lance Taylor  <iant@google.com>
9781
9782         * gold.cc (queue_middle_tasks): Fix formatting.
9783         * object.cc (Relobj::is_section_name_included): Likewise.
9784
9785 2009-12-23  Ian Lance Taylor  <iant@google.com>
9786
9787         * i386.cc (Target_i386::do_calls_non_split): Recognize
9788         -fsplit-stack prologue for a function with a static chain.
9789         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9790         -fsplit-stack prologue when using %r11.
9791
9792 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9793
9794         * options.cc (General_options::parse_version): Make -v continue and do
9795         the link like GNU ld does.
9796
9797 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9798
9799         * Makefile.am (CCFILES): Add timer.cc.
9800         (HFILES): Add timer.h.
9801         * configure.ac: Check for sysconf and times.
9802         * main.cc: include timer.h.
9803         (main): Use Timer instead of get_run_time.
9804         * timer.cc: New.
9805         * timer.h: New.
9806         * workqueue.cc: include timer.h.
9807         (Workqueue::find_and_run_task):
9808         Report user, sys and wall time.
9809         * Makefile.in: Regenerate.
9810         * config.in: Regenerate.
9811         * configure: Regenerate.
9812
9813 2009-12-16  Doug Kwan  <dougkwan@google.com>
9814
9815         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9816         sections.
9817         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9818         relaxed input sections.
9819         * output.cc (Output_section::find_relaxed_input_section): Change
9820         return type to Output_relaxed_input_section pointer.  Adjust code
9821         for new type of relaxed_input_section_map_.
9822         * output.h (Output_section::find_relaxed_input_section): Change
9823         return type to Output_relaxed_input_section pointer.
9824         (Output_section::Output_relaxed_input_section_by_input_section_map):
9825         New type.
9826         (Output_section::relaxed_input_section_map_): Change type to
9827         Output_section::Output_relaxed_input_section_by_input_section_map.
9828         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9829         input section.
9830
9831 2009-12-15  Ian Lance Taylor  <iant@google.com>
9832
9833         * layout.cc (Layout::create_shstrtab): Only write out after input
9834         sections if we are compressing debug sections.
9835
9836 2009-12-15  Ian Lance Taylor  <iant@google.com>
9837
9838         * archive.cc (Archive::add_symbols): Only look up a symbol without
9839         a version if there is, in fact, a version.
9840
9841 2009-12-14  Ian Lance Taylor  <iant@google.com>
9842
9843         Revert -Wshadow changes, all changes from:
9844         2009-12-11  Doug Kwan  <dougkwan@google.com>
9845         2009-12-11  Nick Clifton  <nickc@redhat.com>
9846         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9847
9848 2009-12-11  Doug Kwan  <dougkwan@google.com>
9849
9850         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9851         due to -Wshadow.
9852         * attributes.cc (Object_attribute::size): Ditto.
9853         (Attributes_section_data::size): Ditto.
9854         (Attributes_section_data::Attributes_section_data): Ditto.
9855         (Output_attributes_section_data::do_write): Ditto.
9856         * attributes.h (Object_attribute::set_type): Ditto.
9857         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9858
9859 2009-12-11  Nick Clifton  <nickc@redhat.com>
9860
9861         * archive.cc: Fix shadowed variable warnings.
9862         * arm.cc: Likewise.
9863         * compressed_output.cc: Likewise.
9864         * compressed_output.h: Likewise.
9865         * configure: Likewise.
9866         * dwarf_reader.cc: Likewise.
9867         * dynobj.cc: Likewise.
9868         * dynobj.h: Likewise.
9869         * ehframe.cc: Likewise.
9870         * ehframe.h: Likewise.
9871         * errors.cc: Likewise.
9872         * expression.cc: Likewise.
9873         * fileread.cc: Likewise.
9874         * fileread.h: Likewise.
9875         * freebsd.h: Likewise.
9876         * i386.cc: Likewise.
9877         * icf.cc: Likewise.
9878         * incremental.h: Likewise.
9879         * layout.cc: Likewise.
9880         * layout.h: Likewise.
9881         * mapfile.cc: Likewise.
9882         * merge.cc: Likewise.
9883         * merge.h: Likewise.
9884         * object.cc: Likewise.
9885         * object.h: Likewise.
9886         * options.h: Likewise.
9887         * output.cc: Likewise.
9888         * output.h: Likewise.
9889         * parameters.cc: Likewise.
9890         * plugin.cc: Likewise.
9891         * powerpc.cc: Likewise.
9892         * reduced_debug_output.cc: Likewise.
9893         * reduced_debug_output.h: Likewise.
9894         * reloc.cc: Likewise.
9895         * reloc.h: Likewise.
9896         * resolve.cc: Likewise.
9897         * script-sections.cc: Likewise.
9898         * script.cc: Likewise.
9899         * script.h: Likewise.
9900         * sparc.cc: Likewise.
9901         * symtab.cc: Likewise.
9902         * symtab.h: Likewise.
9903         * target-select.cc: Likewise.
9904         * target-select.h: Likewise.
9905         * token.h: Likewise.
9906         * workqueue.cc: Likewise.
9907         * workqueue.h: Likewise.
9908         * x86_64.cc: Likewise.
9909
9910 2009-12-10  Doug Kwan  <dougkwan@google.com>
9911
9912         * arm.cc (attributes.h): New include.
9913         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9914         (Arm_relobj::~Arm_relobj): Delete object pointed by
9915         attributes_section_data_.
9916         (Arm_relobj::attributes_section_data): New method definition.
9917         (Arm_relobj::attributes_section_data_): New data member declaration.
9918         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9919         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9920         attributes_section_data_.
9921         (Arm_dynobj::attributes_section_data): New method definition.
9922         (Arm_dynobj::attributes_section_data_): New data member declaration.
9923         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9924         initialization value of may_use_blx_ to false.
9925         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9926         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9927         object attributes to compute results instead of hard-coding.
9928         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9929         Target_arm::get_secondary_compatible_arch,
9930         Target_arm::set_secondary_compatible_arch
9931         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9932         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9933         New method declarations.
9934         (Target_arm::get_aeabi_object_attribute): New method definition.
9935         (Target_arm::attributes_section_data_): New data member declaration.
9936         (read_arm_attributes_section): New template definition.
9937         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9938         (Arm_dynobj::do_read_symbols): Ditto.
9939         (Target_arm::do_finalize_sections): Merge attributes sections from
9940         input.  Check for BLX use after attributes section merging.
9941         Fix __exidx_start and __exidx_end visibility.  Create an
9942         .ARM.attributes section if necessary.
9943         (Target_arm::get_secondary_compatible_arch,
9944         Target_arm::set_secondary_compatible_arch,
9945         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9946         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9947         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9948         New method definitions.
9949
9950 2009-12-09  Ian Lance Taylor  <iant@google.com>
9951
9952         * plugin.cc (Plugin::load): Don't cast from void* to a function
9953         pointer.
9954
9955 2009-12-09  Ian Lance Taylor  <iant@google.com>
9956
9957         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9958         information fields.
9959
9960 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9961
9962         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9963         Replace two_file_shared_1.so with two_file_shared_2.so.
9964         * testsuite/Makefile.in: Regenerated.
9965
9966 2009-12-08  Doug Kwan  <dougkwan@google.com>
9967
9968         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9969         (HFILES): Add attributes.h and int_encoding.h.
9970         * Makefile.in: Regenerate.
9971         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9972         function definitions to int_encoding.cc
9973         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9974         prototypes to int_encoding.h
9975         * reduced_debug_output.cc (int_encoding.h): New include.
9976         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9977         function definitions to int_encoding.cc
9978         (insert_into_vector, read_from_pointer): Move template definitions to
9979         int_encoding.h
9980         * attributes.cc: New file.
9981         * attributes.h: New file.
9982         * int_encoding.cc: New file.
9983         * int_encoding.h: New file.
9984
9985 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9986
9987         PR gold/11055
9988         * incremental-dump.cc (dump_incremental_inputs): New.
9989         (main): Use dump_incremental_inputs.
9990
9991 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9992
9993         PR gold/10893
9994         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9995         checking elfcpp::STT_FUNC.
9996         (Target_i386::Relocate::relocate): Likewise.
9997         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9998
9999         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10000         symbols from shared libraries into normal FUNC symbols.
10001
10002         * symtab.h (Symbol): Add is_func and use it.
10003
10004 2009-12-05  Doug Kwan  <dougkwan@google.com>
10005
10006         * arm.cc (Target_arm::arm_info): Initialize new fields
10007         attributes_section and attributes_vendor.
10008         * i386.cc (Target_i386::i386_info): Same.
10009         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10010         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10011         fields attributes_section and attributes_vendor.
10012         * sparc.cc (Target_sparc::sparc_info): Same.
10013         * target.h (Target::attributes_section, Target::attributes_vendor,
10014         Target::is_attributes_section, Target::attribute_arg_type,
10015         Target::attributes_order): New method definitions.
10016         (Target::Target_info::attributes_section,
10017         Target::Target_info::attributes_vendor): New fields.
10018         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10019         virtual method definitions.
10020         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10021         attributes_section and attributes_vendor.
10022         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10023
10024 2009-12-05  Doug Kwan  <dougkwan@google.com>
10025
10026         * arm.cc: Update comments about interworking and stub generation.
10027         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10028         considered as non-PIC.
10029         (Arm_relocate_functions::base_abs): Fix formatting.
10030         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10031         of function to use GOT entry address instead of offset.
10032         (Target_arm::Scan::global): Issue an error if a symbol would need a
10033         PLT does not get one because it is untyped.  Remove code to create
10034         dynamic symbols for relative branches.
10035         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10036         takes unsigned integer instead of boolean.
10037
10038 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10039
10040         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10041         (two_file_test_LDADD): Likewise.
10042         (common_test_1_LDADD): Likewise.
10043         (exception_test_LDADD) Likewise.
10044         (weak_test_LDADD): Likewise.
10045         (many_sections_test_LDADD): Likewise.
10046         (initpri1_LDADD): Likewise.
10047         (script_test_1_LDADD): Likewise.
10048         (script_test_2_LDADD): Likewise.
10049         (justsyms_LDADD): Likewise.
10050         (binary_test_LDADD): Likewise.
10051         (large_LDADD): Likewise.
10052         * testsuite/Makefile.in: Regenerated.
10053
10054 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10055
10056         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10057         (Symbol_table::override_with_special): Likewise.
10058         (Symbol_table::add_from_object): Likewise.
10059
10060 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10061
10062         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10063         Don't set the data_offset twice.
10064
10065 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10066
10067         * testsuite/Makefile.in: Regenerate.
10068
10069 2009-12-03  Doug Kwan  <dougkwan@google.com>
10070
10071         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10072         (Target_arm::do_finalize_sections): Add parameter for symbol table
10073         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10074         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10075         parameter for symbol table pointer.
10076         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10077         an additional parameter for a pointer to symbol table.
10078         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10079         parameter for a symbol table pointer.
10080         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10081         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10082         Ditto.
10083         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10084         parameter for a symbol table pointer.
10085
10086 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10087
10088         * incremental.cc (Incremental_inputs_header)
10089         (Incremental_inputs_header_write, Incremental_inputs_entry)
10090         (Incremental_inputs_entry_write): Move ...
10091         * incremental.h (Incremental_inputs_header)
10092         (Incremental_inputs_header_write, Incremental_inputs_entry)
10093         (Incremental_inputs_entry_write): here.
10094
10095 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10096
10097         * incremental.cc (make_sized_incremental_binary): Set the target.
10098         Error if it is incompatible.
10099         * output.h (Output_file): Add filename method.
10100
10101 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10102
10103         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10104         from the get_* methods.
10105
10106 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10107
10108         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10109         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10110         Write 0 for the data_offset of scripts.
10111
10112 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10113
10114         * testsuite/Makefile.am: Add the incremental_test.sh test.
10115         * testsuite/incremental_test.sh: New.
10116         * testsuite/incremental_test_1.c: New.
10117         * testsuite/incremental_test_2.c: New.
10118
10119 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10120
10121         * incremental-dump.cc (main): Fix typos.
10122
10123 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10124
10125         PR gold/11025
10126         * incremental-dump.cc (main): Use llu to print 64 bit values.
10127
10128 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10129             H.J. Lu  <hongjiu.lu@intel.com>
10130
10131         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10132         $(LIBDL).
10133         (incremental_dump_LDADD): Likewise.
10134         * Makefile.in: Regenerated.
10135
10136 2009-11-25  Doug Kwan  <dougkwan@google.com>
10137
10138         Revert:
10139
10140         2009-11-25  Doug Kwan  <dougkwan@google.com>
10141
10142                 * arm.cc (Target_arm::Target_arm): Move method definition
10143                 outside of class definition.  Add code to handle
10144                 --target1-rel, --target1-abs and --target2= options.
10145                 (Target_arm::get_reloc_reloc_type): Change method to be
10146                 non-static and const.
10147                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10148                 New data member declaration.
10149                 (Target_arm::Scan::local, Target_arm::Scan::global,
10150                 Target_arm::Relocate::relocate,
10151                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10152                 Adjust call to Target_arm::get_real_reloc_type.
10153                 (Target_arm::get_real_reloc_type): Use command line options
10154                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10155                 * options.h (--target1-rel, --target1-abs, --target2): New
10156                 ARM-only options.
10157
10158 2009-11-25  Doug Kwan  <dougkwan@google.com>
10159
10160         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10161         class definition.  Add code to handle --target1-rel, --target1-abs
10162         and --target2= options.
10163         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10164         and const.
10165         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10166         member declaration.
10167         (Target_arm::Scan::local, Target_arm::Scan::global,
10168         Target_arm::Relocate::relocate,
10169         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10170         call to Target_arm::get_real_reloc_type.
10171         (Target_arm::get_real_reloc_type): Use command line options to
10172         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10173         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10174         options.
10175
10176 2009-11-25  Doug Kwan  <dougkwan@google.com>
10177
10178         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10179         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10180         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10181         formatting.
10182         (Arm_relocate_functions::thm_call): Replace body with a call to
10183         Arm_relocate_functions::thumb_branch_common.
10184         (Arm_relocate_functions::thm_jump24,
10185         Arm_relocate_functions::thm_xpc22): New method definitions.
10186         (Arm_relocate_functions::thumb_branch_common): New method definition.
10187         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10188         operator.
10189         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10190         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10191
10192 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10193
10194         * Makefile.am: Build incremental-dump
10195         * Makefile.in: Regenerate.
10196         * incremental-dump.cc: New.
10197         * incremental.cc (Incremental_inputs_header_data,
10198         Incremental_inputs_entry_data): Move to incremental.h
10199         * incremental.h: (Incremental_inputs_header_data,
10200         Incremental_inputs_entry_data): Move from incremental.cc
10201
10202 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10203
10204         * incremental.cc (Incremental_inputs_header,
10205         Incremental_inputs_header_write, Incremental_inputs_entry,
10206         Incremental_inputs_entry_write): Add a typedef with the data type.
10207
10208 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10209
10210         * incremental.cc (Incremental_inputs_header,
10211         Incremental_inputs_header_write, Incremental_inputs_entry,
10212         Incremental_inputs_entry_write): Update comment about which
10213         type has the filed descriptions.
10214
10215 2009-11-15  Doug Kwan  <dougkwan@google.com>
10216
10217         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10218         (Arm_relocate_functions::arm_branch_common): Change method defintion
10219         in class definition to a method declaration and update list of formal
10220         parameters.
10221         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10222         Arm_relocation_functions::jump24): Adjust call to
10223         Arm_relocate_functions::arm_branch_common.  Update list of formal
10224         parameters.
10225         (Arm_relocate_functions::xpc25): New method definition.
10226         (Arm_relocate_functions::arm_branch_common): Move method defintion
10227         out from class definition.  Use stubs for mode-switching and extending
10228         branch ranges.
10229         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10230         specially.  Change code to enable use of stubs in ARM branches.
10231
10232 2009-11-10  Doug Kwan  <dougkwan@google.com>
10233
10234         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10235         in method declaration.
10236         (Target_arm::relocate_stub): New method declaration.
10237         (Target_arm::default_target): Change to return a pointer instead of
10238         a const reference.
10239         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10240         Target_arm::default_target.
10241         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10242         method definition.
10243         (Target_arm::relocate_section): Adjust view.
10244         (Target_arm::relocate_stub): New method definition.
10245
10246 2009-11-10  Doug Kwan  <dougkwan@google.com>
10247
10248         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10249         a format warning.
10250         * incremental.cc (open_incremental_binary): Initialized local
10251         variables to avoid warnings.
10252         * object.cc (make_elf_object): Ditto.
10253         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10254         a format warning.
10255
10256 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10257
10258         PR gold/10930
10259         * testsuite/plugin_test.c: Include "config.h".
10260
10261 2009-11-09  Doug Kwan  <dougkwan@google.com>
10262
10263         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10264         (arm_symbol_value): Remove.
10265         (Arm_relocate_functions::arm_branch_common,
10266         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10267         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10268         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10269         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10270         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10271         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10272         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10273         Arm_relocate_functions::thm_mobw_abs_nc,
10274         Arm_relocate_functions::thm_mov_abs,
10275         Arm_relocate_functions::movw_prel_nc,
10276         Arm_relocate_functions::thm_movt_abs,
10277         Arm_relocate_functions::movt_prel,
10278         Arm_relocate_functions::thm_movw_prel_nc,
10279         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10280         (Target_arm::Relocate::relocate): Only decompose address into two
10281         parts if relocation type uses the thumb-bit and pass the actual
10282         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10283         calls to methods in Arm_relocate_functions for this change.
10284
10285 2009-11-08  Ian Lance Taylor  <iant@google.com>
10286
10287         PR 10925
10288         * reloc.cc: Instantiate
10289         Sized_relobj::initialize_input_to_output_maps and
10290         Sized_relobj:free_input_to_output_maps.
10291
10292 2009-11-06  Ian Lance Taylor  <iant@google.com>
10293
10294         PR 10876
10295         * defstd.cc (in_segment): Set only_if_ref true for "end".
10296
10297 2009-11-06  Doug Kwan  <dougkwan@google.com>
10298
10299         * arm.cc (class Reloc_stub): Correct a comment.
10300         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10301         (Target_arm::scan_section_for_stubs): New method declaration.
10302         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10303         Change methods from private to protected.
10304         (Target_arm::do_may_relax): New method definition.
10305         (Target_arm::do_relax, Target_arm::group_sections,
10306         Target_arm::scan_reloc_for_stub,
10307         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10308         (Target_arm::arm_input_section_map_): New data member declaration.
10309         (Target_arm::scan_reloc_for_stub,
10310         Target_arm::scan_reloc_section_for_stubs,
10311         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10312         Target_arm::do_relax): New method definitions.
10313
10314 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10315
10316         * configure.ac: Check for (struct stat)::st_mtim
10317         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10318         * config.in: Regenerate.
10319         * configure: Regenerate.
10320
10321 2009-11-05  Ian Lance Taylor  <iant@google.com>
10322
10323         PR 10910
10324         * output.cc (Output_segment::add_output_section): Add missing
10325         return statement.
10326
10327 2009-11-04  Ian Lance Taylor  <iant@google.com>
10328
10329         PR 10880
10330         * object.h (class Object): Add is_needed and set_is_needed
10331         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10332         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10333         defined in a dynamic object and referenced by a regular object,
10334         set is_needed for the dynamic object.
10335         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10336         if the file is marked with as_needed and it is not needed.
10337
10338 2009-11-04  Ian Lance Taylor  <iant@google.com>
10339
10340         PR 10887
10341         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10342         tags if data is discarded by linker script.
10343         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10344         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10345         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10346         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10347
10348 2009-11-04  Ian Lance Taylor  <iant@google.com>
10349
10350         * layout.cc (Layout::get_output_section): Add is_interp and
10351         is_dynamic_linker_section parameters.  Change all callers.
10352         (Layout::choose_output_section): Likewise.
10353         (Layout::make_output_section): Likewise.
10354         (Layout::add_output_section_data): Add is_dynamic_linker_section
10355         parameter.  Change all callers.
10356         * layout.h (class Layout): Update declarations.
10357         * output.h (class Output_section): Add is_interp, set_is_interp,
10358         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10359         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10360         generate_code_fills_at_write_ to a bitfield.
10361         * output.cc (Output_section::Output_sections): Initialize new
10362         fields.
10363         (Output_segment::add_output_section): Add do_sort parameter.
10364         Change all callers.
10365
10366 2009-11-03  Ian Lance Taylor  <iant@google.com>
10367
10368         PR 10860
10369         * options.h (class General_options): Add --warn-common.
10370         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10371         merging two common symbols.
10372         (Symbol_table::should_override): Handle --warn-common when merging
10373         a common symbol with a defined symbol.  Use report_resolve_problem
10374         for multiple definitions.
10375         (Symbol_table::report_resolve_problem): New function.
10376         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10377
10378 2009-11-03  Doug Kwan  <dougkwan@google.com>
10379
10380         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10381         stub_factory_.
10382         (Target_arm::stub_factory): New method definition.
10383         (Target_arm::new_arm_input_section,
10384         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10385         Target_arm::reloc_uses_thumb_bit): New method declarations.
10386         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10387         New type definitions.
10388         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10389         member declarations.
10390         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10391         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10392         New method definitions.
10393
10394 2009-11-03  Ian Lance Taylor  <iant@google.com>
10395
10396         * options.h (class General_options): Add --warn_constructors.
10397
10398 2009-11-03  Ian Lance Taylor  <iant@google.com>
10399
10400         PR 10893
10401         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10402         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10403
10404 2009-11-03  Ian Lance Taylor  <iant@google.com>
10405
10406         PR 10895
10407         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10408         --msgid-bugs-address.
10409         (install-pdf): New target.
10410         (install-data_yes): Look up one directory to find mkinstalldirs.
10411
10412 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10413
10414         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10415         tree.
10416
10417 2009-10-30  Doug Kwan  <dougkwan@google.com>
10418
10419         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10420
10421 2009-10-30  Doug Kwan  <dougkwan@google.com>
10422
10423         * arm.cc (Stub_addend_reader): New struct template definition
10424         and partial specializations.
10425         (Stub_addend_reader::operator()): New method definition for a
10426         partially specialized template.
10427
10428 2009-10-30  Doug Kwan  <dougkwan@google.com>
10429
10430         * arm.cc (Arm_relobj::processor_specific_flags): New method
10431         definition.
10432         (Arm_relobj::do_read_symbols): New method declaration.
10433         (Arm_relobj::processor_specific_flags_): New data member declaration.
10434         (Arm_dynobj): New class definition.
10435         (Target_arm::do_finalize_sections): Add input_objects parameter.
10436         (Target_arm::do_adjust_elf_header): New method declaration.
10437         (Target_arm::are_eabi_versions_compatible,
10438         (Target_arm::merge_processor_specific_flags): New method declaration.
10439         (Target_arm::do_make_elf_object): New overloaded method definitions
10440         and declaration.
10441         (Arm_relobj::do_read_symbols): New method definition.
10442         (Arm_dynobj::do_read_symbols): Ditto.
10443         (Target_arm::do_finalize_sections): Add input_objects parameters.
10444         Merge processor-specific flags from all input objects.
10445         (Target_arm::are_eabi_versions_compatible,
10446         Target_arm::merge_processor_specific_flags,
10447         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10448         New method definitions.
10449         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10450         Input_objects pointer type parameter.
10451         * layout.cc (Layout::finalize): Pass input objects to target's.
10452         finalize_sections function.
10453         * output.cc (Output_file_header::do_sized_write): Set ELF file
10454         header's processor-specific flags.
10455         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10456         Input_objects pointer type parameter.
10457         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10458         * target.h (Input_objects): New forward class declaration.
10459         (Target::processor_specific_flags,
10460         Target::are_processor_specific_flags_sect): New method definitions.
10461         (Target::finalize_sections): Add input_objects parameter.
10462         (Target::Target): Initialize processor_specific_flags_ and
10463         are_processor_specific_flags_set_.
10464         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10465         parameter.
10466         (Target::set_processor_specific_flags): New method definition.
10467         (Target::processor_specific_flags_,
10468         Target::are_processor_specific_flags_set_): New data member
10469         declarations.
10470         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10471         Input_objects pointer type parameter.
10472
10473 2009-10-30  Doug Kwan  <dougkwan@google.com>
10474
10475         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10476
10477 2009-10-28  Ian Lance Taylor  <iant@google.com>
10478
10479         * object.h (class Relobj): Drop options parameter from
10480         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10481         do_scan_relocs, do_relocate.  Change all callers.
10482         (class Sized_relobj): Drop options parameters from
10483         do_gc_process_relocs, do_scan_relocs, do_relocate,
10484         do_relocate_sections, relocate_sections, emit_relocs_scan,
10485         emit_relocs_scan_reltype.  Change all callers.
10486         (struct Relocate_info): Remove options field and all references to
10487         it.
10488         * reloc.h (class Read_relocs): Remove options constructor
10489         parameter and options_ field.  Change all callers.
10490         (class Gc_process_relocs, class Scan_relocs): Likewise.
10491         (class Relocate_task): Likewise.
10492         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10493         all callers.
10494         (scan_relocatable_relocs): Likewise.
10495         * target.h (class Sized_target): Remove options parameter from
10496         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10497         all callers.
10498         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10499         callers.
10500         * arm.cc: Update functions to remove options parameters.
10501         * i386.cc: Likewise.
10502         * powerpc.cc: Likewise.
10503         * sparc.cc: Likewise.
10504         * x86_64.cc: Likewise.
10505         * testsuite/testfile.cc: Likewise.
10506
10507 2009-10-28  Doug Kwan  <dougkwan@google.com>
10508
10509         * arm.cc (Arm_relobj): New class definition.
10510         (Arm_relobj::scan_sections_for_stubs,
10511         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10512         New method definitions.
10513
10514 2009-10-28  Cary Coutant  <ccoutant@google.com>
10515
10516         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10517         (Plugin::cleanup_done_): New member.
10518         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10519         (Plugin_manager::cleanup_done_): Remove.
10520         (Plugin_manager::add_input_file): Edit error message.
10521         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10522         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10523
10524 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10525
10526         * fileread.cc: (File_read::View::~View): Use the new
10527         data_ownership_ filed.
10528         (File_read::~File_read): Dispose the new whole_file_view_.
10529         (File_read::open): Mmap the whole file if needed.
10530         (File_read::open): Use whole_file_view_ instead of contents_.
10531         (File_read::find_view): Use whole_file_view_ if applicable.
10532         (File_read::do_read): Use whole_file_view_ instead of contents_.
10533         (File_read::make_view): Use whole_file_view_ instead of contents_,
10534         update File_read::View::View call.
10535         (File_read::find_or_make_view): Update File_read::View::View
10536         call.
10537         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10538         remove contents_
10539         (File_read::View::Data_ownership): New enum.
10540         (File_read::View::View): Replace bool mapped_ with Data_ownership
10541         argument.
10542         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10543         (File_read::View::data_ownership_): New field.
10544         (File_read::contents_): Remove (replaced by whole_file_view_).
10545         (File_read::whole_file_view_): New field.
10546         * options.h (class General_options): Add --keep-files-mapped.
10547
10548 2009-10-27  Cary Coutant  <ccoutant@google.com>
10549
10550         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10551         * testsuite/Makefile.am (plugin_test_5): New test case.
10552         * testsuite/Makefile.in: Regenerate.
10553
10554 2009-10-25  Doug Kwan  <dougkwan@google.com>
10555
10556         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10557         from private to protected to allow access by child class.
10558         (Sized_relobj::do_relocate_sections): New method declaration.
10559         (Sized_relobj::relocate_sections): Virtualize.
10560         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10561         Sized_relobj::relocate_sections.  Instantiate template explicitly
10562         for different target sizes and endianity.
10563
10564 2009-10-24  Doug Kwan  <dougkwan@google.com>
10565
10566         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10567         (Arm_input_section::as_arm_input_section): New method.
10568         (Arm_output_section): New class definition.
10569         (Arm_output_section::create_stub_group,
10570         Arm_output_section::group_sections): New method definitions.
10571
10572 2009-10-22  Doug Kwan  <dougkwan@google.com>
10573
10574         * arm.cc (Arm_input_section): New class definition.
10575         (Arm_input_section::init, Arm_input_section:do_write,
10576         Arm_input_section::set_final_data_size,
10577         Arm_input_section::do_reset_address_and_file_offset): New method
10578         definitions.
10579
10580 2009-10-21  Doug Kwan  <dougkwan@google.com>
10581
10582         * arm.cc (Stub_table, Arm_input_section): New forward class
10583         declarations.
10584         (Stub_table): New class defintion.
10585         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10586         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10587         New method definition.
10588
10589 2009-10-21  Doug Kwan  <dougkwan@google.com>
10590
10591         * arm.cc: Update copyright comments.
10592         (Target_arm): New forward class template declaration.
10593         (Arm_address): New type.
10594         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10595         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10596         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10597         constants.
10598         (Insn_template): Same.
10599         (DEF_STUBS): New macro.
10600         (Stub_type): New enum type.
10601         (Stub_template): New class definition.
10602         (Stub): Same.
10603         (Reloc_stub): Same.
10604         (Stub_factory): Same.
10605         (Target_arm::Target_arm): Initialize may_use_blx_ and
10606         should_force_pic_veneer_.
10607         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10608         Target_arm::should_force_pic_veneer,
10609         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10610         Target_arm::using_thumb_only, Target_arm:;default_target): New
10611         method defintions.
10612         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10613         New data member declarations.
10614         (Insn_template::size, Insn_template::alignment): New method defintions.
10615         (Stub_template::Stub_template): New method definition.
10616         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10617         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10618         (Stub_factory::Stub_factory): New method definition.
10619         * gold.h (string_hash): New template.
10620         * output.h (Input_section_specifier::hash_value): Use
10621         gold::string_hash.
10622         (Input_section_specifier::string_hash): Remove.
10623         * stringpool.cc (Stringpool_template::string_hash): Use
10624         gold::string_hash.
10625
10626 2009-10-20  Doug Kwan  <dougkwan@google.com>
10627
10628         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10629         symbols of relaxed input sections.
10630         * output.h (Output_section::find_relaxed_input_section): Make
10631         method public.
10632
10633 2009-10-16  Doug Kwan  <dougkwan@google.com>
10634
10635         * dynobj.cc (Versions::Versions): Initialize version_script_.
10636         Only insert base version symbol definition for a shared object
10637         if version script defines any version versions.
10638         (Versions::define_base_version): New method definition.
10639         (Versions::add_def): Check that base version is not needed.
10640         (Versions::add_need): Define base version lazily.
10641         * dynobj.h (Versions::define_base_version): New method declaration.
10642         (Versions::needs_base_version_): New data member declaration.
10643         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10644         (check_DATA): Add no_version_test.stdout.
10645         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10646         New make rules.
10647         * testsuite/Makefile.in: Regenerate.
10648         * testsuite/no_version_test.c: New file.
10649         * testsuite/no_version_test.sh: Ditto.
10650
10651 2009-10-16  Doug Kwan  <dougkwan@google.com>
10652
10653         * expression.cc (class Segment_start_expression): New class definition.
10654         (Segment_start_expression::value): New method definition.
10655         (script_exp_function_segment_start): Return a new
10656         Segment_start_expression.
10657         * gold/script-c.h (script_saw_segment_start_expression): New function
10658         prototype.
10659         * script-sections.cc (Script_sections::Script_sections): Initialize
10660         SAW_SEGMENT_START_EXPRESSION_ to false.
10661         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10662         and -Tbbs options to specify section addresses if given in
10663         command line and no SEGMENT_START expression is seen in a script.
10664         * script-sections.h (Script_sections::saw_segment_start_expression,
10665         Script_sections::set_saw_segment_start_expression): New method
10666         definition.
10667         (Script_sections::saw_segment_start_expression_): New data member
10668         declaration.
10669         * script.cc (script_saw_segment_start_expression): New function.
10670         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10671         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10672         script_test_7.sh and script_test_8.sh.
10673         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10674         script_test_8.stdout.
10675         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10676         (script_test_6, script_test_6.stdout, script_test_7,
10677         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10678         * Makefile.in: Regenerate.
10679         * testsuite/script_test_6.sh: New file.
10680         * testsuite/script_test_6.t: Same.
10681         * testsuite/script_test_7.sh: Same.
10682         * testsuite/script_test_7.t: Same.
10683         * testsuite/script_test_8.sh: Same.
10684
10685 2009-10-16  Doug Kwan  <dougkwan@google.com>
10686
10687         * output.cc (Output_segment::set_section_list_address): Cast
10688         expressions to unsigned long long type to avoid format warnings.
10689
10690 2009-10-15  Ian Lance Taylor  <iant@google.com>
10691
10692         * script.cc (Script_options::add_symbol_assignment): Always add a
10693         dot assignment to script_sections_.
10694         * script-sections.cc (Script_sections::add_dot_assignment):
10695         Initialize if necessary.
10696
10697         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10698         program headers with no load segment if there is a linker script.
10699
10700         * layout.cc (Layout::set_segment_offsets): Align the file offset
10701         to the segment aligment for -N or -n with no load segment.
10702         * output.cc (Output_segment::add_output_section): Don't crash if
10703         the first section is a TLS section.
10704         (Output_segment::set_section_list_addresses): Print an error
10705         message if the address moves backward in a linker script.
10706         * script-sections.cc
10707         (Output_section_element_input::set_section_addresses): Don't
10708         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10709         (Orphan_output_section::set_section_addresses): Likewise.
10710
10711 2009-10-15  Doug Kwan  <dougkwan@google.com>
10712
10713         * layout.cc (Layout::finish_dynamic_section): Generate tags
10714         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10715         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10716         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10717
10718 2009-10-14  Ian Lance Taylor  <iant@google.com>
10719
10720         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10721         fields.
10722         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10723         data_shdr fields of relinfo.
10724         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10725         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10726         R_386_TLS_LDO_32, adjust based on section flags.
10727         (Target_i386::Relocate::fix_up_ldo): Remove.
10728
10729 2009-10-13  Ian Lance Taylor  <iant@google.com>
10730
10731         Add support for -pie.
10732         * options.h (class General_options): Add -pie and
10733         --pic-executable.
10734         (General_options::output_is_position_independent): Test -pie.
10735         (General_options::output_is_executable): Return true if not shared
10736         and not relocatable.
10737         (General_options::output_is_pie): Remove.
10738         * options.cc (General_options::finalize): Reject incompatible uses
10739         of -pie.
10740         * gold.cc (queue_middle_tasks): A -pie link is not static.
10741         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10742         * symtab.cc (Symbol::final_value_is_known): Return false if
10743         output_is_position_independent.
10744         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10745         output_is_position_independent.
10746         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10747         output_is_position_independent.
10748         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10749         output_is_position_independent.
10750         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10751         two_file_pie_test.
10752         (basic_pie_test.o, basic_pie_test): New targets.
10753         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10754         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10755         (two_file_pie_test): New target.
10756         * testsuite/Makefile.in: Rebuild.
10757         * README: Remove note saying that -pie is not supported.
10758
10759 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10760
10761         * options.h (class General_options): Add -init and -fini.
10762         * layout.cc (Layout::finish_dynamic_section): Emit
10763         given init and fini functions.
10764
10765 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10766
10767         * gc.h (gc_process_relocs): Check if icf is enabled using new
10768         function.
10769         * gold.cc (queue_initial_tasks): Likewise.
10770         (queue_middle_tasks): Likewise.
10771         * object.cc (do_layout): Likewise.
10772         * symtab.cc (is_section_folded): Likewise.
10773         * main.cc (main): Likewise.
10774         * reloc.cc (Read_relocs::run): Likewise.
10775         (Sized_relobj::do_scan_relocs): Likewise.
10776         * icf.cc (is_function_ctor_or_dtor): New function.
10777         (Icf::find_identical_sections): Check if function is ctor or dtor when
10778         safe icf is chosen.
10779         * options.h (General_options::icf): Change option to be an enum.
10780         (Icf_status): New enum.
10781         (icf_enabled): New method.
10782         (icf_safe_folding): New method.
10783         (set_icf_status): New method.
10784         (icf_status_): New variable.
10785         * (options.cc) (General_options::finalize): Set icf_status_.
10786         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10787         icf_test and icf_keep_unique_test to use the --icf enum flag.
10788         * testsuite/icf_safe_test.sh: New file.
10789         * testsuite/icf_safe_test.cc: New file.
10790
10791 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10792
10793         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10794         includes to gc.h and icf.h.
10795         * arm.cc: Include gc.h.
10796         * gold.cc: Likewise.
10797         * i386.cc: Likewise.
10798         * powerpc.cc: Likewise.
10799         * sparc.cc: Likewise.
10800         * x86_64.cc: Likewise.
10801         * gc.h: Include icf.h.
10802
10803 2009-10-11  Ian Lance Taylor  <iant@google.com>
10804
10805         * plugin.cc: Include "gold.h" before other header files.
10806
10807 2009-10-10  Chris Demetriou  <cgd@google.com>
10808
10809         * options.h (Input_file_argument::Input_file_type): New enum.
10810         (Input_file_argument::is_lib_): Replace with...
10811         (Input_file_argument::type_): New member.
10812         (Input_file_argument::Input_file_argument): Take Input_file_type
10813         'type' rather than boolean 'is_lib' as second argument.
10814         (Input_file_argument::is_lib): Use type_.
10815         (Input_file_argument::is_searched_file): New function.
10816         (Input_file_argument::may_need_search): Handle is_searched_file.
10817         * options.cc (General_options::parse_library): Support -l:filename.
10818         (General_options::parse_just_symbols): Update for Input_file_argument
10819         changes.
10820         (Command_line::process): Likewise.
10821         * archive.cc (Archive::get_file_and_offset): Likewise.
10822         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10823         * script.cc (read_script_file, script_add_file): Likewise.
10824         * fileread.cc (Input_file::Input_file): Likewise.
10825         (Input_file::will_search_for): Handle is_searched_file.
10826         (Input_file::open): Likewise.
10827         * readsyms.cc (Read_symbols::get_name): Likewise.
10828         * testsuite/Makefile.am (searched_file_test): New test.
10829         * testsuite/Makefile.in: Regenerate.
10830         * testsuite/searched_file_test.cc: New file.
10831         * testsuite/searched_file_test_lib.cc: New file.
10832
10833 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10834             Ian Lance Taylor  <iant@google.com>
10835
10836         * descriptor.cc: Include <cstdio> and "binary-io.h".
10837         (Descriptors::open): Open the files in binary mode always.
10838         * script.cc (Lex::get_token): Treat \r as whitespace.
10839
10840 2009-10-09  Ian Lance Taylor  <iant@google.com>
10841
10842         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10843
10844 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10845             Ian Lance Taylor  <iant@google.com>
10846
10847         * configure.ac: Check for readv function also.
10848         * fileread.cc (readv): Define if not HAVE_READV.
10849         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10850         does not exist.
10851         * config.in: Regenerate.
10852         * configure: Regenerate.
10853
10854 2009-10-09  Doug Kwan  <dougkwan@google.com>
10855
10856         * layout.cc (Layout::make_output_section): Call target hook to make
10857         ordinary output section.
10858         (Layout::finalize): Adjust parameter list of call the
10859         Target::may_relax().
10860         * layout.h (class Layout::section_list): New method.
10861         * merge.h (Output_merge_base::entsize): Change visibility to public.
10862         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10863         New methods.
10864         (Output_merge_string::do_is_string): New method.
10865         * object.cc (Sized_relobj::do_setup): renamed from
10866         Sized_relobj::set_up.
10867         * object.h (Sized_relobj::adjust_shndx,
10868         Sized_relobj::initializ_input_to_output_maps,
10869         Sized_relobj::free_input_to_output_maps): Change visibilities to
10870         protected.
10871         (Sized_relobj::setup): Virtualize.
10872         (Sized_relobj::do_setup): New method declaration.
10873         (Sized_relobj::invalidate_section_offset,
10874         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10875         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10876         * options.cc (parse_int): New function.
10877         * options.h (parse_int): New declaration.
10878         (DEFINE_int): New macro.
10879         (stub_group_size): New option.
10880         * output.cc (Output_section::Output_section): Initialize memebers
10881         merge_section_map_, merge_section_by_properties_map_,
10882         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10883         (Output_section::add_input_section): Handled deferred code-fill
10884         generation and remove an old comment.
10885         (Output_section::add_relaxed_input_section): New method definition.
10886         (Output_section::add_merge_input_section): Use merge section by
10887         properties map to speed to search.  Update merge section maps
10888         as appropriate.
10889         (Output_section::build_relaxation_map): New method definition.
10890         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10891         Same.
10892         (Output_section::relax_input_section): Renamed to
10893         Output_section::convert_input_sections_to_relaxed_sections and change
10894         interface to take a vector of pointers to relaxed sections.
10895         (Output_section::find_merge_section,
10896         Output_section::find_relaxed_input_section): New method definitions.
10897         (Output_section::is_input_address_mapped,
10898         Output_section::output_offset, Output_section::output_address):
10899         Use output section data maps to speed up searching.
10900         (Output_section::find_starting_output_address): Add comments.
10901         (Output_section::do_write,
10902         Output_section::write_to_postprocessing_buffer): Do code-fill
10903         generation as appropriate.
10904         (Output_section::get_input_sections): Invalidate relaxed input section
10905         map.
10906         (Output_section::restore_states): Adjust type of checkpoint .
10907         Invalidate relaxed input section map.
10908         * output.h (Output_merge_base): New class declaration.
10909         (Input_section_specifier): New class defintion.
10910         (class Output_relaxed_input_section) Change base class to
10911         Output_section_data_build.
10912         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10913         base class initializer.
10914         (Output_section::add_relaxed_input_section): New method declaration.
10915         (Output_section::Input_section): Change visibility to protected.
10916         (Output_section::Input_section::relobj,
10917         Output_section::Input_section::shndx): Handle relaxed input sections.
10918         Output_section::input_sections) Change visibility to protected.  Also
10919         define overload to return a non-const pointer.
10920         (Output_section::Merge_section_properties): New class defintion.
10921         (Output_section::Merge_section_by_properties_map,
10922         Output_section::Output_section_data_by_input_section_map,
10923         Output_section::Relaxation_map): New types.
10924         (Output_section::relax_input_section): Rename method to
10925         Output_section::convert_input_sections_to_relaxed_sections and change
10926         interface to take a vector of relaxed section pointers.
10927         (Output_section::find_merge_section,
10928         Output_section::find_relaxed_input_section,
10929         Output_section::build_relaxation_map,
10930         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10931         New method declarations.
10932         (Output_section::merge_section_map_
10933         Output_section::merge_section_by_properties_map_,
10934         Output_section::relaxed_input_section_map_,
10935         Output_section::is_relaxed_input_section_map_valid_,
10936         Output_section::generate_code_fills_at_write_): New data members.
10937         * script-sections.cc
10938         (Output_section_element_input::set_section_addresses): Call
10939         current_data_size and addralign methods of relaxed input sections.
10940         (Orphan_output_section::set_section_addresses): Call current_data_size
10941         and addralign methods of relaxed input sections.
10942         * symtab.cc (Symbol_table::compute_final_value): Extract template
10943         from the body of Symbol_table::sized_finalize_symbol.
10944         (Symbol_table::sized_finalized_symbol): Call
10945         Symbol_table::compute_final_value.
10946         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10947         (Symbol_table::compute_final_value): New templated method declaration.
10948         * target.cc (Target::do_make_output_section): New method defintion.
10949         * target.h (Target::make_output_section): New method declaration.
10950         (Target::relax): Add more parameters for input objects, symbol table
10951         and layout.  Adjust call to do_relax.
10952         (Target::do_make_output_section): New method declaration.
10953         (Target::do_relax): Add parameters for input objects, symbol table
10954         and layout.
10955
10956 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10957
10958         * pread.c: Include stdio.h.
10959
10960 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10961
10962         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10963         defined.
10964
10965 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10966
10967         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10968         Change read_shndx type to unsigned int.
10969         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10970         int.
10971         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10972         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10973         Change read_shndx type to unsigned int.
10974         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10975         int.
10976         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10977         * layout.cc (Layout::create_symtab_sections): Cast the result of
10978         local_symcount * symsize to off_t in the gold_assert.
10979
10980 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10981
10982         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10983         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10984         R_ARM_BASE_ABS.
10985         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10986         (Arm_relocate_functions::thm_abs5): New function.
10987         (Arm_relocate_functions::abs12): New function.
10988         (Arm_relocate_functions::abs16): New function.
10989         (Arm_relocate_functions::base_abs): New function.
10990         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10991         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10992         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10993         R_ARM_BASE_ABS.
10994         (Scan::global): Likewise.
10995         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10996         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10997         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10998         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10999         R_ARM_BASE_ABS.
11000
11001 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11002
11003         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11004         (Arm_relocate_functions::movt_prel): New function.
11005         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11006         (Arm_relocate_functions::thm_movt_prel): New function.
11007         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11008         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11009         (Scan::global, Relocate::relocate): Likewise.
11010         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11011
11012 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11013
11014         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11015         Incremental_checker.
11016         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11017         unsigned int.
11018         (class Incremental_inputs_header): New class.
11019         (Incremental_inputs_header_writer): Edit comment.
11020         (Incremental_inputs_entry): New class.
11021         (Incremental_inputs_entry_writer): Edit comment.
11022         (Sized_incremental_binary::do_find_incremental_inputs_section):
11023         Add *strtab_shndx parameter, fill it.
11024         (Sized_incremental_binary::do_check_inputs): New method.
11025         (Incremental_checker::can_incrementally_link_output_file): Use
11026         Sized_incremental_binary::check_inputs.
11027         (Incremental_inputs::report_command_line): Save command line in
11028         command_line_.
11029         * incremental.h:
11030         (Incremental_binary::find_incremental_inputs_section): New
11031         method.
11032         (Incremental_binary::do_find_incremental_inputs_section): Add
11033         strtab_shndx parameter.
11034         (Incremental_binary::do_check_inputs): New pure virtual method.
11035         (Sized_incremental_binary::do_check_inputs): Declare.
11036         (Incremental_checker::Incremental_checker): Add incremental_inputs
11037         parameter, use it to initialize incremental_inputs_.
11038         (Incremental_checker::incremental_inputs_): New field.
11039         (Incremental_checker::command_line): New method.
11040         (Incremental_checker::inputs): New method.
11041         (Incremental_checker::command_line_): New field.
11042
11043 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11044
11045         * incremental.cc: Include <cstdarg> and "target-select.h".
11046         (vexplain_no_incremental): New function.
11047         (explain_no_incremental): New function.
11048         (Incremental_binary::error): New method.
11049         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11050         method.
11051         (make_sized_incremental_binary): New function.
11052         (open_incremental_binary): New function.
11053         (can_incrementally_link_file): Add checks if output is ELF and has
11054         inputs section.
11055         * incremental.h: Include "elfcpp_file.h" and "output.h".
11056         (Incremental_binary): New class.
11057         (Sized_incremental_binary): New class.
11058         (open_incremental_binary): Declare.
11059         * object.cc (is_elf_object): Use
11060         elfcpp::Elf_recognizer::is_elf_file.
11061         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11062         * output.h (Output_file::filesize): New method.
11063
11064 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11065
11066         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11067         New function.
11068         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11069         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11070         function.
11071         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11072         function.
11073         (Arm_relocate_functions::movw_abs_nc): New function.
11074         (Arm_relocate_functions::movt_abs): New function.
11075         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11076         (Arm_relocate_functions::thm_movt_abs): New function.
11077         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11078         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11079         (Scan::global): Likewise.
11080         (Relocate::relocate): Likewise.
11081         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11082
11083 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11084
11085         * arm.cc (Arm_relocate_functions::got_prel) New function.
11086         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11087         (Relocate::relocate): Likewise.
11088         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11089
11090 2009-10-06  Ian Lance Taylor  <iant@google.com>
11091
11092         * options.h (class General_options): Define
11093         split_stack_adjust_size parameter.
11094         * object.h (class Object): Add uses_split_stack_ and
11095         has_no_split_stack_ fields.  Add uses_split_stack and
11096         has_no_split_stack accessor functions.  Declare
11097         handle_split_stack_section.
11098         (class Reloc_symbol_changes): Define.
11099         (class Sized_relobj): Define Function_offsets.  Declare
11100         split_stack_adjust, split_stack_adjust_reltype, and
11101         find_functions.
11102         * object.cc (Object::handle_split_stack_section): New function.
11103         (Sized_relobj::do_layout): Call handle_split_stack_section.
11104         * dynobj.cc (Sized_dynobj::do_layout): Call
11105         handle_split_stack_section.
11106         * reloc.cc (Sized_relobj::relocate_sections): Call
11107         split_stack_adjust for executable sections in split_stack
11108         objects.  Pass reloc_map to relocate_section.
11109         (Sized_relobj::split_stack_adjust): New function.
11110         (Sized_relobj::split_stack_adjust_reltype): New function.
11111         (Sized_relobj::find_functions): New function.
11112         * target-reloc.h: Include "object.h".
11113         (relocate_section): Add reloc_symbol_changes parameter.  Change
11114         all callers.
11115         * target.h (class Target): Add calls_non_split method.  Declare
11116         do_calls_non_split virtual method.  Declare match_view and
11117         set_view_to_nop.
11118         * target.cc: Include "elfcpp.h".
11119         (Target::do_calls_non_split): New function.
11120         (Target::match_view): New function.
11121         (Target::set_view_to_nop): New function.
11122         * gold.cc (queue_middle_tasks): Give an error if mixing
11123         split-stack and non-split-stack objects with -r.
11124         * i386.cc (Target_i386::relocate_section): Add
11125         reloc_symbol_changes parameter.
11126         (Target_i386::do_calls_non_split): New function.
11127         * x86_64.cc (Target_x86_64::relocate_section): Add
11128         reloc_symbol_changes parameter.
11129         (Target_x86_64::do_calls_non_split): New function.
11130         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11131         parameter.
11132         * powerpc.cc (Target_powerpc::relocate_section): Add
11133         reloc_symbol_changes parameter.
11134         * sparc.cc (Target_sparc::relocate_section): Add
11135         reloc_symbol_changes parameter.
11136         * configure.ac: Call AM_CONDITIONAL for the default target.
11137         * configure: Rebuild.
11138         * testsuite/Makefile.am (TEST_AS): New variable.
11139         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11140         (check_DATA): Add split_i386 and split_x86_64 files.
11141         (SPLIT_DEFSYMS): Define.
11142         (split_i386_[1234n].o): New targets.
11143         (split_i386_[124]): New targets.
11144         (split_i386_[1234r].stdout): New targets.
11145         (split_x86_64_[1234n].o): New targets.
11146         (split_x86_64_[124]): New targets.
11147         (split_x86_64_[1234r].stdout): New targets.
11148         (MOSTLYCLEANFILES): Add new executables.
11149         * testsuite/split_i386.sh: New file.
11150         * testsuite/split_x86_64.sh: New file.
11151         * testsuite/split_i386_1.s: New file.
11152         * testsuite/split_i386_2.s: New file.
11153         * testsuite/split_i386_3.s: New file.
11154         * testsuite/split_i386_4.s: New file.
11155         * testsuite/split_i386_n.s: New file.
11156         * testsuite/split_x86_64_1.s: New file.
11157         * testsuite/split_x86_64_2.s: New file.
11158         * testsuite/split_x86_64_3.s: New file.
11159         * testsuite/split_x86_64_4.s: New file.
11160         * testsuite/split_x86_64_n.s: New file.
11161         * testsuite/testfile.cc (Target_test): Update relocation_section
11162         function.
11163         * testsuite/Makefile.in: Rebuild.
11164
11165 2009-10-06  Ian Lance Taylor  <iant@google.com>
11166
11167         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11168         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11169         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11170         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11171         the address on ldo_addrs_.
11172         (Target_i386::Relocate::fix_up_ldo): New function.
11173
11174 2009-10-06   Rafael Espindola  <espindola@google.com>
11175
11176         * plugin.cc (add_input_library): New.
11177         (Plugin::load): Add add_input_library to tv.
11178         (Plugin_manager::add_input_file): Add the is_lib argument.
11179         (add_input_file): Update call to Plugin_manager::add_input_file.
11180         (add_input_library): New.
11181         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11182
11183 2009-09-30  Doug Kwan  <dougkwan@google.com>
11184
11185         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11186         symbol and call Symbol::may_need_copy_reloc to determine if
11187         a copy reloc is needed.
11188         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11189         nocopyreloc is given in command line.
11190         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11191         given in command line.
11192         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11193         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11194         of the removed Target_i386::may_need_copy_reloc.
11195         * options.h (copyreloc): New option with default value false.
11196         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11197         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11198         instead of the removed Target_powerpc::may_need_copy_reloc.
11199         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11200         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11201         instead of the removed Target_sparc::may_need_copy_reloc.
11202         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11203         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11204         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11205         instead of the removed Target_x86_64::may_need_copy_reloc.
11206
11207 2009-09-30  Ian Lance Taylor  <iant@google.com>
11208
11209         * object.h (class Object): Remove target_ field, and target,
11210         sized_target, and set_target methods.
11211         (Object::sized_target): Remove.
11212         (class Sized_relobj): Update declarations.  Remove sized_target.
11213         * object.cc (Sized_relobj::setup): Remove target parameter.
11214         Change all callers.
11215         (Input_objects::add_object): Don't do anything with the target.
11216         (make_elf_sized_object): Add punconfigured parameter.  Change all
11217         callers.  Set or test parameter target.
11218         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11219         Change all callers.
11220         * parameters.cc (Parameters::set_target): Change parameter type to
11221         be non-const.
11222         (Parameters::default_target): Remove.
11223         (set_parameters_target): Change parameter type to be non-const.
11224         (parameters_force_valid_target): New function.
11225         (parameters_clear_target): New function.
11226         * parameters.h (class Parameters): Update declarations.  Remove
11227         default_target method.  Add sized_target and clear_target
11228         methods.  Change target_ to be non-const.
11229         (set_parameters_target): Update declaration.
11230         (parameters_force_valid_target): Declare.
11231         (parameters_clear_target): Declare.
11232         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11233         as NULL if we aren't searching.
11234         (Add_symbols::run): Don't check for compatible target.
11235         * fileread.cc (Input_file::open_binary): Call
11236         parameters_force_valid_target.
11237         * gold.cc (queue_middle_tasks): Likewise.
11238         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11239         set_target on object.
11240         * dynobj.h (class Sized_dynobj): Update declarations.
11241         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11242         make_elf_object returns NULL.
11243         (Archive::include_member): Don't check whether object target is
11244         compatible.
11245         * output.cc (Output_section::add_input_section): Get target from
11246         parameters.
11247         (Output_section::relax_input_section): Likewise.
11248         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11249         parameters.
11250         (Sized_relobj::do_scan_relocs): Likewise.
11251         (Sized_relobj::relocate_sections): Likewise.
11252         * resolve.cc (Symbol_table::resolve): Likewise.
11253         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11254         parameter.  Change all callers.
11255         (Symbol_table::add_from_object): Get target from parameters.
11256         (Symbol_table::add_from_relobj): Don't check object target.
11257         (Symbol_table::add_from_dynobj): Likewise.
11258         (Symbol_table::define_special_symbol): Get target from
11259         parameters.
11260         * symtab.h (class Symbol_table): Update declaration.
11261         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11262         parameter.  Change all callers.  Clear parameter target.
11263         (Binary_test): Test target here.
11264         * testsuite/object_unittest.cc (gold_testsuite): Remove
11265         target_test_pointer parameter.  Change all callers.
11266         (Object_test): Test target here.
11267
11268 2009-09-26  Ian Lance Taylor  <iant@google.com>
11269
11270         * testsuite/initpri1.c: Don't try to use constructor priorities if
11271         compiling with gcc before 4.3.
11272
11273 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11274
11275         * testsuite/retain_symbols_file_test.sh (check_present): Change
11276         output file name to retain_symbols_file_test.stdout.
11277         (check_absent): Likewise.
11278
11279 2009-09-18  Craig Silverstein  <csilvers@google.com>
11280
11281         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11282         * options.cc: Include <cerrno> and <fstream>.
11283         (General_options::finalize): Parse -retain-symbols-file tag.
11284         * options.h: New flag.
11285         (General_options): New method should_retain_symbol, new
11286         variable symbols_to_retain.
11287         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11288         should_retain_symbol map.
11289         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11290         * testsuite/Makefile.in: Regenerate.
11291         * testsuite/retain_symbols_file_test.sh: New file.
11292
11293 2009-09-18  Nick Clifton  <nickc@redhat.com>
11294
11295         * po/es.po: Updated Spanish translation.
11296
11297 2009-09-17  Doug Kwan  <dougkwan@google.com>
11298
11299         * debug.h (DEBUG_RELAXATION): New constant.
11300         (DEBUG_ALL): Add DEBUG_RELAXATION.
11301         (debug_string_to_enum): Add relaxation debug option.
11302         * layout.cc
11303         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11304         Layout::Relaxation_debug_check::read_sections,
11305         Layout::Relaxation_debug_check::read_sections): New method definitions.
11306         (Layout::Layout): Initialize data members
11307         record_output_section_data_from_scrips_,
11308         script_output_section_data_list_ and relaxation_debug_check_.
11309         (Layout::save_segments, Layout::restore_segments,
11310         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11311         Layout::relaxation_loop_body): New method definitions.
11312         (Layout::finalize): Support relaxation.  Move section layout code to
11313         Layout::relaxation_loop_body.
11314         (Layout::set_asection_address_from_script): Move code for orphan
11315         section placement out.
11316         (Layout::place_orphan_sections_in_script): New method definition.
11317         * layout.h (Output_segment_headers, Output_file_header):
11318         New forward class declarations.
11319         (Layout::~Layout): Define.
11320         (Layout::new_output_section_data_from_script): New method definition.
11321         (Layout::place_orphan_sections_in_script): New method declaration.
11322         (Layout::Segment_states): New type declaration.
11323         (Layout::save_segments, Layout::restore_segments,
11324         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11325         Layout::relaxation_loop_body): New method declarations.
11326         (Layout::Output_section_data_list): New type declaration.
11327         (Layout::Relaxation_debug_check): New class definition.
11328         (Layout::record_output_section_data_from_script_,
11329         Layout::script_output_section_data_list_, Layout::segment_states_,
11330         Layout::relaxation_debug_check_): New data members.
11331         * output.cc: (Output_section_headers::do_size): New method definition.
11332         (Output_section_headers::Output_section_headers): Move size
11333         computation to Output_section_headers::do_size.
11334         (Output_segment_headers::do_size): New method definition.
11335         (Output_file_header::Output_file_header): Move size computation to
11336         Output_file_header::do_size and call it.
11337         (Output_file_header::do_size): New method definition.
11338         (Output_data_group::Output_data_group): Adjust call to
11339         Output_section_data.
11340         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11341         (Output_symtab_xindex::do_write): Add array bound check.
11342         (Output_section::Input_section::print_to_mapfile): Handle
11343         RELAXED_INPUT_SECTION_CODE.
11344         (Output_section::Output_section): Initialize data member checkpoint_.
11345         (Output_section::~Output_section): Delete checkpoint object pointed
11346         by checkpoint_.
11347         (Output_section::add_input_section): Always add an Input_section if
11348         relaxing.
11349         (Output_section::add_merge_input_section): Add assert.
11350         (Output_section::relax_input_section): New method definition.
11351         (Output_section::set_final_data_size): Set load address to zero for
11352         an unallocated section.
11353         (Output_section::do_address_and_file_offset_have_reset_values):
11354         New method definition.
11355         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11356         Handle relaxed input section.
11357         (Output_section::sort_attached_input_sections): Checkpoint input
11358         section list lazily.
11359         (Output_section::get_input_sections): Change type of input_sections to
11360         list of Simple_input_section pointers.  Checkpoint input section list
11361         lazily.  Also handle relaxed input sections.
11362         (Output_section::add_input_section_for_script): Take a reference to
11363         a Simple_input_section object instead of Relobj pointer and section
11364         index as parameter.  Handle relaxed input sections.
11365         (Output_section::save_states, Output_section::restore_states): New
11366         method definitions.
11367         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11368         (Output_data::is_data_size_fixed): New method definition.
11369         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11370         if it is fixed.
11371         (Output_data::address_and_file_offset_have_reset_values): New method
11372         definition.
11373         (Output_data::do_address_and_file_offset_have_reset_values): New method
11374         definition.
11375         (Output_data::set_data_size): Check that data size is not fixed.
11376         (Output_data::fix_data_size): New method definition.
11377         (Output_data::is_data_size_fixed_): New data member.
11378         (Output_section_headers::set_final_data_size): New method definition.
11379         (Output_section_headers::do_size): New method declaration.
11380         (Output_segment_headers::set_final_data_size): New method definition.
11381         (Output_segment_headers::do_size): New method declaration.
11382         (Output_file_header::set_final_data_size)::New method definition.
11383         (Output_file_header::do_size)::New method declaration.
11384         (Output_section_data::Output_section_data): Add new parameter
11385         is_data_size_fixed and use it to fix data size.
11386         (Output_data_const::Output_data_const): Adjust call to base class
11387         constructor and fix data size.
11388         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11389         base class constructor and fix data size.
11390         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11391         base class constructor and fix data size.
11392         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11393         class constructor and fix data size.
11394         (Output_data_group::set_final_data_size): New method definition.
11395         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11396         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11397         class constructor and fix data size.
11398         (Output_relaxed_input_section): New class definition.
11399         (Output_section::Simple_input_section): New class definition.
11400         (Output_section::get_input_sections): Adjust parameter list.
11401         (Output_section::add_input_section_for_script): Same.
11402         (Output_section::save_states, Output_section::restore_states,
11403         Output_section::do_address_and_file_offset_have_reset_values,
11404         (Output_section::Input_section::Input_section): Handle
11405         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11406         Output_relaxed_input_section.
11407         (Output_section::Input_section::is_input_section,
11408         Output_section::Input_section::set_output_section): Handle relaxed
11409         input section.
11410         (Output_section::Input_section::is_relaxed_input_section,
11411         Output_section::Input_section::output_section_data,
11412         Output_section::Input_section::relaxed_input_section): New method
11413         definitions.
11414         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11415         value.
11416         (Output_section::Input_section::u1_): Update comments.
11417         (Output_section::Input_section::u2_): Add new union member poris.
11418         (Output_section::Checkpoint_output_section): New classs definition.
11419         (Output_section::relax_input_section): New method declaration.
11420         (Output_section::checkpoint_): New data member.
11421         (Output_segment): Update comments.
11422         (Output_segment::Output_segment): Un-privatize copy constructor.
11423         (Output_segment::operator=): Un-privatize.
11424         * script-sections.cc (Output_section_element::Input_section_list):
11425         Change element type to Output_section::Simple_input_section.
11426         (Output_section_element_dot_assignment::set_section_addresses):
11427         Register output section data for relaxation clean up.
11428         (Output_data_exression::Output_data_expression): Adjust call to base
11429         constructor to fix data size.
11430         (Output_section_element_data::set_section_addresses): Register
11431         Output_data_expression object for relaxation clean up.
11432         (struct Input_section_info): Replace Relobj pointer and section index
11433         pair with Output_section::Simple_input_section and Convert struct to a
11434         class.
11435         (Input_section_sorter::operator()): Adjust access to
11436         Input_section_info data member to use accessors.
11437         (Output_section_element_input::set_section_addresses): Use layout
11438         parameter.  Adjust code to use Output_section::Simple_input_section
11439         and Input_secction_info classes.  Register filler for relaxation
11440         clean up.
11441         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11442         and section index pair with Output_section::Simple_input_section
11443         class.  Adjust code accordingly.
11444         (Phdrs_element::release_segment): New method definition.
11445         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11446         segment list.
11447         (Script_sections::release_segments): New method definition.
11448         * gold/script-sections.h (Script_sections::release_segments): New
11449         method declaration.
11450         * gold/target.h (Target::may_relax, Target::relax,
11451         Target::do_may_relax, Target::do_relax): New method definitions.
11452
11453 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11454
11455         * arm.cc (has_signed_unsigned_overflow): New function.
11456         (Arm_relocate_functions::abs8): New function.
11457         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11458         (Target_arm::Scan::global): Likewise.
11459         (Target_arm::relocate::relocate): Likewise.
11460         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11461         Likewise.
11462
11463 2009-09-16  Cary Coutant  <ccoutant@google.com>
11464
11465         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11466         * testsuite/Makefile.in: Regenerate.
11467
11468 2009-09-11  Nick Clifton  <nickc@redhat.com>
11469
11470         * po/gold.pot: Updated by the Translation project.
11471
11472 2009-09-08  Cary Coutant  <ccoutant@google.com>
11473
11474         * output.cc (Output_file::open): Add execute permission to empty file.
11475         * testsuite/Makefile.am (permission_test): New test.
11476         * testsuite/Makefile.in: Regenerate.
11477
11478 2009-09-02  Ian Lance Taylor  <iant@google.com>
11479
11480         * output.cc (Output_file::resize): Call map_no_anonymous rather
11481         than map.
11482
11483 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11484
11485         * gold.cc: Include "incremental.h".
11486         (queue_initial_tasks): Call Incremental_checker methods.
11487         * incremental.cc: Include "output.h".
11488         (Incremental_checker::can_incrementally_link_output_file): New
11489         method.
11490         * incremental.h (Incremental_checker): New class.
11491
11492         * output.cc (Output_file::open_for_modification): New method.
11493         (Output_file::map_anonymous): Changed return type to bool.  Record
11494         map in base_ field.
11495         (Output_file::map_no_anonymous): New method, broken out of map.
11496         (Output_file::map): Use map_no_anonymous and map_anonymous.
11497         * output.h (class Output_file): Update declarations.
11498
11499 2009-08-24  Cary Coutant  <ccoutant@google.com>
11500
11501         * options.h (Command_line::Pre_options): New class.
11502         (Command_line::pre_options): New member.
11503         * options.cc (gold::options::ready_to_register): New variable.
11504         (One_option::register_option): Do nothing if not registering options.
11505         Assert if same short option registered twice.
11506         (General_options::General_options): Turn off option registration when
11507         done constructing.
11508         (Command_line::Pre_options::Pre_options): New constructor.
11509
11510 2009-08-24  Cary Coutant  <ccoutant@google.com>
11511
11512         * options.h (General_options::no_keep_memory): Remove incorrect
11513         short option.
11514
11515 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11516
11517         * Makefile.am (am__skiplex, am__skipyacc): New.
11518         * Makefile.in: Regenerate.
11519
11520 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11521
11522         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11523         (INCLUDES): ... this.
11524         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11525         (AM_CPPFLAGS): Renamed from ...
11526         (INCLUDE): ... this.
11527         * Makefile.in, testsuite/Makefile.in: Regenerate.
11528
11529         * Makefile.in: Regenerate.
11530         * aclocal.m4: Likewise.
11531         * config.in: Likewise.
11532         * configure: Likewise.
11533         * testsuite/Makefile.in: Likewise.
11534
11535         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11536         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11537         * Makefile.in: Regenerate.
11538         * testsuite/Makefile.in: Regenerate.
11539
11540 2009-08-19  Cary Coutant  <ccoutant@google.com>
11541
11542         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11543         symbols in shared libraries overridden by hidden or internal symbols
11544         in the main program.
11545
11546 2009-08-19  Chris Demetriou  <cgd@google.com>
11547
11548         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11549         checking source file names in error messages.
11550
11551 2009-08-18  Doug Kwan  <dougkwan@google.com>
11552
11553         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11554         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11555         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11556         an elfcpp::Ehdr as parameter.
11557         * object.cc (Object::set_target): Remove the version that looks up
11558         a target and sets it.
11559         (Sized_relobj::setup): Take a Target object instead of
11560         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11561         (make_elf_sized_object): Find target and ask target to
11562         make an ELF object.
11563         * object.h: (Object::set_target): Remove the version that looks up
11564         a target and sets it.
11565         (Sized_relobj::setup): Take a Target object instead of
11566         an elfcpp:Ehdr as parameter.
11567         * target.cc: Include dynobj.h.
11568         (Target::do_make_elf_object_implementation): New.
11569         (Target::do_make_elf_object): New.
11570         * target.h (Target::make_elf_object): New template declaration.
11571         (Target::do_make_elf_object): New method declarations.
11572         (Target::do_make_elf_object_implementation): New template declaration.
11573
11574 2009-08-14  Ian Lance Taylor  <iant@google.com>
11575
11576         * gold.h (FUNCTION_NAME): Define.
11577         (gold_unreachable): Use FUNCTION_NAME.
11578
11579 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11580
11581         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11582         symbol in the --keep-unique list is not found.
11583
11584 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11585
11586         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11587         been maked as --keep-unique.
11588         (Icf::unfold_section): New function.
11589         * icf.h (Icf::unfold_section): New function.
11590         * options.h (General_options::keep_unique): New option.
11591         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11592         * testsuite/Makefile.in: Regenerate.
11593         * testsuite/icf_keep_unique_test.sh: New file.
11594         * testsuite/icf_keep_unique_test.cc: New file.
11595
11596 2009-08-12  Cary Coutant  <ccoutant@google.com>
11597
11598         PR 10471
11599         * resolve.cc (Symbol_table::resolve): Check for references from
11600         dynamic objects to hidden and internal symbols.
11601         * testsuite/Makefile.am (hidden_test.sh): New test.
11602         * testsuite/Makefile.in: Regenerate.
11603         * testsuite/hidden_test.sh: New script.
11604         * testsuite/hidden_test_1.c: New test source.
11605         * testsuite/hidden_test_main.c: New test source.
11606
11607 2009-08-11  Doug Kwan  <dougkwan@google.com>
11608
11609         * arm.cc: Update comments.
11610         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11611         segment to locate the .ARM.exidx section if present.
11612
11613 2009-08-09  Doug Kwan  <dougkwan@google.com>
11614
11615         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11616         patch.
11617
11618 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11619         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11620         compiler warnings.
11621
11622 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11623
11624         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11625         valid tls_segment only for non-debug-section relocations.
11626         * testsuite/Makefile.am: Add gc_tls_test.
11627         * testsuite/Makefile.in: Regenerate.
11628         * testsuite/gc_tls_test.cc: New file.
11629         * testsuite/gc_tls_test.sh: New file.
11630
11631 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11632
11633         * icf.cc: New file.
11634         * icf.h: New file.
11635         * Makefile.am (CCFILES): Add icf.cc.
11636         (HFILES): Add icf.h
11637         * Makefile.in: Regenerate.
11638         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11639         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11640         section, symbol and addend information for the relocs.
11641         * gold.cc (queue_middle_tasks): Call identical code folding.
11642         * gold.h: Add defines for multimap.
11643         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11644         to the call of finalize_local_symbols.
11645         * main.cc (main): Create object of class Icf.
11646         * object.cc (Sized_relobj::do_layout): Allow this function to be
11647         called twice during icf.
11648         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11649         to sections marked as identical by icf.
11650         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11651         when available.
11652         (Sized_relobj::do_section_entsize): New function.
11653         * object.h (Object::section_entsize): New function.
11654         (Object::do_section_entsize): New pure virtual function.
11655         (Relobj::finalize_local_symbols): Add new parameter.
11656         (Relobj::do_section_entsize): New function.
11657         * options.h (General_options::icf): New option.
11658         (General_options::icf_iterations): New option.
11659         (General_options::print_icf_sections): New option.
11660         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11661         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11662         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11663         icf.
11664         * symtab.cc (Symbol_table::is_section_folded): New function.
11665         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11666         to sections marked as identical by icf.
11667         * symtab.h (Symbol_table::set_icf): New function.
11668         (Symbol_table::icf): New function.
11669         (Symbol_table::is_section_folded): New function.
11670         (Symbol_table::icf_): New data member.
11671         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11672         * testsuite/Makefile.am: Add commands to build icf_test.
11673         * testsuite/Makefile.in: Regenerate.
11674         * testsuite/icf_test.sh: New file.
11675         * testsuite/icf_test.cc: New file.
11676
11677 2009-07-24  Chris Demetriou  <cgd@google.com>
11678
11679         * layout.cc (is_compressible_debug_section): Fix incorrect
11680         comment about compressed section names.
11681
11682 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11683
11684         PR 10419
11685         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11686
11687 2009-07-16  Ian Lance Taylor  <iant@google.com>
11688
11689         PR 10400
11690         * layout.h: #include <map>.
11691         (class Kept_section): Change from struct to class.  Add accessors
11692         and setters.  Add section size to Comdat_group mapping.  Change
11693         Comdat_group to std::map.  Add is_comdat_ field.  Add
11694         linkonce_size field in union.
11695         (class Layout): Update declaration of find_or_add_kept_section.
11696         Don't declare find_kept_object.
11697         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11698         parameter.  Add object, shndx, is_comdat, and is_group_name
11699         parameters.  Change all callers.  Adjust for new Kept_section.
11700         (Layout::find_kept_object): Remove.
11701         * object.cc (Sized_relobj::include_section_group): Update use of
11702         Kept_section.  Rename secnum to shndx.  Only record
11703         Kept_comdat_section if sections are the same size.
11704         (Sized_relobj::include_linkonce_section): Update use of
11705         Kept_section.  Only record Kept_comdat_section if sections are the
11706         same size.  Set size of linkonce section.
11707         (Sized_relobj::map_to_kept_section): Update call to
11708         get_kept_comdat_section.
11709         * object.h (class Sized_relobj): Rename fields in
11710         Kept_comdat_section to drop trailing underscores; change object
11711         field to Relobj*.  Change Kept_comdat_section_table to store
11712         struct rather than pointer.
11713         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11714         Add kept_object and kept_shndx parameters.  Change all callers.
11715         (Sized_relobj::get_kept_comdat_section): Change return type to
11716         bool.  Add kept_object and kept_shndx parameters.  Change all
11717         callers.
11718         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11719         Layout::find_or_add_kept_section.
11720
11721 2009-07-09  Ian Lance Taylor  <iant@google.com>
11722
11723         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11724         Reserve space in the hash table.
11725
11726 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11727
11728         * fileread.cc (File_read::get_mtime): New method.
11729         * fileread.h (Timespec): New structure.
11730         (File_read::get_mtime): New method.
11731         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11732         Renamed from timestamp_nsec.
11733         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11734         Elf_Xword.
11735         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11736         timestamp_nsec.
11737         (Incremental_inputs::report_archive): Save mtime; style fix.
11738         (Incremental_inputs::report_obejct): Save mtime; style fix.
11739         (Incremental_inputs::report_script): Save mtime; style fix.
11740         (Incremental_inputs::finalize_inputs): Style fix.
11741         (Incremental_inputs::finalize): Style fix.
11742         (Incremental_inputs::create_input_section_data): Store inputs
11743         mtime.
11744         * incremental.h (Incremental_inputs::report_script): Add mtime
11745         argument.
11746         (Incremental_inputs::Input_info::Input_info): Intialize only one
11747         union member.
11748         (Incremental_inputs::Input_info::archive): Move to nameless
11749         union.
11750         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11751         (Incremental_inputs::Input_info::script): Move to nameless union.
11752         (Incremental_inputs::mtime): New field.
11753         * script.cc (read_input_script): Pass file mtime to
11754         Incremental_input.
11755         * script.h (Script_info::inputs): Style fix.
11756
11757 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11758
11759         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11760         instead of 32.
11761
11762 2009-06-24  Ian Lance Taylor  <iant@google.com>
11763
11764         PR 10156
11765         * layout.cc (Layout::choose_output_section): If we find an
11766         existing section, update the flags.
11767         (Layout::create_notes): New function, broken out of
11768         Layout::finalize.
11769         (Layout::finalize): Don't create note sections.
11770         (Layout::create_note): Don't crash if linker script discards
11771         section.
11772         (Layout::create_gold_note): Likewise.
11773         (Layout::create_build_id): Likewise.  Don't set
11774         after_input_sections on the section.
11775         (Layout::create_executable_stack_info): Remove target parameter.
11776         Change caller.
11777         * layout.h (class Layout): Declare create_notes.  Update
11778         declaration of create_executable_stack_info.
11779         * gold.cc (queue_middle_tasks): Call create_notes.
11780         * output.cc (Output_section::update_flags_for_input_section): Move
11781         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11782         invalid.
11783         * output.h (Output_data::mark_address_invalid): New function.
11784         (class Output_section): Only declare, not define,
11785         update_flags_for_input_section.  Remove set_flags.
11786
11787 2009-06-24  Ian Lance Taylor  <iant@google.com>
11788
11789         * script-sections.cc (Output_section_definition::
11790         set_section_addresses): Rename shadowing local load_address to
11791         laddr.
11792
11793 2009-06-24  Ian Lance Taylor  <iant@google.com>
11794
11795         PR 10244
11796         * reloc.cc (relocate_sections): Skip empty relocation sections.
11797
11798 2009-06-23  Ian Lance Taylor  <iant@google.com>
11799
11800         PR 10156
11801         * layout.cc (Layout::create_note): Use choose_output_section
11802         rather than make_output_section.
11803
11804 2009-06-23  Ian Lance Taylor  <iant@google.com>
11805
11806         PR 10237
11807         * options.cc (General_options::parse_V): Set printed_version_.
11808         (General_options::General_options): Initialize printed_version_.
11809         * options.h (class General_options): Add printed_version_ field.
11810         * gold.cc (queue_initial_tasks): If there are no input files,
11811         don't give a fatal error if we printed the version information.
11812         (queue_middle_tasks): If using -r with a shared object, give a
11813         fatal error rather than an ordinary error.
11814
11815 2009-06-23  Ian Lance Taylor  <iant@google.com>
11816
11817         PR 10219
11818         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11819         (Layout::make_output_section): Set have_stabstr_section_ if we see
11820         a .stab*str section.
11821         (Layout::finalize): Call link_stabs_sections.
11822         (Layout::link_stabs_sections): New file.
11823         * layout.h (class Layout): Add have_stabstr_section_ field.
11824         Declare link_stabs_sections.
11825
11826 2009-06-23  Doug Kwan  <dougkwan@google.com>
11827
11828         * Makefile.am (libgold_a_LIBADD): New.
11829         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11830         * Makefile.in: Regenerate.
11831         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11832         * configure: Regenerate.
11833         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11834         * fileread.cc: Include sys/state.h
11835         * gold.h: Declare memmem and strndup if found missing.
11836         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11837
11838 2009-06-23  Ian Lance Taylor  <iant@google.com>
11839
11840         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11841         * configure: Rebuild.
11842
11843 2009-06-23  Ian Lance Taylor  <iant@google.com>
11844
11845         PR 10147
11846         * object.cc (Object::section_contents): Don't try to get a view if
11847         the section has length zero.
11848         (Object::handle_gnu_warning_section): If the section is empty, use
11849         the name of the section as the warning.
11850
11851 2009-06-23  Ian Lance Taylor  <iant@google.com>
11852
11853         PR 10133
11854         * stringpool.h (class Stringpool_template): Add optimize_ field.
11855         (Stringpool_template::set_optimize): New function.
11856         * stringpool.cc (Stringpool_template::Stringpool_template):
11857         Initialize optimize_ field.
11858         (Stringpool_template::set_string_offsets): Test local optimize
11859         fild rather than parameter.
11860         * layout.cc (Layout::Layout): Call set_optimize on the section
11861         name stringpool.
11862
11863 2009-06-22  Ian Lance Taylor  <iant@google.com>
11864
11865         PR 10030
11866         * yyscript.y: Parse TARGET.
11867         * script.cc (script_set_target): New function.
11868         * script-c.h (script_set_target): Declare.
11869         * options.cc (General_options::string_to_object_format): Rename
11870         from string_to_object_format in anonymous namespace.  Change
11871         callers.
11872         * options.h (class General_options): Declare
11873         string_to_object_format.
11874
11875 2009-06-22  Ian Lance Taylor  <iant@google.com>
11876
11877         * script-sections.cc (Script_sections::create_segments): Don't put
11878         program headers in a PT_LOAD segment if -n or -N.
11879
11880 2009-06-22  Ian Lance Taylor  <iant@google.com>
11881
11882         PR 10141
11883         * options.h (class General_options): Add -z lazy and -z now.  Sort
11884         -z options into alphabetical order.
11885         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11886
11887 2009-06-21  Ian Lance Taylor  <iant@google.com>
11888
11889         * layout.cc (Layout::make_output_section): Call
11890         Target::new_output_section.
11891         (Layout::attach_allocated_section_to_segment): Put large section
11892         sections in a separate load segment with the large segment flag
11893         set.
11894         (Layout::segment_precedes): Sort large data segments after other
11895         load segments.
11896         (align_file_offset): New static function.
11897         (Layout::set_segment_offsets): Use align_file_offset.
11898         * output.h (class Output_section): Add is_small_section_ and
11899         is_large_section_ fields.
11900         (Output_section::is_small_section): New function.
11901         (Output_section::set_is_small_section):  New function.
11902         (Output_section::is_large_section): New function.
11903         (Output_section::set_is_large_section): New function.
11904         (Output_section::is_large_data_section): New function.
11905         (class Output_segment): Add is_large_data_segment_ field.
11906         (Output_segment::is_large_data_segment): New function.
11907         (Output_segment::set_is_large_data_segment): New function.
11908         * output.cc (Output_section::Output_section): Initialize new
11909         fields.
11910         (Output_segment::Output_segment): Likewise.
11911         (Output_segment::add_output_section): Add assertion that large
11912         data sections always go in large data segments.  Force small data
11913         sections to the end of the list of data sections.  Force small BSS
11914         sections to the start of the list of BSS sections.  For large BSS
11915         sections to the end of the list of BSS sections.
11916         * symtab.h (class Symbol): Declare is_common_shndx.
11917         (Symbol::is_defined): Check Symbol::is_common_shndx.
11918         (Symbol::is_common): Likewise.
11919         (class Symbol_table): Define enum Commons_section_type.  Update
11920         declarations.  Add small_commons_ and large_commons_ fields.
11921         * symtab.cc (Symbol::is_common_shndx): New function.
11922         (Symbol_table::Symbol_table): Initialize new fields.
11923         (Symbol_table::add_from_object): Put small and large common
11924         symbols in the right list.
11925         (Symbol_table::sized_finalized_symbol): Check
11926         Symbol::is_common_shndx.
11927         (Symbol_table::sized_write_globals): Likewise.
11928         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11929         common symbol lists.  Don't call do_allocate_commons_list if the
11930         list is empty.
11931         (Symbol_table::do_allocate_commons_list): Remove is_tls
11932         parameter.  Add comons_section_type parameter.  Change all
11933         callers.  Handle small and large common symbols.
11934         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11935         Symbol::is_common_shndx.
11936         * resolve.cc (symbol_to_bits): Likewise.
11937         * target.h (Target::small_common_shndx): New function.
11938         (Target::small_common_section_flags): New function.
11939         (Target::large_common_shndx): New function.
11940         (Target::large_common_section_flags): New function.
11941         (Target::new_output_section): New function.
11942         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11943         small_common_section_flags, and large_common_section_flags
11944         fields.
11945         (Target::do_new_output_section): New virtual function.
11946         * arm.cc (Target_arm::arm_info): Initialize new fields.
11947         * i386.cc (Target_i386::i386_info): Likewise.
11948         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11949         Likewise.
11950         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11951         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11952         (Target_x86_64::do_new_output_section): New function.
11953         * configure.ac: Define conditional MCMODEL_MEDIUM.
11954         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11955         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11956         (large_LDFLAGS): Define.
11957         * testsuite/large.c: New file.
11958         * testsuite/testfile.cc (Target_test::test_target_info):
11959         Initialize new fields.
11960         * configure, testsuite/Makefile.in: Rebuild.
11961
11962 2009-06-05  Doug Kwan  <dougkwan@google.com>
11963
11964         * Makefile.am (CCFILES): Add target.cc.
11965         * Makefile.in: Regenerate.
11966         * i386.cc (class Target_i386): Define new virtual method to
11967         override do_is_local_label_name in parent.
11968         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11969         local symbols if --discard-locals or -X is given.
11970         * options.h (class General_options): Declare new options
11971         '--discard-locals' and '-X' for discarding locals.
11972         * target.h (class Target): Define new methods is_local_label_name.
11973         Declare new virtual method do_is_local_label_name.
11974         * target.cc: New file.
11975         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11976         (check_SCRIPTS): Add discard_locals_test.sh.
11977         (check_DATA): Add discard_local_tests.syms.
11978         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11979         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11980         * testsuite/Makefile.in: Regenerate.
11981         * testsuite/discard_locals_test.c: New file.
11982         * testsuite/discard_locals_test.sh: Same.
11983
11984 2009-06-05  Doug Kwan  <dougkwan@google.com>
11985
11986         * object.cc (Sized_relobj::Sized_relobj): Initialize
11987         discarded_eh_frame_shndx_ to -1U.
11988         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11989         section.
11990         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11991         a discarded .eh_frame section.
11992         (Sized_relobj::do_finalize_local_symbols): Ditto.
11993         * object.h (class Sized_relobj): Declare new member
11994         discarded_eh_frame_shndx_.
11995         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11996         (local_labels_test.o, local_labels_test): New rules.
11997         * testsuite/Makefile.in: Regenerate.
11998
11999 2009-06-04  Doug Kwan  <dougkwan@google.com>
12000
12001         * layout.cc (Layout::section_name_mapping): Add mapping for
12002         special ARM sections.
12003
12004 2009-06-03  Doug Kwan  <dougkwan@google.com>
12005
12006         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12007         (utils::has_overflow): Same.
12008
12009 2009-06-03  Ian Lance Taylor  <iant@google.com>
12010
12011         * layout.cc (Layout::section_name_mapping): New array, replacing
12012         Layout::linkonce_mapping.
12013         (Layout::section_name_mapping_count): New variable, replacing
12014         Layout::linkonce_mapping_count.
12015         (Layout::linkonce_output_name): Remove.
12016         (Layout::output_section_name): Rewrite.
12017         * layout.h (class Layout): Rename Linkonce_mapping to
12018         Section_name_mapping, linkonce_mapping to section_name_mapping,
12019         linkonce_mapping_count to section_name_mapping_count.  Don't
12020         declare linkonce_output_name.
12021
12022 2009-06-03  Doug Kwan  <dougkwan@google.com>
12023
12024         * gold/arm.cc (namespace utils): New.
12025         (Target_arm::reloc_is_non_pic): Define new method.
12026         (class Arm_relocate_functions): New.
12027         (Target_arm::Relocate::relocate): Handle relocation types used by
12028         Android.
12029
12030 2009-06-03  Ian Lance Taylor  <iant@google.com>
12031
12032         * arm.cc (Target_arm::scan::global): Use || instead of |.
12033
12034 2009-06-02  Doug Kwan  <dougkwan@google.com>
12035
12036         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12037         issued_non_pic_error_.
12038         (class Target_arm::Scan): Declare new method check_non_pic.
12039         Define new method symbol_needs_plt_entry.
12040         Declare new data member issued_non_pic_error_.
12041         (class Target_arm::Relocate): Declare new method
12042         should_apply_static_reloc.
12043         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12044         (Target_arm::Scan::check_non_pic): Define new method.
12045         (Target_arm::Scan::local): Handle a small subset of reloc types used
12046         by Android.
12047         (Target_arm::Scan::local): Same.
12048         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12049
12050 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12051
12052         * incremental.cc (Incremental_inputs::report_command_line): Filter
12053         out --incremental-* options.
12054
12055 2009-05-29  Doug Kwan  <dougkwan@google.com>
12056
12057         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12058         template class.
12059         (class Target_arm): Update comment.
12060         (Target_arm::Target_arm): Initialize new data members GOT_,
12061         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12062         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12063         and Target_arm::rel_dyn_section.
12064         Declare new_enum Target_arm::Got_type.
12065         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12066         and DYNBSS_.
12067         Update commments for member do_dynsym_value.
12068         (Target_arm::got_size, Target_arm::plt_section,
12069         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12070         new methods inside class defintion.
12071         (Target_arm::got_section): Define new method.
12072         (Target_arm::rel_dyn_section): Same.
12073         (Output_data_plt_arm): New template class.
12074         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12075         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12076         (Output_data_plt_arm::add_entry): Same.
12077         (Output_data_plt_arm::first_plt_entry): Define new
12078         static data member for PLT instruction template.
12079         (Output_data_plt_arm::plt_entry): Same.
12080         (Output_data_plt_arm::do_write): Define new method.
12081         (Target_arm::make_plt_entry): Same.
12082         (Target_arm::do_finalize_sections): Same.
12083         (Target_arm::do_dynsym_value): Same.
12084
12085 2009-05-28  Doug Kwan  <dougkwan@google.com>
12086
12087         * Makefile.am (TARGETSOURCES): Add arm.cc.
12088         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12089         * Makefile.in: Regenerate.
12090         * arm.cc: New file.
12091         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12092
12093 2009-05-26  Doug Kwan  <dougkwan@google.com>
12094
12095         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12096         (General_options::check_excluded_libs): Strip off directories in
12097         archive name before matching like GNU ld does.
12098         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12099         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12100         (exclude_libs_test_LDFLAGS): Add linker option
12101         -Wl,--exclude-libs,libexclude_libs_test_3
12102         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12103         an explicit archive without using -l.
12104         (alt/libexclude_libs_test_3.a): New make rule.
12105         * testsuite/Makefile.in: Regenerate.
12106         * testsuite/exclude_libs_test.c : Declare lib3_default().
12107         (main): Call it.
12108         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12109         * exclude_libs_test_3.c: New file.
12110
12111 2009-05-26  Nick Clifton  <nickc@redhat.com>
12112
12113         * po/id.po: New Indonesian translation.
12114         * po/gold.pot: Updated template file.
12115
12116 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12117
12118         * testsuite/Makefile.am: Add -ffunction-sections to compile
12119         gc_comdat_test files.  Add -Wl,--gc-sections to build
12120         gc_comdat_test.
12121         * testsuite/Makefile.in: Regenerate.
12122         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12123
12124 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12125
12126         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12127         kept comdat section was garbage collected.
12128         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12129         * testsuite/Makefile.in: Regenerate.
12130         * testsuite/gc_comdat_test.sh: New file.
12131         * testsuite/gc_comdat_test_1.cc: New file.
12132         * testsuite/gc_comdat_test_2.cc: New file.
12133
12134 2009-05-19  Doug Kwan  <dougkwan@google.com>
12135
12136         * archive.cc (Archive::Archive): Move constructor from archive.h
12137         to here.  Initialize no_export_.
12138         (Archive::get_elf_object_for_member): Set no_export flag of object.
12139         * archive.h (Archive::Archive): Move constructor body to
12140         archive.cc.
12141         (Archive::no_export): New method.
12142         (Archive::no_export_): New field.
12143         * object.h (Object::Object): Initialize no_export_ to false.
12144         (Object::no_export, Object::set_no_export): New methods.
12145         (Object::no_export_): New field.
12146         * options.cc (General_options::parse_exclude_libs): New method.
12147         (General_options::check_excluded_libs) Same.
12148         * options.h (exclude_libs): New option.
12149         (General_options::check_excluded_libs): New method declaration.
12150         (General_options::excluded_libs_): New field.
12151         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12152         default or protected visibility if an object has no-export flag set.
12153         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12154         (check_SCRIPTS): Add exclude_libs_test.sh.
12155         (check_DATA): Add exclude_libs_test.syms.
12156         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12157         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12158         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12159         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12160         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12161         libexclude_libs_test_2.a): New rules.
12162         * testsuite/Makefile.in: Regenerate.
12163         * testsuite/exclude_libs_test.c: New file.
12164         * testsuite/exclude_libs_test.sh: Ditto.
12165         * testsuite/exclude_libs_test_1.c: Ditto.
12166         * testsuite/exclude_libs_test_2.c: Ditto.
12167
12168 2009-05-15  Ian Lance Taylor  <iant@google.com>
12169
12170         * configure.ac: Check for declarations for cases where libiberty.h
12171         checks HAVE_DECL_xxx.
12172         * configure, config.in: Rebuild.
12173
12174 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12175
12176         * gold.h (Incremental_argument_list): Remove (invalid) forward
12177         declaration.
12178         * incremental.cc (Incremental_inputs::report_achive): New method.
12179         (Incremental_inputs::report_object): New method.
12180         (Incremental_inputs::report_script): New method.
12181         (Incremental_inputs::finalize_inputs): New method.
12182         (Incremental_inputs::finalize): Call finalize_inputs().
12183         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12184         Create inputs entries.
12185         * incremental.h (Incremental_input_type): New enum.
12186         (Incremental_inputs::Incremental_input): Initialize new fields.
12187         (Incremental_inputs::report_inputs): New method.
12188         (Incremental_inputs::report_achive): New method.
12189         (Incremental_inputs::report_object): New method.
12190         (Incremental_inputs::report_script): New method.
12191         (Incremental_inputs::finalize_inputs): New method.
12192         (Incremental_inputs::Input_info): New struct.
12193         (Incremental_inputs::Input_info_map): New typedef.
12194         (Incremental_inputs::lock_): New field.
12195         (Incremental_inputs::Inputs_): New field.
12196         (Incremental_inputs::Inputs_map): New field.
12197         * main.cc (main): Call Incremental_input::report_inputs.
12198         * options.h (Input_argument_list): Typedef moved from
12199         Input_arguments.
12200         (Input_file_group::Files): Remove, use ::Input_argument_list.
12201         (Input_file_group::Input_argument_list): Remove, use
12202         ::Input_argument_list.
12203         * plugin.cc (Plugin_manager::add_input_file): Add error in
12204         incremental build.
12205         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12206         functions.
12207         * script.cc (read_input_script): Call
12208         Incremental_input::report_script.
12209         * script.h (Script_info): New class.
12210
12211 2009-04-27  Ian Lance Taylor  <iant@google.com>
12212
12213         * x86_64.cc (do_adjust_output_section): Set entsize to
12214         plt_entry_size.
12215
12216 2009-04-23  Elliott Hughes  <enh@google.com>
12217
12218         * output.cc (Output_file::close): After short writes, continue
12219         writing from the correct offset in the buffer being written.
12220
12221 2009-04-23  Chris Demetriou  <cgd@google.com>
12222
12223         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12224         * configure: Regenerate.
12225         * config.in: Regenerate.
12226         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12227         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12228
12229 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12230
12231         * incremental.cc (Incremental_inputs_header_data): Renamed from
12232         Incremental_input_header_data.
12233         (Incremental_inputs_header_data::data_size): New field.
12234         (Incremental_inputs_header_data::put_input_file_count): Renamed
12235         from input_file_count.
12236         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12237         from command_line_offset.
12238         (Incremental_inputs_header_data::put_reserved): Renamed from
12239         put_reserved.
12240         (Incremental_inputs_entry_data): Renamed from
12241         Incremental_input_entry_data.
12242         (Incremental_inputs_entry_data::data_size): New field.
12243         (Incremental_inputs::report_command_line): New method.
12244         (Incremental_inputs::finalize): New method.
12245         (Incremental_inputs::create_incremental_inputs_data): New method.
12246         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12247         * incremental.h: New file.
12248         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12249         (Layout::finalize): Create incremental inputs section in
12250         incremental builds.
12251         (Layout::create_incremental_info_sections): New method.
12252         * layout.h (Layout::incremental_inputs): New method.
12253         (Layout::create_incremental_info_sections): New method.
12254         (Layout::incremental_inputs_): New field.
12255         * main.cc (main): Notify Incremental_input of the command line.
12256
12257 2009-04-01  Ian Lance Taylor  <iant@google.com>
12258             Mikolaj Zalewski  <mikolajz@google.com>
12259
12260         * gold.h (reserve_unordered_map): Define, three versions, one for
12261         each version of Unordered_map.
12262         * layout.cc (Layout::Layout): Remove options parameter.  Add
12263         number_of_input_files parameter.  Don't initialize options_.
12264         Initialize number_of_input_files_ and resized_signatures_.  Move
12265         sections_are_attached_.
12266         (Layout::layout_group): Reserve space for group_signatures_.
12267         (Layout::find_or_add_kept_section): Change name parameter to be a
12268         reference.  Resize signatures_ map when it gets large enough.
12269         (Layout::layout_eh_frame): Use parameters->options() instead of
12270         this->options_.
12271         (Layout::make_output_section): Likewise.
12272         (Layout::attach_allocated_section_to_segment): Likewise.
12273         (Layout::finalize, Layout::create_executable_stack): Likewise.
12274         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12275         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12276         * layout.h (class Layout): Update declarations.  Remove options_
12277         field.  Add number_of_input_files_ and resized_signatures_
12278         fields.  Move sections_are_attached_ field.
12279         * main.cc (main): Pass number of input files to Layout
12280         constructor.  Don't pass options.
12281
12282 2009-03-30  Ian Lance Taylor  <iant@google.com>
12283
12284         * ffsll.c (ffsll): Correct implementation.
12285
12286 2009-03-27  Ian Lance Taylor  <iant@google.com>
12287
12288         * ffsll.c: New file.
12289         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12290         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12291         * ftruncate.c (ftruncate): Declare before definition.
12292         * mremap.c (mremap): Likewise.
12293         * pread.c (pread): Likewise.
12294         * configure, Makefile.in, config.in: Rebuild.
12295
12296         * mremap.c: New file.
12297         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12298         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12299         (mremap): Declare if HAVE_MREMAP is not defined.
12300         * configure, Makefile.in, config.in: Rebuild.
12301
12302 2009-03-27  Cary Coutant  <ccoutant@google.com>
12303
12304         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12305         position independent.
12306         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12307         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12308
12309 2009-03-24  Cary Coutant  <ccoutant@google.com>
12310
12311         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12312         an executable.
12313         (needs_dynamic_reloc): Likewise.
12314
12315 2009-03-24  Ian Lance Taylor  <iant@google.com>
12316
12317         * yyscript.y (file_cmd): Recognize EXTERN.
12318         (extern_name_list, extern_name_list_body): New nonterminals.
12319         * script.cc (script_add_extern): Define.
12320         * script-c.h (script_add_extern): Declare.
12321
12322 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12323
12324         * object.cc (is_elf_object): Define.
12325         * object.h (is_elf_object): Declare.
12326         * archive.cc (Archive::get_elf_object_for_member): Call
12327         is_elf_object.
12328         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12329
12330 2009-03-24  Elliott Hughes  <enh@google.com>
12331
12332         * output.cc (Output_file::map_anonymous): Define.
12333         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12334         try an anonymous one.  Report the size if the mmap fails.
12335         * output.h (class Output_file): Declare map_anonymous.
12336
12337 2009-03-24  Ian Lance Taylor  <iant@google.com>
12338
12339         * target-select.cc (instantiate_target): Don't acquire the lock if
12340         the instantiated_target_ field has already been set.
12341
12342 2009-03-23  Ian Lance Taylor  <iant@google.com>
12343
12344         * gold-threads.h (class Initialize_lock): Define.
12345         * gold-threads.cc (class Initialize_lock_once): Define.
12346         (initialize_lock_control): New static variable.
12347         (initialize_lock_pointer): New static variable.
12348         (initialize_lock_once): New static function.
12349         (Initialize_lock::Initialize_lock): Define.
12350         (Initialize_lock::initialize): Define.
12351         * target-select.h: Include "gold-threads.h".
12352         (class Target_selector): Add lock_ and initialize_lock_ fields.
12353         Don't define instantiate_target, just declare it.
12354         * target-select.cc (Target_selector::Target_selector): Initialize
12355         new fields.
12356         (Target_selector::instantiate_target): Define.
12357         * descriptors.h: Include "gold-threads.h".
12358         (class Descriptors): Add initialize_lock_ field.
12359         * descriptors.cc (Descriptors::Descriptors): Initialize new
12360         field.
12361         (Descriptors::open): Use initialize_lock_ field
12362         * errors.h (class Errors): Add initialize_lock_ field.
12363         * errors.cc (Errors::Errors): Initialize new field.
12364         (Errors::initialize_lock): Use initialize_lock_ field.
12365         * powerpc.cc (class Target_selector_powerpc): Remove
12366         instantiated_target_ field.  In do_recognize call
12367         instantiate_target rather than do_instantiate_target.  In
12368         do_instantiate_target just allocate a new target.
12369         * sparc.cc (class Target_selector_sparc): Likewise.
12370
12371         * freebsd.h: New file.
12372         * i386.cc: Include "freebsd.h".
12373         (Target_i386): Derive from Target_freebsd rather than
12374         Sized_target.
12375         (Target_selector_i386): Derive from Target_selector_freebsd rather
12376         than Target_selector.
12377         * x86_64.cc: Include "freebsd.h".
12378         (Target_x86_64): Derive from Target_freebsd rather than
12379         Sized_target.
12380         (Target_selector_x86_64): Derive from Target_selector_freebsd
12381         rather than Target_selector.
12382         * target.h (class Target): Add adjust_elf_header and
12383         do_adjust_elf_header.
12384         * output.cc (Output_file_header:: do_sized_write): Call target
12385         adjust_elf_header routine.
12386         * configure.tgt: Set targ_osabi.
12387         * configure.ac: Define GOLD_DEFAULT_OSABI.
12388         * parameters.cc (Parameters::default_target): Pass
12389         GOLD_DEFAULT_OSABI to select_target.
12390         * target-select.h (class Target_selector): Make instantiate_target
12391         protected rather than private.
12392         * Makefile.am (HFILES): Add freebsd.h.
12393         * configure, Makefile.in, config.in: Rebuild.
12394
12395         * merge.cc (do_add_input_section): Correct pend value.  Change
12396         message about last entry not being null terminated from error to
12397         warning.
12398
12399 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12400
12401         * incremental.cc: New file.
12402         * Makefile.am (CCFILES): Add incremental.cc.
12403         * Makefile.in: Rebuild.
12404
12405 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12406
12407         * layout.cc (Layout::output_section_name): Preserve names
12408         of '.note.' sections.
12409
12410 2009-03-19  Ian Lance Taylor  <iant@google.com>
12411
12412         * descriptors.cc (Descriptors::open): Check that the options are
12413         valid before using them.
12414
12415 2009-03-18  Ian Lance Taylor  <iant@google.com>
12416
12417         * script-sections.h: Include <list>.
12418         (class Script_sections): Change Sections_elements from std::vector
12419         to std::list.  Typedef public Elements_iterator.  Add
12420         orphan_section_placement_, data_segment_align_start_, and
12421         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12422         field.
12423         * script-sections.cc (class Orphan_section_placement): New class.
12424         (class Sections_element): Add virtual functions is_relro and
12425         orphan_section_init.  Remove virtual function place_orphan_here.
12426         (class Output_section_definition): Add is_relro and
12427         orphan_section_init.  Remove place_orphan_here.
12428         (class Orphan_output_section): Likewise.
12429         (Script_sections::Script_sections): Update for field changes.
12430         (Script_sections::data_segment_align): Set saw_data_segment_align_
12431         and data_segment_align_start_, not data_segment_align_index.
12432         (Script_sections::data_segment_relro_end): Check
12433         saw_data_segment_align_.  Use data_segment_align_start_ rather
12434         than data_segment_align_index_.
12435         (Script_sections::place_orphan): Rewrite to use
12436         Orphan_section_placement.
12437
12438 2009-03-17  Ian Lance Taylor  <iant@google.com>
12439
12440         * archive.cc (Archive::add_symbols): Check for a version attached
12441         to the symbol name in the archive map.
12442         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12443         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12444         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12445         (ver_test_11.a): New target.
12446         * testsuite/Makefile.in: Rebuild.
12447
12448         * configure.ac: Check for chsize and posix_fallocate.  Replace
12449         ftruncate.
12450         * ftruncate.c: New file, from gnulib.
12451         * output.cc (posix_fallocate): Define dummy version if not
12452         HAVE_POSIX_FALLOCATE.
12453         (Output_file::map): Call posix_fallocate rather than lseek and
12454         write.
12455         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12456         * configure, Makefile.in, config.in: Rebuild.
12457
12458 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12459
12460         * layout.h (Layout::create_note): Add section_name parameter.
12461         * layout.cc (Layout::create_note): Likewise.
12462         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12463
12464 2009-03-17  Ian Lance Taylor  <iant@google.com>
12465
12466         * descriptors.cc: Include "options.h".
12467         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12468         (Descriptors::open): Always use O_CLOEXEC when opening a new
12469         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12470         then set FD_CLOEXEC.
12471
12472         * sparc.cc (class Target_sparc): Add has_got_section.
12473         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12474         make sure we have a GOT section.
12475
12476         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12477         (Target_sparc::Scan::local): Likewise.
12478         (Target_sparc::Scan::global): Likewise.
12479         (Target_sparc::Relocate::relocate): Likewise.
12480         (Target_sparc::Relocate::relocate_tls): Likewise.
12481
12482         * symtab.cc (Symbol_table::define_default_version): New function,
12483         broken out of add_from_object.
12484         (Symbol_table::add_from_object): Call define_default_version.
12485         (Symbol_table::define_special_symbol): Add resolve_oldsym
12486         parameter.  Change all callers.  If the version for a symbol comes
12487         from a version script, resolve it with the symbol with the same
12488         name with no version.  Also add the symbol without a version if
12489         appropriate.
12490         (do_define_in_output_data): If resolving with oldsym, don't delete
12491         sym.
12492         (do_define_in_output_segment): Likewise.
12493         (do_define_as_constant): Likewise.
12494         * symtab.h (class Symbol_table): Update declarations.
12495
12496 2009-03-13  Ian Lance Taylor  <iant@google.com>
12497
12498         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12499         (Read_symbols::requeue): New function.
12500         (Read_symbols::do_read_symbols): If make_elf_object fails because
12501         the target type is not configured, and the file was searched for,
12502         issue a warning and retry with the next directory.
12503         (Add_symbols::run): If the file has an incompatible format, and
12504         it was searched for, requeue the Read_symbols task.  On error,
12505         release the object.
12506         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12507         dirindex parameter to constructor.  Change all callers.  Declare
12508         incompatible_warning and requeue.
12509         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12510         input_argument_ and input_group_ fields.  Add them to
12511         constructor.  Change all callers.
12512         (class Read_script): Add dirindex_ field.  Add it to constructor.
12513         Change all callers.
12514         * archive.cc (Archive::setup): Remove input_objects parameter.
12515         Change all callers.
12516         (Archive::get_file_and_offset): Likewise.
12517         (Archive::read_all_symbols): Likewise.
12518         (Archive::read_symbols): Likewise.
12519         (Archive::get_elf_object_for_member): Remove input_objects
12520         parameter.  Add punconfigured parameter.  Change all callers.
12521         (Archive::add_symbols): Change return type to bool.  Check return
12522         value of include_member.
12523         (Archive::include_all_members): Likewise.
12524         (Archive::include_member): Change return type to bool.  Return
12525         false if first included object has incompatible target.  Set
12526         included_member_ field.
12527         (Add_archive_symbols::run): If add_symbols returns false, requeue
12528         Read_symbols task.
12529         * archive.h (class Archive): Add included_member_ field.
12530         Initialize it in constructor.  Add input_file and searched_for
12531         methods.  Update declarations.
12532         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12533         input_argument_ fields.  Add them to constructor.  Change all
12534         callers.
12535         * script.cc: Include "target-select.h".
12536         (class Parser_closure): Add skip_on_incompatible_target_ and
12537         found_incompatible_target_ fields.  Add
12538         skip_on_incompatible_target parameter to constructor.  Change all
12539         callers.  Add methods skip_on_incompatible_target,
12540         clear_skip_on_incompatible_target, found_incompatible_target, and
12541         set_found_incompatible_target.
12542         (read_input_script): Add dirindex parameter.  Change all callers.
12543         If parser finds an incompatible target, requeue Read_symbols
12544         task.
12545         (script_set_symbol): Clear skip_on_incompatible_target in
12546         closure.
12547         (script_add_assertion, script_parse_option): Likewise.
12548         (script_start_sections, script_add_phdr): Likewise.
12549         (script_check_output_format): New function.
12550         * script.h (read_input_script): Update declaration.
12551         * script-c.h (script_check_output_format): Declare.
12552         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12553         (ignore_cmd): Remove OUTPUT_FORMAT.
12554         * fileread.cc (Input_file::Input_file): Add explicit this.
12555         (Input_file::will_search_for): New function.
12556         (Input_file::open): Add pindex parameter.  Change all callers.
12557         * fileread.h (class Input_file): Add input_file_argument method.
12558         Declare will_search_for.  Update declarations.
12559         * object.cc (make_elf_object): Add punconfigured parameter.
12560         Change all callers.
12561         * object.h (class Object): Make input_file public.  Add
12562         searched_for method.
12563         (make_elf_object): Update declaration.
12564         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12565         restart search.
12566         * dirsearch.h (class Dirsearch): Update declaration.
12567         * options.h (class General_options): Add --warn-search-mismatch.
12568         * parameters.cc (Parameters::is_compatible_target): New function.
12569         * parameters.h (class Parameters): Declare is_compatible_target.
12570         * workqueue.cc (Workqueue::add_blocker): New function.
12571         * workqueue.h (class Workqueue): Declare add_blocker.
12572
12573         * fileread.cc (Input_file::open): Remove options parameter.
12574         Change all callers.
12575         (Input_file::open_binary): Likewise.
12576         * script.cc (read_input_script): Likewise.
12577         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12578         options parameter from constructor.  Change all callers.
12579         (class Read_script): Likewise.
12580         * fileread.h (class Input_file): Update declarations.
12581         * script.h (read_input_script): Update declaration.
12582
12583 2009-03-10  Nick Clifton  <nickc@redhat.com>
12584
12585         * po/es.po: New Spanish translation.
12586
12587 2009-03-06  Cary Coutant  <ccoutant@google.com>
12588
12589         * options.cc (parse_short_option): Keep dash_z from registering itself.
12590
12591 2009-03-03  Ian Lance Taylor  <iant@google.com>
12592
12593         PR 9918
12594         * target-reloc.h (relocate_section): Pass output_section to
12595         relocate.
12596         * i386.cc (Target_i386::should_apply_static_reloc): Add
12597         output_section parameter.  Change all callers.
12598         (Target_i386::Relocate::relocate): Add output_section parameter.
12599         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12600         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12601         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12602         * testsuite/two_file_shared.sh: New script.
12603         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12604         (check_DATA): Add two_file_shared.dbg.
12605         (two_file_shared.dbg): New target.
12606         * testsuite/Makefile.in: Rebuild.
12607
12608 2009-03-01  Ian Lance Taylor  <iant@google.com>
12609
12610         * configure.ac: Check for byteswap.h.
12611         * configure: Rebuild.
12612         * config.in: Rebuild.
12613
12614 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12615
12616         * layout.cc (Layout::find_or_add_kept_section): New function.
12617         (Layout::add_comdat): Removed.
12618         * layout.h (struct Kept_section): Move out of class Layout.
12619         Remove trailing underscores from field names.  Add group_sections
12620         field.  Rename group_ field to is_group.  Change all uses.
12621         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12622         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12623         comdat_groups_ field.
12624         (Sized_relobj::include_section_group): Use
12625         find_or_add_kept_section and Kept_section::group_sections.
12626         (Sized_relobj::include_linkonce_section): Likewise.
12627         * object.cc (class Sized_relobj): Don't define Comdat_group or
12628         Comdat_group_table.  Remove find_comdat_group and
12629         add_comdat_group.  Remove comdat_groups_ field.
12630         * plugin.cc (include_comdat_group): Use
12631         Layout::find_or_add_kept_section.
12632
12633 2009-02-28  Ian Lance Taylor  <iant@google.com>
12634
12635         * README: --gc-sections and map files are now supported.  Document
12636         some build requirements.
12637
12638         PR 6992
12639         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12640         relocatable link set the value of the section symbol to zero.
12641         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12642         relocatable link don't include the section address in the local
12643         symbol value.
12644
12645 2009-02-27  Ian Lance Taylor  <iant@google.com>
12646
12647         PR 6811
12648         * options.h (class Search_directory): Add is_system_directory.
12649         (class General_options): Declare is_in_system_directory.
12650         * options.cc (get_relative_sysroot): Make static.
12651         (get_default_sysroot): Make static.
12652         (General_optoins::is_in_system_directory): New function.
12653         * fileread.cc (Input_file::is_in_system_directory): New function.
12654         * fileread.h (class Input_file): Declare is_in_system_directory.
12655         * object.h (class Object): Add is_in_system_directory.
12656         (class Input_objects): Remove system_library_directory_ field.
12657         * object.cc (Input_objects::add_object): Don't set
12658         system_library_directory_.
12659         (input_objects::found_in_system_library_directory): Remove.
12660         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12661         parameter.  Change all callers.
12662         (Symbol_table::sized_write_globals): Likewise.
12663         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12664         Call Object::is_in_system_directory.
12665         * symtab.h (class Symbol_table): Update declarations.
12666
12667         PR 5990
12668         * descriptors.h (Open_descriptor): Add is_on_stack field.
12669         * descriptors.cc (Descriptors::open): If the descriptor is on the
12670         top of the stack, remove it.  Initialize is_on_stack field.
12671         (Descriptors::release): Only add pod to stack if it is not on the
12672         stack already.
12673         (Descriptors::close_some_descriptor): Clear stack_next and
12674         is_on_stack fields.
12675
12676         PR 7091
12677         * output.cc (Output_section::find_starting_output_address): Rename
12678         from starting_output_address; add PADDR parameter; change return
12679         type.
12680         * output.h (class Output_section): Declare
12681         find_starting_output_address instead of starting_output_address.
12682         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12683         section symbol for which we can't find a merge section.
12684
12685         PR 9836
12686         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12687         hidden or internal, force the symbol to be local.
12688         * resolve.cc (Symbol::override_visibility): Define.
12689         (Symbol::override_base): Use override_visibility.
12690         (Symbol_table::resolve): Likewise.
12691         (Symbol::override_base_with_special): Likewise.
12692         (Symbol_table::override_with_special): If the visibility is hidden
12693         or internal, force the symbol to be local.
12694         * symtab.h (class Symbol): Add set_visibility and
12695         override_visibility.
12696         * testsuite/ver_test_1.sh: New file.
12697         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12698         (check_DATA): Add ver_test_1.syms.
12699         (ver_test_1.syms): New target.
12700         * testsuite/Makefile.in: Rebuild.
12701
12702 2009-02-25  Cary Coutant  <ccoutant@google.com>
12703
12704         * layout.cc (Layout::choose_output_section): Don't rename sections
12705         when using a linker script that has a SECTIONS clause.
12706         * Makefile.in: Regenerate.
12707
12708         * testsuite/Makefile.am (script_test_5.sh): New test case.
12709         * testsuite/Makefile.in: Regenerate.
12710         * testsuite/script_test_5.cc: New file.
12711         * testsuite/script_test_5.sh: New file.
12712         * testsuite/script_test_5.t: New file.
12713
12714 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12715
12716         * archive.cc (Archive::include_member): Update calls to add_symbols.
12717         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12718         the Layout argument.
12719         * dynobj.h (do_add_symbols): Add the Layout argument.
12720         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12721         Layout argument.
12722         * object.h (Object::add_symbols): Add the Layout argument.
12723         (Object::do_add_symbols): Add the Layout argument.
12724         (Sized_relobj::do_add_symbols): Add the Layout argument.
12725         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12726         Unify the two versions.
12727         (Add_plugin_symbols): Remove.
12728         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12729         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12730         (Add_plugin_symbols): Remove.
12731         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12732         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12733         (Add_symbols::run): Make it work with Pulginobj.
12734
12735 2009-02-06  Ian Lance Taylor  <iant@google.com>
12736
12737         * object.cc (Sized_relobj::do_layout): Make info message start
12738         with lower case letter.
12739
12740 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12741
12742         * binary.cc: Fix file comment.
12743
12744         * options.h (enum Incremental_disposition): Define.
12745         (class General_options): Add new options: --incremental,
12746         --incremental_changed, --incremental_unchanged,
12747         --incremental_unknown.  Add incremental_disposition_ and
12748         implicit_incremental_ fields.
12749         (General_options::incremental_disposition): New function.
12750         (class Position_dependent_options): Add incremental_disposition
12751         option.
12752         (Position_dependent_options::copy_from_options): Set incremental
12753         dispositions.
12754         * options.cc (General_options::parse_incremental_changed): New
12755         function.
12756         (General_options::parse_incremental_unchanged): New function.
12757         (General_options::parse_incremental_unknown): New function.
12758         (General_options::General_options): Initialize new fields
12759         incremental_disposition_ and implicit_incremental_.
12760         (General_options::finalize): Check for uasge of --incremental-*
12761         without --incremental.
12762
12763 2009-02-06  Chris Demetriou  <cgd@google.com>
12764
12765         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12766         pointer and to report location as the file name associated with
12767         the symbol.
12768         (gold_undefined_symbol_at_location): New function to replace the
12769         old gold_undefined_symbol functionality.
12770         * target-reloc.h (relocate_section): Update to use
12771         gold_undefined_symbol_at_location.
12772         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12773         Call gold_undefined_symbol function rather than gold_error.
12774         * errors.h (Errors::undefined_symbol): Take location as a
12775         string, rather than calculating it from a relocation.
12776         * errors.cc (Errors::fatal): Print "fatal error:" before the
12777         formatted message.
12778         (Errors::error, Errors::error_at_location): Print "error: "
12779         before the formatted message.
12780         (Errors::undefined_symbol): Take location as a string, rather
12781         than calculating it from a relocation.
12782         (gold_undefined_symbol_at_location): New function akin to
12783         old gold_undefined_symbol, calculates location from relocation.
12784         (gold_undefined_symbol): Change to take only a Symbol pointer
12785         and to report location as the file name associated with the symbol.
12786         * testsuite/debug_msg.sh: Update for changed error messages.
12787         * testsuite/undef_symbol.sh: Likewise.
12788
12789 2009-02-04  Duncan Sands  <baldrick@free.fr>
12790
12791         PR 9812
12792         * reduced_debug_output.h
12793         (Output_reduced_debug_abbrev_section::failed): Use format for
12794         gold_warning.
12795         (Output_reduced_debug_info_section::faild): Likewise.
12796
12797 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12798
12799         * script.cc (Lazy_demangler): New class.
12800         (Version_script_info::get_symbol_version_helper): Demangle a
12801         symbol only once.
12802
12803 2009-01-29  Cary Coutant  <ccoutant@google.com>
12804
12805         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12806         to __tls_get_addr.
12807         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12808
12809 2009-01-28  Ian Lance Taylor  <iant@google.com>
12810
12811         * version.cc (version_string): Bump to 1.9.
12812
12813         * gold.h: Include <cstring> and <stdint.h>.
12814         * version.cc: Include <cstdio>.
12815         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12816         warning.
12817         * reduced_debug_output.cc (insert_into_vector): Rename from
12818         Insert_into_vector; change all callers.  Use Swap_unaligned to
12819         avoid aliasing issue; remove union since it is unnecessary.
12820
12821 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12822
12823         * Makefile.am (CCFILES): Add gc.cc.
12824         (HFILES): Add gc.h.
12825         * Makefile.in: Regenerate.
12826         * gold.cc (Gc_runner): New class.
12827         (queue_initial_tasks): Call garbage collection related tasks
12828         when corresponding options are invoked.
12829         (queue_middle_gc_tasks): New function.
12830         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12831         processed early before laying out sections during garbage collection.
12832         * gold.h (queue_middle_gc_tasks): New function.
12833         (is_prefix_of): Move from "layout.cc".
12834         * i386.cc (Target_i386::gc_process_relocs): New function.
12835         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12836         * main.cc (main): Create object of class "Garbage_collection".
12837         * object.cc (Relobj::copy_symbols_data): New function.
12838         (Relobj::is_section_name_included): New function.
12839         (Sized_relobj::do_layout): Allow this function to be called twice
12840         during garbage collection and defer layout of section during the
12841         first call.
12842         * object.h (Relobj::get_symbols_data): New function.
12843         (Relobj::is_section_name_included): New function.
12844         (Relobj::copy_symbols_data): New function.
12845         (Relobj::set_symbols_data): New function.
12846         (Relobj::get_relocs_data): New function.
12847         (Relobj::set_relocs_data): New function.
12848         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12849         (Relobj::gc_process_relocs): New function.
12850         (Relobj::do_gc_process_relocs): New pure virtual function.
12851         (Relobj::sd_): New data member.
12852         (Sized_relobj::is_output_section_offset_invalid): New function.
12853         (Sized_relobj::do_gc_process_relocs): New function.
12854         * options.h (General_options::gc_sections): Modify to not be a no-op.
12855         (General_options::print_gc_sections): New option.
12856         * plugin.cc (Plugin_finish::run): Remove function call to
12857         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12858         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12859         * reloc.cc (Read_relocs::run): Add task to process relocs and
12860         determine unreferenced sections when doing garbage collection.
12861         (Gc_process_relocs): New class.
12862         (Sized_relobj::do_gc_process_relocs): New function.
12863         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12864         sections that are garbage collected.
12865         * reloc.h (Gc_process_relocs): New class.
12866         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12867         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12868         symbols whose corresponding sections are garbage collected.
12869         (Symbol_table::Symbol_table): Add new parameter for the garbage
12870         collection object.
12871         (Symbol_table::gc_mark_undef_symbols): New function.
12872         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12873         (Symbol_table::gc_mark_dyn_syms): New function.
12874         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12875         as garbage.
12876         (Symbol_table::add_from_object): Likewise.
12877         (Symbol_table::add_from_relobj): When building shared objects, do not
12878         treat externally visible symbols as garbage.
12879         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12880         table information for static and relocatable links.
12881         * symtab.h (Symbol_table::set_gc): New function.
12882         (Symbol_table::gc): New function.
12883         (Symbol_table::gc_mark_undef_symbols): New function.
12884         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12885         (Symbol_table::gc_mark_dyn_syms): New function.
12886         (Symbol_table::gc_): New data member.
12887         * target.h (Sized_target::gc_process_relocs): New pure virtual
12888         function.
12889         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12890         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12891
12892 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12893
12894         * options.h (General_options::gc_sections): Define as a no-op for now.
12895         (General_options::no_keep_memory): Ditto.
12896         (General_options::Bshareable): Define.
12897         * options.cc (General_options::finalize): Honor -Bshareable.
12898
12899 2009-01-20  Andreas Schwab  <schwab@suse.de>
12900
12901         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12902         read the value in the contents, since we don't use it.  Use the
12903         template endianness when writing.
12904         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12905
12906 2009-01-19  Andreas Schwab  <schwab@suse.de>
12907
12908         * configure.tgt (powerpc64-*): Fix targ_obj.
12909
12910 2009-01-15  Ian Lance Taylor  <iant@google.com>
12911
12912         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12913         local symbols when stripping all symbols.
12914
12915 2009-01-14  Cary Coutant  <ccoutant@google.com>
12916
12917         * output.cc (Output_reloc): Add explicit instantiations.
12918
12919 2009-01-14  Cary Coutant  <ccoutant@google.com>
12920
12921         * archive.cc (Archive::get_elf_object_for_member): Remove call
12922         to File_read::claim_for_plugin.
12923         * descriptors.cc (Descriptors::open): Remove reference to
12924         is_claimed.
12925         (Descriptors::claim_for_plugin): Remove.
12926         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12927         (Descriptors::is_claimed): Remove.
12928         (claim_descriptor_for_plugin): Remove.
12929         * fileread.cc (File_read::claim_for_plugin): Remove.
12930         * fileread.h (File_read::claim_for_plugin): Remove.
12931         (File_read::descriptor): Reopen descriptor if necessary.
12932         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12933         (Plugin_manager::all_symbols_read): Add task parameter. Change
12934         all callers.
12935         (Plugin_manager::get_input_file): New function.
12936         (Plugin_manager::release_input_file): New function.
12937         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12938         corresponding data member.
12939         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12940         and pass to base constructor. Change all callers.
12941         (get_input_file, release_input_file): New functions.
12942         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12943         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12944         (Plugin_manager::all_symbols_read): Add task parameter.
12945         (Plugin_manager::get_input_file): New function.
12946         (Plugin_manager::release_input_file): New function.
12947         (Plugin_manager::task_): New data member.
12948         (Pluginobj::Pluginobj): Add filesize parameter.
12949         (Pluginobj::filename): New function.
12950         (Pluginobj::descriptor): New function.
12951         (Pluginobj::filesize): New function.
12952         (Pluginobj::filesize_): New data member.
12953         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12954         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12955         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12956
12957         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12958         with archive libraries.
12959         * testsuite/Makefile.in: Regenerate.
12960         * testsuite/plugin_test.c (struct sym_info): New type.
12961         (get_input_file, release_input_file): New static variables.
12962         (onload): Capture new transfer vector entries.
12963         (claim_file_hook): Stop reading at end of file according to filesize.
12964         Factor out parsing of readelf output into separate function.
12965         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12966         APIs and get the source file name from the symbol table.  Convert
12967         source file name to corresponding object file name.  Print info
12968         message when adding new input files.
12969         (parse_readelf_line): New function.
12970         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12971         * testsuite/plugin_test_2.sh: Likewise.
12972         * testsuite/plugin_test_3.sh: Likewise.
12973         * testsuite/plugin_test_4.sh: New test case.
12974
12975 2009-01-07  Ian Lance Taylor  <iant@google.com>
12976
12977         * version.cc (version_string): Bump to 1.8.
12978
12979 2008-12-23  Cary Coutant  <ccoutant@google.com>
12980
12981         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12982         * plugin.cc (Plugin_manager::finish): Rename as
12983         layout_deferred_objects.  Move cleanup to separate function.
12984         (Plugin_manager::cleanup): New function.
12985         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12986         separately.
12987         * plugin.h (Plugin_manager::finish): Rename as
12988         layout_deferred_objects.
12989         (Plugin_manager::cleanup): New function.
12990         (Plugin_manager::cleanup_done): New field.
12991
12992 2008-12-23  Cary Coutant  <ccoutant@google.com>
12993
12994         * plugin.cc (is_visible_from_outside): New function.
12995         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12996         so we don't return "IR only" status for exported symbols or -r links.
12997
12998         * testsuite/Makefile.am (plugin_test_3): New test case.
12999         * testsuite/Makefile.in: Regenerate.
13000         * testsuite/plugin_test_3.sh: New file.
13001
13002 2008-12-22  Cary Coutant  <ccoutant@google.com>
13003
13004         * object.cc (Sized_relobj::layout_section): New function.
13005         (Sized_relobj::do_layout): Defer layout of input sections until after
13006         plugin has provided replacement files.
13007         (Sized_relobj::do_layout_deferred_sections): New function.
13008         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13009         (Relobj::layout_deferred_sections): New function.
13010         (Relobj::do_layout_deferred_sections): New function.
13011         (Sized_relobj::do_layout_deferred_sections): New function.
13012         (Sized_relobj::layout_section): New function.
13013         (Sized_relobj::Deferred_layout): New structure.
13014         (Sized_relobj::deferred_layout_): New field.
13015         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13016         Change all callers.  Layout deferred sections.
13017         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13018         references.
13019         (Plugin_hook::run): Move code from do_plugin_hook inline.
13020         (Plugin_hook::do_plugin_hook): Remove.
13021         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13022         (Plugin_manager::finish): Renamed, was cleanup.
13023         (Plugin_manager::should_defer_layout): New function.
13024         (Plugin_manager::add_deferred_layout_object): New function.
13025         (Plugin_manager::Deferred_layout_list): New type.
13026         (Plugin_manager::deferred_layout_objects_): New field.
13027         (Plugin_hook::do_plugin_hook): Remove.
13028
13029 2008-12-17  Ian Lance Taylor  <iant@google.com>
13030
13031         * options.h (class General_options): Add --no case for
13032         --export-dynamic.
13033
13034 2008-12-16  Cary Coutant  <ccoutant@google.com>
13035
13036         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13037         vector.
13038         (Plugin_manager::claim_file): Create plugin object even if
13039         plugin did not call the add_symbols callback.
13040         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13041         asking for more symbols than were added.
13042         * testsuite/Makefile.am (plugin_test_1): Add test case with
13043         no global symbols.
13044         (empty.syms): New target.
13045         * testsuite/Makefile.in: Regenerate.
13046         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13047         message. Don't call add_symbols if no globals.
13048         (all_symbols_read_hook): Don't provide replacement for empty
13049         claimed file.
13050
13051 2008-12-12  Ian Lance Taylor  <iant@google.com>
13052
13053         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13054         r_type == 0 for a local symbol with r_sym == 0.
13055         (scan_relocatable_relocs): Pass r_sym to
13056         local_non_section_strategy.
13057         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13058         r_sym parameter.
13059
13060         * configure.ac: Update test for TLS descriptors: they are
13061         supported as of glibc 2.9.
13062         * configure: Rebuild.
13063
13064 2008-12-11  Ian Lance Taylor  <iant@google.com>
13065
13066         PR 7091
13067         * target-reloc.h (Default_scan_relocatable_relocs): For each
13068         function, map r_type == 0 to RELOC_DISCARD.
13069
13070 2008-12-10  Cary Coutant  <ccoutant@google.com>
13071
13072         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13073         object to override a kept COMDAT group from a plugin object.
13074
13075 2008-12-09  Ian Lance Taylor  <iant@google.com>
13076
13077         PR 7088
13078         * yyscript.y (file_cmd): Handle INPUT.
13079
13080         * testsuite/initpri1.c: Change all declarations to be full
13081         prototypes by adding void, to avoid compiler warnings.
13082
13083 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13084
13085         * options.cc (General_options::parse_plugin_opt): New.
13086         (General_options::add_plugin): The argument now is just the filename.
13087         (General_options::add_plugin_option): New.
13088         * options.h (plugin_opt): New.
13089         (add_plugin): Change argument name.
13090         (add_plugin_option): New.
13091         * plugin.cc (Plugin::load): Don't parse the plugin option.
13092         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13093         (Plugin::add_option): New.
13094         (Plugin::args_): Change type.
13095         (Plugin::filename_): New.
13096         (Plugin_manager::add_plugin_option): New.
13097         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13098         * testsuite/Makefile.in: Regenerate.
13099
13100 2008-12-05  Cary Coutant  <ccoutant@google.com>
13101
13102         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13103         Handle --strip-lto-sections option.
13104         * options.h (strip_lto_sections): New option.
13105
13106 2008-12-01  Cary Coutant  <ccoutant@google.com>
13107
13108         * plugin.cc (ld_plugin_message): Change format parameter to const.
13109         Fix mismatch between new[] and delete.
13110
13111 2008-11-14  Cary Coutant  <ccoutant@google.com>
13112
13113         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13114         instead of -1U.
13115
13116 2008-11-05  Craig Silverstein  <csilvers@google.com>
13117
13118         * options.cc (General_options::parse_dynamic_list): New function.
13119         * options.h (General_options): New flags dynamic_list,
13120         dynamic_list_data, dynamic_list_cpp_new, and
13121         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13122         (General_options::in_dynamic_list): New function.
13123         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13124         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13125         (Lex::can_continue_name): Likewise.
13126         (yylex): Likewise.
13127         (read_script_file): New parameter script_options.
13128         (read_dynamic_list): New function.
13129         (Script_options::define_dynamic_list): New function.
13130         (dynamic_list_keyword_parsecodes): New variable.
13131         (dynamic_list_keywords): New variable.
13132         * script.h (Script_options::define_dynamic_list): New function
13133         prototype.
13134         (read_dynamic_list): New function prototype.
13135         * symtab.cc (strprefix): New macro.
13136         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13137         dynamic_list_data, dynamic_list_cpp_new, and
13138         dynamic_list_cpp_typeinfo.
13139         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13140         (dynamic_list_expr): New rule.
13141         (dynamic_list_nodes): Likewise.
13142         (dynamic_list_node): Likewise.
13143         * testsuite/Makefile.am (dynamic_list): New test.
13144         * testsuite/Makefile.in: Regenerated.
13145         * testsuite/dynamic_list.t: New file.
13146         * testsuite/dynamic_list.sh: New file.
13147
13148 2008-11-05  Craig Silverstein  <csilvers@google.com>
13149
13150         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13151         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13152         (t11_last): Likewise.
13153         * testsuite/ver_test_6.c (main): Likewise.
13154
13155 2008-10-07  Cary Coutant  <ccoutant@google.com>
13156
13157         * options.c (General_options::finalize): Add check for -static and
13158         -shared.
13159         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13160         is not empty.
13161
13162 2008-10-02  Cary Coutant  <ccoutant@google.com>
13163
13164         * plugin.cc (make_sized_plugin_object): Fix conditional
13165         compilation to work when not all targets are enabled.
13166
13167 2008-09-29  Cary Coutant  <ccoutant@google.com>
13168
13169         * archive.cc (Archive::get_file_and_offset): Use filename instead
13170         of name to get library path.
13171         (Archive::include_member): Unlock external member of a thin archive.
13172
13173         * testsuite/Makefile.am (TEST_AR): New variable.
13174         (thin_archive_test_1): New test.
13175         (thin_archive_test_2): New test.
13176         * testsuite/Makefile.in: Regenerate.
13177         * testsuite/thin_archive_main.cc: New file.
13178         * testsuite/thin_archive_test_1.cc: New file.
13179         * testsuite/thin_archive_test_2.cc: New file.
13180         * testsuite/thin_archive_test_3.cc: New file.
13181         * testsuite/thin_archive_test_4.cc: New file.
13182
13183 2008-09-29  Cary Coutant  <ccoutant@google.com>
13184
13185         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13186         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13187         instead of -1U.
13188         (Sized_relobj::do_finalize_local_symbols): Likewise.
13189         (Sized_relobj::map_to_kept_section): Likewise.
13190         * object.h (Sized_relobj::invalid_address): New constant.
13191         (Sized_relobj::do_output_section_offset): Check for invalid_address
13192         and return -1ULL.
13193         * output.cc (Output_reloc::local_section_offset): Use constant
13194         invalid_address instead of -1U.
13195         (Output_reloc::get_address): Likewise.
13196         (Output_section::output_address): Change -1U to -1ULL.
13197         * output.h (Output_reloc::invalid_address): New constant.
13198         * reloc.cc (Sized_relobj::write_sections): Use constant
13199         invalid_address instead of -1U.
13200         (Sized_relobj::relocate_sections): Likewise.
13201         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13202         values for merge sections.
13203         * target-reloc.h (relocate_for_relocatable): Use constant
13204         invalid_address instead of -1U.
13205
13206 2008-09-19  Cary Coutant  <ccoutant@google.com>
13207
13208         Add plugin functionality for link-time optimization (LTO).
13209         * configure.ac (plugins): Add --enable-plugins option.
13210         * configure: Regenerate.
13211         * config.in: Regenerate.
13212         * Makefile.am (LIBDL): New variable.
13213         (CCFILES): Add plugin.cc.
13214         (HFILES): Add plugin.h.
13215         (ldadd_var): Add LIBDL.
13216         * Makefile.in: Regenerate.
13217
13218         * archive.cc: Include "plugin.h".
13219         (Archive::setup): Don't preread archive symbols when using a plugin.
13220         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13221         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13222         files.
13223         (Archive::include_member): Add symbols from plugin objects.
13224         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13225         * descriptors.cc (Descriptors::open): Check for file descriptors
13226         abandoned by plugins.
13227         (Descriptors::claim_for_plugin): New function.
13228         * descriptors.h (Descriptors::claim_for_plugin): New function.
13229         (Open_descriptor::is_claimed): New field.
13230         (claim_descriptor_for_plugin): New function.
13231         * fileread.cc (File_read::claim_for_plugin): New function.
13232         * fileread.h (File_read::claim_for_plugin): New function.
13233         (File_read::descriptor): New function.
13234         * gold.cc: Include "plugin.h".
13235         (queue_initial_tasks): Add task to call plugin hooks for generating
13236         new object files.
13237         * main.cc: Include "plugin.h".
13238         (main): Load plugin libraries.
13239         * object.h (Pluginobj): Declare.
13240         (Object::pluginobj): New function.
13241         (Object::do_pluginobj): New function.
13242         (Object::set_target): New function.
13243         * options.cc: Include "plugin.h".
13244         (General_options::parse_plugin): New function.
13245         (General_options::General_options): Initialize plugins_ field.
13246         (General_options::add_plugin): New function.
13247         * options.h (Plugin_manager): Declare.
13248         (General_options): Add --plugin option.
13249         (General_options::has_plugins): New function.
13250         (General_options::plugins): New function.
13251         (General_options::add_plugin): New function.
13252         (General_options::plugins_): New field.
13253         * plugin.cc: New file.
13254         * plugin.h: New file.
13255         * readsyms.cc: Include "plugin.h".
13256         (Read_symbols::do_read_symbols): Check for archive before checking
13257         for ELF file.  Call plugin hooks to claim files.
13258         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13259         from a real object file; force override when processing replacement
13260         files.
13261         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13262         (Symbol::init_base_object): Likewise.
13263         (Symbol::init_base_output_data): Likewise.
13264         (Symbol::init_base_output_segment): Likewise.
13265         (Symbol::init_base_constant): Likewise.
13266         (Symbol::init_base_undefined): Likewise.
13267         (Symbol::output_section): Assert that object is not a plugin.
13268         (Symbol_table::add_from_pluginobj): New function.
13269         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13270         undefined.
13271         (Symbol_table::sized_write_globals): Likewise.
13272         (Symbol_table::add_from_pluginobj): Instantiate template.
13273         * symtab.h (Sized_pluginobj): Declare.
13274         (Symbol::in_real_elf): New function.
13275         (Symbol::set_in_real_elf): New function.
13276         (Symbol::in_real_elf_): New field.
13277         (Symbol_table::add_from_pluginobj): New function.
13278
13279         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13280         (LIBDL): New variable.
13281         (LDADD): Add LIBDL.
13282         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13283         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13284         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13285         (MOSTLYCLEANFILES): Likewise.
13286         * testsuite/Makefile.in: Regenerate.
13287         * testsuite/plugin_test.c: New file.
13288         * testsuite/plugin_test_1.sh: New file.
13289         * testsuite/plugin_test_2.sh: New file.
13290
13291 2008-09-16  Ian Lance Taylor  <iant@google.com>
13292
13293         * target-reloc.h (relocate_section): Check whether a symbol is
13294         defined by the ABI before reporting an undefined symbol error.
13295         * target.h (Target::is_defined_by_abi): Make parameter const.
13296         (Target::do_is_defined_by_abi): Likewise.
13297         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13298         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13299         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13300         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13301         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13302         * testsuite/Makefile.in: Rebuild.
13303
13304         * fileread.cc (make_view): Add casts to avoid warning.
13305
13306 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13307
13308         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13309         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13310
13311 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13312
13313         * options.h (General_options::output_is_executable): New.
13314         (General_options::output_is_pie): New.
13315         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13316         for shared libraries.
13317         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13318
13319 2008-09-11  Chris Demetriou  <cgd@google.com>
13320
13321         * options.h (origin): New -z option.
13322         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13323         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13324         in DT_FLAGS_1.
13325
13326 2008-09-05  Cary Coutant  <ccoutant@google.com>
13327
13328         * fileread.cc (File_read::make_view): Add check for attempt to map
13329         beyond end of file.
13330
13331 2008-09-05  Cary Coutant  <ccoutant@google.com>
13332
13333         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13334         explicit instantiations.
13335
13336 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13337
13338         PR gold/6858
13339         * options.cc (General_options::finalize): Allow undefined symbols
13340         in shlibs if linking -shared.
13341
13342         PR gold/6859
13343         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13344         symbols as not needing a dynsym entry.
13345
13346 2008-08-20  Craig Silverstein  <csilvers@google.com>
13347
13348         * fileread.cc (File_read::open): Do not lock the file unless it
13349         was successfully opened.
13350
13351 2008-08-14  Cary Coutant  <ccoutant@google.com>
13352
13353         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13354         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13355         * testsuite/tls_test.cc (struct int128): 128-bit struct
13356         for testing TLS relocs with non-zero addend.
13357         (v12): New TLS variable.
13358         (t12): New test.
13359         (t_last): Add check for v12.
13360         * testsuite/tls_test.h (t12): New function.
13361         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13362
13363 2008-08-13  Ian Lance Taylor  <iant@google.com>
13364
13365         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13366         set tls_segment_ or relro_segment_.
13367         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13368         when appropriate.
13369         * output.h (Output_section::clear_is_relro): New function.
13370         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13371         sections specially even when output_data_ is empty.
13372         (Output_segment::maximum_alignment): When first section is relro,
13373         only force alignment for PT_LOAD segments.
13374         * script.cc (script_data_segment_align): New function.
13375         (script_data_segment_relro_end): New function.
13376         * script-c.h (script_data_segment_align): Declare.
13377         (script_data_segment_relro_end): Declare.
13378         * script-sections.h (class Script_sections): Declare
13379         data_segment_align and data_segment_relro_end.  Add fields
13380         segment_align_index_ and saw_relro_end_.
13381         * script-sections.cc (class Sections_element): Add set_is_relro
13382         virtual function.  Add new bool* parameter to place_orphan_here.
13383         Add get_output_section virtual function.
13384         (class Output_section_definition): Add set_is_relro.  Add new
13385         bool* parameter to place_orphan_here.  Add get_output_section.
13386         Add is_relro_ field.
13387         (Output_section_definition::Output_section_definition): Initialize
13388         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13389         and is_relro_ fields.
13390         (Output_section_definition::place_orphan_here): Add is_relro
13391         parameter.
13392         (Output_section_definition::set_section_addresses): Set relro for
13393         output section.
13394         (Output_section_definition::alternate_constraint): Likewise.
13395         (class Orphan_output_section): Add new bool* parameter to
13396         place_orphan_here.  Add get_output_section.
13397         (Orphan_output_section::place_orphan_here): Add is_relro
13398         parameter.
13399         (Script_sections::Script_sections): Initialize
13400         data_segment_align_index_ and saw_relro_end_.
13401         (Script_sections::data_segment_align): New function.
13402         (Script_sections::data_segment_relro_end): New function.
13403         (Script_sections::place_orphan): Set or clear is_relro.
13404         (Script_sections::set_section_addresses): Force alignment of first
13405         TLS section.
13406         * yyscript.y (exp): Call script_data_segment_align and
13407         script_data_segment_relro_end.
13408         * testsuite/relro_script_test.t: New file.
13409         * testsuite/relro_test.cc (using_script): Declare.
13410         (t1, t2): Test using_script.
13411         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13412         (relro_script_test_SOURCES): Define.
13413         (relro_script_test_DEPENDENCIES): Define.
13414         (relro_script_test_LDFLAGS): Define.
13415         (relro_script_test_LDADD): Define.
13416         (relro_script_test.so): New target.
13417         * testsuite/Makefile.in: Rebuild.
13418
13419 2008-08-06  Cary Coutant <ccoutant@google.com>
13420
13421         * archive.cc (Archive::total_archives, Archive::total_members)
13422         (Archive::total_members_loaded): New variables.
13423         (Archive::setup): Add parameter.  Add option to preread
13424         archive symbols.
13425         (Archive::read_armap): Add counter.
13426         (Archive::get_file_and_offset): New function.
13427         (Archive::get_elf_object_for_member): New function.
13428         (Archive::read_all_symbols): New function.
13429         (Archive::read_symbols): New function.
13430         (Archive::add_symbols): Add counters.
13431         (Archive::include_all_members): Use armap to find members if it's
13432         already built.
13433         (Archive::include_member): Skip reading symbols if already read.
13434         Factored code into Archive::get_file_and_offset and
13435         Archive::get_elf_object_for_member.  Changed call to
13436         Mapfile::report_include_archive_member.
13437         (Archive::print_stats): New function.
13438         * archive.h: Declare Object and Read_symbols_data classes.
13439         (Archive::Archive): Add initializers for new members.
13440         (Archive::setup): Add parameter.
13441         (Archive::print_stats): New function.
13442         (Archive::total_archives, Archive::total_members)
13443         (Archive::total_members_loaded): New variables.
13444         (Archive::get_file_and_offset): New function.
13445         (Archive::get_elf_object_for_member): New function.
13446         (Archive::read_all_symbols): New function.
13447         (Archive::read_symbols): New function.
13448         (Archive::Archive_member): New class.
13449         (Archive::members_): New member.
13450         (Archive::num_members_): New member.
13451         * main.cc: Include archive.h.
13452         (main): Call Archive::print_stats.
13453         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13454         archive parameter; member_name is now the fully-decorated name.
13455         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13456         * options.h: (General_options): Add --preread-archive-symbols option.
13457         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13458         Archive::setup.
13459
13460 2008-08-04  Ian Lance Taylor  <iant@google.com>
13461
13462         * symtab.h (Symbol::use_plt_offset): New function.
13463         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13464         * powerpc.cc (Relocate::relocate): Likewise.
13465         * sparc.cc (Relocate::relocate): Likewise.
13466         * x86_64.cc (Relocate::relocate): Likewise.
13467         * testsuite/weak_plt.sh: New test.
13468         * testsuite/weak_plt_main.cc: New test.
13469         * testsuite/weak_plt_shared.cc: New test.
13470         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13471         (check_PROGRAMS): Add weak_plt.
13472         (check_DATA): Add weak_plt_shared.so.
13473         (weak_plt_main_pic.o, weak_plt): New targets.
13474         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13475         * testsuite/Makefile.in: Rebuild.
13476
13477         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13478         gcctestdir/ld.
13479         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13480         * testsuite/Makefile.in: Rebuild.
13481
13482 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13483
13484         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13485         * Makefile.in: Regenerate.
13486         * po/POTFILES.in: Regenerate.
13487
13488 2008-07-29  Ian Lance Taylor  <iant@google.com>
13489
13490         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13491         symbols before other symbols.
13492         * testsuite/script_test_2.cc (test_addr): Declare.
13493         (test_addr_alias): Declare.
13494         (main): Check that test_addr and test_addr_alias have the right
13495         values.
13496         * testsuite/script_test_2.t: Define test_addr_alias and
13497         test_addr.
13498
13499 2008-07-24  Ian Lance Taylor  <iant@google.com>
13500
13501         PR 5990
13502         * descriptors.cc: New file.
13503         * descriptors.h: New file.
13504         * gold-threads.h (class Hold_optional_lock): New class.
13505         * fileread.cc: Include "descriptors.h".
13506         (File_read::~File_read): Release descriptor rather than closing
13507         it.
13508         (File_read::open) [file]: Call open_descriptor rather than open.
13509         Set is_descriptor_opened_.
13510         (File_read::open) [memory]: Assert that descriptor is not open.
13511         (File_read::reopen_descriptor): New function.
13512         (File_read::release): Release descriptor.
13513         (File_read::do_read): Make non-const.  Reopen descriptor.
13514         (File_read::read): Make non-const.
13515         (File_read::make_view): Reopen descriptor.
13516         (File_read::do_readv): Likewise.
13517         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13518         Update declarations.
13519         * layout.cc: Include "descriptors.h".
13520         (Layout::create_build_id): Use open_descriptor rather than open.
13521         * output.cc: Include "descriptors.h".
13522         (Output_file::open): Use open_descriptor rather than open.
13523         * archive.cc (Archive::const_iterator): Change Archive to be
13524         non-const.
13525         (Archive::begin, Archive::end): Make non-const.
13526         (Archive::count_members): Likewise.
13527         * archive.h (class Archive): Update declarations.
13528         * object.h (Object::read): Make non-const.
13529         * Makefile.am (CCFILES): Add descriptors.cc.
13530         (HFILES): Add descriptors.h.
13531         * Makefile.in: Rebuild.
13532
13533         PR 6716
13534         * gold.h: Always include <clocale>.  Add Solaris workarounds
13535         following code in binutils/sysdep.h.
13536
13537         PR 6048
13538         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13539         this->eh_frame_hdr_ is NULL before using it.
13540
13541         * dynobj.cc (Versions::Versions): Update comment.
13542
13543         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13544         the base version name.
13545
13546         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13547         array size plus one.
13548         (Stringpool_template::set_string_offsets): Subtract one from key
13549         before using it as an array index.
13550         (Stringpool_template::get_offset_with_length): Likewise.
13551         (Stringpool_template::write_to_buffer): Likewise.
13552         * stringpool.h (Stringpool_template::get_offset_from_key):
13553         Likewise.
13554
13555 2008-07-23  Ian Lance Taylor  <iant@google.com>
13556
13557         PR 6658
13558         * object.h (Merged_symbol_value::value): Do our best to handle a
13559         negative addend.
13560
13561         PR 6647
13562         * script.cc (Version_script_info::get_versions): Don't add empty
13563         version tag to return value.
13564         (Version_script_info::get_symbol_version_helper): Change return
13565         type to bool.  Add pversion parameter.  Change all callers.
13566         (script_register_vers_node): Don't require a non-NULL tag.
13567         * script.h (class Version_script_info): Update declarations.
13568         (Version_script_info::get_symbol_version): Change return type to
13569         bool.  Add version parameter.  Change all callers.
13570         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13571         handling.  Handle an empty version from a version script.
13572         (Symbol_table::define_special_symbol): Likewise.
13573         * testsuite/ver_test_10.script: New file.
13574         * testsuite/ver_test_10.sh: New file.
13575         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13576         (check_DATA): Add ver_test_10.syms.
13577         (ver_test_10.syms, ver_test_10.so): New target.
13578         * testsuite/Makefile.in: Rebuild.
13579
13580 2008-07-23  Simon Baldwin  <simonb@google.com>
13581
13582         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13583         to zero for undefined symbols from dynamic libraries.
13584
13585 2008-07-23  Ian Lance Taylor  <iant@google.com>
13586
13587         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13588         Change all callers.
13589         * symtab.h (class Symbol_table): Update declaration.
13590         * testsuite/ver_test_9.cc: New file.
13591         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13592         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13593         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13594         (ver_test_9.so, ver_test_9.o): New targets.
13595         * testsuite/Makefile.in: Rebuild.
13596
13597 2008-07-22  Ian Lance Taylor  <iant@google.com>
13598
13599         * options.h (class General_options): Define --check-sections.
13600         * layout.cc (Layout::set_segment_offsets): Handle
13601         --check-sections.
13602
13603         * options.h (class General_options): Define -n/--nmagic and
13604         -N/--omagic.
13605         * options.cc (General_options::finalize): For -n/--nmagic or
13606         -N/--omagic, set -static.
13607         * layout.cc (Layout::attach_allocated_section_to_segment): If
13608         -N/--omagic, don't put read-only and read-write sections in
13609         different segments.
13610         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13611         finding a read-only segment.
13612         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13613         don't set the minimum segment alignment to the common page size,
13614         and don't set the file offset to the address modulo the page size.
13615         * script-sections.cc (Script_sections::create_segments): If
13616         -n/--omagic, don't put read-only and read-write sections in
13617         different segments.
13618
13619         * cref.cc: New file.
13620         * cref.h: New file.
13621         * options.h (class General_options): Add --print-symbol-counts.
13622         * main.cc (main): Issue defined symbol report if requested.
13623         * archive.cc (Archive::interpret_header): Make into a const member
13624         function.
13625         (Archive::add_symbols): Call Input_objects::archive_start and
13626         archive_stop.
13627         (Archive::const_iterator): Define new class.
13628         (Archive::begin, Archive::end): New functions.
13629         (Archive::include_all_members): Rewrite to use iterator.
13630         (Archive::count_members): New function.
13631         * archive.h (class Archive): Update declarations.
13632         (Archive::filename): New function.
13633         * object.cc: Include "cref.h".
13634         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13635         (Sized_relobj::do_get_global_symbol_counts): New function.
13636         (Input_objects::add_object): Add object to cross-referencer.
13637         (Input_objects::archive_start): New function.
13638         (Input_objects::archive_stop): New function.
13639         (Input_objects::print_symbol_counts): New function.
13640         * object.h: Declare Cref and Archive.
13641         (Object::get_global_symbol_counts): New function.
13642         (Object::do_get_global_symbol_counts): New pure virtual function.
13643         (class Sized_relobj): Add defined_count_ field.  Update
13644         declarations.
13645         (class Input_objects): Add cref_ field.  Update constructor.
13646         Update declarations.
13647         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13648         defined_count_.
13649         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13650         symbol counts.
13651         (Sized_dynobj::do_get_global_symbol_counts): New function.
13652         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13653         defined_count_.  Update declarations.  Define Symbols typedef.
13654         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13655         parameter.  Change all callers.
13656         (Symbol_table::add_from_dynobj): Add sympointers and defined
13657         parameters.  Change all callers.
13658         * symtab.h (class Symbol_table): Update declarations.
13659         * Makefile.am (CCFILES): Add cref.cc.
13660         (HFILES): Add cref.h.
13661         * Makefile.in: Rebuild.
13662
13663 2008-07-22  Simon Baldwin  <simonb@google.com>
13664
13665         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13666         to zero when writing undefined symbols.
13667
13668 2008-07-22  Ian Lance Taylor  <iant@google.com>
13669
13670         * output.cc (Output_section::add_input_section): Don't try to
13671         merge empty merge sections.
13672
13673 2008-07-21  Craig Silverstein  <csilvers@google.com>
13674
13675         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13676         Include symbol version in error message.
13677
13678 2008-07-20  Chris Demetriou  <cgd@google.com>
13679
13680         * configure.ac (gold_cv_c_random_seed): New configured variable.
13681         (RANDOM_SEED_CFLAGS): New substituted variable.
13682         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13683         * configure: Rebuild.
13684         * Makefile.in: Likewise.
13685         * testsuite/Makefile.in: Likewise.
13686
13687 2008-07-18  Ian Lance Taylor  <iant@google.com>
13688
13689         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13690         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13691         * testsuite/ver_test_main.cc (main): Call t4.
13692         (t4, t4_2a): Define.
13693         * testsuite/ver_test_2.cc (t4_2): Define.
13694         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13695         * testsuite/ver_test_4.cc (t4_2a): Define.
13696         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13697         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13698
13699 2008-07-17  Ian Lance Taylor  <iant@google.com>
13700
13701         * dynobj.cc (Versions::add_def): If we give an error about a
13702         missing version, go ahead and create the version anyhow.
13703
13704 2008-07-10  Ian Lance Taylor  <iant@google.com>
13705
13706         Handle output sections with more than 0x7fffffff bytes.
13707         * object.h (class Relobj): Change map_to_output_ to
13708         output_sections_, and just keep a section pointer.  Change all
13709         uses.  Move comdat group support to Sized_relobj.
13710         (Relobj::is_section_specially_mapped): Remove.
13711         (Relobj::output_section): Remove poff parameter.  Change all
13712         callers.
13713         (Relobj::output_section_offset): New function.
13714         (Relobj::set_section_offset): Rewrite.
13715         (Relobj::map_to_output): Remove.
13716         (Relobj::output_sections): New function.
13717         (Relobj::do_output_section_offset): New pure virtual function.
13718         (Relobj::do_set_section_offset): Likewise.
13719         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13720         group support from Relobj.  Update declarations.
13721         (Sized_relobj::get_output_section_offset): New function.
13722         (Sized_relobj::do_output_section_offset): New function.
13723         (Sized_relobj::do_set_section_offset): New function.
13724         * object.cc (Relobj::output_section_address): Remove.
13725         (Sized_relobj::Sized_relobj): Initialize new fields.
13726         (Sized_relobj::include_section_group): Cast find_kept_object to
13727         Sized_relobj.
13728         (Sized_relobj::include_linkonce_section): Likewise.
13729         (Sized_relobj::do_layout): Use separate arrays for output section
13730         and output offset.
13731         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13732         output_sections.
13733         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13734         output_sections and section_offsets.
13735         (Sized_relobj::write_local_symbols): Likewise.
13736         (map_to_kept_section): Compute output address directly.
13737         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13738         output_sections and section_offsets.
13739         (Sized_relobj::write_sections): Likewise.
13740         (Sized_relobj::relocate_sections): Likewise.
13741         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13742         * output.h (class Output_reloc): Update declarations.  Change
13743         u2_.relobj to Sized_relobj*.
13744         (class Output_data_reloc): Change add functions to use
13745         Sized_relobj*.
13746         * output.cc (Output_reloc::Output_reloc): Change relobj to
13747         Sized_relobj*.
13748         (Output_reloc::local_section_offset): Change return type to
13749         Elf_Addr.  Use get_output_section_offset.
13750         (Output_reloc::get_address): Likewise.
13751         (Output_section::is_input_address_mapped): Don't call
13752         is_section_specially_mapped.
13753         (Output_section::output_offset): Likewise.
13754         (Output_section::output_address): Likewise.
13755         (Output_section::starting_output_address): Likewise.
13756         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13757         parameter to Sized_relobj*.
13758         (Copy_relocs::need_copy_reloc): Likewise.
13759         (Copy_relocs::save): Likewise.
13760         * copy-relocs.h (class Copy_relocs): Update declarations.
13761         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13762         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13763         * target-reloc.h (relocate_for_relocatable): Change
13764         offset_in_output_section type to Elf_Addr.  Change code that uses
13765         it as well.
13766         * layout.cc (Layout::layout): Always set *off.
13767         * mapfile.cc (Mapfile::print_input_section): Use
13768         output_section_offset.
13769         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13770         Sized_relobj*.
13771         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13772         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13773         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13774
13775 2008-07-03  Ian Lance Taylor  <iant@google.com>
13776
13777         * layout.cc (Layout::include_section): Do not discard unrecognized
13778         SHT_STRTAB sections.
13779
13780 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13781
13782         * script.cc (Lex::can_continue_name): Make '?' allowable in
13783         version-script names.
13784         * testsuite/version_script.map: Change glob pattern to use '?'
13785
13786 2008-06-30  Manish Singh  <yosh@gimp.org>
13787
13788         PR 6585
13789         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13790         Correct typo.
13791
13792 2008-06-30  Ian Lance Taylor  <iant@google.com>
13793
13794         PR 6660
13795         PR 6682
13796         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13797         versions]: Don't try to read the value in the contents, since we
13798         don't use it.  Use the template endianness when writing.
13799
13800 2008-06-25  Cary Coutant  <ccoutant@google.com>
13801
13802         * fileread.cc (File_read::make_view): Assert on zero-length view.
13803         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13804         symbol table when there are no symbols to read.
13805
13806 2008-06-23  Craig Silverstein  <csilvers@google.com>
13807
13808         * version.cc (version_string): Bump to 1.7
13809
13810 2008-06-18  Craig Silverstein  <csilvers@google.com>
13811
13812         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13813         constant 0xFFFF to type Valtype.
13814         (Powerpc_relocate_functions::rel16_ha): Likewise.
13815
13816 2008-06-17  Ian Lance Taylor  <iant@google.com>
13817
13818         * output.h (Output_section::Input_section): Initialize p2align_ to
13819         zero for Output_section_data constructors.
13820         (Output_section::Input_section::addralign): If not an input
13821         section, return the alignment of the Output_section_data.
13822         * testsuite/copy_test.cc: New file.
13823         * testsuite/copy_test_1.cc: New file.
13824         * testsuite/copy_test_2.cc: New file.
13825         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13826         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13827         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13828         (copy_test_1_pic.o, copy_test_1.so): New targets.
13829         (copy_test_2_pic.o, copy_test_2.so): New targets.
13830         * testsuite/Makefile.in: Rebuild.
13831
13832         * script-sections.cc (Script_sections::place_orphan): Initialize
13833         local variable exact.
13834
13835 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13836
13837         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13838
13839 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13840             David S. Miller  <davem@davemloft.net>
13841
13842         * powerpc.cc: New file.
13843         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13844         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13845         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13846         * Makefile.in: Rebuild.
13847
13848 2008-06-09  Ian Lance Taylor  <iant@google.com>
13849
13850         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13851         <exception>.
13852         (throwing, orig_terminate): New static variables.
13853         (terminate_handler): New static function.
13854         (t2): Set terminate handler.
13855
13856 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13857
13858         PR 6584
13859         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13860         alignment.
13861
13862 2008-05-30  Cary Coutant  <ccoutant@google.com>
13863
13864         * archive.cc (Archive::include_all_members) Correct to step
13865         over symbol table and extended name table in thin archives.
13866
13867 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13868
13869         PR 6407
13870         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13871         calculation.
13872
13873 2008-05-28  Caleb Howe  <cshowe@google.com>
13874
13875         * reduced_debug_output.cc: New file.
13876         * reduced_debug_output.h: New file.
13877         * options.h (class General_options): Add --strip-debug-non-line.
13878         * options.cc (General_options::finalize): Add strip_debug_non_line
13879         to the strip heirarchy.
13880         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13881         fields.
13882         * layout.cc: Include "reduced_debug_output.h".
13883         (Layout::Layout): Initialize new fields.
13884         (line_only_debug_sections): New static array.
13885         (is_lines_only_debug_sections): New static inline function.
13886         (Layout::include_section): Handle --strip-debug-non-line.
13887         (Layout::make_output_section): If --strip-debug-non-line, build
13888         new output sections for .debug_abbrev and .debug_info.
13889         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13890         gold.  Warn about possible overflow.
13891         (read_signed_LEB_128): Likewise.
13892         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13893         (read_signed_LEB_128): Declare.
13894         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13895         (HFILES): Add reduced_debug_output.h.
13896         * Makefile.in: Rebuild.
13897
13898 2008-05-21  Ian Lance Taylor  <iant@google.com>
13899
13900         * mapfile.cc: New file.
13901         * mapfile.h: New file.
13902         * options.h (class General_options): Add -M/--print-map and -Map.
13903         * options.cc (General_options::finalize): Make -M equivalent to
13904         -Map -.
13905         * main.cc: Include <cstdio> and "mapfile.h".
13906         (main): Open mapfile if requested.
13907         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13908         constructor.  Change caller.
13909         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13910         (queue_middle_tasks): Likewise.
13911         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13912         declarations.
13913         * archive.cc: Include "mapfile.h".
13914         (Archive::add_symbols): Add mapfile parameter.  Change all
13915         callers.  Pass mapfile, symbol, and reason to include_member.
13916         (Archive::include_all_members): Add mapfile parameter.  Change all
13917         callers.
13918         (Archive::include_member): Add mapfile, sym, and why parameters.
13919         Change all callers.  Report inclusion to map file.
13920         * archive.h: Include "fileread.h".
13921         (class Archive): Update declarations.
13922         (Archive::file): New const method.
13923         (class Add_archive_symbols): Add mapfile_ field.  Update
13924         constructor.  Change all callers.
13925         * readsyms.h (class Read_symbols): Likewise.
13926         (class Finish_group): Likewise.
13927         (class Read_script): Likewise.
13928         * common.cc: Include "mapfile.h".
13929         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13930         all callers.
13931         (Symbol_table::do_allocate_commons): Likewise.
13932         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13933         symbol allocation to mapfile.
13934         * common.h (class Allocate_commons_task): Add mapfile_ field.
13935         Update constructor.  Change all callers.
13936         * symtab.h (class Symbol_table): Update declarations.
13937         * layout.cc: Include "mapfile.h".
13938         (Layout_task_runner::run): Print information to mapfile.
13939         (Layout::create_gold_note): Change Output_data_fixed_space to
13940         Output_data_zero_fill.
13941         (Layout::create_build_id): Likewise.
13942         (Layout::print_to_mapfile): New function.
13943         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13944         constructor.  Change caller.
13945         (class Layout): Declare print_to_mapfile.
13946         * output.cc (Output_section::Input_section::print_to_mapfile): New
13947         function.
13948         (Output_section::add_input_section): If producing a map, always
13949         add to input_sections_ list.
13950         (Output_section::do_print_to_mapfile): New function.
13951         (Output_segment::print_sections_to_mapfile): New function.
13952         (Output_segment::print_section_list_to_mapfile): New function.
13953         * output.h: Include "mapfile.h".
13954         (Output_data::print_to_mapfile): New function.
13955         (Output_data::do_print_to_mapfile): New virtual function.
13956         (Output_segment_headers::do_print_to_mapfile): New function.
13957         (Output_file_header::do_print_to_mapfile): New function.
13958         (Output_data_const::do_print_to_mapfile): New function.
13959         (class Output_data_const_buffer): Add map_name_ field.  Update
13960         constructor.  Change all callers.  Add do_print_to_mapfile
13961         function.
13962         (class Output_data_fixed_space): Likewise.
13963         (class Output_data_space): Likewise.
13964         (class Output_data_zero_fill): New class.
13965         (Output_data_strtab::do_print_to_mapfile): New function.
13966         (Output_data_reloc_base::do_print_to_mapfile): New function.
13967         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13968         (Output_data_group::do_print_to_mapfile): New function.
13969         (Output_data_got::do_print_to_mapfile): New function.
13970         (Output_data_dynamic::do_print_to_mapfile): New function.
13971         (Output_symtab_xindex::do_print_to_mapfile): New function.
13972         (class Output_section): Declare do_print_to_mapflie.  Declare
13973         print_to_mapfile in Input_section.
13974         (class Output_segment): Declare new functions.
13975         * object.h (Sized_relobj::symbol_count): New function.
13976         * script-sections.cc
13977         (Output_section_element_dot_assignment::set_section_addresses):
13978         Change Output_data_fixed_space to Output_data_zero_fill.
13979         (Output_data_expression::do_print_to_mapfile): New function.
13980         * script.cc (read_input_script): Add mapfile parameter.  Change
13981         all callers.
13982         * script.h (read_input_script): Update declaration.
13983         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13984         (Eh_frame::do_print_to_mapfile): New function.
13985         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13986         (Output_merge_string::do_print_to_mapfile): New function.
13987         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13988         function.
13989         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13990         function.
13991         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13992         function.
13993         * Makefile.am (CCFILES): Add mapfile.cc.
13994         (HFILES): Add mapfile.h.
13995         * Makefile.in: Rebuild.
13996
13997 2008-05-19  Ian Lance Taylor  <iant@google.com>
13998
13999         * options.h (class General_options): Add -z relro.
14000         * layout.cc (Layout::Layout): Initialize relro_segment_.
14001         (Layout::add_output_section_data): Return the output section.
14002         (Layout::make_output_section): Rcognize relro sections and mark
14003         them appropriately.
14004         (Layout::attach_allocated_section_to_segment): Put relro sections
14005         in a PT_GNU_RELRO segment.
14006         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14007         section as relro.
14008         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14009         PT_TLS segments.
14010         (Layout::linkonce_mapping): Map d.rel.ro.local to
14011         .data.rel.ro.local.
14012         (Layout::output_section_name): Us .data.rel.ro.local for any
14013         section which begins with that.
14014         * layout.h (class Layout): Update add_output_section_data
14015         declaration.  Add relro_segment_ field.
14016         * output.cc (Output_section::Output_section): Initialize is_relro_
14017         and is_relro_local_ fields.
14018         (Output_segment::add_output_section): Group relro sections.
14019         (Output_segment::is_first_section_relro): New function.
14020         (Output_segment::maximum_alignment): If there is a relro section,
14021         align the segment to the common page size.
14022         (Output_segment::set_section_addresses): Track whether we are
14023         looking at relro sections.  If the last section is a relro
14024         section, align to the common page size.
14025         (Output_segment::set_section_list_addresses): Add in_relro
14026         parameter.  Change all callers.  Align to the page size when
14027         moving from relro to non-relro section.
14028         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14029         segment.
14030         * output.h (class Output_section): Add is_relro_ and
14031         is_relro_local_ fields.
14032         (Output_section::is_relro): New function.
14033         (Output_section::set_is_relro): New function.
14034         (Output_section::is_relro_local): New function.
14035         (Output_section::set_is_relro_local): New function.
14036         (class Output_segment): Update declarations.
14037         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14038         * sparc.cc (Target_sparc::got_section): Likewise.
14039         * x86_64.cc (Target_x86_64::got_section): Likewise.
14040         * testsuite/relro_test_main.cc: New file.
14041         * testsuite/relro_test.cc: New file.
14042         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14043         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14044         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14045         (relro_test.so, relro_test_pic.o): New targets.
14046         * testsuite/Makefile.in: Rebuild.
14047
14048 2008-05-16  Ian Lance Taylor  <iant@google.com>
14049
14050         * output.cc (Output_segment::add_output_section): Remove front
14051         parameter.
14052         * output.h (class Output_segment): Remove
14053         add_initial_output_section and overloaded add_output_section.
14054         Update declaration of remaining add_output_section.
14055         * layout.cc (Layout::create_interp): Call add_output_section
14056         rather than add_initial_output_section.
14057         (Layout::finish_dynamic_section): Likewise.
14058
14059         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14060         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14061         know the dynamic type.
14062         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14063         field.  Initialize it in constructor.
14064         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14065         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14066         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14067         reloc.
14068
14069         * output.cc (Output_reloc::get_address): Change return type to
14070         Elf_Addr.
14071         * output.h (class Output_reloc): Update get_address declaration.
14072         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14073         for section addresses.
14074
14075 2008-05-09  Ian Lance Taylor  <iant@google.com>
14076
14077         PR 6493
14078         * gold.cc (gold_nomem): Use return value of write.
14079
14080 2008-05-08  Ian Lance Taylor  <iant@google.com>
14081
14082         * symtab.c (Symbol::init_base_output_data): Add version
14083         parameter.  Change all callers.
14084         (Symbol::init_base_output_segment): Likewise.
14085         (Symbol::init_base_constant): Likewise.
14086         (Symbol::init_base_undefined): Likewise.
14087         (Sized_symbol::init_output_data): Likewise.
14088         (Sized_symbol::init_output_segment): Likewise.
14089         (Sized_symbol::init_constant): Likewise.
14090         (Sized_symbol::init_undefined): Likewise.
14091         (Symbol_table::do_define_in_output_data): If the new symbol has a
14092         version, mark it as the default.
14093         (Symbol_table::do_define_in_output_segment): Likewise.
14094         (Symbol_table::do_define_as_constant): Likewise.
14095         * symtab.h (class Symbol): Update declarations.
14096         (class Sized_symbol): Likewise.
14097         * resolve.cc (Symbol::override_version): New function.
14098         (Symbol::override_base): Call override_version.
14099         (Symbol::override_base_with_special): Likewise.
14100         * testsuite/ver_script_8.script: New file.
14101         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14102         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14103         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14104         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14105
14106 2008-05-06  Ian Lance Taylor  <iant@google.com>
14107
14108         PR 6049
14109         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14110         functions.
14111         (class General_options): Remove existing --undefined, and add
14112         --no-undefined instead.  Add new --undefined as synonym for -u.
14113         * archive.cc (Archive::add_symbols): Check whether symbol was
14114         named with -u.
14115         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14116         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14117         all uses.  Add IS_UNDEFINED.  Update declarations to split
14118         different versions of init_base.  Declare init_base_undefined.
14119         (Symbol::is_defined): Handle IS_UNDEFINED.
14120         (Symbol::is_undefined): Likewise.
14121         (Symbol::is_weak_undefined): Call is_undefined.
14122         (Symbol::is_absolute): Handle IS_CONSTANT.
14123         (class Sized_symbol): Update declarations to split different
14124         versions of init.  Declare init_undefined.
14125         (class Symbol_table): Declare new functions.
14126         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14127         Change all callers.
14128         (Symbol::init_base_output_data): Likewise.
14129         (Symbol::init_base_output_segment): Likewise.
14130         (Symbol::init_base_constant): Likewise.
14131         (Symbol::init_base_undefined): New function.
14132         (Sized_symbol::init_object): Rename from init.  Change all
14133         callers.
14134         (Sized_symbol::init_output_data): Likewise.
14135         (Sized_symbol::init_output_segment): Likewise.
14136         (Sized_symbol::init_constant): Likewise.
14137         (Sized_symbol::init_undefined): New function.
14138         (Symbol_table::add_undefined_symbols_from_command_line): New
14139         function.
14140         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14141         function.
14142         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14143         (Symbol::output_section): Likewise.
14144         (Symbol::set_output_section): Likewise.
14145         (Symbol_table::sized_finalize_symbol): Likewise.
14146         (Symbol_table::sized_write_globals): Likewise.
14147         * resolve.cc (Symbol_table::should_override): Likewise.
14148         (Symbol::override_base_with_special): Likewise.
14149
14150         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14151         symbol, change it to have default visibility.
14152         * testsuite/protected_1.cc: New file.
14153         * testsuite/protected_2.cc: New file.
14154         * testsuite/protected_3.cc: New file.
14155         * testsuite/protected_main_1.cc: New file.
14156         * testsuite/protected_main_2.cc: New file.
14157         * testsuite/protected_main_3.cc: New file.
14158         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14159         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14160         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14161         (protected_1.so): New target.
14162         (protected_1_pic.o, protected_2_pic.o): New targets.
14163         (protected_3_pic.o): New target.
14164         (check_PROGRAMS): Add protected_2.
14165         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14166         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14167         * testsuite/Makefile.in: Rebuild.
14168
14169         * options.h (DEFINE_var): Add set_user_set_##varname__.
14170         (DEFINE_bool_alias): New macro.
14171         (class General_options): Define -Bstatic using DEFINE_bool_alias
14172         rather than DEFINE_special.  Add --undefined as an alias for -z
14173         defs.
14174         * options.cc (General_options::parse_Bstatic): Remove.
14175
14176         * options.h (class General_options): Add --fatal-warnings.
14177         * main.cc (main): Implement --fatal-warnings.
14178         * errors.h (Errors::warning_count): New function.
14179
14180         * options.h (class General_options): Add -Bsymbolic-functions.
14181         * symtab.h (Symbol::is_preemptible): Check for
14182         -Bsymbolic-functions.
14183
14184 2008-05-05  Ian Lance Taylor  <iant@google.com>
14185
14186         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14187         as noVARNAME rather than no-VARNAME.
14188         (class General_options): Add option -z combreloc.
14189         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14190         get_address.
14191         (Output_reloc::sort_before) [SHT_REL]: New function.
14192         (Output_reloc::sort_before) [SHT_RELA]: New function.
14193         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14194         Sort_relocs_comparison.
14195         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14196         parameter.  Change all callers.
14197         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14198         sort_relocs parameter.  Change all callers.
14199         * output.cc (Output_reloc::get_address): New function, broken out
14200         of write_rel.
14201         (Output_reloc::write_rel): Call it.
14202         (Output_reloc::compare): New function.
14203         (Output_data_reloc_base::do_write): Optionally sort relocs.
14204
14205         * configure.ac: If targ_extra_obj is set, link it in.
14206         * configure.tgt: Initialize all variables.
14207         (x86_64*): Set targ_extra_obj and targ_extra_size.
14208         * configure: Rebuild.
14209
14210         * object.cc (Sized_relobj::include_section_group): Adjust section
14211         indexes read from group data.  Build vector to pass to
14212         layout_group.
14213         * layout.cc (Layout::layout_group): Add flags and shndxes
14214         parameters.  Remove contents parameter.  Change caller.  Update
14215         explicit instantiations.
14216         * layout.h (class Layout): Update layout_group declaration.
14217         * output.cc (Output_data_group::Output_data_group): Add flags and
14218         input_shndxes parameters.  Remove contents parameter.  Change
14219         caller.
14220         (Output_data_group::do_write): Change input_sections_ to
14221         input_shndxes_.
14222         * output.h (class Output_data_group): Update constructor
14223         declaration.  Rename input_sections_ to input_shndxes_.
14224         * testsuite/many_sections_test.cc: Add template.
14225
14226 2008-04-30  Cary Coutant  <ccoutant@google.com>
14227
14228         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14229
14230         * layout.cc (Layout::include_section): Refactored check for debug
14231         info section.
14232         (Layout::add_comdat): Add new parameters.  Change type
14233         of signature parameter.  Add object and shndx to signatures table.
14234         (Layout::find_kept_object): New function.
14235         * layout.h: Include <cstring>.
14236         (Layout::is_debug_info_section): New function.
14237         (Layout::add_comdat): Add new parameters.
14238         (Layout::find_kept_object): New function.
14239         (Layout::Kept_section): New struct.
14240         (Layout::Signatures): Change type of map range.
14241         * object.cc (Relobj::output_section_address): New function.
14242         (Sized_relobj::include_section_group): Add new parameters.  Change
14243         calls to Layout::add_comdat.  Change to build table of kept comdat
14244         groups and table mapping discarded sections to kept sections.
14245         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14246         (Sized_relobj::do_layout): Change calls to include_section_group and
14247         include_linkonce_section.
14248         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14249         value to zero when section is discarded.
14250         (Sized_relobj::map_to_kept_section): New function.
14251         * object.h (Relobj::output_section_address): New function.
14252         (Relobj::Comdat_group): New type.
14253         (Relobj::find_comdat_group): New function.
14254         (Relobj::Comdat_group_table): New type.
14255         (Relobj::Kept_comdat_section): New type.
14256         (Relobj::Kept_comdat_section_table): New type.
14257         (Relobj::add_comdat_group): New function.
14258         (Relobj::set_kept_comdat_section): New function.
14259         (Relobj::get_kept_comdat_section): New function.
14260         (Relobj::comdat_groups_): New field.
14261         (Relobj::kept_comdat_sections_): New field.
14262         (Symbol_value::input_value): Update comment.
14263         (Sized_relobj::map_to_kept_section) New function.
14264         (Sized_relobj::include_linkonce_section): Add new parameter.
14265         * target-reloc.h (Comdat_behavior): New type.
14266         (get_comdat_behavior): New function.
14267         (relocate_section): Add code to map a discarded section to the
14268         corresponding kept section when applying a relocation.
14269
14270 2008-04-30  Craig Silverstein  <csilvers@google.com>
14271
14272         * dwarf_reader.cc (next_generation_count): New static var.
14273         (Addr2line_cache_entry): New struct.
14274         (addr2line_cache): New static var.
14275         (Dwarf_line_info::one_addr2line): Added caching.
14276         (Dwarf_line_info::clear_addr2line_cache): New function.
14277         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14278         cache-size parameter.
14279         (Dwarf_line_info::one_addr2line_cache): New function.
14280         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14281         new cache-size argument to one_addr2line(), and clear cache.
14282
14283 2008-04-28  Cary Coutant  <ccoutant@google.com>
14284
14285         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14286         R_386_PC8 relocations.
14287
14288 2008-04-23  Ian Lance Taylor  <iant@google.com>
14289
14290         * object.cc (Sized_relobj::include_section_group): Check for
14291         invalid section group.
14292
14293         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14294         header size.
14295
14296         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14297         than read for file header.
14298         * archive.cc (Archive::include_member): Likewise.
14299
14300 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14301
14302         * aclocal.m4: Regenerate.
14303         * configure: Regenerate.
14304
14305 2008-04-19  Ian Lance Taylor  <iant@google.com>
14306
14307         * version.cc (version_string): Bump to 1.6.
14308
14309         * testsuite/Makefile.am (many_sections_r_test): New target.
14310         (many_sections_r_test_SOURCES): Remove.
14311         (many_sections_r_test_DEPENDENCIES): Remove.
14312         (many_sections_r_test_LDFLAGS): Remove.
14313         (many_sections_r_test_LDADD): Remove.
14314
14315         * object.cc (Sized_relobj::do_add_symbols): Always pass
14316         local_symbol_count_ to add_from_relobj.
14317
14318         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14319         every thousand variables.
14320         * testsuite/Makefile.in: Rebuild.
14321
14322         * object.cc (Xindex::initialize_symtab_xindex): New function.
14323         (Xindex::read_symtab_xindex): New function.
14324         (Xindex::sym_xindex_to_shndx): New function.
14325         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14326         available.
14327         (Sized_relobj::do_initialize_xindex): New function.
14328         (Sized_relobj::do_read_symbols): Adjust section links.
14329         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14330         parameter.  Change all callers.
14331         (Sized_relobj::include_section_group): Adjust section links and
14332         symbol section indexes.
14333         (Sized_relobj::do_layout): Adjust section links.
14334         (Sized_relobj::do_count_local_symbols): Adjust section links and
14335         symbol section indexes.
14336         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14337         ordinary and special symbols.
14338         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14339         dynsym_xindex parameters.  Change all callers.  Adjust section
14340         links.  Use SHN_XINDEX when needed.
14341         (Sized_relobj::get_symbol_location_info): Adjust section links.
14342         Don't get fooled by special symbols.
14343         * object.h (class Xindex): Define.
14344         (class Object): Add xindex_ parameter.  Declare virtual functoin
14345         do_initialize_xindex.
14346         (Object::adjust_sym_shndx): New function.
14347         (Object::set_xindex): New protected function.
14348         (class Symbol_value): Add is_ordinary_shndx_ field.
14349         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14350         (Symbol_value::value): Assert ordinary section.
14351         (Symbol_value::initialize_input_to_output_map): Likewise.
14352         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14353         Change all callers.
14354         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14355         all callers.
14356         (class Sized_relobj): Update declarations.
14357         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14358         parameter.  Change all callers.
14359         (Sized_relobj::adjust_shndx): New function.
14360         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14361         field.
14362         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14363         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14364         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14365         (Sized_dynobj::read_dynsym_section): Adjust section links.
14366         (Sized_dynobj::read_dynamic): Likewise.
14367         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14368         section links.
14369         (Sized_dynobj::do_initialize_xindex): New function.
14370         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14371         do_initialize_xindex.
14372         (Sized_dynobj::adjust_shndx): New function.
14373         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14374         dynsym_xindex_ fields.
14375         (Layout::finalize): Add a call to set_section_indexes before
14376         creating the symtab sections.
14377         (Layout::set_section_indexes): Don't do anything if the section
14378         already has a section index.
14379         (Layout::create_symtab_sections): Add shnum parameter.  Change
14380         caller.  Create .symtab_shndx section if needed.
14381         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14382         caller.
14383         (Layout::allocated_output_section_count): New function.
14384         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14385         needed.
14386         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14387         fields.  Update declarations.
14388         (Layout::symtab_xindex): New function.
14389         (Layout::dynsym_xindex): New function.
14390         (class Write_symbols_task): Add layout_ field.
14391         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14392         Change caller.
14393         * output.cc (Output_section_headers::Output_section_headers): Add
14394         shstrtab_section parameter.  Change all callers.
14395         (Output_section_headers::do_sized_write): Store overflow values
14396         for section count and section string table section index in
14397         section header zero.
14398         (Output_file_header::do_sized_write): Check for overflow of
14399         section count and section string table section index.
14400         (Output_symtab_xindex::do_write): New function.
14401         (Output_symtab_xindex::endian_do_write): New function.
14402         * output.h (class Output_section_headers): Add shstrtab_section_.
14403         Update declarations.
14404         (class Output_symtab_xindex): Define.
14405         (Output_section::has_out_shndx): New function.
14406         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14407         field.
14408         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14409         Change all callers.
14410         (Sized_symbol::init): Likewise.
14411         (Symbol::output_section): Check for ordinary symbol.
14412         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14413         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14414         callers.
14415         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14416         Change all callers.  Simplify handling of symbols from sections
14417         not included in the link.
14418         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14419         distinction.
14420         (Weak_alias_sorter::operator()): Assert that symbols are
14421         ordinary.
14422         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14423         distinction.
14424         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14425         parameters.  Change all callers.
14426         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14427         symbol distinction.  Use SHN_XINDEX when needed.
14428         (Symbol_table::write_section_symbol): Add symtab_xindex
14429         parameter.  Change all callers.
14430         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14431         SHN_XINDEX when needed.
14432         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14433         declarations.
14434         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14435         (Symbol::is_defined): Check is_ordinary.
14436         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14437         (Symbol::is_absolute, Symbol::is_common): Likewise.
14438         (class Sized_symbol): Update declarations.
14439         (class Symbol_table): Update declarations.
14440         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14441         parameters.  Change all callers.
14442         (Sized_symbol::override): Likewise.
14443         (Symbol_table::override): Likewise.
14444         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14445         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14446         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14447         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14448         to be in an ordinary section.
14449         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14450         object and is_ordinary parameters.  Change all callers.
14451         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14452         Change all callers.  Don't add undefined or non-ordinary symbols
14453         to reloc_map_.
14454         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14455         Change all callers.
14456         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14457         declarations.
14458         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14459         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14460         (Sized_relobj::relocate_sections): Likewise.
14461         * target-reloc.h (scan_relocs): Adjust section symbol index.
14462         (scan_relocatable_relocs): Likewise.
14463         * i386.cc (Scan::local): Check for ordinary symbols.
14464         * sparc.cc (Scan::local): Likewise.
14465         * x86_64.cc (Scan::local): Likewise.
14466         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14467         to symbol_section_and_value.
14468         * testsuite/many_sections_test.cc: New file.
14469         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14470         (check_PROGRAMS): Add many_sections_test.
14471         (many_sections_test_SOURCES): Define.
14472         (many_sections_test_DEPENDENCIES): Define.
14473         (many_sections_test_LDFLAGS): Define.
14474         (BUILT_SOURCES): Add many_sections_define.h.
14475         (many_sections_define.h): New target.
14476         (BUILT_SOURCES): Add many_sections_check.h.
14477         (many_sections_check.h): New target.
14478         (check_PROGRAMS): Add many_sections_r_test.
14479         (many_sections_r_test_SOURCES): Define.
14480         (many_sections_r_test_DEPENDENCIES): Define.
14481         (many_sections_r_test_LDFLAGS): Define.
14482         (many_sections_r_test_LDADD): Define.
14483         (many_sections_r_test.o): New target.
14484         * testsuite/Makefile.in: Rebuild.
14485
14486 2008-04-17  Cary Coutant  <ccoutant@google.com>
14487
14488         * errors.cc (Errors::info): New function.
14489         (gold_info): New function.
14490         * errors.h (Errors::info): New function.
14491         * gold.h (gold_info): New function.
14492         * object.cc (Input_objects::add_object): Print trace output.
14493         * options.cc (options::parse_set): New function.
14494         (General_options::parse_wrap): Deleted.
14495         (General_options::General_options): Deleted initializer.
14496         * options.h (options::String_set): New typedef.
14497         (options::parse_set): New function.
14498         (DEFINE_set): New macro.
14499         (General_options::wrap): Changed to use DEFINE_set. Changed
14500         callers of any_wrap_symbols and is_wrap_symbol.
14501         (General_options::trace, General_options::trace_symbol):
14502         New options.
14503         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14504         (General_options::wrap_symbols_): Deleted.
14505         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14506
14507 2008-04-17  David S. Miller  <davem@davemloft.net>
14508
14509         * options.cc (General_options::parse_V): New function.
14510         * options.h: Add entries for -V and -Qy.
14511
14512 2008-04-17  Ian Lance Taylor  <iant@google.com>
14513
14514         * common.cc (Symbol_table::allocate_commons): Remove options
14515         parameter.  Change caller.
14516         (Symbol_table::do_allocate_commons): Remove options parameter.
14517         Change caller.  Just call do_allocate_commons_list twice.
14518         (Symbol_table::do_allocate_commons_list): New function, broken out
14519         of do_allocate_commons.
14520         * common.h (class Allocate_commons_task): Remove options_ field.
14521         Update constructor.
14522         * symtab.cc (Symbol_table::Symbol_table): Initialize
14523         tls_commons_.
14524         (Symbol_table::add_from_object): Put TLS common symbols on
14525         tls_commons_ list.
14526         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14527         which are IN_OUTPUT_DATA.
14528         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14529         allocate_commons and do_allocate_commons declarations.  Declare
14530         do_allocate_commons_list.
14531         * gold.cc (queue_middle_tasks): Update creation of
14532         Allocate_commons_task to not pass options.
14533         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14534         (TLS_TEST_C_FLAGS): New variable.
14535         (tls_test_c_pic.o): New target.
14536         (tls_test_shared.so): Link in tls_test_c_pic.o.
14537         (tls_test_c_pic_ie.o): New target.
14538         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14539         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14540         (tls_test_c.o): New target.
14541         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14542         (tls_pic_test_LDADD): Likewise.
14543         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14544         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14545         (tls_test_c_gnu2.o): New target.
14546         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14547         tls_test_c_gnu2.o.
14548         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14549         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14550         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14551         * testsuite/tls_test.cc: Include "config.h".
14552         (t_last): Call t11_last.
14553         * testsuite/tls_test.h (t11, t11_last): Declare.
14554         * testsuite/tls_test_c.c: New file.
14555         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14556         * configure.ac: Check for OpenMP support.
14557         * configure, config.in, Makefile.in: Rebuild.
14558         * testsuite/Makefile.in: Rebuild.
14559
14560 2008-04-16  Cary Coutant  <ccoutant@google.com>
14561
14562         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14563         (Target_i386::tls_base_symbol_defined_): New field.
14564         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14565         (Target_i386::Scan::global): Likewise.
14566         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14567         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14568         (Target_x86_64::tls_base_symbol_defined_): New field.
14569         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14570         (Target_x86_64::Scan::global): Likewise.
14571
14572 2008-04-16  Cary Coutant  <ccoutant@google.com>
14573
14574         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14575         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14576         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14577         building shared libraries.
14578         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14579         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14580         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14581         * testsuite/Makefile.in: Rebuild.
14582         * testsuite/weak_undef.h: New file.
14583         * testsuite/weak_undef_file1.cc: Add extra test cases.
14584         * testsuite/weak_undef_file2.cc: Likewise.
14585         * testsuite/weak_undef_test.cc: Likewise.
14586
14587 2008-04-16  David S. Miller  <davem@davemloft.net>
14588
14589         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14590         Add issued_non_pic_error_ field.  Declare check_non_pic.
14591         (Target_sparc::Scan::check_non_pic): New function.
14592         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14593         (Target_sparc::Scan::global): Likewise.
14594
14595         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14596         * configure: Rebuild.
14597
14598         * options.h (DEFINE_enable): New macro.
14599         (new_dtags): New enable option.
14600         (initfirst, interpose, loadfltr, nodefaultlib,
14601         nodelete, nodlopen, nodump): New -z options.
14602         * layout.cc (Layout:finish_dynamic_section): If new
14603         dtags enabled, emit DT_RUNPATH.  Also, emit a
14604         DT_FLAGS_1 containing any specified -z flags.
14605
14606 2008-04-16  Ian Lance Taylor  <iant@google.com>
14607
14608         * copy-relocs.cc: New file.
14609         * copy-relocs.h: New file.
14610         * reloc.cc: Remove Copy_relocs code.
14611         * reloc.h: Likewise.
14612         * reloc-types.h (struct Reloc_types) [both versions]: Add
14613         get_reloc_addend_noerror.
14614         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14615         variants of add_global which take an addend which must be zero.
14616         * i386.cc: Include "copy-relocs.h".
14617         (class Target_i386): Change type of copy_relocs_ to variable,
14618         update initializer.
14619         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14620         Change all callers.
14621         (Target_i386::do_finalize_sections): Change handling of
14622         copy_relocs_.
14623         * sparc.cc: Include "copy-relocs.h".
14624         (class Target_sparc): Change type of copy_relocs_ to variable,
14625         update initializer.
14626         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14627         Change all callers.
14628         (Target_sparc::do_finalize_sections): Change handling of
14629         copy_relocs_.
14630         * x86_64.cc: Include "copy-relocs.h".
14631         (class Target_x86_64): Change type of copy_relocs_ to variable,
14632         update initializer.
14633         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14634         class.  Change all callers.
14635         (Target_x86_64::do_finalize_sections): Change handling of
14636         copy_relocs_.
14637         * Makefile.am (CCFILES): Add copy-relocs.cc.
14638         (HFILES): Add copy-relocs.h.
14639
14640         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14641
14642         * testsuite/script_test_4.sh: Permit leading zeroes.
14643
14644 2008-04-15  Ian Lance Taylor  <iant@google.com>
14645
14646         * script-sections.cc (Script_sections::create_segments): Use
14647         header_size_adjustment even when there is enough room for the
14648         headers.
14649         * testsuite/script_test_4.sh: New file.
14650         * testsuite/script_test_4.t: New file.
14651         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14652         (check_DATA): Add script_test_4.stdout.
14653         (MOSTLYCLEANFILES): Likewise.
14654         (script_test_4): New target.
14655         (script_test_4.stdout): New target.
14656         * testsuite/Makefile.in: Rebuild.
14657
14658         * sparc.cc: Add definitions for Output_data_plt_sparc class
14659         constants.
14660
14661 2008-04-14  David S. Miller  <davem@davemloft.net>
14662
14663         * sparc.cc: New file.
14664         * Makefile.am (TARGETSOURCES): Add sparc.cc
14665         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14666         * configure.tgt: Document targ_extra_size and
14667         targ_extra_big_endian.  Add entries for sparc-* and
14668         sparc64-*.
14669         * configure.ac: Handle targ_extra_size and
14670         targ_extra_big_endian.
14671         * Makefile.in: Rebuild.
14672         * configure: Likewise.
14673         * po/POTFILES.in: Likewise.
14674         * po/gold.pot: Likewise.
14675
14676 2008-04-14  Ian Lance Taylor  <iant@google.com>
14677
14678         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14679         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14680         in the name/type/flags to section mapping.  Don't call
14681         allocate_output_section.
14682         (Layout::choose_output_section): Change parameter from adjust_name
14683         to is_input_section.  Don't permit input sections after sections
14684         are attached to segments.  Don't call allocate_output_section.
14685         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14686         not write_enable_output_section.
14687         (Layout::make_output_section): Don't push to
14688         unattached_section_list_ nor call attach_to_segment.  Call
14689         attach_section_to_segment if sections are attached.
14690         (Layout::attach_sections_to_segments): New function.
14691         (Layout::attach_section_to_segment): New function.
14692         (Layout::attach_allocated_section_to_segment): Rename from
14693         attach_to_segment.  Remove flags parameter.
14694         (Layout::allocate_output_section): Remove function.
14695         (Layout::write_enable_output_section): Remove function.
14696         * layout.h (class Layout): Update for above changes.  Add new
14697         field sections_are_attached_.
14698         * output.h (Output_section::update_flags_for_input_section): New
14699         function.
14700         * output.cc (Output_section::add_input_section): Call
14701         update_flags_for_input_section.
14702         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14703
14704 2008-04-11  Cary Coutant  <ccoutant@google.com>
14705
14706         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14707         thought unnecessary.
14708         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14709
14710 2008-04-11  Ian Lance Taylor  <iant@google.com>
14711
14712         * output.h (class Output_section_data): Remove inline definition
14713         of set_addralign.
14714         * output.cc (Output_section_data::set_addralign): New function.
14715
14716 2008-04-11  Cary Coutant  <ccoutant@google.com>
14717
14718         Add support for TLS descriptors for i386 and x86_64.
14719         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14720         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14721         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14722         GOT_TYPE_TLS_DESC.
14723         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14724         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14725         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14726         relocations.
14727         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14728         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14729         Fix problem with initial-exec relocations.
14730         (Target_i386::Relocate::relocate_tls): Likewise.
14731         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14732         relaxation.
14733         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14734         support for section-plus-offset dynamic table entries.
14735         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14736         (Output_data_dynamic::Dynamic_entry): Add support for
14737         section-plus-offset dynamic table entries.
14738         (Output_data_dynamic::Classification): Likewise.
14739         (Output_data_dynamic::classification_): Renamed offset_.
14740         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14741         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14742         (Target_x86_64::make_plt_section): New function.
14743         (Target_x86_64::reserve_tlsdesc_entries): New function.
14744         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14745         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14746         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14747         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14748         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14749         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14750         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14751         add extra PLT entry for TLS descriptors.
14752         (Output_data_plt_x86_64::got_): New field.
14753         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14754         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14755         fields.
14756         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14757         descriptors.
14758         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14759         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14760         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14761         R_386_TLS_DESC_CALL relocations.
14762         (Target_x86_64::Scan::global): Likewise.
14763         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14764         for TLS descriptors.
14765         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14766         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14767         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14768         GD-to-IE relaxation.
14769         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14770         and TLS_DESCRIPTORS.
14771         * Makefile.in: Rebuild.
14772         * configure: Rebuild.
14773         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14774         (tls_test_shared2.so): New target.
14775         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14776         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14777         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14778         (tls_shared_gd_to_ie_test_LDADD): New variable.
14779         (tls_shared_gnu2_gd_to_ie_test): New target.
14780         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14781         New targets.
14782         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14783         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14784         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14785         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14786         (tls_shared_gnu2_test): New target.
14787         (tls_test_gnu2_shared.so): New target.
14788         (tls_shared_gnu2_test_SOURCES): New variable.
14789         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14790         (tls_shared_gnu2_test_LDFLAGS): New variable.
14791         (tls_shared_gnu2_test_LDADD): New variable.
14792         * testsuite/Makefile.in: Rebuild.
14793         * testsuite/Makefile.
14794
14795 2008-04-11  Ian Lance Taylor  <iant@google.com>
14796
14797         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14798         justsyms.t.
14799         * testsuite/Makefile.in: Rebuild.
14800
14801         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14802         long.
14803         * testsuite/script_test_2.cc (main): Adjust test.
14804
14805 2008-04-11  David S. Miller  <davem@davemloft.net>
14806             Ian Lance Taylor  <iant@google.com>
14807
14808         * options.h (General_options): Add entries for '-Y' and
14809         '-relax'.
14810         * options.cc (General_options:finalize): If -Y was used, add those
14811         entries to the library path instead of the default "/lib" and
14812         "/usr/lib".
14813
14814 2008-04-11  David S. Miller  <davem@davemloft.net>
14815
14816         * testsuite/justsyms.t: Start at 0x100.
14817         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14818         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14819         long.
14820         * testsuite/script_test_2.cc: Adjust string and section length
14821         checks.
14822
14823 2008-04-09  Ian Lance Taylor  <iant@google.com>
14824
14825         PR gold/5996
14826         * script-sections.cc (Sections_element::allocate_to_segment): Add
14827         orphan parameter.
14828         (Output_section_definition::allocate_to_segment): Likewise.
14829         (Orphan_output_section::allocate_to_segment): Likewise.
14830         (Script_sections::attach_sections_using_phdrs_clause): Don't
14831         propagate non-PT_LOAD segments to orphan sections.
14832         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14833         readelf rather than objdump.
14834         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14835         .interp section and PT_INTERP segment are the same size.
14836         * testsuite/Makefile.in: Rebuild.
14837
14838         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14839         aliases for symbols defined in the same object.
14840         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14841         (weak_alias_test_SOURCES): New variable.
14842         (weak_alias_test_DEPENDENCIES): New variable.
14843         (weak_alias_test_LDFLAGS): New variable.
14844         (weak_alias_test_LDADD): New variable.
14845         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14846         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14847         (weak_alias_test_3.o): New target.
14848         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14849         * testsuite/weak_alias_test_main.cc: New file.
14850         * testsuite/weak_alias_test_1.cc: New file.
14851         * testsuite/weak_alias_test_2.cc: New file.
14852         * testsuite/weak_alias_test_3.cc: New file.
14853
14854 2008-04-08  Ian Lance Taylor  <iant@google.com>
14855
14856         * options.h (class General_options): Add --noinhibit-exec option.
14857         * main.cc (main): Check --noinhibit-exec.
14858
14859         * options.h (class General_options): Define --wrap as a special
14860         option.  Add wrap_symbols_ field.
14861         (General_options::any_wrap_symbols): New function.
14862         (General_options::is_wrap_symbol): New function.
14863         * options.cc (General_options::parse_wrap): New function.
14864         (General_options::General_options): Initialize wrap_symbols_.
14865         * symtab.cc (Symbol_table::wrap_symbol): New function.
14866         (Symbol_table::add_from_object): Handle --wrap.
14867         * symtab.h (class Symbol_table): Declare wrap_symbol.
14868         * target.h (Target::wrap_char): New function.
14869         (Target::Target_info): Add wrap_char field.
14870         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14871         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14872         * testsuite/testfile.cc (Target_test::test_target_info):
14873         Likewise.
14874
14875         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14876         there is one.
14877
14878         * layout.h (class Layout): Add added_eh_frame_data_ field.
14879         * layout.cc (Layout::Layout): Initialize new field.
14880         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14881         output section until we find a section we merged successfully.
14882         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14883         that the size be non-zero.
14884
14885         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14886         qualifier.
14887
14888 2008-04-08  Craig Silverstein  <csilvers@google.com>
14889
14890         * configure.ac: Export new conditional variable HAVE_ZLIB.
14891         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14892         on HAVE_ZLIB.
14893         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14894         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14895
14896 2008-04-07  Ian Lance Taylor  <iant@google.com>
14897
14898         * version.cc (version_string): Set to "1.5".
14899
14900         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14901         Add issued_non_pic_error_ field.  Declare check_non_pic.
14902         (Target_x86_64::Scan::check_non_pic): New function.
14903         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14904         (Target_x86_64::Scan::global): Likewise.
14905
14906         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14907         addend parameter.  Change caller.  Handle merge sections.
14908         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14909         Address to Addend.  Don't add in the result of
14910         local_section_offset, pass down the addend and use the returned
14911         value.
14912         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14913         Update declarations of local_section_offset and symbol_value.
14914         * testsuite/two_file_test_1.cc (t18): New function.
14915         * testsuite/two_file_test_2.cc (f18): New function.
14916         * testsuite/two_file_test_main.cc (main): Call t18.
14917         * testsuite/two_file_test.h (t18, f18): Declare.
14918
14919         * configure.ac: Don't test for objdump, c++filt, or readelf.
14920         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14921         conditionals.
14922         (TEST_READELF): New variable.
14923         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14924         (check_PROGRAMS): Add two_file_strip_test.
14925         (two_file_strip_test): New target.
14926         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14927         (two_file_same_shared_strip_test_SOURCES): New variable.
14928         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14929         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14930         (two_file_same_shared_strip_test_LDADD): New variable.
14931         (two_file_shared_strip.so): New target.
14932         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14933         (ver_test_5.syms, ver_test_7.syms): Likewise.
14934         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14935         (strip_test_3.stdout): Use TEST_OBJDUMP.
14936         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14937
14938 2008-04-04  Cary Coutant  <ccoutant@google.com>
14939
14940         * symtab.h (Symbol::is_weak_undefined): New function.
14941         (Symbol::is_strong_undefined): New function.
14942         (Symbol::is_absolute): New function.
14943         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14944         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14945         absolute symbols.
14946         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14947         (weak_undef_test): New target.
14948         * testsuite/Makefile.in: Rebuild.
14949         * testsuite/weak_undef_file1.cc: New file.
14950         * testsuite/weak_undef_file2.cc: New file.
14951         * testsuite/weak_undef_test.cc: New file.
14952
14953 2008-04-03  Craig Silverstein  <csilvers@google.com>
14954
14955         * compressed_output.h (class Output_compressed_section): Use
14956         unsigned buffer.
14957         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14958         add zlib header.
14959         (zlib_compressed_suffix): Removed.
14960         (Output_compressed_section::set_final_data_size): Use unsigned
14961         buffers.
14962         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14963         Fix linker invocation.
14964         (flagstest_o_specialfile_and_compress_debug_sections):
14965         Likewise.
14966         * testsuite/Makefile.in: Regenerated.
14967
14968 2008-04-02  David S. Miller  <davem@davemloft.net>
14969
14970         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14971         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14972
14973 2008-04-02  Craig Silverstein  <csilvers@google.com>
14974
14975         * TODO: New file.
14976
14977 2008-04-02  Ian Lance Taylor  <iant@google.com>
14978
14979         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14980         parameters.  Update for new key type to views_.  Change all
14981         callers.
14982         (File_read::read): Adjust for byteshift in returned view.
14983         (File_read::add_view): New function, broken out of
14984         find_and_make_view.
14985         (File_read::make_view): New function, broken out of
14986         find_and_make_view.
14987         (File_read::find_or_make_view): Add offset and aligned
14988         parameters.  Rewrite accordingly.  Change all callers.
14989         (File_read::get_view): Add offset and aligned parameters.  Adjust
14990         for byteshift in return value.
14991         (File_read::get_lasting_view): Likewise.
14992         * fileread.h (class File_read): Update declarations.
14993         (class File_read::View): Add byteshift_ field.  Add byteshift to
14994         constructor.  Add byteshift method.
14995         * archive.h (Archive::clear_uncached_views): New function.
14996         (Archive::get_view): Add aligned parameter.  Change all callers.
14997         * object.h (Object::get_view): Add aligned parameter.  Change all
14998         callers.
14999         (Object::get_lasting_view): Likewise.
15000
15001         * fileread.cc (File_read::release): Don't call clear_views if
15002         there are multiple objects.
15003         * fileread.h (File_read::clear_uncached_views): New function.
15004         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15005         on the archive.
15006
15007 2008-03-31  Cary Coutant  <ccoutant@google.com>
15008
15009         Add thin archive support.
15010         * archive.cc (Archive::armagt): New const.
15011         (Archive::setup): Remove task parameter and calls to unlock.
15012         (Archive::unlock_nested_archives): New function.
15013         (Archive::read_header): Add nested_off parameter. Change
15014         all callers.
15015         (Archive::interpret_header): Likewise.
15016         (Archive::include_all_members): Change to handle thin
15017         archives.
15018         (Archive::include_member): Likewise.
15019         * archive.h (Archive::Archive): Add new parameters and
15020         initializers.
15021         (Archive::armagt): New const.
15022         (Archive::setup): Remove task parameter.
15023         (Archive::unlock_nested_archives): New function.
15024         (Archive::read_header): Add nested_off parameter.
15025         (Archive::interpret_header): Likewise.
15026         (Archive::Nested_archive_table): New typedef.
15027         (Archive::is_thin_archive_): New field.
15028         (Archive::nested_archives_): New field.
15029         (Archive::options_): New field.
15030         (Archive::dirpath_): New field.
15031         (Archive::task_): New field.
15032         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15033         for thin archives.  Pass additional parameters to
15034         Archive::Archive.  Unlock the archive file after calling
15035         Archive::setup.
15036
15037 2008-03-29  Ian Lance Taylor  <iant@google.com>
15038
15039         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15040         version symbol to be local.
15041         * testsuite/ver_test_4.sh: New file.
15042         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15043         (check_DATA): Add ver_test_4.syms.
15044         (ver_test_4.syms): New target.
15045         * testsuite/Makefile.in: Rebuild.
15046
15047         * output.cc
15048         (Output_section::Input_section_sort_entry::has_priority): New
15049         function.
15050         (Output_section::Input_section_sort_entry::match_file_name): New
15051         function.
15052         (Output_section::Input_section_sort_entry::match_section_name):
15053         Remove.
15054         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15055         Remove.
15056         (Output_section::Input_section_sort_entry::match_section_file):
15057         Remove.
15058         (Output_section::Input_section_sort_compare::operator()): Rewrite
15059         using new Input_section_sort_entry functions.  Sort crtbegin and
15060         crtend first.  Sort sections with no priority before sections with
15061         a priority.
15062         * testsuite/initpri1.c (d3): Check j != 4.
15063         (cd5): New constructor/destructor function.
15064         (main): Check j != 2.
15065
15066         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15067         new symbol when resolving, don't call set_is_default.
15068         * testsuite/ver_test_7.cc: New file.
15069         * testsuite/ver_test_7.sh: New file.
15070         * testsuite/Makefile.am (ver_test_7.so): New target.
15071         (ver_test_7.o): New target.
15072         (check_SCRIPTS): Add ver_test_7.sh.
15073         (check_DATA): Add ver_test_7.syms.
15074         (ver_test_7.syms): New target.
15075
15076 2008-03-28  Ian Lance Taylor  <iant@google.com>
15077
15078         * layout.cc (Layout::layout): If we see an input section with a
15079         name that needs sorting, set the must_sort flag for the output
15080         section.
15081         (Layout::make_output_section): If the name of the output section
15082         indicates that it might require sorting, set the may_sort flag.
15083         * output.h (Output_section::may_sort_attached_input_sections): New
15084         function.
15085         (Output_section::set_may_sort_attached_input_sections): New
15086         function.
15087         (Output_section::must_sort_attached_input_sections): New
15088         function.
15089         (Output_section::set_must_sort_attached_input_sections): New
15090         function.
15091         (class Output_section): Declare Input_section_sort_entry.  Define
15092         Input_section_sort_compare.  Declare
15093         sort_attached_input_sections.  Add new fields:
15094         may_sort_attached_input_sections_,
15095         must_sort_attached_input_sections_,
15096         attached_input_sections_are_sorted_.
15097         * output.cc (Output_section::Output_section): Initialize new
15098         fields.
15099         (Output_section::add_input_section): Add an entry to
15100         input_sections_ if may_sort or must_sort are true.
15101         (Output_section::set_final_data_size): Call
15102         sort_attached_input_sections if necessary.
15103         (Output_section::Input_section_sort_entry): Define new class.
15104         (Output_section::Input_section_sort_compare::operator()): New
15105         function.
15106         (Output_section::sort_attached_input_sections): New function.
15107         * configure.ac: Check whether the compiler supports constructor
15108         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15109         * testsuite/initpri1.c: New file.
15110         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15111         CONSTRUCTOR_PRIORITY.
15112         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15113         (initpri1_LDFLAGS): New variable.
15114         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15115
15116 2008-03-27  Ian Lance Taylor  <iant@google.com>
15117
15118         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15119         * testsuite/common_test_1.c: New file.
15120         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15121         (common_test_1_SOURCES): New variable.
15122         (common_test_1_DEPENDENCIES): New variable.
15123         (common_test_1_LDFLAGS): New variable.
15124
15125         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15126         and commons_ correctly when NAME/VERSION does not override
15127         NAME/NULL.
15128         * testsuite/ver_test_6.c: New file.
15129         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15130         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15131         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15132
15133 2008-03-26  Ian Lance Taylor  <iant@google.com>
15134
15135         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15136         of an undefined symbol from a version script.
15137         * testsuite/Makefile.am (ver_test_5.so): New target.
15138         (ver_test_5.o): New target.
15139         (check_SCRIPTS): Add ver_test_5.sh.
15140         (check_DATA): Add ver_test_5.syms.
15141         (ver_test_5.syms): New target.
15142         * testsuite/ver_test_5.cc: New file.
15143         * testsuite/ver_test_5.script: New file.
15144         * testsuite/ver_test_5.sh: New file.
15145         * Makefile.in, testsuite/Makefile.in: Rebuild.
15146
15147         PR gold/5986
15148         Fix problems building gold with gcc 4.3.0.
15149         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15150         (gold_error_at_location, gold_warning_at_location): Use it.
15151         * configure.ac: Check whether we can compile and use a template
15152         function with a printf attribute.
15153         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15154         when jumping over bytes.
15155         * object.cc: Instantiate Object::read_section_data.
15156         * debug.h: Include <cstring>
15157         * dwarf_reader.cc: Include <algorithm>
15158         * main.cc: Include <cstring>.
15159         * options.cc: Include <cstring>.
15160         * output.cc: Include <cstring>.
15161         * script.cc: Include <cstring>.
15162         * script.h: Include <string>.
15163         * symtab.cc: Include <cstring> and <algorithm>.
15164         * target-select.cc: Include <cstring>.
15165         * version.cc: Include <string>.
15166         * testsuite/testmain.cc: Include <cstdlib>.
15167         * configure, config.in: Rebuild.
15168
15169 2008-03-25  Ian Lance Taylor  <iant@google.com>
15170
15171         * options.cc: Include "../bfd/bfdver.h".
15172         (options::help): Print bug reporting address.
15173
15174         * version.cc (print_version): Adjust output for current value of
15175         BFD_VERSION_STRING.
15176
15177         * NEWS: New file.
15178
15179         * options.cc (options::help): Print list of supported targets.
15180         * target-select.h: Include <vector>.
15181         (class Target_selector): Make machine_, size_, and is_big_endian_
15182         fields const.  Add bfd_name_ and instantiated_target_ fields.
15183         (Target_selector::Target_selector): Add bfd_name parameter.
15184         (Target_selector::recognize): Make non-virtual, call
15185         do_recognize.
15186         (Target_selector::recognize_by_name): Make non-virtual, call
15187         do_recognize_by_name.
15188         (Target_selector::supported_names): New function.
15189         (Target_selector::bfd_name): New function.
15190         (Target_selector::do_instantiate_target): New pure virtual
15191         function.
15192         (Target_selector::do_recognize): New virtual function.
15193         (Target_selector::do_recognize_by_name): New virtual function.
15194         (Target_selector::instantiate_target): New private function.
15195         (supported_target_names): Declare.
15196         * target-select.cc (Target_selector::Target_selector): Update for
15197         new parameter and fields.
15198         (select_target_by_name): Check that the name matches before
15199         calling recognize_by_name.
15200         (supported_target_names): New function.
15201         * i386.cc (class Target_selector_i386): Update Target_selector
15202         constructor call.  Remove recognize and recognize_by_name.  Add
15203         do_instantiate_target.
15204         * x86_64.cc (class Target_selector_x86_64): Likewise.
15205         * testsuite/testfile.cc (class Target_selector_test): Update for
15206         changes to Target_selector.
15207
15208         * README: Rewrite, with some notes on unsupported features.
15209
15210 2008-03-24  Cary Coutant  <ccoutant@google.com>
15211
15212         * i386.cc (Target_i386::Got_type): New enum declaration.
15213         (Target_i386::Scan::local): Updated callers of Output_data_got
15214         member functions.
15215         (Target_i386::Scan::global): Likewise.
15216         (Target_i386::Relocate::relocate): Likewise.
15217         (Target_i386::Relocate::relocate_tls): Likewise.
15218         * object.h (Got_offset_list): New class.
15219         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15220         (Sized_relobj::local_got_offset): Likewise.
15221         (Sized_relobj::set_local_got_offset): Likewise.
15222         (Sized_relobj::local_has_tls_got_offset): Removed.
15223         (Sized_relobj::local_tls_got_offset): Removed.
15224         (Sized_relobj::set_local_tls_got_offset): Removed.
15225         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15226         * output.cc (Output_data_got::add_global): Added got_type parameter.
15227         (Output_data_got::add_global_with_rel): Likewise.
15228         (Output_data_got::add_global_with_rela): Likewise.
15229         (Output_data_got::add_global_pair_with_rel): New function.
15230         (Output_data_got::add_global_pair_with_rela): New function.
15231         (Output_data_got::add_local): Added got_type parameter.
15232         (Output_data_got::add_local_with_rel): Likewise.
15233         (Output_data_got::add_local_with_rela): Likewise.
15234         (Output_data_got::add_local_pair_with_rel): New function.
15235         (Output_data_got::add_local_pair_with_rela): New function.
15236         (Output_data_got::add_global_tls): Removed.
15237         (Output_data_got::add_global_tls_with_rel): Removed.
15238         (Output_data_got::add_global_tls_with_rela): Removed.
15239         (Output_data_got::add_local_tls): Removed.
15240         (Output_data_got::add_local_tls_with_rel): Removed.
15241         (Output_data_got::add_local_tls_with_rela): Removed.
15242         * output.h (Output_data_got::add_global): Added got_type parameter.
15243         (Output_data_got::add_global_with_rel): Likewise.
15244         (Output_data_got::add_global_with_rela): Likewise.
15245         (Output_data_got::add_global_pair_with_rel): New function.
15246         (Output_data_got::add_global_pair_with_rela): New function.
15247         (Output_data_got::add_local): Added got_type parameter.
15248         (Output_data_got::add_local_with_rel): Likewise.
15249         (Output_data_got::add_local_with_rela): Likewise.
15250         (Output_data_got::add_local_pair_with_rel): New function.
15251         (Output_data_got::add_local_pair_with_rela): New function.
15252         (Output_data_got::add_global_tls): Removed.
15253         (Output_data_got::add_global_tls_with_rel): Removed.
15254         (Output_data_got::add_global_tls_with_rela): Removed.
15255         (Output_data_got::add_local_tls): Removed.
15256         (Output_data_got::add_local_tls_with_rel): Removed.
15257         (Output_data_got::add_local_tls_with_rela): Removed.
15258         * resolve.cc (Symbol::override_base_with_special): Removed
15259         reference to has_got_offset_ field.
15260         * symtab.cc (Symbol::init_fields): Replaced initialization
15261         of got_offset_ with got_offsets_.  Removed initialization
15262         of has_got_offset_
15263         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15264         (Symbol::got_offset): Likewise.
15265         (Symbol::set_got_offset): Likewise.
15266         (Symbol::has_tls_got_offset): Removed.
15267         (Symbol::tls_got_offset): Removed.
15268         (Symbol::set_tls_got_offset): Removed.
15269         (Symbol::got_offset_): Removed.
15270         (Symbol::tls_mod_got_offset_): Removed.
15271         (Symbol::tls_pair_got_offset_): Removed.
15272         (Symbol::got_offsets_): New field.
15273         (Symbol::has_got_offset): Removed.
15274         (Symbol::has_tls_mod_got_offset): Removed.
15275         (Symbol::has_tls_pair_got_offset): Removed.
15276         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15277         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15278         member functions.
15279         (Target_x86_64::Scan::global): Likewise.
15280         (Target_x86_64::Relocate::relocate): Likewise.
15281         (Target_x86_64::Relocate::relocate_tls): Likewise.
15282
15283 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15284
15285         * yyscript.y: Fix spelling error in comment.
15286
15287 2008-03-24  Ian Lance Taylor  <iant@google.com>
15288
15289         * options.h (class General_options): Define build_id option.
15290         * layout.h (class Layout): Declare write_build_id, create_note,
15291         create_build_id.  Add build_id_note_ member.
15292         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15293         "libiberty.h", "md5.h", "sha1.h".
15294         (Layout::Layout): Initialize eh_frame_data_,
15295         eh_frame_hdr_section_, and build_id_note_.
15296         (Layout::finalize): Call create_build_id.
15297         (Layout::create_note): New function, broken out of
15298         Layout::create_gold_note.
15299         (Layout::create_gold_note): Call create_note.
15300         (Layout::create_build_id): New function.
15301         (Layout::write_build_id): New function.
15302         (Close_task_runner::run): Call write_build_id.
15303
15304         * x86_64.cc: Correct license to GPLv3.
15305
15306 2008-03-23  Ian Lance Taylor  <iant@google.com>
15307
15308         * options.cc: Include "demangle.h".
15309         (parse_optional_string): New function.
15310         (parse_long_option): Handle takes_optional_argument.
15311         (parse_short_option): Update dash_z initializer.  Handle
15312         takes_optional_argument.
15313         (General_options::General_options): Initialize do_demangle_.
15314         (General_options::finalize): Set do_demangle_.  Handle demangling
15315         style.
15316         * options.h (parse_optional_string): Declare.
15317         (struct One_option): Add optional_arg field.  Update constructor.
15318         Update call constructor calls.  Add takes_optional_argument
15319         function.
15320         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15321         (DEFINE_optional_string): Define.
15322         (General_options::demangle): Change from DEFINE_bool to
15323         DEFINE_optional_string.
15324         (General_options::no_demangle): New function.
15325         (General_options::do_demangle): New function.
15326         (General_options::set_do_demangle): New function.
15327         (General_options::execstack_status_): Move definition to end of
15328         class definition.
15329         (General_options::static_): Likewise.
15330         (General_options::do_demangle_): New field.
15331         * object.cc (big_endian>::get_symbol_location_info): Call
15332         Options::do_demangle, not Options::demangle.
15333         * symtab.cc (demangle): Likewise.
15334
15335 2008-03-22  Ian Lance Taylor  <iant@google.com>
15336
15337         * gold.h: Include <cstddef> and <sys/types.h>
15338         * options.h: Include <cstring>.
15339
15340 2008-03-21  Ian Lance Taylor  <iant@google.com>
15341
15342         * Added source code to GNU binutils.
15343 \f
15344 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15345
15346 Copying and distribution of this file, with or without modification,
15347 are permitted in any medium without royalty provided the copyright
15348 notice and this notice are preserved.
15349
15350 Local Variables:
15351 mode: change-log
15352 left-margin: 8
15353 fill-column: 74
15354 version-control: never
15355 End: