Revert "Fix race condition while building EH frame header."
[external/binutils.git] / gold / ChangeLog
1 2013-11-14  Cary Coutant  <ccoutant@google.com>
2
3         Revert patch -- this did not fix the problem, and there is
4         no race there.
5
6         2013-11-14  Cary Coutant  <ccoutant@google.com>
7
8             PR gold/14860
9             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
10             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
11             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
12             updating fde_offsets_.
13             (Eh_frame_hdr::lock_): New data member.
14
15 2013-11-14  Cary Coutant  <ccoutant@google.com>
16
17         * dwp.cc (Dwo_file_entry): New type.
18         (File_list): Use Dwo_file_entry.
19         (Dwo_file::verify): New function.
20         (Dwo_file::verify_dwo_list): New function.
21         (Dwo_file::sized_verify_dwo_list): New function.
22         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
23         list.
24         (Dwp_options): New enum type.
25         (dwp_options): Add --verify-only.
26         (usage): Likewise.
27         (main): Likewise.
28         * dwp.h (gold_info): Add declaration.
29
30 2013-11-14  Cary Coutant  <ccoutant@google.com>
31
32         PR gold/14860
33         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
34         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
35         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
36         updating fde_offsets_.
37         (Eh_frame_hdr::lock_): New data member.
38
39 2013-11-06  Cary Coutant  <ccoutant@google.com>
40
41         PR gold/15758
42         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
43         before reloc sections.
44
45 2013-10-31  Cary Coutant  <ccoutant@google.com>
46
47         Restore support for dwp v2 DWARF package file format.
48
49         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
50         tu_length parameter.  Adjust all callers.
51         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
52         * dwp.cc: Include dwarf.h.
53         (Section_bounds): New struct type.
54         (Unit_set): New struct type.
55         (Dwo_file::Dwo_file): Initialize new data member.
56         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
57         Combine and rename to...
58         (Dwo_file::read_unit_index): ...this.
59         (Dwo_file::sized_read_compunit_index)
60         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
61         (Dwo_file::sized_read_unit_index): ...this.
62         (Dwo_file::copy_section): Remove section_name, is_str_offsets
63         parameters; add section_id parameter.
64         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
65         (Dwo_file::add_unit_set): ...this.
66         (Dwo_file::shndx_map_): Remove.
67         (Dwo_file::sect_offsets_): New data member.
68         (Dwp_output_file::Dwp_output_file): Initialize new data members.
69         (Dwp_output_file::add_section): Rename to...
70         (Dwp_output_file::add_contribution): ...this.
71         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
72         (Dwp_output_file::add_tu_set): Likewise.
73         (Dwp_output_file::Contribution): New type.
74         (Dwp_output_file::Section::contributions): New data member.
75         (Dwp_output_file::Cu_or_tu_set): Remove.
76         (Dwp_output_file::Section::Section): New ctor.
77         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
78         (Dwp_output_file::Dwp_index::Section_table): New type.
79         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
80         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
81         parameter.
82         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
83         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
84         (Dwp_output_file::Dwp_index::section_table): New member function.
85         (Dwp_output_file::Dwp_index::section_table_end): New member function.
86         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
87         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
88         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
89         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
90         (Dwp_output_file::Dwp_index::section_table_): New data member.
91         (Dwp_output_file::Dwp_index::section_mask_): New data member.
92         (Dwp_output_file::add_output_section): New member function.
93         (Dwp_output_file::write_new_section): New member function.
94         (Dwp_output_file::write_contributions): New member function.
95         (Dwp_output_file::section_id_map_): New data member.
96         (class Dwo_id_info_reader): Remove.
97         (class Unit_reader): New class.
98         (get_dwarf_section_name): New function.
99         (Dwo_file::read_executable): Adjust initializations of class data.
100         (Dwo_file::read): Add support for v2 package file format.
101         (Dwo_file::read_unit_index): Likewise.
102         (Dwo_file::sized_read_unit_index): Likewise.
103         (Dwo_file::copy_section): Likewise.
104         (Dwo_file::add_unit_set): Likewise.
105         (Dwp_output_file::add_output_section): Likewise.
106         (Dwp_output_file::add_contribution): Likewise.
107         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
108         for empty slot.
109         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
110         file format.
111         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
112         slot.
113         (Dwp_output_file::initialize): Remove unused function.
114         (Dwp_output_file::finalize): Add support for v2 package file format.
115         (Dwp_output_file::write_index): Likewise.
116         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
117         function prototype.
118
119 2013-10-31  Cary Coutant  <ccoutant@google.com>
120
121         * configure.ac: Fix check for -fmerge-constants.
122         * configure.ac: Regenerate.
123
124 2013-10-30  Roland McGrath  <mcgrathr@google.com>
125
126         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
127         Correct 9-byte nop sequence to match what the assembler generates.
128
129 2013-10-30  Alan Modra  <amodra@gmail.com>
130
131         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
132         ppc64_local_entry_offset, ppc64_local_entry_offset,
133         do_read_symbols): New functions.
134         (Powerpc_relobj::e_flags_, st_other_): New vars.
135         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
136         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
137         (Powerpc_relobj::e_flags_): New var.
138         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
139         and adjust for ELFv2.
140         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
141         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
142         (Powerpc_dynobj::do_find_special_sections): Likewise.
143         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
144         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
145         to ELFv2 local entry.
146         (Target_powerpc::do_relax): No thread safe barriers needed for
147         ELFv2.
148         (Output_data_plt_powerpc::initial_plt_entry_size_,
149         plt_entry_size): Delete.  Replace all uses with
150         first_plt_entry_offset() and plt_entry_size().
151         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
152         reserved_size parm.  Update callers.
153         (Output_data_plt_powerpc::entry_count): Update.
154         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
155         and use Target_powerpc::first_plt_entry_offset().
156         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
157         rename to plt_entry_size.
158         (Output_data_plt_powerpc::add_ifunc_entry,
159         add_local_ifunc_entry): Adjust reloc for ELFv2.
160         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
161         (glink_eh_frame_fde_64v2): New.
162         (Stub_table::plt_call_size): Support ELFv2 sizing.
163         (Output_data_glink::add_eh_frame): Use the new FDE.
164         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
165         (Stub_table::do_write): Write ELFv2 stubs and glink.
166         (Target_powerpc::Relocate::relocate): Replaces nop after call
167         with ld 2,24(1) and adjust local offset destination for ELFv2.
168
169 2013-10-30  Alan Modra  <amodra@gmail.com>
170
171         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
172         (Target_powerpc::Scan::global, local): Likewise.
173         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
174         on all ppc64 @h and @ha relocs.
175
176 2013-10-14  Alan Modra  <amodra@gmail.com>
177
178         * output.h (Output_data_got::add_constant): Tidy.
179         (Output_data_got::add_constant_pair): New function.
180         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
181         methods used so as to first call reserve_ent().
182
183 2013-10-11  Roland McGrath  <mcgrathr@google.com>
184
185         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
186         add_got_entry and add_got_entry_pair.
187
188         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
189         (HAVE_PUBNAMES): Likewise.
190         * configure: Regenerate.
191
192         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
193         * testsuite/Makefile.in: Regenerate.
194
195         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
196         Remove const from declaration.
197         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
198         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
199         * output.h (Output_file_header): Remove const from member target_
200         and corresponding constructor argument.
201         * output.cc (Output_file_header::Output_file_header): Update prototype.
202         (Output_file_header::do_sized_write): Use this->target_ in place
203         of parameters()->target().
204
205         * testsuite/undef_symbol.cc (Foo::get_a): New method.
206
207         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
208         * configure: Regenerate.
209         * Makefile.in: Regenerate.
210         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
211         * testsuite/merge_string_literals_2.c: Likewise.
212         * testsuite/Makefile.am
213         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
214         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
215         literal -fmerge-constants.
216         * testsuite/Makefile.in: Regenerate.
217
218         * i386.cc (Target_i386): Remove unused member dynbss_.
219         * arm.cc (Target_arm): Likewise.
220         * powerpc.cc (Target_powerpc): Likewise.
221         * sparc.cc (Target_sparc): Likewise.
222         * tilegx.cc (Target_tilegx): Likewise.
223         * x86_64.cc (Target_x86_64): Likewise.
224         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
225         type_signature_, type_offset_.
226         * plugin.h (Plugin_hook): Remove unused member layout_.
227         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
228         mapfile_.
229         (Read_member): Remove unused members input_objects_, symtab_,
230         mapfile_, layout_.
231         (Check_library): Remove unused member symtab_.
232         * archive.h (Lib_group): Remove unused member lib_.
233         * archive.cc (Lib_group::Lib_group): Update initializer.
234         * incremental.h (Incremental_binary): Remove unused member target_.
235         (Incremental_script_entry): Removed unused member script_.
236         * layout.h (Write_symbols_task): Remove unused member input_objects_.
237         * icf.h (Icf): Remove unused member num_tracked_relocs.
238
239         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
240         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
241         its only use.
242         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
243
244         * archive.h: Use struct rather than class for forward declaration
245         of Read_symbols_data.
246
247 2013-10-07  Cary Coutant  <ccoutant@google.com>
248
249         PR gold/16010
250         * testsuite/Makefile.am (icf_test): Fix dependencies.
251         (icf_safe_test): Likewise.
252         (icf_safe_so_test): Likewise.
253         (large_symbol_alignment): Add empty _LDADD rule.
254         * testsuite/Makefile.in: Regenerate.
255
256 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
257
258         PR gold/15927
259         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
260         relocation for R_X86_64_32 on x32.
261
262 2013-08-27  Roland McGrath  <mcgrathr@google.com>
263
264         * output.cc (Output_segment::set_section_addresses): Take new
265         Target* argument.  If target->isolate_execinstr() and the segment
266         is executable and starts at a target->abi_pagesize() boundary,
267         pad its end out to a target->abi_pagesize() boundary with code fill.
268         * output.h (Output_segment::set_section_addresses): Update decl.
269         * layout.h (Layout::check_output_data_for_reset_values): Take new
270         argument RELAX_OUTPUTS.
271         (Layout): New member relax_output_list_.
272         (Layout::add_relax_output): New method.
273         * layout.cc (Layout::Layout): Update constructor.
274         (Layout::reset_relax_output): New method.
275         (Layout::clean_up_after_relaxation): Call it.
276         (Layout::prepare_for_relaxation): Update caller.
277         (Layout::set_segment_offsets): Update callers of set_section_addresses.
278         Call reset_relax_output before re-processing segments for
279         isolate_execinstr case.
280         (Layout::write_data): Handle relax_output_list_.
281         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
282         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
283
284 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
285
286         PR binutils/15834
287         * object.h: Fix typos.
288
289 2013-08-16  Roland McGrath  <mcgrathr@google.com>
290
291         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
292         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
293
294 2013-08-07  Cary Coutant  <ccoutant@google.com>
295
296         Revert support for v2 DWP files:
297
298         2013-03-01  Cary Coutant  <ccoutant@google.com>
299
300             Add dwp support for v2 DWARF package file format.
301             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
302             tu_length parameter.  Adjust all callers.
303             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
304             * dwp.cc: Include dwarf.h.
305             (Section_bounds): New struct type.
306             (Unit_set): New struct type.
307             (Dwo_file::Dwo_file): Initialize new data member.
308             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
309             Combine and rename to...
310             (Dwo_file::read_unit_index): ...this.
311             (Dwo_file::sized_read_compunit_index)
312             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
313             (Dwo_file::sized_read_unit_index): ...this.
314             (Dwo_file::copy_section): Remove section_name, is_str_offsets
315             parameters; add section_id parameter.
316             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
317             (Dwo_file::add_unit_set): ...this.
318             (Dwo_file::shndx_map_): Remove.
319             (Dwo_file::sect_offsets_): New data member.
320             (Dwp_output_file::Dwp_output_file): Initialize new data members.
321             (Dwp_output_file::add_section): Rename to...
322             (Dwp_output_file::add_contribution): ...this.
323             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
324             (Dwp_output_file::add_tu_set): Likewise.
325             (Dwp_output_file::Contribution): New type.
326             (Dwp_output_file::Section::contributions): New data member.
327             (Dwp_output_file::Cu_or_tu_set): Remove.
328             (Dwp_output_file::Section::Section): New ctor.
329             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
330             (Dwp_output_file::Dwp_index::Section_table): New type.
331             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
332             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
333             parameter.
334             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
335             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
336             (Dwp_output_file::Dwp_index::section_table): New member function.
337             (Dwp_output_file::Dwp_index::section_table_end): New member function.
338             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
339             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
340             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
341             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
342             (Dwp_output_file::Dwp_index::section_table_): New data member.
343             (Dwp_output_file::Dwp_index::section_mask_): New data member.
344             (Dwp_output_file::add_output_section): New member function.
345             (Dwp_output_file::write_new_section): New member function.
346             (Dwp_output_file::write_contributions): New member function.
347             (Dwp_output_file::section_id_map_): New data member.
348             (class Dwo_id_info_reader): Remove.
349             (class Unit_reader): New class.
350             (get_dwarf_section_name): New function.
351             (Dwo_file::read_executable): Adjust initializations of class data.
352             (Dwo_file::read): Add support for v2 package file format.
353             (Dwo_file::read_unit_index): Likewise.
354             (Dwo_file::sized_read_unit_index): Likewise.
355             (Dwo_file::copy_section): Likewise.
356             (Dwo_file::add_unit_set): Likewise.
357             (Dwp_output_file::add_output_section): Likewise.
358             (Dwp_output_file::add_contribution): Likewise.
359             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
360             for empty slot.
361             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
362             file format.
363             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
364             slot.
365             (Dwp_output_file::initialize): Remove unused function.
366             (Dwp_output_file::finalize): Add support for v2 package file format.
367             (Dwp_output_file::write_index): Likewise.
368             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
369             function prototype.
370
371 2013-07-31  Cary Coutant  <ccoutant@google.com>
372
373         * object.cc (Sized_relobj::do_output_section_address): New function.
374         (Sized_relobj): Instantiate explicitly.
375         * object.h (Object::output_section_address): New function.
376         (Object::do_output_section_address): New function.
377         (Sized_relobj::do_output_section_address): New function.
378         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
379
380 2013-07-30  Cary Coutant  <ccoutant@google.com>
381             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
382
383         * parameters.cc (Parameters::entry): Return target-specific entry
384         symbol name.
385         * target.h (Target::entry_symbol_name): New function.
386         (Target_info::entry_symbol_name): New data member.
387
388         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
389         * i386.cc (Target_i386::i386_info): Likewise.
390         (Target_i386_nacl::i386_nacl_info): Likewise.
391         * sparc.cc (Target_sparc::sparc_info): Likewise.
392         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
393         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
394         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
395         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
396
397 2013-07-22  Sterling Augustine  <saugustine@google.com>
398
399         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
400         Convert parameter shndx to local variable. Add parameters symtab
401         and symtab_size.  Scan over section names.  Find relocation
402         section corresponding to current section.  Create and initialize
403         reloc_mapper_ and reloc_type_.
404         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
405         unit_length to off_t.  Initialize member unit_length_.  Fill in field
406         cu_offset_.
407         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
408         Initialize new fields unit_length_ and cu_offset_.
409         (Dwarf_pubnames_table::read_section): Update prototype.
410         (Dwarf_pubnames_table::cu_offset): New member function.
411         (Dwarf_pubnames_table::subsection_size): Likewise.
412         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
413         New fields.
414         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
415         member functions public.
416         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
417         Update comment.  Rework logic.  Move repeated parts to...
418         (Gdb_index_info_reader::read_pubtable): ...here. New function.
419         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
420         pubtypes_table_, and stmt_list_offset.
421         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
422         Gdb_index::find_pubtype_offset,
423         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
424         (Gdb_index::pubnames_read): Update prototype and rework logic.
425         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
426         Forward declare.
427         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
428         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
429         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
430         Gdb_index::map_pubtable_to_dies):
431         Declare functions.
432         (Gdb_index::pubnames_read): Update declaration.
433         (Gdb_index::Pubname_offset_map): New type.
434         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
435         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
436         Gdb_index::stmt_list_offset): Declare.
437         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
438         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
439         Gdb_index::pubtypes_offset_): Remove.
440
441 2013-07-19  Roland McGrath  <mcgrathr@google.com>
442
443         * options.h (General_options): Add -Trodata-segment option.
444         * parameters.cc (Parameters::check_rodata_segment): New function.
445         (Parameters::set_target_once): Call it.
446         * parameters.h (Parameters): Declare it (private member function).
447         * layout.cc (load_seg_unusable_for_headers): New function, broken
448         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
449         then validate rodata segment rather than text segment.
450         (relaxation_loop_body): Call that.
451         (is_text_segment): New function.  Don't admit a non-executable
452         segment if TARGET->isolate_execinstr().
453         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
454
455 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
456
457         PR gold/15070
458         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
459         * nacl.h (Sniff_file::View::View): Request aligned view.
460
461 2013-07-11  Cary Coutant  <ccoutant@google.com>
462
463         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
464         correct BRLT entry size.
465
466 2013-07-03  Alan Modra  <amodra@gmail.com>
467
468         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
469         comment.
470
471 2013-07-01  Cary Coutant  <ccoutant@google.com>
472
473         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
474         reloc_type_.
475         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
476         (Dwarf_ranges_table::lookup_reloc): New function.
477         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
478         reloc_type_.
479         (Dwarf_ranges_table::lookup_reloc): New function.
480         (Dwarf_ranges_table::reloc_type_): New data member.
481
482 2013-06-27  Jing Yu  <jingyu@google.com>
483
484         PR gold/15662
485         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
486         function.
487         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
488         (Target_powerpc::do_relax): Call the above.
489
490 2013-06-27  Cary Coutant  <ccoutant@google.com>
491
492         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
493         on garbage collected .opd section.
494
495 2013-06-27  Alan Modra  <amodra@gmail.com>
496
497         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
498         is non-zero.
499         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
500         (Target_powerpc::do_function_location): Likewise for loc->shndx.
501
502 2013-06-14  Cary Coutant  <ccoutant@google.com>
503
504         * resolve.cc (Symbol::override_base): Don't override st_type
505         from plugin placeholder symbols.
506         (Symbol_table::resolve): Likewise.
507         (Symbol_table::should_override): Don't complain about TLS mismatch
508         if the TO symbol is a plugin placeholder.
509         * testsuite/Makefile.am (plugin_test_tls): New test.
510         * testsuite/Makefile.in: Regenerate.
511         * testsuite/plugin_test_tls.sh: New test script.
512         * testsuite/two_file_test_2_tls.cc: New test source.
513         * testsuite/two_file_test_tls.cc: New test source.
514
515 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
516
517         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
518         the maximum segment alignment is larger than the page size.
519         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
520         correctly aligns the symbols with large alignemnt.
521         * testsuite/Makefile.in: Regenerate.
522         * testsuite/large_symbol_alignment.cc: New file.
523
524 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
525             Sriraman Tallam  <tmsriram@google.com>
526
527         * options.h (sort_section): New option.
528         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
529         Rename from Input_section_sort_section_name_special_ordering_compare.
530         (Input_section_sort_section_name_compare): New struct.
531         * output.cc (Output_section::Input_section_sort_section_name_compare::
532         operator()): New function.
533         (Output_section::sort_attached_input_sections): Use new sort function
534         for .text if --sort-section=name is specified.
535         * layout.cc (Layout::make_output_section):
536         Add sorting by name when --sort-section=name is specified.
537         * testsuite/Makefile.am (text_section_grouping): Test option
538         --sort-section=name.
539         * testsuite/Makefile.in: Regenerate.
540         * testsuite/section_sorting_name.cc: New file.
541         * testsuite/section_sorting_name.sh: New file.
542
543 2013-05-21  Cary Coutant  <ccoutant@google.com>
544
545         * symtab.h (Symbol::is_cxx_vtable): New function.
546         * target-reloc.h (relocate_section): Check for vtable symbol.
547         * testsuite/Makefile.am (missing_key_func.sh): New test case.
548         * testsuite/Makefile.in: Regenerate.
549         * testsuite/missing_key_func.cc: New test source.
550         * testsuite/missing_key_func.sh: New test script.
551
552 2013-05-21  Cary Coutant  <ccoutant@google.com>
553
554         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
555         type of enclosing symbol.
556         (Relocate_info::location): Check symbol type when describing symbol.
557         * object.h (Symbol_location_info): Remove unused line_number;
558         add enclosing_symbol_type.
559         * testsuite/debug_msg.sh: Adjust expected output.
560
561 2013-05-13  Cary Coutant  <ccoutant@google.com>
562
563         * configure.ac: Export DEFAULT_TARGET.
564         * configure: Regenerate.
565         * Makefile.in: Regenerate.
566         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
567         * testsuite/Makefile.in: Regenerate.
568         * testsuite/debug_msg.sh: Delete duplicate tests.
569         Don't check undef_int error message match for powerpc where the
570         source file and line number aren't available.
571
572 2013-05-10  Roland McGrath  <mcgrathr@google.com>
573
574         * options.h (General_options): Add --rosegment-gap option.
575         * options.cc (finalize): --rosegment-gap implies --rosegment.
576         * layout.cc (set_segment_offsets): Let user option override
577         target->rosegment_gap().
578
579 2013-05-10  Roland McGrath  <mcgrathr@google.com>
580
581         * options.h (General_options): Remove leading space from help
582         messages for -nostdlib and --rosegment.
583
584 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
585
586         PR ld/15365
587         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
588
589 2013-05-03  Alan Modra  <amodra@gmail.com>
590
591         * merge.cc (Output_merge_string::do_add_input_section): Correct
592         scan for number of strings.  Rename vars to avoid shadowing.
593         Include missing terminator in input_size_.
594
595 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
596
597         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
598         Restore empty string handling.
599
600 2013-05-01  Cary Coutant  <ccoutant@google.com>
601
602         * stringpool.cc (Stringpool_template::new_key_offset): Fix
603         uninitialized warning.
604
605 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
606
607         * output.cc (Output_section::add_merge_input_section): Allow
608         to merge sections if the alignment is more than character size.
609         * merge.h (Output_merge_string::Output_merge_string): Remove
610         assert.
611         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
612         only not-null strings. Check the alignment of strings.
613         * stringpool.h
614         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
615         alignment as the argument.
616         (Stringpool_template<Stringpool_char>::addralign_): New class member.
617         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
618         Align non-zero length strings according to the addralign_.
619         (Stringpool_template<Stringpool_char>::set_string_offsets):
620         Updating offsets according to the given alignment.
621         * testsuite/Makefile.am (text_section_grouping): Test if string
622         literals are getting merged.
623         * testsuite/Makefile.in: Regenerate.
624         * testsuite/merge_string_literals_1.c: New file.
625         * testsuite/merge_string_literals_2.c: Ditto.
626         * testsuite/merge_string_literals.sh: Ditto.
627
628 2013-04-26  Ian Lance Taylor  <iant@google.com>
629
630         * target-reloc.h (relocate_section): If the reloc offset is out of
631         range, pass VIEW as NULL to relocate.relocate.
632         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
633         * i386.cc (Target_i386::Relocate::relocate): Likewise.
634         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
635         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
636         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
637         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
638
639 2013-04-26  Geoff Pike  <gpike@chromium.org>
640
641         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
642         * layout.cc (Hash_task): New class.
643         (Layout::queue_build_id_tasks): New function.
644         (Layout::write_build_id): Handle single-thread portion of build ID
645         computation.  (In some cases, all of it is single-threaded.)  Replace
646         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
647         functionality in fewer lines of code.
648         * layout.h (Layout::queue_build_id_tasks): New function declaration.
649         * options.h (General_options): make "--build-id" default to tree
650         rather than sha1.  Add two new options related to --build-id=tree:
651         --build-id-chunk-size-for-treehash and
652         --build-id-min-file-size-for-treehash.
653         * Makefile.am: add testing of --build-id=tree and related new options
654         (these tests will be invoked by "make check").
655         * Makefile.in: Regenerate.
656
657 2013-04-25  Alan Modra  <amodra@gmail.com>
658
659         * configure.tgt: Add powerpcle and powerpc64le.
660
661 2013-04-22  Alan Modra  <amodra@gmail.com>
662
663         PR gold/15355
664         * layout.cc (Layout::segment_precedes): Allow more than one
665         segment with the same type and flags.
666
667 2013-04-15  Cary Coutant  <ccoutant@google.com>
668
669         * layout.cc (Layout::set_relocatable_section_offsets): Don't
670         allocate space in file for BSS sections.
671
672 2013-04-15  Cary Coutant  <ccoutant@google.com>
673
674         * script-sections.cc (Orphan_output_section): Reset address
675         to zero after each orphaned section for relocatable links.
676
677 2013-04-15  Cary Coutant  <ccoutant@google.com>
678
679         * symtab.cc (Symbol_table::sized_write_globals): Subtract
680         section starting address for relocatable link.
681         * testsuite/Makefile.am (script_test_11): New test.
682         * testsuite/Makefile.in: Regenerate.
683         * testsuite/script_test_11.c: New source file.
684         * testsuite/script_test_11.t: New linker script.
685
686 2013-04-13  Alan Modra  <amodra@gmail.com>
687
688         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
689         owner when sections are not adjacent and exceed group size.
690         (Target_powerpc::group_sections): Handle corner case.
691         (Target_powerpc::Branch_info::make_stub): Handle case where
692         stub table doesn't exist due to branches in non-exec sections.
693         (Target_powerpc::Relocate::relocate): Likewise.
694
695 2013-04-11  Alan Modra  <amodra@gmail.com>
696
697         PR gold/15354
698         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
699         .branch_lt to match bfd ld.  Adjust comments throughout file.
700
701 2013-04-04  Ian Lance Taylor  <iant@google.com>
702
703         GCC PR c++/56840
704         * object.cc (do_layout_deferred_sections): Handle .eh_frame
705         sections before checking whether they are included in the link.
706
707 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
708
709         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
710         object before calling the plugin claim_file handler.  Pass the elf
711         object of the archive to the plugin. Delete the elf object if the
712         plugin claims the file.
713
714 2013-03-21  Alan Modra  <amodra@gmail.com>
715
716         * layout.cc (Layout::set_segment_offsets): Accept writable .text
717         segment when omagic.
718
719 2013-03-21  Alan Modra  <amodra@gmail.com>
720
721         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
722         comparison warning.
723         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
724         uninitialized" warning.
725
726 2013-03-20  Alan Modra  <amodra@gmail.com>
727
728         * symtab.h (Symbol::clear_version): New function.
729         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
730         is_needed by weak references.  Clear version for symbols defined
731         in as-needed objects that are not needed.
732
733 2013-03-15  Alan Modra  <amodra@gmail.com>
734
735         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
736         static and public.  Add report_err param.  Return false for data refs.
737         (Target_powerpc::rela_dyn_section): New overloaded function.
738         (Target_powerpc::plt_, iplt_): Elucidate.
739         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
740         (Output_data_plt_powerpc::do_write): Don't write .iplt.
741         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
742         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
743         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
744         push_branch and make_plt_entry for ifunc syms when
745         reloc_needs_plt_for_ifunc.
746         (Target_powerpc::Relocate::relocate): Don't use plt entry value
747         for ifunc unless reloc_needs_plt_for_ifunc.
748
749 2013-03-15  Alan Modra  <amodra@gmail.com>
750
751         * gc.h (gc_process_relocs): Don't look through function descriptors.
752         * icf.cc (get_section_contents): Do so here instead.
753
754 2013-03-13  Alan Modra  <amodra@gmail.com>
755
756         * powerpc.cc (is_branch_reloc): Forward declare.
757         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
758         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
759         false for 64-bit, true for 32-bit non-branch relocs.
760         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
761         * testsuite/Makefile.am (icf_test): Use linker map file instead of
762         nm output.
763         (icf_safe_test): Generate linker map file as well as nm output.
764         (icf_safe_so_test): Likewise.
765         * testsuite/Makefile.in: Regenerate.
766         * testsuite/icf_test.sh: Parse linker map file to determine
767         section folding.
768         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
769         * testsuite/icf_safe_so_test.sh: Likewise.
770         (X86_32_or_ARM_specific_safe_fold): Merge into..
771         (arch_specific_safe_fold): ..this.
772         (X86_64_specific_safe_fold): Delete unused function.
773
774 2013-03-12  Alan Modra  <amodra@gmail.com>
775
776         * gc.h (gc_process_relocs): Look through function descriptors
777         to determine shndx, symvalue and addend used by ICF.  Tidy
778         variable duplication.
779
780 2013-03-11  Alan Modra  <amodra@gmail.com>
781
782         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
783         * layout.cc (Layout_task_runner::run): ..to here.
784         * symtab.h (struct Symbol_location): Extract from..
785         (class Symbol_table): ..here.
786         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
787         * target.h (class Target): Add function_location and
788         do_function_location functions.
789         (class Sized_target): Add do_function_location.
790         * object.h (class Sized_relobj_file): Move find_shdr..
791         (class Object): ..to here.
792         * object.cc: Likewise.  Update to suit.  Instantiate.
793         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
794         * powerpc.cc (class Powerpc_dynobj): New.
795         (Target_powerpc::do_function_location): New function.
796         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
797         (Powerpc_dynobj::do_read_symbols): New function.
798         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
799
800 2013-03-08  Ian Lance Taylor  <iant@google.com>
801
802         * options.cc (General_options::string_to_object_format): Accept
803         "default".
804
805 2013-03-08  Alan Modra  <amodra@gmail.com>
806
807         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
808         pointer to Post_fde.
809         (struct Post_fde): Move definition to here..
810         * ehframe.cc (struct Post_fde): ..from here.
811         (Cie::write): Don't alloc Post_fde.
812         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
813
814 2013-03-07  Alan Modra  <amodra@gmail.com>
815
816         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
817         relocation referencing .LC0.
818         * testsuite/discard_locals_test.sh: Remove FIXMEs.
819
820 2013-03-07  Alan Modra  <amodra@gmail.com>
821
822         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
823         always_inline.  Add assembly for powerpc to avoid GOT.
824
825 2013-03-07  Alan Modra  <amodra@gmail.com>
826
827         * testsuite/script_test_10.sh: Don't test .bss section
828         header number.
829
830 2013-03-06  Alan Modra  <amodra@gmail.com>
831
832         * powerpc.cc (class Powerpc_relobj): Move some member functions.
833         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
834         all callers.  Handle folded sections.
835         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
836         to Powerpc_relobj.
837         (Global_symbol_visitor_opd::operator()): Likewise.
838
839 2013-03-04  Alan Modra  <amodra@gmail.com>
840
841         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
842         * testsuite/Makefile.in: Regenerate.
843
844 2013-03-01  Cary Coutant  <ccoutant@google.com>
845
846         Add dwp support for v2 DWARF package file format.
847         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
848         tu_length parameter.  Adjust all callers.
849         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
850         * dwp.cc: Include dwarf.h.
851         (Section_bounds): New struct type.
852         (Unit_set): New struct type.
853         (Dwo_file::Dwo_file): Initialize new data member.
854         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
855         Combine and rename to...
856         (Dwo_file::read_unit_index): ...this.
857         (Dwo_file::sized_read_compunit_index)
858         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
859         (Dwo_file::sized_read_unit_index): ...this.
860         (Dwo_file::copy_section): Remove section_name, is_str_offsets
861         parameters; add section_id parameter.
862         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
863         (Dwo_file::add_unit_set): ...this.
864         (Dwo_file::shndx_map_): Remove.
865         (Dwo_file::sect_offsets_): New data member.
866         (Dwp_output_file::Dwp_output_file): Initialize new data members.
867         (Dwp_output_file::add_section): Rename to...
868         (Dwp_output_file::add_contribution): ...this.
869         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
870         (Dwp_output_file::add_tu_set): Likewise.
871         (Dwp_output_file::Contribution): New type.
872         (Dwp_output_file::Section::contributions): New data member.
873         (Dwp_output_file::Cu_or_tu_set): Remove.
874         (Dwp_output_file::Section::Section): New ctor.
875         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
876         (Dwp_output_file::Dwp_index::Section_table): New type.
877         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
878         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
879         parameter.
880         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
881         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
882         (Dwp_output_file::Dwp_index::section_table): New member function.
883         (Dwp_output_file::Dwp_index::section_table_end): New member function.
884         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
885         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
886         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
887         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
888         (Dwp_output_file::Dwp_index::section_table_): New data member.
889         (Dwp_output_file::Dwp_index::section_mask_): New data member.
890         (Dwp_output_file::add_output_section): New member function.
891         (Dwp_output_file::write_new_section): New member function.
892         (Dwp_output_file::write_contributions): New member function.
893         (Dwp_output_file::section_id_map_): New data member.
894         (class Dwo_id_info_reader): Remove.
895         (class Unit_reader): New class.
896         (get_dwarf_section_name): New function.
897         (Dwo_file::read_executable): Adjust initializations of class data.
898         (Dwo_file::read): Add support for v2 package file format.
899         (Dwo_file::read_unit_index): Likewise.
900         (Dwo_file::sized_read_unit_index): Likewise.
901         (Dwo_file::copy_section): Likewise.
902         (Dwo_file::add_unit_set): Likewise.
903         (Dwp_output_file::add_output_section): Likewise.
904         (Dwp_output_file::add_contribution): Likewise.
905         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
906         for empty slot.
907         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
908         file format.
909         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
910         slot.
911         (Dwp_output_file::initialize): Remove unused function.
912         (Dwp_output_file::finalize): Add support for v2 package file format.
913         (Dwp_output_file::write_index): Likewise.
914         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
915         function prototype.
916
917 2013-03-01  Cary Coutant  <ccoutant@google.com>
918
919         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
920         function into class definition in header file.
921         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
922         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
923         New function.
924         (Dwarf_info_reader::check_buffer): Move here from .cc file.
925
926 2013-02-28  Alan Modra  <amodra@gmail.com>
927
928         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
929         * target.cc (Target::do_plt_fde_location): New function.
930         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
931         accessor function, and constructor param.
932         (struct Post_fde, Post_fdes): Declare.
933         (Cie::write): Add post_fdes param.
934         * ehframe.cc (Fde::write): Use plt_fde_location.
935         (struct Post_fde): Define.
936         (Cie::write): Stash FDEs added post merge mapping.
937         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
938         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
939         (Eh_frame::do_sized_write): Arrange to write post map FDES after
940         other FDEs.
941         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
942         (Target_powerpc::has_glink): New function.
943         (Target_powerpc::do_relax): Add eh_frame info for stubs.
944         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
945         glink_eh_frame_fde_32, default_fde): New data.
946         (Stub_table::eh_frame_added_): New var.
947         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
948         Make const.
949         (Stub_table::add_eh_frame): New function.
950         (Output_data_glink::add_eh_frame): New function.
951         (Target_powerpc::make_glink_section): Call add_eh_frame.
952
953 2013-02-15  Ian Lance Taylor  <iant@google.com>
954
955         * options.h (DEFINE_uint64_alias): Define.
956         (class General_options): Add -Ttext-segment as an alias for
957         -Ttext.
958
959 2013-02-15  Alan Modra  <amodra@gmail.com>
960
961         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
962         (Stub_table::do_write): ..here, two places.
963         (Stub_table::plt_call_size): Use it here too.
964
965 2013-02-11  Ian Lance Taylor  <iant@google.com>
966
967         * descriptors.cc (Descriptors::close_all): New function.
968         * descriptors.h (class Descriptors): Declare close_all.
969         (close_all_descriptors): New inline function.
970         * plugin.cc: Include "descriptors.h".
971         (Plugin_manager::cleanup): Call close_all_descriptors.
972
973 2013-02-06  Alan Modra  <amodra@gmail.com>
974
975         * README: Update coding style link.
976
977 2013-01-28  Cary Coutant  <ccoutant@google.com>
978
979         * dwp.cc (File_list): New typedef.
980         (Dwo_name_info_reader): New class.
981         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
982         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
983         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
984         (Dwo_file::read_executable): New function.
985         (Dwo_file::read): Move common setup code to ...
986         (Dwo_file::make_object): ... here.
987         (dwp_options): Add --exec/-e.
988         (usage): Likewise.
989         (main): Likewise.
990
991 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
992
993         * layout.cc (Layout::layout): Check for option text_reorder.
994         (Layout::make_output_section): Ditto.
995         * options.h (text_reorder): New option.
996         * output.cc (Input_section_sort_compare): Remove special ordering
997         of section names.
998         (Output_section::
999          Input_section_sort_section_name_special_ordering_compare::
1000          operator()): New function.
1001         (Output_section::sort_attached_input_sections): Use new sort function
1002         for .text.
1003         * output.h (Input_section_sort_section_name_special_ordering_compare):
1004         New struct.
1005         * testsuite/Makefile.am (text_section_grouping): Test option
1006         --no-text-reorder
1007         * testsuite/Makefile.in: Regenerate.
1008         * testsuite/text_section_grouping.sh: Check order of functions without
1009         default text reordering.
1010
1011 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1012
1013         * options.h (General_options): Change default to true for new_dtags.
1014
1015 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1016
1017         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1018         when enable_new_dtags is false.  Only add DT_RUNPATH when
1019         enable_new_dtags is true.
1020
1021 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1022
1023         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1024         used in declaration and definition consistent.
1025         (Target_powerpc::symval_for_branch): Ditto.
1026
1027 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1028
1029         * testsuite/plugin_final_layout.cc: Fix comment.
1030
1031 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1032
1033         * layout.cc (Layout::layout): Do not do default sorting for
1034         text sections when section ordering is specified.
1035         (make_output_section): Ditto.
1036         * testsuite/plugin_final_layout.cc: Name the function sections
1037         to catch reordering issues.
1038
1039 2013-01-15  Alan Modra  <amodra@gmail.com>
1040
1041         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1042         plt-thread-safe.
1043
1044 2013-01-15  Alan Modra  <amodra@gmail.com>
1045
1046         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1047         * testsuite/Makefile.in: Regenerate.
1048
1049 2013-01-14  Alan Modra  <amodra@gmail.com>
1050
1051         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1052         * testsuite/Makefile.in: Regenerate.
1053
1054 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1055
1056         PR bfd/14430
1057         Fix mingw gold build with plugins enabled
1058         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1059         * configure.ac: Export DLOPEN_LIBS and add headers check.
1060         * plugin.cc: Handle non-dlfcn case.
1061         * Makefile.in: Regenerate.
1062         * config.in: Regenerate.
1063         * configure: Regenerate.
1064         * testsuite/Makefile.in: Regenerate.
1065
1066 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1067
1068         * output.h (sort_attached_input_sections): Change to be public.
1069         * script-sections.cc
1070         (Output_section_definition::set_section_addresses): Sort
1071         attached input sections according to section order before linker
1072         script assigns section addresses.
1073         (Orphan_output_section::set_section_addresses): Sort
1074         attached input sections according to section order before linker
1075         script assigns section addresses.
1076         * Makefile.am (final_layout.sh): Use a simple linker script to
1077         check if section ordering still works.
1078         * Makefile.in: Regenerate.
1079
1080 2013-01-09  Ben Cheng  <bccheng@google.com>
1081
1082         * arm.cc (Target_arm::attributes_accept_div): New function.
1083         (Target_arm::attributes_forbid_div): New function.
1084         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1085         attribute using the same new functions as what bfd/elf32_arm.c
1086         does.
1087
1088 2013-01-07  Cary Coutant  <ccoutant@google.com>
1089
1090         PR gold/14993
1091         * output.cc (Output_section::add_input_section): For incremental
1092         updates, don't track input sections that are allocated from patch
1093         space.
1094
1095 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1096             Ian Lance Taylor  <iant@google.com>
1097
1098         PR gold/14897
1099         * configure.ac (--enable-ld): Removed.
1100         (install_as_default): Set to yes only for --enable-gold=default
1101         or --disable-ld.
1102         * configure: Regenerated.
1103
1104 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1105
1106         * options.h (General_options): Add -fuse-ld= for GCC linker
1107         option compatibility.
1108
1109 2013-01-04  Cary Coutant  <ccoutant@google.com>
1110
1111         * configure.ac: Fix typo restoring CXXFLAGS.
1112         * configure: Regenerate.
1113
1114 2013-01-04  Cary Coutant  <ccoutant@google.com>
1115
1116         * testsuite/Makefile.am (CXXLINK_S): New macro.
1117         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1118         * testsuite/Makefile.in: Regenerate.
1119
1120 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1121
1122         * version.cc (print_version): Update copyright year to 2013.
1123
1124 2012-12-20  Ian Lance Taylor  <iant@google.com>
1125
1126         * layout.cc (Layout::special_ordering_of_input_section): New
1127         function.
1128         (Layout::layout): If input section requires special ordering, must
1129         sort input sections.
1130         (Layout::make_output_section): May sort .text input sections.
1131         (Layout::is_section_name_prefix_grouped): Remove.
1132         * layout.h (class Layout): Declare
1133         special_ordering_of_input_section.  Don't declare
1134         is_section_name_prefix_grouped.
1135         * output.cc (Output_section::add_input_section): Revert last
1136         change.
1137         (Output_section::Input_section_sort::match_file_name): Don't crash
1138         if called on output section data.
1139         (Output_section::Input_section_sort_compare): Sort based on
1140         special ordering.
1141         (Output_section::Input_section_sort_section_order_index_compare):
1142         Revert last patch.
1143         (Output_section::sort_attached_input_sections): Likewise.
1144
1145 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1146
1147         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1148         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1149         * output.cc (Output_section::add_input_section): Check if section
1150         name contains special prefix.  Keep input sections to sort such
1151         sections.
1152         (Output_section::Input_section_sort_section_order_index_compare
1153          ::operator()): Group sections according to prefixes.
1154         (Output_section::sort_attached_input_sections): Add condition to
1155         Input_section_entry constructor call.
1156         * testsuite/Makefile.am (text_section_grouping): New test.
1157         * testsuite/Makefile.in: Regenerate.
1158         * testsuite/text_section_grouping.cc: New file.
1159         * testsuite/text_section_grouping.sh: New file.
1160
1161 2012-12-17  Nick Clifton  <nickc@redhat.com>
1162
1163         * Makefile.am: Add copyright notice.
1164         * NEWS: Likewise.
1165         * README: Likewise.
1166         * configure.ac: Likewise.
1167         * ftruncate.c: Likewise.
1168         * Makefile.in: Regenerate.
1169
1170 2012-12-14  Cary Coutant  <ccoutant@google.com>
1171
1172         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1173         --no-as-needed flag.
1174         (exception_separate_shared_12_test): Likewise.
1175         (incremental_copy_test): Likewise.
1176         * testsuite/Makefile.in: Regenerate.
1177
1178 2012-12-14  Cary Coutant  <ccoutant@google.com>
1179
1180         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1181         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1182
1183 2012-12-12  Alan Modra  <amodra@gmail.com>
1184
1185         * powerpc.cc (class Track_tls): New.
1186         (class Relocate, class Scan): Inherit Track_tls.
1187         (Target_powerpc::Scan::local, global): Track tls optimization
1188         and avoid creating plt entry for __tls_get_addr if all uses
1189         are optimized away.
1190         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1191
1192 2012-12-12  Alan Modra  <amodra@gmail.com>
1193
1194         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1195         Replace no_toc_optimize with toc_optimize.
1196         * output.h (Output_section::input_sections): Provide non-const variant.
1197         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1198         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1199         accessors.
1200         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1201         (class Sort_toc_sections): New.
1202         (Target_powerpc::do_finalize_sections): Sort toc sections.
1203         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1204
1205 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1206
1207         * testsuite/binary_unittest.cc (read_all): New function.
1208         (Sized_binary_test): Use it instead of ::read.
1209         * fileread.cc (do_read): Don't assume pread always reads the whole
1210         amount in a single call.
1211
1212 2012-12-10  Alan Modra  <amodra@gmail.com>
1213
1214         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1215         Set EM_PPC64 or EM_PPC here.
1216         (Target_selector_powerpc::do_recognize): Delete.
1217
1218 2012-12-10  Alan Modra  <amodra@gmail.com>
1219
1220         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1221         stub_table_.
1222         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1223
1224 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1225
1226         * testsuite/binary_unittest.cc (Sized_binary_test):
1227         Use open_descriptor rather than ::open.
1228
1229 2012-12-07  Alan Modra  <amodra@gmail.com>
1230
1231         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1232         typedef and invalid_address constant.
1233         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1234         instantiate constants.
1235
1236 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1237
1238         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1239         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1240         * aclocal.m4: Regenerate.
1241         * configure: Regenerate.
1242         * Makefile.in: Regenerate.
1243         * testsuite/Makefile.in: Regenerate.
1244
1245 2012-12-07  Alan Modra  <amodra@gmail.com>
1246
1247         * options.h (General_options): Add no_toc_optimize.
1248         * powerpc.cc (ok_lo_toc_insn): New function.
1249         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1250
1251 2012-12-06  Alan Modra  <amodra@gmail.com>
1252
1253         * options.h (General_options): Add plt_align, plt_static_chain,
1254         plt_thread_safe.  Update stub_group_size help text.
1255         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1256         for new plt_thread_safe_ var.
1257         (use_plt_offset): Correct comments.
1258         (Target_powerpc::do_relax): Look for thread creation symbols to
1259         determine default plt_thread_safe value.  Clear plt call stubs
1260         as well as branch stubs each iteration.
1261         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1262         insn constants.
1263         (l, hi, ha, write_insn): Move earlier.
1264         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1265         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1266         plt stubs too.
1267         (Stub_table::update_size): Adjust.
1268         (Stub_table::prev_size, set_prev_size): Delete.
1269         (Stub_table::stub_align): Let --plt-align affect result.
1270         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1271         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1272         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1273         (Stub_table::do_write): Support more stub variants.
1274
1275 2012-12-04  Alan Modra  <amodra@gmail.com>
1276
1277         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1278         (Target_powerpc::do_define_standard_symbols): New function.
1279
1280 2012-12-03  Alan Modra  <amodra@gmail.com>
1281
1282         * output.h: Formatting, whitespace.
1283
1284 2012-12-03  Alan Modra  <amodra@gmail.com>
1285
1286         * layout.h (Layout::get_executable_sections): Declare.
1287         * layout.cc (Layout::get_executable_sections): New function.
1288         * arm.cc (Target_arm::group_sections): Use it.
1289         (Arm_output_section::group_sections): Delete now redundant test.
1290         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1291         param to handle relative relocs.
1292         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1293         (Output_data_reloc::add_absolute): Adjust.
1294         (Output_data_reloc::add_relative): New function.
1295         (Output_data::reset_data_size): New function.
1296         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1297         (Output_section::set_addralign): New function.
1298         (Output_section::checkpoint_set_addralign): New function.
1299         (Output_section::clear_section_offsets_need_adjustment): New function.
1300         (Output_section::input_sections): Make public.
1301         * powerpc.cc (class Output_data_brlt_powerpc): New.
1302         (class Stub_table, class Stub_control): New.
1303         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1304         stub_table_, set_stub_table, stub_table): New vectors and accessor
1305         functions.
1306         (Target_powerpc::do_may_relax, do_relax, push_branch,
1307         new_stub_table, stub_tables, brlt_section, group_sections,
1308         add_branch_lookup_table, find_branch_lookup_table,
1309         write_branch_lookup_table, make_brlt_section): New functions.
1310         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1311         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1312         branch_info_): New vars.
1313         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1314         make call stubs here.
1315         (Output_data_glink): Remove all call stub handling from this class.
1316         (Target_powerpc::Scan::local, global): Save interesting branch
1317         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1318         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1319         functions on final link.
1320         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1321         Handle long branch destinations too.
1322         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1323         do_plt_address_for_local): Adjust lookup of plt call stubs.
1324
1325 2012-11-30  Alan Modra  <amodra@gmail.com>
1326
1327         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1328         relocs against protected symbols when building 32-bit shared libs.
1329
1330 2012-11-30  Alan Modra  <amodra@gmail.com>
1331
1332         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1333         param.  Call got_section() to make .got.  Update all callers
1334         and their callers and so on.
1335
1336 2012-11-30  Alan Modra  <amodra@gmail.com>
1337
1338         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1339         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1340         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1341         value if it already exists.
1342
1343 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1344
1345         PR gold/14858
1346         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1347
1348 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1349
1350         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1351         than bfc instruction for data sandboxing.
1352
1353 2012-11-08  Alan Modra  <amodra@gmail.com>
1354
1355         * po/POTFILES.in: Regenerate.
1356
1357 2012-11-05  Alan Modra  <amodra@gmail.com>
1358
1359         * configure.ac: Apply 2012-09-10 change to config.in here.
1360         * configure: Regenerate.
1361
1362 2012-11-05  Alan Modra  <amodra@gmail.com>
1363
1364         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1365         (struct Opd_ent): Use "Address" rather than "Offset".
1366         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1367         (Target_powerpc::got_section): Make public.
1368         (Target_powerpc::scan_relocs): Move code setting symbols..
1369         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1370         Create _SDA_BASE_ only when referenced.
1371
1372 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1373
1374         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1375         from last change.
1376
1377 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1378
1379         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1380         for offset_in_output_section parameter.
1381         (Sized_target::relocate_special_relocatable): Likewise.
1382         * arm.cc (Target_arm::relocate_relocs): Likewise.
1383         (Target_arm::relocate_special_relocatable): Likewise.
1384         * i386.cc (Target_i386::relocate_relocs): Likewise.
1385         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1386         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1387         * target-reloc.h (relocate_relocs): Likewise.
1388         * testsuite/testfile.cc (Target_test): Likewise.
1389         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1390         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1391
1392         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1393         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1394
1395         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1396         parameter, which is unused in the [!F_SETFD] case.
1397
1398         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1399         SYMNDX to off_t before comparing it to this->data_size().
1400         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1401         * incremental.cc (Output_section_incremental_inputs::do_write):
1402         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1403
1404         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1405
1406 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1407
1408         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1409         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1410         in EABI_VER5.
1411
1412 2012-10-29  Cary Coutant  <ccoutant@google.com>
1413
1414         * dwp.cc (usage): Add file and exit status parameters;
1415         add --help and --version options.
1416         (print_version): New function.
1417         (main): Add --help and --version options.
1418
1419 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1420
1421         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1422         final_layout_sequence.txt.
1423         * testsuite/Makefile.in: Regenerated.
1424
1425 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1426
1427         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1428         COMPILE generated by automake.
1429         (LINK1): Likewise.
1430         (CXXCOMPILE1): Likewise.
1431         (CXXLINK1): Likewise.
1432         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1433         (LINK): Likewise.
1434         (CXXCOMPILE): Likewise.
1435         (CXXLINK): Likewise.
1436         * testsuite/Makefile.in: Regenerated.
1437
1438 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1439
1440         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1441         on bad fwrite return.
1442
1443 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1444
1445         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1446         on val.
1447
1448 2012-10-23  Cary Coutant  <ccoutant@google.com>
1449
1450         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1451         * testsuite/Makefile.in: Regenerate.
1452         * testsuite/dwp_test.h: New source file.
1453         * testsuite/dwp_test_1.cc: New source file.
1454         * testsuite/dwp_test_1.s: New source file.
1455         * testsuite/dwp_test_1.sh: New source file.
1456         * testsuite/dwp_test_1b.cc: New source file.
1457         * testsuite/dwp_test_1b.s: New source file.
1458         * testsuite/dwp_test_2.cc: New source file.
1459         * testsuite/dwp_test_2.s: New source file.
1460         * testsuite/dwp_test_2.sh: New source file.
1461         * testsuite/dwp_test_main.cc: New source file.
1462         * testsuite/dwp_test_main.s: New source file.
1463
1464 2012-10-23  Cary Coutant  <ccoutant@google.com>
1465
1466         * dwp.h: New header file.
1467         * dwp.cc: New source file.
1468         * gold.h: Move shared declarations to system.h.
1469         * system.h: New header file.
1470         * Makefile.am: Add dwp.
1471         * Makefile.in: Regenerate.
1472
1473 2012-10-23  Cary Coutant  <ccoutant@google.com>
1474
1475         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1476         Dwarf_info_reader::read_from_pointer.
1477         (Dwarf_pubnames_table::read_header): Likewise.
1478         (Dwarf_pubnames_table::next_name): Likewise.
1479         (Dwarf_die::read_attributes): Likewise.
1480         (Dwarf_die::skip_attributes): Likewise.
1481         (Dwarf_info_reader::read_from_pointer): New function template.
1482         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1483         (Dwarf_pubnames_table): Likewise.
1484         (Dwarf_info_reader::read_from_pointer): New function template.
1485         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1486         Dwarf_pubnames_table ctor.
1487
1488 2012-10-23  Cary Coutant  <ccoutant@google.com>
1489
1490         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1491         abbrev_shndx.
1492         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1493         abbrev_shndx_.
1494         (Dwarf_info_reader::set_abbrev_shndx): New method.
1495         (Dwarf_info_reader::abbrev_shndx_): New data member.
1496
1497 2012-10-23  Cary Coutant  <ccoutant@google.com>
1498
1499         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1500         from object, not parameters.
1501         (Dwarf_info_reader::parse): Likewise.
1502         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1503         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1504         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1505         methods.
1506
1507 2012-10-23  Cary Coutant  <ccoutant@google.com>
1508
1509         * fileread.cc (Input_file::Input_file): New constructor.
1510         * fileread.h (class Input_file): Add new constructor.
1511
1512 2012-10-18  Alan Modra  <amodra@gmail.com>
1513
1514         PR gold/14727
1515         * object.cc (Relobj::is_section_name_included): Also match
1516         .sdata personality section.
1517
1518 2012-10-18  Alan Modra  <amodra@gmail.com>
1519
1520         * target-reloc.h (class Default_comdat_behavior): New, package up..
1521         (get_comdat_behaviour): ..this.
1522         (relocate_section): Add Relocate_comdat_behavior template arg,
1523         adjust code to suit.
1524         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1525         (Target_arm::scan_reloc_section): Likewise.
1526         * i386.cc (Target_i386::relocate_section): Likewise.
1527         * sparc.cc (Target_sparc::relocate_section): Likewise.
1528         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1529         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1530         * powerpc.cc (class Relocate_comdat_behavior): New.
1531         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1532         gold::relocate_section with new template arg.
1533
1534 2012-10-18  Alan Modra  <amodra@gmail.com>
1535
1536         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1537         dynamic relocs for GOT_TPREL got entries, without symbol if
1538         resolving locally.
1539         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1540         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1541         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1542
1543 2012-10-17  Alan Modra  <amodra@gmail.com>
1544
1545         PR gold/14726
1546         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1547
1548 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1549
1550         * layout.cc (Layout::include_section): Keep sections marked
1551         SHF_EXCLUDE when doing relocatable links.
1552
1553 2012-10-16  Alan Modra  <amodra@gmail.com>
1554
1555         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1556         (Target_powerpc::do_finalize_sections): Call it.
1557         (Output_data_save_res): New class and supporting functions.
1558         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1559         normal symbols defined in object files.
1560
1561 2012-10-12  Alan Modra  <amodra@gmail.com>
1562
1563         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1564         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1565         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1566         section if scan_opd_relocs not yet called.
1567         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1568
1569 2012-10-12  Alan Modra  <amodra@gmail.com>
1570
1571         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1572         add_local_ifunc_entry): Revert last change.
1573         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1574
1575 2012-10-05  Alan Modra  <amodra@gmail.com>
1576
1577         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1578         do_plt_address_for_global): New functions.
1579         (Output_data_got_powerpc::do_write): Don't segfault when linking
1580         statically.
1581         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1582         add_local_ifunc_entry): Return true on adding entry..
1583         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1584         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1585         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1586         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1587         set up symbols here.
1588         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1589         syms here.  Do so even when no .iplt.  Don't segfault when linking
1590         statically.
1591         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1592         new variants without reloc param.
1593         (Glink_sym_ent::Glink_sym_ent): Likewise.
1594         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1595         reloc when refs will resolve to plt call stub.
1596         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1597         R_PPC_PLTREL24 to resolve locally.
1598         (Target_powerpc::Scan::global): Correct ifunc handling.
1599         (Target_powerpc::Relocate::relocate): Correct local sym glink
1600         lookup.  Don't destroy "value" when we have a plt call stub,
1601         and when checking plt call validity.
1602         (Target_powerpc::do_dynsym_value): Simplify.
1603
1604 2012-10-05  Alan Modra  <amodra@gmail.com>
1605
1606         * i386.cc (Output_data_plt_i386::address_for_global,
1607         address_for_local): Add plt offset to returned value.  Adjust uses.
1608         * sparc.cc (Output_data_plt_sparc::address_for_global,
1609         address_for_local): Likewise.
1610         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1611         address_for_local): Likewise.
1612         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1613         address_for_local): Likewise.
1614         * target.h (Target::plt_address_for_global, plt_address_for_local):
1615         Update comment.
1616         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1617         (Output_data_got::Got_entry::write): Nor here.
1618         * output.h: Comment fix.
1619
1620 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1621
1622         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1623         global_offset_table_ value for larget got.
1624         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1625
1626 2012-09-29  Alan Modra  <amodra@gmail.com>
1627
1628         * powerpc.cc (Target_powerpc::iplt_): New output section.
1629         (Target_powerpc::iplt_section, make_iplt_section,
1630         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1631         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1632         Target_powerpc::plt_entry_count): Count iplt entries too.
1633         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1634         reloc section in constructor.  New params.
1635         (Target_powerpc::make_plt_section): Create reloc section here instead.
1636         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1637         functions.
1638         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1639         (Output_data_glink::add_entry, find_entry): New functions to
1640         deal with local syms.
1641         (Glink_sym_ent): Add support for local syms.
1642         (Output_data_glink::do_write): Handle ifunc plt entries.
1643         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1644         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1645         (Target_powerpc::Relocate::relocate): Likewise.
1646         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1647
1648 2012-09-25  Alan Modra  <amodra@gmail.com>
1649
1650         * object.h (Sized_relobj_file::adjust_local_symbol,
1651         do_adjust_local_symbol): New functions.
1652         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1653         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1654         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1655         and irregular opd entry spacing.
1656         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1657         (Global_symbol_visitor_opd): New functor.
1658         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1659         on deleted opd entries.
1660
1661 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1662
1663         * tilegx.cc: New file.
1664         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1665         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1666         * configure.tgt: Add entries for tilegx*.
1667         * configure.ac: Likewise.
1668         * Makefile.in: Rebuild.
1669         * configure: Likewise.
1670         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1671         tilegx.
1672
1673 2012-09-13  Alan Modra  <amodra@gmail.com>
1674
1675         * target-reloc.h (scan_relocs): Call scan.local for relocs
1676         against symbols in discarded sections.  Pass is_discarded
1677         param.
1678         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1679         Add is_discarded param.
1680         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1681         is_discarded to flag opd entry as discarded.  Don't emit dyn
1682         relocs on such entries.
1683         (Target_powerpc::Scan::global): Similarly detect and handle
1684         such opd entries.
1685         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1686         opd_ent_.  Update all uses.
1687         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1688         (Target_powerpc::relocate_section): Zero out discarded opd
1689         entry relocs.
1690
1691 2012-09-12  Ian Lance Taylor  <iant@google.com>
1692
1693         PR gold/14570
1694         * output.cc: Rename Output_data_got template parameter from size
1695         to got_size for all functions.  Compile all variants of
1696         Output_data_got.
1697         (Output_data_got::Got_entry::write): Correct use of size for
1698         symbol value.  Use local_is_tls rather than casting to
1699         Sized_relobj_file.
1700         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1701         (class Sized_relobj_file): Add do_local_is_tls.
1702         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1703
1704 2012-09-11  Alan Modra  <amodra@gmail.com>
1705
1706         PR gold/14566
1707         * layout.cc (Layout::set_segment_offsets): When using
1708         common-page-size alignment, ensure we are on a new max-page-size
1709         page.
1710         * output.cc (Output_segment::set_section_addresses): Use
1711         abi_pagesize, not common_pagesize for relro boundary.
1712         (Output_segment::set_offset): Likewise.
1713
1714 2012-09-11  Alan Modra  <amodra@gmail.com>
1715
1716         * output.h (Output_data_got::add_global_tls, add_local_tls,
1717         add_local_tls_pair): New functions.
1718         (Output_data_got::add_local_pair_with_rel): Remove second
1719         reloc param.  Expand comment.
1720         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1721         use_plt_or_tls_offset_, similarly for constructor param.
1722         (Output_data_got::Got_entry::write): Add got_index param.
1723         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1724         add_local_tls_pair): New functions.
1725         (Output_data_got::Got_entry::write): Handle tls symbols
1726         with use_plt_or_tls_offset_ set specially.
1727         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1728         (Output_data_got::do_write): Replace iterator with index, pass
1729         index to entry write function.
1730         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1731         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1732         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1733         call.
1734         * i386.cc (Target_i386::Scan::local): Likewise.
1735         * sparc.cc (Target_sparc::Scan::local): Likewise.
1736         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1737         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1738         do_tls_offset_for_global): New functions.
1739         (Target_powerpc::Scan::local): Correct TLS relocations and got
1740         entry values.
1741         (Target_powerpc::Scan::global): Don't emit unnecessary
1742         dynamic relocations on TLS GOT entries.
1743
1744 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1745
1746         * config.in: Disable sanity check for kfreebsd.
1747
1748 2012-09-10  Sterling Augustine  <saugustine@google.com>
1749
1750         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1751         (Gdb_index::pubtypes_read): New parameter.
1752         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1753         to calls.
1754         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1755         pubtypes_object_.
1756
1757 2012-09-09  Alan Modra  <amodra@gmail.com>
1758
1759         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1760         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1761         * gc.h (gc_process_relocs): Call target gc_add_reference.
1762         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1763         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1764         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1765         unnecessary cast.
1766         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1767         to cater for when we don't need code offset.  Update use.
1768         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1769         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1770         set_opd_valid): New functions.
1771         (Target_powerpc::do_gc_add_reference): New function.
1772         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1773         stashed refs.
1774         (Target_powerpc::do_gc_mark_symbol): New function.
1775
1776 2012-09-06  Cary Coutant  <ccoutant@google.com>
1777
1778         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1779         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1780         (Dwarf_die::skip_attributes): Likewise.
1781         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1782         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1783         (main): Call it.
1784         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1785
1786 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1787
1788         * testsuite/script_test_3.t: Add .got.plt output section
1789         statement.
1790         * testsuite/script_test_4.t: Likewise.
1791
1792 2012-09-05  Alan Modra  <amodra@gmail.com>
1793
1794         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1795         update all uses and lose "enum" when using type.
1796
1797 2012-09-05  Alan Modra  <amodra@gmail.com>
1798
1799         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1800         * configure: Regenerate.
1801         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1802         (plugin_final_layout.stdout): Likewise.
1803         (memory_test): Set page sizes to 0x1000.
1804         * testsuite/Makefile.in: Regenerate.
1805         * testsuite/discard_locals_test.sh: Add FIXME comment.
1806         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1807         * testsuite/pr14265.t: Add .got output section statement.
1808         * testsuite/script_test_2.t: Likewise.
1809         * testsuite/script_test_3.t: Likewise.
1810         * testsuite/script_test_4.t: Likewise.
1811         * testsuite/script_test_5.t: Likewise.
1812         * testsuite/script_test_6.t: Likewise.
1813         * testsuite/script_test_7.t: Likewise.
1814         * testsuite/script_test_9.t: Likewise.
1815
1816 2012-09-05  Alan Modra  <amodra@gmail.com>
1817
1818         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1819         (Powerpc_relocate_functions::Status): New typedef.
1820         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1821         (Target_powerpc::Scan::local): Handle REL64.
1822         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1823         for REL32 and REL64.
1824         (Target_powerpc::symval_for_branch): New function, extracted from..
1825         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1826         checks.  Report overflow errors.
1827
1828 2012-09-05  Alan Modra  <amodra@gmail.com>
1829
1830         * object.h (Sized_relobj_file::emit_relocs): Delete.
1831         (Sized_relobj_file::emit_relocs_reltype): Delete.
1832         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1833         relocate_relocs for --emit-relocs.
1834         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1835         * output.h: Update comment.
1836         (Output_segment::first_section): New function.
1837         (Output_segment::first_section_load_address): Use first_section.
1838         * output.cc (Output_segment::first_section): New function extracted..
1839         (Output_segment::first_section_load_address): ..from here.  Delete.
1840         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1841         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1842         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1843         adjust call to target.h function.
1844         * i386.cc (Target_i386): Likewise.
1845         * sparc.cc (Target_sparc): Likewise.
1846         * x86_64.cc (Target_x86_64): Likewise.
1847         * powerpc.cc (Target_powerpc): Likewise.
1848         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1849         first tls section has section symbol for optimised local dynamic
1850         output relocs.
1851         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1852         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1853         optimised tls code.
1854         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1855         Rename to relocate_relocs.  Update error message.
1856
1857 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1858
1859         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1860         --just-symbols.
1861
1862 2012-08-31  Alan Modra  <amodra@gmail.com>
1863
1864         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1865         (Powerpc_relobj::toc_base_offset): New stub function.
1866         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1867         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1868         (Target_powerpc::Relocate::enum skip_tls): New.
1869         (Target_powerpc::call_tls_get_addr_): New var.
1870         (Target_powerpc::is_branch_reloc): Move to file scope.
1871         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1872         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1873         New functions.
1874         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1875         (powerpc_info): Correct common_pagesize for ppc64.
1876         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1877         (Powerpc_relocate_functions): Add overflow check enums and functions.
1878         Add non-shift version of rela, rela_ua.  Delete all rel public
1879         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1880         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1881         addr16_ha3, addr14 functions.
1882         (Output_data_got_powerpc::add_constant_pair): New function.
1883         (Output_data_got_powerpc::got_base_offset): Likewise.
1884         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1885         (instruction constants): Sort, add some more.
1886         (Output_data_glink::do_write): Add and use Address typedef.  Use
1887         object->toc_base_offset() stub for 64-bit.
1888         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1889         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1890         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1891         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1892         Always treat .opd relocs as against locally defined symbol.
1893         Correct condition for RELATIVE relocs.
1894         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1895         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1896         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1897         calculations.  Handle TLS relocs, and more.  Add overflow
1898         checking and adjust for Powerpc_relocate_functions changes.
1899         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1900         Reinstate --emit-relocs code with FIXME.
1901
1902 2012-08-30  Alan Modra  <amodra@gmail.com>
1903
1904         * layout.cc (Layout::set_segment_offsets): Set p_align to
1905         abi_pagesize, not common_pagesize.
1906         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1907         to determine whether file header can go in segment.
1908
1909 2012-08-30  Alan Modra  <amodra@gmail.com>
1910
1911         * output.h (Output_reloc::Output_reloc <output section>): Add
1912         is_relative param.  Adjust calls.
1913         (Output_reloc::add_output_section_relative): New functions.
1914         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1915         is_relative.
1916         (Output_reloc::symbol_value): Handle SECTION_CODE.
1917
1918 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1919
1920         * gold.cc (queue_middle_tasks): Call layout again when unique
1921         segments for sections is desired.
1922         * layout.cc (Layout::Layout): Initialize new members.
1923         (Layout::get_output_section_flags): New function.
1924         (Layout::choose_output_section): Call get_output_section_flags.
1925         (Layout::layout): Make output section for mapping to a unique segment.
1926         (Layout::insert_section_segment_map): New function.
1927         (Layout::attach_allocated_section_to_segment): Make unique segment for
1928         output sections marked so.
1929         (Layout::segment_precedes): Check for unique segments when sorting.
1930         * layout.h (Layout::Unique_segment_info): New struct.
1931         (Layout::Section_segment_map): New typedef.
1932         (Layout::insert_section_segment_map): New function.
1933         (Layout::get_output_section_flags): New function.
1934         (Layout::is_unique_segment_for_sections_specified): New function.
1935         (Layout::set_unique_segment_for_sections_specified): New function.
1936         (Layout::unique_segment_for_sections_specified_): New member.
1937         (Layout::section_segment_map_): New member.
1938         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1939         Rename is_gc_pass_one to is_pass_one.
1940         Rename is_gc_pass_two to is_pass_two.
1941         Rename is_gc_or_icf to is_two_pass.
1942         Check for which pass based on whether symbols data is present.
1943         Make it two pass when unique segments for sections is desired.
1944         * output.cc (Output_section::Output_section): Initialize new
1945         members.
1946         * output.h (Output_section::is_unique_segment): New function.
1947         (Output_section::set_is_unique_segment): New function.
1948         (Output_section::is_unique_segment_): New member.
1949         (Output_section::extra_segment_flags): New function.
1950         (Output_section::set_extra_segment_flags): New function.
1951         (Output_section::extra_segment_flags_): New member.
1952         (Output_section::segment_alignment): New function.
1953         (Output_section::set_segment_alignment): New function.
1954         (Output_section::segment_alignment_): New member.
1955         (Output_segment::Output_segment): Initialize is_unique_segment_.
1956         (Output_segment::is_unique_segment): New function.
1957         (Output_segment::set_is_unique_segment): New function.
1958         (Output_segment::is_unique_segment_): New member.
1959         * plugin.cc (allow_unique_segment_for_sections): New function.
1960         (unique_segment_for_sections): New function.
1961         (Plugin::load): Add new functions to transfer vector.
1962         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1963         * Makefile.in: Regenerate.
1964         * testsuite/plugin_final_layout.sh: Check if unique segment
1965         functionality works.
1966         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1967         are available.
1968         (allow_unique_segment_for_sections): New global.
1969         (unique_segment_for_sections): New global.
1970         (claim_file_hook): Call allow_unique_segment_for_sections.
1971         (all_symbols_read_hook): Call unique_segment_for_sections.
1972
1973 2012-08-22  Cary Coutant  <ccoutant@google.com>
1974
1975         * layout.cc (Layout::include_section): Don't assert on GROUP
1976         sections with --emit-relocs.
1977
1978 2012-08-21  Cary Coutant  <ccoutant@google.com>
1979
1980         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1981         if --export-dynamic-symbol names an undef symbol.
1982
1983 2012-08-18  Alan Modra  <amodra@gmail.com>
1984
1985         * powerpc.cc: Formatting and white space.
1986         (Powerpc_relobj): Rename got2_section_ to special_.
1987         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1988         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1989         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1990         (Target_powerpc): Add Address typedef and invalid_address.  Use
1991         throughout.
1992         (Target_powerpc::is_branch_reloc): New function.
1993         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1994         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1995         for dst_mask, value and addend.
1996         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1997         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1998         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1999         uint16_t for 24-bit offset.  Use get_output_section_offset and
2000         check return.
2001         (Target_powerpc::Scan::local): Handle more relocs.
2002         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2003         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2004         Plug in toc restoring insn after plt calls.  Translate branches
2005         to function descriptor symbols to corresponding entry point.
2006         (Target_powerpc::relocate_for_relocatable): Check return from
2007         get_output_section_offset.
2008         * symtab.h: Comment typo.
2009
2010 2012-08-14  Ian Lance Taylor  <iant@google.com>
2011
2012         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2013         unsupported_relocal_local to call unsupported_reloc_global.
2014
2015 2012-08-14  Nick Clifton  <nickc@redhat.com>
2016
2017         PR ld/14265
2018         * script-sections.cc (Sections_element::output_section_name): Add
2019         keep return parameter.
2020         (Output_section_element::match_name): Add keep return parameter.
2021         Return the value of the keep_ member.
2022         * script-sections.h (class Output_section): Update
2023         output_section_name prototype.
2024         * layout.cc (Layout::keep_input_section): New public member
2025         function.
2026         (Layout::choose_output_section): Pass keep parameter to
2027         output_section_name.
2028         * layout.h (class Layout): Add keep_input_section.
2029         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2030         sections.
2031         * testsuite/Makefile.am: Add a test.
2032         * testsuite/Makefile.in: Regenerate.
2033         * testsuite/pr14265.c: Source file for the test.
2034         * testsuite/pr14265.t: Linker script for the test.
2035         * testsuite/pr14265.sh: Shell script for the test.
2036
2037 2012-08-14  Alan Modra  <amodra@gmail.com>
2038
2039         * target.h (Target::output_section_name): New function.
2040         (Target::do_output_section_name): New function.
2041         * layout.cc (Layout::choose_output_section): Call the above.
2042         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2043
2044 2012-08-14  Alan Modra  <amodra@gmail.com>
2045
2046         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2047         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2048         for replace_constant call.
2049         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2050         (Output_data_glink::do_print_to_mapfile): New function.
2051         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2052         (Target_powerpc::Relocate::relocate): Likewise.
2053
2054 2012-08-14  Alan Modra  <amodra@gmail.com>
2055
2056         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2057         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2058         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2059         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2060         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2061         here.
2062         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2063         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2064         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2065         here.
2066         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2067         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2068
2069 2012-08-12  Alan Modra  <amodra@gmail.com>
2070
2071         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2072         (glink insn constants): Use uint32_t.
2073         (Output_data_glink::add_entry): Use insert, not [] operator.
2074
2075 2012-08-11  Alan Modra  <amodra@gmail.com>
2076
2077         * object.h (Sized_relobj_file::find_shdr): New function.
2078         (Sized_relobj_file::find_special_sections): New function.
2079         * object.cc (Sized_relobj_file::find_shdr): New function.
2080         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2081         (Sized_relobj_file::find_special_sections): New function, split out..
2082         (Sized_relobj_file::do_read_symbols): ..from here.
2083         * output.h (Output_data_got::replace_constant): New function.
2084         (Output_data_got::num_entries): New function.
2085         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2086         (Output_data_got::got_offset): Protected rather than private.
2087         (Output_data_got::replace_got_entry): New function.
2088         * output.cc (Output_data_got::replace_got_entry): New function.
2089         * powerpc.cc (class Powerpc_relobj): New.
2090         (class Powerpc_relocate_functions): Delete all psymval variants or
2091         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2092         Implement _ha functions using corresponding _hi function.
2093         (Powerpc_relobj::find_special_sections): New function.
2094         (Target_powerpc::do_make_elf_object): New function.
2095         (class Output_data_got_powerpc): New.
2096         (class Output_data_glink): New.
2097         (class Powerpc_scan_relocatable_reloc): New.
2098         Many more changes througout file.
2099
2100 2012-08-09  Nick Clifton  <nickc@redhat.com>
2101
2102         * po/vi.po: Updated Vietnamese translation.
2103
2104 2012-08-07  Ian Lance Taylor  <iant@google.com>
2105
2106         * layout.cc (Layout::add_target_dynamic_tags): If
2107         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2108         plt_rel.
2109
2110 2012-07-30  Nick Clifton  <nickc@redhat.com>
2111
2112         * po/gold.pot: Updated template.
2113         * po/es.po: Updated Spanish translation.
2114
2115 2012-07-18  Cary Coutant  <ccoutant@google.com>
2116
2117         PR gold/14344
2118         * configure.ac: Add check for -gpubnames support.
2119         * configure: Regenerate.
2120         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2121         support; force -gno-pubnames.
2122         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2123         support.
2124         (gdb_index_test_4): New test.
2125         * testsuite/Makefile.in: Regenerate.
2126         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2127         * testsuite/gdb_index_test_2.sh: Likewise.
2128         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2129         * testsuite/gdb_index_test_4.sh: New script.
2130         * testsuite/gdb_index_test_comm.sh: New script with common code;
2131         don't look for space after colon.
2132
2133 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2134
2135         * gold.cc (queue_middle_tasks): Update function order only after
2136         deferred objects due to plugins are processed.
2137
2138 2012-07-11  Ian Lance Taylor  <iant@google.com>
2139
2140         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2141         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2142         (Target_arm::scan_reloc_for_stub): Likewise.
2143         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2144         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2145         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2146         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2147         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2148
2149 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2150             Ian Lance Taylor  <iant@google.com>
2151
2152         PR gold/14309
2153         * configure.ac: Test whether std::tr1::hash<off_t> works.
2154         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2155         needed.
2156         * output.h (class Output_fill): Add virtual destructor.
2157         * configure, config.in: Rebuild.
2158
2159 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2160
2161         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2162
2163 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2164
2165         * plugin.cc (Plugin::load): Handle position independent executables.
2166
2167 2012-06-06  Cary Coutant  <ccoutant@google.com>
2168
2169         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2170         add .debug_macro.
2171         (lines_only_debug_sections): Likewise.
2172         (gdb_fast_lookup_sections): New static array.
2173         (is_gdb_debug_section): Rename formal parameter.
2174         (is_lines_only_debug_section): Likewise.
2175         (is_gdb_fast_lookup_section): New function.
2176         (Layout::include_section): Check for ".zdebug_" prefix; pass
2177         section name suffix to is_gdb_debug_section, et al.; check for
2178         fast-lookup sections when building .gdb_index.
2179         * options.h (--strip-debug-gdb): Update GDB version number.
2180
2181 2012-06-06  Cary Coutant  <ccoutant@google.com>
2182
2183         * configure.ac: Add check for fallocate.
2184         * configure: Regenerate.
2185         * config.in: Regenerate.
2186
2187         * options.h (class General_options): Add --mmap-output-file and
2188         --posix-fallocate options.
2189         * output.cc: (posix_fallocate): Remove; replace with...
2190         (gold_fallocate): New function.
2191         (Output_file::map_no_anonymous): Call gold_fallocate.
2192         (Output_file::map): Check --mmap-output-file option.
2193
2194 2012-06-05  Jing Yu  <jingyu@google.com>
2195
2196         * gold.h (textdomain): Add do {} to empty while(0).
2197         (bindtextdomain): Likewise.
2198
2199 2012-06-04  Cary Coutant  <ccoutant@google.com>
2200
2201         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2202         has_dynsym_index.
2203
2204 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2205
2206         * symtab.cc (Symbol_table::define_special_symbol):
2207         Initialize *poldsym to prevent uninitialized variable errors.
2208
2209 2012-05-23  Cary Coutant  <ccoutant@google.com>
2210
2211         * layout.cc (Layout::section_name_mapping): Add rules to handle
2212         exact match on .data.rel.ro.local or .data.rel.ro.
2213         (Layout::output_section_name): Check for exact matches.
2214
2215 2012-05-23  Cary Coutant  <ccoutant@google.com>
2216
2217         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2218         more carefully.
2219
2220 2012-05-22  Cary Coutant  <ccoutant@google.com>
2221
2222         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2223         object before exporting symbol.
2224
2225 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2226
2227         * testsuite/tls_test.cc: Include "config.h" first.
2228         * testsuite/tls_test_c.c: Likewise.
2229
2230 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2231             Nick Clifton  <nickc@redhat.com>
2232
2233         PR 14072
2234         * configure.in: Add check that sysdep.h has been included before
2235         any system header files.
2236         * configure: Regenerate.
2237         * config.in: Regenerate.
2238
2239 2012-05-14  Cary Coutant  <ccoutant@google.com>
2240
2241         * layout.cc (Layout::make_output_section): Mark .tdata section
2242         as RELRO.
2243         * testsuite/relro_test.cc: Add a TLS variable.
2244
2245 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2246
2247         PR gold/14091
2248         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2249         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2250         R_X86_64_64.
2251
2252 2012-05-08  Cary Coutant  <ccoutant@google.com>
2253
2254         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2255         (lines_only_debug_sections): Likewise.
2256
2257 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2258
2259         * nacl.cc: New file.
2260         * nacl.h: New file.
2261         * Makefile.am (CCFILES, HFILES): Add them.
2262         * Makefile.in: Regenerate.
2263         * i386.cc (Output_data_plt_i386_nacl): New class.
2264         (Output_data_plt_i386_nacl_exec): New class.
2265         (Output_data_plt_i386_nacl_dyn): New class.
2266         (Target_i386_nacl): New class.
2267         (Target_selector_i386_nacl): New class.
2268         (target_selector_i386): Use it instead of Target_selector_i386.
2269         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2270         (Target_x86_64_nacl): New class.
2271         (Target_selector_x86_64_nacl): New class.
2272         (target_selector_x86_64, target_selector_x32): Use it instead of
2273         Target_selector_x86_64.
2274         * arm.cc (Output_data_plt_arm_nacl): New class.
2275         (Target_arm_nacl): New class.
2276         (Target_selector_arm_nacl): New class.
2277         (target_selector_arm, target_selector_armbe): Use it instead of
2278         Target_selector_arm.
2279
2280         * target-select.cc (select_target): Take new Input_file* and off_t
2281         arguments, pass them on to recognize method of selector.
2282         * object.cc (make_elf_sized_object): Update caller.
2283         * parameters.cc (parameters_force_valid_target): Likewise.
2284         * incremental.cc (make_sized_incremental_binary): Likewise.
2285         * target-select.h: Update decl.
2286         (Target_selector::recognize): Take new Input_file* argument,
2287         pass it on to do_recognize.
2288         (Target_selector::do_recognize): Take new Input_file* argument.
2289         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2290         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2291         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2292         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2293
2294         * target.h (Target::Target_info): New members isolate_execinstr
2295         and rosegment_gap.
2296         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2297         * arm.cc (Target_arm::arm_info): Update initializer.
2298         * i386.cc (Target_i386::i386_info): Likewise.
2299         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2300         * sparc.cc (Target_sparc::sparc_info): Likewise.
2301         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2302         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2303         * layout.cc (Layout::attach_allocated_section_to_segment):
2304         Take new const Target* argument.  If target->isolate_execinstr(), act
2305         like --rosegment.
2306         (Layout::find_first_load_seg): Take new const Target* argument;
2307         if target->isolate_execinstr(), reject PF_X segments.
2308         (Layout::relaxation_loop_body): Update caller.
2309         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2310         reset file offset to zero when we hit LOAD_SEG, and then do a second
2311         loop over the segments before LOAD_SEG to reassign offsets after
2312         addresses have been determined.  Handle target->rosegment_gap().
2313         (Layout::attach_section_to_segment): Take new const Target* argument;
2314         pass it to attach_allocated_section_to_segment.
2315         (Layout::make_output_section): Update caller.
2316         (Layout::attach_sections_to_segments): Take new const Target* argument;
2317         pass it to attach_section_to_segment.
2318         * gold.cc (queue_middle_tasks): Update caller.
2319         * layout.h (Layout): Update method decls with new arguments.
2320
2321         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2322         Target_info pointer to use.
2323         (Target_arm::do_make_data_plt): New virtual method.
2324         (Target_arm::make_data_plt): New method that calls it.
2325         (Target_arm::make_plt_entry): Use it.
2326         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2327         for the section alignment.
2328         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2329         method.
2330         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2331         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2332         method.
2333         (Output_data_plt_arm::get_plt_entry_size): Call it.
2334         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2335         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2336         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2337         method.
2338         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2339         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2340         method instead of sizeof(plt_entry).
2341         (Output_data_plt_arm::add_entry): Likewise.
2342         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2343         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2344         than static method.
2345         (Target_arm::plt_entry_size): Likewise.
2346         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2347         Move to ...
2348         (Output_data_plt_arm_standard): ... here, new class.
2349         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2350         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2351         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2352
2353         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2354         Take additional argument for the PLT entry size.
2355         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2356         Use get_plt_entry_size method rather than plt_entry_size variable.
2357         (Output_data_plt_x86_64::reserve_slot): Likewise.
2358         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2359         (Output_data_plt_x86_64::add_entry): Likewise.
2360         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2361         (Output_data_plt_x86_64::address_for_global): Likewise.
2362         (Output_data_plt_x86_64::address_for_local): Likewise.
2363         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2364         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2365         Make method non-static.
2366         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2367         method.
2368         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2369         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2370         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2371         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2372         virtual method.
2373         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2374         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2375         virtual method.
2376         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2377         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2378         virtual method.
2379         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2380         (Output_data_plt_x86_64::plt_entry_size)
2381         (Output_data_plt_x86_64::first_plt_entry)
2382         (Output_data_plt_x86_64::plt_entry)
2383         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2384         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2385         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2386         (Output_data_plt_x86_64_standard): ... here, new class.
2387         (Target_x86_64::Target_x86_64): Take optional argument for the
2388         Target_info pointer to use.
2389         (Target_x86_64::do_make_data_plt): New virtual method.
2390         (Target_x86_64::make_data_plt): New method to call it.
2391         (Target_x86_64::init_got_plt_for_update): Use that.
2392         Call this->plt_->add_eh_frame method here.
2393         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2394         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2395         rather than static method.
2396         (Target_x86_64::plt_entry_size): Likewise.
2397         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2398         rather than plt_entry_size variable.  Move guts of PLT filling to...
2399         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2400         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2401         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2402
2403         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2404         additional argument for the section alignment.
2405         Don't do add_eh_frame_for_plt here.
2406         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2407         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2408         variable.
2409         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2410         method.
2411         (Output_data_plt_i386::get_plt_entry_size): Call it.
2412         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2413         (Output_data_plt_i386::add_eh_frame): New method to call it.
2414         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2415         method.
2416         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2417         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2418         method.
2419         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2420         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2421         method instead of plt_entry_size.
2422         (Output_data_plt_i386::plt_entry_size)
2423         (Output_data_plt_i386::plt_eh_frame_fde_size)
2424         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2425         (Output_data_plt_i386_standard): ... here, new class.
2426         (Output_data_plt_i386_exec): New class.
2427         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2428         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2429         (Output_data_plt_i386::exec_plt_entry): Move to ...
2430         (Output_data_plt_i386_exec::plt_entry): ... here.
2431         (Output_data_plt_i386_dyn): New class.
2432         (Output_data_plt_i386::first_plt_entry): Move to ...
2433         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2434         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2435         (Output_data_plt_i386_dyn::plt_entry): ... here.
2436         (Target_i386::Target_i386): Take optional argument for the Target_info
2437         pointer to use.
2438         (Target_i386::do_make_data_plt): New virtual method.
2439         (Target_i386::make_data_plt): New method to call it.
2440         (Target_i386::make_plt_section): Use that.
2441         Call this->plt_->add_eh_frame method here.
2442         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2443         rather than plt_entry_size variable.
2444         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2445         (Output_data_plt_i386::address_for_local): Likewise.
2446         (Output_data_plt_i386::do_write): Likewise.
2447         Move guts of PLT filling to...
2448         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2449         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2450         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2451         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2452
2453 2012-05-01  Cary Coutant  <ccoutant@google.com>
2454
2455         * dwarf_reader.cc (Dwarf_die::read_attributes)
2456         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2457         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2458         * reduced_debug_output.cc
2459         (Output_reduced_debug_info_section::get_die_end): Remove
2460         DW_FORM_GNU_ref_index.  Add default case.
2461
2462 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2463
2464         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2465         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2466         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2467         DW_AT_high_pc as offset from DW_AT_low_pc.
2468
2469         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2470         * testsuite/Makefile.in: Regenerate.
2471         * testsuite/gdb_index_test_3.c: New test source file.
2472         * testsuite/gdb_index_test_3.sh: New test source file.
2473
2474 2012-04-25  Ian Lance Taylor  <iant@google.com>
2475
2476         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2477         pointer.
2478         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2479         as a class, not a struct.
2480         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2481         (Target_arm::apply_cortex_a8_workaround): Likewise.
2482         * gc.h: Declare Reloc_types as a struct, not a class.
2483         * object.h: Declare Symbols_data as a struct.
2484         * reloc.h: Declare Read_relocs_data as a struct.
2485         * target.h: Declare Relocate_info as a struct.
2486
2487 2012-04-24  David S. Miller  <davem@davemloft.net>
2488
2489         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2490         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2491         and R_SPARC_WPLT30.
2492
2493 2012-04-24  Cary Coutant  <ccoutant@google.com>
2494
2495         * incremental-dump.cc (find_input_containing_global): Replace
2496         magic number with symbolic constant.
2497         (dump_incremental_inputs): Update version number.
2498         * incremental.cc (Output_section_incremental_inputs): Update version
2499         number; import symbolic constants from Incremental_inputs_reader.
2500         (Incremental_inputs::create_data_sections): Align relocations
2501         section correctly for 64-bit targets.
2502         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2503         constants; add padding.
2504         (Output_section_incremental_inputs::write_header): Add assert for
2505         header_size.
2506         (Output_section_incremental_inputs::write_input_files): Add assert
2507         for input_entry_size.
2508         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2509         add assert for object_info_size, input_section_entry_size,
2510         global_sym_entry_size.
2511         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2512         for data structure sizes; use them.
2513         (Incremental_input_entry_reader): Import symbolic constants from
2514         Incremental_inputs_reader; use them.
2515
2516 2012-04-23  David S. Miller  <davem@davemloft.net>
2517
2518         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2519         and elf_flags_set_.
2520         (Target_sparc::Target_sparc): Initialize new fields.
2521         (Target_sparc::do_make_elf_object): New function.
2522         (Target_sparc::do_adjust_elf_header): New function.
2523
2524 2012-04-23  Cary Coutant  <ccoutant@google.com>
2525
2526         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2527         CU range table of gdb index.
2528
2529 2012-04-20  David S. Miller  <davem@davemloft.net>
2530
2531         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2532         instead of false.
2533
2534 2012-04-16  David S. Miller  <davem@davemloft.net>
2535
2536         * sparc.cc (Target_sparc::got_address): New function.
2537         (Sparc_relocate_functions::gdop_hix22): New function.
2538         (Sparc_relocate_functions::gdop_lox10): New function.
2539         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2540         relocs.
2541         (Target_sparc::Scan::local): Likewise if the global symbol is not
2542         preemptible and is not IFUNC.
2543         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2544         transformations for local and non-preemptible non-IFUNC global
2545         symbols.
2546
2547         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2548         writing out 64-bit part of ranges.
2549
2550         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2551         -fpic and -fpie respectively.
2552         * Makefile.in: Regenerate.
2553
2554         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2555         (Target_sparc::Target_sparc): Initialize new field.
2556         (Target_sparc::do_plt_section_for_global): New function.
2557         (Target_sparc::do_plt_section_for_local): New function.
2558         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2559         (Target_sparc::make_plt_section): New function, broken out of
2560         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2561         (Target_sparc::make_plt_entry): Call make_plt_section.
2562         (Target_sparc::make_local_ifunc_plt_entry): New function.
2563         (Target_sparc::rela_ifunc_section): New function.
2564         (Target_sparc::plt_section): Remove const.
2565         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2566         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2567         and ifunc_count_ fields.
2568         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2569         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2570         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2571         (Output_data_plt_sparc::rela_ifunc): New function.
2572         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2573         (Output_data_plt_sparc::has_ifunc_section): New function.
2574         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2575         (Output_data_plt_sparc::address_for_global): New function.
2576         (Output_data_plt_sparc::address_for_local): New function.
2577         (Output_data_plt_sparc::plt_index_to_offset): New function.
2578         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2579         and entry_count.
2580         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2581         entry_count.
2582         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2583         R_SPARC_JMP_IREL to switch.
2584         (Target_sparc::Scan::check_non_pic): Likewise.
2585         (Target_sparc::Scan::local): Handle IFUNC symbols.
2586         (Target_sparc::Scan::local): Likewise.
2587         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2588         and plt_address_for_local.
2589         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2590         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2591
2592         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2593         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2594         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2595         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2596         global relocs too.
2597         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2598         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2599         calls.
2600         * sparc.cc (Target_sparc::Scan::global): Likewise.
2601         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2602
2603 2012-04-16  Cary Coutant  <ccoutant@google.com>
2604
2605         * archive.cc (Library_base::should_include_member): Check for
2606         --export-dynamic-symbol.
2607         * options.h (class General_options): Add --export-dynamic-symbol.
2608         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2609         --export-dynamic-symbol.
2610         (Symbol_table::gc_mark_undef_symbols): Likewise.
2611         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2612
2613 2012-04-12  David S. Miller  <davem@davemloft.net>
2614
2615         * sparc.cc (Reloc::wdisp10): New relocation method.
2616         (Reloc::h34): Likewise.
2617         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2618         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2619         R_SPARC_WDISP10.
2620         (Target_sparc::Scan::local): Likewise.
2621         (Target_sparc::Scan::global): Likewise.
2622         (Target_sparc::Relocate::relocate): Likewise.
2623
2624 2012-04-09  Cary Coutant  <ccoutant@google.com>
2625
2626         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2627         low_pc == 0.
2628
2629 2012-04-06  Ian Lance Taylor  <iant@google.com>
2630
2631         * timer.cc: #include <unistd.h>.
2632
2633 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2634
2635         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2636         * config.in: Regenerate.
2637         * configure: Regenerate.
2638
2639 2012-04-05  Nick Clifton  <nickc@redhat.com>
2640
2641         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2642         (AM_LC_MESSAGES): Add.
2643         * aclocal.m4: Regenerate.
2644         * config.in: Regenerate.
2645         * configure: Regenerate.
2646
2647 2012-03-21  Cary Coutant  <ccoutant@google.com>
2648
2649         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2650         * Makefile.in: Regenerate.
2651         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2652         (Sized_elf_reloc_mapper::symbol_section): New function.
2653         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2654         (make_elf_reloc_mapper): New function.
2655         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2656         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2657         (Dwarf_abbrev_table::do_get_abbrev): New function.
2658         (Dwarf_ranges_table::read_ranges_table): New function.
2659         (Dwarf_ranges_table::read_range_list): New function.
2660         (Dwarf_pubnames_table::read_section): New function.
2661         (Dwarf_pubnames_table::read_header): New function.
2662         (Dwarf_pubnames_table::next_name): New function.
2663         (Dwarf_die::Dwarf_die): New function.
2664         (Dwarf_die::read_attributes): New function.
2665         (Dwarf_die::skip_attributes): New function.
2666         (Dwarf_die::set_name): New function.
2667         (Dwarf_die::set_linkage_name): New function.
2668         (Dwarf_die::attribute): New function.
2669         (Dwarf_die::string_attribute): New function.
2670         (Dwarf_die::int_attribute): New function.
2671         (Dwarf_die::uint_attribute): New function.
2672         (Dwarf_die::ref_attribute): New function.
2673         (Dwarf_die::child_offset): New function.
2674         (Dwarf_die::sibling_offset): New function.
2675         (Dwarf_info_reader::check_buffer): New function.
2676         (Dwarf_info_reader::parse): New function.
2677         (Dwarf_info_reader::do_parse): New function.
2678         (Dwarf_info_reader::do_read_string_table): New function.
2679         (Dwarf_info_reader::lookup_reloc): New function.
2680         (Dwarf_info_reader::get_string): New function.
2681         (Dwarf_info_reader::visit_compilation_unit): New function.
2682         (Dwarf_info_reader::visit_type_unit): New function.
2683         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2684         Sized_elf_reloc_mapper.
2685         (Sized_dwarf_line_info::symbol_section): Remove function.
2686         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2687         (Sized_dwarf_line_info::read_line_mappings): Remove object
2688         parameter, adjust callers.
2689         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2690         * dwarf_reader.h: Include <sys/types.h>.
2691         (class Track_relocs): Remove forward declaration.
2692         (class Elf_reloc_mapper): New class.
2693         (class Sized_elf_reloc_mapper): New class.
2694         (class Dwarf_abbrev_table): New class.
2695         (class Dwarf_range_list): New class.
2696         (class Dwarf_ranges_table): New class.
2697         (class Dwarf_pubnames_table): New class.
2698         (class Dwarf_die): New class.
2699         (class Dwarf_info_reader): New class.
2700         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2701         (Sized_dwarf_line_info::symbol_section): Remove member function.
2702         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2703         base class.
2704         * gdb-index.cc: New source file.
2705         * gdb-index.h: New source file.
2706         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2707         and .debug_types sections, call Layout::add_to_gdb_index.
2708         (Sized_relobj_incr::do_section_name): Implement.
2709         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2710         return type; Implement.
2711         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2712         return type.
2713         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2714         parameter list and return type.
2715         (Sized_incr_dynobj::do_section_contents): Likewise.
2716         * layout.cc: Include gdb-index.h.
2717         (Layout::Layout): Initialize gdb_index_data_.
2718         (Layout::init_fixed_output_section): Check for .gdb_index section.
2719         (Layout::add_to_gdb_index): New function. Instantiate.
2720         * layout.h: Add forward declaration for class Gdb_index.
2721         (Layout::add_to_gdb_index): New member function.
2722         (Layout::gdb_index_data_): New data member.
2723         * main.cc: Include gdb-index.h.
2724         (main): Print statistics for gdb index.
2725         * object.cc (Object::section_contents): Move code into
2726         do_section_contents.
2727         (need_decompressed_section): Check for sections needed when building
2728         gdb index.
2729         (build_compressed_section_map): Likewise.
2730         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2731         gdb index.
2732         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2733         sections; call Layout::add_to_gdb_index.
2734         (Sized_relobj_file::do_decompressed_section_contents): Call
2735         do_section_contents directly.
2736         * object.h (Object::do_section_contents): Adjust parameter list and
2737         return type.
2738         (Object::do_decompressed_section_contents): Call do_section_contents
2739         directly.
2740         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2741         return type.
2742         * options.h (class General_options): Add --gdb-index option.
2743         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2744         list and return type.
2745         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2746         * reloc.h (Track_relocs::checkpoint): New function.
2747         (Track_relocs::reset): New function.
2748
2749         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2750         New test cases.
2751         * testsuite/Makefile.in: Regenerate.
2752         * testsuite/gdb_index_test.cc: New test source file.
2753         * testsuite/gdb_index_test_1.sh: New test source file.
2754         * testsuite/gdb_index_test_2.sh: New test source file.
2755
2756 2012-03-19  Doug Kwan  <dougkwan@google.com>
2757
2758         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2759         (Target_arm::do_finalize_sections): Remove code which defines
2760         __exidx_start and __exidx_end.  Make symbol table parameter
2761         anonymous as it is not used.
2762         * gold.cc (queue_middle_tasks): Call target hook to define any
2763         target-specific symbols.
2764         * target.h (Target::define_standard_symbols): New method.
2765         (Target::do_define_standard_symbols): Same.
2766         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2767         * testsuite/Makefile.in: Regenerate.
2768         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2769         and __exidx_end.
2770         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2771         relocations are generated for __exidx_start and __exidx_end.
2772
2773 2012-03-16  Doug Kwan  <dougkwan@google.com>
2774
2775         * testsuite/Makefile.am: Disable test initpri3b.
2776         * testsuite/Makefile.in: Regenerate.
2777
2778 2012-03-15  Doug Kwan  <dougkwan@google.com>
2779
2780         * arm.cc (Target_arm::got_section): Make .got section read-only
2781         if -z now is given.
2782
2783 2012-03-15  Ian Lance Taylor  <iant@google.com>
2784
2785         PR gold/13850
2786         * layout.cc (Layout::make_output_section): Correctly mark
2787         SHT_INIT_ARRAY, et. al., as relro.
2788
2789 2012-03-14  Doug Kwan  <dougkwan@google.com>
2790
2791         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2792         dynamic relocations for protected symbols in shared objects.
2793
2794 2012-03-13  Ian Lance Taylor  <iant@google.com>
2795
2796         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2797         keep the larger alignment.
2798
2799 2012-03-12  Cary Coutant  <ccoutant@google.com>
2800
2801         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2802         handling of DW_LNE_define_file.
2803
2804 2012-03-12  Cary Coutant  <ccoutant@google.com>
2805
2806         * reduced_debug_output.cc
2807         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2808         codes to switch.
2809
2810 2012-02-29  Cary Coutant  <ccoutant@google.com>
2811
2812         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2813
2814 2012-02-29  Cary Coutant  <ccoutant@google.com>
2815
2816         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2817         Call Object::decompressed_section_contents.
2818         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2819         New dtor.
2820         (Sized_dwarf_line_info::buffer_start_): New data member.
2821         * merge.cc (Output_merge_data::do_add_input_section): Call
2822         Object::decompressed_section_contents.
2823         (Output_merge_string::do_add_input_section): Likewise.
2824         * object.cc (need_decompressed_section): New function.
2825         (build_compressed_section_map): Decompress sections needed later.
2826         (Sized_relobj_file::do_decompressed_section_contents): New function.
2827         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2828         * object.h (Object::decompressed_section_contents): New function.
2829         (Object::discard_decompressed_sections): New function.
2830         (Object::do_decompressed_section_contents): New function.
2831         (Object::do_discard_decompressed_sections): New function.
2832         (Compressed_section_info): New type.
2833         (Compressed_section_map): Include decompressed section contents.
2834         (Sized_relobj_file::do_decompressed_section_contents): New function.
2835         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2836
2837 2012-02-16  Cary Coutant  <ccoutant@google.com>
2838
2839         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2840         * testsuite/Makefile.in: Regenerate.
2841
2842 2012-02-14  Cary Coutant  <ccoutant@google.com>
2843
2844         * options.cc (General_options::finalize): Disallow -pie and -static.
2845
2846 2012-02-03  Doug Kwan  <dougkwan@google.com>
2847
2848         * arm.cc (Arm_relocate_functions::abs8,
2849         Arm_relocate_functions::abs16): Use
2850         Bits::has_signed_unsigned_overflow32.
2851         (Arm_relocate_functions::thm_abs8): Correct range of
2852         overflow check.
2853         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2854         in assertions.
2855
2856 2012-02-02  Doug Kwan  <dougkwan@google.com>
2857
2858         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2859         position independent outputs, not just shared objects.
2860
2861 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2862
2863         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2864         * configure: Regenerated.
2865
2866 2012-01-27  Ian Lance Taylor  <iant@google.com>
2867
2868         * reloc.h (Bits): New class with static functions, copied from
2869         namespace utils in arm.cc.
2870         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2871         instead.
2872
2873 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2874
2875         * incremental.cc (write_info_blocks): Correct relocation offset.
2876
2877 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2878
2879         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2880         (Relocate::tls_gd_to_le): Likewise.
2881
2882 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2883
2884         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2885
2886 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2887
2888         * configure.ac: Check if -mcmodel=medium works.
2889         * configure: Regenerated.
2890
2891 2012-01-24  Cary Coutant  <ccoutant@google.com>
2892
2893         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2894         definition and ...
2895         (read_unsigned_LEB_128_x): ... this new function.
2896         (read_signed_LEB_128): Replaced with inline definition and ...
2897         (read_signed_LEB_128_x): ... this new function.
2898         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2899         (read_unsigned_LEB_128): Add inline definition.
2900         (read_signed_LEB_128_x): New function.
2901         (read_signed_LEB_128): Add inline definition.
2902         * testsuite/Makefile.am (leb128_unittest): New unit test.
2903         * testsuite/Makefile.in: Regenerate.
2904         * testsuite/leb128_unittest.cc: New unit test.
2905
2906 2012-01-23  Ian Lance Taylor  <iant@google.com>
2907
2908         PR gold/13617
2909         * i386.cc (Target_i386::do_code_fill): When using a jmp
2910         instruction, pad with nop instructions.
2911         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2912
2913 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2914
2915         * x86_64.cc (gc_process_relocs): Add typename on types used in
2916         template.
2917         (scan_relocs): Likewise.
2918         (relocate_section): Likewise.
2919         (apply_relocation): Likewise.
2920
2921 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2922
2923         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2924         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2925         under x32.
2926
2927 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2928
2929         * x86_64.cc: Initial support for x32.
2930
2931 2012-01-03  Cary Coutant  <ccoutant@google.com>
2932
2933         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2934         Use abstract base class for GOT.
2935         * gold/output.h (class Output_data_got_base): New abstract base class.
2936         (class Output_data_got): Derive from new base class, adjust ctors.
2937         (Output_data_got::reserve_slot): Make virtual; rename to
2938         do_reserve_slot; Adjust callers.
2939         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2940         pointer to abstract base class.
2941         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2942
2943 2011-12-18  Ian Lance Taylor  <iant@google.com>
2944
2945         * object.h (Relobj::local_symbol_value): New function.
2946         (Relobj::local_plt_offset): New function.
2947         (Relobj::local_has_got_offset): New function.
2948         (Relobj::local_got_offset): New function.
2949         (Relobj::set_local_got_offset): New function.
2950         (Relobj::do_local_symbol_value): New pure virtual function.
2951         (Relobj::do_local_plt_offset): Likewise.
2952         (Relobj::do_local_has_got_offset): Likewise.
2953         (Relobj::do_local_got_offset): Likewise.
2954         (Relobj::do_set_local_got_offset): Likewise.
2955         (Sized_relobj::do_local_has_got_offset): Rename from
2956         local_has_got_offset.
2957         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2958         (Sized_relobj::do_set_local_got_offset): Rename from
2959         set_local_got_offset.
2960         (Sized_relobj_file::do_local_plt_offset): Rename from
2961         local_plt_offset.
2962         (Sized_relobj_file::do_local_symbol_value): New function.
2963         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2964         local_plt_offset.
2965         * output.cc (Output_data_got::Got_entry::write): Change object to
2966         Relobj.  Use local_symbol_value.
2967         (Output_data_got::add_global_with_rel): Change rel_dyn to
2968         Output_data_reloc_generic*.  Use add_global_generic.
2969         (Output_data_got::add_global_with_rela): Remove.  Change all
2970         callers to use add_global_with_rel.
2971         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2972         Output_data_reloc_generic*.  Use add_global_generic.
2973         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2974         callers to use add_global_pair_with_rel.
2975         (Output_data_got::add_local): Change object to Relobj*.
2976         (Output_data_got::add_local_plt): Likewise.
2977         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2978         change rel_dyn to Output_data_reloc_generic*.  Use
2979         add_local_generic.
2980         (Output_data_got::add_local_with_rela): Remove.  Change all
2981         callers to use all_local_with_rel.
2982         (Output_data_got::add_local_pair_with_rel): Change object to
2983         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2984         add_output_section_generic.
2985         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2986         callers to use add_local_pair_with_rel.
2987         (Output_data_got::reserve_local): Change object to Relobj*.
2988         * output.h: (class Output_data_reloc_generic): Add pure virtual
2989         declarations for add_global_generic, add_local_generic,
2990         add_output_section_generic.
2991         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2992         functions for Output_data_reloc_generic.  Update declarations for
2993         changes listed in output.cc.
2994         (class Output_data_got): Change template parameter to got_size.
2995         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2996         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2997         function.
2998         (Sized_relobj_incr::do_local_plt_offset): New function.
2999         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3000         add_global_generic.
3001
3002 2011-12-17  Cary Coutant  <ccoutant@google.com>
3003
3004         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3005         * resolve.cc (Symbol_table::resolve): Likewise.
3006         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3007         arrays.
3008         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3009
3010 2011-12-16  Ian Lance Taylor  <iant@google.com>
3011
3012         * output.h (Output_data_reloc_generic::add): Only call
3013         add_dynamic_reloc if this is a dynamic reloc section.
3014
3015 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3016
3017         PR gold/13505
3018         * target-reloc.h (apply_relocation): Replace <64, false> with
3019         <size, big_endian>.
3020
3021 2011-11-25  Nick Clifton  <nickc@redhat.com>
3022
3023         * po/it.po: New Italian translation.
3024
3025 2011-11-17  Sterling Augustine  <saugustine@google.com>
3026
3027         * script.cc (script_include_directive): Implement.
3028         (read_script_file): New local variables name and search_path. Update
3029         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3030         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3031         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3032
3033 2011-11-11  Sterling Augustine  <saugustine@google.com>
3034
3035         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3036         (file_or_sections_cmd): Likewise.
3037
3038 2011-11-11  Doug Kwan  <dougkwan@google.com>
3039
3040         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3041         if --just-symbols is given.
3042
3043 2011-11-10  Doug Kwan  <dougkwan@google.com>
3044
3045         PR gold/13362
3046         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3047         when processing data relocs.
3048         * reloc.h (Relocate_functions::rel_unaligned): New method.
3049         (Relocate_functions::pcrel_unaligned): Ditto.
3050         (Relocate_functions::rel32_unaligned): Ditto.
3051         (Relocate_functions::pcrel32_unaligned): Ditto.
3052
3053 2011-11-09  Doug Kwan  <dougkwan@google.com>
3054
3055         PR gold/13362
3056         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3057         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3058         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3059         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3060         (Relocate_functions::rel_unaligned): New.
3061         (Relocate_functions::rel32_unaligned): New.
3062         * target-reloc.h (relocate_for_relocatable): Add code to handle
3063         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3064         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3065         arm_unaligned_reloc_r): New targets.
3066         * testsuite/Makefile.in: Regenerate.
3067         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3068         linking.
3069
3070 2011-11-02  Ian Lance Taylor  <iant@google.com>
3071
3072         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3073         NATIVE_LINKER.
3074         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3075         * options.cc (General_options::finalize): Use library search path
3076         from configure script if specified.  If not native and no sysroot,
3077         only search TOOLLIBDIR.
3078         * options.h (Search_directory::Search_directory): Change name to
3079         const std::string&.
3080         (General_options::add_to_library_path_with_sysroot): Change arg to
3081         const std::string&.
3082         * configure, Makefile.in, config.in: Rebuild.
3083
3084 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3085
3086         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3087         we are working around the ARM1176 Erratum.
3088         * options.h (General_options::fix_arm1176): Add option.
3089         * testsuite/Makefile.am: Add testcases, and keep current ones
3090         working.
3091         * testsuite/Makefile.in: Regenerate.
3092         * testsuite/arm_fix_1176.s: New file.
3093         * testsuite/arm_fix_1176.sh: Likewise.
3094
3095 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3096
3097         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3098         may_use_blx_.
3099         (Target_arm::may_use_blx): Remove method.
3100         (Target_arm::set_may_use_blx): Likewise.
3101         (Target_arm::may_use_v4t_interworking): New method.
3102         (Target_arm::may_use_v5t_interworking): Likewise.
3103         (Target_arm::may_use_blx_): Remove member variable.
3104         (Arm_relocate_functions::arm_branch_common): Check for v5T
3105         interworking.
3106         (Arm_relocate_functions::thumb_branch_common): Likewise.
3107         (Reloc_stub::stub_type_for_reloc): Likewise.
3108         (Target_arm::do_finalize_sections): Correct interworking checks.
3109         * testsuite/Makefile.am: Add new tests.
3110         * testsuite/Makefile.in: Regenerate.
3111         * testsuite/arm_farcall_arm_arm.s: New test.
3112         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3113         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3114         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3115         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3116         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3117         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3118         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3119
3120 2011-10-31  Cary Coutant  <ccoutant@google.com>
3121
3122         PR gold/13023
3123         * expression.cc (Expression::eval_with_dot): Add
3124         is_section_dot_assignment parameter.
3125         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3126         absolute and assigning to dot within a section.
3127         * script-sections.cc
3128         (Output_section_element_assignment::set_section_addresses): Pass
3129         dot_section to set_if_absolute.
3130         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3131         as is_section_dot_assignment flag to eval_with_dot.
3132         (Output_section_element_dot_assignment::set_section_addresses):
3133         Likewise.
3134         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3135         parameter.  Also set value if relative to dot_section; set the
3136         symbol's output_section.
3137         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3138         parameter.  Adjust all callers.
3139         (Expression::eval_maybe_dot): Likewise.
3140         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3141         Adjust all callers.
3142         * testsuite/script_test_2.t: Test assignment of an absolute value
3143         to dot within an output section element.
3144
3145 2011-10-31  Cary Coutant  <ccoutant@google.com>
3146
3147         * options.h (class General_options): Add --[no-]gnu-unique options.
3148         * symtab.cc (Symbol_table::sized_write_globals): Convert
3149         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3150
3151 2011-10-31  Cary Coutant  <ccoutant@google.com>
3152
3153         PR gold/13359
3154         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3155         unnecessary assertion.
3156         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3157
3158 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3159
3160         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3161         gc_mark_symbol.
3162         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3163         gc_mark_symbol.
3164         Change to just keep the section associated with symbol.
3165         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3166         they are externally visible and --export-dynamic is turned on.
3167         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3168
3169 2011-10-19  Ian Lance Taylor  <iant@google.com>
3170
3171         PR gold/13163
3172         * script-sections.cc
3173         (Output_section_element_dot_assignment::needs_output_section): New
3174         function.
3175
3176 2011-10-19  Ian Lance Taylor  <iant@google.com>
3177
3178         PR gold/13204
3179         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3180         --section-start option was seen.
3181         * options.h (General_options::any_section_start): New function.
3182
3183 2011-10-18  David S. Miller  <davem@davemloft.net>
3184
3185         PR binutils/13301
3186         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3187         member to track relocation locations that have moved during TLS
3188         reloc optimizations.
3189         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3190         (Target_sparc::Relocate::relocate): Adjust view down by 4
3191         bytes if it matches reloc_adjust_addr_.
3192         (Target_sparc::Relocate::relocate_tls): Always move the
3193         __tls_get_addr call delay slot instruction forward 4 bytes when
3194         performing relaxation.
3195
3196 2011-10-18  Cary Coutant  <ccoutant@google.com>
3197
3198         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3199         (Output_file::map_no_anonymous): Check for non-zero
3200         return code from posix_fallocate.
3201
3202 2011-10-17  Cary Coutant  <ccoutant@google.com>
3203
3204         PR gold/13245
3205         * plugin.cc (is_visible_from_outside): Check for symbols
3206         referenced from dynamic objects.
3207         * resolve.cc (Symbol_table::resolve): Don't count references
3208         from dynamic objects as references from real ELF files.
3209         * testsuite/plugin_test_2.sh: Adjust expected result.
3210
3211 2011-10-17  Cary Coutant  <ccoutant@google.com>
3212
3213         * gold.cc: Include timer.h.
3214         (queue_middle_tasks): Stamp time.
3215         (queue_final_tasks): Likewise.
3216         * main.cc (main): Store timer in parameters.  Print timers
3217         for each pass.
3218         * parameters.cc (Parameters::Parameters): Initialize timer_.
3219         (Parameters::set_timer): New function.
3220         (set_parameters_timer): New function.
3221         * parameters.h (Parameters::set_timer): New function.
3222         (Parameters::timer): New function.
3223         (Parameters::timer_): New data member.
3224         (set_parameters_timer): New function.
3225         * timer.cc (Timer::stamp): New function.
3226         (Timer::get_pass_time): New function.
3227         * timer.h (Timer::stamp): New function.
3228         (Timer::get_pass_time): New function.
3229         (Timer::pass_times_): New data member.
3230
3231 2011-10-17  Cary Coutant  <ccoutant@google.com>
3232
3233         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3234         task for members of lib groups.
3235
3236 2011-10-17  Cary Coutant  <ccoutant@google.com>
3237
3238         PR gold/13288
3239         * fileread.cc (File_read::find_view): Add assert.
3240         (File_read::make_view): Move bounds check (replace with assert)...
3241         (File_read::find_or_make_view): ... to here.
3242
3243 2011-10-12  Cary Coutant  <ccoutant@google.com>
3244
3245         * output.cc (Output_file::open_base_file): Handle case where
3246         ::read returns less than requested size.
3247
3248 2011-10-10  Cary Coutant  <ccoutant@google.com>
3249
3250         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3251         Initialize defined_count_.
3252         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3253         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3254         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3255         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3256         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3257         * incremental.h (Sized_relobj_incr::defined_count_): New data
3258         member.
3259         (Sized_incr_dynobj::defined_count_): New data member.
3260         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3261         Return zeroes instead of internal error.
3262
3263 2011-10-10  Cary Coutant  <ccoutant@google.com>
3264
3265         PR gold/13249
3266         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3267         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3268         * output.h (class Output_reloc): Add use_plt_offset flag.
3269         (Output_reloc::type_): Adjust size of bit field.
3270         (Output_reloc::use_plt_offset_): New bit field.
3271         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3272         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3273         flag.  Adjust all callers.
3274         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3275         creating RELATIVE relocations.
3276
3277 2011-10-10  Nick Clifton  <nickc@redhat.com>
3278
3279         * po/es.po: Updated Spanish translation.
3280         * po/fi.po: Updated Finnish translation.
3281
3282 2011-10-03   Diego Novillo  <dnovillo@google.com>
3283
3284         * options.cc (parse_uint): Fix dereference of RETVAL.
3285
3286 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3287
3288         * layout.h (section_order_map_): New member.
3289         (get_section_order_map): New member function.
3290         * output.cc (Output_section::add_input_section): Check for patterns
3291         only when --section-ordering-file is specified.
3292         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3293         output_sections have been formed.
3294         * layout.cc (Layout_Layout): Initialize section_order_map_.
3295         * plugin.cc (update_section_order): Store order in order_map. Do not
3296         update the order.
3297         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3298         * testsuite/Makefile.in: Regenerate.
3299         * testsuite/plugin_section_order.c: New file.
3300         * testsuite/plugin_final_layout.cc: New file.
3301         * testsuite/plugin_final_layout.sh: New file.
3302
3303 2011-09-29  Cary Coutant  <ccoutant@google.com>
3304
3305         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3306         Check for NULL.
3307         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3308         symbols during incremental update.
3309         (Symbol_table::add_from_dynobj): Likewise.
3310
3311 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3312             Ian Lance Taylor  <iant@google.com>
3313
3314         * symtab.cc (Symbol_table::define_special_symbol): Always
3315         canonicalize version string.
3316
3317 2011-09-26  Cary Coutant  <ccoutant@google.com>
3318
3319         * gold.cc (queue_initial_tasks): Move option checks ...
3320         * options.cc (General_options::finalize): ... to here. Disable
3321         some options; make others fatal.
3322
3323 2011-09-26  Cary Coutant  <ccoutant@google.com>
3324
3325         gcc PR lto/47247
3326         * plugin.cc (get_symbols_v2): New function.
3327         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3328         (is_referenced_from_outside): New function.
3329         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3330         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3331         (get_symbols): Pass version parameter.
3332         (get_symbols_v2): New function.
3333         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3334         parameter.
3335         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3336         (onload): Add LDPT_GET_SYMBOLS_V2.
3337         (all_symbols_read_hook): Use get_symbols_v2; check for
3338         LDPR_PREVAILING_DEF_IRONLY_EXP.
3339         * testsuite/plugin_test_3.sh: Update expected results.
3340
3341 2011-09-23  Simon Baldwin  <simonb@google.com>
3342
3343         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3344         configuration options.
3345         * configure: Regenerate.
3346         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3347         * Makefile.in: Regenerate.
3348         * testsuite/Makefile.in: Regenerate.
3349
3350 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3351
3352         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3353
3354 2011-09-19  Cary Coutant  <ccoutant@google.com>
3355
3356         * incremental.cc (can_incremental_update): Fix typo in comment.
3357         * incremental.h (can_incremental_update): Likewise.
3358
3359 2011-09-18  Cary Coutant  <ccoutant@google.com>
3360
3361         * incremental.cc (can_incremental_update): New function.
3362         * incremental.h (can_incremental_update): New function.
3363         * layout.cc (Layout::init_fixed_output_section): Call it.
3364         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3365         * object.cc (Sized_relobj_file::do_layout): Call
3366         can_incremental_update.
3367
3368 2011-09-13  Cary Coutant  <ccoutant@google.com>
3369
3370         * configure.ac: Check for glibc support for gnu_indirect_function
3371         support with static linking, setting automake conditional
3372         IFUNC_STATIC.
3373         * Makefile.in: Regenerate.
3374         * configure: Regenerate.
3375
3376         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3377         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3378         for IFUNC_STATIC.
3379         * testsuite/Makefile.in: Regenerate.
3380
3381 2011-09-13  Cary Coutant  <ccoutant@google.com>
3382
3383         * incremental.cc (Sized_relobj_incr::do_layout): Call
3384         report_comdat_group for kept comdat sections.
3385         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3386         * testsuite/Makefile.in: Regenerate.
3387         * testsuite/incr_comdat_test_1.cc: New source file.
3388         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3389         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3390         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3391
3392 2011-09-13  Ian Lance Taylor  <iant@google.com>
3393
3394         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3395         variable external_symbols_offset.
3396
3397 2011-09-12  Ian Lance Taylor  <iant@google.com>
3398
3399         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3400         triggered if object has no symbols.
3401
3402 2011-09-09  David S. Miller  <davem@davemloft.net>
3403
3404         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3405         (Output_fill_debug_line::do_write): Likewise.
3406
3407 2011-08-29  Cary Coutant  <ccoutant@google.com>
3408
3409         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3410         casts to match formatting specs.
3411         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3412
3413 2011-08-26  Cary Coutant  <ccoutant@google.com>
3414
3415         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3416         remaining hole size when allocating.
3417         (Layout::make_output_section): Set fill methods for debug sections.
3418         * layout.h (Free_list::Free_list_node): Move from private to
3419         public.
3420         (Free_list::set_min_hole_size): New function.
3421         (Free_list::begin, Free_list::end): New functions.
3422         (Free_list::min_hole_): New data member.
3423         * output.cc: Include dwarf.h.
3424         (Output_fill_debug_info::do_minimum_hole_size): New function.
3425         (Output_fill_debug_info::do_write): New function.
3426         (Output_fill_debug_line::do_minimum_hole_size): New function.
3427         (Output_fill_debug_line::do_write): New function.
3428         (Output_section::Output_section): Initialize new data member.
3429         (Output_section::set_final_data_size): Ensure patch space is larger
3430         than minimum hole size.
3431         (Output_section::do_write): Fill holes in debug sections.
3432         * output.h (Output_fill): New class.
3433         (Output_fill_debug_info): New class.
3434         (Output_fill_debug_line): New class.
3435         (Output_section::set_free_space_fill): New function.
3436         (Output_section::free_space_fill_): New data member.
3437         * testsuite/Makefile.am (incremental_test_3): Add
3438         --incremental-patch option.
3439         (incremental_test_4): Likewise.
3440         (incremental_test_5): Likewise.
3441         (incremental_test_6): Likewise.
3442         (incremental_copy_test): Likewise.
3443         (incremental_common_test_1): Likewise.
3444         * testsuite/Makefile.in: Regenerate.
3445
3446 2011-08-26  Nick Clifton  <nickc@redhat.com>
3447
3448         * po/es.po: Updated Spanish translation.
3449
3450 2011-08-01  Cary Coutant  <ccoutant@google.com>
3451
3452         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3453         * gold/testsuite/Makefile.in: Regenerate.
3454         * gold/testsuite/justsyms_exec.c: New source file.
3455         * gold/testsuite/justsyms_lib.c: New source file.
3456
3457 2011-08-01  Cary Coutant  <ccoutant@google.com>
3458
3459         * layout.cc (Layout::set_segment_offsets): Don't realign text
3460         segment if -Ttext was specified.
3461         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3462         file type.
3463         * object.h (Sized_relobj_file::e_type): New function.
3464         (Sized_relobj_file::e_type_): New data member.
3465         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3466         base address for ET_EXEC files.
3467         * target.cc (Target::do_make_elf_object_implementation): Allow
3468         ET_EXEC files with --just-symbols option.
3469
3470 2011-07-28  Cary Coutant  <ccoutant@google.com>
3471
3472         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3473         Add thread_number parameter.
3474         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3475         * workqueue-threads.cc
3476         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3477         current thread if its thread number is greater than desired thread
3478         count.
3479         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3480         Add thread_number parameter.
3481         (Workqueue::should_cancel_thread): Likewise.
3482         (Workqueue::find_runnable_or_wait): Pass thread_number to
3483         should_cancel_thread.
3484         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3485         parameter.
3486
3487 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3488
3489         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3490         only after checking if it cannot be forced local.
3491         * symtab.h (is_externally_visible): Check if the symbol is not forced
3492         local.
3493
3494 2011-07-15  Ian Lance Taylor  <iant@google.com>
3495
3496         * options.h (class General_options): Add --print-output-format.
3497         Move -EL next to -EB, for  better --help output.
3498         * target-select.cc: Include <cstdio>, "options.h", and
3499         "parameters.h".
3500         (Target_selector::do_target_bfd_name): New function.
3501         (print_output_format): New function.
3502         * target-select.h (class Target_selector): Update declarations.
3503         (Target_selector::target_bfd_name): New function.
3504         (print_output_format): Declare.
3505         * main.cc: Include "target-select.h".
3506         (main): Handle --print-output-format.
3507         * gold.cc: Include "target-select.h".
3508         (queue_initial_tasks): Handle --print-output-format when there are
3509         no input files.
3510         * parameters.cc (parameters_force_valid_target): Give a better
3511         error message if -EB/-EL does not match target.
3512         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3513         function.
3514
3515 2011-07-15  Ian Lance Taylor  <iant@google.com>
3516
3517         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3518         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3519         (Output_data_plt_i386::do_write): Write address of .dynamic
3520         section to first entry in .got.plt section.
3521         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3522         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3523         Initialize layout_.
3524         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3525         section to first entry in .got.plt section.
3526         * layout.h (Layout::dynamic_section): New function.
3527
3528 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3529
3530         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3531         to claim_file call.
3532         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3533         input_section_position_, and input_section_glob_.
3534         (read_layout_from_file): Call function section_ordering_specified.
3535         * layout.h (is_section_ordering_specified): New function.
3536         (section_ordering_specified): New function.
3537         (section_ordering_specified_): New boolean member.
3538         * main.cc(main): Call load_plugins after layout object is defined.
3539         * output.cc (Output_section::add_input_section): Use
3540         function section_ordering_specified to check if section ordering is
3541         needed.
3542         * output.cc (Output_section::add_relaxed_input_section): Use
3543         function section_ordering_specified to check if section ordering is
3544         needed.
3545         (Output_section::update_section_layout): New function.
3546         (Output_section::sort_attached_input_sections): Check if input section
3547         must be reordered.
3548         * output.h (Output_section::update_section_layout): New function.
3549         * plugin.cc (get_section_count): New function.
3550         (get_section_type): New function.
3551         (get_section_name): New function.
3552         (get_section_contents): New function.
3553         (update_section_order): New function.
3554         (allow_section_ordering): New function.
3555         (Plugin::load): Add the new interfaces to the transfer vector.
3556         (Plugin_manager::load_plugins): New parameter.
3557         (Plugin_manager::all_symbols_read): New parameter.
3558         (Plugin_manager::claim_file): New parameter. Save the elf object for
3559         unclaimed objects.
3560         (Plugin_manager::get_elf_object): New function.
3561         (Plugin_manager::get_view): Change to directly use the bool to check
3562         if get_view is called from claim_file_hook.
3563         * plugin.h (input_objects): New function
3564         (Plugin__manager::load_plugins): New parameter.
3565         (Plugin_manager::claim_file): New parameter.
3566         (Plugin_manager::get_elf_object): New function.
3567         (Plugin_manager::in_claim_file_handler): New function.
3568         (Plugin_manager::in_claim_file_handler_): New member.
3569         (layout): New function.
3570         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3571         handler with an extra parameter. Make the elf object before calling
3572         claim_file handler.
3573         * testsuite/plugin_test.c (get_section_count): New function pointer.
3574         (get_section_type): New function pointer.
3575         (get_section_name): New function pointer.
3576         (get_section_contents): New function pointer.
3577         (update_section_order): New function pointer.
3578         (allow_section_ordering): New function pointer.
3579         (onload): Check if the new interfaces exist.
3580
3581 2011-07-13  Ian Lance Taylor  <iant@google.com>
3582
3583         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3584         relro section.
3585         * x86_64.cc (Target_x86_64::got_section): Likewise.
3586         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3587         (relro_now_test_SOURCES): New variable.
3588         (relro_now_test_DEPENDENCIES): New variable.
3589         (relro_now_test_LDFLAGS): New variable.
3590         (relro_now_test_LDADD): New variable.
3591         (relro_now_test.so): New target.
3592         * testsuite/Makefile.in: Rebuild.
3593
3594 2011-07-12  Ian Lance Taylor  <iant@google.com>
3595
3596         PR gold/12980
3597         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3598         GLOB_DAT relocation rather than a RELATIVE relocation for a
3599         protected symbol when creating a shared library.
3600         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3601         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3602         * testsuite/protected_main_1.cc (main): Test that protected
3603         function has same address.
3604
3605 2011-07-11  Ian Lance Taylor  <iant@google.com>
3606
3607         PR gold/12979
3608         * options.h (class General_options): Add -Bgroup.
3609         * options.cc (General_options::finalize): If -Bgroup is set,
3610         default to --unresolved-symbols=report-all.
3611         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3612         * target-reloc.h (issue_undefined_symbol_error): Handle
3613         --unresolved-symbols=report-all.
3614
3615 2011-07-08  Ian Lance Taylor  <iant@google.com>
3616
3617         PR gold/11985
3618         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3619         if linker script discards key sections.
3620         (Layout::create_dynamic_symtab): Likewise.
3621         (Layout::assign_local_dynsym_offsets): Likewise.
3622         (Layout::sized_create_version_sections): Likewise.
3623         (Layout::create_interp): Likewise.
3624         (Layout::finish_dynamic_section): Likewise.
3625         (Layout::set_dynamic_symbol_size): Likewise.
3626
3627 2011-07-08  Ian Lance Taylor  <iant@google.com>
3628
3629         PR gold/12386
3630         * options.h (class General_options): Add --unresolved-symbols.
3631         * target-reloc.h (issue_undefined_symbol_error): Check
3632         --unresolved-symbols.  Add comments.
3633
3634 2011-07-08  Ian Lance Taylor  <iant@google.com>
3635
3636         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3637         expression more complex.
3638
3639 2011-07-08  Ian Lance Taylor  <iant@google.com>
3640
3641         PR gold/11317
3642         * target-reloc.h (issue_undefined_symbol_error): New inline
3643         function, broken out of relocate_section.
3644         (relocate_section): Call issue_undefined_symbol_error.
3645         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3646         there is no TLS segment if we are about to issue an undefined
3647         symbol error.
3648         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3649
3650 2011-07-08  Ian Lance Taylor  <iant@google.com>
3651
3652         PR gold/12279
3653         * resolve.cc (Symbol_table::should_override): Add fromtype
3654         parameter.  Change all callers.  Give error when linking together
3655         TLS and non-TLS symbol.
3656         (Symbol_table::should_override_with_special): Add fromtype
3657         parameter.  Change all callers.
3658         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3659         there is no TLS segment if we have reported some errors.
3660         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3661
3662 2011-07-08  Ian Lance Taylor  <iant@google.com>
3663
3664         PR gold/12372
3665         * target.h (Target::plt_address_for_global): New function.
3666         (Target::plt_address_for_local): New function.
3667         (Target::plt_section_for_global): Remove.
3668         (Target::plt_section_for_local): Remove.
3669         (Target::do_plt_address_for_global): New virtual function.
3670         (Target::do_plt_address_for_local): New virtual function.
3671         (Target::do_plt_section_for_global): Remove.
3672         (Target::do_plt_section_for_local): Remove.
3673         (Target::register_global_plt_entry): Add Symbol_table and Layout
3674         parameters.
3675         * output.cc (Output_data_got::Got_entry::write): Use
3676         plt_address_for_global and plt_address_for_local.
3677         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3678         address of output section.
3679         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3680         got_irelative_, and irelative_count_ fields.  Update
3681         declarations.
3682         (Output_data_plt_i386::has_irelative_section): New function.
3683         (Output_data_plt_i386::entry_count): Add irelative_count_.
3684         (Output_data_plt_i386::set_final_data_size): Likewise.
3685         (class Target_i386): Add got_irelative_ and rel_irelative_
3686         fields.  Update declarations.
3687         (Target_i386::Target_i386): Initialize new fields.
3688         (Target_i386::do_plt_address_for_global): New function replacing
3689         do_plt_section_for_global.
3690         (Target_i386::do_plt_address_for_local): New function replacing
3691         do_plt_section_for_local.
3692         (Target_i386::got_section): Create got_irelative_.
3693         (Target_i386::rel_irelative_section): New function.
3694         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3695         fields.  Don't define __rel_iplt_{start,end}.
3696         (Output_data_plt_i386::add_entry): Add symtab and layout
3697         parameters.  Change all callers.  Use different PLT and GOT for
3698         IFUNC symbols.
3699         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3700         layout parameters.  Change all callers.  Use different PLT and
3701         GOT.
3702         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3703         (Output_data_plt_i386::rel_irelative): New function.
3704         (Output_data_plt_i386::address_for_global): New function.
3705         (Output_data_plt_i386::address_for_local): New function.
3706         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3707         IRELATIVE GOT when changing IFUNC GOT entries.
3708         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3709         reloc.
3710         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3711         if we didn't create an IRELATIVE GOT.
3712         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3713         plt_address_for_local.
3714         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3715         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3716         got_irelative_, and irelative_count_ fields.  Update
3717         declarations.
3718         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3719         Initialize new fields.  Remove symtab parameter.  Change all
3720         callers.
3721         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3722         irelative_count_.
3723         (Output_data_plt_x86_64::has_irelative_section): New function.
3724         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3725         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3726         fields.  Update declarations.
3727         (Target_x86_64::Target_x86_64): Initialize new fields.
3728         (Target_x86_64::do_plt_address_for_global): New function replacing
3729         do_plt_section_for_global.
3730         (Target_x86_64::do_plt_address_for_local): New function replacing
3731         do_plt_section_for_local.
3732         (Target_x86_64::got_section): Create got_irelative_.
3733         (Target_x86_64::rela_irelative_section): New function.
3734         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3735         all callers.  Don't create __rel_iplt_{start,end}.
3736         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3737         parameters.  Change all callers.  Use different PLT and GOT for
3738         IFUNC symbols.
3739         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3740         layout parameters.  Change all callers.  Use different PLT and
3741         GOT.
3742         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3743         parameters.  Change all callers.  Use different PLT and GOT for
3744         IFUNC symbols.
3745         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3746         (Output_data_plt_x86_64::rela_irelative): New function.
3747         (Output_data_plt_x86_64::address_for_global): New function.
3748         (Output_data_plt_x86_64::address_for_local): New function.
3749         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3750         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3751         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3752         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3753         parameters.
3754         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3755         reloc.
3756         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3757         symbols if we didn't create an IRELATIVE GOT.
3758         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3759         plt_address_for_local.
3760         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3761         * testsuite/ifuncvar1.c: New test file.
3762         * testsuite/ifuncvar2.c: New test file.
3763         * testsuite/ifuncvar3.c: New test file.
3764         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3765         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3766         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3767         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3768         * testsuite/Makefile.in: Rebuild.
3769
3770 2011-07-07  Cary Coutant  <ccoutant@google.com>
3771
3772         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3773         (two_file_test_1_ndebug.o): Likewise.
3774         (two_file_test_1b_ndebug.o): Likewise.
3775         (two_file_test_2_ndebug.o): Likewise.
3776         (two_file_test_main_ndebug.o): Likewise.
3777         (incremental_test_2): Link with no-debug versions.
3778
3779 2011-07-06  Cary Coutant  <ccoutant@google.com>
3780
3781         * gold/incremental.cc
3782         (Output_section_incremental_inputs::write_info_blocks): Check for
3783         hidden and internal symbols.
3784
3785 2011-07-06  Cary Coutant  <ccoutant@google.com>
3786
3787         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3788         Check disposition for startup file.
3789         (Incremental_inputs::report_command_line): Ignore
3790         --incremental-startup-unchanged option.
3791         * options.cc (General_options::parse_incremental_startup_unchanged):
3792         New function.
3793         (General_options::General_options): Initialize new data member.
3794         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3795         (General_options): Add --incremental-startup-unchanged option.
3796         (General_options::incremental_startup_disposition): New function.
3797         (General_options::incremental_startup_disposition_): New data member.
3798
3799 2011-07-06  Cary Coutant  <ccoutant@google.com>
3800
3801         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3802         input file index to Script_info ctor.
3803         (Sized_incremental_binary::do_file_has_changed): Find the
3804         command-line argument for files named in scripts.
3805         * incremental.h (Script_info::Script_info): New ctor
3806         with input file index.
3807         (Script_info::input_file_index): New function.
3808         (Script_info::input_file_index_): New data member.
3809         (Incremental_binary::get_library): Add const.
3810         (Incremental_binary::get_script_info): Add const.
3811         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3812         * testsuite/Makefile.am (incremental_test_5): New test case.
3813         (incremental_test_6): New test case.
3814         * testsuite/Makefile.in: Regenerate.
3815
3816 2011-07-06  Cary Coutant  <ccoutant@google.com>
3817
3818         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3819         debug output when command lines differ.
3820
3821 2011-07-06  Cary Coutant  <ccoutant@google.com>
3822
3823         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3824         --incremental-patch option.
3825         * layout.cc (Free_list::allocate): Extend allocation beyond original
3826         end if enabled.
3827         (Layout::make_output_section): Mark sections that should get
3828         patch space.
3829         * options.cc (parse_percent): New function.
3830         * options.h (parse_percent): New function.
3831         (DEFINE_percent): New macro.
3832         (General_options): Add --incremental-patch option.
3833         * output.cc (Output_section::Output_section): Initialize new data
3834         members.
3835         (Output_section::add_input_section): Print section name when out
3836         of patch space.
3837         (Output_section::add_output_section_data): Likewise.
3838         (Output_section::set_final_data_size): Add patch space when
3839         doing --incremental-full.
3840         (Output_section::do_reset_address_and_file_offset): Remove patch
3841         space.
3842         (Output_segment::set_section_list_addresses): Print debug output
3843         only if --incremental-update.
3844         * output.h (Output_section::set_is_patch_space_allowed): New function.
3845         (Output_section::is_patch_space_allowed_): New data member.
3846         (Output_section::patch_space_): New data member.
3847         * parameters.cc (Parameters::incremental_full): New function.
3848         * parameters.h (Parameters::incremental_full): New function
3849         * testsuite/Makefile.am (incremental_test_2): Add test for
3850         --incremental-patch option.
3851         * testsuite/Makefile.in: Regenerate.
3852         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3853         (t18): Remove function body.
3854
3855 2011-07-05  Doug Kwan  <dougkwan@google.com>
3856
3857         PR gold/12771
3858         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3859         Arm_Address type for relocation result.
3860         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3861         overflow check.
3862         (Arm_relocate_functions::abs32): Use unaligned access.
3863         (Arm_relocate_functions::rel32): Ditto.
3864         (Arm_relocate_functions::prel31): Ditto.
3865         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3866         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3867         static data relocations.
3868         * testsuite/Makefile.in: Regnerate.
3869         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3870
3871 2011-07-05  Ian Lance Taylor  <iant@google.com>
3872
3873         PR gold/12392
3874         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3875         symbols if necessary.
3876         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3877
3878 2011-07-05  Ian Lance Taylor  <iant@google.com>
3879
3880         PR gold/12952
3881         * resolve.cc (Symbol::override_base_with_special): Simply override
3882         version with special symbol version, ignoring previous version.
3883
3884 2011-07-05  Ian Lance Taylor  <iant@google.com>
3885
3886         * object.cc (Sized_relobj_file::include_section_group): Add
3887         information to comment about signature location.
3888
3889 2011-07-02  Ian Lance Taylor  <iant@google.com>
3890
3891         PR gold/12957
3892         * options.h (class General_options): Add -f and -F.
3893         * options.cc (General_options::finalize): Fatal error if -f/-F
3894         are used without -shared.
3895         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3896
3897 2011-07-02  Ian Lance Taylor  <iant@google.com>
3898
3899         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3900
3901 2011-07-01  Ian Lance Taylor  <iant@google.com>
3902
3903         PR gold/12525
3904         PR gold/12952
3905         * resolve.cc (Symbol::override_base_with_special): Don't override
3906         the version if the overriding symbol has a different name.
3907         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3908         all callers.  If we give an error about an undefined version,
3909         define the base version if necessary.
3910         * dynobj.h (class Versions): Update declaration.
3911         * testsuite/weak_alias_test_5.cc: New file.
3912         * testsuite/weak_alias_test.script: New file.
3913         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3914         and versioned_alias have the right value, and call t2.
3915         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3916         weak_alias_test_5.so.
3917         (weak_alias_test_LDADD): Likewise.
3918         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3919         * testsuite/Makefile.in: Rebuild.
3920
3921 2011-07-01  Ian Lance Taylor  <iant@google.com>
3922
3923         PR gold/12525
3924         * options.h (class General_options): Support -z notext.
3925         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3926         -Wl,-z,notext.
3927         (two_file_shared_nonpic.so): Likewise.
3928         (two_file_shared_mixed.so): Likewise.
3929         (two_file_shared_mixed_1.so): Likewise.
3930         (weak_undef_lib_nonpic.so): Likewise.
3931         (alt/weak_undef_lib_nonpic.so): Likewise.
3932         (tls_test_shared_nonpic.so): Likewise.
3933         * testsuite/Makefile.in: Rebuild.
3934
3935 2011-07-01  Ian Lance Taylor  <iant@google.com>
3936
3937         PR gold/12525
3938         * configure.ac: Test whether static linking works, setting
3939         the automake conditional HAVE_STATIC.
3940         * testsuite/Makefile.am: Disable tests using -static if
3941         HAVE_STATIC is not true.
3942         * configure, testsuite/Makefile.in: Rebuild.
3943
3944 2011-07-01  Ian Lance Taylor  <iant@google.com>
3945
3946         PR gold/12525
3947         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3948         Assert if we see DW_EH_PE_indirect.
3949         * target.h (Target::ehframe_datarel_base): New function.
3950         (Target::do_ehframe_datarel_base): New target function.
3951         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3952         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3953         function.
3954
3955 2011-07-01  Ian Lance Taylor  <iant@google.com>
3956
3957         PR gold/12571
3958         * options.h (class General_options): Add
3959         --ld-generated-unwind-info.
3960         * ehframe.cc (Fde::write): Add address parameter.  Change all
3961         callers.  If associated with PLT, fill in address and size.
3962         (Cie::set_output_offset): Only add merge mapping if there is an
3963         object.
3964         (Cie::write): Add address parameter.  Change all callers.
3965         (Eh_frame::add_ehframe_for_plt): New function.
3966         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3967         input_offset_ fields into union u_, with new plt field.
3968         (Fde::Fde): Adjust for new union field.
3969         (Fde::Fde) [Output_data version]: New constructor.
3970         (Fde::add_mapping): Only add merge mapping if there is an object.
3971         (class Cie): Update declarations.
3972         (class Eh_frame): Declare add_ehframe_for_plt.
3973         * layout.cc (Layout::layout_eh_frame): Break out code into
3974         make_eh_frame_section, and call it.
3975         (Layout::make_eh_frame_section): New function.
3976         (Layout::add_eh_frame_for_plt): New function.
3977         * layout.h (class Layout): Update declarations.
3978         * merge.cc (Merge_map::add_mapping): Add assertion.
3979         * i386.cc: Include "dwarf.h".
3980         (class Output_data_plt_i386): Make first_plt_entry,
3981         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3982         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3983         and plt_eh_frame_fde.
3984         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3985         boundary.  Call add_eh_frame_for_plt if appropriate.
3986         * x86_64.cc: Include "dwarf.h".
3987         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3988         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3989         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3990         and plt_eh_frame_fde.
3991         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3992         appropriate.
3993
3994 2011-06-29  Ian Lance Taylor  <iant@google.com>
3995
3996         PR gold/12629
3997         * object.cc (Sized_relobj_file::layout_section): Change shdr
3998         parameter to be const.
3999         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4000         out of do_layout.
4001         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4002         appropriate.  Call layout_eh_frame_section.
4003         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4004         sections.
4005         * object.h (class Sized_relobj_file): Update declarations.
4006
4007 2011-06-29  Ian Lance Taylor  <iant@google.com>
4008
4009         PR gold/12652
4010         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4011         modifier.
4012         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4013
4014 2011-06-29  Ian Lance Taylor  <iant@google.com>
4015
4016         PR gold/12675
4017         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4018         SHT_X86_64_UNWIND.
4019         * layout.cc (Layout::layout_eh_frame): Likewise.
4020
4021 2011-06-29  Ian Lance Taylor  <iant@google.com>
4022
4023         PR gold/12695
4024         * layout.cc (Layout::symtab_section_shndx): New function.
4025         * layout.h (class Layout): Declare symtab_section_shndx.
4026         * output.cc (Output_section::write_header): Call it.
4027
4028 2011-06-29  Ian Lance Taylor  <iant@google.com>
4029
4030         PR gold/12818
4031         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4032         symbols which are not used in a relocation.
4033
4034 2011-06-28  Ian Lance Taylor  <iant@google.com>
4035
4036         PR gold/12898
4037         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4038         script create indistinguishable segments.
4039         (Layout::set_segment_offsets): Use stable_sort when sorting
4040         segments.  Pass this to Compare_segments constructor.
4041         * layout.h (class Layout): Make segment_precedes non-static.
4042         (class Compare_segments): Change from struct to class.  Add
4043         layout_ field.  Add constructor.
4044         * script-sections.cc
4045         (Script_sections::attach_sections_using_phdrs_clause): Rename
4046         local orphan to is_orphan.  Don't report failure to put empty
4047         section in segment.  On attachment failure, report name of
4048         section, and attach to first PT_LOAD segment.
4049
4050 2011-06-28  Ian Lance Taylor  <iant@google.com>
4051
4052         PR gold/12934
4053         * target-select.cc (Target_selector::Target_selector): Add
4054         emulation parameter.  Change all callers.
4055         (select_target_by_bfd_name): Rename from select_target_by_name.
4056         Change all callers.
4057         (select_target_by_emulation): New function.
4058         (supported_emulation_names): New function.
4059         * target-select.h (class Target_selector): Add emulation_ field.
4060         Update declarations.
4061         (Target_selector::recognize_by_bfd_name): Rename from
4062         recognize_by_name.  Change all callers.
4063         (Target_selector::supported_bfd_names): Rename from
4064         supported_names.  Change all callers.
4065         (Target_selector::recognize_by_emulation): New function.
4066         (Target_selector::supported_emulations): New function.
4067         (Target_selector::emulation): New function.
4068         (Target_selector::do_recognize_by_bfd_name): Rename from
4069         do_recognize_by_name.  Change all callers.
4070         (Target_selector::do_supported_bfd_names): Rename from
4071         do_supported_names.  Change all callers.
4072         (Target_selector::do_recognize_by_emulation): New function.
4073         (Target_selector::do_supported_emulations): New function.
4074         (select_target_by_bfd_name): Change name in declaration.
4075         (select_target_by_emulation): Declare.
4076         (supported_emulation_names): Declare.
4077         * parameters.cc (parameters_force_valid_target): Try to find
4078         target based on emulation from -m option.
4079         * options.h (class General_options): Change doc string for -m.
4080         * options.cc (help): Print emulations.
4081         (General_options::parse_V): Likewise.
4082         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4083         Add emulation parameter.  Change all callers.
4084
4085 2011-06-28  Ian Lance Taylor  <iant@google.com>
4086
4087         * target.h (class Target): Add osabi_ field.
4088         (Target::osabi): New function.
4089         (Target::set_osabi): New function.
4090         (Target::Target): Initialize osabi_.
4091         (Target::do_adjust_elf_header): Make pure virtual.
4092         (Sized_target::do_adjust_elf_header): Declare.
4093         * target.cc (Sized_target::do_adjust_elf_header): New function.
4094         (class Sized_target): Instantiate all versions.
4095         * freebsd.h (class Target_freebsd): Remove.
4096         (Target_selector_freebsd::do_recognize): Call set_osabi on
4097         Target.
4098         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4099         (Target_selector_freebsd::set_osabi): Remove.
4100         * i386.cc (class Target_i386): Inherit from Sized_target rather
4101         than Target_freebsd.
4102         * x86_64.cc (class Target_x86_64): Likewise.
4103
4104 2011-06-28  Ian Lance Taylor  <iant@google.com>
4105
4106         * target.h (Target::can_check_for_function_pointers): Rewrite.
4107         Make non-virtual.
4108         (Target::can_icf_inline_merge_sections): Likewise.
4109         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4110         (Target::Target_info): Add can_icf_inline_merge_sections field.
4111         (Target::do_can_check_for_function_pointers): New virtual
4112         function.
4113         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4114         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4115         from can_check_for_function_pointers, move in file.
4116         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4117         section_may_have_icf_unsafe_poineters, move in file.
4118         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4119         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4120         Rename from can_check_for_function_pointers, move in file.
4121         (Target_i386::can_icf_inline_merge_sections): Remove.
4122         (Target_i386::i386_info): Initialize
4123         can_icf_inline_merge_sections.
4124         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4125         Initialize can_icf_inline_merge_sections.
4126         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4127         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4128         Rename from can_check_for_function_pointers, move in file.
4129         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4130         (Target_x86_64::x86_64_info): Initialize
4131         can_icf_inline_merge_sections.
4132         * testsuite/testfile.cc (Target_test::test_target_info):
4133         Likewise.
4134         * icf.cc (get_section_contents): Correct formatting.
4135
4136 2011-06-27  Ian Lance Taylor  <iant@google.com>
4137
4138         * symtab.cc (Symbol::versioned_name): New function.
4139         (Symbol_table::add_to_final_symtab): Use versioned_name when
4140         appropriate.
4141         (Symbol_table::sized_write_symbol): Likewise.
4142         * symtab.h (class Symbol): Declare versioned_name.
4143         * stringpool.h (class Stringpool_template): Add variant of add
4144         which takes a std::basic_string.
4145         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4146         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4147         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4148         (ver_test_12.o): New target.
4149         * testsuite/Makefile.in: Rebuild.
4150
4151 2011-06-27  Doug Kwan  <dougkwan@google.com>
4152
4153         * arm.cc (Arm_relocate_functions::thm_jump8,
4154         Arm_relocate_functions::thm_jump11): Use a wider signed
4155         type to compute offset.
4156         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4157         arm_thm_jump8.
4158         * testsuite/Makefile.in: Regenerate.
4159         * testsuite/arm_branch_in_range.sh: Check test results of
4160         arm_thm_jump11 and arm_thm_jump8.
4161         * testsuite/arm_thm_jump11.s: New test source file.
4162         * testsuite/arm_thm_jump11.t: New linker script.
4163         * testsuite/arm_thm_jump8.s: New test source file.
4164         * testsuite/arm_thm_jump8.t: New linker script.
4165
4166 2011-06-24  Ian Lance Taylor  <iant@google.com>
4167
4168         * layout.cc: Include "object.h".
4169         (ctors_sections_in_init_array): New static variable.
4170         (Layout::is_ctors_in_init_array): New function.
4171         (Layout::layout): Add entry to ctors_sections_in_init_array if
4172         appropriate.
4173         * layout.h (class Layout): Declare is_ctors_in_init_array.
4174         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4175         is_ctors_reverse_view is set.
4176         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4177         all callers.  Set is_ctors_reverse_view field of View_size.
4178         (Sized_relobj_file::reverse_words): New function.
4179         * object.h (Sized_relobj_file::View_size): Add
4180         is_ctors_reverse_view field.
4181         (class Sized_relobj_file): Update declarations.
4182         * testsuite/initpri3.c: New test.
4183         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4184         initpri3b.
4185         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4186         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4187         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4188         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4189         * testsuite/Makefile.in: Rebuild.
4190
4191 2011-06-24  Cary Coutant  <ccoutant@google.com>
4192
4193         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4194         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4195         (debug_msg_cdebug.err): New targets.
4196         * testsuite/Makefile.in: Regenerate.
4197         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4198         Fix checks for link with shared library.
4199
4200 2011-06-24  Doug Kwan  <dougkwan@google.com>
4201
4202         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4203         skip empty text sections.
4204         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4205
4206 2011-06-22  Ian Lance Taylor  <iant@google.com>
4207
4208         PR gold/12910
4209         * options.h (class General_options): Add --ctors-in-init-array.
4210         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4211         friends as SHT_PROGBITS for merging sections.
4212         (Layout::layout): Remove special handling of .init_array and
4213         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4214         and .dtors if ctors_in_init_array.
4215         (Layout::make_output_section): Force correct section types for
4216         .init_array and friends.  Don't sort if doing relocatable link,
4217         Don't sort .ctors and .dtors if ctors_in_init_array.
4218         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4219         (Layout::output_section_name): Add relobj parameter.  Change all
4220         callers.  Handle .ctors. and .dtors. in code rather than table.
4221         Handle .ctors and .dtors if ctors_in_init_array.
4222         (Layout::match_file_name): New function, moved from output.cc.
4223         * layout.h (class Layout): Update declarations.
4224         * output.cc: Include "layout.h".
4225         (Input_section_sort_entry::get_priority): New function.
4226         (Input_section_sort_entry::match_file_name): Just call
4227         Layout::match_file_name.
4228         (Output_section::Input_section_sort_init_fini_compare::operator()):
4229         Handle .ctors and .dtors.  Sort by explicit priority rather than
4230         by name.
4231         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4232         * testsuite/initpri2.c: New test.
4233         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4234         (check_PROGRAMS): Add initpri2.
4235         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4236         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4237         * configure, testsuite/Makefile.in: Rebuild.
4238
4239 2011-06-19  Ian Lance Taylor  <iant@google.com>
4240
4241         PR gold/12880
4242         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4243         .interp section to a PT_INTERP segment even if we have seen a
4244         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4245         clause in a linker script.
4246         (Layout::finalize): Don't create a .interp section if we've
4247         already create a PT_INTERP segment.
4248         (Layout::create_interp): Always call choose_output_section (revert
4249         patch of 2011-06-17).  Don't create PT_INTERP segment.
4250         * script-sections.cc
4251         (Script_sections::create_note_and_tls_segments): Add a .interp
4252         section to a PT_INTERP segment even if we have seen a
4253         --dynamic-linker option.
4254
4255 2011-06-18  Ian Lance Taylor  <iant@google.com>
4256
4257         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4258         merely because a non-PT_LOAD segment has a dynamic reloc.
4259
4260 2011-06-18  Ian Lance Taylor  <iant@google.com>
4261
4262         * layout.cc (Layout::finish_dynamic_section): Don't create
4263         DT_FLAGS entry if not needed.
4264
4265 2011-06-18  Ian Lance Taylor  <iant@google.com>
4266
4267         PR gold/12745
4268         * layout.cc (Layout::layout_eh_frame): Correct handling of
4269         writable .eh_frame section.
4270
4271 2011-06-17  Ian Lance Taylor  <iant@google.com>
4272
4273         PR gold/12893
4274         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4275         symbol is redefined with the exact same object and value.
4276
4277 2011-06-17  Ian Lance Taylor  <iant@google.com>
4278
4279         PR gold/12880
4280         * layout.h (class Layout): Add interp_segment_ field.
4281         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4282         (Layout::attach_allocated_section_to_segment): If making shared
4283         library, put .interp section in PT_INTERP segment.
4284         (Layout::finalize): Also call create_interp if -dynamic-linker
4285         option was used.
4286         (Layout::create_interp): Assert that there is no PT_INTERP
4287         segment.  If not using a SECTIONS clause, use make_output_section.
4288         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4289         * script-sections.cc
4290         (Script_sections::create_note_and_tls_segments): If making shared
4291         library, put .interp section in PT_INTERP segment.
4292
4293 2011-06-17  Ian Lance Taylor  <iant@google.com>
4294
4295         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4296         when making a shared library.
4297
4298 2011-06-17  Ian Lance Taylor  <iant@google.com>
4299
4300         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4301         parameter.  Change all callers.  Don't issue warning about PC32
4302         against locally defined symbol.
4303
4304 2011-06-16  Ian Lance Taylor  <iant@google.com>
4305
4306         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4307         occurs in same object.
4308
4309 2011-06-14  Alan Modra  <amodra@gmail.com>
4310
4311         * po/POTFILES.in: Regenerate.
4312
4313 2011-06-09  Ian Lance Taylor  <iant@google.com>
4314
4315         * script-sections.cc
4316         (Orphan_output_section::set_section_addresses): For a relocatable
4317         link set address to 0.
4318
4319 2011-06-09  Cary Coutant  <ccoutant@google.com>
4320
4321         PR gold/12804
4322         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4323         used with --compress-debug-sections.
4324         * gold/object.cc (Sized_relobj_file::do_layout): Report
4325         uncompressed size of compressed input sections.
4326
4327 2011-06-08  Cary Coutant  <ccoutant@google.com>
4328
4329         PR gold/12804
4330         * testsuite/two_file_test_2_v1.cc: Change initialization of
4331         v2 to keep it in .data.
4332
4333 2011-06-07  Cary Coutant  <ccoutant@google.com>
4334
4335         * common.cc (Symbol_table::do_allocate_commons_list): Call
4336         gold_fallback.
4337         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4338         (Errors::fallback): New function.
4339         (gold_fallback): New function.
4340         * errors.h (Errors::fallback): New function.
4341         * gold.cc (gold_exit): Change status parameter to enum; adjust
4342         all callers.
4343         (queue_initial_tasks): Call gold_fallback.
4344         * gold.h: Include cstdlib.
4345         (Exit_status): New enum type.
4346         (gold_exit): Change status parameter to enum.
4347         (gold_fallback): New function.
4348         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4349         (Layout::create_symtab_sections): Likewise.
4350         (Layout::create_shdrs): Likewise.
4351         * main.cc (main): Adjust call to gold_exit.
4352         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4353         (Output_data_got::add_got_entry_pair): Likewise.
4354         (Output_section::add_input_section): Likewise.
4355         (Output_section::add_output_section_data): Likewise.
4356         (Output_segment::set_section_list_addresses): Likewise.
4357         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4358
4359 2011-06-07  Cary Coutant  <ccoutant@google.com>
4360
4361         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4362         for incremental links.
4363         * output.cc (Output_segment::set_section_list_addresses): Remove
4364         FIXME and test for TLS or BSS.
4365
4366 2011-06-07  Cary Coutant  <ccoutant@google.com>
4367
4368         * testsuite/Makefile.am: Add incremental_copy_test,
4369         incremental_common_test_1.
4370         * testsuite/Makefile.in: Regenerate.
4371         * testsuite/common_test_1_v1.c: New source file.
4372         * testsuite/common_test_1_v2.c: New source file.
4373         * testsuite/copy_test_v1.cc: New source file.
4374
4375 2011-06-07  Cary Coutant  <ccoutant@google.com>
4376
4377         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4378         update, allocate common from bss section's free list.
4379         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4380         linker-defined symbols.
4381         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4382         Skip GOT and PLT entries that are no longer referenced.
4383         (Output_section_incremental_inputs::write_info_blocks): Mark
4384         linker-defined symbols.
4385         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4386         * output.cc (Output_section::allocate): New function.
4387         * output.h (Output_section::allocate): New function.
4388         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4389         linker-defined symbols.
4390         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4391         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4392         (Symbol::init_base_output_data): Likewise.
4393         (Symbol::init_base_output_segment): Likewise.
4394         (Symbol::init_base_constant): Likewise.
4395         (Sized_symbol::init_output_data): Likewise.
4396         (Sized_symbol::init_output_segment): Likewise.
4397         (Sized_symbol::init_constant): Likewise.
4398         (Symbol_table::do_define_in_output_data): Likewise.
4399         (Symbol_table::do_define_in_output_segment): Likewise.
4400         (Symbol_table::do_define_as_constant): Likewise.
4401         * symtab.h (Symbol::is_predefined): New function.
4402         (Symbol::init_base_output_data): Add is_predefined parameter.
4403         (Symbol::init_base_output_segment): Likewise.
4404         (Symbol::init_base_constant): Likewise.
4405         (Symbol::is_predefined_): New data member.
4406         (Sized_symbol::init_output_data): Add is_predefined parameter.
4407         (Sized_symbol::init_output_segment): Likewise.
4408         (Sized_symbol::init_constant): Likewise.
4409         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4410
4411 2011-06-07  Cary Coutant  <ccoutant@google.com>
4412
4413         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4414         instead of emit_copy_reloc.
4415         (Copy_relocs::emit_copy_reloc): Refactor.
4416         (Copy_relocs::make_copy_reloc): New function.
4417         (Copy_relocs::add_copy_reloc): Remove.
4418         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4419         section.
4420         (Copy_relocs::make_copy_reloc): New function.
4421         (Copy_relocs::add_copy_reloc): Remove.
4422         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4423         unchanged input files.
4424         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4425         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4426         Reserve BSS space for COPY relocations.
4427         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4428         (Output_section_incremental_inputs::write_info_blocks): Record
4429         whether a symbol is copied from a shared object.
4430         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4431         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4432         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4433         (Incremental_input_entry_reader::get_output_symbol_index): Add
4434         is_copy parameter.
4435         (Incremental_binary::emit_copy_relocs): New function.
4436         (Incremental_binary::do_emit_copy_relocs): New function.
4437         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4438         new data member.
4439         (Sized_incremental_binary::add_copy_reloc): New function.
4440         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4441         (Sized_incremental_binary::Copy_reloc): New struct.
4442         (Sized_incremental_binary::Copy_relocs): New typedef.
4443         (Sized_incremental_binary::copy_relocs_): New data member.
4444         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4445         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4446         * target.h (Sized_target::emit_copy_reloc): New function.
4447         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4448
4449 2011-06-02  Cary Coutant  <ccoutant@google.com>
4450
4451         PR gold/12163
4452         * gold/archive.cc (Archive::Archive): Initialize new data member.
4453         (Archive::include_all_members): Return if archive has already been
4454         included.
4455         * gold/archive.h (Archive::include_all_members_): New data member.
4456
4457 2011-06-02  Nick Clifton  <nickc@redhat.com>
4458
4459         * dynobj.h: Fix spelling mistake in comment.
4460         * output.cc: Likewise.
4461
4462 2011-05-31  Doug Kwan  <dougkwan@google.com>
4463             Asier Llano
4464
4465         PR gold/12826
4466         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4467         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4468         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4469         redundant arm_exidx_test.so.
4470         * testsuite/Makefile.in: Regenerate.
4471         (check_SCRIPTS): Add pr12826.sh
4472         (check_DATA): Add pr12826.stdout
4473         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4474         * testsuite/pr12826.sh: New file.
4475         * testsuite/pr12826_1.s: Ditto.
4476         * testsuite/pr12826_1.s: Ditto.
4477
4478 2011-05-30  Ian Lance Taylor  <iant@google.com>
4479
4480         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4481         sections.
4482
4483 2011-05-29  Ian Lance Taylor  <iant@google.com>
4484
4485         PR gold/12804
4486         * testsuite/Makefile.am: Use different file name for two_file_test
4487         temporary file for each incremental test.
4488         * testsuite/Makefile.in: Rebuild.
4489
4490 2011-05-29  Ian Lance Taylor  <iant@google.com>
4491
4492         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4493         binary input file is empty.
4494
4495 2011-05-27  Ian Lance Taylor  <iant@google.com>
4496
4497         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4498         (ver_test_9.so): Likewise.
4499         * testsuite/Makefile.in: Rebuild.
4500
4501 2011-05-26 Cary Coutant  <ccoutant@google.com>
4502
4503         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4504         * incremental.cc (Incremental_inputs::report_input_section): Fix
4505         comment, indentation.
4506         (Incremental_inputs::report_comdat_group): New function.
4507         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4508         of data for incremental input file entry.
4509         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4510         group count, COMDAT group signatures.
4511         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4512         an unchanged input file.
4513         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4514         Initialize new data member.
4515         (Incremental_object_entry::add_comdat_group): New function.
4516         (Incremental_object_entry::get_comdat_group_count): New function.
4517         (Incremental_object_entry::get_comdat_signature_key): New function.
4518         (Incremental_object_entry::groups_): New data member.
4519         (Incremental_inputs::report_comdat_group): New function.
4520         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4521         data for incremental input file entry.
4522         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4523         (Incremental_input_entry_reader::get_input_section): Adjust size of
4524         data for incremental input file entry.
4525         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4526         (Incremental_input_entry_reader::get_comdat_group_signature): New
4527         function.
4528         * object.cc (Sized_relobj::include_section_group): Report kept
4529         COMDAT groups for incremental links.
4530
4531 2011-05-24  David Meyer  <pdox@google.com>
4532
4533         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4534         with name parameter.  Add found_name parameter.
4535         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4536         * dirsearch.h (class Dirsearch): Update declaration.
4537
4538 2011-05-24  Ian Lance Taylor  <iant@google.com>
4539
4540         * archive.cc (Library_base::should_include_member): Pull in object
4541         from archive if it defines the entry symbol.
4542         * parameters.cc (Parameters::entry): New function.
4543         * parameters.h (class Parameters): Declare entry.
4544         * output.h (class Output_file_header): Remove entry_ field.
4545         * output.cc (Output_file_header::Output_file_header): Remove entry
4546         parameter.  Change all callers.
4547         (Output_file_header::entry): Use parameters->entry.
4548         * gold.cc (queue_middle_tasks): Likewise.
4549         * plugin.cc (Plugin_hook::run): Likewise.
4550
4551 2011-05-24 Cary Coutant  <ccoutant@google.com>
4552
4553         * gold.cc (queue_initial_tasks): Pass incremental base filename
4554         to Output_file::open_base_file; don't print error message.
4555         * incremental-dump.cc (main): Adjust call to
4556         Output_file::open_for_modification.
4557         * incremental-dump.cc (main): Likewise.
4558         * incremental.cc (Incremental_inputs::report_command_line):
4559         Ignore --incremental-base option when comparing command lines.
4560         Ignore parameter when given as separate argument.
4561         * options.h (class General_options): Add --incremental-base.
4562         * output.cc (Output_file::Output_file):
4563         (Output_file::open_base_file): Add base_name and writable parameters;
4564         read base file into new file; print error message here.
4565         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4566         callers.
4567         * output.h (Output_file::open_for_modification): Rename to...
4568         (Output_file::open_base_file): ...this; add base_name and
4569         writable parameters; adjust all callers.
4570         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4571         callers.
4572         * testsuite/Makefile.am (incremental_test_4): Test
4573         --incremental-base.
4574         * testsuite/Makefile.in: Regenerate.
4575
4576 2011-05-24 Cary Coutant  <ccoutant@google.com>
4577
4578         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4579         incremental_test_4.
4580         * testsuite/Makefile.in: Regenerate.
4581         * testsuite/two_file_test_1_v1.cc: New test source file.
4582         * testsuite/two_file_test_1b_v1.cc: New test source file.
4583         * testsuite/two_file_test_2_v1.cc: New test source file.
4584
4585 2011-05-24 Cary Coutant  <ccoutant@google.com>
4586
4587         * dynobj.h (Dynobj::do_dynobj): New function.
4588         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4589         flag and soname for shared objects.
4590         * incremental.cc (Incremental_inputs::report_object): Make
4591         either Incremental_object_entry or Incremental_dynobj_entry; add
4592         soname to string table.
4593         (Incremental_inputs::report_input_section): Add assertion.
4594         (Output_section_incremental_inputs::set_final_data_size): Adjust
4595         type of input file entry for shared libraries; adjust size of
4596         shared library info entry.
4597         (Output_section_incremental_inputs::write_input_files): Write
4598         as_needed flag for shared libraries.
4599         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4600         of input file entry for shared libraries; write soname.
4601         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4602         soname from incremental info.
4603         * incremental.h (enum Incremental_input_flags): Add
4604         INCREMENTAL_INPUT_AS_NEEDED.
4605         (Incremental_input_entry::Incremental_input_entry): Initialize new
4606         data member.
4607         (Incremental_input_entry::set_as_needed): New function.
4608         (Incremental_input_entry::as_needed): New function.
4609         (Incremental_input_entry::do_dynobj_entry): New function.
4610         (Incremental_input_entry::as_needed_): New data member.
4611         (Incremental_object_entry::Incremental_object_entry): Don't check
4612         for shared library.
4613         (Incremental_object_entry::do_type): Likewise.
4614         (class Incremental_dynobj_entry): New class.
4615         (Incremental_input_entry_reader::as_needed): New function.
4616         (Incremental_input_entry_reader::get_soname): New function.
4617         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4618         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4619         size of shared library info entry.
4620         * layout.cc (Layout::finish_dynamic_section): Don't test for
4621         incremental link when adding DT_NEEDED entries.
4622         * object.h (Object::Object): Initialize new data member.
4623         (Object::dynobj): New function.
4624         (Object::set_as_needed): New function.
4625         (Object::as_needed): New function.
4626         (Object::do_dynobj): New function.
4627         (Object::as_needed_): New data member.
4628
4629 2011-05-24 Cary Coutant  <ccoutant@google.com>
4630
4631         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4632         info; adjust display of GOT entries.
4633         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4634         vector of input objects; remove file_status_.
4635         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4636         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4637         got_plt reader; call target hooks to reserve GOT entries.
4638         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4639         of input file info header and GOT info entry.
4640         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4641         relocation info.
4642         (Got_plt_view_info::got_descriptor): Remove.
4643         (Got_plt_view_info::sym_index): New data member.
4644         (Got_plt_view_info::input_index): New data member.
4645         (Local_got_offset_visitor::visit): Write input file index.
4646         (Global_got_offset_visitor::visit): Write 0 for input file index.
4647         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4648         with sym_index and input_index.
4649         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4650         incremental info GOT entry; replace got_descriptor with input_index.
4651         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4652         map from input file index to object.
4653         (Sized_relobj_incr::do_layout): Replace direct data member reference
4654         with accessor function.
4655         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4656         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4657         Adjust size of input file info header.
4658         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4659         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4660         (Incremental_input_entry_reader::get_input_section): Adjust size of
4661         input file info header.
4662         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4663         of incremental info GOT entry.
4664         (Incremental_got_plt_reader::get_got_desc): Remove.
4665         (Incremental_got_plt_reader::get_got_symndx): New function.
4666         (Incremental_got_plt_reader::get_got_input_index): New function.
4667         (Sized_incremental_binary::Sized_incremental_binary): Remove
4668         file_status_; add input_objects_.
4669         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4670         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4671         (Sized_incremental_binary::file_is_unchanged): Remove.
4672         (Sized_incremental_binary::set_input_object): New function.
4673         (Sized_incremental_binary::input_object): New function.
4674         (Sized_incremental_binary::file_status_): Remove.
4675         (Sized_incremental_binary::input_objects_): New data member.
4676         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4677         references.
4678         (Sized_relobj_incr::invalid_address): Move to base class.
4679         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4680         class.
4681         (Sized_relobj_incr::do_output_section_offset): Likewise.
4682         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4683         (Sized_relobj_incr::section_offsets_): Likewise.
4684         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4685         function.
4686         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4687         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4688         with accessor function.
4689         (Sized_relobj_file::do_layout): Likewise.
4690         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4691         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4692         (Sized_relobj_file::compute_final_local_value): Replace refs to
4693         section_offsets_ with accessor function.
4694         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4695         * object.h (Relobj::Relobj): Initialize new data members.
4696         (Relobj::add_dyn_reloc): New function.
4697         (Relobj::first_dyn_reloc): New function.
4698         (Relobj::dyn_reloc_count): New function.
4699         (Relobj::first_dyn_reloc_): New data member.
4700         (Relobj::dyn_reloc_count_): New data member.
4701         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4702         references.
4703         (Sized_relobj::Address): New typedef.
4704         (Sized_relobj::invalid_address): Move here from child class.
4705         (Sized_relobj::Sized_relobj): Initialize new data members.
4706         (Sized_relobj::sized_relobj): New function.
4707         (Sized_relobj::is_output_section_offset_invalid): Move here from
4708         child class.
4709         (Sized_relobj::get_output_section_offset): Likewise.
4710         (Sized_relobj::local_has_got_offset): Likewise.
4711         (Sized_relobj::local_got_offset): Likewise.
4712         (Sized_relobj::set_local_got_offset): Likewise.
4713         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4714         (Sized_relobj::clear_got_offsets): New function.
4715         (Sized_relobj::section_offsets): Move here from child class.
4716         (Sized_relobj::do_output_section_offset): Likewise.
4717         (Sized_relobj::do_set_section_offset): Likewise.
4718         (Sized_relobj::Local_got_offsets): Likewise.
4719         (Sized_relobj::local_got_offsets_): Likewise.
4720         (Sized_relobj::section_offsets_): Likewise.
4721         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4722         references.
4723         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4724         class.
4725         (Sized_relobj_file::sized_relobj): New function
4726         (Sized_relobj_file::local_has_got_offset): Move to base class.
4727         (Sized_relobj_file::local_got_offset): Likewise.
4728         (Sized_relobj_file::set_local_got_offset): Likewise.
4729         (Sized_relobj_file::get_output_section_offset): Likewise.
4730         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4731         (Sized_relobj_file::do_output_section_offset): Likewise.
4732         (Sized_relobj_file::do_set_section_offset): Likewise.
4733         (Sized_relobj_file::Local_got_offsets): Likewise.
4734         (Sized_relobj_file::local_got_offsets_): Likewise.
4735         (Sized_relobj_file::section_offsets_): Likewise.
4736         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4737         (all constructors).
4738         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4739         (Output_reloc::get_symbol_index): Likewise.
4740         (Output_reloc::local_section_offset): Likewise.
4741         (Output_reloc::get_address): Likewise.
4742         (Output_reloc::symbol_value): Likewise.
4743         (Output_data_got::reserve_slot): Move to class definition.
4744         (Output_data_got::reserve_local): New function.
4745         (Output_data_got::reserve_slot_for_global): Remove.
4746         (Output_data_got::reserve_global): New function.
4747         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4748         (all constructors, two instantiations).
4749         (Output_reloc::get_relobj): New function (two instantiations).
4750         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4751         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4752         (Output_data_reloc::add_global): Adjust type of relobj.
4753         (Output_data_reloc::add_global_relative): Likewise.
4754         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4755         (Output_data_reloc::add_local): Likewise.
4756         (Output_data_reloc::add_local_relative): Likewise.
4757         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4758         (Output_data_reloc::add_local_section): Likewise.
4759         (Output_data_reloc::add_output_section): Likewise.
4760         (Output_data_reloc::add_absolute): Likewise.
4761         (Output_data_reloc::add_target_specific): Likewise.
4762         (Output_data_got::reserve_slot): Move definition here.
4763         (Output_data_got::reserve_local): New function.
4764         (Output_data_got::reserve_global): New function.
4765         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4766         section_offsets_ with accessor function.
4767         (Sized_relobj_file::write_sections): Likewise.
4768         (Sized_relobj_file::do_relocate_sections): Likewise.
4769         * target.h (Sized_target::reserve_local_got_entry): New function.
4770         (Sized_target::reserve_global_got_entry): New function.
4771         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4772         (Target_x86_64::reserve_global_got_entry): New function.
4773         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4774
4775 2011-05-23 Cary Coutant  <ccoutant@google.com>
4776
4777         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4778         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4779         bit when checking got_type.
4780         * incremental.cc (Sized_incremental_binary::setup_readers):
4781         Store symbol table and string table locations; initialize bit vector
4782         of file status flags.
4783         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4784         unchanged files.
4785         (Sized_incremental_binary::do_process_got_plt): New function.
4786         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4787         (Output_section_incremental_inputs::set_final_data_size): Record
4788         file index for each input file.
4789         (Output_section_incremental_inputs::write_got_plt): Store file index
4790         instead of input entry offset for each GOT entry.
4791         * incremental.h
4792         (Incremental_input_entry::Incremental_input_entry): Initialize new
4793         data member.
4794         (Incremental_input_entry::set_offset): Store file index.
4795         (Incremental_input_entry::get_file_index): New function.
4796         (Incremental_input_entry::file_index_): New data member.
4797         (Incremental_binary::process_got_plt): New function.
4798         (Incremental_binary::do_process_got_plt): New function.
4799         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4800         data members.
4801         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4802         (Sized_incremental_binary::set_file_is_unchanged): New function.
4803         (Sized_incremental_binary::file_is_unchanged): New function.
4804         (Sized_incremental_binary::do_process_got_plt): New function.
4805         (Sized_incremental_binary::file_status_): New data member.
4806         (Sized_incremental_binary::main_symtab_loc_): New data member.
4807         (Sized_incremental_binary::main_strtab_loc_): New data member.
4808         * output.cc (Output_data_got::Got_entry::write): Add case
4809         RESERVED_CODE.
4810         (Output_data_got::add_global): Call add_got_entry.
4811         (Output_data_got::add_global_plt): Likewise.
4812         (Output_data_got::add_global_with_rel): Likewise.
4813         (Output_data_got::add_global_with_rela): Likewise.
4814         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4815         (Output_data_got::add_global_pair_with_rela): Likewise.
4816         (Output_data_got::add_local): Call add_got_entry.
4817         (Output_data_got::add_local_plt): Likewise.
4818         (Output_data_got::add_local_with_rel): Likewise.
4819         (Output_data_got::add_local_with_rela): Likewise.
4820         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4821         (Output_data_got::add_local_pair_with_rela): Likewise.
4822         (Output_data_got::reserve_slot): New function.
4823         (Output_data_got::reserve_slot_for_global): New function.
4824         (Output_data_got::add_got_entry): New function.
4825         (Output_data_got::add_got_entry_pair): New function.
4826         (Output_section::add_output_section_data): Edit FIXME.
4827         * output.h
4828         (Output_section_data_build::Output_section_data_build): New
4829         constructor with size parameter.
4830         (Output_data_space::Output_data_space): Likewise.
4831         (Output_data_got::Output_data_got): Initialize new data member; new
4832         constructor with size parameter.
4833         (Output_data_got::add_constant): Call add_got_entry.
4834         (Output_data_got::reserve_slot): New function.
4835         (Output_data_got::reserve_slot_for_global): New function.
4836         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4837         (Output_data_got::add_got_entry): New function.
4838         (Output_data_got::add_got_entry_pair): New function.
4839         (Output_data_got::free_list_): New data member.
4840         * target.h (Sized_target::init_got_plt_for_update): New function.
4841         (Sized_target::register_global_plt_entry): New function.
4842         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4843         Initialize new data member; call init; add constructor with PLT count.
4844         (Output_data_plt_x86_64::init): New function.
4845         (Output_data_plt_x86_64::add_relocation): New function.
4846         (Output_data_plt_x86_64::reserve_slot): New function.
4847         (Output_data_plt_x86_64::free_list_): New data member.
4848         (Target_x86_64::init_got_plt_for_update): New function.
4849         (Target_x86_64::register_global_plt_entry): New function.
4850         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4851         incremental updates.
4852         (Output_data_plt_x86_64::add_relocation): New function.
4853         * testsuite/object_unittest.cc (Object_test): Set default options.
4854
4855 2011-05-16  Ian Lance Taylor  <iant@google.com>
4856
4857         * options.h (class General_options): Make -i a synonym for -r.
4858
4859 2011-05-16  Ian Lance Taylor  <iant@google.com>
4860
4861         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4862
4863 2011-05-10 Cary Coutant  <ccoutant@google.com>
4864
4865         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4866         strip_all (-s).
4867
4868 2011-05-06  Ian Lance Taylor  <iant@google.com>
4869
4870         * layout.cc (Layout::layout): If the output section flags change,
4871         update the ordering.
4872
4873 2011-04-25 Cary Coutant  <ccoutant@google.com>
4874
4875         * incremental-dump.cc (dump_incremental_inputs): Print local
4876         symbol info for each input file.
4877         * incremental.cc
4878         (Output_section_incremental_inputs::set_final_data_size): Add local
4879         symbol info to input file entries in incremental info.
4880         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4881         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4882         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4883         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4884         implementation.
4885         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4886         (Sized_incr_relobj::do_relocate): Write the local symbols.
4887         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4888         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4889         Adjust size of input file header.
4890         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4891         (Incremental_inputs_reader::get_local_symbol_count): New function.
4892         (Incremental_inputs_reader::get_input_section): Adjust size of input
4893         file header.
4894         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4895         (Sized_incr_relobj::This): New typedef.
4896         (Sized_incr_relobj::sym_size): New const data member.
4897         (Sized_incr_relobj::Local_symbol): New struct.
4898         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4899         (Sized_incr_relobj::do_local_symbol_offset): New function.
4900         (Sized_incr_relobj::local_symbol_count_): New data member.
4901         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4902         (Sized_incr_relobj::local_symbol_index_): New data member.
4903         (Sized_incr_relobj::local_symbol_offset_): New data member.
4904         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4905         (Sized_incr_relobj::local_symbols_): New data member.
4906         * object.h (Relobj::output_local_symbol_count): New function.
4907         (Relobj::local_symbol_offset): New function.
4908         (Relobj::do_output_local_symbol_count): New function.
4909         (Relobj::do_local_symbol_offset): New function.
4910         (Sized_relobj::do_output_local_symbol_count): New function.
4911         (Sized_relobj::do_local_symbol_offset): New function.
4912
4913 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4914
4915         * descriptors.cc (set_close_on_exec): New function.
4916         (Descriptors::open): Use set_close_on_exec.
4917         * output.cc (S_ISLNK): Define if not defined.
4918
4919 2011-04-22 Cary Coutant  <ccoutant@google.com>
4920
4921         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4922         global symbol map.
4923         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4924         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4925         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4926         relocations.
4927         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4928         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4929         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4930         * incremental.h
4931         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4932         function.
4933         (Incremental_binary::apply_incremental_relocs): New function.
4934         (Incremental_binary::do_apply_incremental_relocs): New function.
4935         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4936         data member.
4937         (Sized_incremental_binary::add_global_symbol): New function.
4938         (Sized_incremental_binary::global_symbol): New function.
4939         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4940         (Sized_incremental_binary::symbol_map_): New data member.
4941         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4942         * target.h (Sized_target::apply_relocation): New function.
4943         * target-reloc.h (apply_relocation): New function.
4944         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4945
4946 2011-04-22  Doug Kwan  <dougkwan@google.com>
4947
4948         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4949         flag of a SHT_ARM_EXIDX section.
4950         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4951         * testsuite/Makefile.in: Regenerate.
4952         * testsuite/arm_exidx_test.s: New file.
4953         * testsuite/arm_exidx_test.sh: Same.
4954
4955 2011-04-20 Cary Coutant  <ccoutant@google.com>
4956
4957         PR gold/12689
4958         * archive.h (Incremental_archive_entry::Archive_member):
4959         Initialize arg_serial_ (second constructor).
4960
4961 2011-04-17  Ian Lance Taylor  <iant@google.com>
4962
4963         * object.cc (Relocate_info::location): Simplify location string.
4964         * errors.cc (Errors::error_at_location): Don't print program
4965         name.
4966         (Errors::warning_at_location): Likewise.
4967         (Errors::undefined_symbol): Likewise.
4968         * testsuite/debug_msg.sh: Update accordingly.
4969
4970 2011-04-14 Cary Coutant  <ccoutant@google.com>
4971
4972         * gold/layout.cc (Layout::symtab_section_offset): New function.
4973         * gold/layout.h (Layout::symtab_section_offset): New function.
4974         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4975
4976 2011-04-12  Ian Lance Taylor  <iant@google.com>
4977
4978         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4979         with MREMAP_MAYMOVE.
4980         * output.h (class Output_file): Add map_is_allocated_ field.
4981         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4982         not available, provide stubs.  If mremap is not available, #define
4983         it to gold_mremap.
4984         (MREMAP_MAYMOVE): Define if not defined.
4985         (Output_file::Output_file): Initialize map_is_allocated_.
4986         (Output_file::resize): Check map_is_allocated_.
4987         (Output_file::map_anonymous): If mmap fails, use malloc.
4988         (Output_file::unmap): Don't do anything for an anonymous map.
4989         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4990         is not available, provide stubs.
4991         (File_read::View::~View): Use free rather than delete[].
4992         (File_read::make_view): Use malloc rather than new[].  If mmap
4993         fails, use malloc.
4994         (File_read::find_or_make_view): Use malloc rather than new[].
4995         * gold.h: Remove HAVE_REMAP code.
4996         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4997         exists.  Rename mremap to gold_mremap.  If mmap is not available
4998         don't do anything.
4999         * configure, config.in: Rebuild.
5000
5001 2011-04-11  Ian Lance Taylor  <iant@google.com>
5002
5003         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5004         initialize local variable v.
5005
5006 2011-04-11  Cary Coutant  <ccoutant@google.com>
5007
5008         * archive.cc (Archive::include_member): Adjust call to
5009         report_object.
5010         (Add_archive_symbols::run): Track argument serial numbers.
5011         (Lib_group::include_member): Likewise.
5012         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5013         * archive.h (Incremental_archive_entry::Archive_member):
5014         Initialize arg_serial_.
5015         (Archive_member::arg_serial_): New data member.
5016         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5017         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5018         incremental link.
5019         (Sized_dynobj::do_for_all_local_got_entries): New function.
5020         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5021         function.
5022         * fileread.cc (get_mtime): New function.
5023         * fileread.h (get_mtime): New function.
5024         * gold.cc (queue_initial_tasks): Check for incremental update.
5025         (process_incremental_input): New function.
5026         (queue_middle_tasks): Don't force valid target for incremental
5027         update.
5028         * incremental-dump.cc (find_input_containing_global): Adjust
5029         size of symbol info entry.
5030         (dump_incremental_inputs): Dump argument serial number and
5031         in_system_directory flag; bias shndx by 1; print symbol names
5032         when dumping per-file symbol lists; use new symbol info readers.
5033         * incremental.cc
5034         (Output_section_incremental_inputs:update_data_size): New function.
5035         (Sized_incremental_binary::setup_readers): Setup input readers
5036         for each input file; build maps for files added from libraries
5037         and scripts.
5038         (Sized_incremental_binary::check_input_args): New function.
5039         (Sized_incremental_binary::do_check_inputs): Build map of argument
5040         serial numbers to input arguments.
5041         (Sized_incremental_binary::do_file_has_changed): Rename
5042         do_file_is_unchanged to this; compare file modification times.
5043         (Sized_incremental_binary::do_init_layout): New function.
5044         (Sized_incremental_binary::do_reserve_layout): New function.
5045         (Sized_incremental_binary::do_get_input_reader): Remove.
5046         (Sized_incremental_binary::get_symtab_view): New function.
5047         (Incremental_checker::can_incrementally_link_output_file): Remove.
5048         (Incremental_inputs::report_command_line): Exclude --debug options.
5049         (Incremental_inputs::report_archive_begin): Add parameter; track
5050         argument serial numbers; don't put input file entry for archive
5051         before archive members.
5052         (Incremental_inputs::report_archive_end): Put input file entry
5053         for archive after archive members.
5054         (Incremental_inputs::report_object): Add parameter; track argument
5055         serial numbers and in_system_directory flag.
5056         (Incremental_inputs::report_script): Add parameter; track argument
5057         serial numbers.
5058         (Output_section_incremental_inputs::set_final_data_size): Adjust
5059         size of symbol info entry; check for forwarding symbols.
5060         (Output_section_incremental_inputs::write_input_files): Write
5061         in_system_directory flag and argument serial number.
5062         (Output_section_incremental_inputs::write_info_blocks): Map section
5063         indices between incremental info and original input file; store
5064         input section index for each symbol.
5065         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5066         change operator() to visit().
5067         (class Global_got_offset_visitor): Likewise.
5068         (class Global_symbol_visitor_got_plt):
5069         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5070         classes.
5071         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5072         (Sized_incr_relobj::do_read_symbols): New function.
5073         (Sized_incr_relobj::do_layout): New function.
5074         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5075         (Sized_incr_relobj::do_add_symbols): New function.
5076         (Sized_incr_relobj::do_should_include_member): New function.
5077         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5078         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5079         (Sized_incr_relobj::do_section_size): New function.
5080         (Sized_incr_relobj::do_section_name): New function.
5081         (Sized_incr_relobj::do_section_contents): New function.
5082         (Sized_incr_relobj::do_section_flags): New function.
5083         (Sized_incr_relobj::do_section_entsize): New function.
5084         (Sized_incr_relobj::do_section_address): New function.
5085         (Sized_incr_relobj::do_section_type): New function.
5086         (Sized_incr_relobj::do_section_link): New function.
5087         (Sized_incr_relobj::do_section_info): New function.
5088         (Sized_incr_relobj::do_section_addralign): New function.
5089         (Sized_incr_relobj::do_initialize_xindex): New function.
5090         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5091         (Sized_incr_relobj::do_read_relocs): New function.
5092         (Sized_incr_relobj::do_gc_process_relocs): New function.
5093         (Sized_incr_relobj::do_scan_relocs): New function.
5094         (Sized_incr_relobj::do_count_local_symbols): New function.
5095         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5096         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5097         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5098         (Sized_incr_relobj::do_relocate): New function.
5099         (Sized_incr_relobj::do_set_section_offset): New function.
5100         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5101         (Sized_incr_dynobj::do_read_symbols): New function.
5102         (Sized_incr_dynobj::do_layout): New function.
5103         (Sized_incr_dynobj::do_add_symbols): New function.
5104         (Sized_incr_dynobj::do_should_include_member): New function.
5105         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5106         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5107         (Sized_incr_dynobj::do_section_size): New function.
5108         (Sized_incr_dynobj::do_section_name): New function.
5109         (Sized_incr_dynobj::do_section_contents): New function.
5110         (Sized_incr_dynobj::do_section_flags): New function.
5111         (Sized_incr_dynobj::do_section_entsize): New function.
5112         (Sized_incr_dynobj::do_section_address): New function.
5113         (Sized_incr_dynobj::do_section_type): New function.
5114         (Sized_incr_dynobj::do_section_link): New function.
5115         (Sized_incr_dynobj::do_section_info): New function.
5116         (Sized_incr_dynobj::do_section_addralign): New function.
5117         (Sized_incr_dynobj::do_initialize_xindex): New function.
5118         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5119         (make_sized_incremental_object): New function.
5120         (Incremental_library::copy_unused_symbols): New function.
5121         (Incremental_library::do_for_all_unused_symbols): New function.
5122         * incremental.h (enum Incremental_input_flags): New type.
5123         (class Incremental_checker): Remove.
5124         (Incremental_input_entry::Incremental_input_entry): Add argument
5125         serial number.
5126         (Incremental_input_entry::arg_serial): New function.
5127         (Incremental_input_entry::set_is_in_system_directory): New function.
5128         (Incremental_input_entry::is_in_system_directory): New function.
5129         (Incremental_input_entry::arg_serial_): New data member.
5130         (Incremental_input_entry::is_in_system_directory_): New data member.
5131         (class Script_info): Move here from script.h.
5132         (Script_info::Script_info): Add filename parameter.
5133         (Script_info::filename): New function.
5134         (Script_info::filename_): New data member.
5135         (Incremental_script_entry::Incremental_script_entry): Add argument
5136         serial number.
5137         (Incremental_object_entry::Incremental_object_entry): Likewise.
5138         (Incremental_object_entry::add_input_section): Build list of input
5139         sections with map to original shndx.
5140         (Incremental_object_entry::get_input_section_index): New function.
5141         (Incremental_object_entry::shndx_): New data member.
5142         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5143         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5144         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5145         serial number.
5146         (Incremental_inputs::report_archive_begin): Likewise.
5147         (Incremental_inputs::report_object): Likewise.
5148         (Incremental_inputs::report_script): Likewise.
5149         (class Incremental_global_symbol_reader): New class.
5150         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5151         and store flags and input file type.
5152         (Incremental_input_entry_reader::arg_serial): New function.
5153         (Incremental_input_entry_reader::type): Extract type from flags.
5154         (Incremental_input_entry_reader::is_in_system_directory): New function.
5155         (Incremental_input_entry_reader::get_input_section_count): Call
5156         accessor function for type.
5157         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5158         function for type; adjust size of global symbol entry.
5159         (Incremental_input_entry_reader::get_global_symbol_count): Call
5160         accessor function for type.
5161         (Incremental_input_entry_reader::get_object_count): Likewise.
5162         (Incremental_input_entry_reader::get_object_offset): Likewise.
5163         (Incremental_input_entry_reader::get_member_count): Likewise.
5164         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5165         (Incremental_input_entry_reader::get_member_offset): Likewise.
5166         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5167         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5168         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5169         (Incremental_input_entry_reader::get_global_symbol_reader): New
5170         function.
5171         (Incremental_input_entry_reader::get_output_symbol_index): New
5172         function.
5173         (Incremental_input_entry_reader::type_): Remove.
5174         (Incremental_input_entry_reader::flags_): New data member.
5175         (Incremental_inputs_reader::input_file_offset): New function.
5176         (Incremental_inputs_reader::input_file_index): New function.
5177         (Incremental_inputs_reader::input_file): Call input_file_offset.
5178         (Incremental_inputs_reader::input_file_at_offset): New function.
5179         (Incremental_relocs_reader::get_r_type): Reformat.
5180         (Incremental_relocs_reader::get_r_shndx): Reformat.
5181         (Incremental_relocs_reader::get_r_offset): Reformat.
5182         (Incremental_relocs_reader::data): New function.
5183         (Incremental_binary::Incremental_binary): Initialize new data members.
5184         (Incremental_binary::check_inputs): Add cmdline parameter.
5185         (Incremental_binary::file_is_unchanged): Remove.
5186         (Input_reader::arg_serial): New function.
5187         (Input_reader::get_unused_symbol_count): New function.
5188         (Input_reader::get_unused_symbol): New function.
5189         (Input_reader::do_arg_serial): New function.
5190         (Input_reader::do_get_unused_symbol_count): New function.
5191         (Input_reader::do_get_unused_symbol): New function.
5192         (Incremental_binary::input_file_count): New function.
5193         (Incremental_binary::get_input_reader): Change signature to use
5194         index instead of filename.
5195         (Incremental_binary::file_has_changed): New function.
5196         (Incremental_binary::get_input_argument): New function.
5197         (Incremental_binary::get_library): New function.
5198         (Incremental_binary::get_script_info): New function.
5199         (Incremental_binary::init_layout): New function.
5200         (Incremental_binary::reserve_layout): New function.
5201         (Incremental_binary::output_file): New function.
5202         (Incremental_binary::do_check_inputs): New function.
5203         (Incremental_binary::do_file_is_unchanged): Remove.
5204         (Incremental_binary::do_file_has_changed): New function.
5205         (Incremental_binary::do_init_layout): New function.
5206         (Incremental_binary::do_reserve_layout): New function.
5207         (Incremental_binary::do_input_file_count): New function.
5208         (Incremental_binary::do_get_input_reader): Change signature.
5209         (Incremental_binary::input_args_map_): New data member.
5210         (Incremental_binary::library_map_): New data member.
5211         (Incremental_binary::script_map_): New data member.
5212         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5213         new data members.
5214         (Sized_incremental_binary::output_section): New function.
5215         (Sized_incremental_binary::inputs_reader): Add const.
5216         (Sized_incremental_binary::symtab_reader): Add const.
5217         (Sized_incremental_binary::relocs_reader): Add const.
5218         (Sized_incremental_binary::got_plt_reader): Add const.
5219         (Sized_incremental_binary::get_symtab_view): New function.
5220         (Sized_incremental_binary::Inputs_reader): New typedef.
5221         (Sized_incremental_binary::Input_entry_reader): New typedef.
5222         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5223         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5224         (Sized_incremental_binary::do_file_has_changed): New function.
5225         (Sized_incremental_binary::do_init_layout): New function.
5226         (Sized_incremental_binary::do_reserve_layout): New function.
5227         (Sized_input_reader::Inputs_reader): Remove.
5228         (Sized_input_reader::Input_entry_reader): Remove.
5229         (Sized_input_reader::do_arg_serial): New function.
5230         (Sized_input_reader::do_get_unused_symbol_count): New function.
5231         (Sized_input_reader::do_get_unused_symbol): New function.
5232         (Sized_incremental_binary::do_input_file_count): New function.
5233         (Sized_incremental_binary::do_get_input_reader): Change signature;
5234         use index instead of filename.
5235         (Sized_incremental_binary::section_map_): New data member.
5236         (Sized_incremental_binary::input_entry_readers_): New data member.
5237         (class Sized_incr_relobj): New class.
5238         (class Sized_incr_dynobj): New class.
5239         (make_sized_incremental_object): New function.
5240         (class Incremental_library): New class.
5241         * layout.cc (Free_list::num_lists): New static data member.
5242         (Free_list::num_nodes): New static data member.
5243         (Free_list::num_removes): New static data member.
5244         (Free_list::num_remove_visits): New static data member.
5245         (Free_list::num_allocates): New static data member.
5246         (Free_list::num_allocate_visits): New static data member.
5247         (Free_list::init): New function.
5248         (Free_list::remove): New function.
5249         (Free_list::allocate): New function.
5250         (Free_list::dump): New function.
5251         (Free_list::print_stats): New function.
5252         (Layout_task_runner::run): Resize output file for incremental updates.
5253         (Layout::Layout): Initialize new data members.
5254         (Layout::set_incremental_base): New function.
5255         (Layout::init_fixed_output_section): New function.
5256         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5257         incremental updates.
5258         (Layout::create_gold_note): Do not create gold note section for
5259         incremental updates.
5260         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5261         for incremental updates.
5262         (Layout::set_section_offsets): For incremental updates, allocate space
5263         from free list.
5264         (Layout::create_symtab_sections): Layout with offsets relative to
5265         start of section; for incremental updates, allocate space from free
5266         list.
5267         (Layout::create_shdrs): For incremental updates, allocate space from
5268         free list.
5269         (Layout::finish_dynamic_section): For incremental updates, do not
5270         check --as-needed (fixed in subsequent patch).
5271         * layout.h (class Free_list): New class.
5272         (Layout::set_incremental_base): New function.
5273         (Layout::incremental_base): New function.
5274         (Layout::init_fixed_output_section): New function.
5275         (Layout::allocate): New function.
5276         (Layout::incremental_base_): New data member.
5277         (Layout::free_list_): New data member.
5278         * main.cc (main): Print Free_list statistics.
5279         * object.cc (Relobj::finalize_incremental_relocs): Add
5280         clear_counts parameter; clear counts only when clear_counts is set.
5281         (Sized_relobj::Sized_relobj): Initialize new base class.
5282         (Sized_relobj::do_layout): Don't report special sections.
5283         (Sized_relobj::do_for_all_local_got_entries): New function.
5284         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5285         symtab_off to all symbol table offsets.
5286         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5287         * object.h (class Got_offset_list): Move to top of file.
5288         (Object::Object): Allow case where input_file == NULL.
5289         (Object::~Object): Likewise.
5290         (Object::input_file): Assert that input_file != NULL.
5291         (Object::lock): Allow case where input_file == NULL.
5292         (Object::unlock): Likewise.
5293         (Object::is_locked): Likewise.
5294         (Object::token): Likewise.
5295         (Object::release): Likewise.
5296         (Object::is_incremental): New function.
5297         (Object::get_mtime): New function.
5298         (Object::for_all_local_got_entries): New function.
5299         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5300         (Object::set_is_in_system_directory): New function.
5301         (Object::is_in_system_directory): New function.
5302         (Object::do_is_incremental): New function.
5303         (Object::do_get_mtime): New function.
5304         (Object::do_for_all_local_got_entries): New function.
5305         (Object::is_in_system_directory_): New data member.
5306         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5307         (class Sized_relobj_base): New class.
5308         (class Sized_relobj): Derive from Sized_relobj_base.
5309         (class Sized_relobj::Symbols): Redeclare from base class.
5310         (class Sized_relobj::local_got_offset_list): Remove.
5311         (class Sized_relobj::Output_sections): Redeclare from base class.
5312         (class Sized_relobj::do_for_all_local_got_entries): New function.
5313         (class Sized_relobj::write_local_symbols): Add offset parameter.
5314         (class Sized_relobj::local_symbol_offset_): Update comment.
5315         (class Sized_relobj::local_dynsym_offset_): Update comment.
5316         * options.cc (Input_arguments::add_file): Remove const.
5317         * options.h (Input_file_argument::Input_file_argument):
5318         Initialize arg_serial_ (all constructors).
5319         (Input_file_argument::set_arg_serial): New function.
5320         (Input_file_argument::arg_serial): New function.
5321         (Input_file_argument::arg_serial_): New data member.
5322         (Input_arguments::Input_arguments): Initialize file_count_.
5323         (Input_arguments::add_file): Remove const.
5324         (Input_arguments::number_of_input_files): New function.
5325         (Input_arguments::file_count_): New data member.
5326         (Command_line::number_of_input_files): Call
5327         Input_arguments::number_of_input_files.
5328         * output.cc (Output_segment_headers::Output_segment_headers):
5329         Set current size.
5330         (Output_section::Input_section::current_data_size): New function.
5331         (Output_section::Output_section): Initialize new data members.
5332         (Output_section::add_input_section): Don't do merge sections for
5333         an incremental link; allocate space from free list for an
5334         incremental update.
5335         (Output_section::add_output_section_data): Allocate space from
5336         free list for an incremental update.
5337         (Output_section::update_data_size): New function.
5338         (Output_section::set_fixed_layout): New function.
5339         (Output_section::reserve): New function.
5340         (Output_segment::set_section_addresses): Remove const.
5341         (Output_segment::set_section_list_addresses): Remove const; allocate
5342         space from free list for an incremental update.
5343         (Output_segment::set_offset): Adjust size of RELRO segment for an
5344         incremental update.
5345         * output.h (Output_data::current_data_size): Move here from
5346         child classes.
5347         (Output_data::pre_finalize_data_size): New function.
5348         (Output_data::update_data_size): New function.
5349         (Output_section_headers::update_data_size): new function.
5350         (Output_section_data_build::current_data_size): Move to Output_data.
5351         (Output_data_strtab::update_data_size): New function.
5352         (Output_section::current_data_size): Move to Output_data.
5353         (Output_section::set_fixed_layout): New function.
5354         (Output_section::has_fixed_layout): New function.
5355         (Output_section::reserve): New function.
5356         (Output_section::update_data_size): New function.
5357         (Output_section::has_fixed_layout_): New data member.
5358         (Output_section::free_list_): New data member.
5359         (Output_segment::set_section_addresses): Remove const.
5360         (Output_segment::set_section_list_addresses): Remove const.
5361         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5362         New function.
5363         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5364         New function.
5365         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5366         parameter when calling Add_symbols constructor; store argument
5367         serial number for members of a lib group.
5368         (Add_symbols::locks): Allow case where token == NULL.
5369         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5370         (Read_member::~Read_member): New function.
5371         (Read_member::is_runnable): New function.
5372         (Read_member::locks): New function.
5373         (Read_member::run): New function.
5374         (Check_script::~Check_script): New function.
5375         (Check_script::is_runnable): New function.
5376         (Check_script::locks): New function.
5377         (Check_script::run): New function.
5378         (Check_library::~Check_library): New function.
5379         (Check_library::is_runnable): New function.
5380         (Check_library::locks): New function.
5381         (Check_library::run): New function.
5382         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5383         (Add_symbols::library_): New data member.
5384         (class Read_member): New class.
5385         (class Check_script): New class.
5386         (class Check_library): New class.
5387         * reloc.cc (Read_relocs::is_runnable): Allow case where
5388         token == NULL.
5389         (Read_relocs::locks): Likewise.
5390         (Scan_relocs::locks): Likewise.
5391         (Relocate_task::locks): Likewise.
5392         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5393         to clear counters.
5394         (Sized_relobj::incremental_relocs_scan): Fix comment.
5395         (Sized_relobj::do_relocate): Pass output file offset to
5396         write_local_symbols.
5397         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5398         from class declaration.
5399         * script.cc (read_input_script): Allocate Script_info; pass
5400         argument serial number to report_script.
5401         * script.h (class Script_info): Move to incremental.h.
5402         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5403         * symtab.h (Symbol_table::add_from_incrobj): New function.
5404         (Symbol_table::set_file_offset): New function.
5405
5406 2011-04-05  Cary Coutant  <ccoutant@google.com>
5407
5408         * incremental-dump.cc (dump_incremental_inputs): Change signature
5409         to take a Sized_incremental_binary; change caller.  Use readers
5410         in Sized_incremental_binary.
5411         * incremental.cc
5412         (Sized_incremental_binary::find_incremental_inputs_sections):
5413         Rename do_find_incremental_inputs_sections to this.
5414         (Sized_incremental_binary::setup_readers): New function.
5415         (Sized_incremental_binary::do_check_inputs): Check
5416         has_incremental_info_ flag; move setup code to setup_readers;
5417         use input readers.
5418         (Sized_incremental_binary::do_file_is_unchanged): New function.
5419         (Sized_incremental_binary::do_get_input_reader): New function.
5420         * incremental.h (class Incremental_binary): Move to end of file.
5421         (Incremental_binary::file_is_unchanged): New function.
5422         (Incremental_binary::do_file_is_unchanged): New function.
5423         (Incremental_binary::Input_reader): New class.
5424         (Incremental_binary::get_input_reader): New function.
5425         (class Sized_incremental_binary): Move to end of file.
5426         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5427         input section reader classes.
5428         (Sized_incremental_binary::has_incremental_info): New function.
5429         (Sized_incremental_binary::inputs_reader): New function.
5430         (Sized_incremental_binary::symtab_reader): New function.
5431         (Sized_incremental_binary::relocs_reader): New function.
5432         (Sized_incremental_binary::got_plt_reader): New function.
5433         (Sized_incremental_binary::do_file_is_unchanged): New function.
5434         (Sized_incremental_binary::Sized_input_reader): New class.
5435         (Sized_incremental_binary::get_input_reader): New function.
5436         (Sized_incremental_binary::find_incremental_inputs_sections):
5437         Rename do_find_incremental_inputs_sections to this.
5438         (Sized_incremental_binary::setup_readers): New function.
5439         (Sized_incremental_binary::has_incremental_info_): New data member.
5440         (Sized_incremental_binary::inputs_reader_): New data member.
5441         (Sized_incremental_binary::symtab_reader_): New data member.
5442         (Sized_incremental_binary::relocs_reader_): New data member.
5443         (Sized_incremental_binary::got_plt_reader_): New data member.
5444         (Sized_incremental_binary::current_input_file_): New data member.
5445
5446 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5447
5448         PR gold/12640
5449         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5450         violation.
5451
5452 2011-03-30  Cary Coutant  <ccoutant@google.com>
5453
5454         * archive.cc (Archive::include_member): Adjust call to report_object.
5455         (Add_archive_symbols::run): Add script_info to call to
5456         report_archive_begin.
5457         (Lib_group::include_member): Adjust call to report_object.
5458         (Add_lib_group_symbols::run): Adjust call to report_object.
5459         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5460         blocks.  Add object count for script input files.
5461         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5462         script_info parameter; change all callers.
5463         (Incremental_inputs::report_object): Add script_info parameter;
5464         change all callers.
5465         (Incremental_inputs::report_script): Store backpointer to
5466         incremental info entry.
5467         (Output_section_incremental_inputs::set_final_data_size): Record
5468         additional information for scripts.
5469         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5470         * incremental.h (Incremental_script_entry::add_object): New function.
5471         (Incremental_script_entry::get_object_count): New function.
5472         (Incremental_script_entry::get_object): New function.
5473         (Incremental_script_entry::objects_): New data member; adjust
5474         constructor.
5475         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5476         (Incremental_inputs::report_object): Add script_info parameter.
5477         (Incremental_inputs_reader::get_object_count): New function.
5478         (Incremental_inputs_reader::get_object_offset): New function.
5479         * options.cc (Input_arguments::add_file): Return reference to
5480         new input argument.
5481         * options.h (Input_argument::set_script_info): New function.
5482         (Input_argument::script_info): New function.
5483         (Input_argument::script_info_): New data member; adjust all
5484         constructors.
5485         (Input_file_group::add_file): Return reference to new input argument.
5486         (Input_file_lib::add_file): Likewise.
5487         (Input_arguments::add_file): Likewise.
5488         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5489         * script.cc (Parser_closure::Parser_closure): Add script_info
5490         parameter; adjust all callers.
5491         (Parser_closure::script_info): New function.
5492         (Parser_closure::script_info_): New data member.
5493         (read_input_script): Report scripts earlier to incremental info.
5494         (script_add_file): Set script_info in Input_argument.
5495         (script_add_library): Likewise.
5496         * script.h (Script_options::Script_info): Rewrite class.
5497
5498 2011-03-29  Cary Coutant  <ccoutant@google.com>
5499
5500         * archive.cc (Library_base::should_include_member): Move
5501         method here from class Archive.
5502         (Archive::Archive): Initialize base class.
5503         (Archive::should_include_member): Move to base class.
5504         (Archive::do_for_all_unused_symbols): New function.
5505         (Add_archive_symbols::run): Remove redundant access to
5506         incremental_inputs.
5507         (Lib_group::Lib_group): Initialize base class.
5508         (Lib_group::do_filename): New function.
5509         (Lib_group::include_member): Pass pointer to Lib_group to
5510         report_object.
5511         (Lib_group::do_for_all_unused_symbols): New function.
5512         (Add_lib_group_symbols::run): Report archive information for
5513         incremental links.
5514         * archive.h (class Library_base): New base class.
5515         (class Archive): Derive from Library_base.
5516         (Archive::filename): Move to base class.
5517         (Archive::set_incremental_info): Likewise.
5518         (Archive::incremental_info): Likewise.
5519         (Archive::Should_include): Likewise.
5520         (Archive::should_include_member): Likewise.
5521         (Archive::Armap_entry): Remove.
5522         (Archive::Unused_symbol_iterator): Remove.
5523         (Archive::unused_symbols_begin): Remove.
5524         (Archive::unused_symbols_end): Remove.
5525         (Archive::do_filename): New function.
5526         (Archive::do_get_mtime): New function.
5527         (Archive::do_for_all_unused_symbols): New function.
5528         (Archive::task_): Move to base class.
5529         (Archive::incremental_info_): Likewise.
5530         (class Lib_group): Derive from Library_base.
5531         (Lib_group::do_filename): New function.
5532         (Lib_group::do_get_mtime): New function.
5533         (Lib_group::do_for_all_unused_symbols): New function.
5534         (Lib_group::task_): Move to base class.
5535         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5536         function.
5537         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5538         function.
5539         * incremental.cc (Incremental_inputs::report_archive_begin):
5540         Use Library_base; call library's get_mtime; add incremental inputs
5541         entry before members.
5542         (class Unused_symbol_visitor): New class.
5543         (Incremental_inputs::report_archive_end): Use Library_base; use
5544         visitor class to record unused symbols; don't add incremental inputs
5545         entry after members.
5546         (Incremental_inputs::report_object): Use Library_base.
5547         * incremental.h
5548         (Incremental_archive_entry::Incremental_archive_entry): Remove
5549         unused Archive parameter.
5550         (Incremental_inputs::report_archive_begin): Use Library_base.
5551         (Incremental_inputs::report_archive_end): Likewise.
5552         (Incremental_inputs::report_object): Likewise.
5553         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5554         function.
5555         * object.h (Object::for_all_global_symbols): New function.
5556         (Object::do_for_all_global_symbols): New function.
5557         (Sized_relobj::do_for_all_global_symbols): New function.
5558         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5559         function.
5560         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5561         function.
5562
5563 2011-03-27  Ian Lance Taylor  <iant@google.com>
5564
5565         * archive.cc (Archive::interpret_header): Return -1 if something
5566         goes wrong.  Change callers accordingly.
5567
5568 2011-03-25  Cary Coutant  <ccoutant@google.com>
5569
5570         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5571         * testsuite/Makefile.in: Regenerate.
5572
5573 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5574
5575         * plugin.cc (get_view): New.
5576         (Plugin::load): Pass get_view to the plugin.
5577         (Plugin_manager::get_view): New.
5578
5579 2011-03-21  Ian Lance Taylor  <iant@google.com>
5580
5581         * testsuite/final_layout.sh: Rewrite to not use dc.
5582         * testsuite/relro_test.sh: Fail if dc is not present.
5583
5584 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5585
5586         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5587         Change == to -eq.
5588         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5589         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5590         Change == to -eq.
5591         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5592         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5593
5594 2011-03-14  Ian Lance Taylor  <iant@google.com>
5595
5596         * script-sections.cc (Sort_output_sections::script_compare):
5597         Rename from is_before, change return type.
5598         (Sort_output_sections::operator()): Adjust accordingly.
5599
5600 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5601
5602         PR gold/12572
5603         * testsuite/odr_violation2.cc: Add comment to make all error line
5604         numbers double digits.
5605         * testsuite/debug_msg.sh: Adjust expected errors.
5606
5607 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5608
5609         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5610         but mark earlier ones as non-canonical
5611         (offset_to_iterator): Update search target and example
5612         (do_addr2line): Return extra lines in a vector*
5613         (format_file_lineno): Extract from do_addr2line
5614         (one_addr2line): Add vector* out-param
5615         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5616         when a lineno entry appeared last for its instruction
5617         (Dwarf_line_info): Add vector* out-param
5618         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5619         * symtab.cc (Odr_violation_compare): Include the lineno in the
5620         comparison again.
5621         (linenos_from_loc): New. Combine the canonical line for an
5622         address with its other lines.
5623         (True_if_intersect): New. Helper functor to make
5624         std::set_intersection a query.
5625         (detect_odr_violations): Compare sets of lines instead of just
5626         one line for each function. This became less deterministic, but
5627         has fewer false positives.
5628         * symtab.h: Declarations.
5629         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5630         mix an optimized and non-optimized object in the same binary
5631         (odr_violation2.so): Same.
5632         * testsuite/Makefile.in: Regenerate from Makefile.am.
5633         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5634         * testsuite/debug_msg.sh: Update line numbers and add
5635         assertions.
5636         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5637         non-optimized context.
5638         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5639         isn't inlined, and use OdrDerived in an optimized context.
5640         * testsuite/odr_header1.h: Defines OdrDerived, where
5641         optimization will change the
5642         first-instruction-in-the-destructor's file and line number.
5643         * testsuite/odr_header2.h: Defines OdrBase.
5644
5645 2011-03-09  Ian Lance Taylor  <iant@google.com>
5646
5647         * fileread.cc (File_read::clear_views): Don't delete the whole
5648         file view.
5649
5650 2011-03-08  Ian Lance Taylor  <iant@google.com>
5651
5652         PR gold/12525
5653         * fileread.cc: #include <climits>.
5654         (GOLD_IOV_MAX): Define.
5655         (File_read::read_multiple): Limit number of entries by iov_max.
5656         * fileread.h (class File_read): Always set max_readv_entries to
5657         128.
5658
5659 2011-03-07  Ian Lance Taylor  <iant@google.com>
5660
5661         PR gold/12525
5662         * options.h (class General_options): Add -dy and -dn.
5663
5664 2011-03-02  Cary Coutant  <ccoutant@google.com>
5665
5666         * testsuite/script_test_9.t: Add TLS segment.
5667
5668 2011-03-02  Simon Baldwin  <simonb@google.com>
5669
5670         * configure.ac: Add check for gnu_indirect_function support in
5671         the toolchain building binutils.
5672         * configure: Rebuild.
5673
5674 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5675
5676         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5677         plugin only symbols.
5678         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5679         in plugin files as not needed in the symbol table.
5680
5681 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5682
5683         * output.cc (Output_section::add_input_section): Delay fill
5684         generation for section ordering.
5685
5686 2011-02-09  Ian Lance Taylor  <iant@google.com>
5687
5688         PR gold/12316
5689         * object.h (class Sized_relobj): Remove clear_local_symbols.
5690         * reloc.cc (Sized_relobj::do_relocate): Don't call
5691         clear_local_symbols.
5692
5693 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5694
5695         * plugin.cc (is_visible_from_outside): Return true for symbols
5696         in the -u option.
5697
5698 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5699
5700         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5701         filename.
5702
5703 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5704
5705         * icf.h (is_section_foldable_candidate): Change type of parameter
5706         to std::string.
5707         * icf.cc (Icf::find_identical_sections): Change type of local variable
5708         section_name to be std::string.
5709         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5710
5711 2011-01-25  Ian Lance Taylor  <iant@google.com>
5712
5713         * script.cc (script_add_extern): Rewrite to use
5714         add_symbol_reference.
5715
5716 2011-01-25  Doug Kwan  <dougkwan@google.com>
5717
5718         * icf.cc (get_section_contents): Always lock section's object.
5719
5720 2011-01-24  Ian Lance Taylor  <iant@google.com>
5721
5722         * options.h (class General_options): Accept
5723         --no-detect-odr-violations.
5724
5725 2011-01-24  Ian Lance Taylor  <iant@google.com>
5726
5727         * version.cc (version_string): Bump to 1.11.
5728
5729 2011-01-24  Ian Lance Taylor  <iant@google.com>
5730
5731         * plugin.cc (class Plugin_rescan): Define new class.
5732         (Plugin_manager::claim_file): Set any_claimed_.
5733         (Plugin_manager::save_archive): New function.
5734         (Plugin_manager::save_input_group): New function.
5735         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5736         necessary.
5737         (Plugin_manager::new_undefined_symbol): New function.
5738         (Plugin_manager::rescan): New function.
5739         (Plugin_manager::rescannable_defines): New function.
5740         (Plugin_manager::add_input_file): Set any_added_.
5741         * plugin.h (class Plugin_manager): define new fields rescannable_,
5742         undefined_symbols_, any_claimed_, and any_added_.  Declare
5743         Plugin_rescan as friend.  Declare new functions.
5744         (Plugin_manager::Rescannable): Define type.
5745         (Plugin_manager::Rescannable_list): Define type.
5746         (Plugin_manager::Undefined_symbol_list): Define type.
5747         (Plugin_manager::Plugin_manager): Initialize new fields.
5748         * archive.cc (Archive::defines_symbol): New function.
5749         (Add_archive_symbols::run): Pass archive to plugins if any.
5750         * archive.h (class Archive): Declare defines_symbol.
5751         * readsyms.cc (Input_group::~Input_group): New function.
5752         (Finish_group::run): Pass input_group to plugins if any.
5753         * readsyms.h (class Input_group): Declare destructor.
5754         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5755         any.
5756
5757 2011-01-10  Ian Lance Taylor  <iant@google.com>
5758
5759         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5760         section as relro.
5761         (Layout::set_segment_offsets): Reset increase_relro before calling
5762         set_section_addresses a second time.
5763
5764 2011-01-04  Cary Coutant  <ccoutant@google.com>
5765
5766         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5767         sections before NOBITS sections.
5768
5769 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5770
5771         * version.cc (print_version): Update copyright to 2011.
5772
5773 2010-12-23  Cary Coutant  <ccoutant@google.com>
5774
5775         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5776         of OS to this->add.  Add OD parameter to second form of the function.
5777
5778 2010-12-20  Ian Lance Taylor  <iant@google.com>
5779
5780         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5781         second of two consecutive entries with same offset.
5782
5783 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5784
5785         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5786         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5787         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5788         to avoid unneeded links against $(LDADD).
5789         * testsuite/Makefile.in: Regenerate.
5790
5791 2010-12-15  Ian Lance Taylor  <iant@google.com>
5792
5793         PR gold/12324
5794         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5795         for R_X86_64_32 and R_X86_64_PC32.
5796         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5797         ver_matching_def_pic.o.
5798         (ver_matching_def_pic.o): New target.
5799
5800 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5801
5802         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5803         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5804         Move definition before File_read::View member definitions.
5805         (File_read::View::~View): Initialize and hold lock before
5806         updating current_mapped_bytes.
5807
5808 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5809
5810         * dwarf_reader.cc: Remove outdated comment.
5811         * gold-threads.cc: Fix typo in error message.
5812         * archive.cc: Fix typos in comments.
5813         * archive.h: Likewise.
5814         * arm-reloc-property.cc: Likewise.
5815         * arm-reloc-property.h: Likewise.
5816         * arm-reloc.def: Likewise.
5817         * arm.cc: Likewise.
5818         * attributes.h: Likewise.
5819         * cref.cc: Likewise.
5820         * ehframe.cc: Likewise.
5821         * fileread.h: Likewise.
5822         * gold.h: Likewise.
5823         * i386.cc: Likewise.
5824         * icf.cc: Likewise.
5825         * incremental.h: Likewise.
5826         * int_encoding.cc: Likewise.
5827         * layout.h: Likewise.
5828         * main.cc: Likewise.
5829         * merge.h: Likewise.
5830         * object.cc: Likewise.
5831         * object.h: Likewise.
5832         * options.cc: Likewise.
5833         * readsyms.cc: Likewise.
5834         * reduced_debug_output.cc: Likewise.
5835         * reloc.cc: Likewise.
5836         * script-sections.cc: Likewise.
5837         * sparc.cc: Likewise.
5838         * symtab.h: Likewise.
5839         * target-reloc.h: Likewise.
5840         * target.cc: Likewise.
5841         * target.h: Likewise.
5842         * timer.cc: Likewise.
5843         * timer.h: Likewise.
5844         * x86_64.cc: Likewise.
5845
5846 2010-12-09  Cary Coutant  <ccoutant@google.com>
5847
5848         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5849         stack.
5850         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5851         parameter; change all callers.
5852         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5853         * options.h (warn_execstack): New option.
5854
5855 2010-12-07  Doug Kwan  <dougkwan@google.com>
5856
5857         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5858         like function call relocations.
5859
5860 2010-12-07  Ian Lance Taylor  <iant@google.com>
5861
5862         * archive.cc (Archive::get_elf_object_for_member): Permit
5863         punconfigured to be NULL.
5864         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5865         (Archive::include_member): Pass NULL to get_elf_object_for_member
5866         if we searched for the archive and this is the first included
5867         object.
5868
5869 2010-12-01  Ian Lance Taylor  <iant@google.com>
5870
5871         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5872         track_relocs_type_ field.
5873         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5874         Set track_relocs_type_.
5875         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5876         contents when using RELA relocs.
5877         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5878         reloc_map_.
5879         * reloc.cc (Track_relocs::next_addend): New function.
5880         * reloc.h (class Track_relocs): Declare next_addend.
5881
5882 2010-12-01  Ian Lance Taylor  <iant@google.com>
5883
5884         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5885         virtual destructor.
5886
5887 2010-12-01  Ian Lance Taylor  <iant@google.com>
5888
5889         * README: Update compilers known to work and fail.
5890
5891 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5892
5893         * configure.in: For --enable-gold, handle value `default' instead of
5894         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5895         not the default.
5896         * configure: Regenerate.
5897
5898 2010-11-18  Doug Kwan  <dougkwan@google.com>
5899
5900         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5901         and right_alignment to be zero.  Store result alignment only if it is
5902         greater than existing alignment.
5903
5904 2010-11-16  Cary Coutant  <ccoutant@google.com>
5905
5906         PR gold/12220
5907         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5908         Check for ".zdebug_line".
5909
5910 2010-11-16  Doug Kwan  <dougkwan@google.com>
5911             Cary Coutant  <ccoutant@google.com>
5912
5913         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5914         by reference; adjust all callers.
5915         * output.cc (Output_segment::set_section_addresses): Adjust references
5916         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5917         list is empty.
5918         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5919         end at page boundary.
5920
5921 2010-11-16  Cary Coutant  <ccoutant@google.com>
5922
5923         PR gold/12220
5924         * layout.cc (Layout::choose_output_section): Transform names of
5925         compressed sections even when using a script with a SECTIONS clause.
5926         (Layout::output_section_name): Remove code to transform
5927         compressed debug section names.
5928         * output.cc (Output_section::add_input_section): Use uncompressed
5929         section size when tracking input sections.
5930
5931 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5932
5933         * symtab.h (Symbol::NON_PIC_REF): Remove.
5934         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5935         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5936         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5937         (Symbol::use_plt_offset): Take a flags argument and pass it
5938         directly to needs_dynamic_reloc.  Restrict check for undefined
5939         weak symbols to function calls.
5940         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5941         (Target_arm::Scan::global): Use it.
5942         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5943         (Target_arm::Relocate::relocate): Likewise.
5944         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5945         parameter with an r_type parameter.  Use get_reference_flags
5946         to get the flags.
5947         (Target_arm::Relocate::relocate): Update accordingly.
5948         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5949         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5950         (Target_i386::Scan::global): Likewise.
5951         (Target_i386::Relocate::relocate): Likewise.
5952         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5953         parameter with an r_type parameter.  Use get_reference_flags
5954         to get the flags.
5955         (Target_i386::Relocate::relocate): Update accordingly.
5956         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5957         (Target_powerpc::Scan::global): Use it.
5958         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5959         (Target_powerpc::Relocate::relocate): Likewise.
5960         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5961         (Target_sparc::Scan::global): Use it.
5962         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5963         (Target_sparc::Relocate::relocate): Likewise.
5964         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5965         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5966         (Target_x86_64::Scan::global): Likewise.
5967         (Target_x86_64::Relocate::relocate): Likewise.
5968
5969 2010-11-08  Doug Kwan  <dougkwan@google.com>
5970             Cary Coutant  <ccoutant@google.com>
5971
5972         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5973         (Arm_exidx_merge_section::section_contents_): New data member.
5974         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5975         (Arm_input_section::~Arm_input_section): De-allocate memory.
5976         (Arm_input_section::original_contents_): New data member.
5977         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5978         in parameters instead of calling Object::section_contents without
5979         locking.
5980         (Arm_output_section::group_section): New parameter TASK.  Pass it
5981         to callees that need locking objects.
5982         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5983         to lock EXIDX input sections.  Fix a formatting issue.  Call
5984         Arm_exidx_merged_section::build_contents to create merged section
5985         contents.
5986         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5987         to lock object of stub table owner.
5988         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5989         TEXT_SIZE to initialize data member TEXT_SIZE_.
5990         (Arm_exidx_input_section::addralign): Fix typo in comment.
5991         (Arm_exidx_input_section::text_size): New method.
5992         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5993         that require locking objects.  Lock objects before scanning for stubs
5994         and updating local symbols.
5995         (Arm_input_section<big_endian>::init): Copy contents of original
5996         input section.
5997         (Arm_input_section<big_endian>::do_write): Use saved contents of
5998         original input section instead of calling Object::section_contents
5999         without locking.
6000         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6001         size without calling Object::section_size().
6002         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6003         for size.  Allocate a buffer for merged EXIDX entries.
6004         (Arm_exidx_merged_section::build_contents): New method.
6005         (Arm_exidx_merged_section::do_write): Move merge section contents
6006         building code to Arm_exidx_merged_section::build_contetns.  Write
6007         out contetns in buffer instead of building it on the fly.
6008         (Arm_relobj::make_exidx_input_section): Also pass text section size
6009         to Arm_exidx_input_section constructor.
6010         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6011         (Arm_dynobj::do_read_symbols): Fix memory leak.
6012         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6013         * target.h: (class Task): Add forward declaration.
6014         (Target::relax): Add new parameter TASK and pass it to
6015         Target::do_relax().
6016         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6017
6018 2010-11-05  Cary Coutant  <ccoutant@google.com>
6019
6020         PR gold/10708
6021         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6022         object when reading from the file.
6023         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6024         second layout pass.
6025         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6026         when reading section contents.
6027         (get_section_contents): Likewise.
6028         (icf::find_identical_sections): Likewise.
6029         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6030         object when reading from the file.
6031         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6032         the object when doing deferred section layout.
6033
6034 2010-11-03  Nick Clifton  <nickc@redhat.com>
6035
6036         PR gold/12001
6037         * script.h (class Symbol_assignment: name): New member.  Returns
6038         the name of the symbol.
6039         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6040         Returns true if the given symbol name is on the list of
6041         assignments wating to be processed.
6042         * archive.cc (should_incldue_member): If the symbol is undefined,
6043         check to see if it is on the list of symbols pending assignment.
6044
6045 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6046
6047         * script-sections.cc (Script_sections::find_memory_region): Check
6048         for a NULL output section pointer.
6049
6050 2010-10-29  Doug Kwan  <dougkwan@google.com>
6051
6052         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6053         Output_section::add_relaxed_input_section.
6054         * output.cc (Output_section::add_relaxed_input_section): Add new
6055         arguments LAYOUT and NAME.  Set section order index.
6056         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6057         Copy section order index.
6058         * output.h (Output_section::add_relaxed_input_section): Add new
6059         arguments LAYOUT and NAME.
6060
6061 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6062
6063         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6064         NATIVE_OR_CROSS_LINKER.
6065         * testsuite/Makefile.in: Regenerate.
6066
6067 2010-10-20  Doug Kwan  <dougkwan@google.com>
6068
6069         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6070         without SHF_LINK_ORDER flags.
6071         * layout.cc (Layout::choose_output_section): Do not filter
6072         SHF_LINK_ORDER flag in a relocatable link.
6073
6074 2010-10-17  Cary Coutant  <ccoutant@google.com>
6075
6076         * output.h (Output_segment::set_section_addresses): Change function
6077         signature.  Update all callers.
6078         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6079         sections.
6080         (Output_segment::set_section_addresses): Align after last TLS
6081         section.  Add padding before last relro section instead of after.
6082
6083 2010-10-17  Doug Kwan  <dougkwan@google.com>
6084
6085         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6086         GOT output section to be writable.
6087
6088 2010-10-14  Cary Coutant  <ccoutant@google.com>
6089
6090         * debug.h (DEBUG_INCREMENTAL): New flag.
6091         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6092         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6093         mode.
6094         * incremental.cc (report_command_line): Ignore all forms of
6095         --incremental.
6096         * layout.cc (Layout::Layout): Check parameters for incremental link
6097         mode.
6098         * options.cc (General_options::parse_incremental): New function.
6099         (General_options::parse_no_incremental): New function.
6100         (General_options::parse_incremental_full): New function.
6101         (General_options::parse_incremental_update): New function.
6102         (General_options::incremental_mode_): New data member.
6103         (General_options::finalize): Check incremental_mode_.
6104         * options.h (General_options): Update help text for --incremental.
6105         Add --no-incremental, --incremental-full, --incremental-update.
6106         (General_options::Incremental_mode): New enum type.
6107         (General_options::incremental_mode): New function.
6108         (General_options::incremental_mode_): New data member.
6109         * parameters.cc (Parameters::incremental_mode_): New data member.
6110         (Parameters::set_options): Set incremental_mode_.
6111         (Parameters::set_incremental_full): New function.
6112         (Parameters::incremental): New function.
6113         (Parameters::incremental_update): New function.
6114         (set_parameters_incremental_full): New function.
6115         * parameters.h (Parameters::set_incremental_full): New function.
6116         (Parameters::incremental): New function.
6117         (Parameters::incremental_update): New function.
6118         (Parameters::incremental_mode_): New data member.
6119         (set_parameters_incremental_full): New function.
6120         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6121         incremental link mode.
6122         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6123         (Sized_relobj::do_relocate_sections): Likewise.
6124         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6125         option.
6126         * testsuite/Makefile.in: Regenerate.
6127         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6128
6129 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6130
6131         * script-sections.h (class Script_sections): Make
6132         Sections_elements typedef public.
6133         * script-sections.cc (class Sort_output_sections): Add elements_
6134         field.  Add constructor which sets it; change all callers.
6135         (Sort_output_sections::is_before): New function.
6136         (Sort_output_sections::operator()): Call is_before.
6137         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6138         conditional.
6139         * testsuite/script_test_10.sh: New test. Test script section
6140         order.
6141         * testsuite/script_test_10.t: Likewise.
6142         * testsuite/script_test_10.s: Likewise.
6143         * testsuite/Makefile.am: Wrap the cross linker tests and the
6144         common tests into NATIVE_OR_CROSS_LINKER.
6145         (check_SCRIPTS): Add script_test_10.sh.
6146         (check_DATA): Add script_test_10.stdout.
6147         (script_test_10.o, script_test_10): New targets.
6148         (script_test_10.stdout): New target.
6149         * configure, testsuite/Makefile.in: Regenerate.
6150
6151 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6152
6153         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6154         error for the deprecated relocations.
6155         (Target_arm::Scan::global): Likewise.
6156         (Target_arm::Relocate::relocate): Likewise.
6157
6158 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6159
6160         * fileread.cc (Input_file::find_file): Initialize *found_name
6161         and *namep when using the fallback search for case 4.
6162
6163 2010-10-11  Cary Coutant  <ccoutant@google.com>
6164
6165         * options.h (class General_options): Redefine -z lazy as an alias for
6166         the negation of -z now.
6167
6168 2010-10-11  Ian Lance Taylor  <iant@google.com>
6169
6170         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6171         binding.
6172
6173 2010-10-06  Nick Clifton  <nickc@redhat.com>
6174
6175         * script-sections.cc(class Memory_region): Remove
6176         current_lma_offset_ field.  Rename current_vma_offset_ to
6177         current_offset_.  Add last_section_ field.
6178         (Memory_region::get_current_vma_address): Rename to
6179         get_current_address.
6180         (Memory_region::get_current_lma_address): Delete.
6181         (Memory_region::increment_vma_offset): Rename to
6182         increment_offset.
6183         (Memory_region::increment_lma_offset): Delete.
6184         (Memory_region::attributes_compatible): New method.  Returns
6185         true if the provided section is compatible with the region.
6186         (Memory_region::get_last_section): New method.  Returns the last
6187         section to use the region.
6188         (Memory_region::set_last_section): New method.  Stores the last
6189         section to use the region.
6190         (Script_sections::block_in_region): New method.  Returns true if
6191         a block of memory is contained within a region.
6192         (Script_sections::find_memory_region): New method.  Locates a
6193         memory region to be used to set a VMA or LMA address.
6194         (Output_section_definition::set_section_addresses): Add code to
6195         check for addresses set by memory regions.
6196         (Output_segment::set_section_addresses): Remove memory region
6197         walking code.
6198         (Script_sections::create_segment): Add a warning if a header
6199         segment is created outside of any region.
6200         * script-sections.h (class Script_sections): Add prototypes for
6201         find_memory_region and block_in_region methods.
6202         * testsuite/memory_test.s: Use .long instead of .word.
6203         * testsuite/memory_test.t: Add some more output sections.
6204         * testsuite/memory_test.sh: Update expected output.
6205
6206 2010-10-02  Doug Kwan  <dougkwan@google.com>
6207
6208         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6209         defintion to symtab.h
6210         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6211         declaration to defintion.
6212
6213 2010-10-01  Nick Clifton  <nickc@redhat.com>
6214
6215         * expression.cc (eval): Replace dummy argument with NULL.
6216         (eval_maybe_dot): Check for a NULL result section pointer.
6217         (Symbol_expression::value): Likewise.
6218         (Dot_expression::value): Likewise.
6219         (BINARY_EXPRESSION): Likewise.
6220         (Max_expression::value): Likewise.
6221         (Min_expression::value): Likewise.
6222         (Absolute_expression::value): Likewise.
6223         (Addr_expression::value_from_output_section): Likewise.
6224         (Loaddddr_expression::value_from_output_section): Likewise.
6225         (Segment_start_expression::value): Likewise.
6226         * script-sections.cc
6227         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6228         argument with NULL.
6229         (Sections_elememt_dot_assignment::set_section_addresses):
6230         Likewise.
6231         (Output_data_expression::do_write_to_buffer): Likewise.
6232         (Output_section_definition::finalize_symbols): Likewise.
6233         (Output_section_definition::set_section_addresses): Likewise.
6234
6235 2010-09-30  Doug Kwan  <dougkwan@google.com>
6236
6237         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6238
6239 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6240
6241         * target.h (Target::can_icf_inline_merge_sections): New virtual
6242         function.
6243         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6244         virtual function.
6245         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6246         virtual function.
6247         * icf.cc (get_section_contents): Inline merge sections only when
6248         target allows it.
6249
6250 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6251
6252         * configure: Regenerate.
6253
6254 2010-09-17  Ian Lance Taylor  <iant@google.com>
6255
6256         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6257         * testsuite/Makefile.am (memory_test.o): New target.
6258         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6259         memory_test.t.
6260         * testsuite/Makefile.in: Rebuild.
6261
6262 2010-09-17  Doug Kwan  <dougkwan@google.com>
6263
6264         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6265         defintion if relocation uses GOT entries of the symbol.
6266         * testsuite/icf_safe_test.sh: Fix test.
6267         * testsuite/icf_safe_so_test.sh: Fix test.
6268
6269 2010-09-16  Cary Coutant  <ccoutant@google.com>
6270
6271         * script_sections.cc (class Memory_region): Remove "NULL" from
6272         vector initializations.
6273
6274 2010-09-15  Cary Coutant  <ccoutant@google.com>
6275
6276         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6277         Resolve forwarding symbols.
6278
6279 2010-09-15  Doug Kwan  <dougkwan@google.com>
6280
6281         * gold/testsuite/script_test_3.t: Add ARM special sections.
6282         * gold/testsuite/script_test_4.t: Same.
6283         * gold/testsuite/script_test_5.t: Same.
6284         * gold/testsuite/script_test_6.t: Same.
6285         * gold/testsuite/script_test_7.t: Same.
6286         * gold/testsuite/script_test_7.t: Same.
6287         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6288
6289 2010-09-14  Cary Coutant  <ccoutant@google.com>
6290
6291         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6292         (Target_x86_64::Relocate::relocate_tls): Replace check for
6293         saw_tls_block_reloc_ with test for executable section.
6294
6295 2010-09-12  Cary Coutant  <ccoutant@google.com>
6296
6297         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6298         position-independent executables to shared libraries need dynamic
6299         relocations.
6300         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6301         position-independent executables.
6302         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6303         * testsuite/Makefile.in: Regenerate.
6304
6305 2010-09-10  Nick Clifton  <nickc@redhat.com>
6306
6307         PR gold/11997
6308         * testsuite/memory_test.t: Discard any sections that are not
6309         needed.
6310
6311 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6312
6313         PR gold/11996
6314         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6315         "This::" to work around a bug in gcc 4.2.
6316
6317         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6318
6319 2010-09-09  Rafael Espindola  <espindola@google.com>
6320
6321         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6322         sections with different PF_X flags in the same segment.
6323         (Layout::find_first_load_seg): Search all segments to find the first
6324         one.
6325         * options.h (rosegment): New.
6326
6327 2010-09-08  Rafael Espindola  <espindola@google.com>
6328
6329         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6330
6331 2010-09-08  Doug Kwan  <dougkwan@google.com>
6332
6333         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6334         (Arm_relobj::do_relocate_sections): Add new parameter for output
6335         file to match the parent.
6336         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6337         of local symbols instead of input values.  Update code to track
6338         changes in gold::relocate_section.
6339         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6340         (Sized_relobj::compute_final_local_value_internal): New methods.
6341         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6342         body into private version of Sized_relobj::compute_final_local_value.
6343         Call the inline method.
6344         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6345         merged symbol value if there is one.
6346         (Symbol_value::has_output_value): New method defintiion.
6347         (Sized_relobj::Compute_final_local_value_status): New enum type.
6348         (Sized_relobj::compute_final_local_value): New methods.
6349         (Sized_relobj::compute_final_local_value_internal): New methods.
6350         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6351         and arm_cortex_a8.sh.
6352         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6353         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6354         New tests.
6355         * Makefile.in: Regenerate.
6356         * testsuite/arm_bl_out_of_range.s: Update test.
6357         * testsuite/thumb_bl_out_of_range.s: Ditto.
6358         * testsuite/thumb_blx_out_of_range.s: Ditto.
6359         * testsuite/arm_branch_out_of_range.sh: New file.
6360         * testsuite/arm_cortex_a8.sh: Ditto.
6361         * testsuite/arm_cortex_a8_b.s: Ditto.
6362         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6363         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6364         * testsuite/arm_cortex_a8_bl.s: Ditto.
6365         * testsuite/arm_cortex_a8_blx.s: Ditto.
6366         * testsuite/arm_cortex_a8_local.s: Ditto.
6367         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6368         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6369
6370 2010-09-08  Rafael Espindola  <espindola@google.com>
6371
6372         * Makefile.am (memory_test.stdout): Run readelf with -W.
6373         * Makefile.in: Regenerate.
6374         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6375         64 bit output.
6376
6377 2010-09-08  Rafael Espindola  <espindola@google.com>
6378
6379         * script-sections.cc (Script_sections::add_memory_region): Convert
6380         field precision to int.
6381         * script.cc (script_set_section_region, script_set_section_region):
6382         Convert field precision to int.
6383
6384 2010-09-08  Rafael Espindola  <espindola@google.com>
6385
6386         * arm.cc (do_finalize_sections): Create the __exidx_start and
6387         __exdix_end symbols even when the section is missing.
6388
6389 2010-09-08  Nick Clifton  <nickc@redhat.com>
6390
6391         * README: Remove claim that MEMORY is not supported.
6392         * expression.cc (script_exp_function_origin)
6393         (script_exp_function_length): Move from here to ...
6394         * script.cc: ... here.
6395         (script_set_section_region, script_add_memory)
6396         (script_parse_memory_attr, script_include_directive): New
6397         functions.
6398         * script-sections.cc
6399         (class Memory_region): New class.
6400         (class Output_section_definition): Add set_memory_region,
6401         set_section_vma, set_section_lma and get_section_name methods.
6402         (class Script_Sections): Add add_memory_region,
6403         find_memory_region, find_memory_region_origin,
6404         find_memory_region_length and set_memory_region methods.
6405         Have set_section_addresses method walk the list of set memory
6406         regions.
6407         Extend the print methos to display memory regions.
6408         * script-sections.h: Add prototypes for new methods.
6409         Add enum for MEMORY region attributes.
6410         * yyscript.y: Add support for parsing MEMORY regions.
6411         * script-c.h: Add prototypes for new functions.
6412         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6413         * testsuite/Makefile.in: Regenerate.
6414         * testsuite/memory_test.sh: New script.
6415         * testsuite/memory_test.s: New assembler source file.
6416         * testsuite/memory_test.t: New linker script.
6417
6418 2010-08-27  Doug Kwan  <dougkwan@google.com>
6419
6420         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6421         reference override an existing dynamic weak reference.
6422         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6423         * testsuite/Makefile.in: Regenerate.
6424         * testsuite/dyn_weak_ref.sh: New file.
6425         * testsuite/dyn_weak_ref_1.c: Ditto.
6426         * testsuite/dyn_weak_ref_2.c: Ditto.
6427
6428 2010-08-27  Ian Lance Taylor  <iant@google.com>
6429
6430         * incremental.h (class Incremental_input_entry): Add virtual
6431         destructor.
6432
6433 2010-08-27  Ian Lance Taylor  <iant@google.com>
6434
6435         * testsuite/start_lib_test_3.c: Mark t3 as used.
6436
6437 2010-08-27  Nick Clifton  <nickc@redhat.com>
6438
6439         * options.cc (version_script): Fix small typo in previous
6440         whitespace tidyup.
6441
6442 2010-08-25  Nick Clifton  <nickc@redhat.com>
6443
6444         * archive.cc: Formatting fixes: Remove whitespace between
6445         typename and following asterisk.  Remove whitespace between
6446         function name and opening parenthesis.
6447         * archive.h: Likewise.
6448         * arm.cc: Likewise.
6449         * attributes.cc: Likewise.
6450         * attributes.h: Likewise.
6451         * common.cc: Likewise.
6452         * copy-relocs.cc: Likewise.
6453         * dirsearch.h: Likewise.
6454         * dynobj.cc: Likewise.
6455         * ehframe.cc: Likewise.
6456         * ehframe.h: Likewise.
6457         * expression.cc: Likewise.
6458         * fileread.cc: Likewise.
6459         * fileread.h: Likewise.
6460         * gc.h: Likewise.
6461         * gold-threads.cc: Likewise.
6462         * gold.cc: Likewise.
6463         * i386.cc: Likewise.
6464         * icf.h: Likewise.
6465         * incremental-dump.cc: Likewise.
6466         * incremental.cc: Likewise.
6467         * layout.cc: Likewise.
6468         * layout.h: Likewise.
6469         * main.cc: Likewise.
6470         * merge.cc: Likewise.
6471         * merge.h: Likewise.
6472         * object.cc: Likewise.
6473         * object.h: Likewise.
6474         * options.cc: Likewise.
6475         * options.h: Likewise.
6476         * output.cc: Likewise.
6477         * output.h: Likewise.
6478         * plugin.cc: Likewise.
6479         * plugin.h: Likewise.
6480         * powerpc.cc: Likewise.
6481         * reloc.cc: Likewise.
6482         * script-c.h: Likewise.
6483         * script-sections.cc: Likewise.
6484         * script.cc: Likewise.
6485         * stringpool.cc: Likewise.
6486         * symtab.cc: Likewise.
6487         * symtab.h: Likewise.
6488         * target.cc: Likewise.
6489         * timer.cc: Likewise.
6490         * timer.h: Likewise.
6491         * version.cc: Likewise.
6492         * x86_64.cc: Likewise.
6493
6494 2010-08-24  Nick Clifton  <nickc@redhat.com>
6495
6496         PR 11899
6497         * layout.cc (segment_precedes): Sort segments by their physical
6498         addresses, if they have been set.
6499
6500 2010-08-23  Cary Coutant  <ccoutant@google.com>
6501
6502         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6503         symbols data.
6504         (Lib_group::include_member): Unlock object after deleting its
6505         symbols data.
6506         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6507         the bug fixed here.
6508
6509 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6510             Cary Coutant  <ccoutant@google.com>
6511
6512         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6513         constructor, and set_blocker.
6514         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6515         readsyms_blocker_.
6516         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6517         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6518         * testsuite/Makefile.am (start_lib_test): New test case.
6519         * testsuite/Makefile.in: Regenerate.
6520         * testsuite/start_lib_test_main.c: New file.
6521         * testsuite/start_lib_test_1.c: New file.
6522         * testsuite/start_lib_test_2.c: New file.
6523         * testsuite/start_lib_test_3.c: New file.
6524
6525 2010-08-19  Ian Lance Taylor  <iant@google.com>
6526
6527         * Makefile.in: Rebuild with automake 1.11.1.
6528         * aclocal.m4: Likewise.
6529         * testsuite/Makefile.in: Likewise.
6530
6531 2010-08-19  Ian Lance Taylor  <iant@google.com>
6532
6533         PR 10893
6534         * i386.cc (class Output_data_plt_i386): Update declarations.
6535         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6536         local_ifuncs_ fields.
6537         (Target_i386::do_plt_section_for_global): New function.
6538         (Target_i386::do_plt_section_for_local): New function.
6539         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6540         parameter; change all callers.  Initialize global_ifuncs_ and
6541         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6542         __rel_iplt_end.
6543         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6544         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6545         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6546         symbols.
6547         (Target_i386::make_plt_section): New function, broken out of
6548         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6549         (Target_i386::make_plt_entry): Call make_plt_section.
6550         (Target_i386::make_local_ifunc_plt_entry): New function.
6551         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6552         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6553         R_386_IRELATIVE to switch.
6554         (Target_i386::Scan::global): Likewise.
6555         (Target_i386::Relocate::relocate): Likewise.
6556         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6557         switch.
6558         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6559         (Target_x86_64::do_plt_section_for_global): New function.
6560         (Target_x86_64::do_plt_section_for_local): New function.
6561         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6562         parameter; change all callers.  If doing a static link define
6563         __rela_iplt_start and __rela_iplt_end.
6564         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6565         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6566         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6567         to point to .plt.
6568         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6569         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6570         switch.
6571         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6572         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6573         R_X86_64_IRELATIVE to switch.
6574         (Target_x86_64::Scan::global): Likewise.
6575         (Target_x86_64::Relocate::relocate): Likewise.
6576         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6577         switch.
6578         * target.h (class Target): Add plt_section_for_global and
6579         plt_section_for_local functions.  Add do_plt_section_for_global
6580         and do_plt_section_for_local virtual functions.
6581         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6582         clarifying comments.
6583         (Symbol::use_plt_offset): Handle IFUNC symbol.
6584         * object.cc (Sized_relobj::Sized_relobj): Initialize
6585         local_plt_offsets_.
6586         (Sized_relobj::local_has_plt_offset): New function.
6587         (Sized_relobj::local_plt_offset): New function.
6588         (Sized_relobj::set_local_plt_offset): New function.
6589         (Sized_relobj::do_count): Handle IFUNC symbol.
6590         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6591         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6592         is_ifunc_symbol functions.
6593         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6594         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6595         local_plt_offsets_ field.
6596         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6597         * output.h (class Output_section_data): Add non-const
6598         output_section function.
6599         (class Output_data_got): Update declarations.
6600         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6601         Add use_plt_offset parameter to global and local constructors.
6602         Change all callers.  Change local_sym_index_ field to 31 bits.
6603         Change GSYM_CODE and CONSTANT_CODE accordingly.
6604         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6605         doing a static link don't set sh_link field.
6606         (Output_data_got::Got_entry::write): Use PLT offset if
6607         appropriate.
6608         (Output_data_got::add_global_plt): New function.
6609         (Output_data_got::add_local_plt): New function.
6610         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6611         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6612         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6613         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6614         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6615         IFUNC conditional.
6616         * testsuite/ifunc-sel.h: New file.
6617         * testsuite/ifuncmain1.c: New file.
6618         * testsuite/ifuncmain1vis.c: New file.
6619         * testsuite/ifuncmod1.c: New file.
6620         * testsuite/ifuncdep2.c: New file.
6621         * testsuite/ifuncmain2.c: New file.
6622         * testsuite/ifuncmain3.c: New file.
6623         * testsuite/ifuncmod3.c: New file.
6624         * testsuite/ifuncmain4.c: New file.
6625         * testsuite/ifuncmain5.c: New file.
6626         * testsuite/ifuncmod5.c: New file.
6627         * testsuite/ifuncmain6pie.c: New file.
6628         * testsuite/ifuncmod6.c: New file.
6629         * testsuite/ifuncmain7.c: New file.
6630         * configure, testsuite/Makefile.in: Rebuild.
6631
6632 2010-08-18  Ian Lance Taylor  <iant@google.com>
6633
6634         * incremental.cc
6635         (Output_section_incremental_inputs::write_input_files): Add cast
6636         to avoid signed/unsigned comparison warning.
6637         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6638
6639 2010-08-12  Cary Coutant  <ccoutant@google.com>
6640
6641         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6642
6643 2010-08-13  Ian Lance Taylor  <iant@google.com>
6644
6645         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6646
6647 2010-08-12  Cary Coutant  <ccoutant@google.com>
6648             Doug Kwan  <dougkwan@google.com>
6649
6650         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6651         defintion overrides non-weak undef, remember that the original undef
6652         is not weak.
6653         * symtab.cc (Symbol_table::sized_write_global): For undef without
6654         an original weak binding, set binding to global in output.
6655         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6656         * testsuite/Makefile.in: Regenerate.
6657         * testsuite/strong_ref_weak_def.sh: New file.
6658         * testsuite/strong_ref_weak_def_1.c: Ditto.
6659         * testsuite/strong_ref_weak_def_2.c: Ditto.
6660
6661 2010-08-12  Cary Coutant  <ccoutant@google.com>
6662
6663         * testsuite/incremental_test.sh: Rewrite.
6664         * testsuite/incremental_test_1.c: Rewrite.
6665         * testsuite/incremental_test_2.c: Rewrite.
6666
6667 2010-08-12  Cary Coutant  <ccoutant@google.com>
6668
6669         * arm.cc (Target_arm::got_size): Add const.
6670         (Target_arm::got_entry_count): New function.
6671         (Target_arm::plt_entry_count): New function.
6672         (Target_arm::first_plt_entry_offset): New function.
6673         (Target_arm::plt_entry_size): New function.
6674         (Output_data_plt_arm::entry_count): New function.
6675         (Output_data_plt_arm::first_plt_entry_offset): New function.
6676         (Output_data_plt_arm::get_plt_entry_size): New function.
6677         * i386.cc (Target_i386::got_size): Add const.
6678         (Target_i386::got_entry_count): New function.
6679         (Target_i386::plt_entry_count): New function.
6680         (Target_i386::first_plt_entry_offset): New function.
6681         (Target_i386::plt_entry_size): New function.
6682         (Output_data_plt_i386::entry_count): New function.
6683         (Output_data_plt_i386::first_plt_entry_offset): New function.
6684         (Output_data_plt_i386::get_plt_entry_size): New function.
6685         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6686         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6687         * incremental.cc: Include target.h.
6688         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6689         parameter.  Adjust all callers.  Find incremental_got_plt section.
6690         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6691         section.
6692         (Output_section_incremental_inputs::set_final_data_size): Calculate
6693         size of incremental_got_plt section.
6694         (Output_section_incremental_inputs::do_write): Write the
6695         incremental_got_plt section.
6696         (Got_plt_view_info): New struct.
6697         (Local_got_offset_visitor): New class.
6698         (Global_got_offset_visitor): New class.
6699         (Global_symbol_visitor_got_plt): New class.
6700         (Output_section_incremental_inputs::write_got_plt): New function.
6701         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6702         Add parameter.  Adjust all callers.
6703         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6704         (Incremental_inputs::got_plt_section): New function.
6705         (Incremental_inputs::got_plt_section_): New data member.
6706         (Incremental_got_plt_reader): New class.
6707         * layout.cc (Layout::create_incremental_info_sections): Add the
6708         incremental_got_plt section.
6709         * object.h (Got_offset_list::get_list): New function.
6710         (Got offset_list::for_all_got_offsets): New function.
6711         (Sized_relobj::local_got_offset_list): New function.
6712         * powerpc.cc (Target_powerpc::got_size): Add const.
6713         (Target_powerpc::got_entry_count): New function.
6714         (Target_powerpc::plt_entry_count): New function.
6715         (Target_powerpc::first_plt_entry_offset): New function.
6716         (Target_powerpc::plt_entry_size): New function.
6717         (Output_data_plt_powerpc::entry_count): New function.
6718         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6719         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6720         * sparc.cc (Target_sparc::got_size): Add const.
6721         (Target_sparc::got_entry_count): New function.
6722         (Target_sparc::plt_entry_count): New function.
6723         (Target_sparc::first_plt_entry_offset): New function.
6724         (Target_sparc::plt_entry_size): New function.
6725         (Output_data_plt_sparc::entry_count): New function.
6726         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6727         (Output_data_plt_sparc::get_plt_entry_size): New function.
6728         * symtab.h (Symbol::got_offset_list): New function.
6729         (Symbol_table::for_all_symbols): New function.
6730         * target.h (Sized_target::got_entry_count): New function.
6731         (Sized_target::plt_entry_count): New function.
6732         (Sized_target::plt_entry_size): New function.
6733         * x86_64.cc (Target_x86_64::got_size): Add const.
6734         (Target_x86_64::got_entry_count): New function.
6735         (Target_x86_64::plt_entry_count): New function.
6736         (Target_x86_64::first_plt_entry_offset): New function.
6737         (Target_x86_64::plt_entry_size): New function.
6738         (Output_data_plt_x86_64::entry_count): New function.
6739         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6740         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6741
6742 2010-08-12  Cary Coutant  <ccoutant@google.com>
6743
6744         * archive.cc: Include incremental.h.
6745         (Archive::Archive): Initialize incremental_info_.
6746         (Archive::include_member): Record archive members in incremental info.
6747         (Add_archive_symbols::run): Record begin and end of an archive in
6748         incremental info.
6749         (Lib_group::include_member): Record objects in incremental info.
6750         * archive.h (Incremental_archive_entry): Forward declaration.
6751         (Archive::set_incremental_info): New member function.
6752         (Archive::incremental_info): New member function.
6753         (Archive::Unused_symbol_iterator): New class.
6754         (Archive::unused_symbols_begin): New member function.
6755         (Archive::unused_symbols_end): New member function.
6756         (Archive::incremental_info_): New data member.
6757         * incremental-dump.cc (find_input_containing_global): New function.
6758         (dump_incremental_inputs): Dump new incremental info sections.
6759         * incremental.cc: Include symtab.h.
6760         (Output_section_incremental_inputs): New class.
6761         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6762         new incremental info sections.
6763         (Sized_incremental_binary::do_check_inputs): Likewise.
6764         (Incremental_inputs::report_archive): Remove.
6765         (Incremental_inputs::report_archive_begin): New function.
6766         (Incremental_inputs::report_archive_end): New function.
6767         (Incremental_inputs::report_object): New function.
6768         (Incremental_inputs::finalize_inputs): Remove.
6769         (Incremental_inputs::report_input_section): New function.
6770         (Incremental_inputs::report_script): Rewrite.
6771         (Incremental_inputs::finalize): Do nothing but finalize string table.
6772         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6773         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6774         (Incremental_inputs::create_data_sections): New function.
6775         (Incremental_inputs::relocs_entsize): New function.
6776         (Output_section_incremental_inputs::set_final_data_size): New function.
6777         (Output_section_incremental_inputs::do_write): New function.
6778         (Output_section_incremental_inputs::write_header): New function.
6779         (Output_section_incremental_inputs::write_input_files): New function.
6780         (Output_section_incremental_inputs::write_info_blocks): New function.
6781         (Output_section_incremental_inputs::write_symtab): New function.
6782         * incremental.h (Incremental_script_entry): Forward declaration.
6783         (Incremental_object_entry): Forward declaration.
6784         (Incremental_archive_entry): Forward declaration.
6785         (Incremental_inputs): Forward declaration.
6786         (Incremental_inputs_header_data): Remove.
6787         (Incremental_inputs_header): Remove.
6788         (Incremental_inputs_header_write): Remove.
6789         (Incremental_inputs_entry_data): Remove.
6790         (Incremental_inputs_entry): Remove.
6791         (Incremental_inputs_entry_write): Remove.
6792         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6793         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6794         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6795         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6796         Likewise.
6797         (Incremental_input_entry): New class.
6798         (Incremental_script_entry): New class.
6799         (Incremental_object_entry): New class.
6800         (Incremental_archive_entry): New class.
6801         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6802         (Incremental_inputs::report_inputs): Remove.
6803         (Incremental_inputs::report_archive): Remove.
6804         (Incremental_inputs::report_archive_begin): New function.
6805         (Incremental_inputs::report_archive_end): New function.
6806         (Incremental_inputs::report_object): Change prototype.
6807         (Incremental_inputs::report_input_section): New function.
6808         (Incremental_inputs::report_script): Change prototype.
6809         (Incremental_inputs::get_reloc_count): New function.
6810         (Incremental_inputs::set_reloc_count): New function.
6811         (Incremental_inputs::create_data_sections): New function.
6812         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6813         (Incremental_inputs::inputs_section): New function.
6814         (Incremental_inputs::symtab_section): New function.
6815         (Incremental_inputs::relocs_section): New function.
6816         (Incremental_inputs::get_stringpool): Add const.
6817         (Incremental_inputs::command_line): Add const.
6818         (Incremental_inputs::inputs): Remove.
6819         (Incremental_inputs::command_line_key): New function.
6820         (Incremental_inputs::input_file_count): New function.
6821         (Incremental_inputs::input_files): New function.
6822         (Incremental_inputs::relocs_entsize): New function.
6823         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6824         (Incremental_inputs::finalize_inputs): Remove.
6825         (Incremental_inputs::Input_info): Remove.
6826         (Incremental_inputs::lock_): Remove.
6827         (Incremental_inputs::inputs_): Change type.
6828         (Incremental_inputs::inputs_map_): Remove.
6829         (Incremental_inputs::current_object_entry_): New data member.
6830         (Incremental_inputs::inputs_section_): New data member.
6831         (Incremental_inputs::symtab_section_): New data member.
6832         (Incremental_inputs::relocs_section_): New data member.
6833         (Incremental_inputs::reloc_count_): New data member.
6834         (Incremental_inputs_reader): New class.
6835         (Incremental_symtab_reader): New class.
6836         (Incremental_relocs_reader): New class.
6837         * layout.cc (Layout::finalize): Move finalization of incremental info
6838         and creation of incremental info sections to follow finalization of
6839         symbol table.  Set offsets for postprocessing sections.
6840         (Layout::create_incremental_info_sections): Call
6841         Incremental_inputs::create_data_sections.  Add incremental symtab
6842         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6843         sections to layout after input sections.
6844         * layout.h (struct Timespec): Forward declaration.
6845         (Layout::incremental_inputs): Add const.
6846         (Layout::create_incremental_info_sections): Add parameter.
6847         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6848         * object.cc: Include incremental.h.
6849         (Relobj::finalize_incremental_relocs): New function.
6850         (Sized_relobj::do_layout): Record input sections in incremental info.
6851         * object.h (Object::output_section): New function.
6852         (Object::output_section_offset): Moved from Relobj.
6853         (Object::get_incremental_reloc_base): New function.
6854         (Object::get_incremental_reloc_count): New function.
6855         (Object::do_output_section): New function.
6856         (Object::do_output_section_offset): Moved from Relobj.
6857         (Object::do_get_incremental_reloc_base): New function.
6858         (Object::do_get_incremental_reloc_count): New function.
6859         (Object::Object): Initialize new data members.
6860         (Relobj::output_section): Renamed do_output_section and moved to
6861         protected.
6862         (Relobj::output_section_offset): Moved to Object.
6863         (Relobj::do_get_incremental_reloc_base): New function.
6864         (Relobj::do_get_incremental_reloc_count): New function.
6865         (Relobj::allocate_incremental_reloc_counts): New function.
6866         (Relobj::count_incremental_reloc): New function.
6867         (Relobj::finalize_incremental_relocs): New function.
6868         (Relobj::next_incremental_reloc_index): New function.
6869         (Relobj::reloc_counts_): New data member.
6870         (Relobj::reloc_bases_): New data member.
6871         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6872         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6873         (Sized_relobj::incremental_relocs_scan): New function.
6874         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6875         (Sized_relobj::incremental_relocs_write): New function.
6876         (Sized_relobj::incremental_relocs_write_reltype): New function.
6877         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6878         incremental link.
6879         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6880         archives and object files elsewhere.
6881         (Add_symbols::run): Report object files here.
6882         (Finish_group::run): Report end of archive at end of group.
6883         * reloc.cc: Include layout.h, incremental.h.
6884         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6885         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6886         (Sized_relobj::incremental_relocs_scan): New function.
6887         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6888         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6889         (Sized_relobj::incremental_relocs_write): New function.
6890         (Sized_relobj::incremental_relocs_write_reltype): New function.
6891         * script.cc (read_input_script): Rewrite test for incremental link.
6892         Change call to Incremental_inputs::report_script.
6893         * symtab.h (Symbol_table::first_global_index): New function.
6894         (Symbol_table::output_count): New function.
6895
6896 2010-08-12  Doug Kwan  <dougkwan@google.com>
6897
6898         * arm.cc (Target_arm::merge_object_attributes): Check command line
6899         options --no-wchar-size-warning and --no-enum-size-warning.
6900         * options.h (General_options): Add ld-compatible options
6901         --no-enum-size-warning and --no-wchar-size-warning.
6902
6903 2010-08-04  Ian Lance Taylor  <iant@google.com>
6904
6905         * x86_64.cc (Target_x86_64::Scan::local): Use
6906         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6907         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6908         (Target_x86_64::Scan::global): Likewise.
6909         (Target_x86_64::Relocate::relocate): Likewise.
6910         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6911         Likewise.
6912
6913 2010-08-03  Cary Coutant  <ccoutant@google.com>
6914
6915         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6916         to reserve space in merged_strings vector. Keep total input size
6917         for stats.
6918         (Output_merge_string::do_print_merge_stats): Print total input size.
6919         * merge.h (Output_merge_string): Add input_size_ field.
6920         * stringpool.cc (Stringpool_template::string_length): Move
6921         implementations out of Stringpool_template class and place in
6922         stringpool.h.
6923         * stringpool.h (string_length): Move out of Stringpool_template.
6924
6925 2010-08-03  Ian Lance Taylor  <iant@google.com>
6926
6927         PR 11712
6928         * layout.cc (relaxation_loop_body): If address of load segment is
6929         set, adjust address to include headers if possible.
6930
6931 2010-08-03  Ian Lance Taylor  <iant@google.com>
6932
6933         * version.cc (version_string): Bump to 1.10.
6934
6935 2010-08-03  Ian Lance Taylor  <iant@google.com>
6936
6937         PR 11805
6938         * layout.h (enum Output_section_order): Define.
6939         (class Layout): Update declarations.
6940         * layout.cc (Layout::get_output_section): Add order parameter.
6941         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6942         is_first_non_relro parameters.  Change all callers.
6943         (Layout::choose_output_section): Likewise.
6944         (Layout::add_output_section_data): Likewise.
6945         (Layout::make_output_section): Likewise.  Set order.
6946         (Layout::default_section_order): New function.
6947         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6948         * output.cc (Output_section::Output_section): Initialize order_.
6949         Don't initialize deleted fields.
6950         (Output_segment::Output_segment): Don't initialize deleted
6951         fields.
6952         (Output_segment::add_output_section_to_load): New function
6953         replacing add_output_section.  Change all callers to call this or
6954         add_output_section_to_nonload.
6955         (Output_segment::add_output_section_to_nonload): New function.
6956         (Output_segment::remove_output_section): Rewrite.
6957         (Output_segment::add_initial_output_data): Likewise.
6958         (Output_segment::has_any_data_sections): Likewise.
6959         (Output_segment::is_first_section_relro): Likewise.
6960         (Output_segment::maximum_alignment): Likewise.
6961         (Output_segment::has_dynamic_reloc): New function replacing
6962         dynamic_reloc_count.  Change all callers.
6963         (Output_segment::has_dynamic_reloc_list): New function replacing
6964         dynamic_reloc_count_list.  Change all callers.
6965         (Output_segment::set_section_addresses): Rewrite.
6966         (Output_segment::set_offset): Rewrite.
6967         (Output_segment::find_first_and_last_list): Remove.
6968         (Output_segment::set_tls_offsets): Rewrite.
6969         (Output_segment::first_section_load_address): Likewise.
6970         (Output_segment::output_section_count): Likewise.
6971         (Output_segment::section_with_lowest_load_address): Likewise.
6972         (Output_segment::write_section_headers): Likewise.
6973         (Output_segment::print_sections_to_map): Likewise.
6974         * output.h (class Output_data): Remove dynamic_reloc_count_
6975         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6976         (Output_data::add_dynamic_reloc): Rewrite.
6977         (Output_data::has_dynamic_reloc): New function.
6978         (Output_data::dynamic_reloc_count): Remove.
6979         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6980         is_last_relro_, is_first_non_relro_, is_interp_,
6981         is_dynamic_linker_section_ fields.  Add order and set_order
6982         functions.  Remove is_relro_local, set_is_relro_local,
6983         is_last_relro, set_is_last_relro, is_first_non_relro,
6984         set_is_first_non_relro functions, is_interp, set_is_interp,
6985         is_dynamic_linker_section, and set_is_dynamic_linker_section
6986         functions.
6987         (class Output_segment): Change Output_data_list from std::list to
6988         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6989         output_bss_ fields.  Update declarations.
6990
6991 2010-08-02  Ian Lance Taylor  <iant@google.com>
6992
6993         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6994         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6995         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6996
6997 2010-08-02  Ian Lance Taylor  <iant@google.com>
6998
6999         PR 11855
7000         * script.cc (Script_options::Script_options): Initialize
7001         symbol_definitions_ and symbol_references_.
7002         (Script_options::add_symbol_assignment): Update
7003         symbol_definitions_ and symbol_references_.
7004         (Script_options::add_symbol_reference): New function.
7005         (script_symbol): New function.
7006         * script.h (class Script_options): Add symbol_definitions_ and
7007         symbol_references_ fields.
7008         (Script_options::referenced_const_iterator): New type.
7009         (Script_options::referenced_begin): New function.
7010         (Script_options::referenced_end): New function.
7011         (Script_options::is_referenced): New function.
7012         (Script_options::any_unreferenced): New function.
7013         * script-c.h (script_symbol): Declare.
7014         * yyscript.y (exp): Call script_symbol.
7015         * symtab.cc: Include "script.h".
7016         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7017         Change all callers.  Check symbols referenced by scripts.
7018         (Symbol_table::add_undefined_symbols_from_command_line): Add
7019         layout parameter.  Change all callers.
7020         (Symbol_table::do_add_undefined_symbols_from_command_line):
7021         Likewise.  Break out loop body.  Check symbols referenced by
7022         scripts.
7023         (Symbol_table::add_undefined_symbol_from_command_line): New
7024         function broken out of
7025         do_add_undefined_symbols_from_command_line.
7026         * symtab.h (class Symbol_table): Update declarations.
7027         * archive.cc: Include "layout.h".
7028         (Archive::should_include_member): Add layout parameter.  Change
7029         all callers.  Check for symbol mentioned in expression.
7030         * archive.h (class Archive): Update declaration.
7031         * object.cc (Sized_relobj::do_should_include_member): Add layout
7032         parameter.
7033         * object.h (Object::should_include_member): Add layout parameter.
7034         Change all callers.
7035         (Object::do_should_include_member): Add layout parameter.
7036         (class Sized_relobj): Update declaration.
7037         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7038         parameter.
7039         * dynobj.h (class Sized_dynobj): Update declaration.
7040         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7041         layout parameter.
7042         * plugin.h (class Sized_pluginobj): Update declaration.
7043
7044 2010-08-02  Ian Lance Taylor  <iant@google.com>
7045
7046         PR 11866
7047         * output.cc (Output_segment::set_offset): Search for the first and
7048         last sections rather than assuming that the list is in order.
7049         (Output_segment::find_first_and_last_list): New function.
7050         * output.h (class Output_segment): Update declarations.
7051         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7052         (relro_strip_test_SOURCES): New variable.
7053         (relro_strip_test_DEPENDENCIES): New variable.
7054         (relro_strip_test_LDFLAGS): New variable.
7055         (relro_strip_test_LDADD): New variable.
7056         (relro_strip_test.so): New target.
7057
7058 2010-08-02  Ian Lance Taylor  <iant@google.com>
7059
7060         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7061         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7062         (Target_i386::got_tlsdesc_section): New function.
7063         (Target_i386::got_section): Create space for GOT entries for
7064         TLSDESC relocations.
7065         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7066         R_386_TLS_GOTDESC.
7067         (Target_i386::Scan::global): Likewise.
7068         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7069         using TLSDESC GOT.
7070         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7071         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7072         (Target_x86_64::got_tlsdesc_section): New function.
7073         (Target_x86_64::got_section): Create space for GOT entries for
7074         TLSDESC relocations.
7075         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7076         R_386_TLS_GOTDESC.
7077         (Target_x86_64::Scan::global): Likewise.
7078         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7079         using TLSDESC GOT.
7080
7081 2010-08-02  Ian Lance Taylor  <iant@google.com>
7082
7083         * testsuite/final_layout.sh: Use dc to convert from hex to
7084         decimal.
7085
7086 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7087
7088         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7089         paramter to the call to gold::gc_process_relocs.
7090         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7091         paramter to the call to gold::gc_process_relocs.
7092         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7093         parameter to the call to gold::gc_process_relocs.
7094         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7095         template parameter to the call to gold::gc_process_relocs.
7096         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7097         paramter to the call to gold::gc_process_relocs.
7098         * gc.h (get_embedded_addend_size): New function.
7099         (gc_process_relocs): Save the size of the reloc for use by ICF.
7100         * icf.cc (get_section_contents): Get the addend from the text section
7101         for SHT_REL relocation sections.
7102         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7103         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7104         * int_encoding.h (read_from_pointer): New overloaded function.
7105         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7106         * testsuite/icf_sht_rel_addend_test.sh: New file.
7107         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7108         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7109
7110 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7111
7112         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7113         * Makefile.in: Regenerate.
7114         * testsuite/Makefile.in: Regenerate.
7115
7116 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7117
7118         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7119         * gold/testsuite/debug_msg.cc: Likewise.
7120         * gold/testsuite/odr_violation1.cc
7121         * gold/testsuite/odr_violation2.cc
7122
7123 2010-07-21  Cary Coutant  <ccoutant@google.com>
7124
7125         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7126         string, and length fields.
7127         (Output_merge_string::Merged_strings_list): New type.
7128         (Output_merge_string::Merged_strings_lists): New typedef.
7129         (Output_merge_string): Replace merged_strings_ with
7130         merged_strings_lists_.
7131         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7132         Merged_strings_list per input object and section.  Don't store pointer
7133         to the string.  Don't store length with each merged string entry.
7134         (Output_merge_string::finalize_merged_data): Loop over list of merged
7135         strings lists.  Recompute length of each merged string.
7136
7137 2010-07-15  Cary Coutant  <ccoutant@google.com>
7138
7139         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7140         here.
7141
7142 2010-07-14  Ian Lance Taylor  <iant@google.com>
7143
7144         * descriptors.cc (Descriptors::open): Report correct name in error
7145         message.
7146
7147 2010-07-13  Doug Kwan  <dougkwan@google.com>
7148
7149         * arm.cc (Arm_input_section::Arm_input_section): For a
7150         SHT_ARM_EXIDX section, always keeps the input sections.
7151         (Arm_input_section::set_exidx_section_link): New method.
7152         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7153         has_errors_ to false.
7154         (Arm_exidx_input_section::has_errors,
7155         Arm_exidx_input_section::set_has_errors): New methods.
7156         (Arm_exidx_input_section::has_errors_): New data member.
7157         (Arm_relobj::get_exidx_shndx_list): New method.
7158         (Arm_output_section::append_text_sections_to_list): Do not skip
7159         section without SHF_EXECINSTR.
7160         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7161         errors.
7162         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7163         section header.  Make error messages more verbose.  Check for
7164         a non-executable section linked to an EXIDX section.
7165         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7166         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7167         check that there is no deferred EXIDX section if we exit early.
7168         Instead of not making an EXIDX section in case of an error, make one
7169         and set the has_errors flag of it.
7170         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7171         in a relocatable link.
7172         (Target_arm::do_relax): Look for the EXIDX output section instead of
7173         assuming that it is called .ARM.exidx.
7174         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7175         section list.  Do not check for SHF_EXECINSTR section flags but
7176         skip any input section with errors.
7177         * output.cc (Output_section::Output_section): Initialize
7178         always_keeps_input_sections_ to false.
7179         (Output_section::add_input_section): Check for
7180         always_keeps_input_sections_.
7181         *  output.h (Output_section::always_keeps_input_sections,
7182         Output_section::set_always_keeps_input_sections): New methods.
7183         (Output_section::always_keeps_input_sections): New data member.
7184
7185 2010-07-13  Rafael Espindola  <espindola@google.com>
7186
7187         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7188         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7189
7190 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7191             Ian Lance Taylor  <iant@google.com>
7192
7193         * output.h (Output_section_lookup_maps::add_merge_section):
7194         Correct check of whether value was inserted.
7195         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7196         (Output_section_lookup_maps::add_relaxed_input_section):
7197         Likewise.
7198         * arm.cc (Target_arm::got_section): Remove used local os.
7199         * i386.cc (Target_i386::got_section): Likewise.
7200         * x86_64.cc (Target_x86_64::got_section): Likewise.
7201         * sparc.cc (Target_sparc::got_section): Likewise.
7202         (Target_sparc::relocate): Remove unused local have_got_offset.
7203         * powerpc.cc (Target_powerpc::relocate): Likewise.
7204
7205 2010-07-13  Ian Lance Taylor  <iant@google.com>
7206
7207         * compressed_output.cc (zlib_decompress): Fix signature in
7208         !HAVE_ZLIB_H case.
7209
7210         * archive.cc (Archive::include_member): Unlock an external member
7211         of a thin archive.  Don't bother to delete an object we know is
7212         NULL.
7213
7214 2010-07-12  Cary Coutant  <ccoutant@google.com>
7215
7216         * compressed_output.cc (zlib_decompress): New function.
7217         (get_uncompressed_size): New function.
7218         (decompress_input_section): New function.
7219         * compressed_output.h (get_uncompressed_size): New function.
7220         (decompress_input_section): New function.
7221         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7222         Handle compressed debug sections.
7223         * layout.cc (is_compressed_debug_section): New function.
7224         (Layout::output_section_name): Map compressed section names to
7225         canonical names.
7226         * layout.h (is_compressed_debug_section): New function.
7227         (is_debug_info_section): Recognize compressed debug sections.
7228         * merge.cc: Include compressed_output.h.
7229         (Output_merge_data::do_add_input_section): Handle compressed
7230         debug sections.
7231         (Output_merge_string::do_add_input_section): Handle compressed
7232         debug sections.
7233         * object.cc: Include compressed_output.h.
7234         (Sized_relobj::Sized_relobj): Initialize new data members.
7235         (build_compressed_section_map): New function.
7236         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7237         * object.h (Object::section_is_compressed): New method.
7238         (Object::do_section_is_compressed): New method.
7239         (Sized_relobj::Compressed_section_map): New type.
7240         (Sized_relobj::do_section_is_compressed): New method.
7241         (Sized_relobj::compressed_sections_): New data member.
7242         * output.cc (Output_section::add_input_section): Handle compressed
7243         debug sections.
7244         * reloc.cc: Include compressed_output.h.
7245         (Sized_relobj::write_sections): Handle compressed debug sections.
7246
7247 2010-07-08  Cary Coutant  <ccoutant@google.com>
7248
7249         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7250         weak when resolving to a dynamic def.
7251         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7252         for weak undef/dynamic def cases. Adjust callers.
7253         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7254         undef_binding_weak_.
7255         (Symbol_table::sized_write_globals): Adjust symbol binding.
7256         (Symbol_table::sized_write_symbol): Add binding parameter.
7257         * symtab.h (Symbol::set_undef_binding): New method.
7258         (Symbol::is_undef_binding_weak): New method.
7259         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7260         (Symbol_table::should_override): Add new parameter.
7261         (Symbol_table::sized_write_symbol): Add new parameter.
7262
7263         * testsuite/weak_undef_file1.cc: Add new test case.
7264         * testsuite/weak_undef_file2.cc: Fix header comment.
7265         * testsuite/weak_undef_test.cc: Add new test case.
7266
7267 2010-06-29  Doug Kwan  <dougkwan@google.com>
7268
7269         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7270         Initialize USE_SYMBOL_.
7271         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7272         definition.
7273         (Arm_reloc_property::uses_symbol_): New data member declaration.
7274         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7275         uses symbol value and symbol is undefined but not weakly undefined.
7276
7277 2010-06-28  Rafael Espindola  <espindola@google.com>
7278
7279         * plugin.cc (Plugin::load): Use dlerror.
7280
7281 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7282
7283         * symtab.cc (detect_odr_violations): When reporting an ODR
7284         violation, report an object where the symbol is defined.
7285
7286 2010-06-25  Doug Kwan  <dougkwan@google.com>
7287
7288         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7289         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7290         definition.
7291         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7292         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7293         target hook to detect function points.
7294         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7295         * icf.h (Icf::check_section_for_function_pointers): Change type of
7296         parameter SECTION_NAME to const reference to std::string.  Use
7297         target hook to determine if section may have unsafe pointers.
7298         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7299         method definition.
7300
7301 2010-06-21  Rafael Espindola  <espindola@google.com>
7302
7303         * fileread.cc (Input_file::find_fie): New
7304         (Input_file::open): Use Input_file::find_fie.
7305         * fileread.h (Input_file::find_fie): New
7306         * plugin.cc (set_extra_library_path): New.
7307         (Plugin::load): Add set_extra_library_path to the transfer vector.
7308         (Plugin_manager::set_extra_library_path): New.
7309         (Plugin_manager::add_input_file): Use the extra search path if set.
7310         (set_extra_library_path(): New.
7311         * plugin.h (Plugin_manager): Add set_extra_library_path and
7312         extra_search_path_.
7313
7314 2010-06-19  Cary Coutant  <ccoutant@google.com>
7315
7316         * layout.cc (gdb_sections): Add .debug_types.
7317         (lines_only_debug_sections): Likewise.
7318
7319 2010-06-18  Rafael Espindola  <espindola@google.com>
7320
7321         * plugin.cc (add_input_file,add_input_library)
7322         (Plugin_manager::add_input_file): Make filename arguments const.
7323         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7324         const.
7325
7326 2010-06-16  Doug Kwan  <dougkwan@google.com>
7327
7328         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7329         .ARM.attributes section if we have not merged any input
7330         attributes sections.
7331
7332 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7333
7334         * arm.cc: Allow combining objects with no EABI version
7335         information.
7336
7337 2010-06-15  Rafael Espindola  <espindola@google.com>
7338
7339         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7340
7341 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7342
7343         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7344         (struct iovec): Correct !HAVE_READV definition.
7345
7346 2010-06-10  Cary Coutant  <ccoutant@google.com>
7347
7348         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7349         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7350         reloc sections.
7351         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7352
7353         PR 11683
7354         * symtab.h (Symbol::is_placeholder): New member function.
7355         * target-reloc.h (relocate_section): Check for placeholder symbols.
7356
7357         * testsuite/Makefile.am (plugin_test_8): New test.
7358         (plugin_test_9): New test.
7359         * testsuite/Makefile.in: Regenerate.
7360
7361 2010-06-09  Nick Clifton  <nickc@redhat.com>
7362
7363         * yyscript.y (input_list_element): Allow strings prefixed with
7364         the '-' character.  Treat these as libraries.
7365         * script.cc (script_add_library): New function.  Adds a library
7366         specified by "-l<name>" found in an input script.
7367         * script-c.h: Add prototype for script_add_library.
7368
7369 2010-06-07  Doug Kwan  <dougkwan@google.com>
7370
7371         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7372         Restrict stub-group size to be within long conditional branch
7373         range when working around cortex-A8 erratum.
7374
7375 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7376
7377         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7378         #ifdef typo.
7379
7380 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7381
7382         PR gold/11658
7383         * output.cc
7384         (Output_section::Input_section_sort_entry::compare_section_ordering):
7385         Change to return non-zero correctly.
7386         (Output_section::Input_section_sort_section_order_index_compare
7387         ::operator()): Change to fix ambiguity in comparisons.
7388
7389 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7390
7391         * gold.h (is_wildcard_string): New function.
7392         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7393         (Layout::layout_eh_frame): Ditto.
7394         (Layout::find_section_order_index): New method.
7395         (Layout::read_layout_from_file): New method.
7396         * layout.h (Layout::find_section_order_index): New method.
7397         (Layout::read_layout_from_file): New method.
7398         (Layout::input_section_position_): New private member.
7399         (Layout::input_section_glob_): New private member.
7400         * main.cc (main): Call read_layout_from_file here.
7401         * options.h (--section-ordering-file): New option.
7402         * output.cc (Output_section::input_section_order_specified_): New
7403         member.
7404         (Output_section::Output_section): Initialize new member.
7405         (Output_section::add_input_section): Add new parameter.
7406         Keep input sections when --section-ordering-file is used.
7407         (Output_section::set_final_data_size): Sort input sections when
7408         section ordering file is specified.
7409         (Output_section::Input_section_sort_entry): Add new parameter.
7410         Check sorting type.
7411         (Output_section::Input_section_sort_entry::compare_section_ordering):
7412         New method.
7413         (Output_section::Input_section_sort_compare::operator()): Change to
7414         consider section_order_index.
7415         (Output_section::Input_section_sort_init_fini_compare::operator()):
7416         Change to consider section_order_index.
7417         (Output_section::Input_section_sort_section_order_index_compare
7418         ::operator()): New method.
7419         (Output_section::sort_attached_input_sections): Change to sort
7420         according to section order when specified.
7421         (Output_section::add_input_section<32, true>): Add new parameter.
7422         (Output_section::add_input_section<64, true>): Add new parameter.
7423         (Output_section::add_input_section<32, false>): Add new parameter.
7424         (Output_section::add_input_section<64, false>): Add new parameter.
7425         * output.h (Output_section::add_input_section): Add new parameter.
7426         (Output_section::input_section_order_specified): New
7427         method.
7428         (Output_section::set_input_section_order_specified): New method.
7429         (Input_section::Input_section): Initialize section_order_index_.
7430         (Input_section::section_order_index): New method.
7431         (Input_section::set_section_order_index): New method.
7432         (Input_section::section_order_index_): New member.
7433         (Input_section::Input_section_sort_section_order_index_compare): New
7434         struct.
7435         (Output_section::input_section_order_specified_): New member.
7436         * script-sections.cc (is_wildcard_string): Delete and move modified
7437         method to gold.h.
7438         (Output_section_element_input::Output_section_element_input): Modify
7439         call to is_wildcard_string.
7440         (Output_section_element_input::Input_section_pattern
7441         ::Input_section_pattern): Ditto.
7442         (Output_section_element_input::Output_section_element_input): Ditto.
7443         * testsuite/Makefile.am (final_layout): New test case.
7444         * testsuite/Makefile.in: Regenerate.
7445         * testsuite/final_layout.cc: New file.
7446         * testsuite/final_layout.sh: New file.
7447
7448 2010-06-01  Rafael Espindola  <espindola@google.com>
7449
7450         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7451
7452 2010-06-01  Rafael Espindola  <espindola@google.com>
7453
7454         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7455         visibility of symbols.
7456
7457 2010-05-27  Doug Kwan  <dougkwan@google.com>
7458
7459         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7460         from start of output section instead of address for a local symbol
7461         in a merged or relaxed section when doing a relocatable link.
7462
7463 2010-05-26  Rafael Espindola  <espindola@google.com>
7464
7465         PR 11604
7466         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7467         adding sections the garbage collector removed.
7468         * gold/testsuite/Makefile.am: Add test.
7469         * gold/testsuite/Makefile.in: Regenerate.
7470         * gold/testsuite/plugin_test_7.sh: New.
7471         * gold/testsuite/plugin_test_7_1.c: New.
7472         * gold/testsuite/plugin_test_7_2.c: New.
7473
7474 2010-05-26  Rafael Espindola  <espindola@google.com>
7475
7476         * script-sections.cc (Output_section_definition::set_section_addresses):
7477         Check for --section-start.
7478
7479 2010-05-26  Doug Kwan  <dougkwan@google.com>
7480
7481         * arm.cc (Arm_scan_relocatable_relocs): New class.
7482         (Target_arm::relocate_special_relocatable): New method.
7483         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7484         (Arm_relocate_functions::thumb_branch_common): Same.
7485         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7486         instead of Default_scan_relocatable_relocs.
7487         * target-reloc.h (relocate_for_relocatable): Let target handle
7488         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7489         * target.h (Sized_target::relocate_special_relocatable): New method.
7490
7491 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7492
7493         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7494
7495 2010-05-23  Doug Kwan  <dougkwan@google.com>
7496
7497         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7498         instead of a cast.
7499         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7500         with a direct branch, not a conditional branch, to a stub.
7501         * merge.cc (Output_merge_base::record_input_section): New method
7502         defintion.
7503         (Output_merge_data::do_add_input_section): Record input section if
7504         keeps-input-sections flag is set.
7505         (Output_merge_string::do_add_input_section): Ditto.
7506         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7507         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7508         INPUT_SECTIONS_.
7509         (Output_merge_base::keeps_input_sections,
7510         Output_merge_base::set_keeps_input_sections,
7511         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7512         method definitions.
7513         (Output_merge_base::Input_sections): New type declaration.
7514         (Output_merge_base::input_sections_begin,
7515         Output_merge_base::input_sections_end,
7516         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7517         (Output_merge_base::bool keeps_input_sections_,
7518         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7519         Output_merge_base::input_sections_): New data members.
7520         (Output_merge_data::do_set_keeps_input_sections): New method
7521         defintion.
7522         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7523         * output.cc (Output_section::Input_section::relobj): Move method
7524         defintion from class declaration to here and handle merge sections.
7525         (Output_section::Input_section::shndx): Ditto.
7526         (Output_section::Output_section): Remove initializations of removed
7527         data members and initialize new data member LOOKUP_MAPS_.
7528         (Output_section::add_input_section): Set keeps-input-sections flag
7529         for a newly created merge output section as appropriate.  Adjust code
7530         to use Output_section_lookup_maps class.
7531         (Output_section::add_relaxed_input_section): Adjst code for lookup
7532         maps code refactoring.
7533         (Output_section::add_merge_input_section): Add a new parameter
7534         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7535         class.  If adding input section to a newly created merge output
7536         section fails, remove the new merge section.
7537         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7538         Adjust code for use of the Output_section_lookup_maps class.
7539         (Output_section::find_merge_section): Ditto.
7540         (Output_section::build_lookup_maps): New method defintion.
7541         (Output_section::find_relaxed_input_section): Adjust code to use
7542         Output_section_lookup_maps class.
7543         (Output_section::get_input_sections): Export merge sections.  Adjust
7544         code to use Output_section_lookup_maps class.
7545         (Output_section:::add_script_input_section): Adjust code to use
7546         Output_section_lookup_maps class.  Update lookup maps for merge
7547         sections also.
7548         (Output_section::discard_states): Use Output_section_lookup_maps.
7549         (Output_section::restore_states): Same.
7550         * output.h (Merge_section_properties): Move class defintion out of
7551         Output_section.
7552         (Output_section_lookup_maps): New class.
7553         (Output_section::Input_section::is_merge_section): New method
7554         defintion.
7555         (Output_section::Input_section::relobj): Move defintion out of class
7556         defintion.  Declare method only.
7557         (Output_section::Input_section::shndx): Ditto.
7558         (Output_section::Input_section::output_merge_base): New method defintion.
7559         (Output_section::Input_section::u2_.pomb): New union field.
7560         (Output_section::Merge_section_by_properties_map,
7561         Output_section::Output_section_data_by_input_section_map,
7562         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7563         Remove types.
7564         (Output_section::add_merge_input_section): Add new parameter
7565         KEEPS_INPUT_SECTIONS.
7566         (Output_section::build_lookup_maps): New method declaration.
7567         (Output_section::merge_section_map_,
7568         Output_section::merge_section_by_properties_map_,
7569         Output_section::relaxed_input_section_map_,
7570         Output_section::is_relaxed_input_section_map_valid_): Remove data
7571         members.
7572         (Output_section::lookup_maps_): New data member.
7573
7574 2010-05-21  Doug Kwan  <dougkwan@google.com>
7575
7576         PR gold/11619
7577         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7578         avoid a compilation error.
7579
7580 2010-05-19  Rafael Espindola  <espindola@google.com>
7581
7582         * script-sections.cc (Output_section_definition::allocate_to_segment):
7583         Update the phdrs_list even when the output section is NULL.
7584         * testsuite/Makefile.am: Add test.
7585         * testsuite/Makefile.in: Regenerate.
7586         * testsuite/script_test_9.cc: New.
7587         * testsuite/script_test_9.sh: New.
7588         * testsuite/script_test_9.t: New.
7589
7590 2010-05-19  Doug Kwan  <dougkwan@google.com>
7591
7592         * arm.cc (Arm_input_section::original_size): New method.
7593         (Arm_input_section::do_addralign): Add a cast.
7594         (Arm_input_section::do_output_offset): Remove static cast.
7595         (Arm_input_section::original_addralign,
7596          Arm_input_section::original_size_): Change type to uint32_t.
7597         (Arm_input_section::init): Add safe casts for section alignment
7598         and size.
7599         (Arm_input_section::set_final_data_size): Do not set address and
7600         offset of stub table.
7601         (Arm_output_section::fix_exidx_coverage): Change use of of
7602         Output_section::Simple_input_section to that of
7603         Output_section::Input_section.
7604         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7605         except for the first pass.
7606         * output.cc (Output_section::get_input_sections): Change type of
7607         input_sections to std::list<Input_section>.
7608         (Output_section::add_script_input_section): Rename from
7609         Output_section::add_simple_input_section.  Change type of SIS
7610         parameter from Simple_input_section to Input_section.
7611         * output.h (Output_section::Simple_input_section): Remove class.
7612         (Output_section::Input_section): Change class visibility to public.
7613         (Output_section::Input_section::addralign): Use stored alignments
7614         for special input sections if set.
7615         (Output_section::Input_section::set_addralign): New method.
7616         (Output_section::get_input_sections): Change parameter type from
7617         list of Simple_input_section to list of Input_section.
7618         (Output_section::add_script_input_section): Rename from
7619         Output_section::add_simple_input_section. Change first parameter's
7620         type from Simple_input_section to Input_section and remove the
7621         second and third parameters.
7622         * script-sections.cc (Input_section::Input_section_list): Change
7623         type to list of Output_section::Input_section/
7624         (Input_section_info::Input_section_info): Change parameter type of
7625         INPUT_SECTION to Output_section::Input_section.
7626         (Input_section_info::input_section): Change return type.
7627         (Input_section_info::input_section_): Change type to
7628         Output_section::Input_section.
7629         (Output_section_element_input::set_section_addresses): Adjust code
7630         to use Output_section::Input_section instead of
7631         Output_section::Simple_input_section.  Adjust code for renaming
7632         of Output_section::add_simple_input_section.
7633         (Orphan_output_section::set_section_addresses): Ditto.
7634
7635 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7636
7637         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7638         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7639
7640 2010-05-18  Rafael Espindola  <espindola@google.com>
7641
7642         * options.cc (General_options::finalize): Handle -nostdlib.
7643         * options.h (nostdlib): New option.
7644         * script.cc (script_add_search_dir): Handle -nostdlib.
7645
7646 2010-05-12  Doug Kwan  <dougkwan@google.com>
7647
7648         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7649         attributes section only if there no attributes section after merging.
7650         (Target_arm::merge_object_attributes): Move value of
7651         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7652         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7653         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7654         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7655         and arm_attr_merge_7.stdout.
7656         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7657         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7658         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7659         arm_attr_merge_7b.o): New rules.
7660         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7661         arm_attr_merge_7
7662         * testsuite/Makefile.in: Regenerate.
7663         * testsuite/arm_attr_merge.sh: New file.
7664         * testsuite/arm_attr_merge_[67][ab].s: Same.
7665
7666 2010-05-05  Nick Clifton  <nickc@redhat.com>
7667
7668         * po/es.po: Updated Spanish translation.
7669
7670 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7671
7672         * Makefile.am (install-exec-local): Properly install gold as
7673         default cross linker.
7674         * Makefile.in: Regenerated.
7675
7676 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7677             Nick Clifton  <nickc@redhat.com>
7678
7679         * configure.ac (install_as_default): Define and set to false
7680         unless --enable-gold or --enable-gold=both/gold has been
7681         specified.
7682         * configure: Regenerate.
7683
7684         * Makefile.am (install-exec-local): Install the executable as
7685         'ld.gold'.  If install_as_default is true then also install it as
7686         'ld'.
7687         * Makefile.in: Regenerated.
7688
7689 2010-04-24  Ian Lance Taylor  <iant@google.com>
7690
7691         * layout.cc (Layout::layout_reloc): In relocatable link don't
7692         combine reloc sections for grouped sections.
7693
7694 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7695
7696         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7697         sections that are not ordinary to icf.
7698         * icf.cc (get_section_contents): Handle relocation pointing to section
7699         with no object or shndx information.
7700         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7701         * testsuite/Makefile.in: Regenerate.
7702         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7703         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7704
7705 2010-04-22  Ian Lance Taylor  <iant@google.com>
7706
7707         * expression.cc (Expression::Expression_eval_info): Add
7708         result_alignment_pointer field.
7709         (Expression::eval_with_dot): Add result_alignment_pointer
7710         parameter.  Change all callers.
7711         (Expression::eval_maybe_dot): Likewise.
7712         (class Binary_expression): Add alignment_pointer parameter to
7713         left_value and right_value.  Change all callers.
7714         (BINARY_EXPRESSION): Set result alignment.
7715         (class Trinary_expression): Add alignment_pointer parameter to
7716         arg2_value and arg3_value.  Change all callers.
7717         (Trinary_cond::value): Set result alignment.
7718         (Max_expression::value, Min_expression::value): Likewise.
7719         (Align_expression::value): Likewise.
7720         * script-sections.cc (class Sections_element): Add dot_alignment
7721         parameter to set_section_addresses virtual function.  Update
7722         instantiations.
7723         (class Output_section_element): Likewise.
7724         (Script_sections::create_segments): Add dot_alignment parameter.
7725         Change all callers.
7726         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7727         (Script_sections::set_phdrs_clause_addresses): Likewise.
7728         * script-sections.h: Update declarations.
7729         * script.h: Update declarations.
7730         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7731         min_p_align.
7732         * testsuite/script_test_3.t: Set large alignment.
7733         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7734         segment has expected alignment.
7735
7736 2010-04-22  Nick Clifton  <nickc@redhat.com>
7737
7738         * po/gold.pot: Updated by the Translation project.
7739         * po/vi.po: Updated Vietnamese translation.
7740
7741 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7742
7743         * testsuite/Makefile.am (check_PROGRAMS): Add
7744         icf_virtual_function_folding_test.
7745         * testsuite/Makefile.in: Regenerated.
7746
7747 2010-04-15  Andrew Haley  <aph@redhat.com>
7748
7749         * options.h (merge_exidx_entries): New option.
7750         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7751         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7752         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7753         (Target_arm::merge_exidx_entries): New function.
7754         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7755         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7756         to Arm_exidx_fixup constructor.
7757         Add new arg, merge_exidx_entries.
7758         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7759         Arm_output_section::fix_exidx_coverage.
7760
7761 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7762
7763         * icf.cc (get_section_contents): Check for preemptible functions.
7764         Ignore addend when appropriate.
7765         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7766         section folded.
7767         (add_from_relobj): Check for section folded.
7768         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7769         * symtab.h (should_add_dynsym_entry): Add new parameter.
7770         * target-reloc.h (scan_relocs): Check for section folded.
7771         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7772         Check reloc types for function pointers in shared objects.
7773         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7774         case.
7775         (icf_preemptible_functions_test): New test case.
7776         (icf_string_merge_test): New test case.
7777         * testsuite.Makefile.in: Regenerate.
7778         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7779         bar_glob.  Refactor code.
7780         * testsuite/icf_preemptible_functions_test.cc: New file.
7781         * testsuite/icf_preemptible_functions_test.sh: New file.
7782         * testsuite/icf_string_merge_test.cc: New file.
7783         * testsuite/icf_string_merge_test.sh: New file.
7784         * testsuite/icf_virtual_function_folding_test.cc: New file.
7785         * testsuite/icf_virtual_function_folding_test.sh: New file.
7786
7787 2010-04-14  Doug Kwan  <dougkwan@google.com>
7788
7789         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7790         for local symbol recounting if we remove a section due to ICF.
7791         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7792         there are no regular objects in input.
7793
7794 2010-04-13  Doug Kwan  <dougkwan@google.com>
7795
7796         * arm.cc (Arm_input_section::set_final_data_size): Compute
7797         accurate final data size instead of using current data size.
7798
7799 2010-04-09  Doug Kwan  <dougkwan@google.com>
7800
7801         * layout.cc (Layout::choose_output_section): Handle script section
7802         types.
7803         (Layout::make_output_section_for_script): Add section type parameter.
7804         Handle script section types.
7805         * layout.h (Layout::make_output_section_for_script): Add section
7806         type parameter.
7807         * output.cc (Output_section::Output_section): Initialize data member
7808         is_noload_.
7809         (Output_section::do_reset_address_and_file_offset): Do not set address
7810         to 0 if section is a NOLOAD section.
7811         * output.h (Output_section::is_noload): New method.
7812         (Output_section::set_is_noload): Ditto.
7813         (Output_section::is_noload_): New data member.
7814         * script-c.h (Script_section_type): New enum type.
7815         (struct Parser_output_section_header): Add new file section_type.
7816         * script-sections.cc (Sections_element::output_section_name): Add
7817         parameter for returning script section type.
7818         (Output_section_definition::output_section_name): Ditto.
7819         (Output_section_definition::section_type)P; New method.
7820         (Output_section_definiton::script_section_type_name): Ditto.
7821         (Output_section_definition::script_section_type_): New data member.
7822         (Output_section_definition::Output_section_definition): Initialize
7823         data member Output_section_definition::script_section_type_.
7824         (Output_section_definition::create_sections): Pass script section type
7825         to Layout::make_output_section_for_script.
7826         (Output_section_definition::output_section_name): Return script
7827         section type to caller.
7828         (Output_section_definition::set_section_address): Do not advance
7829         dot value and load address if section type is NOLOAD.  Set address
7830         of NOLOAD sections regardless of section flags.
7831         (Output_section_definition::print): Print section type if it is
7832         not SCRIPT_SECTION_TYPE_NONE.
7833         (Output_section_definition::section_type): New method.
7834         (Output_section_definition::script_section_type_name): Ditto.
7835         (Script_sections::output_section_name): Add new parameter
7836         PSECTION_TYPE for returning script section type.  Pass it to
7837         section elements.  Handle discard sections.
7838         (Sort_output_sections::operator()): Handle NOLOAD sections.
7839         * script-sections.h (Script_sections::Section_type): New enum type.
7840         (Script_sections::output_section_name): Add a new parameter for
7841         returning script section type.
7842         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7843         INFO and NOLOAD.
7844         * yyscript.y (union): Add new field SECTION_TYPE.
7845         (COPY, DSECT, INFO, NOLOAD): New tokens.
7846         (opt_address_and_section_type): Change type to output_section_header.
7847         (section_type): New non-terminal
7848         (section_header): Handle section type.
7849         (opt_address_and_section_type): Return section type value.
7850
7851 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7852
7853         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7854         * testsuite/plugin_common_test_2.c (foo): Likewise.
7855
7856 2010-04-08  Doug Kwan  <dougkwan@google.com>
7857
7858         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7859         Output_merge_data.
7860         * output.cc (Output_section::add_merge_input_section): Simplify
7861         code and return status of Output_merge_base::add_input_section.
7862         Update merge section map only if Output_merge_base::add_input_section
7863         returns true.
7864
7865 2010-04-07  Doug Kwan  <dougkwan@google.com>
7866
7867         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7868         if section is marked as containing instructions but has no mapping
7869         symbols.
7870         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7871         correct section index.
7872         (Arm_relobj::find_linked_text_section): Ditto.
7873
7874 2010-04-07  Cary Coutant  <ccoutant@google.com>
7875
7876         * archive.cc (include_member): Destroy Read_symbols_data object before
7877         releasing file.
7878         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7879         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7880         (Read_symbols_data::~Read_symbols_data) New destructor.
7881         (Section_relocs::Section_relocs) New constructor.
7882         (Section_relocs::~Section_relocs) New destructor.
7883         (Read_relocs_data::Read_relocs_data) New constructor.
7884         (Read_relocs_data::~Read_relocs_data) New destructor.
7885         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7886         pointers to NULL after deleting.
7887
7888 2010-04-07  Doug Kwan  <dougkwan@google.com>
7889
7890         * arm.cc: Replace "endianity" with "endianness" in comments.
7891         (Arm_exidx_cantunwind): Ditto.
7892         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7893         (Arm_relobj::merge_flags_and_attributes): New method.
7894         (Arm_relobj::merge_flags_and_attributes_): New data member.
7895         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7896         (Arm_relobj::scan_sections_for_stubs): Ditto.
7897         (Arm_relobj::do_read_symbols): Check to see if we really want to
7898         merge processor-specific flags and attributes.  Exit early if
7899         an object is empty except for section names and the undefined symbol.
7900         (Target_arm::do_finalize_sections): Move check for ELF format to
7901         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7902         attributes from a regular object only when we have determined that
7903         it is aapropriate.  Do not create an .ARM.attributes section in
7904         output if there is no regular input object.
7905         (Target_arm::merge_processor_specific_flags): Check
7906         --warn-mismatch before printing any error.
7907         (Target_arm::merge_object_attributes): Ditto.
7908         * gold.cc (queue_middle_tasks): Handle the case in which there is
7909         no regular object in input.
7910         * options.cc (General_options::parse_EB): New method.
7911         (General_options::parse_EL): Same.
7912         (General_options::General_options): Initialize endianness_.
7913         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7914         New options.
7915         (General_options::Endianness): New enum.
7916         (General_options::endianness): New method.
7917         (General_options::endianness_): New data member.
7918         * parameters.cc (Parameters::set_options): Check target endianness.
7919         (Parameters::set_target_once): Ditto.
7920         (Parameters::check_target_endianness): New method.
7921         (parameters_force_valid_target): If either -EL or -EB is specified,
7922         use it to define endianness of default target.
7923         * parameters.h (Parameters::check_target_endianness): New method
7924         declaration.
7925         * target.h (class Target): Change "endianity" to "endianness"
7926         in comments.
7927
7928 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7929
7930         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7931         * configure: Regenerate.
7932         * Makefile.in: Regenerate.
7933         * testsuite/Makefile.in: Regenerate.
7934
7935 2010-04-06  Cary Coutant  <ccoutant@google.com>
7936
7937         gcc PR lto/42757
7938         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7939         prevailing definitions of common symbols.
7940         * testsuite/plugin_test_6.sh: New test case.
7941         * testsuite/plugin_common_test_1.c: New test case.
7942         * testsuite/plugin_common_test_2.c: New test case.
7943         * testsuite/Makefile.am (plugin_test_6): New test case.
7944         * testsuite/Makefile.in: Regenerate.
7945
7946 2010-04-06  Nick Clifton  <nickc@redhat.com>
7947
7948         * po/vi.po: New Vietnamese translation.
7949
7950 2010-03-30  Doug Kwan  <dougkwan@google.com>
7951
7952         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7953
7954 2010-03-25  Doug Kwan  <dougkwan@google.com>
7955
7956         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7957         to avoid a conversion warning on a 32-bit host.
7958
7959 2010-03-24  Ian Lance Taylor  <iant@google.com>
7960
7961         * testsuite/script_test_3.t: Add a TLS segment.
7962         * testsuite/Makefile.am (check_PROGRAMS): Add
7963         tls_phdrs_script_test.
7964         (tls_phdrs_script_test_SOURCES): Define.
7965         (tls_phdrs_script_test_DEPENDENCIES): Define.
7966         (tls_phdrs_script_test_LDFLAGS): Define.
7967         (tls_phdrs_script_test_LDADD): Define.
7968         * testsuite/Makefile.in: Rebuild.
7969
7970 2010-03-23  Cary Coutant  <ccoutant@google.com>
7971
7972         * fileread.cc (find_or_make_view): Fix comment.
7973
7974 2010-03-23  Ian Lance Taylor  <iant@google.com>
7975
7976         * script-sections.cc (class Orphan_section_placement): Define
7977         PLACE_TLS and PLACE_TLS_BSS.
7978         (Orphan_section_placement::Orphan_section_placement): Initialize
7979         new places.
7980         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7981         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7982         (tls_script_test_SOURCES): Define.
7983         (tls_script_test_DEPENDENCIES): Define.
7984         (tls_script_test_LDFLAGS): Define.
7985         (tls_script_test_LDADD): Define.
7986         * testsuite/Makefile.in: Rebuild.
7987
7988 2010-03-22  Doug Kwan  <dougkwan@google.com>
7989
7990         * arm.cc (Arm_relocate_functions::abs8,
7991         Arm_relocate_functions::abs16): Use correct check for overflow
7992         specified in the ARM ELF specs.
7993         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7994         target of a BLX instruction specially.
7995         (Reloc_stub::stub_type_for_reloc): Ditto.
7996         (Relocate::relocate): Use symbolic names instead of numeric relocation
7997         codes to report error.
7998         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7999         workaround.
8000         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8001         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8002         thumb2_blx_out_of_range.stdout
8003         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8004         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8005         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8006         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8007         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8008         thumb2_blx_in_range, thumb2_blx_in_range.o,
8009         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8010         thumb2_blx_out_of_range.o): New rules.
8011         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8012         thumb2_blx_in_range and thumb2_blx_out_of_range.
8013         * testsuite/Makefile.in: Regenerate.
8014         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8015         * testsuite/thumb_blx_in_range.s: New file.
8016         * testsuite/thumb_blx_out_of_range.s: New file.
8017
8018 2010-03-22  Rafael Espindola  <espindola@google.com>
8019
8020         * archive.cc (Should_include): Move to archive.h.
8021         (should_include_member): Make it a member of Archive.
8022         (Lib_group): New.
8023         (Add_lib_group_symbols): New.
8024         * archive.h: Include options.h.
8025         (Archive_member): Moved from Archive.
8026         (Should_include): Moved from archive.cc.
8027         (Lib_group): New.
8028         (Add_lib_group_symbols): New.
8029         * dynobj.cc (do_should_include_member): New.
8030         * dynobj.h (do_should_include_member): New.
8031         * gold.cc (queue_initial_tasks): Update call to queue.
8032         * main.cc (main): Print lib group stats.
8033         * object.cc (do_should_include_member): New.
8034         * object.h: Include archive.h.
8035         (Object::should_include_member): New.
8036         (Object::do_should_include_member): New.
8037         (Sized_relobj::do_should_include_member): New.
8038         * options.cc (General_options::parse_start_lib): New.
8039         (General_options::parse_end_lib): New.
8040         (Input_arguments::add_file): Handle lib groups.
8041         (Input_arguments::start_group): Check we are not in a lib.
8042         (Input_arguments::start_lib): New.
8043         (Input_arguments::end_lib): New.
8044         * options.h (General_options): Add start_lib and end_lib.
8045         (Input_argument::lib_): New.
8046         (Input_argument::lib): New.
8047         (Input_argument::is_lib): New.
8048         (Input_file_lib): New.
8049         (Input_arguments::in_lib_): New.
8050         (Input_arguments::in_lib): New.
8051         (Input_arguments::start_lib): New.
8052         (Input_arguments::end_lib_): New.
8053         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8054         in unused members as preempted.
8055         (Sized_pluginobj::do_should_include_member): New.
8056         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8057         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8058         return the blocker.
8059         (Read_symbols::do_whole_lib_group): New.
8060         (Read_symbols::do_lib_group): New.
8061         (Read_symbols::do_read_symbols): Handle lib groups.
8062         (Read_symbols::get_name): Handle lib groups.
8063         * readsyms.h (Read_symbols): Add an archive member pointer.
8064         (Read_symbols::do_whole_lib_group): New.
8065         (Read_symbols::do_lib_group): New.
8066         (Read_symbols::member_): New.
8067         * script.cc (read_input_script): Update call to queue_soon.
8068
8069 2010-03-19  Doug Kwan  <dougkwan@google.com>
8070
8071         * arm.cc (Stub_table::Stub_table): Initialize new data members
8072         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8073         (Stub_table::add_reloc_stub): Assign stub offset and update
8074         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8075         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8076         New data members.
8077         (Stub_table::update_data_size_and_addralign): Use
8078         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8079         instead of going over all reloc stubs.
8080         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8081         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8082         Stringpool_template::offset_ to size of Stringpool_char.
8083         (Stringpool_template::new_key_offset): Remove code to initialize
8084         Stringpool_template::offset_.
8085         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8086         Stringpool_template::offset_ to zero.
8087
8088 2010-03-15  Doug Kwan  <dougkwan@google.com>
8089
8090         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8091         offset_.
8092         (Stringpool_template::new_key_offset): New method.
8093         (Stringpool_template::add_string): Assign offsets when adding new
8094         strings.
8095         (Stringpool_template::set_string_offsets): Do not set string offsets
8096         when not optimizing.
8097         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8098         member size_.
8099         (Chunked_vector::clear): Clear size_.
8100         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8101         (Chunked_vector::size): Return size_.
8102         (Chunked_vector::push_back): Use size_ to find insert position.
8103         (Chunked_vector::size_): New data member.
8104         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8105         (Stringpool_template::new_key_offset): New method declaration.
8106         (Stringpool_template::offset_): New data member.
8107
8108 2010-03-15   Rafael Espindola  <espindola@google.com>
8109
8110         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8111         Add_symbols' constructor.
8112         * readsyms.h (Add_symbols): Remove the input_group member.
8113
8114 2010-03-10  Ian Lance Taylor  <iant@google.com>
8115
8116         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8117         target to ask whether a reference to a symbol requires a stack
8118         split.
8119         * target.h (Target::is_call_to_non_split): New function.
8120         (Target::do_is_call_to_non_split): Declare virtual function.
8121         * target.cc: Include "symtab.h".
8122         (Target::do_is_call_to_non_split): New function.
8123         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8124
8125 2010-03-10  Cary Coutant  <ccoutant@google.com>
8126
8127         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8128         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8129         (File_read::open[2]): Add whole_file_view_ to list of views.
8130         (File_read::make_view): Remove test of whole_file_view_.
8131         (File_read::find_or_make_view): Create whole_file_view_ if
8132         necessary.
8133         (File_read::clear_views): Replace bool parameter with enum;
8134         adjust all callers.  Don't delete views with permanent data;
8135         do delete cached views and views from archives if
8136         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8137         if clearing the corresponding view.
8138         * fileread.h (File_read::Clear_views_mode): New enum.
8139         (File_read::View::is_permanent_view): New method.
8140         (File_read::clear_views): Replace bool parameter
8141         with enum; adjust all callers.
8142         * options.h (General_options): Change keep_files_mapped option;
8143         add map_whole_files.
8144         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8145         releasing the file.
8146         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8147         the file.
8148
8149 2010-03-10  David S. Miller  <davem@davemloft.net>
8150
8151         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8152
8153 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8154
8155         * icf.cc (get_section_contents): Add '@' marker after processing the
8156         merge reloc.
8157
8158 2010-03-08  Doug Kwan  <dougkwan@google.com>
8159
8160         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8161         due to a conversion warning.
8162         (Arm_relobj::update_output_local_symbol_count): Check for local
8163         symbol with unset output index.
8164
8165 2010-03-05  Ian Lance Taylor  <iant@google.com>
8166
8167         * options.h (class General_options): Add --spare-dynamic-tags.
8168         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8169         --spare-dynamic-tags.
8170
8171 2010-03-05  Ian Lance Taylor  <iant@google.com>
8172
8173         * incremental.cc: Include "libiberty.h".
8174
8175 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8176
8177         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8178         function, is_info_ member.
8179         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8180         (Versions::Versions): Update caller.
8181         (Versions::define_base_version): Likewise.
8182         (Versions::add_def): Likewise.
8183
8184 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8185
8186         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8187         (Scan::possible_function_pointer_reloc): New function.
8188         (Scan::local_reloc_may_be_function_pointer): Change to call
8189         possible_function_pointer_reloc.
8190         (Scan::global_reloc_may_be_function_pointer): Ditto.
8191         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8192         relocations in ".data.rel.ro._ZTV" section.
8193         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8194         * testsuite/icf_safe_so_test.cc: Ditto.
8195         * testsuite/icf_safe_test.cc: Ditto.
8196         * testsuite/icf_safe_test.sh: Ditto.
8197
8198 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8199             Ian Lance Taylor  <iant@google.com>
8200
8201         * target-reloc.h (relocate_section): Check the symbol table index
8202         for -1U before setting the local symbol index.
8203         (scan_relocatable_relocs): If copying the relocation, record that
8204         the local symbol is required.
8205         * object.h (Symbol_value::is_output_symtab_index_set): New
8206         function.
8207         (Symbol_value::may_be_discarded_from_output_symtab): New
8208         function.
8209         (Symbol_value::has_output_symtab_entry): New function.
8210         (Symbol_value::needs_output_symtab_entry): Remove.
8211         (Symbol_value::output_symtab_index): Make sure the symbol index is
8212         set.
8213         (Symbol_value::set_output_symtab_index): Make sure the symbol
8214         index is not set.  Make sure the new index is valid.
8215         (Symbol_value::set_must_have_output_symtab_entry): New function.
8216         (Symbol_value::has_output_dynsym_entry): New function.
8217         (Symbol_value::set_output_dynsym_index): Make sure the new index
8218         is valid.
8219         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8220         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8221         local symbol if permitted.
8222         (Sized_relobj::do_finalize_local_symbols): Call
8223         is_output_symtab_index_set rather than needs_output_symtab_entry.
8224         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8225         rather than needs_output_symtab_entry.  Call
8226         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8227         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8228         is_output_symtab_index_set rather than needs_output_symtab_entry.
8229         * testsuite/discard_locals_relocatable_test.c: New file.
8230         * testsuite/discard_locals_test.sh: Test -r.
8231         * testsuite/Makefile.am (check_DATA): Add
8232         discard_locals_relocatable_test1.syms,
8233         discard_local_relocatable_test2.syms.
8234         (MOSTLYCLEANFILES): Likewise.  Also add
8235         discard_locals_relocatable_test1.lout and
8236         discard_locals_relocatable_test2.out.
8237         (discard_locals_relocatable_test1.syms): New target.
8238         (discard_locals_relocatable_test.o): New target.
8239         (discard_locals_relocatable_test1.out): New target.
8240         (discard_locals_relocatable_test2.syms): New target.
8241         (discard_locals_relocatable_test2.out): New target.
8242         (various): Add missing ../ld-new dependencies.
8243         * testsuite/Makefile.in: Rebuild.
8244
8245 2010-03-03  Nick Clifton  <nickc@redhat.com>
8246
8247         * po/fi.po: New Finnish translation.
8248
8249 2010-03-01  Doug Kwan  <dougkwan@google.com>
8250
8251         * layout.cc (Layout::Layout): Force section types of .init_array*,
8252         .preinit_array* and .fini_array* sections.
8253         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8254         Fix check of return value of std::string::find.().
8255         (Output_section::Input_section_sort_compare::operator()): Remove
8256         comment about .init_array.
8257         (Output_section::Input_section_sort_init_fini_compare::operator()):
8258         New method.
8259         (Output_section::sort_attached_input_sections): Handle .init_array
8260         and .fini_array specially.
8261         * output.h (Output_section::Inut_section_sort_compare): Update
8262         comment.
8263         (Output_section::Input_section_sort_init_fini_compare): New struct.
8264
8265 2010-02-26  Doug Kwan  <dougkwan@google.com>
8266
8267         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8268         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8269         * testsuite/debug_msg.sh: Avoid matching source line number for
8270         use of global variable undef_int.
8271
8272 2010-02-26  Doug Kwan  <dougkwan@google.com>
8273
8274         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8275         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8276         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8277         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8278         * options.cc (General_options::General_options): Initialize member
8279         fix_v4bx_.
8280         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8281         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8282         and rm_no_fix_v4bx.stdout
8283         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8284         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8285         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8286         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8287         and arm_no_fix_v4bx.
8288         * Makefile.in: Regenerate.
8289         * testsuite/arm_fix_v4bx.s: New file.
8290         * testsuite/arm_fix_v4bx.sh: Ditto.
8291
8292 2010-02-24  Doug Kwan  <dougkwan@google.com>
8293
8294         * arm.cc (Target_arm::got_section): Make the .got section the first
8295         non RELRO section in the data segment.
8296         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8297         suffixes of section names.
8298
8299 2010-02-24  Doug Kwan  <dougkwan@google.com>
8300
8301         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8302         flags and attributes merging if an input file is a binary file.
8303         * fileread.cc (Input_file::open): Record format of original file.
8304         * fileread.h (Input_file::Format): New enum type.
8305         (Input_file::Input_file): Initialize data member format_.
8306         (Input_file::format): New method definition.
8307         (Input_file::format_):: New data member.
8308
8309 2010-02-24  Doug Kwan  <dougkwan@google.com>
8310
8311         * arm.cc (Arm_output_data_got): New class.
8312         (ARM_TCB_SIZE): New constant
8313         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8314         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8315         If user uses a script with a SECTIONS clause, issue only a warning
8316         for a misplaced EXIDX input section.  Otherwise, issue an error.
8317         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8318         garbage collection.
8319         (Target_arm::got_mode_index_entry): Handle static linking.
8320         (Target_arm::Scan::local): Ditto.
8321         (Target_arm::Scan::global): Ditto.
8322         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8323         all incorrectly implemented relocations.
8324         (Target_arm::fix_exidx_coverage): Pass layout to
8325         Arm_output_section::fix_exidx_coverage.
8326         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8327         from ".ARM.exidx." and ".ARM.extab.".
8328
8329 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8330
8331         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8332         section if it does not already exist.
8333         * attributes.cc (Attributes_section_data::Attributes_section_data):
8334         Don't crash if size is zero.
8335
8336 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8337             Ian Lance Taylor  <iant@google.com>
8338
8339         * gold.cc (queue_middle_tasks): If no input files were opened,
8340         exit.
8341         * workqueue.h (Task_function::Task_function): Assert that there is
8342         a blocker.
8343
8344 2010-02-22  Doug Kwan  <dougkwan@google.com>
8345
8346         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8347         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8348         types to avoid warnings due to different uint64_t implementations
8349         on different hosts.
8350
8351 2010-02-21  Doug Kwan  <dougkwan@google.com>
8352
8353         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8354         handling of the maximum backward branch offset.
8355         (Arm_relocate_functions::thumb_branch_common): Ditto.
8356         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8357         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8358         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8359         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8360         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8361         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8362         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8363         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8364         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8365         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8366         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8367         thumb2_bl_out_of_range.o): New rules.
8368         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8369         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8370         thumb2_bl_out_of_range
8371         * testsuite/Makefile.in: Regenerate.
8372         * testsuite/arm_bl_in_range.s: New file.
8373         * testsuite/arm_bl_out_of_range.s: Ditto.
8374         * testsuite/arm_branch_in_range.sh: Ditto.
8375         * testsuite/arm_branch_range.t: Ditto.
8376         * testsuite/thumb2_branch_range.t: Ditto.
8377         * testsuite/thumb_bl_in_range.s: Ditto.
8378         * testsuite/thumb_bl_out_of_range.s: Ditto.
8379         * testsuite/thumb_branch_range.t: Ditto.
8380
8381 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8382
8383         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8384         Add reloc offset information.
8385         * icf.cc (get_section_contents): Change iterators to point to the new
8386         vectors. Add reloc offset information to the contents.
8387         * icf.h (Icf::Sections_reachable_info): New typedef.
8388         (Icf::Sections_reachable_list): New typedef.
8389         (Icf::Offset_info): New typedef.
8390         (Icf::Reloc_info): New struct typedef.
8391         (Icf::Reloc_info_list): New typedef.
8392         (Icf::symbol_reloc_list): Delete method.
8393         (Icf::addend_reloc_list): Delete method.
8394         (Icf::section_reloc_list): Delete method.
8395         (Icf::reloc_info_list): New method.
8396         (Icf::reloc_info_list_): New member.
8397
8398 2010-02-19  Doug Kwan  <dougkwan@google.com>
8399
8400         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8401         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8402         * arm.cc (Arm_relocation_functions): New forward declaration.
8403         (Target_arm::Target_arm): Initialize new data members
8404         got_mod_index_offset_ and tls_base_symbol_defined_.
8405         (Target_arm::Relocate::relocate_tls): New method.
8406         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8407          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8408         New methods.
8409         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8410         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8411         (Target_arm::got_mod_index_offset_,
8412         Target_arm::tls_base_symbol_defined_): New data members.
8413         (Target_arm::Scan::local, Target::Scan::global,
8414         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8415         relocations.
8416
8417 2010-02-18  Doug Kwan  <dougkwan@google.com>
8418
8419         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8420         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8421         text section as a parameter becuase some broken tools may not set
8422         the link in section header.
8423         (Target_arm::has_got_section): New method.
8424         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8425         without any mapping symbol as data only.  Remove warning.
8426         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8427         link in its section header, try to discover the link by inspecting the
8428         REL31 relocation at the beginning of the section.
8429         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8430         in error message.
8431         (Target_arm::Scan::global): Treat any reference to the symbol
8432         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8433
8434 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8435
8436         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8437         (Scan::global_reloc_may_be_function_pointer): New function.
8438         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8439         (Scan::global_reloc_may_be_function_pointer): New function.
8440         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8441         (Scan::global_reloc_may_be_function_pointer): New function.
8442         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8443         (Scan::global_reloc_may_be_function_pointer): New function.
8444         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8445         (Scan::global_reloc_may_be_function_pointer): New function.
8446         (Scan::possible_function_pointer_reloc): New function.
8447         (Target_x86_64::can_check_for_function_pointers): New function.
8448         * gc.h (gc_process_relocs): Scan relocation types to determine if
8449         function pointers were taken for targets that support it.
8450         * icf.cc (Icf::find_identical_sections): Include functions for
8451         folding in safe ICF whose pointer is not taken.
8452         * icf.h (Secn_fptr_taken_set): New typedef.
8453         (fptr_section_id_): New member.
8454         (section_has_function_pointers): New function.
8455         (set_section_has_function_pointers): New function.
8456         (check_section_for_function_pointers): New function.
8457         * options.h: Fix comment for safe ICF option.
8458         * target.h (can_check_for_function_pointers): New function.
8459         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8460         Modify icf_safe_test for X86-64.
8461         * testsuite/Makefile.in: Regenerate.
8462         * testsuite/icf_safe_so_test.cc: New file.
8463         * testsuite/icf_safe_so_test.sh: New file.
8464         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8465         (main): Change to take pointer to function kept_func_3.
8466         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8467         folding is done correctly for X86-64.
8468
8469 2010-02-12  David S. Miller  <davem@davemloft.net>
8470
8471         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8472         is_symbolless parameter.
8473         (Output_reloc<SHT_REL>::is_symbolless): New.
8474         (Output_reloc<SHT_REL>::is_symbolless_): New.
8475         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8476         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8477         (Output_reloc<SHT_RELA>::is_symbolless): New.
8478         (Output_data_reloc::add_global): Handle is_symbolless.
8479         (Output_data_reloc::add_global_relative): Likewise.
8480         (Output_data_reloc::add_local): Likewise.
8481         (Output_data_reloc::add_local_relative): Likewise.
8482         (Output_data_reloc::add_symbolless_global_addend): New.
8483         (Output_data_reloc::add_symbolless_local_addend): New.
8484         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8485         is_symbolless.
8486         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8487         instead of ->is_relative_
8488         (Output_reloc::write): Likewise.
8489         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8490         (Output_reloc::write_rel): Simplify.
8491
8492         * sparc.cc (Target_sparc::Scan::local): Use
8493         ->add_symbolless_local_addend as needed.
8494         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8495         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8496         based upon relocation offset.
8497
8498 2010-02-11  Doug Kwan  <dougkwan@google.com>
8499
8500         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8501         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8502         beginning of function.
8503         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8504         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8505         parameter is_32bit in calls to should_apply_static_reloc.
8506         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8507         (check_DATA): Add arm_abs_global.stdout.
8508         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8509         arm_abs_global.stdout): New rules.
8510         (MOSTLLYCLEANFILES): Add arm_abs_global
8511         * Makefile.in: Regenerate.
8512         * testsuite/arm_abs_global.s: New file.
8513         * testsuite/arm_abs_global.sh: Ditto.
8514         * testsuite/arm_abs_lib.s: Ditto.
8515
8516 2010-02-11  Ian Lance Taylor  <iant@google.com>
8517
8518         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8519         Read_relocs task.
8520         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8521         Allocate_commons_task first.
8522         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8523         task, rather than symtab_lock_.
8524         (Gc_process_relocs::~Gc_process_relocs): New function.
8525         (Gc_process_relocs::is_runnable): Check this_blocker_.
8526         (Gc_process_relocs::locks): Use next_blocker_ rather than
8527         blocker_.
8528         (Scan_relocs::~Scan_relocs): New function.
8529         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8530         symtab_lock_.
8531         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8532         next_blocker_.
8533         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8534         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8535         constructor accordingly.
8536         (class Gc_process_relocs): Likewise.
8537         (class Scan_relocs): Likewise.
8538         * common.h (class Allocate_commons_task): Remove symtab_lock_
8539         field, and corresponding constructor parameter.
8540         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8541         symtab_lock_.
8542         (Allocate_commons_task::locks): Likewise.
8543
8544 2010-02-11  Ian Lance Taylor  <iant@google.com>
8545
8546         * gold-threads.h (class Once): Define.
8547         (class Initialize_lock): Rewrite as child of Once.
8548         * gold-threads.cc (class Once_initialize): Define.
8549         (once_pointer_control): New static variable.
8550         (once_pointer, once_arg): New static variables.
8551         (c_run_once): New static function.
8552         (Once::Once, Once::run_once, Once::internal_run): New functions.
8553         (class Initialize_lock_once): Remove.
8554         (initialize_lock_control): Remove.
8555         (initialize_lock_pointer): Remove.
8556         (initialize_lock_once): Remove.
8557         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8558         (Initialize_lock::initialize): Rewrite.
8559         (Initialize_lock::do_run_once): New function.
8560         * archive.cc (Archive::interpret_header): Only clear name if it is
8561         not already empty.
8562         * fileread.cc: Include "gold-threads.h"
8563         (file_counts_lock): New static variable.
8564         (file_counts_initialize_lock): Likewise.
8565         (File_read::release): Only increment counts when using --stats.
8566         Use a lock around the increment.
8567         * parameters.cc (class Set_parameters_target_once): Define.
8568         (set_parameters_target_once): New static variable.
8569         (Parameters::Parameters): Move here from parameters.h.
8570         (Parameters::set_target): Rewrite.
8571         (Parameters::set_target_once): New function.
8572         (Parameters::clear_target): Move here and rewrite.
8573         * parameters.h (class Parameters): Update declarations.  Add
8574         set_parameters_target_once_ field.
8575         (Parameters::Parameters): Move to parameters.cc.
8576         (Parameters::clear_target): Likewise.
8577         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8578         task.
8579         (Start_group::~Start_group): New function.
8580         (Start_group::is_runnable): New function.
8581         (Start_group::locks, Start_group::run): New functions.
8582         (Finish_group::run): Change saw_undefined to size_t.
8583         * readsyms.h (class Start_group): Define.
8584         (class Finish_group): Change saw_undefined_ field to size_t.
8585         (Finish_group::Finish_group): Remove saw_undefined and
8586         this_blocker parameters.  Change all callers.
8587         (Finish_group::set_saw_undefined): New function.
8588         (Finish_group::set_blocker): New function.
8589         * symtab.h (class Symbol_table): Change saw_undefined to return
8590         size_t.  Change saw_undefined_ field to size_t.
8591         * target-select.cc (Set_target_once::do_run_once): New function.
8592         (Target_selector::Target_selector): Initialize set_target_once_
8593         field.  Don't initialize lock_ and initialize_lock_ fields.
8594         (Target_selector::instantiate_target): Rewrite.
8595         (Target_selector::set_target): New function.
8596         * target-select.h (class Set_target_once): Define.
8597         (class Target_selector): Update declarations.  Make
8598         Set_target_once a friend.  Remove lock_ and initialize_lock_
8599         fields.  Add set_target_once_ field.
8600
8601 2010-02-10  Ian Lance Taylor  <iant@google.com>
8602
8603         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8604         queueing any tasks.
8605         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8606         (queue_middle_tasks): Add all blockers before queueing any tasks.
8607         (queue_final_tasks): Likewise.
8608         * token.h (Task_token::add_blockers): New function.
8609         * object.h (Input_objects::number_of_relobjs): New function.
8610
8611 2010-02-10  Ian Lance Taylor  <iant@google.com>
8612
8613         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8614         shared, not if not position independent.
8615         * x86_64.cc (Relocate::relocate_tls): Likewise.
8616         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8617         (tls_pie_pic_test): New target.
8618         * testsuite/Makefile.in: Rebuild.
8619
8620         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8621         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8622         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8623         * testsuite/Makefile.in: Rebuild.
8624
8625 2010-02-09  David S. Miller  <davem@davemloft.net>
8626
8627         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8628         R_SPARC_RELATIVE using ->add_local_relative().
8629         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8630
8631         * output.h (Output_data_dynamic::add_section_size): New method
8632         that takes two Output_data objects.
8633         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8634         entry param.  Handle it in initializers.
8635         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8636         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8637         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8638         arg.
8639         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8640         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8641         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8642         for dynrel_includes_plt.
8643         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8644         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8645         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8646         before .rela.plt
8647         (Target_sparc::do_finalize_sections): Update to pass true for
8648         dynrel_includes_plt.
8649         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8650         output before .rela.plt
8651         (Target_powerpc::do_finalize_sections): Update to pass true for
8652         dynrel_includes_plt when 32-bit.
8653
8654 2010-02-08  Doug Kwan  <dougkwan@google.com>
8655
8656         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8657         method.
8658         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8659         Arm_relobj::scan_section_for_cortex_a8_stubs,
8660         Arm_relobj::do_relocation_section): Instead of calling
8661         Output_section::output_address, use faster
8662         Arm_relobj::simple_input_section_output_address.
8663
8664 2010-02-08  David S. Miller  <davem@davemloft.net>
8665
8666         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8667         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8668         relocation helper function.
8669
8670         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8671         just like R_SPARC_GOT{10,13,22}.
8672         (Target_sparc::Scan::local): Likewise.
8673         (Target_sparc::Relocate:relocate): Likewise.
8674
8675 2010-02-06  Ian Lance Taylor  <iant@google.com>
8676
8677         * configure.ac: Rewrite targetobjs duplicate removal code to use
8678         only shell constructs.
8679         * configure: Rebuild.
8680
8681 2010-02-05  Doug Kwan  <dougkwan@google.com>
8682
8683         PR 11247
8684         * arm.cc (Arm_relobj::section_is_scannable): New method.
8685         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8686         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8687
8688 2010-02-04  Doug Kwan  <dougkwan@google.com>
8689
8690         PR 11247
8691         * arm-reloc-property.cc (cstdio): Include.
8692         * configure.ac (targetobjs): Remove duplicates.
8693         * configure: Regenerate.
8694         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8695         big and little endian version for a given address size.
8696
8697 2010-02-03  Doug Kwan  <dougkwan@google.com>
8698
8699         * arm-reloc-property.cc
8700         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8701         definition.
8702         * arm-reloc-property.h
8703         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8704         New method definition.
8705         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8706         declaration.
8707         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8708         overflow to N.
8709         (GOT_PREL): Change implemented to Y.
8710         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8711         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8712         (Arm_relocate_functions::movw_abs_nc): Remove method.
8713         (Arm_relocate_functions::movt_abs): Ditto.
8714         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8715         (Arm_relocate_functions::thm_movt_abs): Ditto.
8716         (Arm_relocate_functions::movw_rel_nc): Ditto.
8717         (Arm_relocate_functions::movw_rel): Ditto.
8718         (Arm_relocate_functions::movt_rel): Ditto.
8719         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8720         (Arm_relocate_functions:thm_movw_rel): Ditto.
8721         (Arm_relocate_functions:thm_movt_rel): Ditto.
8722         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8723         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8724         New method definitions.
8725         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8726         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8727         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8728         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8729         (Target_arm::Relocate::relocate): Check for non-static or
8730         unimplemented relocation code and exit early.  Change calls to
8731         Target_arm::reloc_uses_thumb_bit and
8732         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8733         instead.  Refactor code to handle similar relocations to increase
8734         code sharing.  Remove check for unsupported relocation code in switch
8735         statement.
8736         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8737         relocation property table to find out size.  Change error message to
8738         print out the name of a relocation code instead of the numeric value.
8739         (Target_arm::scan_reloc_for_stub): Use relocation property table
8740         instead of calling Target_arm::reloc_uses_thumb_bit().
8741
8742 2010-02-02  Doug Kwan  <dougkwan@google.com>
8743
8744         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8745         types of relaxed input section.
8746
8747 2010-02-02  Doug Kwan  <dougkwan@google.com>
8748
8749         * Makefile.am (HFILES): Add arm-reloc-property.h.
8750         (DEFFILES): New.
8751         (TARGETSOURCES): Add arm-reloc-property.cc
8752         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8753         (libgold_a_SOURCES): $(DEFFILES)
8754         * Makefile.in: Regenerate.
8755         * arm-reloc-property.cc: New file.
8756         * arm-reloc-property.h: New file.
8757         * arm-reloc.def: New file.
8758         * arm.cc: Update comments.
8759         (arm-reloc-property.h): New included header.
8760         (arm_reloc_property_table): New global variable.
8761         (Target_arm::do_select_as_default_target): New method definition.
8762         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8763         arm-reloc-property to targ_extra_obj.
8764         * parameters.cc (set_parameters_target): Call
8765         Target::select_as_default_target().
8766         * target.h (Target::select_as_default_target): New method definition.
8767         (Target::do_select_as_default_target): Same.
8768
8769 2010-02-01  Doug Kwan  <dougkwan@google.com>
8770
8771         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8772         first_output_text_section_.
8773         (Arm_exidx_fixup::first_output_text_section): New method definition.
8774         (Arm_exidx_fixup::first_output_text_section_): New data member.
8775         (Arm_exidx_fixup::process_exidx_section): Record the first text
8776         output section seen.
8777         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8778         and entsize in output section header.
8779
8780 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8781
8782         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8783         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8784         (Arm_relocate_functions::thm_alu11): New Method.
8785         (Arm_relocate_functions::thm_pc8): New Method.
8786         (Arm_relocate_functions::thm_pc12): New Method.
8787         (Target_arm::Scan::local): Handle the relocations.
8788         (Target_arm::Scan::global): Likewise.
8789         (Target_arm::Relocate::relocate): Likewise.
8790         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8791
8792 2010-01-29  Doug Kwan  <dougkwan@google.com>
8793
8794         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8795         of relocation types as ld.
8796
8797 2010-01-29  Doug Kwan  <dougkwan@google.com>
8798
8799         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8800         to public.
8801         (Arm_relocate_functions::thumb_branch_common): Ditto.
8802         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8803         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8804         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8805         Arm_relocate_functions::jump24): Remove.
8806         (Target_arm::Relocate::relocate): Adjust code to call
8807         Arm_relocation_functions::arm_branch_common and
8808         Arm_relocation_functions::thumb_branch_common instead of their removed
8809         wrappers.  Merge switch-cases together to reduce source code size.
8810
8811 2010-01-29  Doug Kwan  <dougkwan@google.com>
8812
8813         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8814         output_local_symbol_count_needs_update_.
8815         (Arm_relobj::output_local_symbol_count_needs_update,
8816          Arm_relobj::set_output_local_symbol_count_needs_update,
8817          Arm_relobj::update_output_local_symbol_count): New methods.
8818         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8819         member.
8820         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8821         of pointed function as in a R_ARM_PREL31 relocation.
8822         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8823         for output local symbol count updating.
8824         (Target_arm::do_relax): Update output local symbol counts in objects
8825         if necessary.
8826         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8827
8828 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8829
8830         * arm.cc: Added support for the ARM relocations:
8831         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8832         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8833         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8834         movw_prel_nc).
8835         (Arm_relocate_functions::movw_rel): New method.
8836         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8837         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8838         thm_movw_prel_nc).
8839         (Arm_relocate_functions::thm_movw_rel): New method.
8840         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8841         thm_movt_prel).
8842         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8843         relocations.
8844         (Target_arm::Scan::global): Likewise.
8845         (Target_arm::Relocate::relocate): Likewise.
8846         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8847         Likewise.
8848
8849 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8850
8851         * arm.cc: Added support for ARM group relocations.
8852         (Target_arm::reloc_needs_sym_origin): New method.
8853         (Arm_relocate_functions::calc_grp_kn): New method.
8854         (Arm_relocate_functions::calc_grp_residual): New method.
8855         (Arm_relocate_functions::calc_grp_gn): New method.
8856         (Arm_relocate_functions::arm_grp_alu): New Method.
8857         (Arm_relocate_functions::arm_grp_ldr): New Method.
8858         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8859         (Arm_relocate_functions::arm_grp_ldc): New Method.
8860         (Target_arm::Scan::local): Handle the ARM group relocations.
8861         (Target_arm::Scan::global): Likewise.
8862         (Target_arm::Relocate::relocate): Likewise.
8863         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8864         Likewise.
8865
8866 2010-01-26  Doug Kwan  <dougkwan@google.com>
8867
8868         * arm.cc (set): Include.
8869         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8870         pointer type.
8871         (Arm_output_section::Text_section_list): New type.
8872         (Arm_output_section::append_text_sections_to_list): New method.
8873         (Arm_output_section::fix_exidx_coverage): Ditto.
8874         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8875         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8876         Relobj::set_section_offset() instead of
8877         Sized_relobj::invalidate_section_offset().
8878         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8879         parameter for section headers. Ignore relocation sections for
8880         unallocated sections and EXIDX sections.
8881         (Target_arm::fix_exidx_coverage): New method.
8882         (Target_arm::output_section_address_less_than): New type.
8883         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8884         linked text section instead of the EXIDX section.
8885         (Arm_output_section::create_stub_group): Add an assertion to check
8886         that this is not an EXIDX output section.
8887         (Arm_output_section::append_text_sections_to_list): New method.
8888         (Arm_output_section::fix_exidx_coverage): Ditto.
8889         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8890         Arm_relobj::section_needs_reloc_stub_scanning.
8891         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8892         first pass.
8893         (Target_arm::fix_exidx_coverage): New method.
8894         * object.h (Relobj::set_output_section): New method.
8895         (Sized_relobj::invalidate_section_offset): Remove method.
8896         (Sized_relobj::do_invalidate_section_offset): Remove method.
8897         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8898
8899 2010-01-25  Doug Kwan  <dougkwan@google.com>
8900
8901         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8902         Fix warning due to signed and unsigned comparison on a 32-bit host.
8903
8904 2010-01-22  Doug Kwan  <dougkwan@google.com>
8905
8906         * arm.cc (Target_arm::do_relax): Record an output section for section
8907         offset adjustment it contains any stub table that has changed.
8908         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8909         offsets in an output section if necessary.
8910         * output.cc (Output_section::Output_section): Initialize
8911         section_offsets_need_adjustments_.
8912         (Output_section::add_input_section_for_script): Renamed to
8913         Output_section::add_simple_input_section.
8914         (Output_section::save_states): Add a comment.
8915         (Output_section::discard_states): New method defintion.
8916         (Output_section::adjust_section_offsets): Same.
8917         * output.h (Output_section::add_input_section_for_script): Renamed to
8918         Output_section::add_simple_input_section.
8919         (Output_section::discard_states): New method declaration.
8920         (Output_section::adjust_section_offsets): Same.
8921         (Output_section::section_offsets_need_adjustment,
8922         Output_section::set_section_offsets_need_adjustment): New method
8923         definitions.
8924         (Output_section::section_offsets_need_adjustment_): New data member.
8925         * script-sections.cc
8926         (Output_section_element_input::set_section_address): Adjust code for
8927         renaming of Output_section::add_input_section_for_script.
8928         (Orphan_output_section::set_section_address): Same.
8929
8930 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8931
8932         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8933         Fix_v4bx enum values .
8934         * gold/options.h (General_options): New option definitions.
8935         (General_options::fix_v4bx): New method.
8936         (General_options::Fix_v4bx): New enum.
8937         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8938         (General_options::parse_fix_v4bx_interworking): New method.
8939
8940 2010-01-22  Doug Kwan  <dougkwan@google.com>
8941
8942         * arm.cc (Arm_exidx_fixup): New class.
8943
8944 2010-01-21  Doug Kwan  <dougkwan@google.com>
8945
8946         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8947         classes.
8948         (Arm_exidx_section_offset_map): New type.
8949
8950 2010-01-21  Doug Kwan  <dougkwan@google.com>
8951
8952         * arm.cc (Arm_exidx_input_section): New class.
8953         (Arm_relobj::exidx_input_section_by_link,
8954         Arm_relobj::exidx_input_section_by_shndx,
8955         Arm_relobj::make_exidx_input_section): New methods.
8956         (read_arm_attributes_section): Remove.
8957         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8958         information about them.
8959         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8960         to here.
8961
8962 2010-01-20  Doug Kwan  <dougkwan@google.com>
8963
8964         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8965         Input_section_specifier to Section_id.
8966         (Target_arm::new_arm_input_section: Adjust code for change of key
8967         type.
8968         (Target_arm::find_arm_input_section): Ditto.
8969         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8970         (Section_id): Remove.
8971         (Garbage_collection::Section_id_hash): Remove.
8972         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8973         (Section_id): Remove.
8974         (Icf::Section_id_hash): Remove.
8975         * object.h (Section_id, Const_section_id, Section_id_hash,
8976         Const_section_id_hash): New type definitions.
8977         * output.cc (Output_section::add_relaxed_input_section): Change to
8978         use Const_section_id instead of Input_section_specifier as key type.
8979         (Output_section::add_merge_input_section): Ditto.
8980         (Output_section::build_relaxation_map): Change to use Section_id
8981         instead of Input_section_specifier as key type.
8982         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8983         Ditto.
8984         (Output_section::convert_input_sections_to_relaxed_sections): Change
8985         to use Const_section_id instead of Input_section_specifier as key type.
8986         (Output_section::find_merge_section): Ditto.
8987         (Output_section::find_relaxed_input_section): Ditto.
8988         * output.h (Input_section_specifier): Remove class.
8989         (Output_section::Output_section_data_by_input_section_map): Change
8990         key type to Const_section_id.
8991         (Output_section::Output_relaxed_input_section_by_input_section_map):
8992         Ditto.
8993         (Output_section::Relaxation_map): Change key type to Section_id.
8994
8995 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8996
8997         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8998         (class Arm_v4bx_stub): New class.
8999         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9000         (Stub_factory::make_arm_v4bx_stub): New method.
9001         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9002         (Stub_table::empty): Handle v4bx stubs.
9003         (Stub_table::add_arm_v4bx_stub): New method.
9004         (Stub_table::find_arm_v4bx_stub): New method.
9005         (Arm_relocate_functions::v4bx): New method.
9006         (Target_arm::fix_v4bx): New method.
9007         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9008         (Stub_table::relocate_stubs): Likewise.
9009         (Stub_table::do_write): Likewise.
9010         (Stub_table::update_data_size_and_addralign): Likewise.
9011         (Stub_table::finalize_stubs):  Likewise.
9012         (Target_arm::Scan::local): Likewise.
9013         (Target_arm::Scan::global): Likewise.
9014         (Target_arm::do_finalize_sections): Likewise.
9015         (Target_arm::Relocate::relocate): Likewise.
9016         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9017         Likewise.
9018         (Target_arm::scan_reloc_for_stub): Likewise.
9019         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9020
9021 2010-01-19  Ian Lance Taylor  <iant@google.com>
9022
9023         * output.cc (Output_section_headers::do_sized_write): Write large
9024         segment count to sh_info field.
9025         (Output_file_header::do_sized_write): For large segment count,
9026         write PN_XNUM to e_phnum field.
9027
9028 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9029
9030         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9031         (Arm_relocate_functions::thm_jump8): New function.
9032         (Arm_relocate_functions::thm_jump11): New function.
9033         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9034         R_ARM_THM_JUMP11.
9035         (Target_arm::Scan::global): Likewise.
9036         (Target_arm::Relocate::relocate): Likewise.
9037         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9038         Likewise.
9039
9040 2010-01-14  Doug Kwan  <dougkwan@google.com>
9041
9042         * arm.cc (map, utility): Include headers.
9043         (Target_arm::apply_cortex_a8_workaround): New method.
9044         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9045         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9046         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9047         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9048         the --[no-]fix-cortex-a8 command line options.
9049         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9050         (Target_arm::relocate_stub): Use addend in instruction template.
9051         * options.h (DEFINE_bool): Set the user-set flag.
9052         (General_options): Add --[no-]-fix-cortex options.
9053         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9054         : Update fast look-up map after conversion.
9055
9056 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9057
9058         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9059         in the first pass of do_layout.
9060
9061 2010-01-13  Doug Kwan  <dougkwan@google.com>
9062
9063         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9064         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9065         apparent compiler problem of not folding static constant integral
9066         data members of elfcpp::Elf_sizes<32>.
9067
9068 2010-01-13  Doug Kwan  <dougkwan@google.com>
9069
9070         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9071         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9072         Arm_relobj::scan_section_for_cortex_a8_erratum,
9073         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9074         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9075         sections to scan for relocation stubs into a new method
9076         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9077         relocation and Cortex-A8 stub scanning.
9078         (Target_arm::do_relax): Force stubs to be after stubbed sections
9079         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9080         the beginning of a new relaxation pass.  Update a comment.
9081         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9082
9083 2010-01-12  Ian Lance Taylor  <iant@google.com>
9084
9085         * target-reloc.h (visibility_error): New inline function.
9086         (relocate_section): Call visibility_error.
9087         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9088         (MOSTLYCLEANFILES): Likewise.
9089         (protected_4_pic.o, protected_3.err): New targets.
9090         * testsuite/protected_4.cc: New file.
9091
9092 2010-01-12  Doug Kwan  <dougkwan@google.com>
9093
9094         * arm.cc (Cortex_a8_reloc): New class.
9095         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9096         and cortex_a8_relocs_info_.
9097         (Target_arm::fix_cortex_a8): New method definition.
9098         (Target_arm::Cortex_a8_relocs_info): New type.
9099         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9100         New data member declarations.
9101         (Target_arm::scan_reloc_for_stub): Record information about
9102         relocations for THUMB branches that might be exempted from the
9103         Cortex-A8 workaround.
9104         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9105         at the beginning of a relaxation pass.
9106
9107 2010-01-12  Doug Kwan  <dougkwan@google.com>
9108
9109         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9110         (Arm_relobj::Mapping_symbol_position,
9111          Arm_reloj::Mapping_symbol_position_less,
9112          Arm_relobj::Mapping_symbols_info): New types.
9113         (Target_arm::is_mapping_symbol_name): New method definition.
9114         (Arm_relobj::do_count_local_symbols): Save information about mapping
9115         symbols.
9116
9117 2010-01-11  Doug Kwan  <dougkwan@google.com>
9118
9119         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9120         Arm_relocate_functions::thumb32_branch_upper,
9121         Arm_relocate_functions::thumb32_branch_lower,
9122         Arm_relocate_functions::thumb32_cond_branch_offset,
9123         Arm_relocate_functions::thumb32_cond_branch_upper,
9124         Arm_relocate_functions::thumb32_cond_branch_lower,
9125         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9126         branch offset encoding.
9127         (Arm_relocate_functions::thumb_branch_common): Use new branch
9128         offset encoding methods to avoid code duplication.
9129         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9130         (Stub_addend_reader::operator()): Use new branch encoding method
9131         to avoid code duplication.
9132
9133 2010-01-11  Doug Kwan  <dougkwan@google.com>
9134
9135         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9136         (Target_arm::do_finalize_sections): Define special EXIDX section
9137         symbols only if referenced.
9138         * gc.h (Garbage_collection::add_reference): New method.
9139         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9140         code duplication.
9141
9142 2010-01-11  Ian Lance Taylor  <iant@google.com>
9143
9144         * script.cc (Version_script_info::build_expression_list_lookup):
9145         Change complaing about duplicate wildcard match from error to
9146         warning.
9147
9148         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9149         of 2009-12-30.
9150         (Version_script_info::Version_script_info): Initialize globs_,
9151         default_version_, default_is_global_, and exact_.  Don't
9152         initialize globals_ or locals_.
9153         (Version_script_info::build_lookup_tables): Build local symbols
9154         first.
9155         (Version_script_info::unquote): New function.
9156         (Version_script_info::add_exact_match): New function.
9157         (Version_script_info::build_expression_list_lookup): Remove lookup
9158         parameter.  Add is_global parameter.  Change all callers.  Handle
9159         wildcard pattern specially.  Unquote pattern.  Call
9160         add_exact_match.
9161         (Version_script_info::get_name_to_match): New function.
9162         (Version_script_info::get_symbol_version): New function.
9163         (Version_script_info::get_symbol_version_helper): Remove.
9164         (Version_script_info::check_unmatched_names): Call unquote.
9165         * script.h (class Version_script_info): Change get_symbol_version
9166         to be non-inline and add is_global parameter; change all callers.
9167         Rewrite symbol_is_local.  Update declarations.  Define struct
9168         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9169         Remove globals_ and locals_ members.  Add exact_, globs_,
9170         default_version_, is_global_.
9171         (Version_script_info::Glob): Remove pattern, add expression and
9172         is_global.  Update constructor.  Change all callers.
9173         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9174         default version.
9175         (Versions::symbol_section_contents): If a symbol is undefined, or
9176         defined in a dynamic object, set the version index to
9177         VER_NDX_LOCAL.
9178         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9179         symbol_is_local.
9180         (Symbol_table::add_from_pluginobj): Likewise.
9181         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9182
9183 2010-01-11  Doug Kwan  <dougkwan@google.com>
9184
9185         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9186         (incremental_dump_LDADD): Add linking option for libintl.
9187         * Makefile.in: Regenerate.
9188
9189 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9190
9191         PR gold/11144
9192         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9193         instead of -Ds.
9194         * testsuite/Makefile.in: Regenerated.
9195
9196 2010-01-10  Doug Kwan  <dougkwan@google.com>
9197
9198         * options.h (DEFINE_var): Use parentheses around argument varname__
9199         in macro body to avoid any unintended subsequent substitutions.
9200
9201 2010-01-10  Ian Lance Taylor  <iant@google.com>
9202
9203         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9204         candidates before doing symbol resolution.
9205
9206         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9207         ODR candidates if only one is weak.
9208
9209 2010-01-08  Ian Lance Taylor  <iant@google.com>
9210
9211         * script.cc (Version_script_info::build_expression_list_lookup):
9212         Don't warn about ambiguous version, just record the ambiguity.
9213         (Version_script_info::get_symbol_version_helper): Give error if
9214         version is ambiguous.
9215
9216 2010-01-08  Doug Kwan  <dougkwan@google.com>
9217
9218         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9219         prev_data_size_ and prev_addralign_.  Remove initializer for
9220         deleted data member has_been_changed_.
9221         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9222         to determine if the table is empty.
9223         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9224         Remove.
9225         (Stub_table::add_reloc_stub): Define method in class definition
9226         instead of just declaring it there.
9227         (Stub_table::add_cortex_a8_stub): New method definition.
9228         (Stub_table::update_data_size_and_addralign): Ditto.
9229         (Stub_table::finalize_stubs): Ditto.
9230         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9231         (Stub_table::do_addralign_): Return address alignment in the
9232         (Stub_table::do_reset_address_and_file_offset): Define method in
9233         class definition instead of declaring it there.  Set current data
9234         size to be the data size of the previous pass.
9235         (Stub_table::set_final_data_size): Use current data size as the
9236         final data size.
9237         (Stub_table::relocate_stub): Change parameter type of stub from
9238         Reloc_stub pointer to Stub pointer.
9239         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9240         (Stub_table::Cortex_a8_stub_list): New typedef.
9241         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9242          Stub_table::prev_addralign_): New data member.
9243         (Arm_relobj::Arm_relobj): Initialize data member
9244         section_has_cortex_a8_workaround_.
9245         (Arm_relobj::section_has_cortex_a8_workaround,
9246          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9247          definitions.
9248         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9249         declarations.
9250         (Target_arm::relocate_stub): Change parameter type of stub from
9251         Reloc_stub pointer to Stub pointer.
9252         (Insn_template::size, Insn_template::alignment): Handle
9253         THUMB16_SPECIAL_TYPE.
9254         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9255          Stub_table::update_data_size_and_addralign,
9256          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9257         definitions.
9258         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9259         (Stub_table::do_write): Ditto.
9260         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9261
9262 2010-01-08  Ian Lance Taylor  <iant@google.com>
9263
9264         PR 11108
9265         * symtab.h (class Symbol): Remove fields is_target_special_ and
9266         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9267         (Symbol::is_defined_in_discarded_section): New function.
9268         (Symbol::set_is_defined_in_discarded_section): New function.
9269         (Symbol::has_plt_offset): Rewrite.
9270         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9271         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9272         Don't initialize is_target_special_ or has_plt_offset_.
9273         Initialize is_defined_in_discarded_section_.
9274         (Symbol_table::add_from_relobj): If appropriate, set
9275         is_defined_in_discarded_section.
9276         * resolve.cc (Symbol::override_base_with_special): Don't test
9277         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9278         * target-reloc.h (relocate_section): Do special handling for
9279         symbols defined in discarded sections for global symbols as well
9280         as local symbols.
9281
9282 2010-01-08  Ian Lance Taylor  <iant@google.com>
9283
9284         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9285         the SHT_SYMTAB case.
9286
9287 2010-01-08  Ian Lance Taylor  <iant@google.com>
9288
9289         * object.cc (Sized_relobj::do_layout): Don't get confused if
9290         layout_eh_frame returns NULL.
9291
9292 2010-01-08  Ian Lance Taylor  <iant@google.com>
9293
9294         PR 11084
9295         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9296         dynamic symbol table, use the normal symbol table.
9297         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9298         symbol table.
9299
9300 2010-01-08  Ian Lance Taylor  <iant@google.com>
9301
9302         PR 11072
9303         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9304         sections.
9305
9306 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9307
9308         * version.cc (print_version): Change to "Copyright 2010".
9309
9310 2010-01-08  Ian Lance Taylor  <iant@google.com>
9311
9312         PR 10287
9313         PR 11063
9314         * i386.cc (class Target_i386): Change return type of plt_section
9315         to be non-const.
9316         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9317         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9318         tls_desc_rel_ field.
9319         (Output_data_plt_i386::rel_tls_desc): New function.
9320         (Target_i386::rel_tls_desc_section): New function.
9321         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9322         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9323         R_386_TLS_DESC reloc in rel_tls_desc_section.
9324         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9325         Define struct Tlsdesc_info.
9326         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9327         (Target_x86_64::do_reloc_symbol_index): New function.
9328         (Target_x86_64::add_tlsdesc_info): New function.
9329         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9330         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9331         tlsdesc_rel_ field.
9332         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9333         all callers.
9334         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9335         (Target_x86_64::rela_tlsdesc_section): New function.
9336         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9337         handling.
9338         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9339         (Target_x86_64::do_reloc_addend): New function.
9340         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9341         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9342         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9343         (Output_reloc::type): New function.
9344         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9345         (Output_reloc::is_target_specific): New function.
9346         (Output_reloc::target_arg): New function.
9347         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9348         absolute relocs and target specific relocs.
9349         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9350         add_target_specific.
9351         (class Output_data_reloc) [SHT_RELA]: Likewise.
9352         * output.cc (Output_reloc::Output_reloc): Add four new versions
9353         for absolute relocs and target specific relocs.
9354         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9355         (Output_reloc::get_symbol_index): Likewise.
9356         (Output_reloc::local_section_offset): Check that local_sym_index_
9357         is not TARGET_CODE or 0.
9358         (Output_reloc::symbol_value): Likewise.
9359         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9360         reloc.
9361         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9362         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9363         functions.
9364         * layout.cc (add_target_dynamic_tags): Use output section for
9365         DT_PLTRELSZ and DT_JMPREL.
9366
9367 2010-01-07  Ian Lance Taylor  <iant@google.com>
9368
9369         PR 11061
9370         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9371         function.
9372         (class Output_data_reloc_generic): Define.
9373         (class Output_data_reloc_base): Change base class to
9374         Output_data_reloc_generic.  Change add() method to call
9375         bump_relative_reloc_count for a relative reloc.  Remove
9376         sort_relocs_ field.
9377         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9378         to sort_relocs().
9379         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9380         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9381         appropriate.
9382         * layout.h (class Layout): Update declaration.
9383
9384 2010-01-07  Ian Lance Taylor  <iant@google.com>
9385
9386         * output.h (class Output_data): Add const version of
9387         output_section and do_output_section.
9388         (class Output_section_data): Add const version of
9389         do_output_section.
9390         (class Output_section): Likewise.
9391         * layout.cc (Layout::add_target_dynamic_tags): New function.
9392         * layout.h (class Layout): Update declarations.
9393         * arm.cc (Target_arm::do_finalize_sections): Use
9394         add_target_dynamic_tags.
9395         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9396         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9397         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9398         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9399
9400 2010-01-07  Ian Lance Taylor  <iant@google.com>
9401
9402         PR 11042
9403         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9404         object as needed.
9405
9406 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9407             Ian Lance Taylor  <iant@google.com>
9408
9409         PR 11019
9410         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9411         Xindex::read_symtab_xindex.
9412
9413 2010-01-07  Doug Kwan  <dougkwan@google.com>
9414
9415         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9416         (Insn_template::thumb16_bcond_insn): New method declaration.
9417         (Insn_template): Fix spelling.
9418         (Stub::thumb16_special): New method declaration.
9419         (Stub::do_write): Define virtual method which was previously pure
9420         virtual.
9421         (Stub::do_thumb16_special): New method declaration.
9422         (Stub::do_fixed_endian_write): New template member.
9423         (Reloc_stub::do_write): Remove.
9424         (Reloc_stub::do_fixed_endian_write): Remove.
9425         (Cortex_a8_stub): New class definition.
9426         (Stub_factory::make_cortex_a8_stub): New method definition.
9427         (Stub_factory::Stub_factory): Add missing static storage class
9428         qualifier for elf32_arm_stub_a8_veneer_blx.
9429
9430 2010-01-07  Ian Lance Taylor  <iant@google.com>
9431
9432         PR 10980
9433         * options.h (class General_options): Add --warn-unresolved-symbols
9434         and --error-unresolved-symbols.
9435         * errors.cc (Errors::undefined_symbol): Implement
9436         --warn-unresolved-symbols.
9437
9438         * options.h (class General_options): Add -z text and -z textoff.
9439         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9440
9441 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9442
9443         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9444         (Garbage_collection::cident_sections): New function.
9445         (Garbage_collection::add_cident_section): New function.
9446         (Garbage_collection::cident_sections_): New member.
9447         (gc_process_relocs): Add references to sections whose names are C
9448         identifiers.
9449         * gold.h (cident_section_start_prefix): New constant.
9450         (cident_section_stop_prefix): New constant.
9451         (is_cident): New function.
9452         * layout.cc (Layout::define_section_symbols): Replace string constants
9453         with the newly defined constants.
9454         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9455         C identifiers.
9456         * testsuite/Makefile.am: Add gc_orphan_section_test.
9457         * testsuite/Makefile.in: Regenerate.
9458         * testsuite/gc_orphan_section_test.cc: New file.
9459         * testsuite/gc_orphan_section_test.sh: New file.
9460
9461 2010-01-06  Ian Lance Taylor  <iant@google.com>
9462
9463         PR 10980
9464         * options.h (class General_options): Add --warn-shared-textrel.
9465         * layout.cc (Layout::finish_dynamic_section): Implement
9466         --warn-shared-textrel.
9467
9468         PR 10980
9469         * options.h (class General_options): Add --warn-multiple-gp.
9470
9471 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9472
9473         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9474         $(THREADSLIB) and $(LIBDL).
9475         * Makefile.in: Rebuild.
9476
9477 2010-01-06  Ian Lance Taylor  <iant@google.com>
9478
9479         PR 10980
9480         * options.cc (General_options::parse_section_start): New function.
9481         (General_options::section_start): New function.
9482         (General_options::General_options): Initialize all members.
9483         * options.h: Include <map>
9484         (class General_options): Add --section-start.  Add section_starts_
9485         member.
9486         * layout.cc (Layout::attach_allocated_section_to_segment): If
9487         --section-start was used, set the address of the segment.  Remove
9488         local sort_sections.
9489         (Layout::relaxation_loop_body): If the address of the load segment
9490         has been set by --section-start, don't use it.
9491         * output.h (Output_segment::update_flags_for_output_section): New
9492         function.
9493         * output.cc (Output_segment::add_output_section): Call
9494         update_flags_for_output_section.
9495
9496 2010-01-05  Ian Lance Taylor  <iant@google.com>
9497
9498         PR 10980
9499         * options.h (class General_options): Add --undefined-version.
9500         * script.cc (struct Version_expression): Add was_matched_by_symbol
9501         field.
9502         (Version_script_info::matched_symbol): New function.
9503         (Version_script_info::get_symbol_version_helper): Call
9504         matched_symbol.
9505         (Version_script_info::check_unmatched_names): New function.
9506         * script.h (class Version_script_info): Update declarations.
9507         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9508
9509         * options.h (class General_options): Use DEFINE_bool_alias for
9510         allow_multiple_definition.
9511         * resolve.cc (Symbol_table::should_override): Don't test
9512         allow_multiple_definition.
9513
9514         PR 10980
9515         * options.h (class General_options): Add --cref.
9516         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9517         until after printing cref table.
9518         * cref.cc: Include "symtab.h".
9519         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9520         (Cref_table_compare::operator()): New function.
9521         (Cref_inputs::gather_cref): New function.
9522         (filecol): New static const.
9523         (Cref_inputs::print_cref): New function.
9524         (Cref::print_cref): New function.
9525         * cref.h: Include <cstdio>.
9526         (class Cref): Update declarations.
9527         * mapfile.h (Mapfile::file): New function.
9528         * object.h (class Object): Define Symbols.  Declare virtual
9529         do_get_global_symbols.
9530         (Object::get_global_symbols): New function.
9531         * object.cc (Input_objects::add_object): Pass object to cref_ if
9532         --cref.
9533         (Input_objects::archive_start): Likewise.
9534         (Input_objects::archive_stop): Likewise.
9535         (Input_objects::print_cref): New function.
9536         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9537         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9538         --cref.
9539         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9540         function.
9541         * plugin.h (class Sized_pluginobj): Update declarations.
9542
9543 2010-01-05  Ian Lance Taylor  <iant@google.com>
9544
9545         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9546         to is_default_version.  Rename insdef to insdefault.
9547         (Symbol_table::add_from_relobj): Rename def to is_default_version
9548         and local to is_forced_local.
9549         (Symbol_table::add_from_pluginobj): Likewise.
9550         (Symbol_table::add_from_dynobj): Likewise.
9551         (Symbol_table::define_special_symbol): Rename insdef to
9552         insdefault.
9553
9554 2010-01-04  Ian Lance Taylor  <iant@google.com>
9555
9556         PR 10980
9557         * options.h (class General_options): Add
9558         --allow-multiple-definition and -z muldefs.
9559         * resolve.cc (Symbol_table::should_override): Don't warn about a
9560         multiple symbol definition if --allow-multiple-definition or -z
9561         muldefs.
9562
9563         PR 10980
9564         * options.h (class General_options): Add --add-needed and
9565         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9566         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9567         error if --copy-dt-needed-entries aka --add-needed is used and
9568         would cause a change in behaviour.
9569
9570         PR 10980
9571         * options.h (class General_options): Add -G as a short version of
9572         --shared.  Add no-op options -assert, -g, and -i.
9573
9574 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9575
9576         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9577         check for .text or .gnu.linkonce.t sections.
9578         * icf.cc (Icf::find_identical_sections): Ditto.
9579         Change the detection for mangled function name within the section
9580         name.
9581         * icf.h (is_section_foldable_candidate): New function.
9582
9583 2009-12-30  Ian Lance Taylor  <iant@google.com>
9584
9585         PR 10980
9586         * options.h (class General_options): Permit two dashes with
9587         --retain-symbols-file.
9588
9589 2009-12-30  Ian Lance Taylor  <iant@google.com>
9590
9591         PR 10979
9592         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9593         don't put the file header and segment headers in the text
9594         segment.
9595
9596         PR 10979
9597         * common.cc (Sort_commons::operator()): Stabilize sort when both
9598         entries are NULL.
9599         (Symbol_table::do_allocate_commons_list): When allocating common
9600         symbols, skip a symbol which is no longer common.
9601         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9602         an object before checking its type.
9603         * testsuite/common_test_2.c: New file.
9604         * testsuite/common_test_3.c: New file.
9605         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9606         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9607         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9608         (common_test_2_pic.o, common_test_2.so): New targets.
9609         (common_test_3_pic.o, common_test_3.so): New targets.
9610         * testsuite/Makefile.in: Rebuild.
9611
9612         PR 10979
9613         * script.cc (read_input_script): If we see a new SECTIONS clause,
9614         and we have added an input section, give an error.
9615         * layout.h (class Layout): Add have_added_input_section function.
9616         Add have_added_input_section_ field.
9617         * layout.cc (Layout::Layout): Initialize
9618         have_added_input_section_.
9619         (Layout::layout): Set have_added_input_section_.
9620         (Layout::layout_eh_frame): Likewise.
9621
9622 2009-12-30  Ian Lance Taylor  <iant@google.com>
9623
9624         PR 10931
9625         * options.h (class General_options): Add --sort-common option.
9626         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9627         * common.cc (Sort_common): Add sort_order parameter to
9628         constructor.  Add sort_order_ field.
9629         (Sort_commons::operator): Check sort_order_.
9630         (Symbol_table::allocate_commons): Determine the sort order.
9631         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9632         Change all callers.
9633         (Symbol_table::do_allocate_commons_list): Likewise.
9634
9635 2009-12-30  Ian Lance Taylor  <iant@google.com>
9636
9637         PR 10916
9638         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9639         symbols from this object, don't change the visibility of an
9640         undefined symbol.
9641         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9642
9643 2009-12-30  Ian Lance Taylor  <iant@google.com>
9644
9645         PR 10861
9646         * script.h (class Version_script_info): Define Language enum.
9647         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9648         new fields globals_, locals_, and is_finalized_.
9649         * script.cc: Various formatting fixes.
9650         (class Parser_closure): Change language_stack_ from a vector of
9651         std::string to one of Version_script_info::Language.  Adjust all
9652         uses accordingly.
9653         (class Lazy_demangler): Remove.
9654         (struct Version_expression): Change language from std::string to
9655         Version_script_info::Language.
9656         (Version_script_info::Version_script_info): New function.
9657         (Version_script_info::~Version_script_info): Don't call clear.
9658         (Version_script_info::finalize): New function.
9659         (Version_script_info::build_lookup_tables): New function.
9660         (Version_script_info::build_expression_list_lookup): New
9661         function.
9662         (Version_script_info::get_symbol_version_helper): Rewrite to use
9663         lookup tables.
9664         (Version_script_info::print_expression_list): Adjust to use
9665         Version_script_info::Language.
9666         (script_push_lex_into_version_mode): Check that the version script
9667         has not been finalized.
9668         (version_script_push_lang): Change language string to
9669         Version_script_info::Language.
9670         * options.cc (Command_line::version_script): New function.
9671         * options.h (class General_options): Add finalize_dynamic_list
9672         function.  Change version_script from declaration to definition.
9673         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9674         * testsuite/version_script.map: Remove duplicate def of foo.
9675         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9676         version_script.map.
9677         * testsuite/Makefile.in: Rebuild.
9678
9679 2009-12-30  Ian Lance Taylor  <iant@google.com>
9680
9681         PR 10843
9682         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9683         if the input symbol index is 0, make the output symbol index 0.
9684
9685 2009-12-30  Ian Lance Taylor  <iant@google.com>
9686
9687         PR 10670
9688         * options.h (class General_options): Add -x/--discard-all.
9689         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9690         --discard-all.  If the local symbol needs a dynamic entry, check
9691         that before handling --discard-locals.
9692
9693 2009-12-30  Ian Lance Taylor  <iant@google.com>
9694
9695         PR 10450
9696         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9697         flags to PF_R.
9698         (Output_segment::add_output_section): Don't change the flags if
9699         the type is PT_TLS.
9700
9701         PR 10450
9702         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9703         GNU hash table if they need a dynamic value.  Otherwise, don't add
9704         them if they are defined in a dynamic object or are forced local.
9705
9706 2009-12-29  Ian Lance Taylor  <iant@google.com>
9707
9708         PR 10450
9709         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9710         .gnu.hash table for a 32-bit target.
9711
9712         PR 10450
9713         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9714         regular and a dynamic object only needs a dynamic symbol table
9715         entry if it is externally visible.
9716
9717         PR 10450
9718         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9719         constructor.  Add global_offset_table_ field.
9720         (Target_i386::got_section): Set global_offset_table_.
9721         (Target_i386::do_finalize_sections): Set global_offset_table_
9722         size.
9723         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9724         in constructor.  Add global_offset_table_ field.
9725         (Target_x86_64::got_section): Set global_offset_table_.
9726         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9727         size.
9728
9729         * layout.cc (Layout::Layout): Initialize increase_relro_.
9730         (Layout::get_output_section): Add is_relro, is_last_relro, and
9731         is_first_non_relro parameters.  Change all callers.
9732         (Layout::choose_output_section): Likewise.
9733         (Layout::add_output_section_data): Likewise.
9734         (Layout::make_output_section): Likewise.
9735         (Layout::set_segment_offsets): Clear increase_relro when using a
9736         linker script.
9737         * layout.h (class Layout): Add increase_relro method.  Add
9738         increase_relro_ field.  Update declarations.
9739         * output.cc (Output_section::Output_section): Initialize
9740         is_last_relro_ and is_first_non_relro_.
9741         (Output_segment::add_output_section): Group relro sections is
9742         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9743         (Output_segment::maximum_alignment): Remove relro handling.
9744         (Output_segment::set_section_addresses): Add increase_relro
9745         parameter.  Change all callers.  Add initial alignment to align
9746         relro sections on separate page.  Remove old relro handling.
9747         (Output_segment::set_section_list_addresses): Remove in_relro
9748         parameter.  Change all callers.
9749         (Output_segment::set_offset): Add increase parameter.  Change all
9750         callers.  Remove old relro handling.
9751         * output.h (class Output_section): Add new methods: is_last_relro,
9752         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9753         Add is_last_relro_ and is_first_non_relro_ fields.
9754         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9755         Create separate .got.plt section.  Call increase_relro.
9756         * x86_64.cc (Target_x86_64::got_section): Likewise.
9757         * testsuite/relro_script_test.t: Add .got.plt.
9758
9759         PR 10450
9760         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9761         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9762         (Layout::finalize): Call set_dynamic_symbol_size.
9763         (Layout::set_dynamic_symbol_size): New function.
9764         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9765         set_dynamic_symbol_size.
9766
9767         PR 10450
9768         * output.h (class Output_section): Add is_entsize_zero_ field.
9769         * output.cc (Output_section::Output_section): Initialize
9770         is_entsize_zero_.
9771         (Output_section::set_entsize): If two different entsizes are
9772         requested, force it to zero.
9773         (Output_section::add_input_section): Set flags for .debug_str
9774         before updating section flags.  Set entsize.
9775         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9776         and SHF_STRING if all input sections have those flags.
9777
9778 2009-12-29   Rafael Espindola  <espindola@google.com>
9779
9780         * main.cc (main): Fix the sys time reporting.
9781         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9782         reporting.
9783
9784 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9785
9786         * options.cc (General_options::parse_version): Allow -v to exit
9787         without an error if there is nothing to link.
9788
9789 2009-12-29  Ian Lance Taylor  <iant@google.com>
9790
9791         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9792         using a version of gcc before 4.1.
9793         * configure: Rebuild.
9794
9795 2009-12-28  Chris Demetriou  <cgd@google.com>
9796
9797         * attributes.cc (Output_attributes_section_data::do_write): Use
9798         std::vector::front rather than std::vector::data.
9799
9800 2009-12-28  Ian Lance Taylor  <iant@google.com>
9801
9802         * symtab.h (class Symbol_table): Add enum Defined.
9803         * resolve.cc (Symbol_table::should_override): Add defined
9804         parameter.  Change all callers.  Test whether object is NULL
9805         before calling a method on it.
9806         (Symbol_table::report_resolve_problem): Add defined parameter.
9807         Change all callers.
9808         (Symbol_table::should_override_with_special): Likewise.
9809         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9810         parameter.  Change all callers.
9811         (Symbol_table::do_define_in_output_data): Likewise.
9812         (Symbol_table::define_in_output_segment): Likewise.
9813         (Symbol_table::do_define_in_output_segment): Likewise.
9814         (Symbol_table::define_as_constant): Likewise.
9815         (Symbol_table::do_define_as_constant): Likewise.
9816         * script.h (class Symbol_assignment): Add is_defsym parameter to
9817         constructor; change all callers.
9818         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9819         parameter.  Change all callers.  Add is_defsym_ field.
9820         (class Parser_closure): Add parsing_defsym parameter to
9821         constructor; change all callers.  Add parsing_defsym accessor
9822         function.  Add parsing_defsym_ field.
9823
9824 2009-12-28  Ian Lance Taylor  <iant@google.com>
9825
9826         * gold.cc (queue_middle_tasks): Fix formatting.
9827         * object.cc (Relobj::is_section_name_included): Likewise.
9828
9829 2009-12-23  Ian Lance Taylor  <iant@google.com>
9830
9831         * i386.cc (Target_i386::do_calls_non_split): Recognize
9832         -fsplit-stack prologue for a function with a static chain.
9833         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9834         -fsplit-stack prologue when using %r11.
9835
9836 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9837
9838         * options.cc (General_options::parse_version): Make -v continue and do
9839         the link like GNU ld does.
9840
9841 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9842
9843         * Makefile.am (CCFILES): Add timer.cc.
9844         (HFILES): Add timer.h.
9845         * configure.ac: Check for sysconf and times.
9846         * main.cc: include timer.h.
9847         (main): Use Timer instead of get_run_time.
9848         * timer.cc: New.
9849         * timer.h: New.
9850         * workqueue.cc: include timer.h.
9851         (Workqueue::find_and_run_task):
9852         Report user, sys and wall time.
9853         * Makefile.in: Regenerate.
9854         * config.in: Regenerate.
9855         * configure: Regenerate.
9856
9857 2009-12-16  Doug Kwan  <dougkwan@google.com>
9858
9859         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9860         sections.
9861         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9862         relaxed input sections.
9863         * output.cc (Output_section::find_relaxed_input_section): Change
9864         return type to Output_relaxed_input_section pointer.  Adjust code
9865         for new type of relaxed_input_section_map_.
9866         * output.h (Output_section::find_relaxed_input_section): Change
9867         return type to Output_relaxed_input_section pointer.
9868         (Output_section::Output_relaxed_input_section_by_input_section_map):
9869         New type.
9870         (Output_section::relaxed_input_section_map_): Change type to
9871         Output_section::Output_relaxed_input_section_by_input_section_map.
9872         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9873         input section.
9874
9875 2009-12-15  Ian Lance Taylor  <iant@google.com>
9876
9877         * layout.cc (Layout::create_shstrtab): Only write out after input
9878         sections if we are compressing debug sections.
9879
9880 2009-12-15  Ian Lance Taylor  <iant@google.com>
9881
9882         * archive.cc (Archive::add_symbols): Only look up a symbol without
9883         a version if there is, in fact, a version.
9884
9885 2009-12-14  Ian Lance Taylor  <iant@google.com>
9886
9887         Revert -Wshadow changes, all changes from:
9888         2009-12-11  Doug Kwan  <dougkwan@google.com>
9889         2009-12-11  Nick Clifton  <nickc@redhat.com>
9890         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9891
9892 2009-12-11  Doug Kwan  <dougkwan@google.com>
9893
9894         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9895         due to -Wshadow.
9896         * attributes.cc (Object_attribute::size): Ditto.
9897         (Attributes_section_data::size): Ditto.
9898         (Attributes_section_data::Attributes_section_data): Ditto.
9899         (Output_attributes_section_data::do_write): Ditto.
9900         * attributes.h (Object_attribute::set_type): Ditto.
9901         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9902
9903 2009-12-11  Nick Clifton  <nickc@redhat.com>
9904
9905         * archive.cc: Fix shadowed variable warnings.
9906         * arm.cc: Likewise.
9907         * compressed_output.cc: Likewise.
9908         * compressed_output.h: Likewise.
9909         * configure: Likewise.
9910         * dwarf_reader.cc: Likewise.
9911         * dynobj.cc: Likewise.
9912         * dynobj.h: Likewise.
9913         * ehframe.cc: Likewise.
9914         * ehframe.h: Likewise.
9915         * errors.cc: Likewise.
9916         * expression.cc: Likewise.
9917         * fileread.cc: Likewise.
9918         * fileread.h: Likewise.
9919         * freebsd.h: Likewise.
9920         * i386.cc: Likewise.
9921         * icf.cc: Likewise.
9922         * incremental.h: Likewise.
9923         * layout.cc: Likewise.
9924         * layout.h: Likewise.
9925         * mapfile.cc: Likewise.
9926         * merge.cc: Likewise.
9927         * merge.h: Likewise.
9928         * object.cc: Likewise.
9929         * object.h: Likewise.
9930         * options.h: Likewise.
9931         * output.cc: Likewise.
9932         * output.h: Likewise.
9933         * parameters.cc: Likewise.
9934         * plugin.cc: Likewise.
9935         * powerpc.cc: Likewise.
9936         * reduced_debug_output.cc: Likewise.
9937         * reduced_debug_output.h: Likewise.
9938         * reloc.cc: Likewise.
9939         * reloc.h: Likewise.
9940         * resolve.cc: Likewise.
9941         * script-sections.cc: Likewise.
9942         * script.cc: Likewise.
9943         * script.h: Likewise.
9944         * sparc.cc: Likewise.
9945         * symtab.cc: Likewise.
9946         * symtab.h: Likewise.
9947         * target-select.cc: Likewise.
9948         * target-select.h: Likewise.
9949         * token.h: Likewise.
9950         * workqueue.cc: Likewise.
9951         * workqueue.h: Likewise.
9952         * x86_64.cc: Likewise.
9953
9954 2009-12-10  Doug Kwan  <dougkwan@google.com>
9955
9956         * arm.cc (attributes.h): New include.
9957         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9958         (Arm_relobj::~Arm_relobj): Delete object pointed by
9959         attributes_section_data_.
9960         (Arm_relobj::attributes_section_data): New method definition.
9961         (Arm_relobj::attributes_section_data_): New data member declaration.
9962         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9963         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9964         attributes_section_data_.
9965         (Arm_dynobj::attributes_section_data): New method definition.
9966         (Arm_dynobj::attributes_section_data_): New data member declaration.
9967         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9968         initialization value of may_use_blx_ to false.
9969         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9970         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9971         object attributes to compute results instead of hard-coding.
9972         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9973         Target_arm::get_secondary_compatible_arch,
9974         Target_arm::set_secondary_compatible_arch
9975         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9976         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9977         New method declarations.
9978         (Target_arm::get_aeabi_object_attribute): New method definition.
9979         (Target_arm::attributes_section_data_): New data member declaration.
9980         (read_arm_attributes_section): New template definition.
9981         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9982         (Arm_dynobj::do_read_symbols): Ditto.
9983         (Target_arm::do_finalize_sections): Merge attributes sections from
9984         input.  Check for BLX use after attributes section merging.
9985         Fix __exidx_start and __exidx_end visibility.  Create an
9986         .ARM.attributes section if necessary.
9987         (Target_arm::get_secondary_compatible_arch,
9988         Target_arm::set_secondary_compatible_arch,
9989         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9990         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9991         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9992         New method definitions.
9993
9994 2009-12-09  Ian Lance Taylor  <iant@google.com>
9995
9996         * plugin.cc (Plugin::load): Don't cast from void* to a function
9997         pointer.
9998
9999 2009-12-09  Ian Lance Taylor  <iant@google.com>
10000
10001         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10002         information fields.
10003
10004 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10005
10006         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10007         Replace two_file_shared_1.so with two_file_shared_2.so.
10008         * testsuite/Makefile.in: Regenerated.
10009
10010 2009-12-08  Doug Kwan  <dougkwan@google.com>
10011
10012         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10013         (HFILES): Add attributes.h and int_encoding.h.
10014         * Makefile.in: Regenerate.
10015         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10016         function definitions to int_encoding.cc
10017         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10018         prototypes to int_encoding.h
10019         * reduced_debug_output.cc (int_encoding.h): New include.
10020         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10021         function definitions to int_encoding.cc
10022         (insert_into_vector, read_from_pointer): Move template definitions to
10023         int_encoding.h
10024         * attributes.cc: New file.
10025         * attributes.h: New file.
10026         * int_encoding.cc: New file.
10027         * int_encoding.h: New file.
10028
10029 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10030
10031         PR gold/11055
10032         * incremental-dump.cc (dump_incremental_inputs): New.
10033         (main): Use dump_incremental_inputs.
10034
10035 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10036
10037         PR gold/10893
10038         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10039         checking elfcpp::STT_FUNC.
10040         (Target_i386::Relocate::relocate): Likewise.
10041         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10042
10043         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10044         symbols from shared libraries into normal FUNC symbols.
10045
10046         * symtab.h (Symbol): Add is_func and use it.
10047
10048 2009-12-05  Doug Kwan  <dougkwan@google.com>
10049
10050         * arm.cc (Target_arm::arm_info): Initialize new fields
10051         attributes_section and attributes_vendor.
10052         * i386.cc (Target_i386::i386_info): Same.
10053         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10054         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10055         fields attributes_section and attributes_vendor.
10056         * sparc.cc (Target_sparc::sparc_info): Same.
10057         * target.h (Target::attributes_section, Target::attributes_vendor,
10058         Target::is_attributes_section, Target::attribute_arg_type,
10059         Target::attributes_order): New method definitions.
10060         (Target::Target_info::attributes_section,
10061         Target::Target_info::attributes_vendor): New fields.
10062         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10063         virtual method definitions.
10064         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10065         attributes_section and attributes_vendor.
10066         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10067
10068 2009-12-05  Doug Kwan  <dougkwan@google.com>
10069
10070         * arm.cc: Update comments about interworking and stub generation.
10071         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10072         considered as non-PIC.
10073         (Arm_relocate_functions::base_abs): Fix formatting.
10074         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10075         of function to use GOT entry address instead of offset.
10076         (Target_arm::Scan::global): Issue an error if a symbol would need a
10077         PLT does not get one because it is untyped.  Remove code to create
10078         dynamic symbols for relative branches.
10079         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10080         takes unsigned integer instead of boolean.
10081
10082 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10083
10084         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10085         (two_file_test_LDADD): Likewise.
10086         (common_test_1_LDADD): Likewise.
10087         (exception_test_LDADD) Likewise.
10088         (weak_test_LDADD): Likewise.
10089         (many_sections_test_LDADD): Likewise.
10090         (initpri1_LDADD): Likewise.
10091         (script_test_1_LDADD): Likewise.
10092         (script_test_2_LDADD): Likewise.
10093         (justsyms_LDADD): Likewise.
10094         (binary_test_LDADD): Likewise.
10095         (large_LDADD): Likewise.
10096         * testsuite/Makefile.in: Regenerated.
10097
10098 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10099
10100         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10101         (Symbol_table::override_with_special): Likewise.
10102         (Symbol_table::add_from_object): Likewise.
10103
10104 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10105
10106         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10107         Don't set the data_offset twice.
10108
10109 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10110
10111         * testsuite/Makefile.in: Regenerate.
10112
10113 2009-12-03  Doug Kwan  <dougkwan@google.com>
10114
10115         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10116         (Target_arm::do_finalize_sections): Add parameter for symbol table
10117         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10118         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10119         parameter for symbol table pointer.
10120         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10121         an additional parameter for a pointer to symbol table.
10122         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10123         parameter for a symbol table pointer.
10124         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10125         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10126         Ditto.
10127         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10128         parameter for a symbol table pointer.
10129
10130 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10131
10132         * incremental.cc (Incremental_inputs_header)
10133         (Incremental_inputs_header_write, Incremental_inputs_entry)
10134         (Incremental_inputs_entry_write): Move ...
10135         * incremental.h (Incremental_inputs_header)
10136         (Incremental_inputs_header_write, Incremental_inputs_entry)
10137         (Incremental_inputs_entry_write): here.
10138
10139 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10140
10141         * incremental.cc (make_sized_incremental_binary): Set the target.
10142         Error if it is incompatible.
10143         * output.h (Output_file): Add filename method.
10144
10145 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10146
10147         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10148         from the get_* methods.
10149
10150 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10151
10152         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10153         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10154         Write 0 for the data_offset of scripts.
10155
10156 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10157
10158         * testsuite/Makefile.am: Add the incremental_test.sh test.
10159         * testsuite/incremental_test.sh: New.
10160         * testsuite/incremental_test_1.c: New.
10161         * testsuite/incremental_test_2.c: New.
10162
10163 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10164
10165         * incremental-dump.cc (main): Fix typos.
10166
10167 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10168
10169         PR gold/11025
10170         * incremental-dump.cc (main): Use llu to print 64 bit values.
10171
10172 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10173             H.J. Lu  <hongjiu.lu@intel.com>
10174
10175         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10176         $(LIBDL).
10177         (incremental_dump_LDADD): Likewise.
10178         * Makefile.in: Regenerated.
10179
10180 2009-11-25  Doug Kwan  <dougkwan@google.com>
10181
10182         Revert:
10183
10184         2009-11-25  Doug Kwan  <dougkwan@google.com>
10185
10186                 * arm.cc (Target_arm::Target_arm): Move method definition
10187                 outside of class definition.  Add code to handle
10188                 --target1-rel, --target1-abs and --target2= options.
10189                 (Target_arm::get_reloc_reloc_type): Change method to be
10190                 non-static and const.
10191                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10192                 New data member declaration.
10193                 (Target_arm::Scan::local, Target_arm::Scan::global,
10194                 Target_arm::Relocate::relocate,
10195                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10196                 Adjust call to Target_arm::get_real_reloc_type.
10197                 (Target_arm::get_real_reloc_type): Use command line options
10198                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10199                 * options.h (--target1-rel, --target1-abs, --target2): New
10200                 ARM-only options.
10201
10202 2009-11-25  Doug Kwan  <dougkwan@google.com>
10203
10204         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10205         class definition.  Add code to handle --target1-rel, --target1-abs
10206         and --target2= options.
10207         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10208         and const.
10209         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10210         member declaration.
10211         (Target_arm::Scan::local, Target_arm::Scan::global,
10212         Target_arm::Relocate::relocate,
10213         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10214         call to Target_arm::get_real_reloc_type.
10215         (Target_arm::get_real_reloc_type): Use command line options to
10216         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10217         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10218         options.
10219
10220 2009-11-25  Doug Kwan  <dougkwan@google.com>
10221
10222         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10223         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10224         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10225         formatting.
10226         (Arm_relocate_functions::thm_call): Replace body with a call to
10227         Arm_relocate_functions::thumb_branch_common.
10228         (Arm_relocate_functions::thm_jump24,
10229         Arm_relocate_functions::thm_xpc22): New method definitions.
10230         (Arm_relocate_functions::thumb_branch_common): New method definition.
10231         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10232         operator.
10233         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10234         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10235
10236 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10237
10238         * Makefile.am: Build incremental-dump
10239         * Makefile.in: Regenerate.
10240         * incremental-dump.cc: New.
10241         * incremental.cc (Incremental_inputs_header_data,
10242         Incremental_inputs_entry_data): Move to incremental.h
10243         * incremental.h: (Incremental_inputs_header_data,
10244         Incremental_inputs_entry_data): Move from incremental.cc
10245
10246 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10247
10248         * incremental.cc (Incremental_inputs_header,
10249         Incremental_inputs_header_write, Incremental_inputs_entry,
10250         Incremental_inputs_entry_write): Add a typedef with the data type.
10251
10252 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10253
10254         * incremental.cc (Incremental_inputs_header,
10255         Incremental_inputs_header_write, Incremental_inputs_entry,
10256         Incremental_inputs_entry_write): Update comment about which
10257         type has the filed descriptions.
10258
10259 2009-11-15  Doug Kwan  <dougkwan@google.com>
10260
10261         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10262         (Arm_relocate_functions::arm_branch_common): Change method defintion
10263         in class definition to a method declaration and update list of formal
10264         parameters.
10265         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10266         Arm_relocation_functions::jump24): Adjust call to
10267         Arm_relocate_functions::arm_branch_common.  Update list of formal
10268         parameters.
10269         (Arm_relocate_functions::xpc25): New method definition.
10270         (Arm_relocate_functions::arm_branch_common): Move method defintion
10271         out from class definition.  Use stubs for mode-switching and extending
10272         branch ranges.
10273         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10274         specially.  Change code to enable use of stubs in ARM branches.
10275
10276 2009-11-10  Doug Kwan  <dougkwan@google.com>
10277
10278         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10279         in method declaration.
10280         (Target_arm::relocate_stub): New method declaration.
10281         (Target_arm::default_target): Change to return a pointer instead of
10282         a const reference.
10283         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10284         Target_arm::default_target.
10285         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10286         method definition.
10287         (Target_arm::relocate_section): Adjust view.
10288         (Target_arm::relocate_stub): New method definition.
10289
10290 2009-11-10  Doug Kwan  <dougkwan@google.com>
10291
10292         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10293         a format warning.
10294         * incremental.cc (open_incremental_binary): Initialized local
10295         variables to avoid warnings.
10296         * object.cc (make_elf_object): Ditto.
10297         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10298         a format warning.
10299
10300 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10301
10302         PR gold/10930
10303         * testsuite/plugin_test.c: Include "config.h".
10304
10305 2009-11-09  Doug Kwan  <dougkwan@google.com>
10306
10307         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10308         (arm_symbol_value): Remove.
10309         (Arm_relocate_functions::arm_branch_common,
10310         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10311         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10312         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10313         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10314         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10315         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10316         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10317         Arm_relocate_functions::thm_mobw_abs_nc,
10318         Arm_relocate_functions::thm_mov_abs,
10319         Arm_relocate_functions::movw_prel_nc,
10320         Arm_relocate_functions::thm_movt_abs,
10321         Arm_relocate_functions::movt_prel,
10322         Arm_relocate_functions::thm_movw_prel_nc,
10323         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10324         (Target_arm::Relocate::relocate): Only decompose address into two
10325         parts if relocation type uses the thumb-bit and pass the actual
10326         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10327         calls to methods in Arm_relocate_functions for this change.
10328
10329 2009-11-08  Ian Lance Taylor  <iant@google.com>
10330
10331         PR 10925
10332         * reloc.cc: Instantiate
10333         Sized_relobj::initialize_input_to_output_maps and
10334         Sized_relobj:free_input_to_output_maps.
10335
10336 2009-11-06  Ian Lance Taylor  <iant@google.com>
10337
10338         PR 10876
10339         * defstd.cc (in_segment): Set only_if_ref true for "end".
10340
10341 2009-11-06  Doug Kwan  <dougkwan@google.com>
10342
10343         * arm.cc (class Reloc_stub): Correct a comment.
10344         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10345         (Target_arm::scan_section_for_stubs): New method declaration.
10346         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10347         Change methods from private to protected.
10348         (Target_arm::do_may_relax): New method definition.
10349         (Target_arm::do_relax, Target_arm::group_sections,
10350         Target_arm::scan_reloc_for_stub,
10351         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10352         (Target_arm::arm_input_section_map_): New data member declaration.
10353         (Target_arm::scan_reloc_for_stub,
10354         Target_arm::scan_reloc_section_for_stubs,
10355         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10356         Target_arm::do_relax): New method definitions.
10357
10358 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10359
10360         * configure.ac: Check for (struct stat)::st_mtim
10361         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10362         * config.in: Regenerate.
10363         * configure: Regenerate.
10364
10365 2009-11-05  Ian Lance Taylor  <iant@google.com>
10366
10367         PR 10910
10368         * output.cc (Output_segment::add_output_section): Add missing
10369         return statement.
10370
10371 2009-11-04  Ian Lance Taylor  <iant@google.com>
10372
10373         PR 10880
10374         * object.h (class Object): Add is_needed and set_is_needed
10375         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10376         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10377         defined in a dynamic object and referenced by a regular object,
10378         set is_needed for the dynamic object.
10379         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10380         if the file is marked with as_needed and it is not needed.
10381
10382 2009-11-04  Ian Lance Taylor  <iant@google.com>
10383
10384         PR 10887
10385         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10386         tags if data is discarded by linker script.
10387         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10388         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10389         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10390         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10391
10392 2009-11-04  Ian Lance Taylor  <iant@google.com>
10393
10394         * layout.cc (Layout::get_output_section): Add is_interp and
10395         is_dynamic_linker_section parameters.  Change all callers.
10396         (Layout::choose_output_section): Likewise.
10397         (Layout::make_output_section): Likewise.
10398         (Layout::add_output_section_data): Add is_dynamic_linker_section
10399         parameter.  Change all callers.
10400         * layout.h (class Layout): Update declarations.
10401         * output.h (class Output_section): Add is_interp, set_is_interp,
10402         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10403         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10404         generate_code_fills_at_write_ to a bitfield.
10405         * output.cc (Output_section::Output_sections): Initialize new
10406         fields.
10407         (Output_segment::add_output_section): Add do_sort parameter.
10408         Change all callers.
10409
10410 2009-11-03  Ian Lance Taylor  <iant@google.com>
10411
10412         PR 10860
10413         * options.h (class General_options): Add --warn-common.
10414         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10415         merging two common symbols.
10416         (Symbol_table::should_override): Handle --warn-common when merging
10417         a common symbol with a defined symbol.  Use report_resolve_problem
10418         for multiple definitions.
10419         (Symbol_table::report_resolve_problem): New function.
10420         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10421
10422 2009-11-03  Doug Kwan  <dougkwan@google.com>
10423
10424         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10425         stub_factory_.
10426         (Target_arm::stub_factory): New method definition.
10427         (Target_arm::new_arm_input_section,
10428         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10429         Target_arm::reloc_uses_thumb_bit): New method declarations.
10430         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10431         New type definitions.
10432         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10433         member declarations.
10434         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10435         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10436         New method definitions.
10437
10438 2009-11-03  Ian Lance Taylor  <iant@google.com>
10439
10440         * options.h (class General_options): Add --warn_constructors.
10441
10442 2009-11-03  Ian Lance Taylor  <iant@google.com>
10443
10444         PR 10893
10445         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10446         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10447
10448 2009-11-03  Ian Lance Taylor  <iant@google.com>
10449
10450         PR 10895
10451         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10452         --msgid-bugs-address.
10453         (install-pdf): New target.
10454         (install-data_yes): Look up one directory to find mkinstalldirs.
10455
10456 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10457
10458         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10459         tree.
10460
10461 2009-10-30  Doug Kwan  <dougkwan@google.com>
10462
10463         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10464
10465 2009-10-30  Doug Kwan  <dougkwan@google.com>
10466
10467         * arm.cc (Stub_addend_reader): New struct template definition
10468         and partial specializations.
10469         (Stub_addend_reader::operator()): New method definition for a
10470         partially specialized template.
10471
10472 2009-10-30  Doug Kwan  <dougkwan@google.com>
10473
10474         * arm.cc (Arm_relobj::processor_specific_flags): New method
10475         definition.
10476         (Arm_relobj::do_read_symbols): New method declaration.
10477         (Arm_relobj::processor_specific_flags_): New data member declaration.
10478         (Arm_dynobj): New class definition.
10479         (Target_arm::do_finalize_sections): Add input_objects parameter.
10480         (Target_arm::do_adjust_elf_header): New method declaration.
10481         (Target_arm::are_eabi_versions_compatible,
10482         (Target_arm::merge_processor_specific_flags): New method declaration.
10483         (Target_arm::do_make_elf_object): New overloaded method definitions
10484         and declaration.
10485         (Arm_relobj::do_read_symbols): New method definition.
10486         (Arm_dynobj::do_read_symbols): Ditto.
10487         (Target_arm::do_finalize_sections): Add input_objects parameters.
10488         Merge processor-specific flags from all input objects.
10489         (Target_arm::are_eabi_versions_compatible,
10490         Target_arm::merge_processor_specific_flags,
10491         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10492         New method definitions.
10493         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10494         Input_objects pointer type parameter.
10495         * layout.cc (Layout::finalize): Pass input objects to target's.
10496         finalize_sections function.
10497         * output.cc (Output_file_header::do_sized_write): Set ELF file
10498         header's processor-specific flags.
10499         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10500         Input_objects pointer type parameter.
10501         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10502         * target.h (Input_objects): New forward class declaration.
10503         (Target::processor_specific_flags,
10504         Target::are_processor_specific_flags_sect): New method definitions.
10505         (Target::finalize_sections): Add input_objects parameter.
10506         (Target::Target): Initialize processor_specific_flags_ and
10507         are_processor_specific_flags_set_.
10508         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10509         parameter.
10510         (Target::set_processor_specific_flags): New method definition.
10511         (Target::processor_specific_flags_,
10512         Target::are_processor_specific_flags_set_): New data member
10513         declarations.
10514         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10515         Input_objects pointer type parameter.
10516
10517 2009-10-30  Doug Kwan  <dougkwan@google.com>
10518
10519         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10520
10521 2009-10-28  Ian Lance Taylor  <iant@google.com>
10522
10523         * object.h (class Relobj): Drop options parameter from
10524         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10525         do_scan_relocs, do_relocate.  Change all callers.
10526         (class Sized_relobj): Drop options parameters from
10527         do_gc_process_relocs, do_scan_relocs, do_relocate,
10528         do_relocate_sections, relocate_sections, emit_relocs_scan,
10529         emit_relocs_scan_reltype.  Change all callers.
10530         (struct Relocate_info): Remove options field and all references to
10531         it.
10532         * reloc.h (class Read_relocs): Remove options constructor
10533         parameter and options_ field.  Change all callers.
10534         (class Gc_process_relocs, class Scan_relocs): Likewise.
10535         (class Relocate_task): Likewise.
10536         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10537         all callers.
10538         (scan_relocatable_relocs): Likewise.
10539         * target.h (class Sized_target): Remove options parameter from
10540         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10541         all callers.
10542         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10543         callers.
10544         * arm.cc: Update functions to remove options parameters.
10545         * i386.cc: Likewise.
10546         * powerpc.cc: Likewise.
10547         * sparc.cc: Likewise.
10548         * x86_64.cc: Likewise.
10549         * testsuite/testfile.cc: Likewise.
10550
10551 2009-10-28  Doug Kwan  <dougkwan@google.com>
10552
10553         * arm.cc (Arm_relobj): New class definition.
10554         (Arm_relobj::scan_sections_for_stubs,
10555         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10556         New method definitions.
10557
10558 2009-10-28  Cary Coutant  <ccoutant@google.com>
10559
10560         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10561         (Plugin::cleanup_done_): New member.
10562         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10563         (Plugin_manager::cleanup_done_): Remove.
10564         (Plugin_manager::add_input_file): Edit error message.
10565         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10566         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10567
10568 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10569
10570         * fileread.cc: (File_read::View::~View): Use the new
10571         data_ownership_ filed.
10572         (File_read::~File_read): Dispose the new whole_file_view_.
10573         (File_read::open): Mmap the whole file if needed.
10574         (File_read::open): Use whole_file_view_ instead of contents_.
10575         (File_read::find_view): Use whole_file_view_ if applicable.
10576         (File_read::do_read): Use whole_file_view_ instead of contents_.
10577         (File_read::make_view): Use whole_file_view_ instead of contents_,
10578         update File_read::View::View call.
10579         (File_read::find_or_make_view): Update File_read::View::View
10580         call.
10581         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10582         remove contents_
10583         (File_read::View::Data_ownership): New enum.
10584         (File_read::View::View): Replace bool mapped_ with Data_ownership
10585         argument.
10586         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10587         (File_read::View::data_ownership_): New field.
10588         (File_read::contents_): Remove (replaced by whole_file_view_).
10589         (File_read::whole_file_view_): New field.
10590         * options.h (class General_options): Add --keep-files-mapped.
10591
10592 2009-10-27  Cary Coutant  <ccoutant@google.com>
10593
10594         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10595         * testsuite/Makefile.am (plugin_test_5): New test case.
10596         * testsuite/Makefile.in: Regenerate.
10597
10598 2009-10-25  Doug Kwan  <dougkwan@google.com>
10599
10600         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10601         from private to protected to allow access by child class.
10602         (Sized_relobj::do_relocate_sections): New method declaration.
10603         (Sized_relobj::relocate_sections): Virtualize.
10604         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10605         Sized_relobj::relocate_sections.  Instantiate template explicitly
10606         for different target sizes and endianity.
10607
10608 2009-10-24  Doug Kwan  <dougkwan@google.com>
10609
10610         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10611         (Arm_input_section::as_arm_input_section): New method.
10612         (Arm_output_section): New class definition.
10613         (Arm_output_section::create_stub_group,
10614         Arm_output_section::group_sections): New method definitions.
10615
10616 2009-10-22  Doug Kwan  <dougkwan@google.com>
10617
10618         * arm.cc (Arm_input_section): New class definition.
10619         (Arm_input_section::init, Arm_input_section:do_write,
10620         Arm_input_section::set_final_data_size,
10621         Arm_input_section::do_reset_address_and_file_offset): New method
10622         definitions.
10623
10624 2009-10-21  Doug Kwan  <dougkwan@google.com>
10625
10626         * arm.cc (Stub_table, Arm_input_section): New forward class
10627         declarations.
10628         (Stub_table): New class defintion.
10629         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10630         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10631         New method definition.
10632
10633 2009-10-21  Doug Kwan  <dougkwan@google.com>
10634
10635         * arm.cc: Update copyright comments.
10636         (Target_arm): New forward class template declaration.
10637         (Arm_address): New type.
10638         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10639         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10640         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10641         constants.
10642         (Insn_template): Same.
10643         (DEF_STUBS): New macro.
10644         (Stub_type): New enum type.
10645         (Stub_template): New class definition.
10646         (Stub): Same.
10647         (Reloc_stub): Same.
10648         (Stub_factory): Same.
10649         (Target_arm::Target_arm): Initialize may_use_blx_ and
10650         should_force_pic_veneer_.
10651         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10652         Target_arm::should_force_pic_veneer,
10653         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10654         Target_arm::using_thumb_only, Target_arm:;default_target): New
10655         method defintions.
10656         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10657         New data member declarations.
10658         (Insn_template::size, Insn_template::alignment): New method defintions.
10659         (Stub_template::Stub_template): New method definition.
10660         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10661         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10662         (Stub_factory::Stub_factory): New method definition.
10663         * gold.h (string_hash): New template.
10664         * output.h (Input_section_specifier::hash_value): Use
10665         gold::string_hash.
10666         (Input_section_specifier::string_hash): Remove.
10667         * stringpool.cc (Stringpool_template::string_hash): Use
10668         gold::string_hash.
10669
10670 2009-10-20  Doug Kwan  <dougkwan@google.com>
10671
10672         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10673         symbols of relaxed input sections.
10674         * output.h (Output_section::find_relaxed_input_section): Make
10675         method public.
10676
10677 2009-10-16  Doug Kwan  <dougkwan@google.com>
10678
10679         * dynobj.cc (Versions::Versions): Initialize version_script_.
10680         Only insert base version symbol definition for a shared object
10681         if version script defines any version versions.
10682         (Versions::define_base_version): New method definition.
10683         (Versions::add_def): Check that base version is not needed.
10684         (Versions::add_need): Define base version lazily.
10685         * dynobj.h (Versions::define_base_version): New method declaration.
10686         (Versions::needs_base_version_): New data member declaration.
10687         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10688         (check_DATA): Add no_version_test.stdout.
10689         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10690         New make rules.
10691         * testsuite/Makefile.in: Regenerate.
10692         * testsuite/no_version_test.c: New file.
10693         * testsuite/no_version_test.sh: Ditto.
10694
10695 2009-10-16  Doug Kwan  <dougkwan@google.com>
10696
10697         * expression.cc (class Segment_start_expression): New class definition.
10698         (Segment_start_expression::value): New method definition.
10699         (script_exp_function_segment_start): Return a new
10700         Segment_start_expression.
10701         * gold/script-c.h (script_saw_segment_start_expression): New function
10702         prototype.
10703         * script-sections.cc (Script_sections::Script_sections): Initialize
10704         SAW_SEGMENT_START_EXPRESSION_ to false.
10705         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10706         and -Tbbs options to specify section addresses if given in
10707         command line and no SEGMENT_START expression is seen in a script.
10708         * script-sections.h (Script_sections::saw_segment_start_expression,
10709         Script_sections::set_saw_segment_start_expression): New method
10710         definition.
10711         (Script_sections::saw_segment_start_expression_): New data member
10712         declaration.
10713         * script.cc (script_saw_segment_start_expression): New function.
10714         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10715         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10716         script_test_7.sh and script_test_8.sh.
10717         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10718         script_test_8.stdout.
10719         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10720         (script_test_6, script_test_6.stdout, script_test_7,
10721         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10722         * Makefile.in: Regenerate.
10723         * testsuite/script_test_6.sh: New file.
10724         * testsuite/script_test_6.t: Same.
10725         * testsuite/script_test_7.sh: Same.
10726         * testsuite/script_test_7.t: Same.
10727         * testsuite/script_test_8.sh: Same.
10728
10729 2009-10-16  Doug Kwan  <dougkwan@google.com>
10730
10731         * output.cc (Output_segment::set_section_list_address): Cast
10732         expressions to unsigned long long type to avoid format warnings.
10733
10734 2009-10-15  Ian Lance Taylor  <iant@google.com>
10735
10736         * script.cc (Script_options::add_symbol_assignment): Always add a
10737         dot assignment to script_sections_.
10738         * script-sections.cc (Script_sections::add_dot_assignment):
10739         Initialize if necessary.
10740
10741         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10742         program headers with no load segment if there is a linker script.
10743
10744         * layout.cc (Layout::set_segment_offsets): Align the file offset
10745         to the segment aligment for -N or -n with no load segment.
10746         * output.cc (Output_segment::add_output_section): Don't crash if
10747         the first section is a TLS section.
10748         (Output_segment::set_section_list_addresses): Print an error
10749         message if the address moves backward in a linker script.
10750         * script-sections.cc
10751         (Output_section_element_input::set_section_addresses): Don't
10752         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10753         (Orphan_output_section::set_section_addresses): Likewise.
10754
10755 2009-10-15  Doug Kwan  <dougkwan@google.com>
10756
10757         * layout.cc (Layout::finish_dynamic_section): Generate tags
10758         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10759         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10760         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10761
10762 2009-10-14  Ian Lance Taylor  <iant@google.com>
10763
10764         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10765         fields.
10766         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10767         data_shdr fields of relinfo.
10768         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10769         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10770         R_386_TLS_LDO_32, adjust based on section flags.
10771         (Target_i386::Relocate::fix_up_ldo): Remove.
10772
10773 2009-10-13  Ian Lance Taylor  <iant@google.com>
10774
10775         Add support for -pie.
10776         * options.h (class General_options): Add -pie and
10777         --pic-executable.
10778         (General_options::output_is_position_independent): Test -pie.
10779         (General_options::output_is_executable): Return true if not shared
10780         and not relocatable.
10781         (General_options::output_is_pie): Remove.
10782         * options.cc (General_options::finalize): Reject incompatible uses
10783         of -pie.
10784         * gold.cc (queue_middle_tasks): A -pie link is not static.
10785         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10786         * symtab.cc (Symbol::final_value_is_known): Return false if
10787         output_is_position_independent.
10788         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10789         output_is_position_independent.
10790         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10791         output_is_position_independent.
10792         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10793         output_is_position_independent.
10794         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10795         two_file_pie_test.
10796         (basic_pie_test.o, basic_pie_test): New targets.
10797         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10798         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10799         (two_file_pie_test): New target.
10800         * testsuite/Makefile.in: Rebuild.
10801         * README: Remove note saying that -pie is not supported.
10802
10803 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10804
10805         * options.h (class General_options): Add -init and -fini.
10806         * layout.cc (Layout::finish_dynamic_section): Emit
10807         given init and fini functions.
10808
10809 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10810
10811         * gc.h (gc_process_relocs): Check if icf is enabled using new
10812         function.
10813         * gold.cc (queue_initial_tasks): Likewise.
10814         (queue_middle_tasks): Likewise.
10815         * object.cc (do_layout): Likewise.
10816         * symtab.cc (is_section_folded): Likewise.
10817         * main.cc (main): Likewise.
10818         * reloc.cc (Read_relocs::run): Likewise.
10819         (Sized_relobj::do_scan_relocs): Likewise.
10820         * icf.cc (is_function_ctor_or_dtor): New function.
10821         (Icf::find_identical_sections): Check if function is ctor or dtor when
10822         safe icf is chosen.
10823         * options.h (General_options::icf): Change option to be an enum.
10824         (Icf_status): New enum.
10825         (icf_enabled): New method.
10826         (icf_safe_folding): New method.
10827         (set_icf_status): New method.
10828         (icf_status_): New variable.
10829         * (options.cc) (General_options::finalize): Set icf_status_.
10830         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10831         icf_test and icf_keep_unique_test to use the --icf enum flag.
10832         * testsuite/icf_safe_test.sh: New file.
10833         * testsuite/icf_safe_test.cc: New file.
10834
10835 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10836
10837         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10838         includes to gc.h and icf.h.
10839         * arm.cc: Include gc.h.
10840         * gold.cc: Likewise.
10841         * i386.cc: Likewise.
10842         * powerpc.cc: Likewise.
10843         * sparc.cc: Likewise.
10844         * x86_64.cc: Likewise.
10845         * gc.h: Include icf.h.
10846
10847 2009-10-11  Ian Lance Taylor  <iant@google.com>
10848
10849         * plugin.cc: Include "gold.h" before other header files.
10850
10851 2009-10-10  Chris Demetriou  <cgd@google.com>
10852
10853         * options.h (Input_file_argument::Input_file_type): New enum.
10854         (Input_file_argument::is_lib_): Replace with...
10855         (Input_file_argument::type_): New member.
10856         (Input_file_argument::Input_file_argument): Take Input_file_type
10857         'type' rather than boolean 'is_lib' as second argument.
10858         (Input_file_argument::is_lib): Use type_.
10859         (Input_file_argument::is_searched_file): New function.
10860         (Input_file_argument::may_need_search): Handle is_searched_file.
10861         * options.cc (General_options::parse_library): Support -l:filename.
10862         (General_options::parse_just_symbols): Update for Input_file_argument
10863         changes.
10864         (Command_line::process): Likewise.
10865         * archive.cc (Archive::get_file_and_offset): Likewise.
10866         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10867         * script.cc (read_script_file, script_add_file): Likewise.
10868         * fileread.cc (Input_file::Input_file): Likewise.
10869         (Input_file::will_search_for): Handle is_searched_file.
10870         (Input_file::open): Likewise.
10871         * readsyms.cc (Read_symbols::get_name): Likewise.
10872         * testsuite/Makefile.am (searched_file_test): New test.
10873         * testsuite/Makefile.in: Regenerate.
10874         * testsuite/searched_file_test.cc: New file.
10875         * testsuite/searched_file_test_lib.cc: New file.
10876
10877 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10878             Ian Lance Taylor  <iant@google.com>
10879
10880         * descriptor.cc: Include <cstdio> and "binary-io.h".
10881         (Descriptors::open): Open the files in binary mode always.
10882         * script.cc (Lex::get_token): Treat \r as whitespace.
10883
10884 2009-10-09  Ian Lance Taylor  <iant@google.com>
10885
10886         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10887
10888 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10889             Ian Lance Taylor  <iant@google.com>
10890
10891         * configure.ac: Check for readv function also.
10892         * fileread.cc (readv): Define if not HAVE_READV.
10893         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10894         does not exist.
10895         * config.in: Regenerate.
10896         * configure: Regenerate.
10897
10898 2009-10-09  Doug Kwan  <dougkwan@google.com>
10899
10900         * layout.cc (Layout::make_output_section): Call target hook to make
10901         ordinary output section.
10902         (Layout::finalize): Adjust parameter list of call the
10903         Target::may_relax().
10904         * layout.h (class Layout::section_list): New method.
10905         * merge.h (Output_merge_base::entsize): Change visibility to public.
10906         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10907         New methods.
10908         (Output_merge_string::do_is_string): New method.
10909         * object.cc (Sized_relobj::do_setup): renamed from
10910         Sized_relobj::set_up.
10911         * object.h (Sized_relobj::adjust_shndx,
10912         Sized_relobj::initializ_input_to_output_maps,
10913         Sized_relobj::free_input_to_output_maps): Change visibilities to
10914         protected.
10915         (Sized_relobj::setup): Virtualize.
10916         (Sized_relobj::do_setup): New method declaration.
10917         (Sized_relobj::invalidate_section_offset,
10918         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10919         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10920         * options.cc (parse_int): New function.
10921         * options.h (parse_int): New declaration.
10922         (DEFINE_int): New macro.
10923         (stub_group_size): New option.
10924         * output.cc (Output_section::Output_section): Initialize memebers
10925         merge_section_map_, merge_section_by_properties_map_,
10926         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10927         (Output_section::add_input_section): Handled deferred code-fill
10928         generation and remove an old comment.
10929         (Output_section::add_relaxed_input_section): New method definition.
10930         (Output_section::add_merge_input_section): Use merge section by
10931         properties map to speed to search.  Update merge section maps
10932         as appropriate.
10933         (Output_section::build_relaxation_map): New method definition.
10934         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10935         Same.
10936         (Output_section::relax_input_section): Renamed to
10937         Output_section::convert_input_sections_to_relaxed_sections and change
10938         interface to take a vector of pointers to relaxed sections.
10939         (Output_section::find_merge_section,
10940         Output_section::find_relaxed_input_section): New method definitions.
10941         (Output_section::is_input_address_mapped,
10942         Output_section::output_offset, Output_section::output_address):
10943         Use output section data maps to speed up searching.
10944         (Output_section::find_starting_output_address): Add comments.
10945         (Output_section::do_write,
10946         Output_section::write_to_postprocessing_buffer): Do code-fill
10947         generation as appropriate.
10948         (Output_section::get_input_sections): Invalidate relaxed input section
10949         map.
10950         (Output_section::restore_states): Adjust type of checkpoint .
10951         Invalidate relaxed input section map.
10952         * output.h (Output_merge_base): New class declaration.
10953         (Input_section_specifier): New class defintion.
10954         (class Output_relaxed_input_section) Change base class to
10955         Output_section_data_build.
10956         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10957         base class initializer.
10958         (Output_section::add_relaxed_input_section): New method declaration.
10959         (Output_section::Input_section): Change visibility to protected.
10960         (Output_section::Input_section::relobj,
10961         Output_section::Input_section::shndx): Handle relaxed input sections.
10962         Output_section::input_sections) Change visibility to protected.  Also
10963         define overload to return a non-const pointer.
10964         (Output_section::Merge_section_properties): New class defintion.
10965         (Output_section::Merge_section_by_properties_map,
10966         Output_section::Output_section_data_by_input_section_map,
10967         Output_section::Relaxation_map): New types.
10968         (Output_section::relax_input_section): Rename method to
10969         Output_section::convert_input_sections_to_relaxed_sections and change
10970         interface to take a vector of relaxed section pointers.
10971         (Output_section::find_merge_section,
10972         Output_section::find_relaxed_input_section,
10973         Output_section::build_relaxation_map,
10974         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10975         New method declarations.
10976         (Output_section::merge_section_map_
10977         Output_section::merge_section_by_properties_map_,
10978         Output_section::relaxed_input_section_map_,
10979         Output_section::is_relaxed_input_section_map_valid_,
10980         Output_section::generate_code_fills_at_write_): New data members.
10981         * script-sections.cc
10982         (Output_section_element_input::set_section_addresses): Call
10983         current_data_size and addralign methods of relaxed input sections.
10984         (Orphan_output_section::set_section_addresses): Call current_data_size
10985         and addralign methods of relaxed input sections.
10986         * symtab.cc (Symbol_table::compute_final_value): Extract template
10987         from the body of Symbol_table::sized_finalize_symbol.
10988         (Symbol_table::sized_finalized_symbol): Call
10989         Symbol_table::compute_final_value.
10990         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10991         (Symbol_table::compute_final_value): New templated method declaration.
10992         * target.cc (Target::do_make_output_section): New method defintion.
10993         * target.h (Target::make_output_section): New method declaration.
10994         (Target::relax): Add more parameters for input objects, symbol table
10995         and layout.  Adjust call to do_relax.
10996         (Target::do_make_output_section): New method declaration.
10997         (Target::do_relax): Add parameters for input objects, symbol table
10998         and layout.
10999
11000 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11001
11002         * pread.c: Include stdio.h.
11003
11004 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11005
11006         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11007         defined.
11008
11009 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11010
11011         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11012         Change read_shndx type to unsigned int.
11013         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11014         int.
11015         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11016         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11017         Change read_shndx type to unsigned int.
11018         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11019         int.
11020         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11021         * layout.cc (Layout::create_symtab_sections): Cast the result of
11022         local_symcount * symsize to off_t in the gold_assert.
11023
11024 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11025
11026         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11027         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11028         R_ARM_BASE_ABS.
11029         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11030         (Arm_relocate_functions::thm_abs5): New function.
11031         (Arm_relocate_functions::abs12): New function.
11032         (Arm_relocate_functions::abs16): New function.
11033         (Arm_relocate_functions::base_abs): New function.
11034         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11035         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11036         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11037         R_ARM_BASE_ABS.
11038         (Scan::global): Likewise.
11039         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11040         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11041         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11042         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11043         R_ARM_BASE_ABS.
11044
11045 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11046
11047         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11048         (Arm_relocate_functions::movt_prel): New function.
11049         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11050         (Arm_relocate_functions::thm_movt_prel): New function.
11051         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11052         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11053         (Scan::global, Relocate::relocate): Likewise.
11054         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11055
11056 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11057
11058         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11059         Incremental_checker.
11060         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11061         unsigned int.
11062         (class Incremental_inputs_header): New class.
11063         (Incremental_inputs_header_writer): Edit comment.
11064         (Incremental_inputs_entry): New class.
11065         (Incremental_inputs_entry_writer): Edit comment.
11066         (Sized_incremental_binary::do_find_incremental_inputs_section):
11067         Add *strtab_shndx parameter, fill it.
11068         (Sized_incremental_binary::do_check_inputs): New method.
11069         (Incremental_checker::can_incrementally_link_output_file): Use
11070         Sized_incremental_binary::check_inputs.
11071         (Incremental_inputs::report_command_line): Save command line in
11072         command_line_.
11073         * incremental.h:
11074         (Incremental_binary::find_incremental_inputs_section): New
11075         method.
11076         (Incremental_binary::do_find_incremental_inputs_section): Add
11077         strtab_shndx parameter.
11078         (Incremental_binary::do_check_inputs): New pure virtual method.
11079         (Sized_incremental_binary::do_check_inputs): Declare.
11080         (Incremental_checker::Incremental_checker): Add incremental_inputs
11081         parameter, use it to initialize incremental_inputs_.
11082         (Incremental_checker::incremental_inputs_): New field.
11083         (Incremental_checker::command_line): New method.
11084         (Incremental_checker::inputs): New method.
11085         (Incremental_checker::command_line_): New field.
11086
11087 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11088
11089         * incremental.cc: Include <cstdarg> and "target-select.h".
11090         (vexplain_no_incremental): New function.
11091         (explain_no_incremental): New function.
11092         (Incremental_binary::error): New method.
11093         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11094         method.
11095         (make_sized_incremental_binary): New function.
11096         (open_incremental_binary): New function.
11097         (can_incrementally_link_file): Add checks if output is ELF and has
11098         inputs section.
11099         * incremental.h: Include "elfcpp_file.h" and "output.h".
11100         (Incremental_binary): New class.
11101         (Sized_incremental_binary): New class.
11102         (open_incremental_binary): Declare.
11103         * object.cc (is_elf_object): Use
11104         elfcpp::Elf_recognizer::is_elf_file.
11105         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11106         * output.h (Output_file::filesize): New method.
11107
11108 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11109
11110         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11111         New function.
11112         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11113         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11114         function.
11115         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11116         function.
11117         (Arm_relocate_functions::movw_abs_nc): New function.
11118         (Arm_relocate_functions::movt_abs): New function.
11119         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11120         (Arm_relocate_functions::thm_movt_abs): New function.
11121         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11122         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11123         (Scan::global): Likewise.
11124         (Relocate::relocate): Likewise.
11125         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11126
11127 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11128
11129         * arm.cc (Arm_relocate_functions::got_prel) New function.
11130         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11131         (Relocate::relocate): Likewise.
11132         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11133
11134 2009-10-06  Ian Lance Taylor  <iant@google.com>
11135
11136         * options.h (class General_options): Define
11137         split_stack_adjust_size parameter.
11138         * object.h (class Object): Add uses_split_stack_ and
11139         has_no_split_stack_ fields.  Add uses_split_stack and
11140         has_no_split_stack accessor functions.  Declare
11141         handle_split_stack_section.
11142         (class Reloc_symbol_changes): Define.
11143         (class Sized_relobj): Define Function_offsets.  Declare
11144         split_stack_adjust, split_stack_adjust_reltype, and
11145         find_functions.
11146         * object.cc (Object::handle_split_stack_section): New function.
11147         (Sized_relobj::do_layout): Call handle_split_stack_section.
11148         * dynobj.cc (Sized_dynobj::do_layout): Call
11149         handle_split_stack_section.
11150         * reloc.cc (Sized_relobj::relocate_sections): Call
11151         split_stack_adjust for executable sections in split_stack
11152         objects.  Pass reloc_map to relocate_section.
11153         (Sized_relobj::split_stack_adjust): New function.
11154         (Sized_relobj::split_stack_adjust_reltype): New function.
11155         (Sized_relobj::find_functions): New function.
11156         * target-reloc.h: Include "object.h".
11157         (relocate_section): Add reloc_symbol_changes parameter.  Change
11158         all callers.
11159         * target.h (class Target): Add calls_non_split method.  Declare
11160         do_calls_non_split virtual method.  Declare match_view and
11161         set_view_to_nop.
11162         * target.cc: Include "elfcpp.h".
11163         (Target::do_calls_non_split): New function.
11164         (Target::match_view): New function.
11165         (Target::set_view_to_nop): New function.
11166         * gold.cc (queue_middle_tasks): Give an error if mixing
11167         split-stack and non-split-stack objects with -r.
11168         * i386.cc (Target_i386::relocate_section): Add
11169         reloc_symbol_changes parameter.
11170         (Target_i386::do_calls_non_split): New function.
11171         * x86_64.cc (Target_x86_64::relocate_section): Add
11172         reloc_symbol_changes parameter.
11173         (Target_x86_64::do_calls_non_split): New function.
11174         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11175         parameter.
11176         * powerpc.cc (Target_powerpc::relocate_section): Add
11177         reloc_symbol_changes parameter.
11178         * sparc.cc (Target_sparc::relocate_section): Add
11179         reloc_symbol_changes parameter.
11180         * configure.ac: Call AM_CONDITIONAL for the default target.
11181         * configure: Rebuild.
11182         * testsuite/Makefile.am (TEST_AS): New variable.
11183         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11184         (check_DATA): Add split_i386 and split_x86_64 files.
11185         (SPLIT_DEFSYMS): Define.
11186         (split_i386_[1234n].o): New targets.
11187         (split_i386_[124]): New targets.
11188         (split_i386_[1234r].stdout): New targets.
11189         (split_x86_64_[1234n].o): New targets.
11190         (split_x86_64_[124]): New targets.
11191         (split_x86_64_[1234r].stdout): New targets.
11192         (MOSTLYCLEANFILES): Add new executables.
11193         * testsuite/split_i386.sh: New file.
11194         * testsuite/split_x86_64.sh: New file.
11195         * testsuite/split_i386_1.s: New file.
11196         * testsuite/split_i386_2.s: New file.
11197         * testsuite/split_i386_3.s: New file.
11198         * testsuite/split_i386_4.s: New file.
11199         * testsuite/split_i386_n.s: New file.
11200         * testsuite/split_x86_64_1.s: New file.
11201         * testsuite/split_x86_64_2.s: New file.
11202         * testsuite/split_x86_64_3.s: New file.
11203         * testsuite/split_x86_64_4.s: New file.
11204         * testsuite/split_x86_64_n.s: New file.
11205         * testsuite/testfile.cc (Target_test): Update relocation_section
11206         function.
11207         * testsuite/Makefile.in: Rebuild.
11208
11209 2009-10-06  Ian Lance Taylor  <iant@google.com>
11210
11211         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11212         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11213         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11214         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11215         the address on ldo_addrs_.
11216         (Target_i386::Relocate::fix_up_ldo): New function.
11217
11218 2009-10-06   Rafael Espindola  <espindola@google.com>
11219
11220         * plugin.cc (add_input_library): New.
11221         (Plugin::load): Add add_input_library to tv.
11222         (Plugin_manager::add_input_file): Add the is_lib argument.
11223         (add_input_file): Update call to Plugin_manager::add_input_file.
11224         (add_input_library): New.
11225         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11226
11227 2009-09-30  Doug Kwan  <dougkwan@google.com>
11228
11229         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11230         symbol and call Symbol::may_need_copy_reloc to determine if
11231         a copy reloc is needed.
11232         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11233         nocopyreloc is given in command line.
11234         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11235         given in command line.
11236         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11237         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11238         of the removed Target_i386::may_need_copy_reloc.
11239         * options.h (copyreloc): New option with default value false.
11240         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11241         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11242         instead of the removed Target_powerpc::may_need_copy_reloc.
11243         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11244         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11245         instead of the removed Target_sparc::may_need_copy_reloc.
11246         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11247         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11248         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11249         instead of the removed Target_x86_64::may_need_copy_reloc.
11250
11251 2009-09-30  Ian Lance Taylor  <iant@google.com>
11252
11253         * object.h (class Object): Remove target_ field, and target,
11254         sized_target, and set_target methods.
11255         (Object::sized_target): Remove.
11256         (class Sized_relobj): Update declarations.  Remove sized_target.
11257         * object.cc (Sized_relobj::setup): Remove target parameter.
11258         Change all callers.
11259         (Input_objects::add_object): Don't do anything with the target.
11260         (make_elf_sized_object): Add punconfigured parameter.  Change all
11261         callers.  Set or test parameter target.
11262         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11263         Change all callers.
11264         * parameters.cc (Parameters::set_target): Change parameter type to
11265         be non-const.
11266         (Parameters::default_target): Remove.
11267         (set_parameters_target): Change parameter type to be non-const.
11268         (parameters_force_valid_target): New function.
11269         (parameters_clear_target): New function.
11270         * parameters.h (class Parameters): Update declarations.  Remove
11271         default_target method.  Add sized_target and clear_target
11272         methods.  Change target_ to be non-const.
11273         (set_parameters_target): Update declaration.
11274         (parameters_force_valid_target): Declare.
11275         (parameters_clear_target): Declare.
11276         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11277         as NULL if we aren't searching.
11278         (Add_symbols::run): Don't check for compatible target.
11279         * fileread.cc (Input_file::open_binary): Call
11280         parameters_force_valid_target.
11281         * gold.cc (queue_middle_tasks): Likewise.
11282         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11283         set_target on object.
11284         * dynobj.h (class Sized_dynobj): Update declarations.
11285         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11286         make_elf_object returns NULL.
11287         (Archive::include_member): Don't check whether object target is
11288         compatible.
11289         * output.cc (Output_section::add_input_section): Get target from
11290         parameters.
11291         (Output_section::relax_input_section): Likewise.
11292         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11293         parameters.
11294         (Sized_relobj::do_scan_relocs): Likewise.
11295         (Sized_relobj::relocate_sections): Likewise.
11296         * resolve.cc (Symbol_table::resolve): Likewise.
11297         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11298         parameter.  Change all callers.
11299         (Symbol_table::add_from_object): Get target from parameters.
11300         (Symbol_table::add_from_relobj): Don't check object target.
11301         (Symbol_table::add_from_dynobj): Likewise.
11302         (Symbol_table::define_special_symbol): Get target from
11303         parameters.
11304         * symtab.h (class Symbol_table): Update declaration.
11305         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11306         parameter.  Change all callers.  Clear parameter target.
11307         (Binary_test): Test target here.
11308         * testsuite/object_unittest.cc (gold_testsuite): Remove
11309         target_test_pointer parameter.  Change all callers.
11310         (Object_test): Test target here.
11311
11312 2009-09-26  Ian Lance Taylor  <iant@google.com>
11313
11314         * testsuite/initpri1.c: Don't try to use constructor priorities if
11315         compiling with gcc before 4.3.
11316
11317 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11318
11319         * testsuite/retain_symbols_file_test.sh (check_present): Change
11320         output file name to retain_symbols_file_test.stdout.
11321         (check_absent): Likewise.
11322
11323 2009-09-18  Craig Silverstein  <csilvers@google.com>
11324
11325         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11326         * options.cc: Include <cerrno> and <fstream>.
11327         (General_options::finalize): Parse -retain-symbols-file tag.
11328         * options.h: New flag.
11329         (General_options): New method should_retain_symbol, new
11330         variable symbols_to_retain.
11331         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11332         should_retain_symbol map.
11333         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11334         * testsuite/Makefile.in: Regenerate.
11335         * testsuite/retain_symbols_file_test.sh: New file.
11336
11337 2009-09-18  Nick Clifton  <nickc@redhat.com>
11338
11339         * po/es.po: Updated Spanish translation.
11340
11341 2009-09-17  Doug Kwan  <dougkwan@google.com>
11342
11343         * debug.h (DEBUG_RELAXATION): New constant.
11344         (DEBUG_ALL): Add DEBUG_RELAXATION.
11345         (debug_string_to_enum): Add relaxation debug option.
11346         * layout.cc
11347         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11348         Layout::Relaxation_debug_check::read_sections,
11349         Layout::Relaxation_debug_check::read_sections): New method definitions.
11350         (Layout::Layout): Initialize data members
11351         record_output_section_data_from_scrips_,
11352         script_output_section_data_list_ and relaxation_debug_check_.
11353         (Layout::save_segments, Layout::restore_segments,
11354         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11355         Layout::relaxation_loop_body): New method definitions.
11356         (Layout::finalize): Support relaxation.  Move section layout code to
11357         Layout::relaxation_loop_body.
11358         (Layout::set_asection_address_from_script): Move code for orphan
11359         section placement out.
11360         (Layout::place_orphan_sections_in_script): New method definition.
11361         * layout.h (Output_segment_headers, Output_file_header):
11362         New forward class declarations.
11363         (Layout::~Layout): Define.
11364         (Layout::new_output_section_data_from_script): New method definition.
11365         (Layout::place_orphan_sections_in_script): New method declaration.
11366         (Layout::Segment_states): New type declaration.
11367         (Layout::save_segments, Layout::restore_segments,
11368         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11369         Layout::relaxation_loop_body): New method declarations.
11370         (Layout::Output_section_data_list): New type declaration.
11371         (Layout::Relaxation_debug_check): New class definition.
11372         (Layout::record_output_section_data_from_script_,
11373         Layout::script_output_section_data_list_, Layout::segment_states_,
11374         Layout::relaxation_debug_check_): New data members.
11375         * output.cc: (Output_section_headers::do_size): New method definition.
11376         (Output_section_headers::Output_section_headers): Move size
11377         computation to Output_section_headers::do_size.
11378         (Output_segment_headers::do_size): New method definition.
11379         (Output_file_header::Output_file_header): Move size computation to
11380         Output_file_header::do_size and call it.
11381         (Output_file_header::do_size): New method definition.
11382         (Output_data_group::Output_data_group): Adjust call to
11383         Output_section_data.
11384         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11385         (Output_symtab_xindex::do_write): Add array bound check.
11386         (Output_section::Input_section::print_to_mapfile): Handle
11387         RELAXED_INPUT_SECTION_CODE.
11388         (Output_section::Output_section): Initialize data member checkpoint_.
11389         (Output_section::~Output_section): Delete checkpoint object pointed
11390         by checkpoint_.
11391         (Output_section::add_input_section): Always add an Input_section if
11392         relaxing.
11393         (Output_section::add_merge_input_section): Add assert.
11394         (Output_section::relax_input_section): New method definition.
11395         (Output_section::set_final_data_size): Set load address to zero for
11396         an unallocated section.
11397         (Output_section::do_address_and_file_offset_have_reset_values):
11398         New method definition.
11399         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11400         Handle relaxed input section.
11401         (Output_section::sort_attached_input_sections): Checkpoint input
11402         section list lazily.
11403         (Output_section::get_input_sections): Change type of input_sections to
11404         list of Simple_input_section pointers.  Checkpoint input section list
11405         lazily.  Also handle relaxed input sections.
11406         (Output_section::add_input_section_for_script): Take a reference to
11407         a Simple_input_section object instead of Relobj pointer and section
11408         index as parameter.  Handle relaxed input sections.
11409         (Output_section::save_states, Output_section::restore_states): New
11410         method definitions.
11411         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11412         (Output_data::is_data_size_fixed): New method definition.
11413         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11414         if it is fixed.
11415         (Output_data::address_and_file_offset_have_reset_values): New method
11416         definition.
11417         (Output_data::do_address_and_file_offset_have_reset_values): New method
11418         definition.
11419         (Output_data::set_data_size): Check that data size is not fixed.
11420         (Output_data::fix_data_size): New method definition.
11421         (Output_data::is_data_size_fixed_): New data member.
11422         (Output_section_headers::set_final_data_size): New method definition.
11423         (Output_section_headers::do_size): New method declaration.
11424         (Output_segment_headers::set_final_data_size): New method definition.
11425         (Output_segment_headers::do_size): New method declaration.
11426         (Output_file_header::set_final_data_size)::New method definition.
11427         (Output_file_header::do_size)::New method declaration.
11428         (Output_section_data::Output_section_data): Add new parameter
11429         is_data_size_fixed and use it to fix data size.
11430         (Output_data_const::Output_data_const): Adjust call to base class
11431         constructor and fix data size.
11432         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11433         base class constructor and fix data size.
11434         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11435         base class constructor and fix data size.
11436         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11437         class constructor and fix data size.
11438         (Output_data_group::set_final_data_size): New method definition.
11439         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11440         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11441         class constructor and fix data size.
11442         (Output_relaxed_input_section): New class definition.
11443         (Output_section::Simple_input_section): New class definition.
11444         (Output_section::get_input_sections): Adjust parameter list.
11445         (Output_section::add_input_section_for_script): Same.
11446         (Output_section::save_states, Output_section::restore_states,
11447         Output_section::do_address_and_file_offset_have_reset_values,
11448         (Output_section::Input_section::Input_section): Handle
11449         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11450         Output_relaxed_input_section.
11451         (Output_section::Input_section::is_input_section,
11452         Output_section::Input_section::set_output_section): Handle relaxed
11453         input section.
11454         (Output_section::Input_section::is_relaxed_input_section,
11455         Output_section::Input_section::output_section_data,
11456         Output_section::Input_section::relaxed_input_section): New method
11457         definitions.
11458         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11459         value.
11460         (Output_section::Input_section::u1_): Update comments.
11461         (Output_section::Input_section::u2_): Add new union member poris.
11462         (Output_section::Checkpoint_output_section): New classs definition.
11463         (Output_section::relax_input_section): New method declaration.
11464         (Output_section::checkpoint_): New data member.
11465         (Output_segment): Update comments.
11466         (Output_segment::Output_segment): Un-privatize copy constructor.
11467         (Output_segment::operator=): Un-privatize.
11468         * script-sections.cc (Output_section_element::Input_section_list):
11469         Change element type to Output_section::Simple_input_section.
11470         (Output_section_element_dot_assignment::set_section_addresses):
11471         Register output section data for relaxation clean up.
11472         (Output_data_exression::Output_data_expression): Adjust call to base
11473         constructor to fix data size.
11474         (Output_section_element_data::set_section_addresses): Register
11475         Output_data_expression object for relaxation clean up.
11476         (struct Input_section_info): Replace Relobj pointer and section index
11477         pair with Output_section::Simple_input_section and Convert struct to a
11478         class.
11479         (Input_section_sorter::operator()): Adjust access to
11480         Input_section_info data member to use accessors.
11481         (Output_section_element_input::set_section_addresses): Use layout
11482         parameter.  Adjust code to use Output_section::Simple_input_section
11483         and Input_secction_info classes.  Register filler for relaxation
11484         clean up.
11485         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11486         and section index pair with Output_section::Simple_input_section
11487         class.  Adjust code accordingly.
11488         (Phdrs_element::release_segment): New method definition.
11489         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11490         segment list.
11491         (Script_sections::release_segments): New method definition.
11492         * gold/script-sections.h (Script_sections::release_segments): New
11493         method declaration.
11494         * gold/target.h (Target::may_relax, Target::relax,
11495         Target::do_may_relax, Target::do_relax): New method definitions.
11496
11497 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11498
11499         * arm.cc (has_signed_unsigned_overflow): New function.
11500         (Arm_relocate_functions::abs8): New function.
11501         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11502         (Target_arm::Scan::global): Likewise.
11503         (Target_arm::relocate::relocate): Likewise.
11504         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11505         Likewise.
11506
11507 2009-09-16  Cary Coutant  <ccoutant@google.com>
11508
11509         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11510         * testsuite/Makefile.in: Regenerate.
11511
11512 2009-09-11  Nick Clifton  <nickc@redhat.com>
11513
11514         * po/gold.pot: Updated by the Translation project.
11515
11516 2009-09-08  Cary Coutant  <ccoutant@google.com>
11517
11518         * output.cc (Output_file::open): Add execute permission to empty file.
11519         * testsuite/Makefile.am (permission_test): New test.
11520         * testsuite/Makefile.in: Regenerate.
11521
11522 2009-09-02  Ian Lance Taylor  <iant@google.com>
11523
11524         * output.cc (Output_file::resize): Call map_no_anonymous rather
11525         than map.
11526
11527 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11528
11529         * gold.cc: Include "incremental.h".
11530         (queue_initial_tasks): Call Incremental_checker methods.
11531         * incremental.cc: Include "output.h".
11532         (Incremental_checker::can_incrementally_link_output_file): New
11533         method.
11534         * incremental.h (Incremental_checker): New class.
11535
11536         * output.cc (Output_file::open_for_modification): New method.
11537         (Output_file::map_anonymous): Changed return type to bool.  Record
11538         map in base_ field.
11539         (Output_file::map_no_anonymous): New method, broken out of map.
11540         (Output_file::map): Use map_no_anonymous and map_anonymous.
11541         * output.h (class Output_file): Update declarations.
11542
11543 2009-08-24  Cary Coutant  <ccoutant@google.com>
11544
11545         * options.h (Command_line::Pre_options): New class.
11546         (Command_line::pre_options): New member.
11547         * options.cc (gold::options::ready_to_register): New variable.
11548         (One_option::register_option): Do nothing if not registering options.
11549         Assert if same short option registered twice.
11550         (General_options::General_options): Turn off option registration when
11551         done constructing.
11552         (Command_line::Pre_options::Pre_options): New constructor.
11553
11554 2009-08-24  Cary Coutant  <ccoutant@google.com>
11555
11556         * options.h (General_options::no_keep_memory): Remove incorrect
11557         short option.
11558
11559 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11560
11561         * Makefile.am (am__skiplex, am__skipyacc): New.
11562         * Makefile.in: Regenerate.
11563
11564 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11565
11566         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11567         (INCLUDES): ... this.
11568         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11569         (AM_CPPFLAGS): Renamed from ...
11570         (INCLUDE): ... this.
11571         * Makefile.in, testsuite/Makefile.in: Regenerate.
11572
11573         * Makefile.in: Regenerate.
11574         * aclocal.m4: Likewise.
11575         * config.in: Likewise.
11576         * configure: Likewise.
11577         * testsuite/Makefile.in: Likewise.
11578
11579         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11580         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11581         * Makefile.in: Regenerate.
11582         * testsuite/Makefile.in: Regenerate.
11583
11584 2009-08-19  Cary Coutant  <ccoutant@google.com>
11585
11586         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11587         symbols in shared libraries overridden by hidden or internal symbols
11588         in the main program.
11589
11590 2009-08-19  Chris Demetriou  <cgd@google.com>
11591
11592         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11593         checking source file names in error messages.
11594
11595 2009-08-18  Doug Kwan  <dougkwan@google.com>
11596
11597         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11598         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11599         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11600         an elfcpp::Ehdr as parameter.
11601         * object.cc (Object::set_target): Remove the version that looks up
11602         a target and sets it.
11603         (Sized_relobj::setup): Take a Target object instead of
11604         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11605         (make_elf_sized_object): Find target and ask target to
11606         make an ELF object.
11607         * object.h: (Object::set_target): Remove the version that looks up
11608         a target and sets it.
11609         (Sized_relobj::setup): Take a Target object instead of
11610         an elfcpp:Ehdr as parameter.
11611         * target.cc: Include dynobj.h.
11612         (Target::do_make_elf_object_implementation): New.
11613         (Target::do_make_elf_object): New.
11614         * target.h (Target::make_elf_object): New template declaration.
11615         (Target::do_make_elf_object): New method declarations.
11616         (Target::do_make_elf_object_implementation): New template declaration.
11617
11618 2009-08-14  Ian Lance Taylor  <iant@google.com>
11619
11620         * gold.h (FUNCTION_NAME): Define.
11621         (gold_unreachable): Use FUNCTION_NAME.
11622
11623 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11624
11625         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11626         symbol in the --keep-unique list is not found.
11627
11628 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11629
11630         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11631         been maked as --keep-unique.
11632         (Icf::unfold_section): New function.
11633         * icf.h (Icf::unfold_section): New function.
11634         * options.h (General_options::keep_unique): New option.
11635         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11636         * testsuite/Makefile.in: Regenerate.
11637         * testsuite/icf_keep_unique_test.sh: New file.
11638         * testsuite/icf_keep_unique_test.cc: New file.
11639
11640 2009-08-12  Cary Coutant  <ccoutant@google.com>
11641
11642         PR 10471
11643         * resolve.cc (Symbol_table::resolve): Check for references from
11644         dynamic objects to hidden and internal symbols.
11645         * testsuite/Makefile.am (hidden_test.sh): New test.
11646         * testsuite/Makefile.in: Regenerate.
11647         * testsuite/hidden_test.sh: New script.
11648         * testsuite/hidden_test_1.c: New test source.
11649         * testsuite/hidden_test_main.c: New test source.
11650
11651 2009-08-11  Doug Kwan  <dougkwan@google.com>
11652
11653         * arm.cc: Update comments.
11654         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11655         segment to locate the .ARM.exidx section if present.
11656
11657 2009-08-09  Doug Kwan  <dougkwan@google.com>
11658
11659         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11660         patch.
11661
11662 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11663         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11664         compiler warnings.
11665
11666 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11667
11668         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11669         valid tls_segment only for non-debug-section relocations.
11670         * testsuite/Makefile.am: Add gc_tls_test.
11671         * testsuite/Makefile.in: Regenerate.
11672         * testsuite/gc_tls_test.cc: New file.
11673         * testsuite/gc_tls_test.sh: New file.
11674
11675 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11676
11677         * icf.cc: New file.
11678         * icf.h: New file.
11679         * Makefile.am (CCFILES): Add icf.cc.
11680         (HFILES): Add icf.h
11681         * Makefile.in: Regenerate.
11682         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11683         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11684         section, symbol and addend information for the relocs.
11685         * gold.cc (queue_middle_tasks): Call identical code folding.
11686         * gold.h: Add defines for multimap.
11687         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11688         to the call of finalize_local_symbols.
11689         * main.cc (main): Create object of class Icf.
11690         * object.cc (Sized_relobj::do_layout): Allow this function to be
11691         called twice during icf.
11692         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11693         to sections marked as identical by icf.
11694         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11695         when available.
11696         (Sized_relobj::do_section_entsize): New function.
11697         * object.h (Object::section_entsize): New function.
11698         (Object::do_section_entsize): New pure virtual function.
11699         (Relobj::finalize_local_symbols): Add new parameter.
11700         (Relobj::do_section_entsize): New function.
11701         * options.h (General_options::icf): New option.
11702         (General_options::icf_iterations): New option.
11703         (General_options::print_icf_sections): New option.
11704         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11705         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11706         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11707         icf.
11708         * symtab.cc (Symbol_table::is_section_folded): New function.
11709         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11710         to sections marked as identical by icf.
11711         * symtab.h (Symbol_table::set_icf): New function.
11712         (Symbol_table::icf): New function.
11713         (Symbol_table::is_section_folded): New function.
11714         (Symbol_table::icf_): New data member.
11715         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11716         * testsuite/Makefile.am: Add commands to build icf_test.
11717         * testsuite/Makefile.in: Regenerate.
11718         * testsuite/icf_test.sh: New file.
11719         * testsuite/icf_test.cc: New file.
11720
11721 2009-07-24  Chris Demetriou  <cgd@google.com>
11722
11723         * layout.cc (is_compressible_debug_section): Fix incorrect
11724         comment about compressed section names.
11725
11726 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11727
11728         PR 10419
11729         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11730
11731 2009-07-16  Ian Lance Taylor  <iant@google.com>
11732
11733         PR 10400
11734         * layout.h: #include <map>.
11735         (class Kept_section): Change from struct to class.  Add accessors
11736         and setters.  Add section size to Comdat_group mapping.  Change
11737         Comdat_group to std::map.  Add is_comdat_ field.  Add
11738         linkonce_size field in union.
11739         (class Layout): Update declaration of find_or_add_kept_section.
11740         Don't declare find_kept_object.
11741         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11742         parameter.  Add object, shndx, is_comdat, and is_group_name
11743         parameters.  Change all callers.  Adjust for new Kept_section.
11744         (Layout::find_kept_object): Remove.
11745         * object.cc (Sized_relobj::include_section_group): Update use of
11746         Kept_section.  Rename secnum to shndx.  Only record
11747         Kept_comdat_section if sections are the same size.
11748         (Sized_relobj::include_linkonce_section): Update use of
11749         Kept_section.  Only record Kept_comdat_section if sections are the
11750         same size.  Set size of linkonce section.
11751         (Sized_relobj::map_to_kept_section): Update call to
11752         get_kept_comdat_section.
11753         * object.h (class Sized_relobj): Rename fields in
11754         Kept_comdat_section to drop trailing underscores; change object
11755         field to Relobj*.  Change Kept_comdat_section_table to store
11756         struct rather than pointer.
11757         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11758         Add kept_object and kept_shndx parameters.  Change all callers.
11759         (Sized_relobj::get_kept_comdat_section): Change return type to
11760         bool.  Add kept_object and kept_shndx parameters.  Change all
11761         callers.
11762         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11763         Layout::find_or_add_kept_section.
11764
11765 2009-07-09  Ian Lance Taylor  <iant@google.com>
11766
11767         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11768         Reserve space in the hash table.
11769
11770 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11771
11772         * fileread.cc (File_read::get_mtime): New method.
11773         * fileread.h (Timespec): New structure.
11774         (File_read::get_mtime): New method.
11775         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11776         Renamed from timestamp_nsec.
11777         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11778         Elf_Xword.
11779         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11780         timestamp_nsec.
11781         (Incremental_inputs::report_archive): Save mtime; style fix.
11782         (Incremental_inputs::report_obejct): Save mtime; style fix.
11783         (Incremental_inputs::report_script): Save mtime; style fix.
11784         (Incremental_inputs::finalize_inputs): Style fix.
11785         (Incremental_inputs::finalize): Style fix.
11786         (Incremental_inputs::create_input_section_data): Store inputs
11787         mtime.
11788         * incremental.h (Incremental_inputs::report_script): Add mtime
11789         argument.
11790         (Incremental_inputs::Input_info::Input_info): Intialize only one
11791         union member.
11792         (Incremental_inputs::Input_info::archive): Move to nameless
11793         union.
11794         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11795         (Incremental_inputs::Input_info::script): Move to nameless union.
11796         (Incremental_inputs::mtime): New field.
11797         * script.cc (read_input_script): Pass file mtime to
11798         Incremental_input.
11799         * script.h (Script_info::inputs): Style fix.
11800
11801 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11802
11803         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11804         instead of 32.
11805
11806 2009-06-24  Ian Lance Taylor  <iant@google.com>
11807
11808         PR 10156
11809         * layout.cc (Layout::choose_output_section): If we find an
11810         existing section, update the flags.
11811         (Layout::create_notes): New function, broken out of
11812         Layout::finalize.
11813         (Layout::finalize): Don't create note sections.
11814         (Layout::create_note): Don't crash if linker script discards
11815         section.
11816         (Layout::create_gold_note): Likewise.
11817         (Layout::create_build_id): Likewise.  Don't set
11818         after_input_sections on the section.
11819         (Layout::create_executable_stack_info): Remove target parameter.
11820         Change caller.
11821         * layout.h (class Layout): Declare create_notes.  Update
11822         declaration of create_executable_stack_info.
11823         * gold.cc (queue_middle_tasks): Call create_notes.
11824         * output.cc (Output_section::update_flags_for_input_section): Move
11825         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11826         invalid.
11827         * output.h (Output_data::mark_address_invalid): New function.
11828         (class Output_section): Only declare, not define,
11829         update_flags_for_input_section.  Remove set_flags.
11830
11831 2009-06-24  Ian Lance Taylor  <iant@google.com>
11832
11833         * script-sections.cc (Output_section_definition::
11834         set_section_addresses): Rename shadowing local load_address to
11835         laddr.
11836
11837 2009-06-24  Ian Lance Taylor  <iant@google.com>
11838
11839         PR 10244
11840         * reloc.cc (relocate_sections): Skip empty relocation sections.
11841
11842 2009-06-23  Ian Lance Taylor  <iant@google.com>
11843
11844         PR 10156
11845         * layout.cc (Layout::create_note): Use choose_output_section
11846         rather than make_output_section.
11847
11848 2009-06-23  Ian Lance Taylor  <iant@google.com>
11849
11850         PR 10237
11851         * options.cc (General_options::parse_V): Set printed_version_.
11852         (General_options::General_options): Initialize printed_version_.
11853         * options.h (class General_options): Add printed_version_ field.
11854         * gold.cc (queue_initial_tasks): If there are no input files,
11855         don't give a fatal error if we printed the version information.
11856         (queue_middle_tasks): If using -r with a shared object, give a
11857         fatal error rather than an ordinary error.
11858
11859 2009-06-23  Ian Lance Taylor  <iant@google.com>
11860
11861         PR 10219
11862         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11863         (Layout::make_output_section): Set have_stabstr_section_ if we see
11864         a .stab*str section.
11865         (Layout::finalize): Call link_stabs_sections.
11866         (Layout::link_stabs_sections): New file.
11867         * layout.h (class Layout): Add have_stabstr_section_ field.
11868         Declare link_stabs_sections.
11869
11870 2009-06-23  Doug Kwan  <dougkwan@google.com>
11871
11872         * Makefile.am (libgold_a_LIBADD): New.
11873         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11874         * Makefile.in: Regenerate.
11875         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11876         * configure: Regenerate.
11877         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11878         * fileread.cc: Include sys/state.h
11879         * gold.h: Declare memmem and strndup if found missing.
11880         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11881
11882 2009-06-23  Ian Lance Taylor  <iant@google.com>
11883
11884         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11885         * configure: Rebuild.
11886
11887 2009-06-23  Ian Lance Taylor  <iant@google.com>
11888
11889         PR 10147
11890         * object.cc (Object::section_contents): Don't try to get a view if
11891         the section has length zero.
11892         (Object::handle_gnu_warning_section): If the section is empty, use
11893         the name of the section as the warning.
11894
11895 2009-06-23  Ian Lance Taylor  <iant@google.com>
11896
11897         PR 10133
11898         * stringpool.h (class Stringpool_template): Add optimize_ field.
11899         (Stringpool_template::set_optimize): New function.
11900         * stringpool.cc (Stringpool_template::Stringpool_template):
11901         Initialize optimize_ field.
11902         (Stringpool_template::set_string_offsets): Test local optimize
11903         fild rather than parameter.
11904         * layout.cc (Layout::Layout): Call set_optimize on the section
11905         name stringpool.
11906
11907 2009-06-22  Ian Lance Taylor  <iant@google.com>
11908
11909         PR 10030
11910         * yyscript.y: Parse TARGET.
11911         * script.cc (script_set_target): New function.
11912         * script-c.h (script_set_target): Declare.
11913         * options.cc (General_options::string_to_object_format): Rename
11914         from string_to_object_format in anonymous namespace.  Change
11915         callers.
11916         * options.h (class General_options): Declare
11917         string_to_object_format.
11918
11919 2009-06-22  Ian Lance Taylor  <iant@google.com>
11920
11921         * script-sections.cc (Script_sections::create_segments): Don't put
11922         program headers in a PT_LOAD segment if -n or -N.
11923
11924 2009-06-22  Ian Lance Taylor  <iant@google.com>
11925
11926         PR 10141
11927         * options.h (class General_options): Add -z lazy and -z now.  Sort
11928         -z options into alphabetical order.
11929         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11930
11931 2009-06-21  Ian Lance Taylor  <iant@google.com>
11932
11933         * layout.cc (Layout::make_output_section): Call
11934         Target::new_output_section.
11935         (Layout::attach_allocated_section_to_segment): Put large section
11936         sections in a separate load segment with the large segment flag
11937         set.
11938         (Layout::segment_precedes): Sort large data segments after other
11939         load segments.
11940         (align_file_offset): New static function.
11941         (Layout::set_segment_offsets): Use align_file_offset.
11942         * output.h (class Output_section): Add is_small_section_ and
11943         is_large_section_ fields.
11944         (Output_section::is_small_section): New function.
11945         (Output_section::set_is_small_section):  New function.
11946         (Output_section::is_large_section): New function.
11947         (Output_section::set_is_large_section): New function.
11948         (Output_section::is_large_data_section): New function.
11949         (class Output_segment): Add is_large_data_segment_ field.
11950         (Output_segment::is_large_data_segment): New function.
11951         (Output_segment::set_is_large_data_segment): New function.
11952         * output.cc (Output_section::Output_section): Initialize new
11953         fields.
11954         (Output_segment::Output_segment): Likewise.
11955         (Output_segment::add_output_section): Add assertion that large
11956         data sections always go in large data segments.  Force small data
11957         sections to the end of the list of data sections.  Force small BSS
11958         sections to the start of the list of BSS sections.  For large BSS
11959         sections to the end of the list of BSS sections.
11960         * symtab.h (class Symbol): Declare is_common_shndx.
11961         (Symbol::is_defined): Check Symbol::is_common_shndx.
11962         (Symbol::is_common): Likewise.
11963         (class Symbol_table): Define enum Commons_section_type.  Update
11964         declarations.  Add small_commons_ and large_commons_ fields.
11965         * symtab.cc (Symbol::is_common_shndx): New function.
11966         (Symbol_table::Symbol_table): Initialize new fields.
11967         (Symbol_table::add_from_object): Put small and large common
11968         symbols in the right list.
11969         (Symbol_table::sized_finalized_symbol): Check
11970         Symbol::is_common_shndx.
11971         (Symbol_table::sized_write_globals): Likewise.
11972         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11973         common symbol lists.  Don't call do_allocate_commons_list if the
11974         list is empty.
11975         (Symbol_table::do_allocate_commons_list): Remove is_tls
11976         parameter.  Add comons_section_type parameter.  Change all
11977         callers.  Handle small and large common symbols.
11978         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11979         Symbol::is_common_shndx.
11980         * resolve.cc (symbol_to_bits): Likewise.
11981         * target.h (Target::small_common_shndx): New function.
11982         (Target::small_common_section_flags): New function.
11983         (Target::large_common_shndx): New function.
11984         (Target::large_common_section_flags): New function.
11985         (Target::new_output_section): New function.
11986         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11987         small_common_section_flags, and large_common_section_flags
11988         fields.
11989         (Target::do_new_output_section): New virtual function.
11990         * arm.cc (Target_arm::arm_info): Initialize new fields.
11991         * i386.cc (Target_i386::i386_info): Likewise.
11992         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11993         Likewise.
11994         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11995         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11996         (Target_x86_64::do_new_output_section): New function.
11997         * configure.ac: Define conditional MCMODEL_MEDIUM.
11998         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11999         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12000         (large_LDFLAGS): Define.
12001         * testsuite/large.c: New file.
12002         * testsuite/testfile.cc (Target_test::test_target_info):
12003         Initialize new fields.
12004         * configure, testsuite/Makefile.in: Rebuild.
12005
12006 2009-06-05  Doug Kwan  <dougkwan@google.com>
12007
12008         * Makefile.am (CCFILES): Add target.cc.
12009         * Makefile.in: Regenerate.
12010         * i386.cc (class Target_i386): Define new virtual method to
12011         override do_is_local_label_name in parent.
12012         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12013         local symbols if --discard-locals or -X is given.
12014         * options.h (class General_options): Declare new options
12015         '--discard-locals' and '-X' for discarding locals.
12016         * target.h (class Target): Define new methods is_local_label_name.
12017         Declare new virtual method do_is_local_label_name.
12018         * target.cc: New file.
12019         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12020         (check_SCRIPTS): Add discard_locals_test.sh.
12021         (check_DATA): Add discard_local_tests.syms.
12022         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12023         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12024         * testsuite/Makefile.in: Regenerate.
12025         * testsuite/discard_locals_test.c: New file.
12026         * testsuite/discard_locals_test.sh: Same.
12027
12028 2009-06-05  Doug Kwan  <dougkwan@google.com>
12029
12030         * object.cc (Sized_relobj::Sized_relobj): Initialize
12031         discarded_eh_frame_shndx_ to -1U.
12032         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12033         section.
12034         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12035         a discarded .eh_frame section.
12036         (Sized_relobj::do_finalize_local_symbols): Ditto.
12037         * object.h (class Sized_relobj): Declare new member
12038         discarded_eh_frame_shndx_.
12039         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12040         (local_labels_test.o, local_labels_test): New rules.
12041         * testsuite/Makefile.in: Regenerate.
12042
12043 2009-06-04  Doug Kwan  <dougkwan@google.com>
12044
12045         * layout.cc (Layout::section_name_mapping): Add mapping for
12046         special ARM sections.
12047
12048 2009-06-03  Doug Kwan  <dougkwan@google.com>
12049
12050         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12051         (utils::has_overflow): Same.
12052
12053 2009-06-03  Ian Lance Taylor  <iant@google.com>
12054
12055         * layout.cc (Layout::section_name_mapping): New array, replacing
12056         Layout::linkonce_mapping.
12057         (Layout::section_name_mapping_count): New variable, replacing
12058         Layout::linkonce_mapping_count.
12059         (Layout::linkonce_output_name): Remove.
12060         (Layout::output_section_name): Rewrite.
12061         * layout.h (class Layout): Rename Linkonce_mapping to
12062         Section_name_mapping, linkonce_mapping to section_name_mapping,
12063         linkonce_mapping_count to section_name_mapping_count.  Don't
12064         declare linkonce_output_name.
12065
12066 2009-06-03  Doug Kwan  <dougkwan@google.com>
12067
12068         * gold/arm.cc (namespace utils): New.
12069         (Target_arm::reloc_is_non_pic): Define new method.
12070         (class Arm_relocate_functions): New.
12071         (Target_arm::Relocate::relocate): Handle relocation types used by
12072         Android.
12073
12074 2009-06-03  Ian Lance Taylor  <iant@google.com>
12075
12076         * arm.cc (Target_arm::scan::global): Use || instead of |.
12077
12078 2009-06-02  Doug Kwan  <dougkwan@google.com>
12079
12080         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12081         issued_non_pic_error_.
12082         (class Target_arm::Scan): Declare new method check_non_pic.
12083         Define new method symbol_needs_plt_entry.
12084         Declare new data member issued_non_pic_error_.
12085         (class Target_arm::Relocate): Declare new method
12086         should_apply_static_reloc.
12087         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12088         (Target_arm::Scan::check_non_pic): Define new method.
12089         (Target_arm::Scan::local): Handle a small subset of reloc types used
12090         by Android.
12091         (Target_arm::Scan::local): Same.
12092         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12093
12094 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12095
12096         * incremental.cc (Incremental_inputs::report_command_line): Filter
12097         out --incremental-* options.
12098
12099 2009-05-29  Doug Kwan  <dougkwan@google.com>
12100
12101         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12102         template class.
12103         (class Target_arm): Update comment.
12104         (Target_arm::Target_arm): Initialize new data members GOT_,
12105         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12106         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12107         and Target_arm::rel_dyn_section.
12108         Declare new_enum Target_arm::Got_type.
12109         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12110         and DYNBSS_.
12111         Update commments for member do_dynsym_value.
12112         (Target_arm::got_size, Target_arm::plt_section,
12113         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12114         new methods inside class defintion.
12115         (Target_arm::got_section): Define new method.
12116         (Target_arm::rel_dyn_section): Same.
12117         (Output_data_plt_arm): New template class.
12118         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12119         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12120         (Output_data_plt_arm::add_entry): Same.
12121         (Output_data_plt_arm::first_plt_entry): Define new
12122         static data member for PLT instruction template.
12123         (Output_data_plt_arm::plt_entry): Same.
12124         (Output_data_plt_arm::do_write): Define new method.
12125         (Target_arm::make_plt_entry): Same.
12126         (Target_arm::do_finalize_sections): Same.
12127         (Target_arm::do_dynsym_value): Same.
12128
12129 2009-05-28  Doug Kwan  <dougkwan@google.com>
12130
12131         * Makefile.am (TARGETSOURCES): Add arm.cc.
12132         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12133         * Makefile.in: Regenerate.
12134         * arm.cc: New file.
12135         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12136
12137 2009-05-26  Doug Kwan  <dougkwan@google.com>
12138
12139         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12140         (General_options::check_excluded_libs): Strip off directories in
12141         archive name before matching like GNU ld does.
12142         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12143         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12144         (exclude_libs_test_LDFLAGS): Add linker option
12145         -Wl,--exclude-libs,libexclude_libs_test_3
12146         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12147         an explicit archive without using -l.
12148         (alt/libexclude_libs_test_3.a): New make rule.
12149         * testsuite/Makefile.in: Regenerate.
12150         * testsuite/exclude_libs_test.c : Declare lib3_default().
12151         (main): Call it.
12152         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12153         * exclude_libs_test_3.c: New file.
12154
12155 2009-05-26  Nick Clifton  <nickc@redhat.com>
12156
12157         * po/id.po: New Indonesian translation.
12158         * po/gold.pot: Updated template file.
12159
12160 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12161
12162         * testsuite/Makefile.am: Add -ffunction-sections to compile
12163         gc_comdat_test files.  Add -Wl,--gc-sections to build
12164         gc_comdat_test.
12165         * testsuite/Makefile.in: Regenerate.
12166         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12167
12168 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12169
12170         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12171         kept comdat section was garbage collected.
12172         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12173         * testsuite/Makefile.in: Regenerate.
12174         * testsuite/gc_comdat_test.sh: New file.
12175         * testsuite/gc_comdat_test_1.cc: New file.
12176         * testsuite/gc_comdat_test_2.cc: New file.
12177
12178 2009-05-19  Doug Kwan  <dougkwan@google.com>
12179
12180         * archive.cc (Archive::Archive): Move constructor from archive.h
12181         to here.  Initialize no_export_.
12182         (Archive::get_elf_object_for_member): Set no_export flag of object.
12183         * archive.h (Archive::Archive): Move constructor body to
12184         archive.cc.
12185         (Archive::no_export): New method.
12186         (Archive::no_export_): New field.
12187         * object.h (Object::Object): Initialize no_export_ to false.
12188         (Object::no_export, Object::set_no_export): New methods.
12189         (Object::no_export_): New field.
12190         * options.cc (General_options::parse_exclude_libs): New method.
12191         (General_options::check_excluded_libs) Same.
12192         * options.h (exclude_libs): New option.
12193         (General_options::check_excluded_libs): New method declaration.
12194         (General_options::excluded_libs_): New field.
12195         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12196         default or protected visibility if an object has no-export flag set.
12197         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12198         (check_SCRIPTS): Add exclude_libs_test.sh.
12199         (check_DATA): Add exclude_libs_test.syms.
12200         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12201         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12202         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12203         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12204         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12205         libexclude_libs_test_2.a): New rules.
12206         * testsuite/Makefile.in: Regenerate.
12207         * testsuite/exclude_libs_test.c: New file.
12208         * testsuite/exclude_libs_test.sh: Ditto.
12209         * testsuite/exclude_libs_test_1.c: Ditto.
12210         * testsuite/exclude_libs_test_2.c: Ditto.
12211
12212 2009-05-15  Ian Lance Taylor  <iant@google.com>
12213
12214         * configure.ac: Check for declarations for cases where libiberty.h
12215         checks HAVE_DECL_xxx.
12216         * configure, config.in: Rebuild.
12217
12218 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12219
12220         * gold.h (Incremental_argument_list): Remove (invalid) forward
12221         declaration.
12222         * incremental.cc (Incremental_inputs::report_achive): New method.
12223         (Incremental_inputs::report_object): New method.
12224         (Incremental_inputs::report_script): New method.
12225         (Incremental_inputs::finalize_inputs): New method.
12226         (Incremental_inputs::finalize): Call finalize_inputs().
12227         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12228         Create inputs entries.
12229         * incremental.h (Incremental_input_type): New enum.
12230         (Incremental_inputs::Incremental_input): Initialize new fields.
12231         (Incremental_inputs::report_inputs): New method.
12232         (Incremental_inputs::report_achive): New method.
12233         (Incremental_inputs::report_object): New method.
12234         (Incremental_inputs::report_script): New method.
12235         (Incremental_inputs::finalize_inputs): New method.
12236         (Incremental_inputs::Input_info): New struct.
12237         (Incremental_inputs::Input_info_map): New typedef.
12238         (Incremental_inputs::lock_): New field.
12239         (Incremental_inputs::Inputs_): New field.
12240         (Incremental_inputs::Inputs_map): New field.
12241         * main.cc (main): Call Incremental_input::report_inputs.
12242         * options.h (Input_argument_list): Typedef moved from
12243         Input_arguments.
12244         (Input_file_group::Files): Remove, use ::Input_argument_list.
12245         (Input_file_group::Input_argument_list): Remove, use
12246         ::Input_argument_list.
12247         * plugin.cc (Plugin_manager::add_input_file): Add error in
12248         incremental build.
12249         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12250         functions.
12251         * script.cc (read_input_script): Call
12252         Incremental_input::report_script.
12253         * script.h (Script_info): New class.
12254
12255 2009-04-27  Ian Lance Taylor  <iant@google.com>
12256
12257         * x86_64.cc (do_adjust_output_section): Set entsize to
12258         plt_entry_size.
12259
12260 2009-04-23  Elliott Hughes  <enh@google.com>
12261
12262         * output.cc (Output_file::close): After short writes, continue
12263         writing from the correct offset in the buffer being written.
12264
12265 2009-04-23  Chris Demetriou  <cgd@google.com>
12266
12267         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12268         * configure: Regenerate.
12269         * config.in: Regenerate.
12270         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12271         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12272
12273 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12274
12275         * incremental.cc (Incremental_inputs_header_data): Renamed from
12276         Incremental_input_header_data.
12277         (Incremental_inputs_header_data::data_size): New field.
12278         (Incremental_inputs_header_data::put_input_file_count): Renamed
12279         from input_file_count.
12280         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12281         from command_line_offset.
12282         (Incremental_inputs_header_data::put_reserved): Renamed from
12283         put_reserved.
12284         (Incremental_inputs_entry_data): Renamed from
12285         Incremental_input_entry_data.
12286         (Incremental_inputs_entry_data::data_size): New field.
12287         (Incremental_inputs::report_command_line): New method.
12288         (Incremental_inputs::finalize): New method.
12289         (Incremental_inputs::create_incremental_inputs_data): New method.
12290         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12291         * incremental.h: New file.
12292         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12293         (Layout::finalize): Create incremental inputs section in
12294         incremental builds.
12295         (Layout::create_incremental_info_sections): New method.
12296         * layout.h (Layout::incremental_inputs): New method.
12297         (Layout::create_incremental_info_sections): New method.
12298         (Layout::incremental_inputs_): New field.
12299         * main.cc (main): Notify Incremental_input of the command line.
12300
12301 2009-04-01  Ian Lance Taylor  <iant@google.com>
12302             Mikolaj Zalewski  <mikolajz@google.com>
12303
12304         * gold.h (reserve_unordered_map): Define, three versions, one for
12305         each version of Unordered_map.
12306         * layout.cc (Layout::Layout): Remove options parameter.  Add
12307         number_of_input_files parameter.  Don't initialize options_.
12308         Initialize number_of_input_files_ and resized_signatures_.  Move
12309         sections_are_attached_.
12310         (Layout::layout_group): Reserve space for group_signatures_.
12311         (Layout::find_or_add_kept_section): Change name parameter to be a
12312         reference.  Resize signatures_ map when it gets large enough.
12313         (Layout::layout_eh_frame): Use parameters->options() instead of
12314         this->options_.
12315         (Layout::make_output_section): Likewise.
12316         (Layout::attach_allocated_section_to_segment): Likewise.
12317         (Layout::finalize, Layout::create_executable_stack): Likewise.
12318         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12319         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12320         * layout.h (class Layout): Update declarations.  Remove options_
12321         field.  Add number_of_input_files_ and resized_signatures_
12322         fields.  Move sections_are_attached_ field.
12323         * main.cc (main): Pass number of input files to Layout
12324         constructor.  Don't pass options.
12325
12326 2009-03-30  Ian Lance Taylor  <iant@google.com>
12327
12328         * ffsll.c (ffsll): Correct implementation.
12329
12330 2009-03-27  Ian Lance Taylor  <iant@google.com>
12331
12332         * ffsll.c: New file.
12333         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12334         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12335         * ftruncate.c (ftruncate): Declare before definition.
12336         * mremap.c (mremap): Likewise.
12337         * pread.c (pread): Likewise.
12338         * configure, Makefile.in, config.in: Rebuild.
12339
12340         * mremap.c: New file.
12341         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12342         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12343         (mremap): Declare if HAVE_MREMAP is not defined.
12344         * configure, Makefile.in, config.in: Rebuild.
12345
12346 2009-03-27  Cary Coutant  <ccoutant@google.com>
12347
12348         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12349         position independent.
12350         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12351         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12352
12353 2009-03-24  Cary Coutant  <ccoutant@google.com>
12354
12355         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12356         an executable.
12357         (needs_dynamic_reloc): Likewise.
12358
12359 2009-03-24  Ian Lance Taylor  <iant@google.com>
12360
12361         * yyscript.y (file_cmd): Recognize EXTERN.
12362         (extern_name_list, extern_name_list_body): New nonterminals.
12363         * script.cc (script_add_extern): Define.
12364         * script-c.h (script_add_extern): Declare.
12365
12366 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12367
12368         * object.cc (is_elf_object): Define.
12369         * object.h (is_elf_object): Declare.
12370         * archive.cc (Archive::get_elf_object_for_member): Call
12371         is_elf_object.
12372         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12373
12374 2009-03-24  Elliott Hughes  <enh@google.com>
12375
12376         * output.cc (Output_file::map_anonymous): Define.
12377         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12378         try an anonymous one.  Report the size if the mmap fails.
12379         * output.h (class Output_file): Declare map_anonymous.
12380
12381 2009-03-24  Ian Lance Taylor  <iant@google.com>
12382
12383         * target-select.cc (instantiate_target): Don't acquire the lock if
12384         the instantiated_target_ field has already been set.
12385
12386 2009-03-23  Ian Lance Taylor  <iant@google.com>
12387
12388         * gold-threads.h (class Initialize_lock): Define.
12389         * gold-threads.cc (class Initialize_lock_once): Define.
12390         (initialize_lock_control): New static variable.
12391         (initialize_lock_pointer): New static variable.
12392         (initialize_lock_once): New static function.
12393         (Initialize_lock::Initialize_lock): Define.
12394         (Initialize_lock::initialize): Define.
12395         * target-select.h: Include "gold-threads.h".
12396         (class Target_selector): Add lock_ and initialize_lock_ fields.
12397         Don't define instantiate_target, just declare it.
12398         * target-select.cc (Target_selector::Target_selector): Initialize
12399         new fields.
12400         (Target_selector::instantiate_target): Define.
12401         * descriptors.h: Include "gold-threads.h".
12402         (class Descriptors): Add initialize_lock_ field.
12403         * descriptors.cc (Descriptors::Descriptors): Initialize new
12404         field.
12405         (Descriptors::open): Use initialize_lock_ field
12406         * errors.h (class Errors): Add initialize_lock_ field.
12407         * errors.cc (Errors::Errors): Initialize new field.
12408         (Errors::initialize_lock): Use initialize_lock_ field.
12409         * powerpc.cc (class Target_selector_powerpc): Remove
12410         instantiated_target_ field.  In do_recognize call
12411         instantiate_target rather than do_instantiate_target.  In
12412         do_instantiate_target just allocate a new target.
12413         * sparc.cc (class Target_selector_sparc): Likewise.
12414
12415         * freebsd.h: New file.
12416         * i386.cc: Include "freebsd.h".
12417         (Target_i386): Derive from Target_freebsd rather than
12418         Sized_target.
12419         (Target_selector_i386): Derive from Target_selector_freebsd rather
12420         than Target_selector.
12421         * x86_64.cc: Include "freebsd.h".
12422         (Target_x86_64): Derive from Target_freebsd rather than
12423         Sized_target.
12424         (Target_selector_x86_64): Derive from Target_selector_freebsd
12425         rather than Target_selector.
12426         * target.h (class Target): Add adjust_elf_header and
12427         do_adjust_elf_header.
12428         * output.cc (Output_file_header:: do_sized_write): Call target
12429         adjust_elf_header routine.
12430         * configure.tgt: Set targ_osabi.
12431         * configure.ac: Define GOLD_DEFAULT_OSABI.
12432         * parameters.cc (Parameters::default_target): Pass
12433         GOLD_DEFAULT_OSABI to select_target.
12434         * target-select.h (class Target_selector): Make instantiate_target
12435         protected rather than private.
12436         * Makefile.am (HFILES): Add freebsd.h.
12437         * configure, Makefile.in, config.in: Rebuild.
12438
12439         * merge.cc (do_add_input_section): Correct pend value.  Change
12440         message about last entry not being null terminated from error to
12441         warning.
12442
12443 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12444
12445         * incremental.cc: New file.
12446         * Makefile.am (CCFILES): Add incremental.cc.
12447         * Makefile.in: Rebuild.
12448
12449 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12450
12451         * layout.cc (Layout::output_section_name): Preserve names
12452         of '.note.' sections.
12453
12454 2009-03-19  Ian Lance Taylor  <iant@google.com>
12455
12456         * descriptors.cc (Descriptors::open): Check that the options are
12457         valid before using them.
12458
12459 2009-03-18  Ian Lance Taylor  <iant@google.com>
12460
12461         * script-sections.h: Include <list>.
12462         (class Script_sections): Change Sections_elements from std::vector
12463         to std::list.  Typedef public Elements_iterator.  Add
12464         orphan_section_placement_, data_segment_align_start_, and
12465         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12466         field.
12467         * script-sections.cc (class Orphan_section_placement): New class.
12468         (class Sections_element): Add virtual functions is_relro and
12469         orphan_section_init.  Remove virtual function place_orphan_here.
12470         (class Output_section_definition): Add is_relro and
12471         orphan_section_init.  Remove place_orphan_here.
12472         (class Orphan_output_section): Likewise.
12473         (Script_sections::Script_sections): Update for field changes.
12474         (Script_sections::data_segment_align): Set saw_data_segment_align_
12475         and data_segment_align_start_, not data_segment_align_index.
12476         (Script_sections::data_segment_relro_end): Check
12477         saw_data_segment_align_.  Use data_segment_align_start_ rather
12478         than data_segment_align_index_.
12479         (Script_sections::place_orphan): Rewrite to use
12480         Orphan_section_placement.
12481
12482 2009-03-17  Ian Lance Taylor  <iant@google.com>
12483
12484         * archive.cc (Archive::add_symbols): Check for a version attached
12485         to the symbol name in the archive map.
12486         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12487         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12488         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12489         (ver_test_11.a): New target.
12490         * testsuite/Makefile.in: Rebuild.
12491
12492         * configure.ac: Check for chsize and posix_fallocate.  Replace
12493         ftruncate.
12494         * ftruncate.c: New file, from gnulib.
12495         * output.cc (posix_fallocate): Define dummy version if not
12496         HAVE_POSIX_FALLOCATE.
12497         (Output_file::map): Call posix_fallocate rather than lseek and
12498         write.
12499         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12500         * configure, Makefile.in, config.in: Rebuild.
12501
12502 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12503
12504         * layout.h (Layout::create_note): Add section_name parameter.
12505         * layout.cc (Layout::create_note): Likewise.
12506         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12507
12508 2009-03-17  Ian Lance Taylor  <iant@google.com>
12509
12510         * descriptors.cc: Include "options.h".
12511         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12512         (Descriptors::open): Always use O_CLOEXEC when opening a new
12513         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12514         then set FD_CLOEXEC.
12515
12516         * sparc.cc (class Target_sparc): Add has_got_section.
12517         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12518         make sure we have a GOT section.
12519
12520         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12521         (Target_sparc::Scan::local): Likewise.
12522         (Target_sparc::Scan::global): Likewise.
12523         (Target_sparc::Relocate::relocate): Likewise.
12524         (Target_sparc::Relocate::relocate_tls): Likewise.
12525
12526         * symtab.cc (Symbol_table::define_default_version): New function,
12527         broken out of add_from_object.
12528         (Symbol_table::add_from_object): Call define_default_version.
12529         (Symbol_table::define_special_symbol): Add resolve_oldsym
12530         parameter.  Change all callers.  If the version for a symbol comes
12531         from a version script, resolve it with the symbol with the same
12532         name with no version.  Also add the symbol without a version if
12533         appropriate.
12534         (do_define_in_output_data): If resolving with oldsym, don't delete
12535         sym.
12536         (do_define_in_output_segment): Likewise.
12537         (do_define_as_constant): Likewise.
12538         * symtab.h (class Symbol_table): Update declarations.
12539
12540 2009-03-13  Ian Lance Taylor  <iant@google.com>
12541
12542         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12543         (Read_symbols::requeue): New function.
12544         (Read_symbols::do_read_symbols): If make_elf_object fails because
12545         the target type is not configured, and the file was searched for,
12546         issue a warning and retry with the next directory.
12547         (Add_symbols::run): If the file has an incompatible format, and
12548         it was searched for, requeue the Read_symbols task.  On error,
12549         release the object.
12550         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12551         dirindex parameter to constructor.  Change all callers.  Declare
12552         incompatible_warning and requeue.
12553         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12554         input_argument_ and input_group_ fields.  Add them to
12555         constructor.  Change all callers.
12556         (class Read_script): Add dirindex_ field.  Add it to constructor.
12557         Change all callers.
12558         * archive.cc (Archive::setup): Remove input_objects parameter.
12559         Change all callers.
12560         (Archive::get_file_and_offset): Likewise.
12561         (Archive::read_all_symbols): Likewise.
12562         (Archive::read_symbols): Likewise.
12563         (Archive::get_elf_object_for_member): Remove input_objects
12564         parameter.  Add punconfigured parameter.  Change all callers.
12565         (Archive::add_symbols): Change return type to bool.  Check return
12566         value of include_member.
12567         (Archive::include_all_members): Likewise.
12568         (Archive::include_member): Change return type to bool.  Return
12569         false if first included object has incompatible target.  Set
12570         included_member_ field.
12571         (Add_archive_symbols::run): If add_symbols returns false, requeue
12572         Read_symbols task.
12573         * archive.h (class Archive): Add included_member_ field.
12574         Initialize it in constructor.  Add input_file and searched_for
12575         methods.  Update declarations.
12576         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12577         input_argument_ fields.  Add them to constructor.  Change all
12578         callers.
12579         * script.cc: Include "target-select.h".
12580         (class Parser_closure): Add skip_on_incompatible_target_ and
12581         found_incompatible_target_ fields.  Add
12582         skip_on_incompatible_target parameter to constructor.  Change all
12583         callers.  Add methods skip_on_incompatible_target,
12584         clear_skip_on_incompatible_target, found_incompatible_target, and
12585         set_found_incompatible_target.
12586         (read_input_script): Add dirindex parameter.  Change all callers.
12587         If parser finds an incompatible target, requeue Read_symbols
12588         task.
12589         (script_set_symbol): Clear skip_on_incompatible_target in
12590         closure.
12591         (script_add_assertion, script_parse_option): Likewise.
12592         (script_start_sections, script_add_phdr): Likewise.
12593         (script_check_output_format): New function.
12594         * script.h (read_input_script): Update declaration.
12595         * script-c.h (script_check_output_format): Declare.
12596         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12597         (ignore_cmd): Remove OUTPUT_FORMAT.
12598         * fileread.cc (Input_file::Input_file): Add explicit this.
12599         (Input_file::will_search_for): New function.
12600         (Input_file::open): Add pindex parameter.  Change all callers.
12601         * fileread.h (class Input_file): Add input_file_argument method.
12602         Declare will_search_for.  Update declarations.
12603         * object.cc (make_elf_object): Add punconfigured parameter.
12604         Change all callers.
12605         * object.h (class Object): Make input_file public.  Add
12606         searched_for method.
12607         (make_elf_object): Update declaration.
12608         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12609         restart search.
12610         * dirsearch.h (class Dirsearch): Update declaration.
12611         * options.h (class General_options): Add --warn-search-mismatch.
12612         * parameters.cc (Parameters::is_compatible_target): New function.
12613         * parameters.h (class Parameters): Declare is_compatible_target.
12614         * workqueue.cc (Workqueue::add_blocker): New function.
12615         * workqueue.h (class Workqueue): Declare add_blocker.
12616
12617         * fileread.cc (Input_file::open): Remove options parameter.
12618         Change all callers.
12619         (Input_file::open_binary): Likewise.
12620         * script.cc (read_input_script): Likewise.
12621         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12622         options parameter from constructor.  Change all callers.
12623         (class Read_script): Likewise.
12624         * fileread.h (class Input_file): Update declarations.
12625         * script.h (read_input_script): Update declaration.
12626
12627 2009-03-10  Nick Clifton  <nickc@redhat.com>
12628
12629         * po/es.po: New Spanish translation.
12630
12631 2009-03-06  Cary Coutant  <ccoutant@google.com>
12632
12633         * options.cc (parse_short_option): Keep dash_z from registering itself.
12634
12635 2009-03-03  Ian Lance Taylor  <iant@google.com>
12636
12637         PR 9918
12638         * target-reloc.h (relocate_section): Pass output_section to
12639         relocate.
12640         * i386.cc (Target_i386::should_apply_static_reloc): Add
12641         output_section parameter.  Change all callers.
12642         (Target_i386::Relocate::relocate): Add output_section parameter.
12643         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12644         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12645         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12646         * testsuite/two_file_shared.sh: New script.
12647         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12648         (check_DATA): Add two_file_shared.dbg.
12649         (two_file_shared.dbg): New target.
12650         * testsuite/Makefile.in: Rebuild.
12651
12652 2009-03-01  Ian Lance Taylor  <iant@google.com>
12653
12654         * configure.ac: Check for byteswap.h.
12655         * configure: Rebuild.
12656         * config.in: Rebuild.
12657
12658 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12659
12660         * layout.cc (Layout::find_or_add_kept_section): New function.
12661         (Layout::add_comdat): Removed.
12662         * layout.h (struct Kept_section): Move out of class Layout.
12663         Remove trailing underscores from field names.  Add group_sections
12664         field.  Rename group_ field to is_group.  Change all uses.
12665         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12666         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12667         comdat_groups_ field.
12668         (Sized_relobj::include_section_group): Use
12669         find_or_add_kept_section and Kept_section::group_sections.
12670         (Sized_relobj::include_linkonce_section): Likewise.
12671         * object.cc (class Sized_relobj): Don't define Comdat_group or
12672         Comdat_group_table.  Remove find_comdat_group and
12673         add_comdat_group.  Remove comdat_groups_ field.
12674         * plugin.cc (include_comdat_group): Use
12675         Layout::find_or_add_kept_section.
12676
12677 2009-02-28  Ian Lance Taylor  <iant@google.com>
12678
12679         * README: --gc-sections and map files are now supported.  Document
12680         some build requirements.
12681
12682         PR 6992
12683         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12684         relocatable link set the value of the section symbol to zero.
12685         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12686         relocatable link don't include the section address in the local
12687         symbol value.
12688
12689 2009-02-27  Ian Lance Taylor  <iant@google.com>
12690
12691         PR 6811
12692         * options.h (class Search_directory): Add is_system_directory.
12693         (class General_options): Declare is_in_system_directory.
12694         * options.cc (get_relative_sysroot): Make static.
12695         (get_default_sysroot): Make static.
12696         (General_optoins::is_in_system_directory): New function.
12697         * fileread.cc (Input_file::is_in_system_directory): New function.
12698         * fileread.h (class Input_file): Declare is_in_system_directory.
12699         * object.h (class Object): Add is_in_system_directory.
12700         (class Input_objects): Remove system_library_directory_ field.
12701         * object.cc (Input_objects::add_object): Don't set
12702         system_library_directory_.
12703         (input_objects::found_in_system_library_directory): Remove.
12704         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12705         parameter.  Change all callers.
12706         (Symbol_table::sized_write_globals): Likewise.
12707         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12708         Call Object::is_in_system_directory.
12709         * symtab.h (class Symbol_table): Update declarations.
12710
12711         PR 5990
12712         * descriptors.h (Open_descriptor): Add is_on_stack field.
12713         * descriptors.cc (Descriptors::open): If the descriptor is on the
12714         top of the stack, remove it.  Initialize is_on_stack field.
12715         (Descriptors::release): Only add pod to stack if it is not on the
12716         stack already.
12717         (Descriptors::close_some_descriptor): Clear stack_next and
12718         is_on_stack fields.
12719
12720         PR 7091
12721         * output.cc (Output_section::find_starting_output_address): Rename
12722         from starting_output_address; add PADDR parameter; change return
12723         type.
12724         * output.h (class Output_section): Declare
12725         find_starting_output_address instead of starting_output_address.
12726         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12727         section symbol for which we can't find a merge section.
12728
12729         PR 9836
12730         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12731         hidden or internal, force the symbol to be local.
12732         * resolve.cc (Symbol::override_visibility): Define.
12733         (Symbol::override_base): Use override_visibility.
12734         (Symbol_table::resolve): Likewise.
12735         (Symbol::override_base_with_special): Likewise.
12736         (Symbol_table::override_with_special): If the visibility is hidden
12737         or internal, force the symbol to be local.
12738         * symtab.h (class Symbol): Add set_visibility and
12739         override_visibility.
12740         * testsuite/ver_test_1.sh: New file.
12741         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12742         (check_DATA): Add ver_test_1.syms.
12743         (ver_test_1.syms): New target.
12744         * testsuite/Makefile.in: Rebuild.
12745
12746 2009-02-25  Cary Coutant  <ccoutant@google.com>
12747
12748         * layout.cc (Layout::choose_output_section): Don't rename sections
12749         when using a linker script that has a SECTIONS clause.
12750         * Makefile.in: Regenerate.
12751
12752         * testsuite/Makefile.am (script_test_5.sh): New test case.
12753         * testsuite/Makefile.in: Regenerate.
12754         * testsuite/script_test_5.cc: New file.
12755         * testsuite/script_test_5.sh: New file.
12756         * testsuite/script_test_5.t: New file.
12757
12758 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12759
12760         * archive.cc (Archive::include_member): Update calls to add_symbols.
12761         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12762         the Layout argument.
12763         * dynobj.h (do_add_symbols): Add the Layout argument.
12764         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12765         Layout argument.
12766         * object.h (Object::add_symbols): Add the Layout argument.
12767         (Object::do_add_symbols): Add the Layout argument.
12768         (Sized_relobj::do_add_symbols): Add the Layout argument.
12769         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12770         Unify the two versions.
12771         (Add_plugin_symbols): Remove.
12772         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12773         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12774         (Add_plugin_symbols): Remove.
12775         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12776         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12777         (Add_symbols::run): Make it work with Pulginobj.
12778
12779 2009-02-06  Ian Lance Taylor  <iant@google.com>
12780
12781         * object.cc (Sized_relobj::do_layout): Make info message start
12782         with lower case letter.
12783
12784 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12785
12786         * binary.cc: Fix file comment.
12787
12788         * options.h (enum Incremental_disposition): Define.
12789         (class General_options): Add new options: --incremental,
12790         --incremental_changed, --incremental_unchanged,
12791         --incremental_unknown.  Add incremental_disposition_ and
12792         implicit_incremental_ fields.
12793         (General_options::incremental_disposition): New function.
12794         (class Position_dependent_options): Add incremental_disposition
12795         option.
12796         (Position_dependent_options::copy_from_options): Set incremental
12797         dispositions.
12798         * options.cc (General_options::parse_incremental_changed): New
12799         function.
12800         (General_options::parse_incremental_unchanged): New function.
12801         (General_options::parse_incremental_unknown): New function.
12802         (General_options::General_options): Initialize new fields
12803         incremental_disposition_ and implicit_incremental_.
12804         (General_options::finalize): Check for uasge of --incremental-*
12805         without --incremental.
12806
12807 2009-02-06  Chris Demetriou  <cgd@google.com>
12808
12809         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12810         pointer and to report location as the file name associated with
12811         the symbol.
12812         (gold_undefined_symbol_at_location): New function to replace the
12813         old gold_undefined_symbol functionality.
12814         * target-reloc.h (relocate_section): Update to use
12815         gold_undefined_symbol_at_location.
12816         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12817         Call gold_undefined_symbol function rather than gold_error.
12818         * errors.h (Errors::undefined_symbol): Take location as a
12819         string, rather than calculating it from a relocation.
12820         * errors.cc (Errors::fatal): Print "fatal error:" before the
12821         formatted message.
12822         (Errors::error, Errors::error_at_location): Print "error: "
12823         before the formatted message.
12824         (Errors::undefined_symbol): Take location as a string, rather
12825         than calculating it from a relocation.
12826         (gold_undefined_symbol_at_location): New function akin to
12827         old gold_undefined_symbol, calculates location from relocation.
12828         (gold_undefined_symbol): Change to take only a Symbol pointer
12829         and to report location as the file name associated with the symbol.
12830         * testsuite/debug_msg.sh: Update for changed error messages.
12831         * testsuite/undef_symbol.sh: Likewise.
12832
12833 2009-02-04  Duncan Sands  <baldrick@free.fr>
12834
12835         PR 9812
12836         * reduced_debug_output.h
12837         (Output_reduced_debug_abbrev_section::failed): Use format for
12838         gold_warning.
12839         (Output_reduced_debug_info_section::faild): Likewise.
12840
12841 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12842
12843         * script.cc (Lazy_demangler): New class.
12844         (Version_script_info::get_symbol_version_helper): Demangle a
12845         symbol only once.
12846
12847 2009-01-29  Cary Coutant  <ccoutant@google.com>
12848
12849         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12850         to __tls_get_addr.
12851         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12852
12853 2009-01-28  Ian Lance Taylor  <iant@google.com>
12854
12855         * version.cc (version_string): Bump to 1.9.
12856
12857         * gold.h: Include <cstring> and <stdint.h>.
12858         * version.cc: Include <cstdio>.
12859         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12860         warning.
12861         * reduced_debug_output.cc (insert_into_vector): Rename from
12862         Insert_into_vector; change all callers.  Use Swap_unaligned to
12863         avoid aliasing issue; remove union since it is unnecessary.
12864
12865 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12866
12867         * Makefile.am (CCFILES): Add gc.cc.
12868         (HFILES): Add gc.h.
12869         * Makefile.in: Regenerate.
12870         * gold.cc (Gc_runner): New class.
12871         (queue_initial_tasks): Call garbage collection related tasks
12872         when corresponding options are invoked.
12873         (queue_middle_gc_tasks): New function.
12874         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12875         processed early before laying out sections during garbage collection.
12876         * gold.h (queue_middle_gc_tasks): New function.
12877         (is_prefix_of): Move from "layout.cc".
12878         * i386.cc (Target_i386::gc_process_relocs): New function.
12879         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12880         * main.cc (main): Create object of class "Garbage_collection".
12881         * object.cc (Relobj::copy_symbols_data): New function.
12882         (Relobj::is_section_name_included): New function.
12883         (Sized_relobj::do_layout): Allow this function to be called twice
12884         during garbage collection and defer layout of section during the
12885         first call.
12886         * object.h (Relobj::get_symbols_data): New function.
12887         (Relobj::is_section_name_included): New function.
12888         (Relobj::copy_symbols_data): New function.
12889         (Relobj::set_symbols_data): New function.
12890         (Relobj::get_relocs_data): New function.
12891         (Relobj::set_relocs_data): New function.
12892         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12893         (Relobj::gc_process_relocs): New function.
12894         (Relobj::do_gc_process_relocs): New pure virtual function.
12895         (Relobj::sd_): New data member.
12896         (Sized_relobj::is_output_section_offset_invalid): New function.
12897         (Sized_relobj::do_gc_process_relocs): New function.
12898         * options.h (General_options::gc_sections): Modify to not be a no-op.
12899         (General_options::print_gc_sections): New option.
12900         * plugin.cc (Plugin_finish::run): Remove function call to
12901         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12902         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12903         * reloc.cc (Read_relocs::run): Add task to process relocs and
12904         determine unreferenced sections when doing garbage collection.
12905         (Gc_process_relocs): New class.
12906         (Sized_relobj::do_gc_process_relocs): New function.
12907         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12908         sections that are garbage collected.
12909         * reloc.h (Gc_process_relocs): New class.
12910         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12911         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12912         symbols whose corresponding sections are garbage collected.
12913         (Symbol_table::Symbol_table): Add new parameter for the garbage
12914         collection object.
12915         (Symbol_table::gc_mark_undef_symbols): New function.
12916         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12917         (Symbol_table::gc_mark_dyn_syms): New function.
12918         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12919         as garbage.
12920         (Symbol_table::add_from_object): Likewise.
12921         (Symbol_table::add_from_relobj): When building shared objects, do not
12922         treat externally visible symbols as garbage.
12923         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12924         table information for static and relocatable links.
12925         * symtab.h (Symbol_table::set_gc): New function.
12926         (Symbol_table::gc): New function.
12927         (Symbol_table::gc_mark_undef_symbols): New function.
12928         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12929         (Symbol_table::gc_mark_dyn_syms): New function.
12930         (Symbol_table::gc_): New data member.
12931         * target.h (Sized_target::gc_process_relocs): New pure virtual
12932         function.
12933         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12934         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12935
12936 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12937
12938         * options.h (General_options::gc_sections): Define as a no-op for now.
12939         (General_options::no_keep_memory): Ditto.
12940         (General_options::Bshareable): Define.
12941         * options.cc (General_options::finalize): Honor -Bshareable.
12942
12943 2009-01-20  Andreas Schwab  <schwab@suse.de>
12944
12945         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12946         read the value in the contents, since we don't use it.  Use the
12947         template endianness when writing.
12948         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12949
12950 2009-01-19  Andreas Schwab  <schwab@suse.de>
12951
12952         * configure.tgt (powerpc64-*): Fix targ_obj.
12953
12954 2009-01-15  Ian Lance Taylor  <iant@google.com>
12955
12956         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12957         local symbols when stripping all symbols.
12958
12959 2009-01-14  Cary Coutant  <ccoutant@google.com>
12960
12961         * output.cc (Output_reloc): Add explicit instantiations.
12962
12963 2009-01-14  Cary Coutant  <ccoutant@google.com>
12964
12965         * archive.cc (Archive::get_elf_object_for_member): Remove call
12966         to File_read::claim_for_plugin.
12967         * descriptors.cc (Descriptors::open): Remove reference to
12968         is_claimed.
12969         (Descriptors::claim_for_plugin): Remove.
12970         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12971         (Descriptors::is_claimed): Remove.
12972         (claim_descriptor_for_plugin): Remove.
12973         * fileread.cc (File_read::claim_for_plugin): Remove.
12974         * fileread.h (File_read::claim_for_plugin): Remove.
12975         (File_read::descriptor): Reopen descriptor if necessary.
12976         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12977         (Plugin_manager::all_symbols_read): Add task parameter. Change
12978         all callers.
12979         (Plugin_manager::get_input_file): New function.
12980         (Plugin_manager::release_input_file): New function.
12981         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12982         corresponding data member.
12983         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12984         and pass to base constructor. Change all callers.
12985         (get_input_file, release_input_file): New functions.
12986         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12987         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12988         (Plugin_manager::all_symbols_read): Add task parameter.
12989         (Plugin_manager::get_input_file): New function.
12990         (Plugin_manager::release_input_file): New function.
12991         (Plugin_manager::task_): New data member.
12992         (Pluginobj::Pluginobj): Add filesize parameter.
12993         (Pluginobj::filename): New function.
12994         (Pluginobj::descriptor): New function.
12995         (Pluginobj::filesize): New function.
12996         (Pluginobj::filesize_): New data member.
12997         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12998         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12999         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13000
13001         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13002         with archive libraries.
13003         * testsuite/Makefile.in: Regenerate.
13004         * testsuite/plugin_test.c (struct sym_info): New type.
13005         (get_input_file, release_input_file): New static variables.
13006         (onload): Capture new transfer vector entries.
13007         (claim_file_hook): Stop reading at end of file according to filesize.
13008         Factor out parsing of readelf output into separate function.
13009         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13010         APIs and get the source file name from the symbol table.  Convert
13011         source file name to corresponding object file name.  Print info
13012         message when adding new input files.
13013         (parse_readelf_line): New function.
13014         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13015         * testsuite/plugin_test_2.sh: Likewise.
13016         * testsuite/plugin_test_3.sh: Likewise.
13017         * testsuite/plugin_test_4.sh: New test case.
13018
13019 2009-01-07  Ian Lance Taylor  <iant@google.com>
13020
13021         * version.cc (version_string): Bump to 1.8.
13022
13023 2008-12-23  Cary Coutant  <ccoutant@google.com>
13024
13025         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13026         * plugin.cc (Plugin_manager::finish): Rename as
13027         layout_deferred_objects.  Move cleanup to separate function.
13028         (Plugin_manager::cleanup): New function.
13029         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13030         separately.
13031         * plugin.h (Plugin_manager::finish): Rename as
13032         layout_deferred_objects.
13033         (Plugin_manager::cleanup): New function.
13034         (Plugin_manager::cleanup_done): New field.
13035
13036 2008-12-23  Cary Coutant  <ccoutant@google.com>
13037
13038         * plugin.cc (is_visible_from_outside): New function.
13039         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13040         so we don't return "IR only" status for exported symbols or -r links.
13041
13042         * testsuite/Makefile.am (plugin_test_3): New test case.
13043         * testsuite/Makefile.in: Regenerate.
13044         * testsuite/plugin_test_3.sh: New file.
13045
13046 2008-12-22  Cary Coutant  <ccoutant@google.com>
13047
13048         * object.cc (Sized_relobj::layout_section): New function.
13049         (Sized_relobj::do_layout): Defer layout of input sections until after
13050         plugin has provided replacement files.
13051         (Sized_relobj::do_layout_deferred_sections): New function.
13052         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13053         (Relobj::layout_deferred_sections): New function.
13054         (Relobj::do_layout_deferred_sections): New function.
13055         (Sized_relobj::do_layout_deferred_sections): New function.
13056         (Sized_relobj::layout_section): New function.
13057         (Sized_relobj::Deferred_layout): New structure.
13058         (Sized_relobj::deferred_layout_): New field.
13059         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13060         Change all callers.  Layout deferred sections.
13061         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13062         references.
13063         (Plugin_hook::run): Move code from do_plugin_hook inline.
13064         (Plugin_hook::do_plugin_hook): Remove.
13065         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13066         (Plugin_manager::finish): Renamed, was cleanup.
13067         (Plugin_manager::should_defer_layout): New function.
13068         (Plugin_manager::add_deferred_layout_object): New function.
13069         (Plugin_manager::Deferred_layout_list): New type.
13070         (Plugin_manager::deferred_layout_objects_): New field.
13071         (Plugin_hook::do_plugin_hook): Remove.
13072
13073 2008-12-17  Ian Lance Taylor  <iant@google.com>
13074
13075         * options.h (class General_options): Add --no case for
13076         --export-dynamic.
13077
13078 2008-12-16  Cary Coutant  <ccoutant@google.com>
13079
13080         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13081         vector.
13082         (Plugin_manager::claim_file): Create plugin object even if
13083         plugin did not call the add_symbols callback.
13084         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13085         asking for more symbols than were added.
13086         * testsuite/Makefile.am (plugin_test_1): Add test case with
13087         no global symbols.
13088         (empty.syms): New target.
13089         * testsuite/Makefile.in: Regenerate.
13090         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13091         message. Don't call add_symbols if no globals.
13092         (all_symbols_read_hook): Don't provide replacement for empty
13093         claimed file.
13094
13095 2008-12-12  Ian Lance Taylor  <iant@google.com>
13096
13097         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13098         r_type == 0 for a local symbol with r_sym == 0.
13099         (scan_relocatable_relocs): Pass r_sym to
13100         local_non_section_strategy.
13101         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13102         r_sym parameter.
13103
13104         * configure.ac: Update test for TLS descriptors: they are
13105         supported as of glibc 2.9.
13106         * configure: Rebuild.
13107
13108 2008-12-11  Ian Lance Taylor  <iant@google.com>
13109
13110         PR 7091
13111         * target-reloc.h (Default_scan_relocatable_relocs): For each
13112         function, map r_type == 0 to RELOC_DISCARD.
13113
13114 2008-12-10  Cary Coutant  <ccoutant@google.com>
13115
13116         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13117         object to override a kept COMDAT group from a plugin object.
13118
13119 2008-12-09  Ian Lance Taylor  <iant@google.com>
13120
13121         PR 7088
13122         * yyscript.y (file_cmd): Handle INPUT.
13123
13124         * testsuite/initpri1.c: Change all declarations to be full
13125         prototypes by adding void, to avoid compiler warnings.
13126
13127 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13128
13129         * options.cc (General_options::parse_plugin_opt): New.
13130         (General_options::add_plugin): The argument now is just the filename.
13131         (General_options::add_plugin_option): New.
13132         * options.h (plugin_opt): New.
13133         (add_plugin): Change argument name.
13134         (add_plugin_option): New.
13135         * plugin.cc (Plugin::load): Don't parse the plugin option.
13136         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13137         (Plugin::add_option): New.
13138         (Plugin::args_): Change type.
13139         (Plugin::filename_): New.
13140         (Plugin_manager::add_plugin_option): New.
13141         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13142         * testsuite/Makefile.in: Regenerate.
13143
13144 2008-12-05  Cary Coutant  <ccoutant@google.com>
13145
13146         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13147         Handle --strip-lto-sections option.
13148         * options.h (strip_lto_sections): New option.
13149
13150 2008-12-01  Cary Coutant  <ccoutant@google.com>
13151
13152         * plugin.cc (ld_plugin_message): Change format parameter to const.
13153         Fix mismatch between new[] and delete.
13154
13155 2008-11-14  Cary Coutant  <ccoutant@google.com>
13156
13157         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13158         instead of -1U.
13159
13160 2008-11-05  Craig Silverstein  <csilvers@google.com>
13161
13162         * options.cc (General_options::parse_dynamic_list): New function.
13163         * options.h (General_options): New flags dynamic_list,
13164         dynamic_list_data, dynamic_list_cpp_new, and
13165         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13166         (General_options::in_dynamic_list): New function.
13167         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13168         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13169         (Lex::can_continue_name): Likewise.
13170         (yylex): Likewise.
13171         (read_script_file): New parameter script_options.
13172         (read_dynamic_list): New function.
13173         (Script_options::define_dynamic_list): New function.
13174         (dynamic_list_keyword_parsecodes): New variable.
13175         (dynamic_list_keywords): New variable.
13176         * script.h (Script_options::define_dynamic_list): New function
13177         prototype.
13178         (read_dynamic_list): New function prototype.
13179         * symtab.cc (strprefix): New macro.
13180         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13181         dynamic_list_data, dynamic_list_cpp_new, and
13182         dynamic_list_cpp_typeinfo.
13183         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13184         (dynamic_list_expr): New rule.
13185         (dynamic_list_nodes): Likewise.
13186         (dynamic_list_node): Likewise.
13187         * testsuite/Makefile.am (dynamic_list): New test.
13188         * testsuite/Makefile.in: Regenerated.
13189         * testsuite/dynamic_list.t: New file.
13190         * testsuite/dynamic_list.sh: New file.
13191
13192 2008-11-05  Craig Silverstein  <csilvers@google.com>
13193
13194         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13195         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13196         (t11_last): Likewise.
13197         * testsuite/ver_test_6.c (main): Likewise.
13198
13199 2008-10-07  Cary Coutant  <ccoutant@google.com>
13200
13201         * options.c (General_options::finalize): Add check for -static and
13202         -shared.
13203         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13204         is not empty.
13205
13206 2008-10-02  Cary Coutant  <ccoutant@google.com>
13207
13208         * plugin.cc (make_sized_plugin_object): Fix conditional
13209         compilation to work when not all targets are enabled.
13210
13211 2008-09-29  Cary Coutant  <ccoutant@google.com>
13212
13213         * archive.cc (Archive::get_file_and_offset): Use filename instead
13214         of name to get library path.
13215         (Archive::include_member): Unlock external member of a thin archive.
13216
13217         * testsuite/Makefile.am (TEST_AR): New variable.
13218         (thin_archive_test_1): New test.
13219         (thin_archive_test_2): New test.
13220         * testsuite/Makefile.in: Regenerate.
13221         * testsuite/thin_archive_main.cc: New file.
13222         * testsuite/thin_archive_test_1.cc: New file.
13223         * testsuite/thin_archive_test_2.cc: New file.
13224         * testsuite/thin_archive_test_3.cc: New file.
13225         * testsuite/thin_archive_test_4.cc: New file.
13226
13227 2008-09-29  Cary Coutant  <ccoutant@google.com>
13228
13229         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13230         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13231         instead of -1U.
13232         (Sized_relobj::do_finalize_local_symbols): Likewise.
13233         (Sized_relobj::map_to_kept_section): Likewise.
13234         * object.h (Sized_relobj::invalid_address): New constant.
13235         (Sized_relobj::do_output_section_offset): Check for invalid_address
13236         and return -1ULL.
13237         * output.cc (Output_reloc::local_section_offset): Use constant
13238         invalid_address instead of -1U.
13239         (Output_reloc::get_address): Likewise.
13240         (Output_section::output_address): Change -1U to -1ULL.
13241         * output.h (Output_reloc::invalid_address): New constant.
13242         * reloc.cc (Sized_relobj::write_sections): Use constant
13243         invalid_address instead of -1U.
13244         (Sized_relobj::relocate_sections): Likewise.
13245         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13246         values for merge sections.
13247         * target-reloc.h (relocate_for_relocatable): Use constant
13248         invalid_address instead of -1U.
13249
13250 2008-09-19  Cary Coutant  <ccoutant@google.com>
13251
13252         Add plugin functionality for link-time optimization (LTO).
13253         * configure.ac (plugins): Add --enable-plugins option.
13254         * configure: Regenerate.
13255         * config.in: Regenerate.
13256         * Makefile.am (LIBDL): New variable.
13257         (CCFILES): Add plugin.cc.
13258         (HFILES): Add plugin.h.
13259         (ldadd_var): Add LIBDL.
13260         * Makefile.in: Regenerate.
13261
13262         * archive.cc: Include "plugin.h".
13263         (Archive::setup): Don't preread archive symbols when using a plugin.
13264         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13265         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13266         files.
13267         (Archive::include_member): Add symbols from plugin objects.
13268         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13269         * descriptors.cc (Descriptors::open): Check for file descriptors
13270         abandoned by plugins.
13271         (Descriptors::claim_for_plugin): New function.
13272         * descriptors.h (Descriptors::claim_for_plugin): New function.
13273         (Open_descriptor::is_claimed): New field.
13274         (claim_descriptor_for_plugin): New function.
13275         * fileread.cc (File_read::claim_for_plugin): New function.
13276         * fileread.h (File_read::claim_for_plugin): New function.
13277         (File_read::descriptor): New function.
13278         * gold.cc: Include "plugin.h".
13279         (queue_initial_tasks): Add task to call plugin hooks for generating
13280         new object files.
13281         * main.cc: Include "plugin.h".
13282         (main): Load plugin libraries.
13283         * object.h (Pluginobj): Declare.
13284         (Object::pluginobj): New function.
13285         (Object::do_pluginobj): New function.
13286         (Object::set_target): New function.
13287         * options.cc: Include "plugin.h".
13288         (General_options::parse_plugin): New function.
13289         (General_options::General_options): Initialize plugins_ field.
13290         (General_options::add_plugin): New function.
13291         * options.h (Plugin_manager): Declare.
13292         (General_options): Add --plugin option.
13293         (General_options::has_plugins): New function.
13294         (General_options::plugins): New function.
13295         (General_options::add_plugin): New function.
13296         (General_options::plugins_): New field.
13297         * plugin.cc: New file.
13298         * plugin.h: New file.
13299         * readsyms.cc: Include "plugin.h".
13300         (Read_symbols::do_read_symbols): Check for archive before checking
13301         for ELF file.  Call plugin hooks to claim files.
13302         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13303         from a real object file; force override when processing replacement
13304         files.
13305         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13306         (Symbol::init_base_object): Likewise.
13307         (Symbol::init_base_output_data): Likewise.
13308         (Symbol::init_base_output_segment): Likewise.
13309         (Symbol::init_base_constant): Likewise.
13310         (Symbol::init_base_undefined): Likewise.
13311         (Symbol::output_section): Assert that object is not a plugin.
13312         (Symbol_table::add_from_pluginobj): New function.
13313         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13314         undefined.
13315         (Symbol_table::sized_write_globals): Likewise.
13316         (Symbol_table::add_from_pluginobj): Instantiate template.
13317         * symtab.h (Sized_pluginobj): Declare.
13318         (Symbol::in_real_elf): New function.
13319         (Symbol::set_in_real_elf): New function.
13320         (Symbol::in_real_elf_): New field.
13321         (Symbol_table::add_from_pluginobj): New function.
13322
13323         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13324         (LIBDL): New variable.
13325         (LDADD): Add LIBDL.
13326         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13327         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13328         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13329         (MOSTLYCLEANFILES): Likewise.
13330         * testsuite/Makefile.in: Regenerate.
13331         * testsuite/plugin_test.c: New file.
13332         * testsuite/plugin_test_1.sh: New file.
13333         * testsuite/plugin_test_2.sh: New file.
13334
13335 2008-09-16  Ian Lance Taylor  <iant@google.com>
13336
13337         * target-reloc.h (relocate_section): Check whether a symbol is
13338         defined by the ABI before reporting an undefined symbol error.
13339         * target.h (Target::is_defined_by_abi): Make parameter const.
13340         (Target::do_is_defined_by_abi): Likewise.
13341         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13342         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13343         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13344         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13345         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13346         * testsuite/Makefile.in: Rebuild.
13347
13348         * fileread.cc (make_view): Add casts to avoid warning.
13349
13350 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13351
13352         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13353         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13354
13355 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13356
13357         * options.h (General_options::output_is_executable): New.
13358         (General_options::output_is_pie): New.
13359         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13360         for shared libraries.
13361         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13362
13363 2008-09-11  Chris Demetriou  <cgd@google.com>
13364
13365         * options.h (origin): New -z option.
13366         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13367         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13368         in DT_FLAGS_1.
13369
13370 2008-09-05  Cary Coutant  <ccoutant@google.com>
13371
13372         * fileread.cc (File_read::make_view): Add check for attempt to map
13373         beyond end of file.
13374
13375 2008-09-05  Cary Coutant  <ccoutant@google.com>
13376
13377         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13378         explicit instantiations.
13379
13380 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13381
13382         PR gold/6858
13383         * options.cc (General_options::finalize): Allow undefined symbols
13384         in shlibs if linking -shared.
13385
13386         PR gold/6859
13387         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13388         symbols as not needing a dynsym entry.
13389
13390 2008-08-20  Craig Silverstein  <csilvers@google.com>
13391
13392         * fileread.cc (File_read::open): Do not lock the file unless it
13393         was successfully opened.
13394
13395 2008-08-14  Cary Coutant  <ccoutant@google.com>
13396
13397         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13398         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13399         * testsuite/tls_test.cc (struct int128): 128-bit struct
13400         for testing TLS relocs with non-zero addend.
13401         (v12): New TLS variable.
13402         (t12): New test.
13403         (t_last): Add check for v12.
13404         * testsuite/tls_test.h (t12): New function.
13405         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13406
13407 2008-08-13  Ian Lance Taylor  <iant@google.com>
13408
13409         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13410         set tls_segment_ or relro_segment_.
13411         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13412         when appropriate.
13413         * output.h (Output_section::clear_is_relro): New function.
13414         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13415         sections specially even when output_data_ is empty.
13416         (Output_segment::maximum_alignment): When first section is relro,
13417         only force alignment for PT_LOAD segments.
13418         * script.cc (script_data_segment_align): New function.
13419         (script_data_segment_relro_end): New function.
13420         * script-c.h (script_data_segment_align): Declare.
13421         (script_data_segment_relro_end): Declare.
13422         * script-sections.h (class Script_sections): Declare
13423         data_segment_align and data_segment_relro_end.  Add fields
13424         segment_align_index_ and saw_relro_end_.
13425         * script-sections.cc (class Sections_element): Add set_is_relro
13426         virtual function.  Add new bool* parameter to place_orphan_here.
13427         Add get_output_section virtual function.
13428         (class Output_section_definition): Add set_is_relro.  Add new
13429         bool* parameter to place_orphan_here.  Add get_output_section.
13430         Add is_relro_ field.
13431         (Output_section_definition::Output_section_definition): Initialize
13432         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13433         and is_relro_ fields.
13434         (Output_section_definition::place_orphan_here): Add is_relro
13435         parameter.
13436         (Output_section_definition::set_section_addresses): Set relro for
13437         output section.
13438         (Output_section_definition::alternate_constraint): Likewise.
13439         (class Orphan_output_section): Add new bool* parameter to
13440         place_orphan_here.  Add get_output_section.
13441         (Orphan_output_section::place_orphan_here): Add is_relro
13442         parameter.
13443         (Script_sections::Script_sections): Initialize
13444         data_segment_align_index_ and saw_relro_end_.
13445         (Script_sections::data_segment_align): New function.
13446         (Script_sections::data_segment_relro_end): New function.
13447         (Script_sections::place_orphan): Set or clear is_relro.
13448         (Script_sections::set_section_addresses): Force alignment of first
13449         TLS section.
13450         * yyscript.y (exp): Call script_data_segment_align and
13451         script_data_segment_relro_end.
13452         * testsuite/relro_script_test.t: New file.
13453         * testsuite/relro_test.cc (using_script): Declare.
13454         (t1, t2): Test using_script.
13455         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13456         (relro_script_test_SOURCES): Define.
13457         (relro_script_test_DEPENDENCIES): Define.
13458         (relro_script_test_LDFLAGS): Define.
13459         (relro_script_test_LDADD): Define.
13460         (relro_script_test.so): New target.
13461         * testsuite/Makefile.in: Rebuild.
13462
13463 2008-08-06  Cary Coutant <ccoutant@google.com>
13464
13465         * archive.cc (Archive::total_archives, Archive::total_members)
13466         (Archive::total_members_loaded): New variables.
13467         (Archive::setup): Add parameter.  Add option to preread
13468         archive symbols.
13469         (Archive::read_armap): Add counter.
13470         (Archive::get_file_and_offset): New function.
13471         (Archive::get_elf_object_for_member): New function.
13472         (Archive::read_all_symbols): New function.
13473         (Archive::read_symbols): New function.
13474         (Archive::add_symbols): Add counters.
13475         (Archive::include_all_members): Use armap to find members if it's
13476         already built.
13477         (Archive::include_member): Skip reading symbols if already read.
13478         Factored code into Archive::get_file_and_offset and
13479         Archive::get_elf_object_for_member.  Changed call to
13480         Mapfile::report_include_archive_member.
13481         (Archive::print_stats): New function.
13482         * archive.h: Declare Object and Read_symbols_data classes.
13483         (Archive::Archive): Add initializers for new members.
13484         (Archive::setup): Add parameter.
13485         (Archive::print_stats): New function.
13486         (Archive::total_archives, Archive::total_members)
13487         (Archive::total_members_loaded): New variables.
13488         (Archive::get_file_and_offset): New function.
13489         (Archive::get_elf_object_for_member): New function.
13490         (Archive::read_all_symbols): New function.
13491         (Archive::read_symbols): New function.
13492         (Archive::Archive_member): New class.
13493         (Archive::members_): New member.
13494         (Archive::num_members_): New member.
13495         * main.cc: Include archive.h.
13496         (main): Call Archive::print_stats.
13497         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13498         archive parameter; member_name is now the fully-decorated name.
13499         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13500         * options.h: (General_options): Add --preread-archive-symbols option.
13501         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13502         Archive::setup.
13503
13504 2008-08-04  Ian Lance Taylor  <iant@google.com>
13505
13506         * symtab.h (Symbol::use_plt_offset): New function.
13507         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13508         * powerpc.cc (Relocate::relocate): Likewise.
13509         * sparc.cc (Relocate::relocate): Likewise.
13510         * x86_64.cc (Relocate::relocate): Likewise.
13511         * testsuite/weak_plt.sh: New test.
13512         * testsuite/weak_plt_main.cc: New test.
13513         * testsuite/weak_plt_shared.cc: New test.
13514         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13515         (check_PROGRAMS): Add weak_plt.
13516         (check_DATA): Add weak_plt_shared.so.
13517         (weak_plt_main_pic.o, weak_plt): New targets.
13518         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13519         * testsuite/Makefile.in: Rebuild.
13520
13521         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13522         gcctestdir/ld.
13523         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13524         * testsuite/Makefile.in: Rebuild.
13525
13526 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13527
13528         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13529         * Makefile.in: Regenerate.
13530         * po/POTFILES.in: Regenerate.
13531
13532 2008-07-29  Ian Lance Taylor  <iant@google.com>
13533
13534         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13535         symbols before other symbols.
13536         * testsuite/script_test_2.cc (test_addr): Declare.
13537         (test_addr_alias): Declare.
13538         (main): Check that test_addr and test_addr_alias have the right
13539         values.
13540         * testsuite/script_test_2.t: Define test_addr_alias and
13541         test_addr.
13542
13543 2008-07-24  Ian Lance Taylor  <iant@google.com>
13544
13545         PR 5990
13546         * descriptors.cc: New file.
13547         * descriptors.h: New file.
13548         * gold-threads.h (class Hold_optional_lock): New class.
13549         * fileread.cc: Include "descriptors.h".
13550         (File_read::~File_read): Release descriptor rather than closing
13551         it.
13552         (File_read::open) [file]: Call open_descriptor rather than open.
13553         Set is_descriptor_opened_.
13554         (File_read::open) [memory]: Assert that descriptor is not open.
13555         (File_read::reopen_descriptor): New function.
13556         (File_read::release): Release descriptor.
13557         (File_read::do_read): Make non-const.  Reopen descriptor.
13558         (File_read::read): Make non-const.
13559         (File_read::make_view): Reopen descriptor.
13560         (File_read::do_readv): Likewise.
13561         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13562         Update declarations.
13563         * layout.cc: Include "descriptors.h".
13564         (Layout::create_build_id): Use open_descriptor rather than open.
13565         * output.cc: Include "descriptors.h".
13566         (Output_file::open): Use open_descriptor rather than open.
13567         * archive.cc (Archive::const_iterator): Change Archive to be
13568         non-const.
13569         (Archive::begin, Archive::end): Make non-const.
13570         (Archive::count_members): Likewise.
13571         * archive.h (class Archive): Update declarations.
13572         * object.h (Object::read): Make non-const.
13573         * Makefile.am (CCFILES): Add descriptors.cc.
13574         (HFILES): Add descriptors.h.
13575         * Makefile.in: Rebuild.
13576
13577         PR 6716
13578         * gold.h: Always include <clocale>.  Add Solaris workarounds
13579         following code in binutils/sysdep.h.
13580
13581         PR 6048
13582         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13583         this->eh_frame_hdr_ is NULL before using it.
13584
13585         * dynobj.cc (Versions::Versions): Update comment.
13586
13587         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13588         the base version name.
13589
13590         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13591         array size plus one.
13592         (Stringpool_template::set_string_offsets): Subtract one from key
13593         before using it as an array index.
13594         (Stringpool_template::get_offset_with_length): Likewise.
13595         (Stringpool_template::write_to_buffer): Likewise.
13596         * stringpool.h (Stringpool_template::get_offset_from_key):
13597         Likewise.
13598
13599 2008-07-23  Ian Lance Taylor  <iant@google.com>
13600
13601         PR 6658
13602         * object.h (Merged_symbol_value::value): Do our best to handle a
13603         negative addend.
13604
13605         PR 6647
13606         * script.cc (Version_script_info::get_versions): Don't add empty
13607         version tag to return value.
13608         (Version_script_info::get_symbol_version_helper): Change return
13609         type to bool.  Add pversion parameter.  Change all callers.
13610         (script_register_vers_node): Don't require a non-NULL tag.
13611         * script.h (class Version_script_info): Update declarations.
13612         (Version_script_info::get_symbol_version): Change return type to
13613         bool.  Add version parameter.  Change all callers.
13614         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13615         handling.  Handle an empty version from a version script.
13616         (Symbol_table::define_special_symbol): Likewise.
13617         * testsuite/ver_test_10.script: New file.
13618         * testsuite/ver_test_10.sh: New file.
13619         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13620         (check_DATA): Add ver_test_10.syms.
13621         (ver_test_10.syms, ver_test_10.so): New target.
13622         * testsuite/Makefile.in: Rebuild.
13623
13624 2008-07-23  Simon Baldwin  <simonb@google.com>
13625
13626         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13627         to zero for undefined symbols from dynamic libraries.
13628
13629 2008-07-23  Ian Lance Taylor  <iant@google.com>
13630
13631         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13632         Change all callers.
13633         * symtab.h (class Symbol_table): Update declaration.
13634         * testsuite/ver_test_9.cc: New file.
13635         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13636         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13637         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13638         (ver_test_9.so, ver_test_9.o): New targets.
13639         * testsuite/Makefile.in: Rebuild.
13640
13641 2008-07-22  Ian Lance Taylor  <iant@google.com>
13642
13643         * options.h (class General_options): Define --check-sections.
13644         * layout.cc (Layout::set_segment_offsets): Handle
13645         --check-sections.
13646
13647         * options.h (class General_options): Define -n/--nmagic and
13648         -N/--omagic.
13649         * options.cc (General_options::finalize): For -n/--nmagic or
13650         -N/--omagic, set -static.
13651         * layout.cc (Layout::attach_allocated_section_to_segment): If
13652         -N/--omagic, don't put read-only and read-write sections in
13653         different segments.
13654         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13655         finding a read-only segment.
13656         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13657         don't set the minimum segment alignment to the common page size,
13658         and don't set the file offset to the address modulo the page size.
13659         * script-sections.cc (Script_sections::create_segments): If
13660         -n/--omagic, don't put read-only and read-write sections in
13661         different segments.
13662
13663         * cref.cc: New file.
13664         * cref.h: New file.
13665         * options.h (class General_options): Add --print-symbol-counts.
13666         * main.cc (main): Issue defined symbol report if requested.
13667         * archive.cc (Archive::interpret_header): Make into a const member
13668         function.
13669         (Archive::add_symbols): Call Input_objects::archive_start and
13670         archive_stop.
13671         (Archive::const_iterator): Define new class.
13672         (Archive::begin, Archive::end): New functions.
13673         (Archive::include_all_members): Rewrite to use iterator.
13674         (Archive::count_members): New function.
13675         * archive.h (class Archive): Update declarations.
13676         (Archive::filename): New function.
13677         * object.cc: Include "cref.h".
13678         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13679         (Sized_relobj::do_get_global_symbol_counts): New function.
13680         (Input_objects::add_object): Add object to cross-referencer.
13681         (Input_objects::archive_start): New function.
13682         (Input_objects::archive_stop): New function.
13683         (Input_objects::print_symbol_counts): New function.
13684         * object.h: Declare Cref and Archive.
13685         (Object::get_global_symbol_counts): New function.
13686         (Object::do_get_global_symbol_counts): New pure virtual function.
13687         (class Sized_relobj): Add defined_count_ field.  Update
13688         declarations.
13689         (class Input_objects): Add cref_ field.  Update constructor.
13690         Update declarations.
13691         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13692         defined_count_.
13693         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13694         symbol counts.
13695         (Sized_dynobj::do_get_global_symbol_counts): New function.
13696         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13697         defined_count_.  Update declarations.  Define Symbols typedef.
13698         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13699         parameter.  Change all callers.
13700         (Symbol_table::add_from_dynobj): Add sympointers and defined
13701         parameters.  Change all callers.
13702         * symtab.h (class Symbol_table): Update declarations.
13703         * Makefile.am (CCFILES): Add cref.cc.
13704         (HFILES): Add cref.h.
13705         * Makefile.in: Rebuild.
13706
13707 2008-07-22  Simon Baldwin  <simonb@google.com>
13708
13709         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13710         to zero when writing undefined symbols.
13711
13712 2008-07-22  Ian Lance Taylor  <iant@google.com>
13713
13714         * output.cc (Output_section::add_input_section): Don't try to
13715         merge empty merge sections.
13716
13717 2008-07-21  Craig Silverstein  <csilvers@google.com>
13718
13719         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13720         Include symbol version in error message.
13721
13722 2008-07-20  Chris Demetriou  <cgd@google.com>
13723
13724         * configure.ac (gold_cv_c_random_seed): New configured variable.
13725         (RANDOM_SEED_CFLAGS): New substituted variable.
13726         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13727         * configure: Rebuild.
13728         * Makefile.in: Likewise.
13729         * testsuite/Makefile.in: Likewise.
13730
13731 2008-07-18  Ian Lance Taylor  <iant@google.com>
13732
13733         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13734         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13735         * testsuite/ver_test_main.cc (main): Call t4.
13736         (t4, t4_2a): Define.
13737         * testsuite/ver_test_2.cc (t4_2): Define.
13738         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13739         * testsuite/ver_test_4.cc (t4_2a): Define.
13740         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13741         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13742
13743 2008-07-17  Ian Lance Taylor  <iant@google.com>
13744
13745         * dynobj.cc (Versions::add_def): If we give an error about a
13746         missing version, go ahead and create the version anyhow.
13747
13748 2008-07-10  Ian Lance Taylor  <iant@google.com>
13749
13750         Handle output sections with more than 0x7fffffff bytes.
13751         * object.h (class Relobj): Change map_to_output_ to
13752         output_sections_, and just keep a section pointer.  Change all
13753         uses.  Move comdat group support to Sized_relobj.
13754         (Relobj::is_section_specially_mapped): Remove.
13755         (Relobj::output_section): Remove poff parameter.  Change all
13756         callers.
13757         (Relobj::output_section_offset): New function.
13758         (Relobj::set_section_offset): Rewrite.
13759         (Relobj::map_to_output): Remove.
13760         (Relobj::output_sections): New function.
13761         (Relobj::do_output_section_offset): New pure virtual function.
13762         (Relobj::do_set_section_offset): Likewise.
13763         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13764         group support from Relobj.  Update declarations.
13765         (Sized_relobj::get_output_section_offset): New function.
13766         (Sized_relobj::do_output_section_offset): New function.
13767         (Sized_relobj::do_set_section_offset): New function.
13768         * object.cc (Relobj::output_section_address): Remove.
13769         (Sized_relobj::Sized_relobj): Initialize new fields.
13770         (Sized_relobj::include_section_group): Cast find_kept_object to
13771         Sized_relobj.
13772         (Sized_relobj::include_linkonce_section): Likewise.
13773         (Sized_relobj::do_layout): Use separate arrays for output section
13774         and output offset.
13775         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13776         output_sections.
13777         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13778         output_sections and section_offsets.
13779         (Sized_relobj::write_local_symbols): Likewise.
13780         (map_to_kept_section): Compute output address directly.
13781         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13782         output_sections and section_offsets.
13783         (Sized_relobj::write_sections): Likewise.
13784         (Sized_relobj::relocate_sections): Likewise.
13785         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13786         * output.h (class Output_reloc): Update declarations.  Change
13787         u2_.relobj to Sized_relobj*.
13788         (class Output_data_reloc): Change add functions to use
13789         Sized_relobj*.
13790         * output.cc (Output_reloc::Output_reloc): Change relobj to
13791         Sized_relobj*.
13792         (Output_reloc::local_section_offset): Change return type to
13793         Elf_Addr.  Use get_output_section_offset.
13794         (Output_reloc::get_address): Likewise.
13795         (Output_section::is_input_address_mapped): Don't call
13796         is_section_specially_mapped.
13797         (Output_section::output_offset): Likewise.
13798         (Output_section::output_address): Likewise.
13799         (Output_section::starting_output_address): Likewise.
13800         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13801         parameter to Sized_relobj*.
13802         (Copy_relocs::need_copy_reloc): Likewise.
13803         (Copy_relocs::save): Likewise.
13804         * copy-relocs.h (class Copy_relocs): Update declarations.
13805         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13806         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13807         * target-reloc.h (relocate_for_relocatable): Change
13808         offset_in_output_section type to Elf_Addr.  Change code that uses
13809         it as well.
13810         * layout.cc (Layout::layout): Always set *off.
13811         * mapfile.cc (Mapfile::print_input_section): Use
13812         output_section_offset.
13813         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13814         Sized_relobj*.
13815         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13816         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13817         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13818
13819 2008-07-03  Ian Lance Taylor  <iant@google.com>
13820
13821         * layout.cc (Layout::include_section): Do not discard unrecognized
13822         SHT_STRTAB sections.
13823
13824 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13825
13826         * script.cc (Lex::can_continue_name): Make '?' allowable in
13827         version-script names.
13828         * testsuite/version_script.map: Change glob pattern to use '?'
13829
13830 2008-06-30  Manish Singh  <yosh@gimp.org>
13831
13832         PR 6585
13833         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13834         Correct typo.
13835
13836 2008-06-30  Ian Lance Taylor  <iant@google.com>
13837
13838         PR 6660
13839         PR 6682
13840         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13841         versions]: Don't try to read the value in the contents, since we
13842         don't use it.  Use the template endianness when writing.
13843
13844 2008-06-25  Cary Coutant  <ccoutant@google.com>
13845
13846         * fileread.cc (File_read::make_view): Assert on zero-length view.
13847         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13848         symbol table when there are no symbols to read.
13849
13850 2008-06-23  Craig Silverstein  <csilvers@google.com>
13851
13852         * version.cc (version_string): Bump to 1.7
13853
13854 2008-06-18  Craig Silverstein  <csilvers@google.com>
13855
13856         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13857         constant 0xFFFF to type Valtype.
13858         (Powerpc_relocate_functions::rel16_ha): Likewise.
13859
13860 2008-06-17  Ian Lance Taylor  <iant@google.com>
13861
13862         * output.h (Output_section::Input_section): Initialize p2align_ to
13863         zero for Output_section_data constructors.
13864         (Output_section::Input_section::addralign): If not an input
13865         section, return the alignment of the Output_section_data.
13866         * testsuite/copy_test.cc: New file.
13867         * testsuite/copy_test_1.cc: New file.
13868         * testsuite/copy_test_2.cc: New file.
13869         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13870         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13871         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13872         (copy_test_1_pic.o, copy_test_1.so): New targets.
13873         (copy_test_2_pic.o, copy_test_2.so): New targets.
13874         * testsuite/Makefile.in: Rebuild.
13875
13876         * script-sections.cc (Script_sections::place_orphan): Initialize
13877         local variable exact.
13878
13879 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13880
13881         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13882
13883 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13884             David S. Miller  <davem@davemloft.net>
13885
13886         * powerpc.cc: New file.
13887         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13888         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13889         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13890         * Makefile.in: Rebuild.
13891
13892 2008-06-09  Ian Lance Taylor  <iant@google.com>
13893
13894         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13895         <exception>.
13896         (throwing, orig_terminate): New static variables.
13897         (terminate_handler): New static function.
13898         (t2): Set terminate handler.
13899
13900 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13901
13902         PR 6584
13903         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13904         alignment.
13905
13906 2008-05-30  Cary Coutant  <ccoutant@google.com>
13907
13908         * archive.cc (Archive::include_all_members) Correct to step
13909         over symbol table and extended name table in thin archives.
13910
13911 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13912
13913         PR 6407
13914         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13915         calculation.
13916
13917 2008-05-28  Caleb Howe  <cshowe@google.com>
13918
13919         * reduced_debug_output.cc: New file.
13920         * reduced_debug_output.h: New file.
13921         * options.h (class General_options): Add --strip-debug-non-line.
13922         * options.cc (General_options::finalize): Add strip_debug_non_line
13923         to the strip heirarchy.
13924         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13925         fields.
13926         * layout.cc: Include "reduced_debug_output.h".
13927         (Layout::Layout): Initialize new fields.
13928         (line_only_debug_sections): New static array.
13929         (is_lines_only_debug_sections): New static inline function.
13930         (Layout::include_section): Handle --strip-debug-non-line.
13931         (Layout::make_output_section): If --strip-debug-non-line, build
13932         new output sections for .debug_abbrev and .debug_info.
13933         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13934         gold.  Warn about possible overflow.
13935         (read_signed_LEB_128): Likewise.
13936         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13937         (read_signed_LEB_128): Declare.
13938         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13939         (HFILES): Add reduced_debug_output.h.
13940         * Makefile.in: Rebuild.
13941
13942 2008-05-21  Ian Lance Taylor  <iant@google.com>
13943
13944         * mapfile.cc: New file.
13945         * mapfile.h: New file.
13946         * options.h (class General_options): Add -M/--print-map and -Map.
13947         * options.cc (General_options::finalize): Make -M equivalent to
13948         -Map -.
13949         * main.cc: Include <cstdio> and "mapfile.h".
13950         (main): Open mapfile if requested.
13951         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13952         constructor.  Change caller.
13953         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13954         (queue_middle_tasks): Likewise.
13955         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13956         declarations.
13957         * archive.cc: Include "mapfile.h".
13958         (Archive::add_symbols): Add mapfile parameter.  Change all
13959         callers.  Pass mapfile, symbol, and reason to include_member.
13960         (Archive::include_all_members): Add mapfile parameter.  Change all
13961         callers.
13962         (Archive::include_member): Add mapfile, sym, and why parameters.
13963         Change all callers.  Report inclusion to map file.
13964         * archive.h: Include "fileread.h".
13965         (class Archive): Update declarations.
13966         (Archive::file): New const method.
13967         (class Add_archive_symbols): Add mapfile_ field.  Update
13968         constructor.  Change all callers.
13969         * readsyms.h (class Read_symbols): Likewise.
13970         (class Finish_group): Likewise.
13971         (class Read_script): Likewise.
13972         * common.cc: Include "mapfile.h".
13973         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13974         all callers.
13975         (Symbol_table::do_allocate_commons): Likewise.
13976         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13977         symbol allocation to mapfile.
13978         * common.h (class Allocate_commons_task): Add mapfile_ field.
13979         Update constructor.  Change all callers.
13980         * symtab.h (class Symbol_table): Update declarations.
13981         * layout.cc: Include "mapfile.h".
13982         (Layout_task_runner::run): Print information to mapfile.
13983         (Layout::create_gold_note): Change Output_data_fixed_space to
13984         Output_data_zero_fill.
13985         (Layout::create_build_id): Likewise.
13986         (Layout::print_to_mapfile): New function.
13987         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13988         constructor.  Change caller.
13989         (class Layout): Declare print_to_mapfile.
13990         * output.cc (Output_section::Input_section::print_to_mapfile): New
13991         function.
13992         (Output_section::add_input_section): If producing a map, always
13993         add to input_sections_ list.
13994         (Output_section::do_print_to_mapfile): New function.
13995         (Output_segment::print_sections_to_mapfile): New function.
13996         (Output_segment::print_section_list_to_mapfile): New function.
13997         * output.h: Include "mapfile.h".
13998         (Output_data::print_to_mapfile): New function.
13999         (Output_data::do_print_to_mapfile): New virtual function.
14000         (Output_segment_headers::do_print_to_mapfile): New function.
14001         (Output_file_header::do_print_to_mapfile): New function.
14002         (Output_data_const::do_print_to_mapfile): New function.
14003         (class Output_data_const_buffer): Add map_name_ field.  Update
14004         constructor.  Change all callers.  Add do_print_to_mapfile
14005         function.
14006         (class Output_data_fixed_space): Likewise.
14007         (class Output_data_space): Likewise.
14008         (class Output_data_zero_fill): New class.
14009         (Output_data_strtab::do_print_to_mapfile): New function.
14010         (Output_data_reloc_base::do_print_to_mapfile): New function.
14011         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14012         (Output_data_group::do_print_to_mapfile): New function.
14013         (Output_data_got::do_print_to_mapfile): New function.
14014         (Output_data_dynamic::do_print_to_mapfile): New function.
14015         (Output_symtab_xindex::do_print_to_mapfile): New function.
14016         (class Output_section): Declare do_print_to_mapflie.  Declare
14017         print_to_mapfile in Input_section.
14018         (class Output_segment): Declare new functions.
14019         * object.h (Sized_relobj::symbol_count): New function.
14020         * script-sections.cc
14021         (Output_section_element_dot_assignment::set_section_addresses):
14022         Change Output_data_fixed_space to Output_data_zero_fill.
14023         (Output_data_expression::do_print_to_mapfile): New function.
14024         * script.cc (read_input_script): Add mapfile parameter.  Change
14025         all callers.
14026         * script.h (read_input_script): Update declaration.
14027         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14028         (Eh_frame::do_print_to_mapfile): New function.
14029         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14030         (Output_merge_string::do_print_to_mapfile): New function.
14031         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14032         function.
14033         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14034         function.
14035         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14036         function.
14037         * Makefile.am (CCFILES): Add mapfile.cc.
14038         (HFILES): Add mapfile.h.
14039         * Makefile.in: Rebuild.
14040
14041 2008-05-19  Ian Lance Taylor  <iant@google.com>
14042
14043         * options.h (class General_options): Add -z relro.
14044         * layout.cc (Layout::Layout): Initialize relro_segment_.
14045         (Layout::add_output_section_data): Return the output section.
14046         (Layout::make_output_section): Rcognize relro sections and mark
14047         them appropriately.
14048         (Layout::attach_allocated_section_to_segment): Put relro sections
14049         in a PT_GNU_RELRO segment.
14050         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14051         section as relro.
14052         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14053         PT_TLS segments.
14054         (Layout::linkonce_mapping): Map d.rel.ro.local to
14055         .data.rel.ro.local.
14056         (Layout::output_section_name): Us .data.rel.ro.local for any
14057         section which begins with that.
14058         * layout.h (class Layout): Update add_output_section_data
14059         declaration.  Add relro_segment_ field.
14060         * output.cc (Output_section::Output_section): Initialize is_relro_
14061         and is_relro_local_ fields.
14062         (Output_segment::add_output_section): Group relro sections.
14063         (Output_segment::is_first_section_relro): New function.
14064         (Output_segment::maximum_alignment): If there is a relro section,
14065         align the segment to the common page size.
14066         (Output_segment::set_section_addresses): Track whether we are
14067         looking at relro sections.  If the last section is a relro
14068         section, align to the common page size.
14069         (Output_segment::set_section_list_addresses): Add in_relro
14070         parameter.  Change all callers.  Align to the page size when
14071         moving from relro to non-relro section.
14072         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14073         segment.
14074         * output.h (class Output_section): Add is_relro_ and
14075         is_relro_local_ fields.
14076         (Output_section::is_relro): New function.
14077         (Output_section::set_is_relro): New function.
14078         (Output_section::is_relro_local): New function.
14079         (Output_section::set_is_relro_local): New function.
14080         (class Output_segment): Update declarations.
14081         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14082         * sparc.cc (Target_sparc::got_section): Likewise.
14083         * x86_64.cc (Target_x86_64::got_section): Likewise.
14084         * testsuite/relro_test_main.cc: New file.
14085         * testsuite/relro_test.cc: New file.
14086         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14087         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14088         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14089         (relro_test.so, relro_test_pic.o): New targets.
14090         * testsuite/Makefile.in: Rebuild.
14091
14092 2008-05-16  Ian Lance Taylor  <iant@google.com>
14093
14094         * output.cc (Output_segment::add_output_section): Remove front
14095         parameter.
14096         * output.h (class Output_segment): Remove
14097         add_initial_output_section and overloaded add_output_section.
14098         Update declaration of remaining add_output_section.
14099         * layout.cc (Layout::create_interp): Call add_output_section
14100         rather than add_initial_output_section.
14101         (Layout::finish_dynamic_section): Likewise.
14102
14103         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14104         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14105         know the dynamic type.
14106         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14107         field.  Initialize it in constructor.
14108         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14109         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14110         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14111         reloc.
14112
14113         * output.cc (Output_reloc::get_address): Change return type to
14114         Elf_Addr.
14115         * output.h (class Output_reloc): Update get_address declaration.
14116         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14117         for section addresses.
14118
14119 2008-05-09  Ian Lance Taylor  <iant@google.com>
14120
14121         PR 6493
14122         * gold.cc (gold_nomem): Use return value of write.
14123
14124 2008-05-08  Ian Lance Taylor  <iant@google.com>
14125
14126         * symtab.c (Symbol::init_base_output_data): Add version
14127         parameter.  Change all callers.
14128         (Symbol::init_base_output_segment): Likewise.
14129         (Symbol::init_base_constant): Likewise.
14130         (Symbol::init_base_undefined): Likewise.
14131         (Sized_symbol::init_output_data): Likewise.
14132         (Sized_symbol::init_output_segment): Likewise.
14133         (Sized_symbol::init_constant): Likewise.
14134         (Sized_symbol::init_undefined): Likewise.
14135         (Symbol_table::do_define_in_output_data): If the new symbol has a
14136         version, mark it as the default.
14137         (Symbol_table::do_define_in_output_segment): Likewise.
14138         (Symbol_table::do_define_as_constant): Likewise.
14139         * symtab.h (class Symbol): Update declarations.
14140         (class Sized_symbol): Likewise.
14141         * resolve.cc (Symbol::override_version): New function.
14142         (Symbol::override_base): Call override_version.
14143         (Symbol::override_base_with_special): Likewise.
14144         * testsuite/ver_script_8.script: New file.
14145         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14146         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14147         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14148         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14149
14150 2008-05-06  Ian Lance Taylor  <iant@google.com>
14151
14152         PR 6049
14153         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14154         functions.
14155         (class General_options): Remove existing --undefined, and add
14156         --no-undefined instead.  Add new --undefined as synonym for -u.
14157         * archive.cc (Archive::add_symbols): Check whether symbol was
14158         named with -u.
14159         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14160         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14161         all uses.  Add IS_UNDEFINED.  Update declarations to split
14162         different versions of init_base.  Declare init_base_undefined.
14163         (Symbol::is_defined): Handle IS_UNDEFINED.
14164         (Symbol::is_undefined): Likewise.
14165         (Symbol::is_weak_undefined): Call is_undefined.
14166         (Symbol::is_absolute): Handle IS_CONSTANT.
14167         (class Sized_symbol): Update declarations to split different
14168         versions of init.  Declare init_undefined.
14169         (class Symbol_table): Declare new functions.
14170         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14171         Change all callers.
14172         (Symbol::init_base_output_data): Likewise.
14173         (Symbol::init_base_output_segment): Likewise.
14174         (Symbol::init_base_constant): Likewise.
14175         (Symbol::init_base_undefined): New function.
14176         (Sized_symbol::init_object): Rename from init.  Change all
14177         callers.
14178         (Sized_symbol::init_output_data): Likewise.
14179         (Sized_symbol::init_output_segment): Likewise.
14180         (Sized_symbol::init_constant): Likewise.
14181         (Sized_symbol::init_undefined): New function.
14182         (Symbol_table::add_undefined_symbols_from_command_line): New
14183         function.
14184         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14185         function.
14186         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14187         (Symbol::output_section): Likewise.
14188         (Symbol::set_output_section): Likewise.
14189         (Symbol_table::sized_finalize_symbol): Likewise.
14190         (Symbol_table::sized_write_globals): Likewise.
14191         * resolve.cc (Symbol_table::should_override): Likewise.
14192         (Symbol::override_base_with_special): Likewise.
14193
14194         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14195         symbol, change it to have default visibility.
14196         * testsuite/protected_1.cc: New file.
14197         * testsuite/protected_2.cc: New file.
14198         * testsuite/protected_3.cc: New file.
14199         * testsuite/protected_main_1.cc: New file.
14200         * testsuite/protected_main_2.cc: New file.
14201         * testsuite/protected_main_3.cc: New file.
14202         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14203         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14204         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14205         (protected_1.so): New target.
14206         (protected_1_pic.o, protected_2_pic.o): New targets.
14207         (protected_3_pic.o): New target.
14208         (check_PROGRAMS): Add protected_2.
14209         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14210         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14211         * testsuite/Makefile.in: Rebuild.
14212
14213         * options.h (DEFINE_var): Add set_user_set_##varname__.
14214         (DEFINE_bool_alias): New macro.
14215         (class General_options): Define -Bstatic using DEFINE_bool_alias
14216         rather than DEFINE_special.  Add --undefined as an alias for -z
14217         defs.
14218         * options.cc (General_options::parse_Bstatic): Remove.
14219
14220         * options.h (class General_options): Add --fatal-warnings.
14221         * main.cc (main): Implement --fatal-warnings.
14222         * errors.h (Errors::warning_count): New function.
14223
14224         * options.h (class General_options): Add -Bsymbolic-functions.
14225         * symtab.h (Symbol::is_preemptible): Check for
14226         -Bsymbolic-functions.
14227
14228 2008-05-05  Ian Lance Taylor  <iant@google.com>
14229
14230         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14231         as noVARNAME rather than no-VARNAME.
14232         (class General_options): Add option -z combreloc.
14233         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14234         get_address.
14235         (Output_reloc::sort_before) [SHT_REL]: New function.
14236         (Output_reloc::sort_before) [SHT_RELA]: New function.
14237         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14238         Sort_relocs_comparison.
14239         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14240         parameter.  Change all callers.
14241         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14242         sort_relocs parameter.  Change all callers.
14243         * output.cc (Output_reloc::get_address): New function, broken out
14244         of write_rel.
14245         (Output_reloc::write_rel): Call it.
14246         (Output_reloc::compare): New function.
14247         (Output_data_reloc_base::do_write): Optionally sort relocs.
14248
14249         * configure.ac: If targ_extra_obj is set, link it in.
14250         * configure.tgt: Initialize all variables.
14251         (x86_64*): Set targ_extra_obj and targ_extra_size.
14252         * configure: Rebuild.
14253
14254         * object.cc (Sized_relobj::include_section_group): Adjust section
14255         indexes read from group data.  Build vector to pass to
14256         layout_group.
14257         * layout.cc (Layout::layout_group): Add flags and shndxes
14258         parameters.  Remove contents parameter.  Change caller.  Update
14259         explicit instantiations.
14260         * layout.h (class Layout): Update layout_group declaration.
14261         * output.cc (Output_data_group::Output_data_group): Add flags and
14262         input_shndxes parameters.  Remove contents parameter.  Change
14263         caller.
14264         (Output_data_group::do_write): Change input_sections_ to
14265         input_shndxes_.
14266         * output.h (class Output_data_group): Update constructor
14267         declaration.  Rename input_sections_ to input_shndxes_.
14268         * testsuite/many_sections_test.cc: Add template.
14269
14270 2008-04-30  Cary Coutant  <ccoutant@google.com>
14271
14272         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14273
14274         * layout.cc (Layout::include_section): Refactored check for debug
14275         info section.
14276         (Layout::add_comdat): Add new parameters.  Change type
14277         of signature parameter.  Add object and shndx to signatures table.
14278         (Layout::find_kept_object): New function.
14279         * layout.h: Include <cstring>.
14280         (Layout::is_debug_info_section): New function.
14281         (Layout::add_comdat): Add new parameters.
14282         (Layout::find_kept_object): New function.
14283         (Layout::Kept_section): New struct.
14284         (Layout::Signatures): Change type of map range.
14285         * object.cc (Relobj::output_section_address): New function.
14286         (Sized_relobj::include_section_group): Add new parameters.  Change
14287         calls to Layout::add_comdat.  Change to build table of kept comdat
14288         groups and table mapping discarded sections to kept sections.
14289         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14290         (Sized_relobj::do_layout): Change calls to include_section_group and
14291         include_linkonce_section.
14292         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14293         value to zero when section is discarded.
14294         (Sized_relobj::map_to_kept_section): New function.
14295         * object.h (Relobj::output_section_address): New function.
14296         (Relobj::Comdat_group): New type.
14297         (Relobj::find_comdat_group): New function.
14298         (Relobj::Comdat_group_table): New type.
14299         (Relobj::Kept_comdat_section): New type.
14300         (Relobj::Kept_comdat_section_table): New type.
14301         (Relobj::add_comdat_group): New function.
14302         (Relobj::set_kept_comdat_section): New function.
14303         (Relobj::get_kept_comdat_section): New function.
14304         (Relobj::comdat_groups_): New field.
14305         (Relobj::kept_comdat_sections_): New field.
14306         (Symbol_value::input_value): Update comment.
14307         (Sized_relobj::map_to_kept_section) New function.
14308         (Sized_relobj::include_linkonce_section): Add new parameter.
14309         * target-reloc.h (Comdat_behavior): New type.
14310         (get_comdat_behavior): New function.
14311         (relocate_section): Add code to map a discarded section to the
14312         corresponding kept section when applying a relocation.
14313
14314 2008-04-30  Craig Silverstein  <csilvers@google.com>
14315
14316         * dwarf_reader.cc (next_generation_count): New static var.
14317         (Addr2line_cache_entry): New struct.
14318         (addr2line_cache): New static var.
14319         (Dwarf_line_info::one_addr2line): Added caching.
14320         (Dwarf_line_info::clear_addr2line_cache): New function.
14321         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14322         cache-size parameter.
14323         (Dwarf_line_info::one_addr2line_cache): New function.
14324         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14325         new cache-size argument to one_addr2line(), and clear cache.
14326
14327 2008-04-28  Cary Coutant  <ccoutant@google.com>
14328
14329         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14330         R_386_PC8 relocations.
14331
14332 2008-04-23  Ian Lance Taylor  <iant@google.com>
14333
14334         * object.cc (Sized_relobj::include_section_group): Check for
14335         invalid section group.
14336
14337         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14338         header size.
14339
14340         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14341         than read for file header.
14342         * archive.cc (Archive::include_member): Likewise.
14343
14344 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14345
14346         * aclocal.m4: Regenerate.
14347         * configure: Regenerate.
14348
14349 2008-04-19  Ian Lance Taylor  <iant@google.com>
14350
14351         * version.cc (version_string): Bump to 1.6.
14352
14353         * testsuite/Makefile.am (many_sections_r_test): New target.
14354         (many_sections_r_test_SOURCES): Remove.
14355         (many_sections_r_test_DEPENDENCIES): Remove.
14356         (many_sections_r_test_LDFLAGS): Remove.
14357         (many_sections_r_test_LDADD): Remove.
14358
14359         * object.cc (Sized_relobj::do_add_symbols): Always pass
14360         local_symbol_count_ to add_from_relobj.
14361
14362         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14363         every thousand variables.
14364         * testsuite/Makefile.in: Rebuild.
14365
14366         * object.cc (Xindex::initialize_symtab_xindex): New function.
14367         (Xindex::read_symtab_xindex): New function.
14368         (Xindex::sym_xindex_to_shndx): New function.
14369         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14370         available.
14371         (Sized_relobj::do_initialize_xindex): New function.
14372         (Sized_relobj::do_read_symbols): Adjust section links.
14373         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14374         parameter.  Change all callers.
14375         (Sized_relobj::include_section_group): Adjust section links and
14376         symbol section indexes.
14377         (Sized_relobj::do_layout): Adjust section links.
14378         (Sized_relobj::do_count_local_symbols): Adjust section links and
14379         symbol section indexes.
14380         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14381         ordinary and special symbols.
14382         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14383         dynsym_xindex parameters.  Change all callers.  Adjust section
14384         links.  Use SHN_XINDEX when needed.
14385         (Sized_relobj::get_symbol_location_info): Adjust section links.
14386         Don't get fooled by special symbols.
14387         * object.h (class Xindex): Define.
14388         (class Object): Add xindex_ parameter.  Declare virtual functoin
14389         do_initialize_xindex.
14390         (Object::adjust_sym_shndx): New function.
14391         (Object::set_xindex): New protected function.
14392         (class Symbol_value): Add is_ordinary_shndx_ field.
14393         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14394         (Symbol_value::value): Assert ordinary section.
14395         (Symbol_value::initialize_input_to_output_map): Likewise.
14396         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14397         Change all callers.
14398         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14399         all callers.
14400         (class Sized_relobj): Update declarations.
14401         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14402         parameter.  Change all callers.
14403         (Sized_relobj::adjust_shndx): New function.
14404         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14405         field.
14406         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14407         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14408         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14409         (Sized_dynobj::read_dynsym_section): Adjust section links.
14410         (Sized_dynobj::read_dynamic): Likewise.
14411         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14412         section links.
14413         (Sized_dynobj::do_initialize_xindex): New function.
14414         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14415         do_initialize_xindex.
14416         (Sized_dynobj::adjust_shndx): New function.
14417         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14418         dynsym_xindex_ fields.
14419         (Layout::finalize): Add a call to set_section_indexes before
14420         creating the symtab sections.
14421         (Layout::set_section_indexes): Don't do anything if the section
14422         already has a section index.
14423         (Layout::create_symtab_sections): Add shnum parameter.  Change
14424         caller.  Create .symtab_shndx section if needed.
14425         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14426         caller.
14427         (Layout::allocated_output_section_count): New function.
14428         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14429         needed.
14430         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14431         fields.  Update declarations.
14432         (Layout::symtab_xindex): New function.
14433         (Layout::dynsym_xindex): New function.
14434         (class Write_symbols_task): Add layout_ field.
14435         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14436         Change caller.
14437         * output.cc (Output_section_headers::Output_section_headers): Add
14438         shstrtab_section parameter.  Change all callers.
14439         (Output_section_headers::do_sized_write): Store overflow values
14440         for section count and section string table section index in
14441         section header zero.
14442         (Output_file_header::do_sized_write): Check for overflow of
14443         section count and section string table section index.
14444         (Output_symtab_xindex::do_write): New function.
14445         (Output_symtab_xindex::endian_do_write): New function.
14446         * output.h (class Output_section_headers): Add shstrtab_section_.
14447         Update declarations.
14448         (class Output_symtab_xindex): Define.
14449         (Output_section::has_out_shndx): New function.
14450         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14451         field.
14452         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14453         Change all callers.
14454         (Sized_symbol::init): Likewise.
14455         (Symbol::output_section): Check for ordinary symbol.
14456         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14457         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14458         callers.
14459         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14460         Change all callers.  Simplify handling of symbols from sections
14461         not included in the link.
14462         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14463         distinction.
14464         (Weak_alias_sorter::operator()): Assert that symbols are
14465         ordinary.
14466         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14467         distinction.
14468         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14469         parameters.  Change all callers.
14470         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14471         symbol distinction.  Use SHN_XINDEX when needed.
14472         (Symbol_table::write_section_symbol): Add symtab_xindex
14473         parameter.  Change all callers.
14474         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14475         SHN_XINDEX when needed.
14476         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14477         declarations.
14478         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14479         (Symbol::is_defined): Check is_ordinary.
14480         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14481         (Symbol::is_absolute, Symbol::is_common): Likewise.
14482         (class Sized_symbol): Update declarations.
14483         (class Symbol_table): Update declarations.
14484         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14485         parameters.  Change all callers.
14486         (Sized_symbol::override): Likewise.
14487         (Symbol_table::override): Likewise.
14488         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14489         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14490         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14491         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14492         to be in an ordinary section.
14493         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14494         object and is_ordinary parameters.  Change all callers.
14495         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14496         Change all callers.  Don't add undefined or non-ordinary symbols
14497         to reloc_map_.
14498         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14499         Change all callers.
14500         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14501         declarations.
14502         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14503         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14504         (Sized_relobj::relocate_sections): Likewise.
14505         * target-reloc.h (scan_relocs): Adjust section symbol index.
14506         (scan_relocatable_relocs): Likewise.
14507         * i386.cc (Scan::local): Check for ordinary symbols.
14508         * sparc.cc (Scan::local): Likewise.
14509         * x86_64.cc (Scan::local): Likewise.
14510         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14511         to symbol_section_and_value.
14512         * testsuite/many_sections_test.cc: New file.
14513         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14514         (check_PROGRAMS): Add many_sections_test.
14515         (many_sections_test_SOURCES): Define.
14516         (many_sections_test_DEPENDENCIES): Define.
14517         (many_sections_test_LDFLAGS): Define.
14518         (BUILT_SOURCES): Add many_sections_define.h.
14519         (many_sections_define.h): New target.
14520         (BUILT_SOURCES): Add many_sections_check.h.
14521         (many_sections_check.h): New target.
14522         (check_PROGRAMS): Add many_sections_r_test.
14523         (many_sections_r_test_SOURCES): Define.
14524         (many_sections_r_test_DEPENDENCIES): Define.
14525         (many_sections_r_test_LDFLAGS): Define.
14526         (many_sections_r_test_LDADD): Define.
14527         (many_sections_r_test.o): New target.
14528         * testsuite/Makefile.in: Rebuild.
14529
14530 2008-04-17  Cary Coutant  <ccoutant@google.com>
14531
14532         * errors.cc (Errors::info): New function.
14533         (gold_info): New function.
14534         * errors.h (Errors::info): New function.
14535         * gold.h (gold_info): New function.
14536         * object.cc (Input_objects::add_object): Print trace output.
14537         * options.cc (options::parse_set): New function.
14538         (General_options::parse_wrap): Deleted.
14539         (General_options::General_options): Deleted initializer.
14540         * options.h (options::String_set): New typedef.
14541         (options::parse_set): New function.
14542         (DEFINE_set): New macro.
14543         (General_options::wrap): Changed to use DEFINE_set. Changed
14544         callers of any_wrap_symbols and is_wrap_symbol.
14545         (General_options::trace, General_options::trace_symbol):
14546         New options.
14547         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14548         (General_options::wrap_symbols_): Deleted.
14549         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14550
14551 2008-04-17  David S. Miller  <davem@davemloft.net>
14552
14553         * options.cc (General_options::parse_V): New function.
14554         * options.h: Add entries for -V and -Qy.
14555
14556 2008-04-17  Ian Lance Taylor  <iant@google.com>
14557
14558         * common.cc (Symbol_table::allocate_commons): Remove options
14559         parameter.  Change caller.
14560         (Symbol_table::do_allocate_commons): Remove options parameter.
14561         Change caller.  Just call do_allocate_commons_list twice.
14562         (Symbol_table::do_allocate_commons_list): New function, broken out
14563         of do_allocate_commons.
14564         * common.h (class Allocate_commons_task): Remove options_ field.
14565         Update constructor.
14566         * symtab.cc (Symbol_table::Symbol_table): Initialize
14567         tls_commons_.
14568         (Symbol_table::add_from_object): Put TLS common symbols on
14569         tls_commons_ list.
14570         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14571         which are IN_OUTPUT_DATA.
14572         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14573         allocate_commons and do_allocate_commons declarations.  Declare
14574         do_allocate_commons_list.
14575         * gold.cc (queue_middle_tasks): Update creation of
14576         Allocate_commons_task to not pass options.
14577         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14578         (TLS_TEST_C_FLAGS): New variable.
14579         (tls_test_c_pic.o): New target.
14580         (tls_test_shared.so): Link in tls_test_c_pic.o.
14581         (tls_test_c_pic_ie.o): New target.
14582         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14583         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14584         (tls_test_c.o): New target.
14585         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14586         (tls_pic_test_LDADD): Likewise.
14587         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14588         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14589         (tls_test_c_gnu2.o): New target.
14590         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14591         tls_test_c_gnu2.o.
14592         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14593         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14594         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14595         * testsuite/tls_test.cc: Include "config.h".
14596         (t_last): Call t11_last.
14597         * testsuite/tls_test.h (t11, t11_last): Declare.
14598         * testsuite/tls_test_c.c: New file.
14599         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14600         * configure.ac: Check for OpenMP support.
14601         * configure, config.in, Makefile.in: Rebuild.
14602         * testsuite/Makefile.in: Rebuild.
14603
14604 2008-04-16  Cary Coutant  <ccoutant@google.com>
14605
14606         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14607         (Target_i386::tls_base_symbol_defined_): New field.
14608         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14609         (Target_i386::Scan::global): Likewise.
14610         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14611         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14612         (Target_x86_64::tls_base_symbol_defined_): New field.
14613         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14614         (Target_x86_64::Scan::global): Likewise.
14615
14616 2008-04-16  Cary Coutant  <ccoutant@google.com>
14617
14618         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14619         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14620         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14621         building shared libraries.
14622         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14623         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14624         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14625         * testsuite/Makefile.in: Rebuild.
14626         * testsuite/weak_undef.h: New file.
14627         * testsuite/weak_undef_file1.cc: Add extra test cases.
14628         * testsuite/weak_undef_file2.cc: Likewise.
14629         * testsuite/weak_undef_test.cc: Likewise.
14630
14631 2008-04-16  David S. Miller  <davem@davemloft.net>
14632
14633         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14634         Add issued_non_pic_error_ field.  Declare check_non_pic.
14635         (Target_sparc::Scan::check_non_pic): New function.
14636         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14637         (Target_sparc::Scan::global): Likewise.
14638
14639         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14640         * configure: Rebuild.
14641
14642         * options.h (DEFINE_enable): New macro.
14643         (new_dtags): New enable option.
14644         (initfirst, interpose, loadfltr, nodefaultlib,
14645         nodelete, nodlopen, nodump): New -z options.
14646         * layout.cc (Layout:finish_dynamic_section): If new
14647         dtags enabled, emit DT_RUNPATH.  Also, emit a
14648         DT_FLAGS_1 containing any specified -z flags.
14649
14650 2008-04-16  Ian Lance Taylor  <iant@google.com>
14651
14652         * copy-relocs.cc: New file.
14653         * copy-relocs.h: New file.
14654         * reloc.cc: Remove Copy_relocs code.
14655         * reloc.h: Likewise.
14656         * reloc-types.h (struct Reloc_types) [both versions]: Add
14657         get_reloc_addend_noerror.
14658         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14659         variants of add_global which take an addend which must be zero.
14660         * i386.cc: Include "copy-relocs.h".
14661         (class Target_i386): Change type of copy_relocs_ to variable,
14662         update initializer.
14663         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14664         Change all callers.
14665         (Target_i386::do_finalize_sections): Change handling of
14666         copy_relocs_.
14667         * sparc.cc: Include "copy-relocs.h".
14668         (class Target_sparc): Change type of copy_relocs_ to variable,
14669         update initializer.
14670         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14671         Change all callers.
14672         (Target_sparc::do_finalize_sections): Change handling of
14673         copy_relocs_.
14674         * x86_64.cc: Include "copy-relocs.h".
14675         (class Target_x86_64): Change type of copy_relocs_ to variable,
14676         update initializer.
14677         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14678         class.  Change all callers.
14679         (Target_x86_64::do_finalize_sections): Change handling of
14680         copy_relocs_.
14681         * Makefile.am (CCFILES): Add copy-relocs.cc.
14682         (HFILES): Add copy-relocs.h.
14683
14684         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14685
14686         * testsuite/script_test_4.sh: Permit leading zeroes.
14687
14688 2008-04-15  Ian Lance Taylor  <iant@google.com>
14689
14690         * script-sections.cc (Script_sections::create_segments): Use
14691         header_size_adjustment even when there is enough room for the
14692         headers.
14693         * testsuite/script_test_4.sh: New file.
14694         * testsuite/script_test_4.t: New file.
14695         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14696         (check_DATA): Add script_test_4.stdout.
14697         (MOSTLYCLEANFILES): Likewise.
14698         (script_test_4): New target.
14699         (script_test_4.stdout): New target.
14700         * testsuite/Makefile.in: Rebuild.
14701
14702         * sparc.cc: Add definitions for Output_data_plt_sparc class
14703         constants.
14704
14705 2008-04-14  David S. Miller  <davem@davemloft.net>
14706
14707         * sparc.cc: New file.
14708         * Makefile.am (TARGETSOURCES): Add sparc.cc
14709         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14710         * configure.tgt: Document targ_extra_size and
14711         targ_extra_big_endian.  Add entries for sparc-* and
14712         sparc64-*.
14713         * configure.ac: Handle targ_extra_size and
14714         targ_extra_big_endian.
14715         * Makefile.in: Rebuild.
14716         * configure: Likewise.
14717         * po/POTFILES.in: Likewise.
14718         * po/gold.pot: Likewise.
14719
14720 2008-04-14  Ian Lance Taylor  <iant@google.com>
14721
14722         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14723         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14724         in the name/type/flags to section mapping.  Don't call
14725         allocate_output_section.
14726         (Layout::choose_output_section): Change parameter from adjust_name
14727         to is_input_section.  Don't permit input sections after sections
14728         are attached to segments.  Don't call allocate_output_section.
14729         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14730         not write_enable_output_section.
14731         (Layout::make_output_section): Don't push to
14732         unattached_section_list_ nor call attach_to_segment.  Call
14733         attach_section_to_segment if sections are attached.
14734         (Layout::attach_sections_to_segments): New function.
14735         (Layout::attach_section_to_segment): New function.
14736         (Layout::attach_allocated_section_to_segment): Rename from
14737         attach_to_segment.  Remove flags parameter.
14738         (Layout::allocate_output_section): Remove function.
14739         (Layout::write_enable_output_section): Remove function.
14740         * layout.h (class Layout): Update for above changes.  Add new
14741         field sections_are_attached_.
14742         * output.h (Output_section::update_flags_for_input_section): New
14743         function.
14744         * output.cc (Output_section::add_input_section): Call
14745         update_flags_for_input_section.
14746         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14747
14748 2008-04-11  Cary Coutant  <ccoutant@google.com>
14749
14750         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14751         thought unnecessary.
14752         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14753
14754 2008-04-11  Ian Lance Taylor  <iant@google.com>
14755
14756         * output.h (class Output_section_data): Remove inline definition
14757         of set_addralign.
14758         * output.cc (Output_section_data::set_addralign): New function.
14759
14760 2008-04-11  Cary Coutant  <ccoutant@google.com>
14761
14762         Add support for TLS descriptors for i386 and x86_64.
14763         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14764         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14765         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14766         GOT_TYPE_TLS_DESC.
14767         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14768         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14769         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14770         relocations.
14771         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14772         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14773         Fix problem with initial-exec relocations.
14774         (Target_i386::Relocate::relocate_tls): Likewise.
14775         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14776         relaxation.
14777         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14778         support for section-plus-offset dynamic table entries.
14779         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14780         (Output_data_dynamic::Dynamic_entry): Add support for
14781         section-plus-offset dynamic table entries.
14782         (Output_data_dynamic::Classification): Likewise.
14783         (Output_data_dynamic::classification_): Renamed offset_.
14784         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14785         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14786         (Target_x86_64::make_plt_section): New function.
14787         (Target_x86_64::reserve_tlsdesc_entries): New function.
14788         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14789         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14790         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14791         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14792         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14793         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14794         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14795         add extra PLT entry for TLS descriptors.
14796         (Output_data_plt_x86_64::got_): New field.
14797         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14798         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14799         fields.
14800         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14801         descriptors.
14802         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14803         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14804         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14805         R_386_TLS_DESC_CALL relocations.
14806         (Target_x86_64::Scan::global): Likewise.
14807         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14808         for TLS descriptors.
14809         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14810         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14811         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14812         GD-to-IE relaxation.
14813         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14814         and TLS_DESCRIPTORS.
14815         * Makefile.in: Rebuild.
14816         * configure: Rebuild.
14817         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14818         (tls_test_shared2.so): New target.
14819         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14820         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14821         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14822         (tls_shared_gd_to_ie_test_LDADD): New variable.
14823         (tls_shared_gnu2_gd_to_ie_test): New target.
14824         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14825         New targets.
14826         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14827         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14828         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14829         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14830         (tls_shared_gnu2_test): New target.
14831         (tls_test_gnu2_shared.so): New target.
14832         (tls_shared_gnu2_test_SOURCES): New variable.
14833         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14834         (tls_shared_gnu2_test_LDFLAGS): New variable.
14835         (tls_shared_gnu2_test_LDADD): New variable.
14836         * testsuite/Makefile.in: Rebuild.
14837         * testsuite/Makefile.
14838
14839 2008-04-11  Ian Lance Taylor  <iant@google.com>
14840
14841         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14842         justsyms.t.
14843         * testsuite/Makefile.in: Rebuild.
14844
14845         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14846         long.
14847         * testsuite/script_test_2.cc (main): Adjust test.
14848
14849 2008-04-11  David S. Miller  <davem@davemloft.net>
14850             Ian Lance Taylor  <iant@google.com>
14851
14852         * options.h (General_options): Add entries for '-Y' and
14853         '-relax'.
14854         * options.cc (General_options:finalize): If -Y was used, add those
14855         entries to the library path instead of the default "/lib" and
14856         "/usr/lib".
14857
14858 2008-04-11  David S. Miller  <davem@davemloft.net>
14859
14860         * testsuite/justsyms.t: Start at 0x100.
14861         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14862         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14863         long.
14864         * testsuite/script_test_2.cc: Adjust string and section length
14865         checks.
14866
14867 2008-04-09  Ian Lance Taylor  <iant@google.com>
14868
14869         PR gold/5996
14870         * script-sections.cc (Sections_element::allocate_to_segment): Add
14871         orphan parameter.
14872         (Output_section_definition::allocate_to_segment): Likewise.
14873         (Orphan_output_section::allocate_to_segment): Likewise.
14874         (Script_sections::attach_sections_using_phdrs_clause): Don't
14875         propagate non-PT_LOAD segments to orphan sections.
14876         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14877         readelf rather than objdump.
14878         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14879         .interp section and PT_INTERP segment are the same size.
14880         * testsuite/Makefile.in: Rebuild.
14881
14882         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14883         aliases for symbols defined in the same object.
14884         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14885         (weak_alias_test_SOURCES): New variable.
14886         (weak_alias_test_DEPENDENCIES): New variable.
14887         (weak_alias_test_LDFLAGS): New variable.
14888         (weak_alias_test_LDADD): New variable.
14889         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14890         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14891         (weak_alias_test_3.o): New target.
14892         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14893         * testsuite/weak_alias_test_main.cc: New file.
14894         * testsuite/weak_alias_test_1.cc: New file.
14895         * testsuite/weak_alias_test_2.cc: New file.
14896         * testsuite/weak_alias_test_3.cc: New file.
14897
14898 2008-04-08  Ian Lance Taylor  <iant@google.com>
14899
14900         * options.h (class General_options): Add --noinhibit-exec option.
14901         * main.cc (main): Check --noinhibit-exec.
14902
14903         * options.h (class General_options): Define --wrap as a special
14904         option.  Add wrap_symbols_ field.
14905         (General_options::any_wrap_symbols): New function.
14906         (General_options::is_wrap_symbol): New function.
14907         * options.cc (General_options::parse_wrap): New function.
14908         (General_options::General_options): Initialize wrap_symbols_.
14909         * symtab.cc (Symbol_table::wrap_symbol): New function.
14910         (Symbol_table::add_from_object): Handle --wrap.
14911         * symtab.h (class Symbol_table): Declare wrap_symbol.
14912         * target.h (Target::wrap_char): New function.
14913         (Target::Target_info): Add wrap_char field.
14914         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14915         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14916         * testsuite/testfile.cc (Target_test::test_target_info):
14917         Likewise.
14918
14919         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14920         there is one.
14921
14922         * layout.h (class Layout): Add added_eh_frame_data_ field.
14923         * layout.cc (Layout::Layout): Initialize new field.
14924         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14925         output section until we find a section we merged successfully.
14926         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14927         that the size be non-zero.
14928
14929         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14930         qualifier.
14931
14932 2008-04-08  Craig Silverstein  <csilvers@google.com>
14933
14934         * configure.ac: Export new conditional variable HAVE_ZLIB.
14935         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14936         on HAVE_ZLIB.
14937         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14938         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14939
14940 2008-04-07  Ian Lance Taylor  <iant@google.com>
14941
14942         * version.cc (version_string): Set to "1.5".
14943
14944         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14945         Add issued_non_pic_error_ field.  Declare check_non_pic.
14946         (Target_x86_64::Scan::check_non_pic): New function.
14947         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14948         (Target_x86_64::Scan::global): Likewise.
14949
14950         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14951         addend parameter.  Change caller.  Handle merge sections.
14952         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14953         Address to Addend.  Don't add in the result of
14954         local_section_offset, pass down the addend and use the returned
14955         value.
14956         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14957         Update declarations of local_section_offset and symbol_value.
14958         * testsuite/two_file_test_1.cc (t18): New function.
14959         * testsuite/two_file_test_2.cc (f18): New function.
14960         * testsuite/two_file_test_main.cc (main): Call t18.
14961         * testsuite/two_file_test.h (t18, f18): Declare.
14962
14963         * configure.ac: Don't test for objdump, c++filt, or readelf.
14964         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14965         conditionals.
14966         (TEST_READELF): New variable.
14967         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14968         (check_PROGRAMS): Add two_file_strip_test.
14969         (two_file_strip_test): New target.
14970         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14971         (two_file_same_shared_strip_test_SOURCES): New variable.
14972         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14973         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14974         (two_file_same_shared_strip_test_LDADD): New variable.
14975         (two_file_shared_strip.so): New target.
14976         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14977         (ver_test_5.syms, ver_test_7.syms): Likewise.
14978         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14979         (strip_test_3.stdout): Use TEST_OBJDUMP.
14980         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14981
14982 2008-04-04  Cary Coutant  <ccoutant@google.com>
14983
14984         * symtab.h (Symbol::is_weak_undefined): New function.
14985         (Symbol::is_strong_undefined): New function.
14986         (Symbol::is_absolute): New function.
14987         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14988         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14989         absolute symbols.
14990         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14991         (weak_undef_test): New target.
14992         * testsuite/Makefile.in: Rebuild.
14993         * testsuite/weak_undef_file1.cc: New file.
14994         * testsuite/weak_undef_file2.cc: New file.
14995         * testsuite/weak_undef_test.cc: New file.
14996
14997 2008-04-03  Craig Silverstein  <csilvers@google.com>
14998
14999         * compressed_output.h (class Output_compressed_section): Use
15000         unsigned buffer.
15001         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15002         add zlib header.
15003         (zlib_compressed_suffix): Removed.
15004         (Output_compressed_section::set_final_data_size): Use unsigned
15005         buffers.
15006         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15007         Fix linker invocation.
15008         (flagstest_o_specialfile_and_compress_debug_sections):
15009         Likewise.
15010         * testsuite/Makefile.in: Regenerated.
15011
15012 2008-04-02  David S. Miller  <davem@davemloft.net>
15013
15014         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15015         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15016
15017 2008-04-02  Craig Silverstein  <csilvers@google.com>
15018
15019         * TODO: New file.
15020
15021 2008-04-02  Ian Lance Taylor  <iant@google.com>
15022
15023         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15024         parameters.  Update for new key type to views_.  Change all
15025         callers.
15026         (File_read::read): Adjust for byteshift in returned view.
15027         (File_read::add_view): New function, broken out of
15028         find_and_make_view.
15029         (File_read::make_view): New function, broken out of
15030         find_and_make_view.
15031         (File_read::find_or_make_view): Add offset and aligned
15032         parameters.  Rewrite accordingly.  Change all callers.
15033         (File_read::get_view): Add offset and aligned parameters.  Adjust
15034         for byteshift in return value.
15035         (File_read::get_lasting_view): Likewise.
15036         * fileread.h (class File_read): Update declarations.
15037         (class File_read::View): Add byteshift_ field.  Add byteshift to
15038         constructor.  Add byteshift method.
15039         * archive.h (Archive::clear_uncached_views): New function.
15040         (Archive::get_view): Add aligned parameter.  Change all callers.
15041         * object.h (Object::get_view): Add aligned parameter.  Change all
15042         callers.
15043         (Object::get_lasting_view): Likewise.
15044
15045         * fileread.cc (File_read::release): Don't call clear_views if
15046         there are multiple objects.
15047         * fileread.h (File_read::clear_uncached_views): New function.
15048         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15049         on the archive.
15050
15051 2008-03-31  Cary Coutant  <ccoutant@google.com>
15052
15053         Add thin archive support.
15054         * archive.cc (Archive::armagt): New const.
15055         (Archive::setup): Remove task parameter and calls to unlock.
15056         (Archive::unlock_nested_archives): New function.
15057         (Archive::read_header): Add nested_off parameter. Change
15058         all callers.
15059         (Archive::interpret_header): Likewise.
15060         (Archive::include_all_members): Change to handle thin
15061         archives.
15062         (Archive::include_member): Likewise.
15063         * archive.h (Archive::Archive): Add new parameters and
15064         initializers.
15065         (Archive::armagt): New const.
15066         (Archive::setup): Remove task parameter.
15067         (Archive::unlock_nested_archives): New function.
15068         (Archive::read_header): Add nested_off parameter.
15069         (Archive::interpret_header): Likewise.
15070         (Archive::Nested_archive_table): New typedef.
15071         (Archive::is_thin_archive_): New field.
15072         (Archive::nested_archives_): New field.
15073         (Archive::options_): New field.
15074         (Archive::dirpath_): New field.
15075         (Archive::task_): New field.
15076         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15077         for thin archives.  Pass additional parameters to
15078         Archive::Archive.  Unlock the archive file after calling
15079         Archive::setup.
15080
15081 2008-03-29  Ian Lance Taylor  <iant@google.com>
15082
15083         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15084         version symbol to be local.
15085         * testsuite/ver_test_4.sh: New file.
15086         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15087         (check_DATA): Add ver_test_4.syms.
15088         (ver_test_4.syms): New target.
15089         * testsuite/Makefile.in: Rebuild.
15090
15091         * output.cc
15092         (Output_section::Input_section_sort_entry::has_priority): New
15093         function.
15094         (Output_section::Input_section_sort_entry::match_file_name): New
15095         function.
15096         (Output_section::Input_section_sort_entry::match_section_name):
15097         Remove.
15098         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15099         Remove.
15100         (Output_section::Input_section_sort_entry::match_section_file):
15101         Remove.
15102         (Output_section::Input_section_sort_compare::operator()): Rewrite
15103         using new Input_section_sort_entry functions.  Sort crtbegin and
15104         crtend first.  Sort sections with no priority before sections with
15105         a priority.
15106         * testsuite/initpri1.c (d3): Check j != 4.
15107         (cd5): New constructor/destructor function.
15108         (main): Check j != 2.
15109
15110         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15111         new symbol when resolving, don't call set_is_default.
15112         * testsuite/ver_test_7.cc: New file.
15113         * testsuite/ver_test_7.sh: New file.
15114         * testsuite/Makefile.am (ver_test_7.so): New target.
15115         (ver_test_7.o): New target.
15116         (check_SCRIPTS): Add ver_test_7.sh.
15117         (check_DATA): Add ver_test_7.syms.
15118         (ver_test_7.syms): New target.
15119
15120 2008-03-28  Ian Lance Taylor  <iant@google.com>
15121
15122         * layout.cc (Layout::layout): If we see an input section with a
15123         name that needs sorting, set the must_sort flag for the output
15124         section.
15125         (Layout::make_output_section): If the name of the output section
15126         indicates that it might require sorting, set the may_sort flag.
15127         * output.h (Output_section::may_sort_attached_input_sections): New
15128         function.
15129         (Output_section::set_may_sort_attached_input_sections): New
15130         function.
15131         (Output_section::must_sort_attached_input_sections): New
15132         function.
15133         (Output_section::set_must_sort_attached_input_sections): New
15134         function.
15135         (class Output_section): Declare Input_section_sort_entry.  Define
15136         Input_section_sort_compare.  Declare
15137         sort_attached_input_sections.  Add new fields:
15138         may_sort_attached_input_sections_,
15139         must_sort_attached_input_sections_,
15140         attached_input_sections_are_sorted_.
15141         * output.cc (Output_section::Output_section): Initialize new
15142         fields.
15143         (Output_section::add_input_section): Add an entry to
15144         input_sections_ if may_sort or must_sort are true.
15145         (Output_section::set_final_data_size): Call
15146         sort_attached_input_sections if necessary.
15147         (Output_section::Input_section_sort_entry): Define new class.
15148         (Output_section::Input_section_sort_compare::operator()): New
15149         function.
15150         (Output_section::sort_attached_input_sections): New function.
15151         * configure.ac: Check whether the compiler supports constructor
15152         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15153         * testsuite/initpri1.c: New file.
15154         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15155         CONSTRUCTOR_PRIORITY.
15156         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15157         (initpri1_LDFLAGS): New variable.
15158         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15159
15160 2008-03-27  Ian Lance Taylor  <iant@google.com>
15161
15162         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15163         * testsuite/common_test_1.c: New file.
15164         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15165         (common_test_1_SOURCES): New variable.
15166         (common_test_1_DEPENDENCIES): New variable.
15167         (common_test_1_LDFLAGS): New variable.
15168
15169         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15170         and commons_ correctly when NAME/VERSION does not override
15171         NAME/NULL.
15172         * testsuite/ver_test_6.c: New file.
15173         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15174         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15175         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15176
15177 2008-03-26  Ian Lance Taylor  <iant@google.com>
15178
15179         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15180         of an undefined symbol from a version script.
15181         * testsuite/Makefile.am (ver_test_5.so): New target.
15182         (ver_test_5.o): New target.
15183         (check_SCRIPTS): Add ver_test_5.sh.
15184         (check_DATA): Add ver_test_5.syms.
15185         (ver_test_5.syms): New target.
15186         * testsuite/ver_test_5.cc: New file.
15187         * testsuite/ver_test_5.script: New file.
15188         * testsuite/ver_test_5.sh: New file.
15189         * Makefile.in, testsuite/Makefile.in: Rebuild.
15190
15191         PR gold/5986
15192         Fix problems building gold with gcc 4.3.0.
15193         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15194         (gold_error_at_location, gold_warning_at_location): Use it.
15195         * configure.ac: Check whether we can compile and use a template
15196         function with a printf attribute.
15197         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15198         when jumping over bytes.
15199         * object.cc: Instantiate Object::read_section_data.
15200         * debug.h: Include <cstring>
15201         * dwarf_reader.cc: Include <algorithm>
15202         * main.cc: Include <cstring>.
15203         * options.cc: Include <cstring>.
15204         * output.cc: Include <cstring>.
15205         * script.cc: Include <cstring>.
15206         * script.h: Include <string>.
15207         * symtab.cc: Include <cstring> and <algorithm>.
15208         * target-select.cc: Include <cstring>.
15209         * version.cc: Include <string>.
15210         * testsuite/testmain.cc: Include <cstdlib>.
15211         * configure, config.in: Rebuild.
15212
15213 2008-03-25  Ian Lance Taylor  <iant@google.com>
15214
15215         * options.cc: Include "../bfd/bfdver.h".
15216         (options::help): Print bug reporting address.
15217
15218         * version.cc (print_version): Adjust output for current value of
15219         BFD_VERSION_STRING.
15220
15221         * NEWS: New file.
15222
15223         * options.cc (options::help): Print list of supported targets.
15224         * target-select.h: Include <vector>.
15225         (class Target_selector): Make machine_, size_, and is_big_endian_
15226         fields const.  Add bfd_name_ and instantiated_target_ fields.
15227         (Target_selector::Target_selector): Add bfd_name parameter.
15228         (Target_selector::recognize): Make non-virtual, call
15229         do_recognize.
15230         (Target_selector::recognize_by_name): Make non-virtual, call
15231         do_recognize_by_name.
15232         (Target_selector::supported_names): New function.
15233         (Target_selector::bfd_name): New function.
15234         (Target_selector::do_instantiate_target): New pure virtual
15235         function.
15236         (Target_selector::do_recognize): New virtual function.
15237         (Target_selector::do_recognize_by_name): New virtual function.
15238         (Target_selector::instantiate_target): New private function.
15239         (supported_target_names): Declare.
15240         * target-select.cc (Target_selector::Target_selector): Update for
15241         new parameter and fields.
15242         (select_target_by_name): Check that the name matches before
15243         calling recognize_by_name.
15244         (supported_target_names): New function.
15245         * i386.cc (class Target_selector_i386): Update Target_selector
15246         constructor call.  Remove recognize and recognize_by_name.  Add
15247         do_instantiate_target.
15248         * x86_64.cc (class Target_selector_x86_64): Likewise.
15249         * testsuite/testfile.cc (class Target_selector_test): Update for
15250         changes to Target_selector.
15251
15252         * README: Rewrite, with some notes on unsupported features.
15253
15254 2008-03-24  Cary Coutant  <ccoutant@google.com>
15255
15256         * i386.cc (Target_i386::Got_type): New enum declaration.
15257         (Target_i386::Scan::local): Updated callers of Output_data_got
15258         member functions.
15259         (Target_i386::Scan::global): Likewise.
15260         (Target_i386::Relocate::relocate): Likewise.
15261         (Target_i386::Relocate::relocate_tls): Likewise.
15262         * object.h (Got_offset_list): New class.
15263         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15264         (Sized_relobj::local_got_offset): Likewise.
15265         (Sized_relobj::set_local_got_offset): Likewise.
15266         (Sized_relobj::local_has_tls_got_offset): Removed.
15267         (Sized_relobj::local_tls_got_offset): Removed.
15268         (Sized_relobj::set_local_tls_got_offset): Removed.
15269         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15270         * output.cc (Output_data_got::add_global): Added got_type parameter.
15271         (Output_data_got::add_global_with_rel): Likewise.
15272         (Output_data_got::add_global_with_rela): Likewise.
15273         (Output_data_got::add_global_pair_with_rel): New function.
15274         (Output_data_got::add_global_pair_with_rela): New function.
15275         (Output_data_got::add_local): Added got_type parameter.
15276         (Output_data_got::add_local_with_rel): Likewise.
15277         (Output_data_got::add_local_with_rela): Likewise.
15278         (Output_data_got::add_local_pair_with_rel): New function.
15279         (Output_data_got::add_local_pair_with_rela): New function.
15280         (Output_data_got::add_global_tls): Removed.
15281         (Output_data_got::add_global_tls_with_rel): Removed.
15282         (Output_data_got::add_global_tls_with_rela): Removed.
15283         (Output_data_got::add_local_tls): Removed.
15284         (Output_data_got::add_local_tls_with_rel): Removed.
15285         (Output_data_got::add_local_tls_with_rela): Removed.
15286         * output.h (Output_data_got::add_global): Added got_type parameter.
15287         (Output_data_got::add_global_with_rel): Likewise.
15288         (Output_data_got::add_global_with_rela): Likewise.
15289         (Output_data_got::add_global_pair_with_rel): New function.
15290         (Output_data_got::add_global_pair_with_rela): New function.
15291         (Output_data_got::add_local): Added got_type parameter.
15292         (Output_data_got::add_local_with_rel): Likewise.
15293         (Output_data_got::add_local_with_rela): Likewise.
15294         (Output_data_got::add_local_pair_with_rel): New function.
15295         (Output_data_got::add_local_pair_with_rela): New function.
15296         (Output_data_got::add_global_tls): Removed.
15297         (Output_data_got::add_global_tls_with_rel): Removed.
15298         (Output_data_got::add_global_tls_with_rela): Removed.
15299         (Output_data_got::add_local_tls): Removed.
15300         (Output_data_got::add_local_tls_with_rel): Removed.
15301         (Output_data_got::add_local_tls_with_rela): Removed.
15302         * resolve.cc (Symbol::override_base_with_special): Removed
15303         reference to has_got_offset_ field.
15304         * symtab.cc (Symbol::init_fields): Replaced initialization
15305         of got_offset_ with got_offsets_.  Removed initialization
15306         of has_got_offset_
15307         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15308         (Symbol::got_offset): Likewise.
15309         (Symbol::set_got_offset): Likewise.
15310         (Symbol::has_tls_got_offset): Removed.
15311         (Symbol::tls_got_offset): Removed.
15312         (Symbol::set_tls_got_offset): Removed.
15313         (Symbol::got_offset_): Removed.
15314         (Symbol::tls_mod_got_offset_): Removed.
15315         (Symbol::tls_pair_got_offset_): Removed.
15316         (Symbol::got_offsets_): New field.
15317         (Symbol::has_got_offset): Removed.
15318         (Symbol::has_tls_mod_got_offset): Removed.
15319         (Symbol::has_tls_pair_got_offset): Removed.
15320         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15321         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15322         member functions.
15323         (Target_x86_64::Scan::global): Likewise.
15324         (Target_x86_64::Relocate::relocate): Likewise.
15325         (Target_x86_64::Relocate::relocate_tls): Likewise.
15326
15327 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15328
15329         * yyscript.y: Fix spelling error in comment.
15330
15331 2008-03-24  Ian Lance Taylor  <iant@google.com>
15332
15333         * options.h (class General_options): Define build_id option.
15334         * layout.h (class Layout): Declare write_build_id, create_note,
15335         create_build_id.  Add build_id_note_ member.
15336         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15337         "libiberty.h", "md5.h", "sha1.h".
15338         (Layout::Layout): Initialize eh_frame_data_,
15339         eh_frame_hdr_section_, and build_id_note_.
15340         (Layout::finalize): Call create_build_id.
15341         (Layout::create_note): New function, broken out of
15342         Layout::create_gold_note.
15343         (Layout::create_gold_note): Call create_note.
15344         (Layout::create_build_id): New function.
15345         (Layout::write_build_id): New function.
15346         (Close_task_runner::run): Call write_build_id.
15347
15348         * x86_64.cc: Correct license to GPLv3.
15349
15350 2008-03-23  Ian Lance Taylor  <iant@google.com>
15351
15352         * options.cc: Include "demangle.h".
15353         (parse_optional_string): New function.
15354         (parse_long_option): Handle takes_optional_argument.
15355         (parse_short_option): Update dash_z initializer.  Handle
15356         takes_optional_argument.
15357         (General_options::General_options): Initialize do_demangle_.
15358         (General_options::finalize): Set do_demangle_.  Handle demangling
15359         style.
15360         * options.h (parse_optional_string): Declare.
15361         (struct One_option): Add optional_arg field.  Update constructor.
15362         Update call constructor calls.  Add takes_optional_argument
15363         function.
15364         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15365         (DEFINE_optional_string): Define.
15366         (General_options::demangle): Change from DEFINE_bool to
15367         DEFINE_optional_string.
15368         (General_options::no_demangle): New function.
15369         (General_options::do_demangle): New function.
15370         (General_options::set_do_demangle): New function.
15371         (General_options::execstack_status_): Move definition to end of
15372         class definition.
15373         (General_options::static_): Likewise.
15374         (General_options::do_demangle_): New field.
15375         * object.cc (big_endian>::get_symbol_location_info): Call
15376         Options::do_demangle, not Options::demangle.
15377         * symtab.cc (demangle): Likewise.
15378
15379 2008-03-22  Ian Lance Taylor  <iant@google.com>
15380
15381         * gold.h: Include <cstddef> and <sys/types.h>
15382         * options.h: Include <cstring>.
15383
15384 2008-03-21  Ian Lance Taylor  <iant@google.com>
15385
15386         * Added source code to GNU binutils.
15387 \f
15388 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15389
15390 Copying and distribution of this file, with or without modification,
15391 are permitted in any medium without royalty provided the copyright
15392 notice and this notice are preserved.
15393
15394 Local Variables:
15395 mode: change-log
15396 left-margin: 8
15397 fill-column: 74
15398 version-control: never
15399 End: