* common.cc (Symbol_table::do_allocate_commons_list): Call
[external/binutils.git] / gold / ChangeLog
1 2011-06-07  Cary Coutant  <ccoutant@google.com>
2
3         * common.cc (Symbol_table::do_allocate_commons_list): Call
4         gold_fallback.
5         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6         (Errors::fallback): New function.
7         (gold_fallback): New function.
8         * errors.h (Errors::fallback): New function.
9         * gold.cc (gold_exit): Change status parameter to enum; adjust
10         all callers.
11         (queue_initial_tasks): Call gold_fallback.
12         * gold.h: Include cstdlib.
13         (Exit_status): New enum type.
14         (gold_exit): Change status parameter to enum.
15         (gold_fallback): New function.
16         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
17         (Layout::create_symtab_sections): Likewise.
18         (Layout::create_shdrs): Likewise.
19         * main.cc (main): Adjust call to gold_exit.
20         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
21         (Output_data_got::add_got_entry_pair): Likewise.
22         (Output_section::add_input_section): Likewise.
23         (Output_section::add_output_section_data): Likewise.
24         (Output_segment::set_section_list_addresses): Likewise.
25         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
26
27 2011-06-07  Cary Coutant  <ccoutant@google.com>
28
29         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
30         for incremental links.
31         * output.cc (Output_segment::set_section_list_addresses): Remove
32         FIXME and test for TLS or BSS.
33
34 2011-06-07  Cary Coutant  <ccoutant@google.com>
35
36         * testsuite/Makefile.am: Add incremental_copy_test,
37         incremental_common_test_1.
38         * testsuite/Makefile.in: Regenerate.
39         * testsuite/common_test_1_v1.c: New source file.
40         * testsuite/common_test_1_v2.c: New source file.
41         * testsuite/copy_test_v1.cc: New source file.
42
43 2011-06-07  Cary Coutant  <ccoutant@google.com>
44
45         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
46         update, allocate common from bss section's free list.
47         * incremental-dump.cc (dump_incremental_inputs): Print flag for
48         linker-defined symbols.
49         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
50         Skip GOT and PLT entries that are no longer referenced.
51         (Output_section_incremental_inputs::write_info_blocks): Mark
52         linker-defined symbols.
53         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
54         * output.cc (Output_section::allocate): New function.
55         * output.h (Output_section::allocate): New function.
56         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
57         linker-defined symbols.
58         (Symbol::override_base_with_special): Copy is_predefined_ flag.
59         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
60         (Symbol::init_base_output_data): Likewise.
61         (Symbol::init_base_output_segment): Likewise.
62         (Symbol::init_base_constant): Likewise.
63         (Sized_symbol::init_output_data): Likewise.
64         (Sized_symbol::init_output_segment): Likewise.
65         (Sized_symbol::init_constant): Likewise.
66         (Symbol_table::do_define_in_output_data): Likewise.
67         (Symbol_table::do_define_in_output_segment): Likewise.
68         (Symbol_table::do_define_as_constant): Likewise.
69         * symtab.h (Symbol::is_predefined): New function.
70         (Symbol::init_base_output_data): Add is_predefined parameter.
71         (Symbol::init_base_output_segment): Likewise.
72         (Symbol::init_base_constant): Likewise.
73         (Symbol::is_predefined_): New data member.
74         (Sized_symbol::init_output_data): Add is_predefined parameter.
75         (Sized_symbol::init_output_segment): Likewise.
76         (Sized_symbol::init_constant): Likewise.
77         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
78
79 2011-06-07  Cary Coutant  <ccoutant@google.com>
80
81         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
82         instead of emit_copy_reloc.
83         (Copy_relocs::emit_copy_reloc): Refactor.
84         (Copy_relocs::make_copy_reloc): New function.
85         (Copy_relocs::add_copy_reloc): Remove.
86         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
87         section.
88         (Copy_relocs::make_copy_reloc): New function.
89         (Copy_relocs::add_copy_reloc): Remove.
90         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
91         unchanged input files.
92         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
93         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
94         Reserve BSS space for COPY relocations.
95         (Sized_incremental_binary::do_emit_copy_relocs): New function.
96         (Output_section_incremental_inputs::write_info_blocks): Record
97         whether a symbol is copied from a shared object.
98         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
99         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
100         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
101         (Incremental_input_entry_reader::get_output_symbol_index): Add
102         is_copy parameter.
103         (Incremental_binary::emit_copy_relocs): New function.
104         (Incremental_binary::do_emit_copy_relocs): New function.
105         (Sized_incremental_binary::Sized_incremental_binary): Initialize
106         new data member.
107         (Sized_incremental_binary::add_copy_reloc): New function.
108         (Sized_incremental_binary::do_emit_copy_relocs): New function.
109         (Sized_incremental_binary::Copy_reloc): New struct.
110         (Sized_incremental_binary::Copy_relocs): New typedef.
111         (Sized_incremental_binary::copy_relocs_): New data member.
112         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
113         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
114         * target.h (Sized_target::emit_copy_reloc): New function.
115         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
116
117 2011-06-02  Cary Coutant  <ccoutant@google.com>
118
119         PR gold/12163
120         * gold/archive.cc (Archive::Archive): Initialize new data member.
121         (Archive::include_all_members): Return if archive has already been
122         included.
123         * gold/archive.h (Archive::include_all_members_): New data member.
124
125 2011-06-02  Nick Clifton  <nickc@redhat.com>
126
127         * dynobj.h: Fix spelling mistake in comment.
128         * output.cc: Likewise.
129
130 2011-05-31  Doug Kwan  <dougkwan@google.com>
131             Asier Llano
132
133         PR gold/12826
134         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
135         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
136         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
137         redundant arm_exidx_test.so.
138         * testsuite/Makefile.in: Regenerate.
139         (check_SCRIPTS): Add pr12826.sh
140         (check_DATA): Add pr12826.stdout
141         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
142         * testsuite/pr12826.sh: New file.
143         * testsuite/pr12826_1.s: Ditto.
144         * testsuite/pr12826_1.s: Ditto.
145
146 2011-05-30  Ian Lance Taylor  <iant@google.com>
147
148         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
149         sections.
150
151 2011-05-29  Ian Lance Taylor  <iant@google.com>
152
153         PR gold/12804
154         * testsuite/Makefile.am: Use different file name for two_file_test
155         temporary file for each incremental test.
156         * testsuite/Makefile.in: Rebuild.
157
158 2011-05-29  Ian Lance Taylor  <iant@google.com>
159
160         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
161         binary input file is empty.
162
163 2011-05-27  Ian Lance Taylor  <iant@google.com>
164
165         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
166         (ver_test_9.so): Likewise.
167         * testsuite/Makefile.in: Rebuild.
168
169 2011-05-26 Cary Coutant  <ccoutant@google.com>
170
171         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
172         * incremental.cc (Incremental_inputs::report_input_section): Fix
173         comment, indentation.
174         (Incremental_inputs::report_comdat_group): New function.
175         (Output_section_incremental_inputs::set_final_data_size): Adjust size
176         of data for incremental input file entry.
177         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
178         group count, COMDAT group signatures.
179         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
180         an unchanged input file.
181         * incremental.h (Incremental_object_entry::Incremental_object_entry):
182         Initialize new data member.
183         (Incremental_object_entry::add_comdat_group): New function.
184         (Incremental_object_entry::get_comdat_group_count): New function.
185         (Incremental_object_entry::get_comdat_signature_key): New function.
186         (Incremental_object_entry::groups_): New data member.
187         (Incremental_inputs::report_comdat_group): New function.
188         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
189         data for incremental input file entry.
190         (Incremental_input_entry_reader::get_comdat_group_count): New function.
191         (Incremental_input_entry_reader::get_input_section): Adjust size of
192         data for incremental input file entry.
193         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
194         (Incremental_input_entry_reader::get_comdat_group_signature): New
195         function.
196         * object.cc (Sized_relobj::include_section_group): Report kept
197         COMDAT groups for incremental links.
198
199 2011-05-24  David Meyer  <pdox@google.com>
200
201         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
202         with name parameter.  Add found_name parameter.
203         * fileread.cc (Input_file::find_file): Adjust code accordingly.
204         * dirsearch.h (class Dirsearch): Update declaration.
205
206 2011-05-24  Ian Lance Taylor  <iant@google.com>
207
208         * archive.cc (Library_base::should_include_member): Pull in object
209         from archive if it defines the entry symbol.
210         * parameters.cc (Parameters::entry): New function.
211         * parameters.h (class Parameters): Declare entry.
212         * output.h (class Output_file_header): Remove entry_ field.
213         * output.cc (Output_file_header::Output_file_header): Remove entry
214         parameter.  Change all callers.
215         (Output_file_header::entry): Use parameters->entry.
216         * gold.cc (queue_middle_tasks): Likewise.
217         * plugin.cc (Plugin_hook::run): Likewise.
218
219 2011-05-24 Cary Coutant  <ccoutant@google.com>
220
221         * gold.cc (queue_initial_tasks): Pass incremental base filename
222         to Output_file::open_base_file; don't print error message.
223         * incremental-dump.cc (main): Adjust call to
224         Output_file::open_for_modification.
225         * incremental-dump.cc (main): Likewise.
226         * incremental.cc (Incremental_inputs::report_command_line):
227         Ignore --incremental-base option when comparing command lines.
228         Ignore parameter when given as separate argument.
229         * options.h (class General_options): Add --incremental-base.
230         * output.cc (Output_file::Output_file):
231         (Output_file::open_base_file): Add base_name and writable parameters;
232         read base file into new file; print error message here.
233         (Output_file::map_no_anonymous): Add writable parameter; adjust all
234         callers.
235         * output.h (Output_file::open_for_modification): Rename to...
236         (Output_file::open_base_file): ...this; add base_name and
237         writable parameters; adjust all callers.
238         (Output_file::map_no_anonymous): Add writable parameter; adjust all
239         callers.
240         * testsuite/Makefile.am (incremental_test_4): Test
241         --incremental-base.
242         * testsuite/Makefile.in: Regenerate.
243
244 2011-05-24 Cary Coutant  <ccoutant@google.com>
245
246         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
247         incremental_test_4.
248         * testsuite/Makefile.in: Regenerate.
249         * testsuite/two_file_test_1_v1.cc: New test source file.
250         * testsuite/two_file_test_1b_v1.cc: New test source file.
251         * testsuite/two_file_test_2_v1.cc: New test source file.
252
253 2011-05-24 Cary Coutant  <ccoutant@google.com>
254
255         * dynobj.h (Dynobj::do_dynobj): New function.
256         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
257         flag and soname for shared objects.
258         * incremental.cc (Incremental_inputs::report_object): Make
259         either Incremental_object_entry or Incremental_dynobj_entry; add
260         soname to string table.
261         (Incremental_inputs::report_input_section): Add assertion.
262         (Output_section_incremental_inputs::set_final_data_size): Adjust
263         type of input file entry for shared libraries; adjust size of
264         shared library info entry.
265         (Output_section_incremental_inputs::write_input_files): Write
266         as_needed flag for shared libraries.
267         (Output_section_incremental_inputs::write_info_blocks): Adjust type
268         of input file entry for shared libraries; write soname.
269         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
270         soname from incremental info.
271         * incremental.h (enum Incremental_input_flags): Add
272         INCREMENTAL_INPUT_AS_NEEDED.
273         (Incremental_input_entry::Incremental_input_entry): Initialize new
274         data member.
275         (Incremental_input_entry::set_as_needed): New function.
276         (Incremental_input_entry::as_needed): New function.
277         (Incremental_input_entry::do_dynobj_entry): New function.
278         (Incremental_input_entry::as_needed_): New data member.
279         (Incremental_object_entry::Incremental_object_entry): Don't check
280         for shared library.
281         (Incremental_object_entry::do_type): Likewise.
282         (class Incremental_dynobj_entry): New class.
283         (Incremental_input_entry_reader::as_needed): New function.
284         (Incremental_input_entry_reader::get_soname): New function.
285         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
286         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
287         size of shared library info entry.
288         * layout.cc (Layout::finish_dynamic_section): Don't test for 
289         incremental link when adding DT_NEEDED entries.
290         * object.h (Object::Object): Initialize new data member.
291         (Object::dynobj): New function.
292         (Object::set_as_needed): New function.
293         (Object::as_needed): New function.
294         (Object::do_dynobj): New function.
295         (Object::as_needed_): New data member.
296
297 2011-05-24 Cary Coutant  <ccoutant@google.com>
298
299         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
300         info; adjust display of GOT entries.
301         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
302         vector of input objects; remove file_status_.
303         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
304         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
305         got_plt reader; call target hooks to reserve GOT entries.
306         (Output_section_incremental_inputs::set_final_data_size): Adjust size
307         of input file info header and GOT info entry.
308         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
309         relocation info.
310         (Got_plt_view_info::got_descriptor): Remove.
311         (Got_plt_view_info::sym_index): New data member.
312         (Got_plt_view_info::input_index): New data member.
313         (Local_got_offset_visitor::visit): Write input file index.
314         (Global_got_offset_visitor::visit): Write 0 for input file index.
315         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
316         with sym_index and input_index.
317         (Output_section_incremental_inputs::write_got_plt): Adjust size of
318         incremental info GOT entry; replace got_descriptor with input_index.
319         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
320         map from input file index to object.
321         (Sized_relobj_incr::do_layout): Replace direct data member reference
322         with accessor function.
323         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
324         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
325         Adjust size of input file info header.
326         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
327         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
328         (Incremental_input_entry_reader::get_input_section): Adjust size of
329         input file info header.
330         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
331         of incremental info GOT entry.
332         (Incremental_got_plt_reader::get_got_desc): Remove.
333         (Incremental_got_plt_reader::get_got_symndx): New function.
334         (Incremental_got_plt_reader::get_got_input_index): New function.
335         (Sized_incremental_binary::Sized_incremental_binary): Remove
336         file_status_; add input_objects_.
337         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
338         (Sized_incremental_binary::set_file_is_unchanged): Remove.
339         (Sized_incremental_binary::file_is_unchanged): Remove.
340         (Sized_incremental_binary::set_input_object): New function.
341         (Sized_incremental_binary::input_object): New function.
342         (Sized_incremental_binary::file_status_): Remove.
343         (Sized_incremental_binary::input_objects_): New data member.
344         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
345         references.
346         (Sized_relobj_incr::invalid_address): Move to base class.
347         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
348         class.
349         (Sized_relobj_incr::do_output_section_offset): Likewise.
350         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
351         (Sized_relobj_incr::section_offsets_): Likewise.
352         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
353         function.
354         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
355         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
356         with accessor function.
357         (Sized_relobj_file::do_layout): Likewise.
358         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
359         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
360         (Sized_relobj_file::compute_final_local_value): Replace refs to
361         section_offsets_ with accessor function.
362         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
363         * object.h (Relobj::Relobj): Initialize new data members.
364         (Relobj::add_dyn_reloc): New function.
365         (Relobj::first_dyn_reloc): New function.
366         (Relobj::dyn_reloc_count): New function.
367         (Relobj::first_dyn_reloc_): New data member.
368         (Relobj::dyn_reloc_count_): New data member.
369         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
370         references.
371         (Sized_relobj::Address): New typedef.
372         (Sized_relobj::invalid_address): Move here from child class.
373         (Sized_relobj::Sized_relobj): Initialize new data members.
374         (Sized_relobj::sized_relobj): New function.
375         (Sized_relobj::is_output_section_offset_invalid): Move here from
376         child class.
377         (Sized_relobj::get_output_section_offset): Likewise.
378         (Sized_relobj::local_has_got_offset): Likewise.
379         (Sized_relobj::local_got_offset): Likewise.
380         (Sized_relobj::set_local_got_offset): Likewise.
381         (Sized_relobj::do_for_all_local_got_entries): Likewise.
382         (Sized_relobj::clear_got_offsets): New function.
383         (Sized_relobj::section_offsets): Move here from child class.
384         (Sized_relobj::do_output_section_offset): Likewise.
385         (Sized_relobj::do_set_section_offset): Likewise.
386         (Sized_relobj::Local_got_offsets): Likewise.
387         (Sized_relobj::local_got_offsets_): Likewise.
388         (Sized_relobj::section_offsets_): Likewise.
389         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
390         references.
391         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
392         class.
393         (Sized_relobj_file::sized_relobj): New function
394         (Sized_relobj_file::local_has_got_offset): Move to base class.
395         (Sized_relobj_file::local_got_offset): Likewise.
396         (Sized_relobj_file::set_local_got_offset): Likewise.
397         (Sized_relobj_file::get_output_section_offset): Likewise.
398         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
399         (Sized_relobj_file::do_output_section_offset): Likewise.
400         (Sized_relobj_file::do_set_section_offset): Likewise.
401         (Sized_relobj_file::Local_got_offsets): Likewise.
402         (Sized_relobj_file::local_got_offsets_): Likewise.
403         (Sized_relobj_file::section_offsets_): Likewise.
404         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
405         (all constructors).
406         (set_needs_dynsym_index): Convert relobj to derived class pointer.
407         (Output_reloc::get_symbol_index): Likewise.
408         (Output_reloc::local_section_offset): Likewise.
409         (Output_reloc::get_address): Likewise.
410         (Output_reloc::symbol_value): Likewise.
411         (Output_data_got::reserve_slot): Move to class definition.
412         (Output_data_got::reserve_local): New function.
413         (Output_data_got::reserve_slot_for_global): Remove.
414         (Output_data_got::reserve_global): New function.
415         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
416         (all constructors, two instantiations).
417         (Output_reloc::get_relobj): New function (two instantiations).
418         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
419         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
420         (Output_data_reloc::add_global): Adjust type of relobj.
421         (Output_data_reloc::add_global_relative): Likewise.
422         (Output_data_reloc::add_symbolless_global_addend): Likewise.
423         (Output_data_reloc::add_local): Likewise.
424         (Output_data_reloc::add_local_relative): Likewise.
425         (Output_data_reloc::add_symbolless_local_addend): Likewise.
426         (Output_data_reloc::add_local_section): Likewise.
427         (Output_data_reloc::add_output_section): Likewise.
428         (Output_data_reloc::add_absolute): Likewise.
429         (Output_data_reloc::add_target_specific): Likewise.
430         (Output_data_got::reserve_slot): Move definition here.
431         (Output_data_got::reserve_local): New function.
432         (Output_data_got::reserve_global): New function.
433         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
434         section_offsets_ with accessor function.
435         (Sized_relobj_file::write_sections): Likewise.
436         (Sized_relobj_file::do_relocate_sections): Likewise.
437         * target.h (Sized_target::reserve_local_got_entry): New function.
438         (Sized_target::reserve_global_got_entry): New function.
439         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
440         (Target_x86_64::reserve_global_got_entry): New function.
441         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
442
443 2011-05-23 Cary Coutant  <ccoutant@google.com>
444
445         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
446         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
447         bit when checking got_type.
448         * incremental.cc (Sized_incremental_binary::setup_readers):
449         Store symbol table and string table locations; initialize bit vector
450         of file status flags.
451         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
452         unchanged files.
453         (Sized_incremental_binary::do_process_got_plt): New function.
454         (Sized_incremental_binary::get_symtab_view): Use stored locations.
455         (Output_section_incremental_inputs::set_final_data_size): Record
456         file index for each input file.
457         (Output_section_incremental_inputs::write_got_plt): Store file index
458         instead of input entry offset for each GOT entry.
459         * incremental.h
460         (Incremental_input_entry::Incremental_input_entry): Initialize new
461         data member.
462         (Incremental_input_entry::set_offset): Store file index.
463         (Incremental_input_entry::get_file_index): New function.
464         (Incremental_input_entry::file_index_): New data member.
465         (Incremental_binary::process_got_plt): New function.
466         (Incremental_binary::do_process_got_plt): New function.
467         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
468         data members.
469         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
470         (Sized_incremental_binary::set_file_is_unchanged): New function.
471         (Sized_incremental_binary::file_is_unchanged): New function.
472         (Sized_incremental_binary::do_process_got_plt): New function.
473         (Sized_incremental_binary::file_status_): New data member.
474         (Sized_incremental_binary::main_symtab_loc_): New data member.
475         (Sized_incremental_binary::main_strtab_loc_): New data member.
476         * output.cc (Output_data_got::Got_entry::write): Add case
477         RESERVED_CODE.
478         (Output_data_got::add_global): Call add_got_entry.
479         (Output_data_got::add_global_plt): Likewise.
480         (Output_data_got::add_global_with_rel): Likewise.
481         (Output_data_got::add_global_with_rela): Likewise.
482         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
483         (Output_data_got::add_global_pair_with_rela): Likewise.
484         (Output_data_got::add_local): Call add_got_entry.
485         (Output_data_got::add_local_plt): Likewise.
486         (Output_data_got::add_local_with_rel): Likewise.
487         (Output_data_got::add_local_with_rela): Likewise.
488         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
489         (Output_data_got::add_local_pair_with_rela): Likewise.
490         (Output_data_got::reserve_slot): New function.
491         (Output_data_got::reserve_slot_for_global): New function.
492         (Output_data_got::add_got_entry): New function.
493         (Output_data_got::add_got_entry_pair): New function.
494         (Output_section::add_output_section_data): Edit FIXME.
495         * output.h
496         (Output_section_data_build::Output_section_data_build): New
497         constructor with size parameter.
498         (Output_data_space::Output_data_space): Likewise.
499         (Output_data_got::Output_data_got): Initialize new data member; new
500         constructor with size parameter.
501         (Output_data_got::add_constant): Call add_got_entry.
502         (Output_data_got::reserve_slot): New function.
503         (Output_data_got::reserve_slot_for_global): New function.
504         (class Output_data_got::Got_entry): Add RESERVED_CODE.
505         (Output_data_got::add_got_entry): New function.
506         (Output_data_got::add_got_entry_pair): New function.
507         (Output_data_got::free_list_): New data member.
508         * target.h (Sized_target::init_got_plt_for_update): New function.
509         (Sized_target::register_global_plt_entry): New function.
510         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
511         Initialize new data member; call init; add constructor with PLT count.
512         (Output_data_plt_x86_64::init): New function.
513         (Output_data_plt_x86_64::add_relocation): New function.
514         (Output_data_plt_x86_64::reserve_slot): New function.
515         (Output_data_plt_x86_64::free_list_): New data member.
516         (Target_x86_64::init_got_plt_for_update): New function.
517         (Target_x86_64::register_global_plt_entry): New function.
518         (Output_data_plt_x86_64::add_entry): Allocate from free list for
519         incremental updates.
520         (Output_data_plt_x86_64::add_relocation): New function.
521         * testsuite/object_unittest.cc (Object_test): Set default options.
522
523 2011-05-16  Ian Lance Taylor  <iant@google.com>
524
525         * options.h (class General_options): Make -i a synonym for -r.
526
527 2011-05-16  Ian Lance Taylor  <iant@google.com>
528
529         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
530
531 2011-05-10 Cary Coutant  <ccoutant@google.com>
532
533         * object.cc (Sized_relobj::do_count_local_symbols): Check for
534         strip_all (-s).
535
536 2011-05-06  Ian Lance Taylor  <iant@google.com>
537
538         * layout.cc (Layout::layout): If the output section flags change,
539         update the ordering.
540
541 2011-04-25 Cary Coutant  <ccoutant@google.com>
542
543         * incremental-dump.cc (dump_incremental_inputs): Print local
544         symbol info for each input file.
545         * incremental.cc
546         (Output_section_incremental_inputs::set_final_data_size): Add local
547         symbol info to input file entries in incremental info.
548         (Output_section_incremental_inputs::write_info_blocks): Likewise.
549         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
550         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
551         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
552         implementation.
553         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
554         (Sized_incr_relobj::do_relocate): Write the local symbols.
555         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
556         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
557         Adjust size of input file header.
558         (Incremental_inputs_reader::get_local_symbol_offset): New function.
559         (Incremental_inputs_reader::get_local_symbol_count): New function.
560         (Incremental_inputs_reader::get_input_section): Adjust size of input
561         file header.
562         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
563         (Sized_incr_relobj::This): New typedef.
564         (Sized_incr_relobj::sym_size): New const data member.
565         (Sized_incr_relobj::Local_symbol): New struct.
566         (Sized_incr_relobj::do_output_local_symbol_count): New function.
567         (Sized_incr_relobj::do_local_symbol_offset): New function.
568         (Sized_incr_relobj::local_symbol_count_): New data member.
569         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
570         (Sized_incr_relobj::local_symbol_index_): New data member.
571         (Sized_incr_relobj::local_symbol_offset_): New data member.
572         (Sized_incr_relobj::local_dynsym_offset_): New data member.
573         (Sized_incr_relobj::local_symbols_): New data member.
574         * object.h (Relobj::output_local_symbol_count): New function.
575         (Relobj::local_symbol_offset): New function.
576         (Relobj::do_output_local_symbol_count): New function.
577         (Relobj::do_local_symbol_offset): New function.
578         (Sized_relobj::do_output_local_symbol_count): New function.
579         (Sized_relobj::do_local_symbol_offset): New function.
580
581 2011-04-22  Vladimir Simonov  <sv@sw.ru>
582
583         * descriptors.cc (set_close_on_exec): New function.
584         (Descriptors::open): Use set_close_on_exec.
585         * output.cc (S_ISLNK): Define if not defined.
586
587 2011-04-22 Cary Coutant  <ccoutant@google.com>
588
589         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
590         global symbol map.
591         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
592         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
593         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
594         relocations.
595         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
596         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
597         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
598         * incremental.h
599         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
600         function.
601         (Incremental_binary::apply_incremental_relocs): New function.
602         (Incremental_binary::do_apply_incremental_relocs): New function.
603         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
604         data member.
605         (Sized_incremental_binary::add_global_symbol): New function.
606         (Sized_incremental_binary::global_symbol): New function.
607         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
608         (Sized_incremental_binary::symbol_map_): New data member.
609         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
610         * target.h (Sized_target::apply_relocation): New function.
611         * target-reloc.h (apply_relocation): New function.
612         * x86_64.cc (Target_x86_64::apply_relocation): New function.
613
614 2011-04-22  Doug Kwan  <dougkwan@google.com>
615
616         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
617         flag of a SHT_ARM_EXIDX section.
618         * testsuite/Makefile.am (arm_exidx_test): New test rules.
619         * testsuite/Makefile.in: Regenerate.
620         * testsuite/arm_exidx_test.s: New file.
621         * testsuite/arm_exidx_test.sh: Same.
622
623 2011-04-20 Cary Coutant  <ccoutant@google.com>
624
625         PR gold/12689
626         * archive.h (Incremental_archive_entry::Archive_member):
627         Initialize arg_serial_ (second constructor).
628
629 2011-04-17  Ian Lance Taylor  <iant@google.com>
630
631         * object.cc (Relocate_info::location): Simplify location string.
632         * errors.cc (Errors::error_at_location): Don't print program
633         name.
634         (Errors::warning_at_location): Likewise.
635         (Errors::undefined_symbol): Likewise.
636         * testsuite/debug_msg.sh: Update accordingly.
637
638 2011-04-14 Cary Coutant  <ccoutant@google.com>
639
640         * gold/layout.cc (Layout::symtab_section_offset): New function.
641         * gold/layout.h (Layout::symtab_section_offset): New function.
642         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
643
644 2011-04-12  Ian Lance Taylor  <iant@google.com>
645
646         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
647         with MREMAP_MAYMOVE.
648         * output.h (class Output_file): Add map_is_allocated_ field.
649         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
650         not available, provide stubs.  If mremap is not available, #define
651         it to gold_mremap.
652         (MREMAP_MAYMOVE): Define if not defined.
653         (Output_file::Output_file): Initialize map_is_allocated_.
654         (Output_file::resize): Check map_is_allocated_.
655         (Output_file::map_anonymous): If mmap fails, use malloc.
656         (Output_file::unmap): Don't do anything for an anonymous map.
657         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
658         is not available, provide stubs.
659         (File_read::View::~View): Use free rather than delete[].
660         (File_read::make_view): Use malloc rather than new[].  If mmap
661         fails, use malloc.
662         (File_read::find_or_make_view): Use malloc rather than new[].
663         * gold.h: Remove HAVE_REMAP code.
664         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
665         exists.  Rename mremap to gold_mremap.  If mmap is not available
666         don't do anything.
667         * configure, config.in: Rebuild.
668
669 2011-04-11  Ian Lance Taylor  <iant@google.com>
670
671         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
672         initialize local variable v.
673
674 2011-04-11  Cary Coutant  <ccoutant@google.com>
675
676         * archive.cc (Archive::include_member): Adjust call to
677         report_object.
678         (Add_archive_symbols::run): Track argument serial numbers.
679         (Lib_group::include_member): Likewise.
680         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
681         * archive.h (Incremental_archive_entry::Archive_member):
682         Initialize arg_serial_.
683         (Archive_member::arg_serial_): New data member.
684         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
685         (Sized_dynobj::do_add_symbols): Track symbols when doing an
686         incremental link.
687         (Sized_dynobj::do_for_all_local_got_entries): New function.
688         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
689         function.
690         * fileread.cc (get_mtime): New function.
691         * fileread.h (get_mtime): New function.
692         * gold.cc (queue_initial_tasks): Check for incremental update.
693         (process_incremental_input): New function.
694         (queue_middle_tasks): Don't force valid target for incremental
695         update.
696         * incremental-dump.cc (find_input_containing_global): Adjust
697         size of symbol info entry.
698         (dump_incremental_inputs): Dump argument serial number and
699         in_system_directory flag; bias shndx by 1; print symbol names
700         when dumping per-file symbol lists; use new symbol info readers.
701         * incremental.cc
702         (Output_section_incremental_inputs:update_data_size): New function.
703         (Sized_incremental_binary::setup_readers): Setup input readers
704         for each input file; build maps for files added from libraries
705         and scripts.
706         (Sized_incremental_binary::check_input_args): New function.
707         (Sized_incremental_binary::do_check_inputs): Build map of argument
708         serial numbers to input arguments.
709         (Sized_incremental_binary::do_file_has_changed): Rename
710         do_file_is_unchanged to this; compare file modification times.
711         (Sized_incremental_binary::do_init_layout): New function.
712         (Sized_incremental_binary::do_reserve_layout): New function.
713         (Sized_incremental_binary::do_get_input_reader): Remove.
714         (Sized_incremental_binary::get_symtab_view): New function.
715         (Incremental_checker::can_incrementally_link_output_file): Remove.
716         (Incremental_inputs::report_command_line): Exclude --debug options.
717         (Incremental_inputs::report_archive_begin): Add parameter; track
718         argument serial numbers; don't put input file entry for archive
719         before archive members.
720         (Incremental_inputs::report_archive_end): Put input file entry
721         for archive after archive members.
722         (Incremental_inputs::report_object): Add parameter; track argument
723         serial numbers and in_system_directory flag.
724         (Incremental_inputs::report_script): Add parameter; track argument
725         serial numbers.
726         (Output_section_incremental_inputs::set_final_data_size): Adjust
727         size of symbol info entry; check for forwarding symbols.
728         (Output_section_incremental_inputs::write_input_files): Write
729         in_system_directory flag and argument serial number.
730         (Output_section_incremental_inputs::write_info_blocks): Map section
731         indices between incremental info and original input file; store
732         input section index for each symbol.
733         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
734         change operator() to visit().
735         (class Global_got_offset_visitor): Likewise.
736         (class Global_symbol_visitor_got_plt):
737         (Output_section_incremental_inputs::write_got_plt): Use new visitor
738         classes.
739         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
740         (Sized_incr_relobj::do_read_symbols): New function.
741         (Sized_incr_relobj::do_layout): New function.
742         (Sized_incr_relobj::do_layout_deferred_sections): New function.
743         (Sized_incr_relobj::do_add_symbols): New function.
744         (Sized_incr_relobj::do_should_include_member): New function.
745         (Sized_incr_relobj::do_for_all_global_symbols): New function.
746         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
747         (Sized_incr_relobj::do_section_size): New function.
748         (Sized_incr_relobj::do_section_name): New function.
749         (Sized_incr_relobj::do_section_contents): New function.
750         (Sized_incr_relobj::do_section_flags): New function.
751         (Sized_incr_relobj::do_section_entsize): New function.
752         (Sized_incr_relobj::do_section_address): New function.
753         (Sized_incr_relobj::do_section_type): New function.
754         (Sized_incr_relobj::do_section_link): New function.
755         (Sized_incr_relobj::do_section_info): New function.
756         (Sized_incr_relobj::do_section_addralign): New function.
757         (Sized_incr_relobj::do_initialize_xindex): New function.
758         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
759         (Sized_incr_relobj::do_read_relocs): New function.
760         (Sized_incr_relobj::do_gc_process_relocs): New function.
761         (Sized_incr_relobj::do_scan_relocs): New function.
762         (Sized_incr_relobj::do_count_local_symbols): New function.
763         (Sized_incr_relobj::do_finalize_local_symbols): New function.
764         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
765         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
766         (Sized_incr_relobj::do_relocate): New function.
767         (Sized_incr_relobj::do_set_section_offset): New function.
768         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
769         (Sized_incr_dynobj::do_read_symbols): New function.
770         (Sized_incr_dynobj::do_layout): New function.
771         (Sized_incr_dynobj::do_add_symbols): New function.
772         (Sized_incr_dynobj::do_should_include_member): New function.
773         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
774         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
775         (Sized_incr_dynobj::do_section_size): New function.
776         (Sized_incr_dynobj::do_section_name): New function.
777         (Sized_incr_dynobj::do_section_contents): New function.
778         (Sized_incr_dynobj::do_section_flags): New function.
779         (Sized_incr_dynobj::do_section_entsize): New function.
780         (Sized_incr_dynobj::do_section_address): New function.
781         (Sized_incr_dynobj::do_section_type): New function.
782         (Sized_incr_dynobj::do_section_link): New function.
783         (Sized_incr_dynobj::do_section_info): New function.
784         (Sized_incr_dynobj::do_section_addralign): New function.
785         (Sized_incr_dynobj::do_initialize_xindex): New function.
786         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
787         (make_sized_incremental_object): New function.
788         (Incremental_library::copy_unused_symbols): New function.
789         (Incremental_library::do_for_all_unused_symbols): New function.
790         * incremental.h (enum Incremental_input_flags): New type.
791         (class Incremental_checker): Remove.
792         (Incremental_input_entry::Incremental_input_entry): Add argument
793         serial number.
794         (Incremental_input_entry::arg_serial): New function.
795         (Incremental_input_entry::set_is_in_system_directory): New function.
796         (Incremental_input_entry::is_in_system_directory): New function.
797         (Incremental_input_entry::arg_serial_): New data member.
798         (Incremental_input_entry::is_in_system_directory_): New data member.
799         (class Script_info): Move here from script.h.
800         (Script_info::Script_info): Add filename parameter.
801         (Script_info::filename): New function.
802         (Script_info::filename_): New data member.
803         (Incremental_script_entry::Incremental_script_entry): Add argument
804         serial number.
805         (Incremental_object_entry::Incremental_object_entry): Likewise.
806         (Incremental_object_entry::add_input_section): Build list of input
807         sections with map to original shndx.
808         (Incremental_object_entry::get_input_section_index): New function.
809         (Incremental_object_entry::shndx_): New data member.
810         (Incremental_object_entry::name_key_): Rename; adjust all refs.
811         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
812         (Incremental_archive_entry::Incremental_archive_entry): Add argument
813         serial number.
814         (Incremental_inputs::report_archive_begin): Likewise.
815         (Incremental_inputs::report_object): Likewise.
816         (Incremental_inputs::report_script): Likewise.
817         (class Incremental_global_symbol_reader): New class.
818         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
819         and store flags and input file type.
820         (Incremental_input_entry_reader::arg_serial): New function.
821         (Incremental_input_entry_reader::type): Extract type from flags.
822         (Incremental_input_entry_reader::is_in_system_directory): New function.
823         (Incremental_input_entry_reader::get_input_section_count): Call
824         accessor function for type.
825         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
826         function for type; adjust size of global symbol entry.
827         (Incremental_input_entry_reader::get_global_symbol_count): Call
828         accessor function for type.
829         (Incremental_input_entry_reader::get_object_count): Likewise.
830         (Incremental_input_entry_reader::get_object_offset): Likewise.
831         (Incremental_input_entry_reader::get_member_count): Likewise.
832         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
833         (Incremental_input_entry_reader::get_member_offset): Likewise.
834         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
835         (Incremental_input_entry_reader::Global_symbol_info): Remove.
836         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
837         (Incremental_input_entry_reader::get_global_symbol_reader): New
838         function.
839         (Incremental_input_entry_reader::get_output_symbol_index): New
840         function.
841         (Incremental_input_entry_reader::type_): Remove.
842         (Incremental_input_entry_reader::flags_): New data member.
843         (Incremental_inputs_reader::input_file_offset): New function.
844         (Incremental_inputs_reader::input_file_index): New function.
845         (Incremental_inputs_reader::input_file): Call input_file_offset.
846         (Incremental_inputs_reader::input_file_at_offset): New function.
847         (Incremental_relocs_reader::get_r_type): Reformat.
848         (Incremental_relocs_reader::get_r_shndx): Reformat.
849         (Incremental_relocs_reader::get_r_offset): Reformat.
850         (Incremental_relocs_reader::data): New function.
851         (Incremental_binary::Incremental_binary): Initialize new data members.
852         (Incremental_binary::check_inputs): Add cmdline parameter.
853         (Incremental_binary::file_is_unchanged): Remove.
854         (Input_reader::arg_serial): New function.
855         (Input_reader::get_unused_symbol_count): New function.
856         (Input_reader::get_unused_symbol): New function.
857         (Input_reader::do_arg_serial): New function.
858         (Input_reader::do_get_unused_symbol_count): New function.
859         (Input_reader::do_get_unused_symbol): New function.
860         (Incremental_binary::input_file_count): New function.
861         (Incremental_binary::get_input_reader): Change signature to use
862         index instead of filename.
863         (Incremental_binary::file_has_changed): New function.
864         (Incremental_binary::get_input_argument): New function.
865         (Incremental_binary::get_library): New function.
866         (Incremental_binary::get_script_info): New function.
867         (Incremental_binary::init_layout): New function.
868         (Incremental_binary::reserve_layout): New function.
869         (Incremental_binary::output_file): New function.
870         (Incremental_binary::do_check_inputs): New function.
871         (Incremental_binary::do_file_is_unchanged): Remove.
872         (Incremental_binary::do_file_has_changed): New function.
873         (Incremental_binary::do_init_layout): New function.
874         (Incremental_binary::do_reserve_layout): New function.
875         (Incremental_binary::do_input_file_count): New function.
876         (Incremental_binary::do_get_input_reader): Change signature.
877         (Incremental_binary::input_args_map_): New data member.
878         (Incremental_binary::library_map_): New data member.
879         (Incremental_binary::script_map_): New data member.
880         (Sized_incremental_binary::Sized_incremental_binary): Initialize
881         new data members.
882         (Sized_incremental_binary::output_section): New function.
883         (Sized_incremental_binary::inputs_reader): Add const.
884         (Sized_incremental_binary::symtab_reader): Add const.
885         (Sized_incremental_binary::relocs_reader): Add const.
886         (Sized_incremental_binary::got_plt_reader): Add const.
887         (Sized_incremental_binary::get_symtab_view): New function.
888         (Sized_incremental_binary::Inputs_reader): New typedef.
889         (Sized_incremental_binary::Input_entry_reader): New typedef.
890         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
891         (Sized_incremental_binary::do_file_is_unchanged): Remove.
892         (Sized_incremental_binary::do_file_has_changed): New function.
893         (Sized_incremental_binary::do_init_layout): New function.
894         (Sized_incremental_binary::do_reserve_layout): New function.
895         (Sized_input_reader::Inputs_reader): Remove.
896         (Sized_input_reader::Input_entry_reader): Remove.
897         (Sized_input_reader::do_arg_serial): New function.
898         (Sized_input_reader::do_get_unused_symbol_count): New function.
899         (Sized_input_reader::do_get_unused_symbol): New function.
900         (Sized_incremental_binary::do_input_file_count): New function.
901         (Sized_incremental_binary::do_get_input_reader): Change signature;
902         use index instead of filename.
903         (Sized_incremental_binary::section_map_): New data member.
904         (Sized_incremental_binary::input_entry_readers_): New data member.
905         (class Sized_incr_relobj): New class.
906         (class Sized_incr_dynobj): New class.
907         (make_sized_incremental_object): New function.
908         (class Incremental_library): New class.
909         * layout.cc (Free_list::num_lists): New static data member.
910         (Free_list::num_nodes): New static data member.
911         (Free_list::num_removes): New static data member.
912         (Free_list::num_remove_visits): New static data member.
913         (Free_list::num_allocates): New static data member.
914         (Free_list::num_allocate_visits): New static data member.
915         (Free_list::init): New function.
916         (Free_list::remove): New function.
917         (Free_list::allocate): New function.
918         (Free_list::dump): New function.
919         (Free_list::print_stats): New function.
920         (Layout_task_runner::run): Resize output file for incremental updates.
921         (Layout::Layout): Initialize new data members.
922         (Layout::set_incremental_base): New function.
923         (Layout::init_fixed_output_section): New function.
924         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
925         incremental updates.
926         (Layout::create_gold_note): Do not create gold note section for
927         incremental updates.
928         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
929         for incremental updates.
930         (Layout::set_section_offsets): For incremental updates, allocate space
931         from free list.
932         (Layout::create_symtab_sections): Layout with offsets relative to
933         start of section; for incremental updates, allocate space from free
934         list.
935         (Layout::create_shdrs): For incremental updates, allocate space from
936         free list.
937         (Layout::finish_dynamic_section): For incremental updates, do not
938         check --as-needed (fixed in subsequent patch).
939         * layout.h (class Free_list): New class.
940         (Layout::set_incremental_base): New function.
941         (Layout::incremental_base): New function.
942         (Layout::init_fixed_output_section): New function.
943         (Layout::allocate): New function.
944         (Layout::incremental_base_): New data member.
945         (Layout::free_list_): New data member.
946         * main.cc (main): Print Free_list statistics.
947         * object.cc (Relobj::finalize_incremental_relocs): Add
948         clear_counts parameter; clear counts only when clear_counts is set.
949         (Sized_relobj::Sized_relobj): Initialize new base class.
950         (Sized_relobj::do_layout): Don't report special sections.
951         (Sized_relobj::do_for_all_local_got_entries): New function.
952         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
953         symtab_off to all symbol table offsets.
954         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
955         * object.h (class Got_offset_list): Move to top of file.
956         (Object::Object): Allow case where input_file == NULL.
957         (Object::~Object): Likewise.
958         (Object::input_file): Assert that input_file != NULL.
959         (Object::lock): Allow case where input_file == NULL.
960         (Object::unlock): Likewise.
961         (Object::is_locked): Likewise.
962         (Object::token): Likewise.
963         (Object::release): Likewise.
964         (Object::is_incremental): New function.
965         (Object::get_mtime): New function.
966         (Object::for_all_local_got_entries): New function.
967         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
968         (Object::set_is_in_system_directory): New function.
969         (Object::is_in_system_directory): New function.
970         (Object::do_is_incremental): New function.
971         (Object::do_get_mtime): New function.
972         (Object::do_for_all_local_got_entries): New function.
973         (Object::is_in_system_directory_): New data member.
974         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
975         (class Sized_relobj_base): New class.
976         (class Sized_relobj): Derive from Sized_relobj_base.
977         (class Sized_relobj::Symbols): Redeclare from base class.
978         (class Sized_relobj::local_got_offset_list): Remove.
979         (class Sized_relobj::Output_sections): Redeclare from base class.
980         (class Sized_relobj::do_for_all_local_got_entries): New function.
981         (class Sized_relobj::write_local_symbols): Add offset parameter.
982         (class Sized_relobj::local_symbol_offset_): Update comment.
983         (class Sized_relobj::local_dynsym_offset_): Update comment.
984         * options.cc (Input_arguments::add_file): Remove const.
985         * options.h (Input_file_argument::Input_file_argument):
986         Initialize arg_serial_ (all constructors).
987         (Input_file_argument::set_arg_serial): New function.
988         (Input_file_argument::arg_serial): New function.
989         (Input_file_argument::arg_serial_): New data member.
990         (Input_arguments::Input_arguments): Initialize file_count_.
991         (Input_arguments::add_file): Remove const.
992         (Input_arguments::number_of_input_files): New function.
993         (Input_arguments::file_count_): New data member.
994         (Command_line::number_of_input_files): Call
995         Input_arguments::number_of_input_files.
996         * output.cc (Output_segment_headers::Output_segment_headers):
997         Set current size.
998         (Output_section::Input_section::current_data_size): New function.
999         (Output_section::Output_section): Initialize new data members.
1000         (Output_section::add_input_section): Don't do merge sections for
1001         an incremental link; allocate space from free list for an
1002         incremental update.
1003         (Output_section::add_output_section_data): Allocate space from
1004         free list for an incremental update.
1005         (Output_section::update_data_size): New function.
1006         (Output_section::set_fixed_layout): New function.
1007         (Output_section::reserve): New function.
1008         (Output_segment::set_section_addresses): Remove const.
1009         (Output_segment::set_section_list_addresses): Remove const; allocate
1010         space from free list for an incremental update.
1011         (Output_segment::set_offset): Adjust size of RELRO segment for an
1012         incremental update.
1013         * output.h (Output_data::current_data_size): Move here from
1014         child classes.
1015         (Output_data::pre_finalize_data_size): New function.
1016         (Output_data::update_data_size): New function.
1017         (Output_section_headers::update_data_size): new function.
1018         (Output_section_data_build::current_data_size): Move to Output_data.
1019         (Output_data_strtab::update_data_size): New function.
1020         (Output_section::current_data_size): Move to Output_data.
1021         (Output_section::set_fixed_layout): New function.
1022         (Output_section::has_fixed_layout): New function.
1023         (Output_section::reserve): New function.
1024         (Output_section::update_data_size): New function.
1025         (Output_section::has_fixed_layout_): New data member.
1026         (Output_section::free_list_): New data member.
1027         (Output_segment::set_section_addresses): Remove const.
1028         (Output_segment::set_section_list_addresses): Remove const.
1029         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1030         New function.
1031         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1032         New function.
1033         * readsyms.cc (Read_symbols::do_read_symbols): Add library
1034         parameter when calling Add_symbols constructor; store argument
1035         serial number for members of a lib group.
1036         (Add_symbols::locks): Allow case where token == NULL.
1037         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1038         (Read_member::~Read_member): New function.
1039         (Read_member::is_runnable): New function.
1040         (Read_member::locks): New function.
1041         (Read_member::run): New function.
1042         (Check_script::~Check_script): New function.
1043         (Check_script::is_runnable): New function.
1044         (Check_script::locks): New function.
1045         (Check_script::run): New function.
1046         (Check_library::~Check_library): New function.
1047         (Check_library::is_runnable): New function.
1048         (Check_library::locks): New function.
1049         (Check_library::run): New function.
1050         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1051         (Add_symbols::library_): New data member.
1052         (class Read_member): New class.
1053         (class Check_script): New class.
1054         (class Check_library): New class.
1055         * reloc.cc (Read_relocs::is_runnable): Allow case where
1056         token == NULL.
1057         (Read_relocs::locks): Likewise.
1058         (Scan_relocs::locks): Likewise.
1059         (Relocate_task::locks): Likewise.
1060         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1061         to clear counters.
1062         (Sized_relobj::incremental_relocs_scan): Fix comment.
1063         (Sized_relobj::do_relocate): Pass output file offset to
1064         write_local_symbols.
1065         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1066         from class declaration.
1067         * script.cc (read_input_script): Allocate Script_info; pass
1068         argument serial number to report_script.
1069         * script.h (class Script_info): Move to incremental.h.
1070         * symtab.cc (Symbol_table::add_from_incrobj): New function.
1071         * symtab.h (Symbol_table::add_from_incrobj): New function.
1072         (Symbol_table::set_file_offset): New function.
1073
1074 2011-04-05  Cary Coutant  <ccoutant@google.com>
1075
1076         * incremental-dump.cc (dump_incremental_inputs): Change signature
1077         to take a Sized_incremental_binary; change caller.  Use readers
1078         in Sized_incremental_binary.
1079         * incremental.cc
1080         (Sized_incremental_binary::find_incremental_inputs_sections):
1081         Rename do_find_incremental_inputs_sections to this.
1082         (Sized_incremental_binary::setup_readers): New function.
1083         (Sized_incremental_binary::do_check_inputs): Check
1084         has_incremental_info_ flag; move setup code to setup_readers;
1085         use input readers.
1086         (Sized_incremental_binary::do_file_is_unchanged): New function.
1087         (Sized_incremental_binary::do_get_input_reader): New function.
1088         * incremental.h (class Incremental_binary): Move to end of file.
1089         (Incremental_binary::file_is_unchanged): New function.
1090         (Incremental_binary::do_file_is_unchanged): New function.
1091         (Incremental_binary::Input_reader): New class.
1092         (Incremental_binary::get_input_reader): New function.
1093         (class Sized_incremental_binary): Move to end of file.
1094         (Sized_incremental_binary::Sized_incremental_binary): Setup the
1095         input section reader classes.
1096         (Sized_incremental_binary::has_incremental_info): New function.
1097         (Sized_incremental_binary::inputs_reader): New function.
1098         (Sized_incremental_binary::symtab_reader): New function.
1099         (Sized_incremental_binary::relocs_reader): New function.
1100         (Sized_incremental_binary::got_plt_reader): New function.
1101         (Sized_incremental_binary::do_file_is_unchanged): New function.
1102         (Sized_incremental_binary::Sized_input_reader): New class.
1103         (Sized_incremental_binary::get_input_reader): New function.
1104         (Sized_incremental_binary::find_incremental_inputs_sections):
1105         Rename do_find_incremental_inputs_sections to this.
1106         (Sized_incremental_binary::setup_readers): New function.
1107         (Sized_incremental_binary::has_incremental_info_): New data member.
1108         (Sized_incremental_binary::inputs_reader_): New data member.
1109         (Sized_incremental_binary::symtab_reader_): New data member.
1110         (Sized_incremental_binary::relocs_reader_): New data member.
1111         (Sized_incremental_binary::got_plt_reader_): New data member.
1112         (Sized_incremental_binary::current_input_file_): New data member.
1113
1114 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
1115
1116         PR gold/12640
1117         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1118         violation.
1119
1120 2011-03-30  Cary Coutant  <ccoutant@google.com>
1121
1122         * archive.cc (Archive::include_member): Adjust call to report_object.
1123         (Add_archive_symbols::run): Add script_info to call to
1124         report_archive_begin.
1125         (Lib_group::include_member): Adjust call to report_object.
1126         (Add_lib_group_symbols::run): Adjust call to report_object.
1127         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1128         blocks.  Add object count for script input files.
1129         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1130         script_info parameter; change all callers.
1131         (Incremental_inputs::report_object): Add script_info parameter;
1132         change all callers.
1133         (Incremental_inputs::report_script): Store backpointer to
1134         incremental info entry.
1135         (Output_section_incremental_inputs::set_final_data_size): Record
1136         additional information for scripts.
1137         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1138         * incremental.h (Incremental_script_entry::add_object): New function.
1139         (Incremental_script_entry::get_object_count): New function.
1140         (Incremental_script_entry::get_object): New function.
1141         (Incremental_script_entry::objects_): New data member; adjust
1142         constructor.
1143         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1144         (Incremental_inputs::report_object): Add script_info parameter.
1145         (Incremental_inputs_reader::get_object_count): New function.
1146         (Incremental_inputs_reader::get_object_offset): New function.
1147         * options.cc (Input_arguments::add_file): Return reference to
1148         new input argument.
1149         * options.h (Input_argument::set_script_info): New function.
1150         (Input_argument::script_info): New function.
1151         (Input_argument::script_info_): New data member; adjust all
1152         constructors.
1153         (Input_file_group::add_file): Return reference to new input argument.
1154         (Input_file_lib::add_file): Likewise.
1155         (Input_arguments::add_file): Likewise.
1156         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1157         * script.cc (Parser_closure::Parser_closure): Add script_info
1158         parameter; adjust all callers.
1159         (Parser_closure::script_info): New function.
1160         (Parser_closure::script_info_): New data member.
1161         (read_input_script): Report scripts earlier to incremental info.
1162         (script_add_file): Set script_info in Input_argument.
1163         (script_add_library): Likewise.
1164         * script.h (Script_options::Script_info): Rewrite class.
1165
1166 2011-03-29  Cary Coutant  <ccoutant@google.com>
1167
1168         * archive.cc (Library_base::should_include_member): Move
1169         method here from class Archive.
1170         (Archive::Archive): Initialize base class.
1171         (Archive::should_include_member): Move to base class.
1172         (Archive::do_for_all_unused_symbols): New function.
1173         (Add_archive_symbols::run): Remove redundant access to
1174         incremental_inputs.
1175         (Lib_group::Lib_group): Initialize base class.
1176         (Lib_group::do_filename): New function.
1177         (Lib_group::include_member): Pass pointer to Lib_group to
1178         report_object.
1179         (Lib_group::do_for_all_unused_symbols): New function.
1180         (Add_lib_group_symbols::run): Report archive information for
1181         incremental links.
1182         * archive.h (class Library_base): New base class.
1183         (class Archive): Derive from Library_base.
1184         (Archive::filename): Move to base class.
1185         (Archive::set_incremental_info): Likewise.
1186         (Archive::incremental_info): Likewise.
1187         (Archive::Should_include): Likewise.
1188         (Archive::should_include_member): Likewise.
1189         (Archive::Armap_entry): Remove.
1190         (Archive::Unused_symbol_iterator): Remove.
1191         (Archive::unused_symbols_begin): Remove.
1192         (Archive::unused_symbols_end): Remove.
1193         (Archive::do_filename): New function.
1194         (Archive::do_get_mtime): New function.
1195         (Archive::do_for_all_unused_symbols): New function.
1196         (Archive::task_): Move to base class.
1197         (Archive::incremental_info_): Likewise.
1198         (class Lib_group): Derive from Library_base.
1199         (Lib_group::do_filename): New function.
1200         (Lib_group::do_get_mtime): New function.
1201         (Lib_group::do_for_all_unused_symbols): New function.
1202         (Lib_group::task_): Move to base class.
1203         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1204         function.
1205         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1206         function.
1207         * incremental.cc (Incremental_inputs::report_archive_begin):
1208         Use Library_base; call library's get_mtime; add incremental inputs
1209         entry before members.
1210         (class Unused_symbol_visitor): New class.
1211         (Incremental_inputs::report_archive_end): Use Library_base; use
1212         visitor class to record unused symbols; don't add incremental inputs
1213         entry after members.
1214         (Incremental_inputs::report_object): Use Library_base.
1215         * incremental.h
1216         (Incremental_archive_entry::Incremental_archive_entry): Remove
1217         unused Archive parameter.
1218         (Incremental_inputs::report_archive_begin): Use Library_base.
1219         (Incremental_inputs::report_archive_end): Likewise.
1220         (Incremental_inputs::report_object): Likewise.
1221         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1222         function.
1223         * object.h (Object::for_all_global_symbols): New function.
1224         (Object::do_for_all_global_symbols): New function.
1225         (Sized_relobj::do_for_all_global_symbols): New function.
1226         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1227         function.
1228         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1229         function.
1230
1231 2011-03-27  Ian Lance Taylor  <iant@google.com>
1232
1233         * archive.cc (Archive::interpret_header): Return -1 if something
1234         goes wrong.  Change callers accordingly.
1235
1236 2011-03-25  Cary Coutant  <ccoutant@google.com>
1237
1238         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1239         * testsuite/Makefile.in: Regenerate.
1240
1241 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1242
1243         * plugin.cc (get_view): New.
1244         (Plugin::load): Pass get_view to the plugin.
1245         (Plugin_manager::get_view): New.
1246
1247 2011-03-21  Ian Lance Taylor  <iant@google.com>
1248
1249         * testsuite/final_layout.sh: Rewrite to not use dc.
1250         * testsuite/relro_test.sh: Fail if dc is not present.
1251
1252 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1253
1254         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1255         Change == to -eq.
1256         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1257         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1258         Change == to -eq.
1259         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1260         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1261
1262 2011-03-14  Ian Lance Taylor  <iant@google.com>
1263
1264         * script-sections.cc (Sort_output_sections::script_compare):
1265         Rename from is_before, change return type.
1266         (Sort_output_sections::operator()): Adjust accordingly.
1267
1268 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1269
1270         PR gold/12572
1271         * testsuite/odr_violation2.cc: Add comment to make all error line
1272         numbers double digits.
1273         * testsuite/debug_msg.sh: Adjust expected errors.
1274
1275 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1276
1277         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1278         but mark earlier ones as non-canonical
1279         (offset_to_iterator): Update search target and example
1280         (do_addr2line): Return extra lines in a vector*
1281         (format_file_lineno): Extract from do_addr2line
1282         (one_addr2line): Add vector* out-param
1283         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1284         when a lineno entry appeared last for its instruction
1285         (Dwarf_line_info): Add vector* out-param
1286         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1287         * symtab.cc (Odr_violation_compare): Include the lineno in the
1288         comparison again.
1289         (linenos_from_loc): New. Combine the canonical line for an
1290         address with its other lines.
1291         (True_if_intersect): New. Helper functor to make
1292         std::set_intersection a query.
1293         (detect_odr_violations): Compare sets of lines instead of just
1294         one line for each function. This became less deterministic, but
1295         has fewer false positives.
1296         * symtab.h: Declarations.
1297         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1298         mix an optimized and non-optimized object in the same binary
1299         (odr_violation2.so): Same.
1300         * testsuite/Makefile.in: Regenerate from Makefile.am.
1301         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1302         * testsuite/debug_msg.sh: Update line numbers and add
1303         assertions.
1304         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1305         non-optimized context.
1306         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1307         isn't inlined, and use OdrDerived in an optimized context.
1308         * testsuite/odr_header1.h: Defines OdrDerived, where
1309         optimization will change the
1310         first-instruction-in-the-destructor's file and line number.
1311         * testsuite/odr_header2.h: Defines OdrBase.
1312
1313 2011-03-09  Ian Lance Taylor  <iant@google.com>
1314
1315         * fileread.cc (File_read::clear_views): Don't delete the whole
1316         file view.
1317
1318 2011-03-08  Ian Lance Taylor  <iant@google.com>
1319
1320         PR gold/12525
1321         * fileread.cc: #include <climits>.
1322         (GOLD_IOV_MAX): Define.
1323         (File_read::read_multiple): Limit number of entries by iov_max.
1324         * fileread.h (class File_read): Always set max_readv_entries to
1325         128.
1326
1327 2011-03-07  Ian Lance Taylor  <iant@google.com>
1328
1329         PR gold/12525
1330         * options.h (class General_options): Add -dy and -dn.
1331
1332 2011-03-02  Cary Coutant  <ccoutant@google.com>
1333
1334         * testsuite/script_test_9.t: Add TLS segment.
1335
1336 2011-03-02  Simon Baldwin  <simonb@google.com>
1337
1338         * configure.ac: Add check for gnu_indirect_function support in
1339         the toolchain building binutils.
1340         * configure: Rebuild.
1341
1342 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1343
1344         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1345         plugin only symbols.
1346         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1347         in plugin files as not needed in the symbol table.
1348
1349 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1350
1351         * output.cc (Output_section::add_input_section): Delay fill
1352         generation for section ordering.
1353
1354 2011-02-09  Ian Lance Taylor  <iant@google.com>
1355
1356         PR gold/12316
1357         * object.h (class Sized_relobj): Remove clear_local_symbols.
1358         * reloc.cc (Sized_relobj::do_relocate): Don't call
1359         clear_local_symbols.
1360
1361 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1362
1363         * plugin.cc (is_visible_from_outside): Return true for symbols
1364         in the -u option.
1365
1366 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1367
1368         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1369         filename.
1370
1371 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1372
1373         * icf.h (is_section_foldable_candidate): Change type of parameter
1374         to std::string.
1375         * icf.cc (Icf::find_identical_sections): Change type of local variable
1376         section_name to be std::string.
1377         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1378
1379 2011-01-25  Ian Lance Taylor  <iant@google.com>
1380
1381         * script.cc (script_add_extern): Rewrite to use
1382         add_symbol_reference.
1383
1384 2011-01-25  Doug Kwan  <dougkwan@google.com>
1385
1386         * icf.cc (get_section_contents): Always lock section's object.
1387
1388 2011-01-24  Ian Lance Taylor  <iant@google.com>
1389
1390         * options.h (class General_options): Accept
1391         --no-detect-odr-violations.
1392
1393 2011-01-24  Ian Lance Taylor  <iant@google.com>
1394
1395         * version.cc (version_string): Bump to 1.11.
1396
1397 2011-01-24  Ian Lance Taylor  <iant@google.com>
1398
1399         * plugin.cc (class Plugin_rescan): Define new class.
1400         (Plugin_manager::claim_file): Set any_claimed_.
1401         (Plugin_manager::save_archive): New function.
1402         (Plugin_manager::save_input_group): New function.
1403         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1404         necessary.
1405         (Plugin_manager::new_undefined_symbol): New function.
1406         (Plugin_manager::rescan): New function.
1407         (Plugin_manager::rescannable_defines): New function.
1408         (Plugin_manager::add_input_file): Set any_added_.
1409         * plugin.h (class Plugin_manager): define new fields rescannable_,
1410         undefined_symbols_, any_claimed_, and any_added_.  Declare
1411         Plugin_rescan as friend.  Declare new functions.
1412         (Plugin_manager::Rescannable): Define type.
1413         (Plugin_manager::Rescannable_list): Define type.
1414         (Plugin_manager::Undefined_symbol_list): Define type.
1415         (Plugin_manager::Plugin_manager): Initialize new fields.
1416         * archive.cc (Archive::defines_symbol): New function.
1417         (Add_archive_symbols::run): Pass archive to plugins if any.
1418         * archive.h (class Archive): Declare defines_symbol.
1419         * readsyms.cc (Input_group::~Input_group): New function.
1420         (Finish_group::run): Pass input_group to plugins if any.
1421         * readsyms.h (class Input_group): Declare destructor.
1422         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1423         any.
1424
1425 2011-01-10  Ian Lance Taylor  <iant@google.com>
1426
1427         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1428         section as relro.
1429         (Layout::set_segment_offsets): Reset increase_relro before calling
1430         set_section_addresses a second time.
1431
1432 2011-01-04  Cary Coutant  <ccoutant@google.com>
1433
1434         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1435         sections before NOBITS sections.
1436
1437 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1438
1439         * version.cc (print_version): Update copyright to 2011.
1440
1441 2010-12-23  Cary Coutant  <ccoutant@google.com>
1442
1443         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1444         of OS to this->add.  Add OD parameter to second form of the function.
1445
1446 2010-12-20  Ian Lance Taylor  <iant@google.com>
1447
1448         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1449         second of two consecutive entries with same offset.
1450
1451 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1452
1453         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1454         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1455         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1456         to avoid unneeded links against $(LDADD).
1457         * testsuite/Makefile.in: Regenerate.
1458
1459 2010-12-15  Ian Lance Taylor  <iant@google.com>
1460
1461         PR gold/12324
1462         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1463         for R_X86_64_32 and R_X86_64_PC32.
1464         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1465         ver_matching_def_pic.o.
1466         (ver_matching_def_pic.o): New target.
1467
1468 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1469
1470         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1471         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1472         Move definition before File_read::View member definitions.
1473         (File_read::View::~View): Initialize and hold lock before
1474         updating current_mapped_bytes.
1475
1476 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1477
1478         * dwarf_reader.cc: Remove outdated comment.
1479         * gold-threads.cc: Fix typo in error message.
1480         * archive.cc: Fix typos in comments.
1481         * archive.h: Likewise.
1482         * arm-reloc-property.cc: Likewise.
1483         * arm-reloc-property.h: Likewise.
1484         * arm-reloc.def: Likewise.
1485         * arm.cc: Likewise.
1486         * attributes.h: Likewise.
1487         * cref.cc: Likewise.
1488         * ehframe.cc: Likewise.
1489         * fileread.h: Likewise.
1490         * gold.h: Likewise.
1491         * i386.cc: Likewise.
1492         * icf.cc: Likewise.
1493         * incremental.h: Likewise.
1494         * int_encoding.cc: Likewise.
1495         * layout.h: Likewise.
1496         * main.cc: Likewise.
1497         * merge.h: Likewise.
1498         * object.cc: Likewise.
1499         * object.h: Likewise.
1500         * options.cc: Likewise.
1501         * readsyms.cc: Likewise.
1502         * reduced_debug_output.cc: Likewise.
1503         * reloc.cc: Likewise.
1504         * script-sections.cc: Likewise.
1505         * sparc.cc: Likewise.
1506         * symtab.h: Likewise.
1507         * target-reloc.h: Likewise.
1508         * target.cc: Likewise.
1509         * target.h: Likewise.
1510         * timer.cc: Likewise.
1511         * timer.h: Likewise.
1512         * x86_64.cc: Likewise.
1513
1514 2010-12-09  Cary Coutant  <ccoutant@google.com>
1515
1516         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1517         stack.
1518         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1519         parameter; change all callers.
1520         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1521         * options.h (warn_execstack): New option.
1522
1523 2010-12-07  Doug Kwan  <dougkwan@google.com>
1524
1525         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1526         like function call relocations.
1527
1528 2010-12-07  Ian Lance Taylor  <iant@google.com>
1529
1530         * archive.cc (Archive::get_elf_object_for_member): Permit
1531         punconfigured to be NULL.
1532         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1533         (Archive::include_member): Pass NULL to get_elf_object_for_member
1534         if we searched for the archive and this is the first included
1535         object.
1536
1537 2010-12-01  Ian Lance Taylor  <iant@google.com>
1538
1539         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1540         track_relocs_type_ field.
1541         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1542         Set track_relocs_type_.
1543         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1544         contents when using RELA relocs.
1545         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1546         reloc_map_.
1547         * reloc.cc (Track_relocs::next_addend): New function.
1548         * reloc.h (class Track_relocs): Declare next_addend.
1549
1550 2010-12-01  Ian Lance Taylor  <iant@google.com>
1551
1552         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1553         virtual destructor.
1554
1555 2010-12-01  Ian Lance Taylor  <iant@google.com>
1556
1557         * README: Update compilers known to work and fail.
1558
1559 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1560
1561         * configure.in: For --enable-gold, handle value `default' instead of
1562         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1563         not the default.
1564         * configure: Regenerate.
1565
1566 2010-11-18  Doug Kwan  <dougkwan@google.com>
1567
1568         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1569         and right_alignment to be zero.  Store result alignment only if it is
1570         greater than existing alignment.
1571
1572 2010-11-16  Cary Coutant  <ccoutant@google.com>
1573
1574         PR gold/12220
1575         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1576         Check for ".zdebug_line".
1577
1578 2010-11-16  Doug Kwan  <dougkwan@google.com>
1579             Cary Coutant  <ccoutant@google.com>
1580
1581         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1582         by reference; adjust all callers.
1583         * output.cc (Output_segment::set_section_addresses): Adjust references
1584         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1585         list is empty.
1586         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1587         end at page boundary.
1588
1589 2010-11-16  Cary Coutant  <ccoutant@google.com>
1590
1591         PR gold/12220
1592         * layout.cc (Layout::choose_output_section): Transform names of
1593         compressed sections even when using a script with a SECTIONS clause.
1594         (Layout::output_section_name): Remove code to transform
1595         compressed debug section names.
1596         * output.cc (Output_section::add_input_section): Use uncompressed
1597         section size when tracking input sections.
1598
1599 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1600
1601         * symtab.h (Symbol::NON_PIC_REF): Remove.
1602         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1603         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1604         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1605         (Symbol::use_plt_offset): Take a flags argument and pass it
1606         directly to needs_dynamic_reloc.  Restrict check for undefined
1607         weak symbols to function calls.
1608         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1609         (Target_arm::Scan::global): Use it.
1610         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1611         (Target_arm::Relocate::relocate): Likewise.
1612         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1613         parameter with an r_type parameter.  Use get_reference_flags
1614         to get the flags.
1615         (Target_arm::Relocate::relocate): Update accordingly.
1616         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1617         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1618         (Target_i386::Scan::global): Likewise.
1619         (Target_i386::Relocate::relocate): Likewise.
1620         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1621         parameter with an r_type parameter.  Use get_reference_flags
1622         to get the flags.
1623         (Target_i386::Relocate::relocate): Update accordingly.
1624         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1625         (Target_powerpc::Scan::global): Use it.
1626         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1627         (Target_powerpc::Relocate::relocate): Likewise.
1628         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1629         (Target_sparc::Scan::global): Use it.
1630         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1631         (Target_sparc::Relocate::relocate): Likewise.
1632         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1633         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1634         (Target_x86_64::Scan::global): Likewise.
1635         (Target_x86_64::Relocate::relocate): Likewise.
1636
1637 2010-11-08  Doug Kwan  <dougkwan@google.com>
1638             Cary Coutant  <ccoutant@google.com>
1639
1640         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1641         (Arm_exidx_merge_section::section_contents_): New data member.
1642         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1643         (Arm_input_section::~Arm_input_section): De-allocate memory.
1644         (Arm_input_section::original_contents_): New data member.       
1645         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1646         in parameters instead of calling Object::section_contents without
1647         locking.
1648         (Arm_output_section::group_section): New parameter TASK.  Pass it
1649         to callees that need locking objects.
1650         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1651         to lock EXIDX input sections.  Fix a formatting issue.  Call
1652         Arm_exidx_merged_section::build_contents to create merged section
1653         contents.
1654         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1655         to lock object of stub table owner.
1656         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1657         TEXT_SIZE to initialize data member TEXT_SIZE_.
1658         (Arm_exidx_input_section::addralign): Fix typo in comment.
1659         (Arm_exidx_input_section::text_size): New method.
1660         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1661         that require locking objects.  Lock objects before scanning for stubs
1662         and updating local symbols.
1663         (Arm_input_section<big_endian>::init): Copy contents of original
1664         input section.
1665         (Arm_input_section<big_endian>::do_write): Use saved contents of
1666         original input section instead of calling Object::section_contents
1667         without locking.
1668         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1669         size without calling Object::section_size().
1670         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1671         for size.  Allocate a buffer for merged EXIDX entries.
1672         (Arm_exidx_merged_section::build_contents): New method.
1673         (Arm_exidx_merged_section::do_write): Move merge section contents
1674         building code to Arm_exidx_merged_section::build_contetns.  Write
1675         out contetns in buffer instead of building it on the fly.
1676         (Arm_relobj::make_exidx_input_section): Also pass text section size
1677         to Arm_exidx_input_section constructor.
1678         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1679         (Arm_dynobj::do_read_symbols): Fix memory leak.
1680         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1681         * target.h: (class Task): Add forward declaration.
1682         (Target::relax): Add new parameter TASK and pass it to
1683         Target::do_relax().
1684         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1685
1686 2010-11-05  Cary Coutant  <ccoutant@google.com>
1687
1688         PR gold/10708
1689         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1690         object when reading from the file.
1691         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1692         second layout pass.
1693         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1694         when reading section contents.
1695         (get_section_contents): Likewise.
1696         (icf::find_identical_sections): Likewise.
1697         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1698         object when reading from the file.
1699         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1700         the object when doing deferred section layout.
1701
1702 2010-11-03  Nick Clifton  <nickc@redhat.com>
1703
1704         PR gold/12001
1705         * script.h (class Symbol_assignment: name): New member.  Returns
1706         the name of the symbol.
1707         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1708         Returns true if the given symbol name is on the list of
1709         assignments wating to be processed.
1710         * archive.cc (should_incldue_member): If the symbol is undefined,
1711         check to see if it is on the list of symbols pending assignment.
1712
1713 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1714
1715         * script-sections.cc (Script_sections::find_memory_region): Check
1716         for a NULL output section pointer.
1717
1718 2010-10-29  Doug Kwan  <dougkwan@google.com>
1719
1720         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1721         Output_section::add_relaxed_input_section.
1722         * output.cc (Output_section::add_relaxed_input_section): Add new
1723         arguments LAYOUT and NAME.  Set section order index.
1724         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1725         Copy section order index.
1726         * output.h (Output_section::add_relaxed_input_section): Add new
1727         arguments LAYOUT and NAME.
1728
1729 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1730
1731         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1732         NATIVE_OR_CROSS_LINKER.
1733         * testsuite/Makefile.in: Regenerate.
1734
1735 2010-10-20  Doug Kwan  <dougkwan@google.com>
1736
1737         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1738         without SHF_LINK_ORDER flags.
1739         * layout.cc (Layout::choose_output_section): Do not filter
1740         SHF_LINK_ORDER flag in a relocatable link.
1741
1742 2010-10-17  Cary Coutant  <ccoutant@google.com>
1743
1744         * output.h (Output_segment::set_section_addresses): Change function
1745         signature.  Update all callers.
1746         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1747         sections.
1748         (Output_segment::set_section_addresses): Align after last TLS
1749         section.  Add padding before last relro section instead of after.
1750
1751 2010-10-17  Doug Kwan  <dougkwan@google.com>
1752
1753         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1754         GOT output section to be writable.
1755
1756 2010-10-14  Cary Coutant  <ccoutant@google.com>
1757
1758         * debug.h (DEBUG_INCREMENTAL): New flag.
1759         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1760         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1761         mode.
1762         * incremental.cc (report_command_line): Ignore all forms of
1763         --incremental.
1764         * layout.cc (Layout::Layout): Check parameters for incremental link
1765         mode.
1766         * options.cc (General_options::parse_incremental): New function.
1767         (General_options::parse_no_incremental): New function.
1768         (General_options::parse_incremental_full): New function.
1769         (General_options::parse_incremental_update): New function.
1770         (General_options::incremental_mode_): New data member.
1771         (General_options::finalize): Check incremental_mode_.
1772         * options.h (General_options): Update help text for --incremental.
1773         Add --no-incremental, --incremental-full, --incremental-update.
1774         (General_options::Incremental_mode): New enum type.
1775         (General_options::incremental_mode): New function.
1776         (General_options::incremental_mode_): New data member.
1777         * parameters.cc (Parameters::incremental_mode_): New data member.
1778         (Parameters::set_options): Set incremental_mode_.
1779         (Parameters::set_incremental_full): New function.
1780         (Parameters::incremental): New function.
1781         (Parameters::incremental_update): New function.
1782         (set_parameters_incremental_full): New function.
1783         * parameters.h (Parameters::set_incremental_full): New function.
1784         (Parameters::incremental): New function.
1785         (Parameters::incremental_update): New function.
1786         (Parameters::incremental_mode_): New data member.
1787         (set_parameters_incremental_full): New function.
1788         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1789         incremental link mode.
1790         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1791         (Sized_relobj::do_relocate_sections): Likewise.
1792         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1793         option.
1794         * testsuite/Makefile.in: Regenerate.
1795         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1796
1797 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1798
1799         * script-sections.h (class Script_sections): Make
1800         Sections_elements typedef public.
1801         * script-sections.cc (class Sort_output_sections): Add elements_
1802         field.  Add constructor which sets it; change all callers.
1803         (Sort_output_sections::is_before): New function.
1804         (Sort_output_sections::operator()): Call is_before.
1805         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1806         conditional.
1807         * testsuite/script_test_10.sh: New test. Test script section
1808         order.
1809         * testsuite/script_test_10.t: Likewise.
1810         * testsuite/script_test_10.s: Likewise.
1811         * testsuite/Makefile.am: Wrap the cross linker tests and the
1812         common tests into NATIVE_OR_CROSS_LINKER.
1813         (check_SCRIPTS): Add script_test_10.sh.
1814         (check_DATA): Add script_test_10.stdout.
1815         (script_test_10.o, script_test_10): New targets.
1816         (script_test_10.stdout): New target.
1817         * configure, testsuite/Makefile.in: Regenerate.
1818
1819 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1820
1821         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1822         error for the deprecated relocations.
1823         (Target_arm::Scan::global): Likewise.
1824         (Target_arm::Relocate::relocate): Likewise.
1825
1826 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1827
1828         * fileread.cc (Input_file::find_file): Initialize *found_name
1829         and *namep when using the fallback search for case 4.
1830
1831 2010-10-11  Cary Coutant  <ccoutant@google.com>
1832
1833         * options.h (class General_options): Redefine -z lazy as an alias for
1834         the negation of -z now.
1835
1836 2010-10-11  Ian Lance Taylor  <iant@google.com>
1837
1838         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1839         binding.
1840
1841 2010-10-06  Nick Clifton  <nickc@redhat.com>
1842
1843         * script-sections.cc(class Memory_region): Remove
1844         current_lma_offset_ field.  Rename current_vma_offset_ to
1845         current_offset_.  Add last_section_ field.
1846         (Memory_region::get_current_vma_address): Rename to
1847         get_current_address.
1848         (Memory_region::get_current_lma_address): Delete.
1849         (Memory_region::increment_vma_offset): Rename to
1850         increment_offset.
1851         (Memory_region::increment_lma_offset): Delete.
1852         (Memory_region::attributes_compatible): New method.  Returns
1853         true if the provided section is compatible with the region.
1854         (Memory_region::get_last_section): New method.  Returns the last
1855         section to use the region.
1856         (Memory_region::set_last_section): New method.  Stores the last
1857         section to use the region.
1858         (Script_sections::block_in_region): New method.  Returns true if
1859         a block of memory is contained within a region.
1860         (Script_sections::find_memory_region): New method.  Locates a
1861         memory region to be used to set a VMA or LMA address.
1862         (Output_section_definition::set_section_addresses): Add code to
1863         check for addresses set by memory regions.
1864         (Output_segment::set_section_addresses): Remove memory region
1865         walking code.
1866         (Script_sections::create_segment): Add a warning if a header
1867         segment is created outside of any region.
1868         * script-sections.h (class Script_sections): Add prototypes for
1869         find_memory_region and block_in_region methods.
1870         * testsuite/memory_test.s: Use .long instead of .word.
1871         * testsuite/memory_test.t: Add some more output sections.
1872         * testsuite/memory_test.sh: Update expected output.
1873
1874 2010-10-02  Doug Kwan  <dougkwan@google.com>
1875
1876         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1877         defintion to symtab.h
1878         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1879         declaration to defintion.
1880
1881 2010-10-01  Nick Clifton  <nickc@redhat.com>
1882
1883         * expression.cc (eval): Replace dummy argument with NULL.
1884         (eval_maybe_dot): Check for a NULL result section pointer.
1885         (Symbol_expression::value): Likewise.
1886         (Dot_expression::value): Likewise.
1887         (BINARY_EXPRESSION): Likewise.
1888         (Max_expression::value): Likewise.
1889         (Min_expression::value): Likewise.
1890         (Absolute_expression::value): Likewise.
1891         (Addr_expression::value_from_output_section): Likewise.
1892         (Loaddddr_expression::value_from_output_section): Likewise.
1893         (Segment_start_expression::value): Likewise.
1894         * script-sections.cc
1895         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1896         argument with NULL.
1897         (Sections_elememt_dot_assignment::set_section_addresses):
1898         Likewise.
1899         (Output_data_expression::do_write_to_buffer): Likewise.
1900         (Output_section_definition::finalize_symbols): Likewise.
1901         (Output_section_definition::set_section_addresses): Likewise.
1902
1903 2010-09-30  Doug Kwan  <dougkwan@google.com>
1904
1905         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1906
1907 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1908
1909         * target.h (Target::can_icf_inline_merge_sections): New virtual
1910         function.
1911         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1912         virtual function.
1913         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1914         virtual function.
1915         * icf.cc (get_section_contents): Inline merge sections only when
1916         target allows it.
1917
1918 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1919
1920         * configure: Regenerate.
1921
1922 2010-09-17  Ian Lance Taylor  <iant@google.com>
1923
1924         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1925         * testsuite/Makefile.am (memory_test.o): New target.
1926         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1927         memory_test.t.
1928         * testsuite/Makefile.in: Rebuild.
1929
1930 2010-09-17  Doug Kwan  <dougkwan@google.com>
1931
1932         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1933         defintion if relocation uses GOT entries of the symbol.
1934         * testsuite/icf_safe_test.sh: Fix test.
1935         * testsuite/icf_safe_so_test.sh: Fix test.
1936
1937 2010-09-16  Cary Coutant  <ccoutant@google.com>
1938
1939         * script_sections.cc (class Memory_region): Remove "NULL" from
1940         vector initializations.
1941
1942 2010-09-15  Cary Coutant  <ccoutant@google.com>
1943
1944         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1945         Resolve forwarding symbols.
1946
1947 2010-09-15  Doug Kwan  <dougkwan@google.com>
1948
1949         * gold/testsuite/script_test_3.t: Add ARM special sections.
1950         * gold/testsuite/script_test_4.t: Same.
1951         * gold/testsuite/script_test_5.t: Same.
1952         * gold/testsuite/script_test_6.t: Same.
1953         * gold/testsuite/script_test_7.t: Same.
1954         * gold/testsuite/script_test_7.t: Same.
1955         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1956
1957 2010-09-14  Cary Coutant  <ccoutant@google.com>
1958
1959         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1960         (Target_x86_64::Relocate::relocate_tls): Replace check for
1961         saw_tls_block_reloc_ with test for executable section.
1962
1963 2010-09-12  Cary Coutant  <ccoutant@google.com>
1964
1965         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1966         position-independent executables to shared libraries need dynamic
1967         relocations.
1968         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1969         position-independent executables.
1970         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1971         * testsuite/Makefile.in: Regenerate.
1972
1973 2010-09-10  Nick Clifton  <nickc@redhat.com>
1974
1975         PR gold/11997
1976         * testsuite/memory_test.t: Discard any sections that are not
1977         needed.
1978
1979 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1980
1981         PR gold/11996
1982         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1983         "This::" to work around a bug in gcc 4.2.
1984
1985         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1986
1987 2010-09-09  Rafael Espindola  <espindola@google.com>
1988
1989         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1990         sections with different PF_X flags in the same segment.
1991         (Layout::find_first_load_seg): Search all segments to find the first
1992         one.
1993         * options.h (rosegment): New.
1994
1995 2010-09-08  Rafael Espindola  <espindola@google.com>
1996
1997         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1998
1999 2010-09-08  Doug Kwan  <dougkwan@google.com>
2000
2001         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2002         (Arm_relobj::do_relocate_sections): Add new parameter for output
2003         file to match the parent.
2004         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2005         of local symbols instead of input values.  Update code to track
2006         changes in gold::relocate_section.
2007         * object.cc (Sized_relobj::compute_final_local_value): New methods.
2008         (Sized_relobj::compute_final_local_value_internal): New methods.
2009         (Sized_relobj::do_finalize_local_symbols): Move code from loop
2010         body into private version of Sized_relobj::compute_final_local_value.
2011         Call the inline method.
2012         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
2013         merged symbol value if there is one.
2014         (Symbol_value::has_output_value): New method defintiion.
2015         (Sized_relobj::Compute_final_local_value_status): New enum type.
2016         (Sized_relobj::compute_final_local_value): New methods.
2017         (Sized_relobj::compute_final_local_value_internal): New methods.
2018         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2019         and arm_cortex_a8.sh.
2020         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2021         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2022         New tests.
2023         * Makefile.in: Regenerate.
2024         * testsuite/arm_bl_out_of_range.s: Update test.
2025         * testsuite/thumb_bl_out_of_range.s: Ditto.
2026         * testsuite/thumb_blx_out_of_range.s: Ditto.
2027         * testsuite/arm_branch_out_of_range.sh: New file.
2028         * testsuite/arm_cortex_a8.sh: Ditto.
2029         * testsuite/arm_cortex_a8_b.s: Ditto.
2030         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2031         * testsuite/arm_cortex_a8_b_local.s: Ditto.
2032         * testsuite/arm_cortex_a8_bl.s: Ditto.
2033         * testsuite/arm_cortex_a8_blx.s: Ditto.
2034         * testsuite/arm_cortex_a8_local.s: Ditto.
2035         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2036         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2037
2038 2010-09-08  Rafael Espindola  <espindola@google.com>
2039
2040         * Makefile.am (memory_test.stdout): Run readelf with -W.
2041         * Makefile.in: Regenerate.
2042         * testsuite/memory_test.sh: Make the regexps accept both 32 and
2043         64 bit output.
2044
2045 2010-09-08  Rafael Espindola  <espindola@google.com>
2046
2047         * script-sections.cc (Script_sections::add_memory_region): Convert
2048         field precision to int.
2049         * script.cc (script_set_section_region, script_set_section_region):
2050         Convert field precision to int.
2051
2052 2010-09-08  Rafael Espindola  <espindola@google.com>
2053
2054         * arm.cc (do_finalize_sections): Create the __exidx_start and
2055         __exdix_end symbols even when the section is missing.
2056
2057 2010-09-08  Nick Clifton  <nickc@redhat.com>
2058
2059         * README: Remove claim that MEMORY is not supported.
2060         * expression.cc (script_exp_function_origin)
2061         (script_exp_function_length): Move from here to ...
2062         * script.cc: ... here.
2063         (script_set_section_region, script_add_memory)
2064         (script_parse_memory_attr, script_include_directive): New
2065         functions.
2066         * script-sections.cc
2067         (class Memory_region): New class.
2068         (class Output_section_definition): Add set_memory_region,
2069         set_section_vma, set_section_lma and get_section_name methods.
2070         (class Script_Sections): Add add_memory_region,
2071         find_memory_region, find_memory_region_origin,
2072         find_memory_region_length and set_memory_region methods.
2073         Have set_section_addresses method walk the list of set memory
2074         regions.
2075         Extend the print methos to display memory regions.
2076         * script-sections.h: Add prototypes for new methods.
2077         Add enum for MEMORY region attributes.
2078         * yyscript.y: Add support for parsing MEMORY regions.
2079         * script-c.h: Add prototypes for new functions.
2080         * testsuite/Makefile.am: Add test of MEMORY region functionality.
2081         * testsuite/Makefile.in: Regenerate.
2082         * testsuite/memory_test.sh: New script.
2083         * testsuite/memory_test.s: New assembler source file.
2084         * testsuite/memory_test.t: New linker script.
2085
2086 2010-08-27  Doug Kwan  <dougkwan@google.com>
2087
2088         * gold/resolve.cc (Symbol_table::should_override): Let a weak
2089         reference override an existing dynamic weak reference.
2090         * testsuite/Makefile.am: Add new test dyn_weak_ref.
2091         * testsuite/Makefile.in: Regenerate.
2092         * testsuite/dyn_weak_ref.sh: New file.
2093         * testsuite/dyn_weak_ref_1.c: Ditto.
2094         * testsuite/dyn_weak_ref_2.c: Ditto.
2095
2096 2010-08-27  Ian Lance Taylor  <iant@google.com>
2097
2098         * incremental.h (class Incremental_input_entry): Add virtual
2099         destructor.
2100
2101 2010-08-27  Ian Lance Taylor  <iant@google.com>
2102
2103         * testsuite/start_lib_test_3.c: Mark t3 as used.
2104
2105 2010-08-27  Nick Clifton  <nickc@redhat.com>
2106
2107         * options.cc (version_script): Fix small typo in previous
2108         whitespace tidyup.
2109
2110 2010-08-25  Nick Clifton  <nickc@redhat.com>
2111
2112         * archive.cc: Formatting fixes: Remove whitespace between
2113         typename and following asterisk.  Remove whitespace between
2114         function name and opening parenthesis.
2115         * archive.h: Likewise.
2116         * arm.cc: Likewise.
2117         * attributes.cc: Likewise.
2118         * attributes.h: Likewise.
2119         * common.cc: Likewise.
2120         * copy-relocs.cc: Likewise.
2121         * dirsearch.h: Likewise.
2122         * dynobj.cc: Likewise.
2123         * ehframe.cc: Likewise.
2124         * ehframe.h: Likewise.
2125         * expression.cc: Likewise.
2126         * fileread.cc: Likewise.
2127         * fileread.h: Likewise.
2128         * gc.h: Likewise.
2129         * gold-threads.cc: Likewise.
2130         * gold.cc: Likewise.
2131         * i386.cc: Likewise.
2132         * icf.h: Likewise.
2133         * incremental-dump.cc: Likewise.
2134         * incremental.cc: Likewise.
2135         * layout.cc: Likewise.
2136         * layout.h: Likewise.
2137         * main.cc: Likewise.
2138         * merge.cc: Likewise.
2139         * merge.h: Likewise.
2140         * object.cc: Likewise.
2141         * object.h: Likewise.
2142         * options.cc: Likewise.
2143         * options.h: Likewise.
2144         * output.cc: Likewise.
2145         * output.h: Likewise.
2146         * plugin.cc: Likewise.
2147         * plugin.h: Likewise.
2148         * powerpc.cc: Likewise.
2149         * reloc.cc: Likewise.
2150         * script-c.h: Likewise.
2151         * script-sections.cc: Likewise.
2152         * script.cc: Likewise.
2153         * stringpool.cc: Likewise.
2154         * symtab.cc: Likewise.
2155         * symtab.h: Likewise.
2156         * target.cc: Likewise.
2157         * timer.cc: Likewise.
2158         * timer.h: Likewise.
2159         * version.cc: Likewise.
2160         * x86_64.cc: Likewise.
2161
2162 2010-08-24  Nick Clifton  <nickc@redhat.com>
2163
2164         PR 11899
2165         * layout.cc (segment_precedes): Sort segments by their physical
2166         addresses, if they have been set.
2167
2168 2010-08-23  Cary Coutant  <ccoutant@google.com>
2169
2170         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2171         symbols data.
2172         (Lib_group::include_member): Unlock object after deleting its
2173         symbols data.
2174         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2175         the bug fixed here.
2176
2177 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2178             Cary Coutant  <ccoutant@google.com>
2179
2180         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2181         constructor, and set_blocker.
2182         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2183         readsyms_blocker_.
2184         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2185         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2186         * testsuite/Makefile.am (start_lib_test): New test case.
2187         * testsuite/Makefile.in: Regenerate.
2188         * testsuite/start_lib_test_main.c: New file.
2189         * testsuite/start_lib_test_1.c: New file.
2190         * testsuite/start_lib_test_2.c: New file.
2191         * testsuite/start_lib_test_3.c: New file.
2192
2193 2010-08-19  Ian Lance Taylor  <iant@google.com>
2194
2195         * Makefile.in: Rebuild with automake 1.11.1.
2196         * aclocal.m4: Likewise.
2197         * testsuite/Makefile.in: Likewise.
2198
2199 2010-08-19  Ian Lance Taylor  <iant@google.com>
2200
2201         PR 10893
2202         * i386.cc (class Output_data_plt_i386): Update declarations.
2203         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2204         local_ifuncs_ fields.
2205         (Target_i386::do_plt_section_for_global): New function.
2206         (Target_i386::do_plt_section_for_local): New function.
2207         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2208         parameter; change all callers.  Initialize global_ifuncs_ and
2209         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2210         __rel_iplt_end.
2211         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2212         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2213         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2214         symbols.
2215         (Target_i386::make_plt_section): New function, broken out of
2216         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2217         (Target_i386::make_plt_entry): Call make_plt_section.
2218         (Target_i386::make_local_ifunc_plt_entry): New function.
2219         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2220         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2221         R_386_IRELATIVE to switch.
2222         (Target_i386::Scan::global): Likewise.
2223         (Target_i386::Relocate::relocate): Likewise.
2224         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2225         switch.
2226         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2227         (Target_x86_64::do_plt_section_for_global): New function.
2228         (Target_x86_64::do_plt_section_for_local): New function.
2229         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2230         parameter; change all callers.  If doing a static link define
2231         __rela_iplt_start and __rela_iplt_end.
2232         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2233         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2234         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2235         to point to .plt.
2236         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2237         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2238         switch.
2239         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2240         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2241         R_X86_64_IRELATIVE to switch.
2242         (Target_x86_64::Scan::global): Likewise.
2243         (Target_x86_64::Relocate::relocate): Likewise.
2244         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2245         switch.
2246         * target.h (class Target): Add plt_section_for_global and
2247         plt_section_for_local functions.  Add do_plt_section_for_global
2248         and do_plt_section_for_local virtual functions.
2249         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2250         clarifying comments.
2251         (Symbol::use_plt_offset): Handle IFUNC symbol.
2252         * object.cc (Sized_relobj::Sized_relobj): Initialize
2253         local_plt_offsets_.
2254         (Sized_relobj::local_has_plt_offset): New function.
2255         (Sized_relobj::local_plt_offset): New function.
2256         (Sized_relobj::set_local_plt_offset): New function.
2257         (Sized_relobj::do_count): Handle IFUNC symbol.
2258         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2259         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2260         is_ifunc_symbol functions.
2261         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2262         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2263         local_plt_offsets_ field.
2264         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2265         * output.h (class Output_section_data): Add non-const
2266         output_section function.
2267         (class Output_data_got): Update declarations.
2268         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2269         Add use_plt_offset parameter to global and local constructors.
2270         Change all callers.  Change local_sym_index_ field to 31 bits.
2271         Change GSYM_CODE and CONSTANT_CODE accordingly.
2272         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2273         doing a static link don't set sh_link field.
2274         (Output_data_got::Got_entry::write): Use PLT offset if
2275         appropriate.
2276         (Output_data_got::add_global_plt): New function.
2277         (Output_data_got::add_local_plt): New function.
2278         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2279         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2280         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2281         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2282         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2283         IFUNC conditional.
2284         * testsuite/ifunc-sel.h: New file.
2285         * testsuite/ifuncmain1.c: New file.
2286         * testsuite/ifuncmain1vis.c: New file.
2287         * testsuite/ifuncmod1.c: New file.
2288         * testsuite/ifuncdep2.c: New file.
2289         * testsuite/ifuncmain2.c: New file.
2290         * testsuite/ifuncmain3.c: New file.
2291         * testsuite/ifuncmod3.c: New file.
2292         * testsuite/ifuncmain4.c: New file.
2293         * testsuite/ifuncmain5.c: New file.
2294         * testsuite/ifuncmod5.c: New file.
2295         * testsuite/ifuncmain6pie.c: New file.
2296         * testsuite/ifuncmod6.c: New file.
2297         * testsuite/ifuncmain7.c: New file.
2298         * configure, testsuite/Makefile.in: Rebuild.
2299
2300 2010-08-18  Ian Lance Taylor  <iant@google.com>
2301
2302         * incremental.cc
2303         (Output_section_incremental_inputs::write_input_files): Add cast
2304         to avoid signed/unsigned comparison warning.
2305         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2306
2307 2010-08-12  Cary Coutant  <ccoutant@google.com>
2308
2309         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2310
2311 2010-08-13  Ian Lance Taylor  <iant@google.com>
2312
2313         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2314
2315 2010-08-12  Cary Coutant  <ccoutant@google.com>
2316             Doug Kwan  <dougkwan@google.com>
2317
2318         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2319         defintion overrides non-weak undef, remember that the original undef
2320         is not weak.
2321         * symtab.cc (Symbol_table::sized_write_global): For undef without
2322         an original weak binding, set binding to global in output.
2323         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2324         * testsuite/Makefile.in: Regenerate.
2325         * testsuite/strong_ref_weak_def.sh: New file.
2326         * testsuite/strong_ref_weak_def_1.c: Ditto.
2327         * testsuite/strong_ref_weak_def_2.c: Ditto.
2328
2329 2010-08-12  Cary Coutant  <ccoutant@google.com>
2330
2331         * testsuite/incremental_test.sh: Rewrite.
2332         * testsuite/incremental_test_1.c: Rewrite.
2333         * testsuite/incremental_test_2.c: Rewrite.
2334
2335 2010-08-12  Cary Coutant  <ccoutant@google.com>
2336
2337         * arm.cc (Target_arm::got_size): Add const.
2338         (Target_arm::got_entry_count): New function.
2339         (Target_arm::plt_entry_count): New function.
2340         (Target_arm::first_plt_entry_offset): New function.
2341         (Target_arm::plt_entry_size): New function.
2342         (Output_data_plt_arm::entry_count): New function.
2343         (Output_data_plt_arm::first_plt_entry_offset): New function.
2344         (Output_data_plt_arm::get_plt_entry_size): New function.
2345         * i386.cc (Target_i386::got_size): Add const.
2346         (Target_i386::got_entry_count): New function.
2347         (Target_i386::plt_entry_count): New function.
2348         (Target_i386::first_plt_entry_offset): New function.
2349         (Target_i386::plt_entry_size): New function.
2350         (Output_data_plt_i386::entry_count): New function.
2351         (Output_data_plt_i386::first_plt_entry_offset): New function.
2352         (Output_data_plt_i386::get_plt_entry_size): New function.
2353         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2354         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2355         * incremental.cc: Include target.h.
2356         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2357         parameter.  Adjust all callers.  Find incremental_got_plt section.
2358         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2359         section.
2360         (Output_section_incremental_inputs::set_final_data_size): Calculate
2361         size of incremental_got_plt section.
2362         (Output_section_incremental_inputs::do_write): Write the
2363         incremental_got_plt section.
2364         (Got_plt_view_info): New struct.
2365         (Local_got_offset_visitor): New class.
2366         (Global_got_offset_visitor): New class.
2367         (Global_symbol_visitor_got_plt): New class.
2368         (Output_section_incremental_inputs::write_got_plt): New function.
2369         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2370         Add parameter.  Adjust all callers.
2371         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2372         (Incremental_inputs::got_plt_section): New function.
2373         (Incremental_inputs::got_plt_section_): New data member.
2374         (Incremental_got_plt_reader): New class.
2375         * layout.cc (Layout::create_incremental_info_sections): Add the
2376         incremental_got_plt section.
2377         * object.h (Got_offset_list::get_list): New function.
2378         (Got offset_list::for_all_got_offsets): New function.
2379         (Sized_relobj::local_got_offset_list): New function.
2380         * powerpc.cc (Target_powerpc::got_size): Add const.
2381         (Target_powerpc::got_entry_count): New function.
2382         (Target_powerpc::plt_entry_count): New function.
2383         (Target_powerpc::first_plt_entry_offset): New function.
2384         (Target_powerpc::plt_entry_size): New function.
2385         (Output_data_plt_powerpc::entry_count): New function.
2386         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2387         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2388         * sparc.cc (Target_sparc::got_size): Add const.
2389         (Target_sparc::got_entry_count): New function.
2390         (Target_sparc::plt_entry_count): New function.
2391         (Target_sparc::first_plt_entry_offset): New function.
2392         (Target_sparc::plt_entry_size): New function.
2393         (Output_data_plt_sparc::entry_count): New function.
2394         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2395         (Output_data_plt_sparc::get_plt_entry_size): New function.
2396         * symtab.h (Symbol::got_offset_list): New function.
2397         (Symbol_table::for_all_symbols): New function.
2398         * target.h (Sized_target::got_entry_count): New function.
2399         (Sized_target::plt_entry_count): New function.
2400         (Sized_target::plt_entry_size): New function.
2401         * x86_64.cc (Target_x86_64::got_size): Add const.
2402         (Target_x86_64::got_entry_count): New function.
2403         (Target_x86_64::plt_entry_count): New function.
2404         (Target_x86_64::first_plt_entry_offset): New function.
2405         (Target_x86_64::plt_entry_size): New function.
2406         (Output_data_plt_x86_64::entry_count): New function.
2407         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2408         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2409
2410 2010-08-12  Cary Coutant  <ccoutant@google.com>
2411
2412         * archive.cc: Include incremental.h.
2413         (Archive::Archive): Initialize incremental_info_.
2414         (Archive::include_member): Record archive members in incremental info.
2415         (Add_archive_symbols::run): Record begin and end of an archive in
2416         incremental info.
2417         (Lib_group::include_member): Record objects in incremental info.
2418         * archive.h (Incremental_archive_entry): Forward declaration.
2419         (Archive::set_incremental_info): New member function.
2420         (Archive::incremental_info): New member function.
2421         (Archive::Unused_symbol_iterator): New class.
2422         (Archive::unused_symbols_begin): New member function.
2423         (Archive::unused_symbols_end): New member function.
2424         (Archive::incremental_info_): New data member.
2425         * incremental-dump.cc (find_input_containing_global): New function.
2426         (dump_incremental_inputs): Dump new incremental info sections.
2427         * incremental.cc: Include symtab.h.
2428         (Output_section_incremental_inputs): New class.
2429         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2430         new incremental info sections.
2431         (Sized_incremental_binary::do_check_inputs): Likewise.
2432         (Incremental_inputs::report_archive): Remove.
2433         (Incremental_inputs::report_archive_begin): New function.
2434         (Incremental_inputs::report_archive_end): New function.
2435         (Incremental_inputs::report_object): New function.
2436         (Incremental_inputs::finalize_inputs): Remove.
2437         (Incremental_inputs::report_input_section): New function.
2438         (Incremental_inputs::report_script): Rewrite.
2439         (Incremental_inputs::finalize): Do nothing but finalize string table.
2440         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2441         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2442         (Incremental_inputs::create_data_sections): New function.
2443         (Incremental_inputs::relocs_entsize): New function.
2444         (Output_section_incremental_inputs::set_final_data_size): New function.
2445         (Output_section_incremental_inputs::do_write): New function.
2446         (Output_section_incremental_inputs::write_header): New function.
2447         (Output_section_incremental_inputs::write_input_files): New function.
2448         (Output_section_incremental_inputs::write_info_blocks): New function.
2449         (Output_section_incremental_inputs::write_symtab): New function.
2450         * incremental.h (Incremental_script_entry): Forward declaration.
2451         (Incremental_object_entry): Forward declaration.
2452         (Incremental_archive_entry): Forward declaration.
2453         (Incremental_inputs): Forward declaration.
2454         (Incremental_inputs_header_data): Remove.
2455         (Incremental_inputs_header): Remove.
2456         (Incremental_inputs_header_write): Remove.
2457         (Incremental_inputs_entry_data): Remove.
2458         (Incremental_inputs_entry): Remove.
2459         (Incremental_inputs_entry_write): Remove.
2460         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2461         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2462         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2463         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2464         Likewise.
2465         (Incremental_input_entry): New class.
2466         (Incremental_script_entry): New class.
2467         (Incremental_object_entry): New class.
2468         (Incremental_archive_entry): New class.
2469         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2470         (Incremental_inputs::report_inputs): Remove.
2471         (Incremental_inputs::report_archive): Remove.
2472         (Incremental_inputs::report_archive_begin): New function.
2473         (Incremental_inputs::report_archive_end): New function.
2474         (Incremental_inputs::report_object): Change prototype.
2475         (Incremental_inputs::report_input_section): New function.
2476         (Incremental_inputs::report_script): Change prototype.
2477         (Incremental_inputs::get_reloc_count): New function.
2478         (Incremental_inputs::set_reloc_count): New function.
2479         (Incremental_inputs::create_data_sections): New function.
2480         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2481         (Incremental_inputs::inputs_section): New function.
2482         (Incremental_inputs::symtab_section): New function.
2483         (Incremental_inputs::relocs_section): New function.
2484         (Incremental_inputs::get_stringpool): Add const.
2485         (Incremental_inputs::command_line): Add const.
2486         (Incremental_inputs::inputs): Remove.
2487         (Incremental_inputs::command_line_key): New function.
2488         (Incremental_inputs::input_file_count): New function.
2489         (Incremental_inputs::input_files): New function.
2490         (Incremental_inputs::relocs_entsize): New function.
2491         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2492         (Incremental_inputs::finalize_inputs): Remove.
2493         (Incremental_inputs::Input_info): Remove.
2494         (Incremental_inputs::lock_): Remove.
2495         (Incremental_inputs::inputs_): Change type.
2496         (Incremental_inputs::inputs_map_): Remove.
2497         (Incremental_inputs::current_object_entry_): New data member.
2498         (Incremental_inputs::inputs_section_): New data member.
2499         (Incremental_inputs::symtab_section_): New data member.
2500         (Incremental_inputs::relocs_section_): New data member.
2501         (Incremental_inputs::reloc_count_): New data member.
2502         (Incremental_inputs_reader): New class.
2503         (Incremental_symtab_reader): New class.
2504         (Incremental_relocs_reader): New class.
2505         * layout.cc (Layout::finalize): Move finalization of incremental info
2506         and creation of incremental info sections to follow finalization of
2507         symbol table.  Set offsets for postprocessing sections.
2508         (Layout::create_incremental_info_sections): Call
2509         Incremental_inputs::create_data_sections.  Add incremental symtab
2510         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2511         sections to layout after input sections.
2512         * layout.h (struct Timespec): Forward declaration.
2513         (Layout::incremental_inputs): Add const.
2514         (Layout::create_incremental_info_sections): Add parameter.
2515         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2516         * object.cc: Include incremental.h.
2517         (Relobj::finalize_incremental_relocs): New function.
2518         (Sized_relobj::do_layout): Record input sections in incremental info.
2519         * object.h (Object::output_section): New function.
2520         (Object::output_section_offset): Moved from Relobj.
2521         (Object::get_incremental_reloc_base): New function.
2522         (Object::get_incremental_reloc_count): New function.
2523         (Object::do_output_section): New function.
2524         (Object::do_output_section_offset): Moved from Relobj.
2525         (Object::do_get_incremental_reloc_base): New function.
2526         (Object::do_get_incremental_reloc_count): New function.
2527         (Object::Object): Initialize new data members.
2528         (Relobj::output_section): Renamed do_output_section and moved to
2529         protected.
2530         (Relobj::output_section_offset): Moved to Object.
2531         (Relobj::do_get_incremental_reloc_base): New function.
2532         (Relobj::do_get_incremental_reloc_count): New function.
2533         (Relobj::allocate_incremental_reloc_counts): New function.
2534         (Relobj::count_incremental_reloc): New function.
2535         (Relobj::finalize_incremental_relocs): New function.
2536         (Relobj::next_incremental_reloc_index): New function.
2537         (Relobj::reloc_counts_): New data member.
2538         (Relobj::reloc_bases_): New data member.
2539         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2540         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2541         (Sized_relobj::incremental_relocs_scan): New function.
2542         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2543         (Sized_relobj::incremental_relocs_write): New function.
2544         (Sized_relobj::incremental_relocs_write_reltype): New function.
2545         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2546         incremental link.
2547         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2548         archives and object files elsewhere.
2549         (Add_symbols::run): Report object files here.
2550         (Finish_group::run): Report end of archive at end of group.
2551         * reloc.cc: Include layout.h, incremental.h.
2552         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2553         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2554         (Sized_relobj::incremental_relocs_scan): New function.
2555         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2556         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2557         (Sized_relobj::incremental_relocs_write): New function.
2558         (Sized_relobj::incremental_relocs_write_reltype): New function.
2559         * script.cc (read_input_script): Rewrite test for incremental link.
2560         Change call to Incremental_inputs::report_script.
2561         * symtab.h (Symbol_table::first_global_index): New function.
2562         (Symbol_table::output_count): New function.
2563
2564 2010-08-12  Doug Kwan  <dougkwan@google.com>
2565
2566         * arm.cc (Target_arm::merge_object_attributes): Check command line
2567         options --no-wchar-size-warning and --no-enum-size-warning.
2568         * options.h (General_options): Add ld-compatible options
2569         --no-enum-size-warning and --no-wchar-size-warning.
2570
2571 2010-08-04  Ian Lance Taylor  <iant@google.com>
2572
2573         * x86_64.cc (Target_x86_64::Scan::local): Use
2574         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2575         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2576         (Target_x86_64::Scan::global): Likewise.
2577         (Target_x86_64::Relocate::relocate): Likewise.
2578         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2579         Likewise.
2580
2581 2010-08-03  Cary Coutant  <ccoutant@google.com>
2582
2583         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2584         to reserve space in merged_strings vector. Keep total input size
2585         for stats.
2586         (Output_merge_string::do_print_merge_stats): Print total input size.
2587         * merge.h (Output_merge_string): Add input_size_ field.
2588         * stringpool.cc (Stringpool_template::string_length): Move
2589         implementations out of Stringpool_template class and place in
2590         stringpool.h.
2591         * stringpool.h (string_length): Move out of Stringpool_template.
2592
2593 2010-08-03  Ian Lance Taylor  <iant@google.com>
2594
2595         PR 11712
2596         * layout.cc (relaxation_loop_body): If address of load segment is
2597         set, adjust address to include headers if possible.
2598
2599 2010-08-03  Ian Lance Taylor  <iant@google.com>
2600
2601         * version.cc (version_string): Bump to 1.10.
2602
2603 2010-08-03  Ian Lance Taylor  <iant@google.com>
2604
2605         PR 11805
2606         * layout.h (enum Output_section_order): Define.
2607         (class Layout): Update declarations.
2608         * layout.cc (Layout::get_output_section): Add order parameter.
2609         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2610         is_first_non_relro parameters.  Change all callers.
2611         (Layout::choose_output_section): Likewise.
2612         (Layout::add_output_section_data): Likewise.
2613         (Layout::make_output_section): Likewise.  Set order.
2614         (Layout::default_section_order): New function.
2615         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2616         * output.cc (Output_section::Output_section): Initialize order_.
2617         Don't initialize deleted fields.
2618         (Output_segment::Output_segment): Don't initialize deleted
2619         fields.
2620         (Output_segment::add_output_section_to_load): New function
2621         replacing add_output_section.  Change all callers to call this or
2622         add_output_section_to_nonload.
2623         (Output_segment::add_output_section_to_nonload): New function.
2624         (Output_segment::remove_output_section): Rewrite.
2625         (Output_segment::add_initial_output_data): Likewise.
2626         (Output_segment::has_any_data_sections): Likewise.
2627         (Output_segment::is_first_section_relro): Likewise.
2628         (Output_segment::maximum_alignment): Likewise.
2629         (Output_segment::has_dynamic_reloc): New function replacing
2630         dynamic_reloc_count.  Change all callers.
2631         (Output_segment::has_dynamic_reloc_list): New function replacing
2632         dynamic_reloc_count_list.  Change all callers.
2633         (Output_segment::set_section_addresses): Rewrite.
2634         (Output_segment::set_offset): Rewrite.
2635         (Output_segment::find_first_and_last_list): Remove.
2636         (Output_segment::set_tls_offsets): Rewrite.
2637         (Output_segment::first_section_load_address): Likewise.
2638         (Output_segment::output_section_count): Likewise.
2639         (Output_segment::section_with_lowest_load_address): Likewise.
2640         (Output_segment::write_section_headers): Likewise.
2641         (Output_segment::print_sections_to_map): Likewise.
2642         * output.h (class Output_data): Remove dynamic_reloc_count_
2643         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2644         (Output_data::add_dynamic_reloc): Rewrite.
2645         (Output_data::has_dynamic_reloc): New function.
2646         (Output_data::dynamic_reloc_count): Remove.
2647         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2648         is_last_relro_, is_first_non_relro_, is_interp_,
2649         is_dynamic_linker_section_ fields.  Add order and set_order
2650         functions.  Remove is_relro_local, set_is_relro_local,
2651         is_last_relro, set_is_last_relro, is_first_non_relro,
2652         set_is_first_non_relro functions, is_interp, set_is_interp,
2653         is_dynamic_linker_section, and set_is_dynamic_linker_section
2654         functions.
2655         (class Output_segment): Change Output_data_list from std::list to
2656         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2657         output_bss_ fields.  Update declarations.
2658
2659 2010-08-02  Ian Lance Taylor  <iant@google.com>
2660
2661         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2662         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2663         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2664
2665 2010-08-02  Ian Lance Taylor  <iant@google.com>
2666
2667         PR 11855
2668         * script.cc (Script_options::Script_options): Initialize
2669         symbol_definitions_ and symbol_references_.
2670         (Script_options::add_symbol_assignment): Update
2671         symbol_definitions_ and symbol_references_.
2672         (Script_options::add_symbol_reference): New function.
2673         (script_symbol): New function.
2674         * script.h (class Script_options): Add symbol_definitions_ and
2675         symbol_references_ fields.
2676         (Script_options::referenced_const_iterator): New type.
2677         (Script_options::referenced_begin): New function.
2678         (Script_options::referenced_end): New function.
2679         (Script_options::is_referenced): New function.
2680         (Script_options::any_unreferenced): New function.
2681         * script-c.h (script_symbol): Declare.
2682         * yyscript.y (exp): Call script_symbol.
2683         * symtab.cc: Include "script.h".
2684         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2685         Change all callers.  Check symbols referenced by scripts.
2686         (Symbol_table::add_undefined_symbols_from_command_line): Add
2687         layout parameter.  Change all callers.
2688         (Symbol_table::do_add_undefined_symbols_from_command_line):
2689         Likewise.  Break out loop body.  Check symbols referenced by
2690         scripts.
2691         (Symbol_table::add_undefined_symbol_from_command_line): New
2692         function broken out of
2693         do_add_undefined_symbols_from_command_line.
2694         * symtab.h (class Symbol_table): Update declarations.
2695         * archive.cc: Include "layout.h".
2696         (Archive::should_include_member): Add layout parameter.  Change
2697         all callers.  Check for symbol mentioned in expression.
2698         * archive.h (class Archive): Update declaration.
2699         * object.cc (Sized_relobj::do_should_include_member): Add layout
2700         parameter.
2701         * object.h (Object::should_include_member): Add layout parameter.
2702         Change all callers.
2703         (Object::do_should_include_member): Add layout parameter.
2704         (class Sized_relobj): Update declaration.
2705         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2706         parameter.
2707         * dynobj.h (class Sized_dynobj): Update declaration.
2708         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2709         layout parameter.
2710         * plugin.h (class Sized_pluginobj): Update declaration.
2711
2712 2010-08-02  Ian Lance Taylor  <iant@google.com>
2713
2714         PR 11866
2715         * output.cc (Output_segment::set_offset): Search for the first and
2716         last sections rather than assuming that the list is in order.
2717         (Output_segment::find_first_and_last_list): New function.
2718         * output.h (class Output_segment): Update declarations.
2719         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2720         (relro_strip_test_SOURCES): New variable.
2721         (relro_strip_test_DEPENDENCIES): New variable.
2722         (relro_strip_test_LDFLAGS): New variable.
2723         (relro_strip_test_LDADD): New variable.
2724         (relro_strip_test.so): New target.
2725
2726 2010-08-02  Ian Lance Taylor  <iant@google.com>
2727
2728         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2729         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2730         (Target_i386::got_tlsdesc_section): New function.
2731         (Target_i386::got_section): Create space for GOT entries for
2732         TLSDESC relocations.
2733         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2734         R_386_TLS_GOTDESC.
2735         (Target_i386::Scan::global): Likewise.
2736         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2737         using TLSDESC GOT.
2738         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2739         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2740         (Target_x86_64::got_tlsdesc_section): New function.
2741         (Target_x86_64::got_section): Create space for GOT entries for
2742         TLSDESC relocations.
2743         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2744         R_386_TLS_GOTDESC.
2745         (Target_x86_64::Scan::global): Likewise.
2746         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2747         using TLSDESC GOT.
2748
2749 2010-08-02  Ian Lance Taylor  <iant@google.com>
2750
2751         * testsuite/final_layout.sh: Use dc to convert from hex to
2752         decimal.
2753
2754 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2755
2756         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2757         paramter to the call to gold::gc_process_relocs.
2758         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2759         paramter to the call to gold::gc_process_relocs.
2760         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2761         parameter to the call to gold::gc_process_relocs.
2762         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2763         template parameter to the call to gold::gc_process_relocs.
2764         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2765         paramter to the call to gold::gc_process_relocs.
2766         * gc.h (get_embedded_addend_size): New function.
2767         (gc_process_relocs): Save the size of the reloc for use by ICF.
2768         * icf.cc (get_section_contents): Get the addend from the text section
2769         for SHT_REL relocation sections.
2770         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2771         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2772         * int_encoding.h (read_from_pointer): New overloaded function.
2773         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2774         * testsuite/icf_sht_rel_addend_test.sh: New file.
2775         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2776         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2777
2778 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2779
2780         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2781         * Makefile.in: Regenerate.
2782         * testsuite/Makefile.in: Regenerate.
2783
2784 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2785
2786         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2787         * gold/testsuite/debug_msg.cc: Likewise.
2788         * gold/testsuite/odr_violation1.cc
2789         * gold/testsuite/odr_violation2.cc
2790
2791 2010-07-21  Cary Coutant  <ccoutant@google.com>
2792
2793         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2794         string, and length fields.
2795         (Output_merge_string::Merged_strings_list): New type.
2796         (Output_merge_string::Merged_strings_lists): New typedef.
2797         (Output_merge_string): Replace merged_strings_ with
2798         merged_strings_lists_.
2799         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2800         Merged_strings_list per input object and section.  Don't store pointer
2801         to the string.  Don't store length with each merged string entry.
2802         (Output_merge_string::finalize_merged_data): Loop over list of merged
2803         strings lists.  Recompute length of each merged string.
2804
2805 2010-07-15  Cary Coutant  <ccoutant@google.com>
2806
2807         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2808         here.
2809
2810 2010-07-14  Ian Lance Taylor  <iant@google.com>
2811
2812         * descriptors.cc (Descriptors::open): Report correct name in error
2813         message.
2814
2815 2010-07-13  Doug Kwan  <dougkwan@google.com>
2816
2817         * arm.cc (Arm_input_section::Arm_input_section): For a
2818         SHT_ARM_EXIDX section, always keeps the input sections.
2819         (Arm_input_section::set_exidx_section_link): New method.
2820         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2821         has_errors_ to false.
2822         (Arm_exidx_input_section::has_errors,
2823         Arm_exidx_input_section::set_has_errors): New methods.
2824         (Arm_exidx_input_section::has_errors_): New data member.
2825         (Arm_relobj::get_exidx_shndx_list): New method.
2826         (Arm_output_section::append_text_sections_to_list): Do not skip
2827         section without SHF_EXECINSTR.
2828         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2829         errors.
2830         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2831         section header.  Make error messages more verbose.  Check for
2832         a non-executable section linked to an EXIDX section.
2833         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2834         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2835         check that there is no deferred EXIDX section if we exit early.
2836         Instead of not making an EXIDX section in case of an error, make one
2837         and set the has_errors flag of it.
2838         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2839         in a relocatable link.
2840         (Target_arm::do_relax): Look for the EXIDX output section instead of
2841         assuming that it is called .ARM.exidx.
2842         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2843         section list.  Do not check for SHF_EXECINSTR section flags but
2844         skip any input section with errors.
2845         * output.cc (Output_section::Output_section): Initialize
2846         always_keeps_input_sections_ to false.
2847         (Output_section::add_input_section): Check for
2848         always_keeps_input_sections_.
2849         *  output.h (Output_section::always_keeps_input_sections,
2850         Output_section::set_always_keeps_input_sections): New methods.
2851         (Output_section::always_keeps_input_sections): New data member.
2852
2853 2010-07-13  Rafael Espindola  <espindola@google.com>
2854
2855         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2856         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2857
2858 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2859             Ian Lance Taylor  <iant@google.com>
2860
2861         * output.h (Output_section_lookup_maps::add_merge_section):
2862         Correct check of whether value was inserted.
2863         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2864         (Output_section_lookup_maps::add_relaxed_input_section):
2865         Likewise.
2866         * arm.cc (Target_arm::got_section): Remove used local os.
2867         * i386.cc (Target_i386::got_section): Likewise.
2868         * x86_64.cc (Target_x86_64::got_section): Likewise.
2869         * sparc.cc (Target_sparc::got_section): Likewise.
2870         (Target_sparc::relocate): Remove unused local have_got_offset.
2871         * powerpc.cc (Target_powerpc::relocate): Likewise.
2872
2873 2010-07-13  Ian Lance Taylor  <iant@google.com>
2874
2875         * compressed_output.cc (zlib_decompress): Fix signature in
2876         !HAVE_ZLIB_H case.
2877
2878         * archive.cc (Archive::include_member): Unlock an external member
2879         of a thin archive.  Don't bother to delete an object we know is
2880         NULL.
2881
2882 2010-07-12  Cary Coutant  <ccoutant@google.com>
2883
2884         * compressed_output.cc (zlib_decompress): New function.
2885         (get_uncompressed_size): New function.
2886         (decompress_input_section): New function.
2887         * compressed_output.h (get_uncompressed_size): New function.
2888         (decompress_input_section): New function.
2889         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2890         Handle compressed debug sections.
2891         * layout.cc (is_compressed_debug_section): New function.
2892         (Layout::output_section_name): Map compressed section names to
2893         canonical names.
2894         * layout.h (is_compressed_debug_section): New function.
2895         (is_debug_info_section): Recognize compressed debug sections.
2896         * merge.cc: Include compressed_output.h.
2897         (Output_merge_data::do_add_input_section): Handle compressed
2898         debug sections.
2899         (Output_merge_string::do_add_input_section): Handle compressed
2900         debug sections.
2901         * object.cc: Include compressed_output.h.
2902         (Sized_relobj::Sized_relobj): Initialize new data members.
2903         (build_compressed_section_map): New function.
2904         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2905         * object.h (Object::section_is_compressed): New method.
2906         (Object::do_section_is_compressed): New method.
2907         (Sized_relobj::Compressed_section_map): New type.
2908         (Sized_relobj::do_section_is_compressed): New method.
2909         (Sized_relobj::compressed_sections_): New data member.
2910         * output.cc (Output_section::add_input_section): Handle compressed
2911         debug sections.
2912         * reloc.cc: Include compressed_output.h.
2913         (Sized_relobj::write_sections): Handle compressed debug sections.
2914
2915 2010-07-08  Cary Coutant  <ccoutant@google.com>
2916
2917         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2918         weak when resolving to a dynamic def.
2919         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2920         for weak undef/dynamic def cases. Adjust callers.
2921         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2922         undef_binding_weak_.
2923         (Symbol_table::sized_write_globals): Adjust symbol binding.
2924         (Symbol_table::sized_write_symbol): Add binding parameter.
2925         * symtab.h (Symbol::set_undef_binding): New method.
2926         (Symbol::is_undef_binding_weak): New method.
2927         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2928         (Symbol_table::should_override): Add new parameter.
2929         (Symbol_table::sized_write_symbol): Add new parameter.
2930
2931         * testsuite/weak_undef_file1.cc: Add new test case.
2932         * testsuite/weak_undef_file2.cc: Fix header comment.
2933         * testsuite/weak_undef_test.cc: Add new test case.
2934
2935 2010-06-29  Doug Kwan  <dougkwan@google.com>
2936
2937         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2938         Initialize USE_SYMBOL_.
2939         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2940         definition.
2941         (Arm_reloc_property::uses_symbol_): New data member declaration.
2942         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2943         uses symbol value and symbol is undefined but not weakly undefined.
2944
2945 2010-06-28  Rafael Espindola  <espindola@google.com>
2946
2947         * plugin.cc (Plugin::load): Use dlerror.
2948
2949 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2950
2951         * symtab.cc (detect_odr_violations): When reporting an ODR
2952         violation, report an object where the symbol is defined.
2953
2954 2010-06-25  Doug Kwan  <dougkwan@google.com>
2955
2956         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2957         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2958         definition.
2959         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2960         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2961         target hook to detect function points.
2962         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2963         * icf.h (Icf::check_section_for_function_pointers): Change type of
2964         parameter SECTION_NAME to const reference to std::string.  Use
2965         target hook to determine if section may have unsafe pointers.
2966         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2967         method definition.
2968
2969 2010-06-21  Rafael Espindola  <espindola@google.com>
2970
2971         * fileread.cc (Input_file::find_fie): New
2972         (Input_file::open): Use Input_file::find_fie.
2973         * fileread.h (Input_file::find_fie): New
2974         * plugin.cc (set_extra_library_path): New.
2975         (Plugin::load): Add set_extra_library_path to the transfer vector.
2976         (Plugin_manager::set_extra_library_path): New.
2977         (Plugin_manager::add_input_file): Use the extra search path if set.
2978         (set_extra_library_path(): New.
2979         * plugin.h (Plugin_manager): Add set_extra_library_path and
2980         extra_search_path_.
2981
2982 2010-06-19  Cary Coutant  <ccoutant@google.com>
2983
2984         * layout.cc (gdb_sections): Add .debug_types.
2985         (lines_only_debug_sections): Likewise.
2986
2987 2010-06-18  Rafael Espindola  <espindola@google.com>
2988
2989         * plugin.cc (add_input_file,add_input_library)
2990         (Plugin_manager::add_input_file): Make filename arguments const.
2991         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2992         const.
2993
2994 2010-06-16  Doug Kwan  <dougkwan@google.com>
2995
2996         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2997         .ARM.attributes section if we have not merged any input
2998         attributes sections.
2999
3000 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3001
3002         * arm.cc: Allow combining objects with no EABI version
3003         information.
3004
3005 2010-06-15  Rafael Espindola  <espindola@google.com>
3006
3007         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3008
3009 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3010
3011         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3012         (struct iovec): Correct !HAVE_READV definition.
3013
3014 2010-06-10  Cary Coutant  <ccoutant@google.com>
3015
3016         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3017         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3018         reloc sections.
3019         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3020
3021         PR 11683
3022         * symtab.h (Symbol::is_placeholder): New member function.
3023         * target-reloc.h (relocate_section): Check for placeholder symbols.
3024
3025         * testsuite/Makefile.am (plugin_test_8): New test.
3026         (plugin_test_9): New test.
3027         * testsuite/Makefile.in: Regenerate.
3028
3029 2010-06-09  Nick Clifton  <nickc@redhat.com>
3030
3031         * yyscript.y (input_list_element): Allow strings prefixed with
3032         the '-' character.  Treat these as libraries.
3033         * script.cc (script_add_library): New function.  Adds a library
3034         specified by "-l<name>" found in an input script.
3035         * script-c.h: Add prototype for script_add_library.
3036
3037 2010-06-07  Doug Kwan  <dougkwan@google.com>
3038
3039         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3040         Restrict stub-group size to be within long conditional branch
3041         range when working around cortex-A8 erratum.
3042
3043 2010-06-07  Damien Diederen  <dd@crosstwine.com>
3044
3045         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3046         #ifdef typo.
3047
3048 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
3049
3050         PR gold/11658
3051         * output.cc
3052         (Output_section::Input_section_sort_entry::compare_section_ordering):
3053         Change to return non-zero correctly.
3054         (Output_section::Input_section_sort_section_order_index_compare
3055         ::operator()): Change to fix ambiguity in comparisons.
3056
3057 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
3058
3059         * gold.h (is_wildcard_string): New function.
3060         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3061         (Layout::layout_eh_frame): Ditto.
3062         (Layout::find_section_order_index): New method.
3063         (Layout::read_layout_from_file): New method.
3064         * layout.h (Layout::find_section_order_index): New method.
3065         (Layout::read_layout_from_file): New method.
3066         (Layout::input_section_position_): New private member.
3067         (Layout::input_section_glob_): New private member.
3068         * main.cc (main): Call read_layout_from_file here.
3069         * options.h (--section-ordering-file): New option.
3070         * output.cc (Output_section::input_section_order_specified_): New
3071         member.
3072         (Output_section::Output_section): Initialize new member.
3073         (Output_section::add_input_section): Add new parameter.
3074         Keep input sections when --section-ordering-file is used.
3075         (Output_section::set_final_data_size): Sort input sections when
3076         section ordering file is specified.
3077         (Output_section::Input_section_sort_entry): Add new parameter.
3078         Check sorting type.
3079         (Output_section::Input_section_sort_entry::compare_section_ordering):
3080         New method.
3081         (Output_section::Input_section_sort_compare::operator()): Change to
3082         consider section_order_index.
3083         (Output_section::Input_section_sort_init_fini_compare::operator()):
3084         Change to consider section_order_index.
3085         (Output_section::Input_section_sort_section_order_index_compare
3086         ::operator()): New method.
3087         (Output_section::sort_attached_input_sections): Change to sort
3088         according to section order when specified.
3089         (Output_section::add_input_section<32, true>): Add new parameter.
3090         (Output_section::add_input_section<64, true>): Add new parameter.
3091         (Output_section::add_input_section<32, false>): Add new parameter.
3092         (Output_section::add_input_section<64, false>): Add new parameter.
3093         * output.h (Output_section::add_input_section): Add new parameter.
3094         (Output_section::input_section_order_specified): New
3095         method.
3096         (Output_section::set_input_section_order_specified): New method.
3097         (Input_section::Input_section): Initialize section_order_index_.
3098         (Input_section::section_order_index): New method.
3099         (Input_section::set_section_order_index): New method.
3100         (Input_section::section_order_index_): New member.
3101         (Input_section::Input_section_sort_section_order_index_compare): New
3102         struct.
3103         (Output_section::input_section_order_specified_): New member.
3104         * script-sections.cc (is_wildcard_string): Delete and move modified
3105         method to gold.h.
3106         (Output_section_element_input::Output_section_element_input): Modify
3107         call to is_wildcard_string.
3108         (Output_section_element_input::Input_section_pattern
3109         ::Input_section_pattern): Ditto.
3110         (Output_section_element_input::Output_section_element_input): Ditto.
3111         * testsuite/Makefile.am (final_layout): New test case.
3112         * testsuite/Makefile.in: Regenerate.
3113         * testsuite/final_layout.cc: New file.
3114         * testsuite/final_layout.sh: New file.
3115
3116 2010-06-01  Rafael Espindola  <espindola@google.com>
3117
3118         * plugin.cc (Plugin::load): Pass the output name to the plugin.
3119
3120 2010-06-01  Rafael Espindola  <espindola@google.com>
3121
3122         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3123         visibility of symbols.
3124
3125 2010-05-27  Doug Kwan  <dougkwan@google.com>
3126
3127         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3128         from start of output section instead of address for a local symbol
3129         in a merged or relaxed section when doing a relocatable link.
3130
3131 2010-05-26  Rafael Espindola  <espindola@google.com>
3132
3133        PR 11604
3134         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3135         adding sections the garbage collector removed.
3136         * gold/testsuite/Makefile.am: Add test.
3137         * gold/testsuite/Makefile.in: Regenerate.
3138         * gold/testsuite/plugin_test_7.sh: New.
3139         * gold/testsuite/plugin_test_7_1.c: New.
3140         * gold/testsuite/plugin_test_7_2.c: New.
3141
3142 2010-05-26  Rafael Espindola  <espindola@google.com>
3143
3144         * script-sections.cc (Output_section_definition::set_section_addresses):
3145         Check for --section-start.
3146
3147 2010-05-26  Doug Kwan  <dougkwan@google.com>
3148
3149         * arm.cc (Arm_scan_relocatable_relocs): New class.
3150         (Target_arm::relocate_special_relocatable): New method.
3151         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3152         (Arm_relocate_functions::thumb_branch_common): Same.
3153         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3154         instead of Default_scan_relocatable_relocs.
3155         * target-reloc.h (relocate_for_relocatable): Let target handle
3156         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3157         * target.h (Sized_target::relocate_special_relocatable): New method.
3158
3159 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3160
3161         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3162
3163 2010-05-23  Doug Kwan  <dougkwan@google.com>
3164
3165         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3166         instead of a cast.
3167         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3168         with a direct branch, not a conditional branch, to a stub.
3169         * merge.cc (Output_merge_base::record_input_section): New method
3170         defintion.
3171         (Output_merge_data::do_add_input_section): Record input section if
3172         keeps-input-sections flag is set.
3173         (Output_merge_string::do_add_input_section): Ditto.
3174         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3175         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3176         INPUT_SECTIONS_.
3177         (Output_merge_base::keeps_input_sections,
3178         Output_merge_base::set_keeps_input_sections,
3179         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3180         method definitions.
3181         (Output_merge_base::Input_sections): New type declaration.
3182         (Output_merge_base::input_sections_begin,
3183         Output_merge_base::input_sections_end,
3184         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3185         (Output_merge_base::bool keeps_input_sections_,
3186         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3187         Output_merge_base::input_sections_): New data members.
3188         (Output_merge_data::do_set_keeps_input_sections): New method
3189         defintion.
3190         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3191         * output.cc (Output_section::Input_section::relobj): Move method
3192         defintion from class declaration to here and handle merge sections.
3193         (Output_section::Input_section::shndx): Ditto.
3194         (Output_section::Output_section): Remove initializations of removed
3195         data members and initialize new data member LOOKUP_MAPS_.
3196         (Output_section::add_input_section): Set keeps-input-sections flag
3197         for a newly created merge output section as appropriate.  Adjust code
3198         to use Output_section_lookup_maps class.
3199         (Output_section::add_relaxed_input_section): Adjst code for lookup
3200         maps code refactoring.
3201         (Output_section::add_merge_input_section): Add a new parameter
3202         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3203         class.  If adding input section to a newly created merge output
3204         section fails, remove the new merge section.
3205         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3206         Adjust code for use of the Output_section_lookup_maps class.
3207         (Output_section::find_merge_section): Ditto.
3208         (Output_section::build_lookup_maps): New method defintion.
3209         (Output_section::find_relaxed_input_section): Adjust code to use
3210         Output_section_lookup_maps class.
3211         (Output_section::get_input_sections): Export merge sections.  Adjust
3212         code to use Output_section_lookup_maps class.
3213         (Output_section:::add_script_input_section): Adjust code to use
3214         Output_section_lookup_maps class.  Update lookup maps for merge
3215         sections also.
3216         (Output_section::discard_states): Use Output_section_lookup_maps.
3217         (Output_section::restore_states): Same.
3218         * output.h (Merge_section_properties): Move class defintion out of
3219         Output_section.
3220         (Output_section_lookup_maps): New class.
3221         (Output_section::Input_section::is_merge_section): New method
3222         defintion.
3223         (Output_section::Input_section::relobj): Move defintion out of class
3224         defintion.  Declare method only.
3225         (Output_section::Input_section::shndx): Ditto.
3226         (Output_section::Input_section::output_merge_base): New method defintion.
3227         (Output_section::Input_section::u2_.pomb): New union field.
3228         (Output_section::Merge_section_by_properties_map,
3229         Output_section::Output_section_data_by_input_section_map,
3230         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3231         Remove types.
3232         (Output_section::add_merge_input_section): Add new parameter
3233         KEEPS_INPUT_SECTIONS.
3234         (Output_section::build_lookup_maps): New method declaration.
3235         (Output_section::merge_section_map_,
3236         Output_section::merge_section_by_properties_map_,
3237         Output_section::relaxed_input_section_map_,
3238         Output_section::is_relaxed_input_section_map_valid_): Remove data
3239         members.
3240         (Output_section::lookup_maps_): New data member.
3241
3242 2010-05-21  Doug Kwan  <dougkwan@google.com>
3243
3244         PR gold/11619
3245         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3246         avoid a compilation error.
3247
3248 2010-05-19  Rafael Espindola  <espindola@google.com>
3249
3250         * script-sections.cc (Output_section_definition::allocate_to_segment):
3251         Update the phdrs_list even when the output section is NULL.
3252         * testsuite/Makefile.am: Add test.
3253         * testsuite/Makefile.in: Regenerate.
3254         * testsuite/script_test_9.cc: New.
3255         * testsuite/script_test_9.sh: New.
3256         * testsuite/script_test_9.t: New.
3257
3258 2010-05-19  Doug Kwan  <dougkwan@google.com>
3259
3260         * arm.cc (Arm_input_section::original_size): New method.
3261         (Arm_input_section::do_addralign): Add a cast.
3262         (Arm_input_section::do_output_offset): Remove static cast.
3263         (Arm_input_section::original_addralign,
3264          Arm_input_section::original_size_): Change type to uint32_t.
3265         (Arm_input_section::init): Add safe casts for section alignment
3266         and size.
3267         (Arm_input_section::set_final_data_size): Do not set address and
3268         offset of stub table.
3269         (Arm_output_section::fix_exidx_coverage): Change use of of
3270         Output_section::Simple_input_section to that of
3271         Output_section::Input_section.
3272         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3273         except for the first pass.
3274         * output.cc (Output_section::get_input_sections): Change type of
3275         input_sections to std::list<Input_section>.
3276         (Output_section::add_script_input_section): Rename from
3277         Output_section::add_simple_input_section.  Change type of SIS
3278         parameter from Simple_input_section to Input_section.
3279         * output.h (Output_section::Simple_input_section): Remove class.
3280         (Output_section::Input_section): Change class visibility to public.
3281         (Output_section::Input_section::addralign): Use stored alignments
3282         for special input sections if set.
3283         (Output_section::Input_section::set_addralign): New method.
3284         (Output_section::get_input_sections): Change parameter type from
3285         list of Simple_input_section to list of Input_section.
3286         (Output_section::add_script_input_section): Rename from
3287         Output_section::add_simple_input_section. Change first parameter's
3288         type from Simple_input_section to Input_section and remove the
3289         second and third parameters.
3290         * script-sections.cc (Input_section::Input_section_list): Change
3291         type to list of Output_section::Input_section/
3292         (Input_section_info::Input_section_info): Change parameter type of
3293         INPUT_SECTION to Output_section::Input_section.
3294         (Input_section_info::input_section): Change return type.
3295         (Input_section_info::input_section_): Change type to
3296         Output_section::Input_section.
3297         (Output_section_element_input::set_section_addresses): Adjust code
3298         to use Output_section::Input_section instead of
3299         Output_section::Simple_input_section.  Adjust code for renaming
3300         of Output_section::add_simple_input_section.
3301         (Orphan_output_section::set_section_addresses): Ditto.
3302
3303 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3304
3305         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3306         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3307
3308 2010-05-18  Rafael Espindola  <espindola@google.com>
3309
3310         * options.cc (General_options::finalize): Handle -nostdlib.
3311         * options.h (nostdlib): New option.
3312         * script.cc (script_add_search_dir): Handle -nostdlib.
3313
3314 2010-05-12  Doug Kwan  <dougkwan@google.com>
3315
3316         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3317         attributes section only if there no attributes section after merging.
3318         (Target_arm::merge_object_attributes): Move value of
3319         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3320         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3321         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3322         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3323         and arm_attr_merge_7.stdout.
3324         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3325         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3326         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3327         arm_attr_merge_7b.o): New rules.
3328         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3329         arm_attr_merge_7
3330         * testsuite/Makefile.in: Regenerate.
3331         * testsuite/arm_attr_merge.sh: New file.
3332         * testsuite/arm_attr_merge_[67][ab].s: Same.
3333
3334 2010-05-05  Nick Clifton  <nickc@redhat.com>
3335
3336         * po/es.po: Updated Spanish translation.
3337
3338 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3339
3340         * Makefile.am (install-exec-local): Properly install gold as
3341         default cross linker.
3342         * Makefile.in: Regenerated.
3343
3344 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3345             Nick Clifton  <nickc@redhat.com>
3346
3347         * configure.ac (install_as_default): Define and set to false
3348         unless --enable-gold or --enable-gold=both/gold has been
3349         specified.
3350         * configure: Regenerate.
3351
3352         * Makefile.am (install-exec-local): Install the executable as
3353         'ld.gold'.  If install_as_default is true then also install it as
3354         'ld'.
3355         * Makefile.in: Regenerated.
3356
3357 2010-04-24  Ian Lance Taylor  <iant@google.com>
3358
3359         * layout.cc (Layout::layout_reloc): In relocatable link don't
3360         combine reloc sections for grouped sections.
3361
3362 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3363
3364         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3365         sections that are not ordinary to icf.
3366         * icf.cc (get_section_contents): Handle relocation pointing to section
3367         with no object or shndx information.
3368         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3369         * testsuite/Makefile.in: Regenerate.
3370         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3371         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3372
3373 2010-04-22  Ian Lance Taylor  <iant@google.com>
3374
3375         * expression.cc (Expression::Expression_eval_info): Add
3376         result_alignment_pointer field.
3377         (Expression::eval_with_dot): Add result_alignment_pointer
3378         parameter.  Change all callers.
3379         (Expression::eval_maybe_dot): Likewise.
3380         (class Binary_expression): Add alignment_pointer parameter to
3381         left_value and right_value.  Change all callers.
3382         (BINARY_EXPRESSION): Set result alignment.
3383         (class Trinary_expression): Add alignment_pointer parameter to
3384         arg2_value and arg3_value.  Change all callers.
3385         (Trinary_cond::value): Set result alignment.
3386         (Max_expression::value, Min_expression::value): Likewise.
3387         (Align_expression::value): Likewise.
3388         * script-sections.cc (class Sections_element): Add dot_alignment
3389         parameter to set_section_addresses virtual function.  Update
3390         instantiations.
3391         (class Output_section_element): Likewise.
3392         (Script_sections::create_segments): Add dot_alignment parameter.
3393         Change all callers.
3394         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3395         (Script_sections::set_phdrs_clause_addresses): Likewise.
3396         * script-sections.h: Update declarations.
3397         * script.h: Update declarations.
3398         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3399         min_p_align.
3400         * testsuite/script_test_3.t: Set large alignment.
3401         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3402         segment has expected alignment.
3403
3404 2010-04-22  Nick Clifton  <nickc@redhat.com>
3405
3406         * po/gold.pot: Updated by the Translation project.
3407         * po/vi.po: Updated Vietnamese translation.
3408
3409 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3410
3411         * testsuite/Makefile.am (check_PROGRAMS): Add
3412         icf_virtual_function_folding_test.
3413         * testsuite/Makefile.in: Regenerated.
3414
3415 2010-04-15  Andrew Haley  <aph@redhat.com>
3416
3417         * options.h (merge_exidx_entries): New option.
3418         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3419         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3420         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3421         (Target_arm::merge_exidx_entries): New function.
3422         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3423         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3424         to Arm_exidx_fixup constructor.
3425         Add new arg, merge_exidx_entries.
3426         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3427         Arm_output_section::fix_exidx_coverage.
3428
3429 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3430
3431         * icf.cc (get_section_contents): Check for preemptible functions.
3432         Ignore addend when appropriate.
3433         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3434         section folded.
3435         (add_from_relobj): Check for section folded.
3436         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3437         * symtab.h (should_add_dynsym_entry): Add new parameter.
3438         * target-reloc.h (scan_relocs): Check for section folded.
3439         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3440         Check reloc types for function pointers in shared objects.
3441         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3442         case.
3443         (icf_preemptible_functions_test): New test case.
3444         (icf_string_merge_test): New test case.
3445         * testsuite.Makefile.in: Regenerate.
3446         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3447         bar_glob.  Refactor code.
3448         * testsuite/icf_preemptible_functions_test.cc: New file.
3449         * testsuite/icf_preemptible_functions_test.sh: New file.
3450         * testsuite/icf_string_merge_test.cc: New file.
3451         * testsuite/icf_string_merge_test.sh: New file.
3452         * testsuite/icf_virtual_function_folding_test.cc: New file.
3453         * testsuite/icf_virtual_function_folding_test.sh: New file.
3454
3455 2010-04-14  Doug Kwan  <dougkwan@google.com>
3456
3457         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3458         for local symbol recounting if we remove a section due to ICF.
3459         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3460         there are no regular objects in input.
3461
3462 2010-04-13  Doug Kwan  <dougkwan@google.com>
3463
3464         * arm.cc (Arm_input_section::set_final_data_size): Compute
3465         accurate final data size instead of using current data size.
3466
3467 2010-04-09  Doug Kwan  <dougkwan@google.com>
3468
3469         * layout.cc (Layout::choose_output_section): Handle script section
3470         types.
3471         (Layout::make_output_section_for_script): Add section type parameter.
3472         Handle script section types.
3473         * layout.h (Layout::make_output_section_for_script): Add section
3474         type parameter.
3475         * output.cc (Output_section::Output_section): Initialize data member
3476         is_noload_.
3477         (Output_section::do_reset_address_and_file_offset): Do not set address
3478         to 0 if section is a NOLOAD section.
3479         * output.h (Output_section::is_noload): New method.
3480         (Output_section::set_is_noload): Ditto.
3481         (Output_section::is_noload_): New data member.
3482         * script-c.h (Script_section_type): New enum type.
3483         (struct Parser_output_section_header): Add new file section_type.
3484         * script-sections.cc (Sections_element::output_section_name): Add
3485         parameter for returning script section type.
3486         (Output_section_definition::output_section_name): Ditto.
3487         (Output_section_definition::section_type)P; New method.
3488         (Output_section_definiton::script_section_type_name): Ditto.
3489         (Output_section_definition::script_section_type_): New data member.
3490         (Output_section_definition::Output_section_definition): Initialize
3491         data member Output_section_definition::script_section_type_.
3492         (Output_section_definition::create_sections): Pass script section type
3493         to Layout::make_output_section_for_script.
3494         (Output_section_definition::output_section_name): Return script
3495         section type to caller.
3496         (Output_section_definition::set_section_address): Do not advance
3497         dot value and load address if section type is NOLOAD.  Set address
3498         of NOLOAD sections regardless of section flags.
3499         (Output_section_definition::print): Print section type if it is
3500         not SCRIPT_SECTION_TYPE_NONE.
3501         (Output_section_definition::section_type): New method.
3502         (Output_section_definition::script_section_type_name): Ditto.
3503         (Script_sections::output_section_name): Add new parameter
3504         PSECTION_TYPE for returning script section type.  Pass it to
3505         section elements.  Handle discard sections.
3506         (Sort_output_sections::operator()): Handle NOLOAD sections.
3507         * script-sections.h (Script_sections::Section_type): New enum type.
3508         (Script_sections::output_section_name): Add a new parameter for
3509         returning script section type.
3510         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3511         INFO and NOLOAD.
3512         * yyscript.y (union): Add new field SECTION_TYPE.
3513         (COPY, DSECT, INFO, NOLOAD): New tokens.
3514         (opt_address_and_section_type): Change type to output_section_header.
3515         (section_type): New non-terminal
3516         (section_header): Handle section type.
3517         (opt_address_and_section_type): Return section type value.
3518
3519 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3520
3521         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3522         * testsuite/plugin_common_test_2.c (foo): Likewise.
3523
3524 2010-04-08  Doug Kwan  <dougkwan@google.com>
3525
3526         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3527         Output_merge_data.
3528         * output.cc (Output_section::add_merge_input_section): Simplify
3529         code and return status of Output_merge_base::add_input_section.
3530         Update merge section map only if Output_merge_base::add_input_section
3531         returns true.
3532
3533 2010-04-07  Doug Kwan  <dougkwan@google.com>
3534
3535         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3536         if section is marked as containing instructions but has no mapping
3537         symbols.
3538         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3539         correct section index.
3540         (Arm_relobj::find_linked_text_section): Ditto.
3541
3542 2010-04-07  Cary Coutant  <ccoutant@google.com>
3543
3544         * archive.cc (include_member): Destroy Read_symbols_data object before
3545         releasing file.
3546         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3547         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3548         (Read_symbols_data::~Read_symbols_data) New destructor.
3549         (Section_relocs::Section_relocs) New constructor.
3550         (Section_relocs::~Section_relocs) New destructor.
3551         (Read_relocs_data::Read_relocs_data) New constructor.
3552         (Read_relocs_data::~Read_relocs_data) New destructor.
3553         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3554         pointers to NULL after deleting.
3555
3556 2010-04-07  Doug Kwan  <dougkwan@google.com>
3557
3558         * arm.cc: Replace "endianity" with "endianness" in comments.
3559         (Arm_exidx_cantunwind): Ditto.
3560         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3561         (Arm_relobj::merge_flags_and_attributes): New method.
3562         (Arm_relobj::merge_flags_and_attributes_): New data member.
3563         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3564         (Arm_relobj::scan_sections_for_stubs): Ditto.
3565         (Arm_relobj::do_read_symbols): Check to see if we really want to
3566         merge processor-specific flags and attributes.  Exit early if
3567         an object is empty except for section names and the undefined symbol.
3568         (Target_arm::do_finalize_sections): Move check for ELF format to
3569         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3570         attributes from a regular object only when we have determined that
3571         it is aapropriate.  Do not create an .ARM.attributes section in
3572         output if there is no regular input object.
3573         (Target_arm::merge_processor_specific_flags): Check
3574         --warn-mismatch before printing any error.
3575         (Target_arm::merge_object_attributes): Ditto.
3576         * gold.cc (queue_middle_tasks): Handle the case in which there is
3577         no regular object in input.
3578         * options.cc (General_options::parse_EB): New method.
3579         (General_options::parse_EL): Same.
3580         (General_options::General_options): Initialize endianness_.
3581         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3582         New options.
3583         (General_options::Endianness): New enum.
3584         (General_options::endianness): New method.
3585         (General_options::endianness_): New data member.
3586         * parameters.cc (Parameters::set_options): Check target endianness.
3587         (Parameters::set_target_once): Ditto.
3588         (Parameters::check_target_endianness): New method.
3589         (parameters_force_valid_target): If either -EL or -EB is specified,
3590         use it to define endianness of default target.
3591         * parameters.h (Parameters::check_target_endianness): New method
3592         declaration.
3593         * target.h (class Target): Change "endianity" to "endianness"
3594         in comments.
3595
3596 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3597
3598         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3599         * configure: Regenerate.
3600         * Makefile.in: Regenerate.
3601         * testsuite/Makefile.in: Regenerate.
3602
3603 2010-04-06  Cary Coutant  <ccoutant@google.com>
3604
3605         gcc PR lto/42757
3606         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3607         prevailing definitions of common symbols.
3608         * testsuite/plugin_test_6.sh: New test case.
3609         * testsuite/plugin_common_test_1.c: New test case.
3610         * testsuite/plugin_common_test_2.c: New test case.
3611         * testsuite/Makefile.am (plugin_test_6): New test case.
3612         * testsuite/Makefile.in: Regenerate.
3613
3614 2010-04-06  Nick Clifton  <nickc@redhat.com>
3615
3616         * po/vi.po: New Vietnamese translation.
3617
3618 2010-03-30  Doug Kwan  <dougkwan@google.com>
3619
3620         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3621
3622 2010-03-25  Doug Kwan  <dougkwan@google.com>
3623
3624         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3625         to avoid a conversion warning on a 32-bit host.
3626
3627 2010-03-24  Ian Lance Taylor  <iant@google.com>
3628
3629         * testsuite/script_test_3.t: Add a TLS segment.
3630         * testsuite/Makefile.am (check_PROGRAMS): Add
3631         tls_phdrs_script_test.
3632         (tls_phdrs_script_test_SOURCES): Define.
3633         (tls_phdrs_script_test_DEPENDENCIES): Define.
3634         (tls_phdrs_script_test_LDFLAGS): Define.
3635         (tls_phdrs_script_test_LDADD): Define.
3636         * testsuite/Makefile.in: Rebuild.
3637
3638 2010-03-23  Cary Coutant  <ccoutant@google.com>
3639
3640         * fileread.cc (find_or_make_view): Fix comment.
3641
3642 2010-03-23  Ian Lance Taylor  <iant@google.com>
3643
3644         * script-sections.cc (class Orphan_section_placement): Define
3645         PLACE_TLS and PLACE_TLS_BSS.
3646         (Orphan_section_placement::Orphan_section_placement): Initialize
3647         new places.
3648         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3649         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3650         (tls_script_test_SOURCES): Define.
3651         (tls_script_test_DEPENDENCIES): Define.
3652         (tls_script_test_LDFLAGS): Define.
3653         (tls_script_test_LDADD): Define.
3654         * testsuite/Makefile.in: Rebuild.
3655
3656 2010-03-22  Doug Kwan  <dougkwan@google.com>
3657
3658         * arm.cc (Arm_relocate_functions::abs8,
3659         Arm_relocate_functions::abs16): Use correct check for overflow
3660         specified in the ARM ELF specs.
3661         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3662         target of a BLX instruction specially.
3663         (Reloc_stub::stub_type_for_reloc): Ditto.
3664         (Relocate::relocate): Use symbolic names instead of numeric relocation
3665         codes to report error.
3666         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3667         workaround.
3668         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3669         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3670         thumb2_blx_out_of_range.stdout
3671         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3672         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3673         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3674         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3675         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3676         thumb2_blx_in_range, thumb2_blx_in_range.o,
3677         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3678         thumb2_blx_out_of_range.o): New rules.
3679         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3680         thumb2_blx_in_range and thumb2_blx_out_of_range.
3681         * testsuite/Makefile.in: Regenerate.
3682         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3683         * testsuite/thumb_blx_in_range.s: New file.
3684         * testsuite/thumb_blx_out_of_range.s: New file.
3685
3686 2010-03-22  Rafael Espindola  <espindola@google.com>
3687
3688         * archive.cc (Should_include): Move to archive.h.
3689         (should_include_member): Make it a member of Archive.
3690         (Lib_group): New.
3691         (Add_lib_group_symbols): New.
3692         * archive.h: Include options.h.
3693         (Archive_member): Moved from Archive.
3694         (Should_include): Moved from archive.cc.
3695         (Lib_group): New.
3696         (Add_lib_group_symbols): New.
3697         * dynobj.cc (do_should_include_member): New.
3698         * dynobj.h (do_should_include_member): New.
3699         * gold.cc (queue_initial_tasks): Update call to queue.
3700         * main.cc (main): Print lib group stats.
3701         * object.cc (do_should_include_member): New.
3702         * object.h: Include archive.h.
3703         (Object::should_include_member): New.
3704         (Object::do_should_include_member): New.
3705         (Sized_relobj::do_should_include_member): New.
3706         * options.cc (General_options::parse_start_lib): New.
3707         (General_options::parse_end_lib): New.
3708         (Input_arguments::add_file): Handle lib groups.
3709         (Input_arguments::start_group): Check we are not in a lib.
3710         (Input_arguments::start_lib): New.
3711         (Input_arguments::end_lib): New.
3712         * options.h (General_options): Add start_lib and end_lib.
3713         (Input_argument::lib_): New.
3714         (Input_argument::lib): New.
3715         (Input_argument::is_lib): New.
3716         (Input_file_lib): New.
3717         (Input_arguments::in_lib_): New.
3718         (Input_arguments::in_lib): New.
3719         (Input_arguments::start_lib): New.
3720         (Input_arguments::end_lib_): New.
3721         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3722         in unused members as preempted.
3723         (Sized_pluginobj::do_should_include_member): New.
3724         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3725         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3726         return the blocker.
3727         (Read_symbols::do_whole_lib_group): New.
3728         (Read_symbols::do_lib_group): New.
3729         (Read_symbols::do_read_symbols): Handle lib groups.
3730         (Read_symbols::get_name): Handle lib groups.
3731         * readsyms.h (Read_symbols): Add an archive member pointer.
3732         (Read_symbols::do_whole_lib_group): New.
3733         (Read_symbols::do_lib_group): New.
3734         (Read_symbols::member_): New.
3735         * script.cc (read_input_script): Update call to queue_soon.
3736
3737 2010-03-19  Doug Kwan  <dougkwan@google.com>
3738
3739         * arm.cc (Stub_table::Stub_table): Initialize new data members
3740         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3741         (Stub_table::add_reloc_stub): Assign stub offset and update
3742         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3743         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3744         New data members.
3745         (Stub_table::update_data_size_and_addralign): Use
3746         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3747         instead of going over all reloc stubs.
3748         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3749         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3750         Stringpool_template::offset_ to size of Stringpool_char.
3751         (Stringpool_template::new_key_offset): Remove code to initialize
3752         Stringpool_template::offset_.
3753         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3754         Stringpool_template::offset_ to zero.
3755
3756 2010-03-15  Doug Kwan  <dougkwan@google.com>
3757
3758         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3759         offset_.
3760         (Stringpool_template::new_key_offset): New method.
3761         (Stringpool_template::add_string): Assign offsets when adding new
3762         strings.
3763         (Stringpool_template::set_string_offsets): Do not set string offsets
3764         when not optimizing.
3765         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3766         member size_.
3767         (Chunked_vector::clear): Clear size_.
3768         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3769         (Chunked_vector::size): Return size_.
3770         (Chunked_vector::push_back): Use size_ to find insert position.
3771         (Chunked_vector::size_): New data member.
3772         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3773         (Stringpool_template::new_key_offset): New method declaration.
3774         (Stringpool_template::offset_): New data member.
3775
3776 2010-03-15   Rafael Espindola  <espindola@google.com>
3777
3778         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3779         Add_symbols' constructor.
3780         * readsyms.h (Add_symbols): Remove the input_group member.
3781
3782 2010-03-10  Ian Lance Taylor  <iant@google.com>
3783
3784         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3785         target to ask whether a reference to a symbol requires a stack
3786         split.
3787         * target.h (Target::is_call_to_non_split): New function.
3788         (Target::do_is_call_to_non_split): Declare virtual function.
3789         * target.cc: Include "symtab.h".
3790         (Target::do_is_call_to_non_split): New function.
3791         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3792
3793 2010-03-10  Cary Coutant  <ccoutant@google.com>
3794
3795         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3796         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3797         (File_read::open[2]): Add whole_file_view_ to list of views.
3798         (File_read::make_view): Remove test of whole_file_view_.
3799         (File_read::find_or_make_view): Create whole_file_view_ if
3800         necessary.
3801         (File_read::clear_views): Replace bool parameter with enum;
3802         adjust all callers.  Don't delete views with permanent data;
3803         do delete cached views and views from archives if
3804         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3805         if clearing the corresponding view.
3806         * fileread.h (File_read::Clear_views_mode): New enum.
3807         (File_read::View::is_permanent_view): New method.
3808         (File_read::clear_views): Replace bool parameter
3809         with enum; adjust all callers.
3810         * options.h (General_options): Change keep_files_mapped option;
3811         add map_whole_files.
3812         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3813         releasing the file.
3814         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3815         the file.
3816
3817 2010-03-10  David S. Miller  <davem@davemloft.net>
3818
3819         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3820
3821 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3822
3823         * icf.cc (get_section_contents): Add '@' marker after processing the
3824         merge reloc.
3825
3826 2010-03-08  Doug Kwan  <dougkwan@google.com>
3827
3828         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3829         due to a conversion warning.
3830         (Arm_relobj::update_output_local_symbol_count): Check for local
3831         symbol with unset output index.
3832
3833 2010-03-05  Ian Lance Taylor  <iant@google.com>
3834
3835         * options.h (class General_options): Add --spare-dynamic-tags.
3836         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3837         --spare-dynamic-tags.
3838
3839 2010-03-05  Ian Lance Taylor  <iant@google.com>
3840
3841         * incremental.cc: Include "libiberty.h".
3842
3843 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3844
3845         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3846         function, is_info_ member.
3847         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3848         (Versions::Versions): Update caller.
3849         (Versions::define_base_version): Likewise.
3850         (Versions::add_def): Likewise.
3851
3852 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3853
3854         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3855         (Scan::possible_function_pointer_reloc): New function.
3856         (Scan::local_reloc_may_be_function_pointer): Change to call
3857         possible_function_pointer_reloc.
3858         (Scan::global_reloc_may_be_function_pointer): Ditto.
3859         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3860         relocations in ".data.rel.ro._ZTV" section.
3861         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3862         * testsuite/icf_safe_so_test.cc: Ditto.
3863         * testsuite/icf_safe_test.cc: Ditto.
3864         * testsuite/icf_safe_test.sh: Ditto.
3865
3866 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3867             Ian Lance Taylor  <iant@google.com>
3868
3869         * target-reloc.h (relocate_section): Check the symbol table index
3870         for -1U before setting the local symbol index.
3871         (scan_relocatable_relocs): If copying the relocation, record that
3872         the local symbol is required.
3873         * object.h (Symbol_value::is_output_symtab_index_set): New
3874         function.
3875         (Symbol_value::may_be_discarded_from_output_symtab): New
3876         function.
3877         (Symbol_value::has_output_symtab_entry): New function.
3878         (Symbol_value::needs_output_symtab_entry): Remove.
3879         (Symbol_value::output_symtab_index): Make sure the symbol index is
3880         set.
3881         (Symbol_value::set_output_symtab_index): Make sure the symbol
3882         index is not set.  Make sure the new index is valid.
3883         (Symbol_value::set_must_have_output_symtab_entry): New function.
3884         (Symbol_value::has_output_dynsym_entry): New function.
3885         (Symbol_value::set_output_dynsym_index): Make sure the new index
3886         is valid.
3887         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3888         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3889         local symbol if permitted.
3890         (Sized_relobj::do_finalize_local_symbols): Call
3891         is_output_symtab_index_set rather than needs_output_symtab_entry.
3892         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3893         rather than needs_output_symtab_entry.  Call
3894         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3895         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3896         is_output_symtab_index_set rather than needs_output_symtab_entry.
3897         * testsuite/discard_locals_relocatable_test.c: New file.
3898         * testsuite/discard_locals_test.sh: Test -r.
3899         * testsuite/Makefile.am (check_DATA): Add
3900         discard_locals_relocatable_test1.syms,
3901         discard_local_relocatable_test2.syms.
3902         (MOSTLYCLEANFILES): Likewise.  Also add
3903         discard_locals_relocatable_test1.lout and
3904         discard_locals_relocatable_test2.out.
3905         (discard_locals_relocatable_test1.syms): New target.
3906         (discard_locals_relocatable_test.o): New target.
3907         (discard_locals_relocatable_test1.out): New target.
3908         (discard_locals_relocatable_test2.syms): New target.
3909         (discard_locals_relocatable_test2.out): New target.
3910         (various): Add missing ../ld-new dependencies.
3911         * testsuite/Makefile.in: Rebuild.
3912
3913 2010-03-03  Nick Clifton  <nickc@redhat.com>
3914
3915         * po/fi.po: New Finnish translation.
3916
3917 2010-03-01  Doug Kwan  <dougkwan@google.com>
3918
3919         * layout.cc (Layout::Layout): Force section types of .init_array*,
3920         .preinit_array* and .fini_array* sections.
3921         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3922         Fix check of return value of std::string::find.().
3923         (Output_section::Input_section_sort_compare::operator()): Remove
3924         comment about .init_array.
3925         (Output_section::Input_section_sort_init_fini_compare::operator()):
3926         New method.
3927         (Output_section::sort_attached_input_sections): Handle .init_array
3928         and .fini_array specially.
3929         * output.h (Output_section::Inut_section_sort_compare): Update
3930         comment.
3931         (Output_section::Input_section_sort_init_fini_compare): New struct.
3932
3933 2010-02-26  Doug Kwan  <dougkwan@google.com>
3934
3935         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3936         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3937         * testsuite/debug_msg.sh: Avoid matching source line number for
3938         use of global variable undef_int.
3939
3940 2010-02-26  Doug Kwan  <dougkwan@google.com>
3941
3942         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3943         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3944         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3945         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3946         * options.cc (General_options::General_options): Initialize member
3947         fix_v4bx_.
3948         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3949         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3950         and rm_no_fix_v4bx.stdout
3951         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3952         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3953         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3954         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3955         and arm_no_fix_v4bx.
3956         * Makefile.in: Regenerate.
3957         * testsuite/arm_fix_v4bx.s: New file.
3958         * testsuite/arm_fix_v4bx.sh: Ditto.
3959
3960 2010-02-24  Doug Kwan  <dougkwan@google.com>
3961
3962         * arm.cc (Target_arm::got_section): Make the .got section the first
3963         non RELRO section in the data segment.
3964         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3965         suffixes of section names.
3966
3967 2010-02-24  Doug Kwan  <dougkwan@google.com>
3968
3969         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3970         flags and attributes merging if an input file is a binary file.
3971         * fileread.cc (Input_file::open): Record format of original file.
3972         * fileread.h (Input_file::Format): New enum type.
3973         (Input_file::Input_file): Initialize data member format_.
3974         (Input_file::format): New method definition.
3975         (Input_file::format_):: New data member.
3976
3977 2010-02-24  Doug Kwan  <dougkwan@google.com>
3978
3979         * arm.cc (Arm_output_data_got): New class.
3980         (ARM_TCB_SIZE): New constant
3981         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3982         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3983         If user uses a script with a SECTIONS clause, issue only a warning
3984         for a misplaced EXIDX input section.  Otherwise, issue an error.
3985         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3986         garbage collection.
3987         (Target_arm::got_mode_index_entry): Handle static linking.
3988         (Target_arm::Scan::local): Ditto.
3989         (Target_arm::Scan::global): Ditto.
3990         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3991         all incorrectly implemented relocations.
3992         (Target_arm::fix_exidx_coverage): Pass layout to
3993         Arm_output_section::fix_exidx_coverage.
3994         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3995         from ".ARM.exidx." and ".ARM.extab.".
3996
3997 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3998
3999         * arm.cc (Target_arm::do_finalize_sections): Create attribute
4000         section if it does not already exist.
4001         * attributes.cc (Attributes_section_data::Attributes_section_data):
4002         Don't crash if size is zero.
4003
4004 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4005             Ian Lance Taylor  <iant@google.com>
4006
4007         * gold.cc (queue_middle_tasks): If no input files were opened,
4008         exit.
4009         * workqueue.h (Task_function::Task_function): Assert that there is
4010         a blocker.
4011
4012 2010-02-22  Doug Kwan  <dougkwan@google.com>
4013
4014         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4015         * icf.cc (get_section_contents): Cast snprintf arguments to long long
4016         types to avoid warnings due to different uint64_t implementations
4017         on different hosts.
4018
4019 2010-02-21  Doug Kwan  <dougkwan@google.com>
4020
4021         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4022         handling of the maximum backward branch offset.
4023         (Arm_relocate_functions::thumb_branch_common): Ditto.
4024         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4025         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4026         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4027         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4028         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4029         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4030         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4031         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4032         thumb_bl_out_of_range thumb_bl_out_of_range.o,
4033         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4034         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4035         thumb2_bl_out_of_range.o): New rules.
4036         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4037         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4038         thumb2_bl_out_of_range
4039         * testsuite/Makefile.in: Regenerate.
4040         * testsuite/arm_bl_in_range.s: New file.
4041         * testsuite/arm_bl_out_of_range.s: Ditto.
4042         * testsuite/arm_branch_in_range.sh: Ditto.
4043         * testsuite/arm_branch_range.t: Ditto.
4044         * testsuite/thumb2_branch_range.t: Ditto.
4045         * testsuite/thumb_bl_in_range.s: Ditto.
4046         * testsuite/thumb_bl_out_of_range.s: Ditto.
4047         * testsuite/thumb_branch_range.t: Ditto.
4048
4049 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
4050
4051         * gc.h (gc_process_relocs): Change vectors to point to the new list.
4052         Add reloc offset information.
4053         * icf.cc (get_section_contents): Change iterators to point to the new
4054         vectors. Add reloc offset information to the contents.
4055         * icf.h (Icf::Sections_reachable_info): New typedef.
4056         (Icf::Sections_reachable_list): New typedef.
4057         (Icf::Offset_info): New typedef.
4058         (Icf::Reloc_info): New struct typedef.
4059         (Icf::Reloc_info_list): New typedef.
4060         (Icf::symbol_reloc_list): Delete method.
4061         (Icf::addend_reloc_list): Delete method.
4062         (Icf::section_reloc_list): Delete method.
4063         (Icf::reloc_info_list): New method.
4064         (Icf::reloc_info_list_): New member.
4065
4066 2010-02-19  Doug Kwan  <dougkwan@google.com>
4067
4068         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4069         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4070         * arm.cc (Arm_relocation_functions): New forward declaration.
4071         (Target_arm::Target_arm): Initialize new data members
4072         got_mod_index_offset_ and tls_base_symbol_defined_.
4073         (Target_arm::Relocate::relocate_tls): New method.
4074         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4075          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4076         New methods.
4077         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4078         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4079         (Target_arm::got_mod_index_offset_,
4080         Target_arm::tls_base_symbol_defined_): New data members.
4081         (Target_arm::Scan::local, Target::Scan::global,
4082         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4083         relocations.
4084
4085 2010-02-18  Doug Kwan  <dougkwan@google.com>
4086
4087         * arm.cc (Arm_relobj::find_linked_text_section): New method.
4088         (Arm_relobj::make_exidx_input_section): Pass section index of linked
4089         text section as a parameter becuase some broken tools may not set
4090         the link in section header.
4091         (Target_arm::has_got_section): New method.
4092         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4093         without any mapping symbol as data only.  Remove warning.
4094         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4095         link in its section header, try to discover the link by inspecting the
4096         REL31 relocation at the beginning of the section.
4097         (Target_arm::Scan::check_non_pic): Report name of offending relocation
4098         in error message.
4099         (Target_arm::Scan::global): Treat any reference to the symbol
4100         _GLOBAL_OFFSET_TABLE_ as a GOT access.
4101
4102 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
4103
4104         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4105         (Scan::global_reloc_may_be_function_pointer): New function.
4106         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4107         (Scan::global_reloc_may_be_function_pointer): New function.
4108         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4109         (Scan::global_reloc_may_be_function_pointer): New function.
4110         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4111         (Scan::global_reloc_may_be_function_pointer): New function.
4112         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4113         (Scan::global_reloc_may_be_function_pointer): New function.
4114         (Scan::possible_function_pointer_reloc): New function.
4115         (Target_x86_64::can_check_for_function_pointers): New function.
4116         * gc.h (gc_process_relocs): Scan relocation types to determine if
4117         function pointers were taken for targets that support it.
4118         * icf.cc (Icf::find_identical_sections): Include functions for
4119         folding in safe ICF whose pointer is not taken.
4120         * icf.h (Secn_fptr_taken_set): New typedef.
4121         (fptr_section_id_): New member.
4122         (section_has_function_pointers): New function.
4123         (set_section_has_function_pointers): New function.
4124         (check_section_for_function_pointers): New function.
4125         * options.h: Fix comment for safe ICF option.
4126         * target.h (can_check_for_function_pointers): New function.
4127         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4128         Modify icf_safe_test for X86-64.
4129         * testsuite/Makefile.in: Regenerate.
4130         * testsuite/icf_safe_so_test.cc: New file.
4131         * testsuite/icf_safe_so_test.sh: New file.
4132         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4133         (main): Change to take pointer to function kept_func_3.
4134         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4135         folding is done correctly for X86-64.
4136
4137 2010-02-12  David S. Miller  <davem@davemloft.net>
4138
4139         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4140         is_symbolless parameter.
4141         (Output_reloc<SHT_REL>::is_symbolless): New.
4142         (Output_reloc<SHT_REL>::is_symbolless_): New.
4143         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4144         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4145         (Output_reloc<SHT_RELA>::is_symbolless): New.
4146         (Output_data_reloc::add_global): Handle is_symbolless.
4147         (Output_data_reloc::add_global_relative): Likewise.
4148         (Output_data_reloc::add_local): Likewise.
4149         (Output_data_reloc::add_local_relative): Likewise.
4150         (Output_data_reloc::add_symbolless_global_addend): New.
4151         (Output_data_reloc::add_symbolless_local_addend): New.
4152         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4153         is_symbolless.
4154         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4155         instead of ->is_relative_
4156         (Output_reloc::write): Likewise.
4157         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4158         (Output_reloc::write_rel): Simplify.
4159
4160         * sparc.cc (Target_sparc::Scan::local): Use
4161         ->add_symbolless_local_addend as needed.
4162         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4163         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4164         based upon relocation offset.
4165
4166 2010-02-11  Doug Kwan  <dougkwan@google.com>
4167
4168         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4169         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4170         beginning of function.
4171         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4172         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4173         parameter is_32bit in calls to should_apply_static_reloc.
4174         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4175         (check_DATA): Add arm_abs_global.stdout.
4176         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4177         arm_abs_global.stdout): New rules.
4178         (MOSTLLYCLEANFILES): Add arm_abs_global
4179         * Makefile.in: Regenerate.
4180         * testsuite/arm_abs_global.s: New file.
4181         * testsuite/arm_abs_global.sh: Ditto.
4182         * testsuite/arm_abs_lib.s: Ditto.
4183
4184 2010-02-11  Ian Lance Taylor  <iant@google.com>
4185
4186         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4187         Read_relocs task.
4188         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4189         Allocate_commons_task first.
4190         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4191         task, rather than symtab_lock_.
4192         (Gc_process_relocs::~Gc_process_relocs): New function.
4193         (Gc_process_relocs::is_runnable): Check this_blocker_.
4194         (Gc_process_relocs::locks): Use next_blocker_ rather than
4195         blocker_.
4196         (Scan_relocs::~Scan_relocs): New function.
4197         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4198         symtab_lock_.
4199         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4200         next_blocker_.
4201         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4202         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4203         constructor accordingly.
4204         (class Gc_process_relocs): Likewise.
4205         (class Scan_relocs): Likewise.
4206         * common.h (class Allocate_commons_task): Remove symtab_lock_
4207         field, and corresponding constructor parameter.
4208         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4209         symtab_lock_.
4210         (Allocate_commons_task::locks): Likewise.
4211
4212 2010-02-11  Ian Lance Taylor  <iant@google.com>
4213
4214         * gold-threads.h (class Once): Define.
4215         (class Initialize_lock): Rewrite as child of Once.
4216         * gold-threads.cc (class Once_initialize): Define.
4217         (once_pointer_control): New static variable.
4218         (once_pointer, once_arg): New static variables.
4219         (c_run_once): New static function.
4220         (Once::Once, Once::run_once, Once::internal_run): New functions.
4221         (class Initialize_lock_once): Remove.
4222         (initialize_lock_control): Remove.
4223         (initialize_lock_pointer): Remove.
4224         (initialize_lock_once): Remove.
4225         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4226         (Initialize_lock::initialize): Rewrite.
4227         (Initialize_lock::do_run_once): New function.
4228         * archive.cc (Archive::interpret_header): Only clear name if it is
4229         not already empty.
4230         * fileread.cc: Include "gold-threads.h"
4231         (file_counts_lock): New static variable.
4232         (file_counts_initialize_lock): Likewise.
4233         (File_read::release): Only increment counts when using --stats.
4234         Use a lock around the increment.
4235         * parameters.cc (class Set_parameters_target_once): Define.
4236         (set_parameters_target_once): New static variable.
4237         (Parameters::Parameters): Move here from parameters.h.
4238         (Parameters::set_target): Rewrite.
4239         (Parameters::set_target_once): New function.
4240         (Parameters::clear_target): Move here and rewrite.
4241         * parameters.h (class Parameters): Update declarations.  Add
4242         set_parameters_target_once_ field.
4243         (Parameters::Parameters): Move to parameters.cc.
4244         (Parameters::clear_target): Likewise.
4245         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4246         task.
4247         (Start_group::~Start_group): New function.
4248         (Start_group::is_runnable): New function.
4249         (Start_group::locks, Start_group::run): New functions.
4250         (Finish_group::run): Change saw_undefined to size_t.
4251         * readsyms.h (class Start_group): Define.
4252         (class Finish_group): Change saw_undefined_ field to size_t.
4253         (Finish_group::Finish_group): Remove saw_undefined and
4254         this_blocker parameters.  Change all callers.
4255         (Finish_group::set_saw_undefined): New function.
4256         (Finish_group::set_blocker): New function.
4257         * symtab.h (class Symbol_table): Change saw_undefined to return
4258         size_t.  Change saw_undefined_ field to size_t.
4259         * target-select.cc (Set_target_once::do_run_once): New function.
4260         (Target_selector::Target_selector): Initialize set_target_once_
4261         field.  Don't initialize lock_ and initialize_lock_ fields.
4262         (Target_selector::instantiate_target): Rewrite.
4263         (Target_selector::set_target): New function.
4264         * target-select.h (class Set_target_once): Define.
4265         (class Target_selector): Update declarations.  Make
4266         Set_target_once a friend.  Remove lock_ and initialize_lock_
4267         fields.  Add set_target_once_ field.
4268
4269 2010-02-10  Ian Lance Taylor  <iant@google.com>
4270
4271         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4272         queueing any tasks.
4273         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4274         (queue_middle_tasks): Add all blockers before queueing any tasks.
4275         (queue_final_tasks): Likewise.
4276         * token.h (Task_token::add_blockers): New function.
4277         * object.h (Input_objects::number_of_relobjs): New function.
4278
4279 2010-02-10  Ian Lance Taylor  <iant@google.com>
4280
4281         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4282         shared, not if not position independent.
4283         * x86_64.cc (Relocate::relocate_tls): Likewise.
4284         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4285         (tls_pie_pic_test): New target.
4286         * testsuite/Makefile.in: Rebuild.
4287
4288         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4289         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4290         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4291         * testsuite/Makefile.in: Rebuild.
4292
4293 2010-02-09  David S. Miller  <davem@davemloft.net>
4294
4295         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4296         R_SPARC_RELATIVE using ->add_local_relative().
4297         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4298
4299         * output.h (Output_data_dynamic::add_section_size): New method
4300         that takes two Output_data objects.
4301         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4302         entry param.  Handle it in initializers.
4303         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4304         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4305         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4306         arg.
4307         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4308         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4309         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4310         for dynrel_includes_plt.
4311         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4312         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4313         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4314         before .rela.plt
4315         (Target_sparc::do_finalize_sections): Update to pass true for
4316         dynrel_includes_plt.
4317         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4318         output before .rela.plt
4319         (Target_powerpc::do_finalize_sections): Update to pass true for
4320         dynrel_includes_plt when 32-bit.
4321
4322 2010-02-08  Doug Kwan  <dougkwan@google.com>
4323
4324         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4325         method.
4326         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4327         Arm_relobj::scan_section_for_cortex_a8_stubs,
4328         Arm_relobj::do_relocation_section): Instead of calling
4329         Output_section::output_address, use faster
4330         Arm_relobj::simple_input_section_output_address.
4331
4332 2010-02-08  David S. Miller  <davem@davemloft.net>
4333
4334         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4335         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4336         relocation helper function.
4337
4338         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4339         just like R_SPARC_GOT{10,13,22}.
4340         (Target_sparc::Scan::local): Likewise.
4341         (Target_sparc::Relocate:relocate): Likewise.
4342
4343 2010-02-06  Ian Lance Taylor  <iant@google.com>
4344
4345         * configure.ac: Rewrite targetobjs duplicate removal code to use
4346         only shell constructs.
4347         * configure: Rebuild.
4348
4349 2010-02-05  Doug Kwan  <dougkwan@google.com>
4350
4351         PR 11247
4352         * arm.cc (Arm_relobj::section_is_scannable): New method.
4353         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4354         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4355
4356 2010-02-04  Doug Kwan  <dougkwan@google.com>
4357
4358         PR 11247
4359         * arm-reloc-property.cc (cstdio): Include.
4360         * configure.ac (targetobjs): Remove duplicates.
4361         * configure: Regenerate.
4362         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4363         big and little endian version for a given address size.
4364
4365 2010-02-03  Doug Kwan  <dougkwan@google.com>
4366
4367         * arm-reloc-property.cc
4368         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4369         definition.
4370         * arm-reloc-property.h
4371         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4372         New method definition.
4373         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4374         declaration.
4375         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4376         overflow to N.
4377         (GOT_PREL): Change implemented to Y.
4378         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4379         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4380         (Arm_relocate_functions::movw_abs_nc): Remove method.
4381         (Arm_relocate_functions::movt_abs): Ditto.
4382         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4383         (Arm_relocate_functions::thm_movt_abs): Ditto.
4384         (Arm_relocate_functions::movw_rel_nc): Ditto.
4385         (Arm_relocate_functions::movw_rel): Ditto.
4386         (Arm_relocate_functions::movt_rel): Ditto.
4387         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4388         (Arm_relocate_functions:thm_movw_rel): Ditto.
4389         (Arm_relocate_functions:thm_movt_rel): Ditto.
4390         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4391         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4392         New method definitions.
4393         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4394         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4395         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4396         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4397         (Target_arm::Relocate::relocate): Check for non-static or
4398         unimplemented relocation code and exit early.  Change calls to
4399         Target_arm::reloc_uses_thumb_bit and
4400         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4401         instead.  Refactor code to handle similar relocations to increase
4402         code sharing.  Remove check for unsupported relocation code in switch
4403         statement.
4404         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4405         relocation property table to find out size.  Change error message to
4406         print out the name of a relocation code instead of the numeric value.
4407         (Target_arm::scan_reloc_for_stub): Use relocation property table
4408         instead of calling Target_arm::reloc_uses_thumb_bit().
4409
4410 2010-02-02  Doug Kwan  <dougkwan@google.com>
4411
4412         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4413         types of relaxed input section.
4414
4415 2010-02-02  Doug Kwan  <dougkwan@google.com>
4416
4417         * Makefile.am (HFILES): Add arm-reloc-property.h.
4418         (DEFFILES): New.
4419         (TARGETSOURCES): Add arm-reloc-property.cc
4420         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4421         (libgold_a_SOURCES): $(DEFFILES)
4422         * Makefile.in: Regenerate.
4423         * arm-reloc-property.cc: New file.
4424         * arm-reloc-property.h: New file.
4425         * arm-reloc.def: New file.
4426         * arm.cc: Update comments.
4427         (arm-reloc-property.h): New included header.
4428         (arm_reloc_property_table): New global variable.
4429         (Target_arm::do_select_as_default_target): New method definition.
4430         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4431         arm-reloc-property to targ_extra_obj.
4432         * parameters.cc (set_parameters_target): Call
4433         Target::select_as_default_target().
4434         * target.h (Target::select_as_default_target): New method definition.
4435         (Target::do_select_as_default_target): Same.
4436
4437 2010-02-01  Doug Kwan  <dougkwan@google.com>
4438
4439         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4440         first_output_text_section_.
4441         (Arm_exidx_fixup::first_output_text_section): New method definition.
4442         (Arm_exidx_fixup::first_output_text_section_): New data member.
4443         (Arm_exidx_fixup::process_exidx_section): Record the first text
4444         output section seen.
4445         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4446         and entsize in output section header.
4447
4448 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4449
4450         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4451         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4452         (Arm_relocate_functions::thm_alu11): New Method.
4453         (Arm_relocate_functions::thm_pc8): New Method.
4454         (Arm_relocate_functions::thm_pc12): New Method.
4455         (Target_arm::Scan::local): Handle the relocations.
4456         (Target_arm::Scan::global): Likewise.
4457         (Target_arm::Relocate::relocate): Likewise.
4458         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4459
4460 2010-01-29  Doug Kwan  <dougkwan@google.com>
4461
4462         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4463         of relocation types as ld.
4464
4465 2010-01-29  Doug Kwan  <dougkwan@google.com>
4466
4467         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4468         to public.
4469         (Arm_relocate_functions::thumb_branch_common): Ditto.
4470         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4471         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4472         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4473         Arm_relocate_functions::jump24): Remove.
4474         (Target_arm::Relocate::relocate): Adjust code to call
4475         Arm_relocation_functions::arm_branch_common and
4476         Arm_relocation_functions::thumb_branch_common instead of their removed
4477         wrappers.  Merge switch-cases together to reduce source code size.
4478
4479 2010-01-29  Doug Kwan  <dougkwan@google.com>
4480
4481         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4482         output_local_symbol_count_needs_update_.
4483         (Arm_relobj::output_local_symbol_count_needs_update,
4484          Arm_relobj::set_output_local_symbol_count_needs_update,
4485          Arm_relobj::update_output_local_symbol_count): New methods.
4486         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4487         member.
4488         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4489         of pointed function as in a R_ARM_PREL31 relocation.
4490         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4491         for output local symbol count updating.
4492         (Target_arm::do_relax): Update output local symbol counts in objects
4493         if necessary.
4494         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4495
4496 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4497
4498         * arm.cc: Added support for the ARM relocations:
4499         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4500         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4501         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4502         movw_prel_nc).
4503         (Arm_relocate_functions::movw_rel): New method.
4504         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4505         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4506         thm_movw_prel_nc).
4507         (Arm_relocate_functions::thm_movw_rel): New method.
4508         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4509         thm_movt_prel).
4510         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4511         relocations.
4512         (Target_arm::Scan::global): Likewise.
4513         (Target_arm::Relocate::relocate): Likewise.
4514         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4515         Likewise.
4516
4517 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4518
4519         * arm.cc: Added support for ARM group relocations.
4520         (Target_arm::reloc_needs_sym_origin): New method.
4521         (Arm_relocate_functions::calc_grp_kn): New method.
4522         (Arm_relocate_functions::calc_grp_residual): New method.
4523         (Arm_relocate_functions::calc_grp_gn): New method.
4524         (Arm_relocate_functions::arm_grp_alu): New Method.
4525         (Arm_relocate_functions::arm_grp_ldr): New Method.
4526         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4527         (Arm_relocate_functions::arm_grp_ldc): New Method.
4528         (Target_arm::Scan::local): Handle the ARM group relocations.
4529         (Target_arm::Scan::global): Likewise.
4530         (Target_arm::Relocate::relocate): Likewise.
4531         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4532         Likewise.
4533
4534 2010-01-26  Doug Kwan  <dougkwan@google.com>
4535
4536         * arm.cc (set): Include.
4537         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4538         pointer type.
4539         (Arm_output_section::Text_section_list): New type.
4540         (Arm_output_section::append_text_sections_to_list): New method.
4541         (Arm_output_section::fix_exidx_coverage): Ditto.
4542         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4543         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4544         Relobj::set_section_offset() instead of
4545         Sized_relobj::invalidate_section_offset().
4546         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4547         parameter for section headers. Ignore relocation sections for
4548         unallocated sections and EXIDX sections.
4549         (Target_arm::fix_exidx_coverage): New method.
4550         (Target_arm::output_section_address_less_than): New type.
4551         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4552         linked text section instead of the EXIDX section.
4553         (Arm_output_section::create_stub_group): Add an assertion to check
4554         that this is not an EXIDX output section.
4555         (Arm_output_section::append_text_sections_to_list): New method.
4556         (Arm_output_section::fix_exidx_coverage): Ditto.
4557         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4558         Arm_relobj::section_needs_reloc_stub_scanning.
4559         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4560         first pass.
4561         (Target_arm::fix_exidx_coverage): New method.
4562         * object.h (Relobj::set_output_section): New method.
4563         (Sized_relobj::invalidate_section_offset): Remove method.
4564         (Sized_relobj::do_invalidate_section_offset): Remove method.
4565         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4566
4567 2010-01-25  Doug Kwan  <dougkwan@google.com>
4568
4569         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4570         Fix warning due to signed and unsigned comparison on a 32-bit host.
4571
4572 2010-01-22  Doug Kwan  <dougkwan@google.com>
4573
4574         * arm.cc (Target_arm::do_relax): Record an output section for section
4575         offset adjustment it contains any stub table that has changed.
4576         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4577         offsets in an output section if necessary.
4578         * output.cc (Output_section::Output_section): Initialize
4579         section_offsets_need_adjustments_.
4580         (Output_section::add_input_section_for_script): Renamed to
4581         Output_section::add_simple_input_section.
4582         (Output_section::save_states): Add a comment.
4583         (Output_section::discard_states): New method defintion.
4584         (Output_section::adjust_section_offsets): Same.
4585         * output.h (Output_section::add_input_section_for_script): Renamed to
4586         Output_section::add_simple_input_section.
4587         (Output_section::discard_states): New method declaration.
4588         (Output_section::adjust_section_offsets): Same.
4589         (Output_section::section_offsets_need_adjustment,
4590         Output_section::set_section_offsets_need_adjustment): New method
4591         definitions.
4592         (Output_section::section_offsets_need_adjustment_): New data member.
4593         * script-sections.cc
4594         (Output_section_element_input::set_section_address): Adjust code for
4595         renaming of Output_section::add_input_section_for_script.
4596         (Orphan_output_section::set_section_address): Same.
4597
4598 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4599
4600         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4601         Fix_v4bx enum values .
4602         * gold/options.h (General_options): New option definitions.
4603         (General_options::fix_v4bx): New method.
4604         (General_options::Fix_v4bx): New enum.
4605         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4606         (General_options::parse_fix_v4bx_interworking): New method.
4607
4608 2010-01-22  Doug Kwan  <dougkwan@google.com>
4609
4610         * arm.cc (Arm_exidx_fixup): New class.
4611
4612 2010-01-21  Doug Kwan  <dougkwan@google.com>
4613
4614         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4615         classes.
4616         (Arm_exidx_section_offset_map): New type.
4617
4618 2010-01-21  Doug Kwan  <dougkwan@google.com>
4619
4620         * arm.cc (Arm_exidx_input_section): New class.
4621         (Arm_relobj::exidx_input_section_by_link,
4622         Arm_relobj::exidx_input_section_by_shndx,
4623         Arm_relobj::make_exidx_input_section): New methods.
4624         (read_arm_attributes_section): Remove.
4625         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4626         information about them.
4627         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4628         to here.
4629
4630 2010-01-20  Doug Kwan  <dougkwan@google.com>
4631
4632         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4633         Input_section_specifier to Section_id.
4634         (Target_arm::new_arm_input_section: Adjust code for change of key
4635         type.
4636         (Target_arm::find_arm_input_section): Ditto.
4637         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4638         (Section_id): Remove.
4639         (Garbage_collection::Section_id_hash): Remove.
4640         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4641         (Section_id): Remove.
4642         (Icf::Section_id_hash): Remove.
4643         * object.h (Section_id, Const_section_id, Section_id_hash,
4644         Const_section_id_hash): New type definitions.
4645         * output.cc (Output_section::add_relaxed_input_section): Change to
4646         use Const_section_id instead of Input_section_specifier as key type.
4647         (Output_section::add_merge_input_section): Ditto.
4648         (Output_section::build_relaxation_map): Change to use Section_id
4649         instead of Input_section_specifier as key type.
4650         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4651         Ditto.
4652         (Output_section::convert_input_sections_to_relaxed_sections): Change
4653         to use Const_section_id instead of Input_section_specifier as key type.
4654         (Output_section::find_merge_section): Ditto.
4655         (Output_section::find_relaxed_input_section): Ditto.
4656         * output.h (Input_section_specifier): Remove class.
4657         (Output_section::Output_section_data_by_input_section_map): Change
4658         key type to Const_section_id.
4659         (Output_section::Output_relaxed_input_section_by_input_section_map):
4660         Ditto.
4661         (Output_section::Relaxation_map): Change key type to Section_id.
4662
4663 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4664
4665         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4666         (class Arm_v4bx_stub): New class.
4667         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4668         (Stub_factory::make_arm_v4bx_stub): New method.
4669         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4670         (Stub_table::empty): Handle v4bx stubs.
4671         (Stub_table::add_arm_v4bx_stub): New method.
4672         (Stub_table::find_arm_v4bx_stub): New method.
4673         (Arm_relocate_functions::v4bx): New method.
4674         (Target_arm::fix_v4bx): New method.
4675         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4676         (Stub_table::relocate_stubs): Likewise.
4677         (Stub_table::do_write): Likewise.
4678         (Stub_table::update_data_size_and_addralign): Likewise.
4679         (Stub_table::finalize_stubs):  Likewise.
4680         (Target_arm::Scan::local): Likewise.
4681         (Target_arm::Scan::global): Likewise.
4682         (Target_arm::do_finalize_sections): Likewise.
4683         (Target_arm::Relocate::relocate): Likewise.
4684         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4685         Likewise.
4686         (Target_arm::scan_reloc_for_stub): Likewise.
4687         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4688
4689 2010-01-19  Ian Lance Taylor  <iant@google.com>
4690
4691         * output.cc (Output_section_headers::do_sized_write): Write large
4692         segment count to sh_info field.
4693         (Output_file_header::do_sized_write): For large segment count,
4694         write PN_XNUM to e_phnum field.
4695
4696 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4697
4698         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4699         (Arm_relocate_functions::thm_jump8): New function.
4700         (Arm_relocate_functions::thm_jump11): New function.
4701         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4702         R_ARM_THM_JUMP11.
4703         (Target_arm::Scan::global): Likewise.
4704         (Target_arm::Relocate::relocate): Likewise.
4705         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4706         Likewise.
4707
4708 2010-01-14  Doug Kwan  <dougkwan@google.com>
4709
4710         * arm.cc (map, utility): Include headers.
4711         (Target_arm::apply_cortex_a8_workaround): New method.
4712         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4713         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4714         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4715         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4716         the --[no-]fix-cortex-a8 command line options.
4717         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4718         (Target_arm::relocate_stub): Use addend in instruction template.
4719         * options.h (DEFINE_bool): Set the user-set flag.
4720         (General_options): Add --[no-]-fix-cortex options.
4721         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4722         : Update fast look-up map after conversion.
4723
4724 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4725
4726         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4727         in the first pass of do_layout.
4728
4729 2010-01-13  Doug Kwan  <dougkwan@google.com>
4730
4731         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4732         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4733         apparent compiler problem of not folding static constant integral
4734         data members of elfcpp::Elf_sizes<32>.
4735
4736 2010-01-13  Doug Kwan  <dougkwan@google.com>
4737
4738         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4739         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4740         Arm_relobj::scan_section_for_cortex_a8_erratum,
4741         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4742         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4743         sections to scan for relocation stubs into a new method
4744         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4745         relocation and Cortex-A8 stub scanning.
4746         (Target_arm::do_relax): Force stubs to be after stubbed sections
4747         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4748         the beginning of a new relaxation pass.  Update a comment.
4749         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4750
4751 2010-01-12  Ian Lance Taylor  <iant@google.com>
4752
4753         * target-reloc.h (visibility_error): New inline function.
4754         (relocate_section): Call visibility_error.
4755         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4756         (MOSTLYCLEANFILES): Likewise.
4757         (protected_4_pic.o, protected_3.err): New targets.
4758         * testsuite/protected_4.cc: New file.
4759
4760 2010-01-12  Doug Kwan  <dougkwan@google.com>
4761
4762         * arm.cc (Cortex_a8_reloc): New class.
4763         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4764         and cortex_a8_relocs_info_.
4765         (Target_arm::fix_cortex_a8): New method definition.
4766         (Target_arm::Cortex_a8_relocs_info): New type.
4767         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4768         New data member declarations.
4769         (Target_arm::scan_reloc_for_stub): Record information about
4770         relocations for THUMB branches that might be exempted from the
4771         Cortex-A8 workaround.
4772         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4773         at the beginning of a relaxation pass.
4774
4775 2010-01-12  Doug Kwan  <dougkwan@google.com>
4776
4777         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4778         (Arm_relobj::Mapping_symbol_position,
4779          Arm_reloj::Mapping_symbol_position_less,
4780          Arm_relobj::Mapping_symbols_info): New types.
4781         (Target_arm::is_mapping_symbol_name): New method definition.
4782         (Arm_relobj::do_count_local_symbols): Save information about mapping
4783         symbols.
4784
4785 2010-01-11  Doug Kwan  <dougkwan@google.com>
4786
4787         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4788         Arm_relocate_functions::thumb32_branch_upper,
4789         Arm_relocate_functions::thumb32_branch_lower,
4790         Arm_relocate_functions::thumb32_cond_branch_offset,
4791         Arm_relocate_functions::thumb32_cond_branch_upper,
4792         Arm_relocate_functions::thumb32_cond_branch_lower,
4793         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4794         branch offset encoding.
4795         (Arm_relocate_functions::thumb_branch_common): Use new branch
4796         offset encoding methods to avoid code duplication.
4797         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4798         (Stub_addend_reader::operator()): Use new branch encoding method
4799         to avoid code duplication.
4800
4801 2010-01-11  Doug Kwan  <dougkwan@google.com>
4802
4803         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4804         (Target_arm::do_finalize_sections): Define special EXIDX section
4805         symbols only if referenced.
4806         * gc.h (Garbage_collection::add_reference): New method.
4807         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4808         code duplication.
4809
4810 2010-01-11  Ian Lance Taylor  <iant@google.com>
4811
4812         * script.cc (Version_script_info::build_expression_list_lookup):
4813         Change complaing about duplicate wildcard match from error to
4814         warning.
4815
4816         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4817         of 2009-12-30.
4818         (Version_script_info::Version_script_info): Initialize globs_,
4819         default_version_, default_is_global_, and exact_.  Don't
4820         initialize globals_ or locals_.
4821         (Version_script_info::build_lookup_tables): Build local symbols
4822         first.
4823         (Version_script_info::unquote): New function.
4824         (Version_script_info::add_exact_match): New function.
4825         (Version_script_info::build_expression_list_lookup): Remove lookup
4826         parameter.  Add is_global parameter.  Change all callers.  Handle
4827         wildcard pattern specially.  Unquote pattern.  Call
4828         add_exact_match.
4829         (Version_script_info::get_name_to_match): New function.
4830         (Version_script_info::get_symbol_version): New function.
4831         (Version_script_info::get_symbol_version_helper): Remove.
4832         (Version_script_info::check_unmatched_names): Call unquote.
4833         * script.h (class Version_script_info): Change get_symbol_version
4834         to be non-inline and add is_global parameter; change all callers.
4835         Rewrite symbol_is_local.  Update declarations.  Define struct
4836         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4837         Remove globals_ and locals_ members.  Add exact_, globs_,
4838         default_version_, is_global_.
4839         (Version_script_info::Glob): Remove pattern, add expression and
4840         is_global.  Update constructor.  Change all callers.
4841         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4842         default version.
4843         (Versions::symbol_section_contents): If a symbol is undefined, or
4844         defined in a dynamic object, set the version index to
4845         VER_NDX_LOCAL.
4846         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4847         symbol_is_local.
4848         (Symbol_table::add_from_pluginobj): Likewise.
4849         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4850
4851 2010-01-11  Doug Kwan  <dougkwan@google.com>
4852
4853         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4854         (incremental_dump_LDADD): Add linking option for libintl.
4855         * Makefile.in: Regenerate.
4856
4857 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4858
4859         PR gold/11144
4860         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4861         instead of -Ds.
4862         * testsuite/Makefile.in: Regenerated.
4863
4864 2010-01-10  Doug Kwan  <dougkwan@google.com>
4865
4866         * options.h (DEFINE_var): Use parentheses around argument varname__
4867         in macro body to avoid any unintended subsequent substitutions.
4868
4869 2010-01-10  Ian Lance Taylor  <iant@google.com>
4870
4871         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4872         candidates before doing symbol resolution.
4873
4874         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4875         ODR candidates if only one is weak.
4876
4877 2010-01-08  Ian Lance Taylor  <iant@google.com>
4878
4879         * script.cc (Version_script_info::build_expression_list_lookup):
4880         Don't warn about ambiguous version, just record the ambiguity.
4881         (Version_script_info::get_symbol_version_helper): Give error if
4882         version is ambiguous.
4883
4884 2010-01-08  Doug Kwan  <dougkwan@google.com>
4885
4886         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4887           prev_data_size_ and prev_addralign_.  Remove initializer for
4888           deleted data member has_been_changed_.
4889           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4890           to determine if the table is empty.
4891           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4892           Remove.
4893           (Stub_table::add_reloc_stub): Define method in class definition
4894           instead of just declaring it there.
4895           (Stub_table::add_cortex_a8_stub): New method definition.
4896           (Stub_table::update_data_size_and_addralign): Ditto.
4897           (Stub_table::finalize_stubs): Ditto.
4898           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4899           (Stub_table::do_addralign_): Return address alignment in the
4900           (Stub_table::do_reset_address_and_file_offset): Define method in
4901           class definition instead of declaring it there.  Set current data
4902           size to be the data size of the previous pass.
4903           (Stub_table::set_final_data_size): Use current data size as the
4904           final data size.
4905           (Stub_table::relocate_stub): Change parameter type of stub from
4906           Reloc_stub pointer to Stub pointer.
4907           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4908           (Stub_table::Cortex_a8_stub_list): New typedef.
4909           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4910            Stub_table::prev_addralign_): New data member.
4911           (Arm_relobj::Arm_relobj): Initialize data member
4912           section_has_cortex_a8_workaround_.
4913           (Arm_relobj::section_has_cortex_a8_workaround,
4914            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4915            definitions.
4916           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4917           declarations.
4918           (Target_arm::relocate_stub): Change parameter type of stub from
4919           Reloc_stub pointer to Stub pointer.
4920           (Insn_template::size, Insn_template::alignment): Handle
4921           THUMB16_SPECIAL_TYPE.
4922           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4923            Stub_table::update_data_size_and_addralign,
4924            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4925           definitions.
4926           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4927           (Stub_table::do_write): Ditto.
4928           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4929
4930 2010-01-08  Ian Lance Taylor  <iant@google.com>
4931
4932         PR 11108
4933         * symtab.h (class Symbol): Remove fields is_target_special_ and
4934         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4935         (Symbol::is_defined_in_discarded_section): New function.
4936         (Symbol::set_is_defined_in_discarded_section): New function.
4937         (Symbol::has_plt_offset): Rewrite.
4938         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4939         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4940         Don't initialize is_target_special_ or has_plt_offset_.
4941         Initialize is_defined_in_discarded_section_.
4942         (Symbol_table::add_from_relobj): If appropriate, set
4943         is_defined_in_discarded_section.
4944         * resolve.cc (Symbol::override_base_with_special): Don't test
4945         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4946         * target-reloc.h (relocate_section): Do special handling for
4947         symbols defined in discarded sections for global symbols as well
4948         as local symbols.
4949
4950 2010-01-08  Ian Lance Taylor  <iant@google.com>
4951
4952         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4953         the SHT_SYMTAB case.
4954
4955 2010-01-08  Ian Lance Taylor  <iant@google.com>
4956
4957         * object.cc (Sized_relobj::do_layout): Don't get confused if
4958         layout_eh_frame returns NULL.
4959
4960 2010-01-08  Ian Lance Taylor  <iant@google.com>
4961
4962         PR 11084
4963         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4964         dynamic symbol table, use the normal symbol table.
4965         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4966         symbol table.
4967
4968 2010-01-08  Ian Lance Taylor  <iant@google.com>
4969
4970         PR 11072
4971         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4972         sections.
4973
4974 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4975
4976         * version.cc (print_version): Change to "Copyright 2010".
4977
4978 2010-01-08  Ian Lance Taylor  <iant@google.com>
4979
4980         PR 10287
4981         PR 11063
4982         * i386.cc (class Target_i386): Change return type of plt_section
4983         to be non-const.
4984         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4985         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4986         tls_desc_rel_ field.
4987         (Output_data_plt_i386::rel_tls_desc): New function.
4988         (Target_i386::rel_tls_desc_section): New function.
4989         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4990         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4991         R_386_TLS_DESC reloc in rel_tls_desc_section.
4992         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4993         Define struct Tlsdesc_info.
4994         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4995         (Target_x86_64::do_reloc_symbol_index): New function.
4996         (Target_x86_64::add_tlsdesc_info): New function.
4997         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4998         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4999         tlsdesc_rel_ field.
5000         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
5001         all callers.
5002         (Output_data_plt_x86_64::rela_tlsdesc): New function.
5003         (Target_x86_64::rela_tlsdesc_section): New function.
5004         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5005         handling.
5006         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5007         (Target_x86_64::do_reloc_addend): New function.
5008         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5009         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5010         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
5011         (Output_reloc::type): New function.
5012         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5013         (Output_reloc::is_target_specific): New function.
5014         (Output_reloc::target_arg): New function.
5015         (class Output_reloc) [SHT_RELA]: Add four new constructors for
5016         absolute relocs and target specific relocs.
5017         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5018         add_target_specific.
5019         (class Output_data_reloc) [SHT_RELA]: Likewise.
5020         * output.cc (Output_reloc::Output_reloc): Add four new versions
5021         for absolute relocs and target specific relocs.
5022         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5023         (Output_reloc::get_symbol_index): Likewise.
5024         (Output_reloc::local_section_offset): Check that local_sym_index_
5025         is not TARGET_CODE or 0.
5026         (Output_reloc::symbol_value): Likewise.
5027         (Output_reloc::write) [SHT_RELA]: Call target for target specific
5028         reloc.
5029         * target.h (class Target): Add reloc_symbol_index and reloc_addend
5030         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
5031         functions.
5032         * layout.cc (add_target_dynamic_tags): Use output section for
5033         DT_PLTRELSZ and DT_JMPREL.
5034
5035 2010-01-07  Ian Lance Taylor  <iant@google.com>
5036
5037         PR 11061
5038         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5039         function.
5040         (class Output_data_reloc_generic): Define.
5041         (class Output_data_reloc_base): Change base class to
5042         Output_data_reloc_generic.  Change add() method to call
5043         bump_relative_reloc_count for a relative reloc.  Remove
5044         sort_relocs_ field.
5045         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5046         to sort_relocs().
5047         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5048         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
5049         appropriate.
5050         * layout.h (class Layout): Update declaration.
5051
5052 2010-01-07  Ian Lance Taylor  <iant@google.com>
5053
5054         * output.h (class Output_data): Add const version of
5055         output_section and do_output_section.
5056         (class Output_section_data): Add const version of
5057         do_output_section.
5058         (class Output_section): Likewise.
5059         * layout.cc (Layout::add_target_dynamic_tags): New function.
5060         * layout.h (class Layout): Update declarations.
5061         * arm.cc (Target_arm::do_finalize_sections): Use
5062         add_target_dynamic_tags.
5063         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5064         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5065         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5066         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5067
5068 2010-01-07  Ian Lance Taylor  <iant@google.com>
5069
5070         PR 11042
5071         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5072         object as needed.
5073
5074 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
5075             Ian Lance Taylor  <iant@google.com>
5076
5077         PR 11019
5078         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5079         Xindex::read_symtab_xindex.
5080
5081 2010-01-07  Doug Kwan  <dougkwan@google.com>
5082
5083         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5084         (Insn_template::thumb16_bcond_insn): New method declaration.
5085         (Insn_template): Fix spelling.
5086         (Stub::thumb16_special): New method declaration.
5087         (Stub::do_write): Define virtual method which was previously pure
5088         virtual.
5089         (Stub::do_thumb16_special): New method declaration.
5090         (Stub::do_fixed_endian_write): New template member.
5091         (Reloc_stub::do_write): Remove.
5092         (Reloc_stub::do_fixed_endian_write): Remove.
5093         (Cortex_a8_stub): New class definition.
5094         (Stub_factory::make_cortex_a8_stub): New method definition.
5095         (Stub_factory::Stub_factory): Add missing static storage class
5096         qualifier for elf32_arm_stub_a8_veneer_blx.
5097
5098 2010-01-07  Ian Lance Taylor  <iant@google.com>
5099
5100         PR 10980
5101         * options.h (class General_options): Add --warn-unresolved-symbols
5102         and --error-unresolved-symbols.
5103         * errors.cc (Errors::undefined_symbol): Implement
5104         --warn-unresolved-symbols.
5105
5106         * options.h (class General_options): Add -z text and -z textoff.
5107         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5108
5109 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
5110
5111         * gc.h (Garbage_collection::Cident_section_map): New typedef.
5112         (Garbage_collection::cident_sections): New function.
5113         (Garbage_collection::add_cident_section): New function.
5114         (Garbage_collection::cident_sections_): New member.
5115         (gc_process_relocs): Add references to sections whose names are C
5116         identifiers.
5117         * gold.h (cident_section_start_prefix): New constant.
5118         (cident_section_stop_prefix): New constant.
5119         (is_cident): New function.
5120         * layout.cc (Layout::define_section_symbols): Replace string constants
5121         with the newly defined constants.
5122         * object.cc (Sized_relobj::do_layout): Track sections whose names are
5123         C identifiers.
5124         * testsuite/Makefile.am: Add gc_orphan_section_test.
5125         * testsuite/Makefile.in: Regenerate.
5126         * testsuite/gc_orphan_section_test.cc: New file.
5127         * testsuite/gc_orphan_section_test.sh: New file.
5128
5129 2010-01-06  Ian Lance Taylor  <iant@google.com>
5130
5131         PR 10980
5132         * options.h (class General_options): Add --warn-shared-textrel.
5133         * layout.cc (Layout::finish_dynamic_section): Implement
5134         --warn-shared-textrel.
5135
5136         PR 10980
5137         * options.h (class General_options): Add --warn-multiple-gp.
5138
5139 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5140
5141         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5142         $(THREADSLIB) and $(LIBDL).
5143         * Makefile.in: Rebuild.
5144
5145 2010-01-06  Ian Lance Taylor  <iant@google.com>
5146
5147         PR 10980
5148         * options.cc (General_options::parse_section_start): New function.
5149         (General_options::section_start): New function.
5150         (General_options::General_options): Initialize all members.
5151         * options.h: Include <map>
5152         (class General_options): Add --section-start.  Add section_starts_
5153         member.
5154         * layout.cc (Layout::attach_allocated_section_to_segment): If
5155         --section-start was used, set the address of the segment.  Remove
5156         local sort_sections.
5157         (Layout::relaxation_loop_body): If the address of the load segment
5158         has been set by --section-start, don't use it.
5159         * output.h (Output_segment::update_flags_for_output_section): New
5160         function.
5161         * output.cc (Output_segment::add_output_section): Call
5162         update_flags_for_output_section.
5163
5164 2010-01-05  Ian Lance Taylor  <iant@google.com>
5165
5166         PR 10980
5167         * options.h (class General_options): Add --undefined-version.
5168         * script.cc (struct Version_expression): Add was_matched_by_symbol
5169         field.
5170         (Version_script_info::matched_symbol): New function.
5171         (Version_script_info::get_symbol_version_helper): Call
5172         matched_symbol.
5173         (Version_script_info::check_unmatched_names): New function.
5174         * script.h (class Version_script_info): Update declarations.
5175         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5176
5177         * options.h (class General_options): Use DEFINE_bool_alias for
5178         allow_multiple_definition.
5179         * resolve.cc (Symbol_table::should_override): Don't test
5180         allow_multiple_definition.
5181
5182         PR 10980
5183         * options.h (class General_options): Add --cref.
5184         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5185         until after printing cref table.
5186         * cref.cc: Include "symtab.h".
5187         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5188         (Cref_table_compare::operator()): New function.
5189         (Cref_inputs::gather_cref): New function.
5190         (filecol): New static const.
5191         (Cref_inputs::print_cref): New function.
5192         (Cref::print_cref): New function.
5193         * cref.h: Include <cstdio>.
5194         (class Cref): Update declarations.
5195         * mapfile.h (Mapfile::file): New function.
5196         * object.h (class Object): Define Symbols.  Declare virtual
5197         do_get_global_symbols.
5198         (Object::get_global_symbols): New function.
5199         * object.cc (Input_objects::add_object): Pass object to cref_ if
5200         --cref.
5201         (Input_objects::archive_start): Likewise.
5202         (Input_objects::archive_stop): Likewise.
5203         (Input_objects::print_cref): New function.
5204         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5205         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5206         --cref.
5207         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5208         function.
5209         * plugin.h (class Sized_pluginobj): Update declarations.
5210
5211 2010-01-05  Ian Lance Taylor  <iant@google.com>
5212
5213         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5214         to is_default_version.  Rename insdef to insdefault.
5215         (Symbol_table::add_from_relobj): Rename def to is_default_version
5216         and local to is_forced_local.
5217         (Symbol_table::add_from_pluginobj): Likewise.
5218         (Symbol_table::add_from_dynobj): Likewise.
5219         (Symbol_table::define_special_symbol): Rename insdef to
5220         insdefault.
5221
5222 2010-01-04  Ian Lance Taylor  <iant@google.com>
5223
5224         PR 10980
5225         * options.h (class General_options): Add
5226         --allow-multiple-definition and -z muldefs.
5227         * resolve.cc (Symbol_table::should_override): Don't warn about a
5228         multiple symbol definition if --allow-multiple-definition or -z
5229         muldefs.
5230
5231         PR 10980
5232         * options.h (class General_options): Add --add-needed and
5233         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5234         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5235         error if --copy-dt-needed-entries aka --add-needed is used and
5236         would cause a change in behaviour.
5237
5238         PR 10980
5239         * options.h (class General_options): Add -G as a short version of
5240         --shared.  Add no-op options -assert, -g, and -i.
5241
5242 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5243
5244         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5245         check for .text or .gnu.linkonce.t sections.
5246         * icf.cc (Icf::find_identical_sections): Ditto.
5247         Change the detection for mangled function name within the section
5248         name.
5249         * icf.h (is_section_foldable_candidate): New function.
5250
5251 2009-12-30  Ian Lance Taylor  <iant@google.com>
5252
5253         PR 10980
5254         * options.h (class General_options): Permit two dashes with
5255         --retain-symbols-file.
5256
5257 2009-12-30  Ian Lance Taylor  <iant@google.com>
5258
5259         PR 10979
5260         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5261         don't put the file header and segment headers in the text
5262         segment.
5263
5264         PR 10979
5265         * common.cc (Sort_commons::operator()): Stabilize sort when both
5266         entries are NULL.
5267         (Symbol_table::do_allocate_commons_list): When allocating common
5268         symbols, skip a symbol which is no longer common.
5269         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5270         an object before checking its type.
5271         * testsuite/common_test_2.c: New file.
5272         * testsuite/common_test_3.c: New file.
5273         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5274         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5275         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5276         (common_test_2_pic.o, common_test_2.so): New targets.
5277         (common_test_3_pic.o, common_test_3.so): New targets.
5278         * testsuite/Makefile.in: Rebuild.
5279
5280         PR 10979
5281         * script.cc (read_input_script): If we see a new SECTIONS clause,
5282         and we have added an input section, give an error.
5283         * layout.h (class Layout): Add have_added_input_section function.
5284         Add have_added_input_section_ field.
5285         * layout.cc (Layout::Layout): Initialize
5286         have_added_input_section_.
5287         (Layout::layout): Set have_added_input_section_.
5288         (Layout::layout_eh_frame): Likewise.
5289
5290 2009-12-30  Ian Lance Taylor  <iant@google.com>
5291
5292         PR 10931
5293         * options.h (class General_options): Add --sort-common option.
5294         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5295         * common.cc (Sort_common): Add sort_order parameter to
5296         constructor.  Add sort_order_ field.
5297         (Sort_commons::operator): Check sort_order_.
5298         (Symbol_table::allocate_commons): Determine the sort order.
5299         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5300         Change all callers.
5301         (Symbol_table::do_allocate_commons_list): Likewise.
5302
5303 2009-12-30  Ian Lance Taylor  <iant@google.com>
5304
5305         PR 10916
5306         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5307         symbols from this object, don't change the visibility of an
5308         undefined symbol.
5309         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5310
5311 2009-12-30  Ian Lance Taylor  <iant@google.com>
5312
5313         PR 10861
5314         * script.h (class Version_script_info): Define Language enum.
5315         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5316         new fields globals_, locals_, and is_finalized_.
5317         * script.cc: Various formatting fixes.
5318         (class Parser_closure): Change language_stack_ from a vector of
5319         std::string to one of Version_script_info::Language.  Adjust all
5320         uses accordingly.
5321         (class Lazy_demangler): Remove.
5322         (struct Version_expression): Change language from std::string to
5323         Version_script_info::Language.
5324         (Version_script_info::Version_script_info): New function.
5325         (Version_script_info::~Version_script_info): Don't call clear.
5326         (Version_script_info::finalize): New function.
5327         (Version_script_info::build_lookup_tables): New function.
5328         (Version_script_info::build_expression_list_lookup): New
5329         function.
5330         (Version_script_info::get_symbol_version_helper): Rewrite to use
5331         lookup tables.
5332         (Version_script_info::print_expression_list): Adjust to use
5333         Version_script_info::Language.
5334         (script_push_lex_into_version_mode): Check that the version script
5335         has not been finalized.
5336         (version_script_push_lang): Change language string to
5337         Version_script_info::Language.
5338         * options.cc (Command_line::version_script): New function.
5339         * options.h (class General_options): Add finalize_dynamic_list
5340         function.  Change version_script from declaration to definition.
5341         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5342         * testsuite/version_script.map: Remove duplicate def of foo.
5343         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5344         version_script.map.
5345         * testsuite/Makefile.in: Rebuild.
5346
5347 2009-12-30  Ian Lance Taylor  <iant@google.com>
5348
5349         PR 10843
5350         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5351         if the input symbol index is 0, make the output symbol index 0.
5352
5353 2009-12-30  Ian Lance Taylor  <iant@google.com>
5354
5355         PR 10670
5356         * options.h (class General_options): Add -x/--discard-all.
5357         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5358         --discard-all.  If the local symbol needs a dynamic entry, check
5359         that before handling --discard-locals.
5360
5361 2009-12-30  Ian Lance Taylor  <iant@google.com>
5362
5363         PR 10450
5364         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5365         flags to PF_R.
5366         (Output_segment::add_output_section): Don't change the flags if
5367         the type is PT_TLS.
5368
5369         PR 10450
5370         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5371         GNU hash table if they need a dynamic value.  Otherwise, don't add
5372         them if they are defined in a dynamic object or are forced local.
5373
5374 2009-12-29  Ian Lance Taylor  <iant@google.com>
5375
5376         PR 10450
5377         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5378         .gnu.hash table for a 32-bit target.
5379
5380         PR 10450
5381         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5382         regular and a dynamic object only needs a dynamic symbol table
5383         entry if it is externally visible.
5384
5385         PR 10450
5386         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5387         constructor.  Add global_offset_table_ field.
5388         (Target_i386::got_section): Set global_offset_table_.
5389         (Target_i386::do_finalize_sections): Set global_offset_table_
5390         size.
5391         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5392         in constructor.  Add global_offset_table_ field.
5393         (Target_x86_64::got_section): Set global_offset_table_.
5394         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5395         size.
5396
5397         * layout.cc (Layout::Layout): Initialize increase_relro_.
5398         (Layout::get_output_section): Add is_relro, is_last_relro, and
5399         is_first_non_relro parameters.  Change all callers.
5400         (Layout::choose_output_section): Likewise.
5401         (Layout::add_output_section_data): Likewise.
5402         (Layout::make_output_section): Likewise.
5403         (Layout::set_segment_offsets): Clear increase_relro when using a
5404         linker script.
5405         * layout.h (class Layout): Add increase_relro method.  Add
5406         increase_relro_ field.  Update declarations.
5407         * output.cc (Output_section::Output_section): Initialize
5408         is_last_relro_ and is_first_non_relro_.
5409         (Output_segment::add_output_section): Group relro sections is
5410         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5411         (Output_segment::maximum_alignment): Remove relro handling.
5412         (Output_segment::set_section_addresses): Add increase_relro
5413         parameter.  Change all callers.  Add initial alignment to align
5414         relro sections on separate page.  Remove old relro handling.
5415         (Output_segment::set_section_list_addresses): Remove in_relro
5416         parameter.  Change all callers.
5417         (Output_segment::set_offset): Add increase parameter.  Change all
5418         callers.  Remove old relro handling.
5419         * output.h (class Output_section): Add new methods: is_last_relro,
5420         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5421         Add is_last_relro_ and is_first_non_relro_ fields.
5422         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5423         Create separate .got.plt section.  Call increase_relro.
5424         * x86_64.cc (Target_x86_64::got_section): Likewise.
5425         * testsuite/relro_script_test.t: Add .got.plt.
5426
5427         PR 10450
5428         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5429         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5430         (Layout::finalize): Call set_dynamic_symbol_size.
5431         (Layout::set_dynamic_symbol_size): New function.
5432         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5433         set_dynamic_symbol_size.
5434
5435         PR 10450
5436         * output.h (class Output_section): Add is_entsize_zero_ field.
5437         * output.cc (Output_section::Output_section): Initialize
5438         is_entsize_zero_.
5439         (Output_section::set_entsize): If two different entsizes are
5440         requested, force it to zero.
5441         (Output_section::add_input_section): Set flags for .debug_str
5442         before updating section flags.  Set entsize.
5443         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5444         and SHF_STRING if all input sections have those flags.
5445
5446 2009-12-29   Rafael Espindola  <espindola@google.com>
5447
5448         * main.cc (main): Fix the sys time reporting.
5449         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5450         reporting.
5451
5452 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5453
5454         * options.cc (General_options::parse_version): Allow -v to exit
5455         without an error if there is nothing to link.
5456
5457 2009-12-29  Ian Lance Taylor  <iant@google.com>
5458
5459         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5460         using a version of gcc before 4.1.
5461         * configure: Rebuild.
5462
5463 2009-12-28  Chris Demetriou  <cgd@google.com>
5464
5465         * attributes.cc (Output_attributes_section_data::do_write): Use
5466         std::vector::front rather than std::vector::data.
5467
5468 2009-12-28  Ian Lance Taylor  <iant@google.com>
5469
5470         * symtab.h (class Symbol_table): Add enum Defined.
5471         * resolve.cc (Symbol_table::should_override): Add defined
5472         parameter.  Change all callers.  Test whether object is NULL
5473         before calling a method on it.
5474         (Symbol_table::report_resolve_problem): Add defined parameter.
5475         Change all callers.
5476         (Symbol_table::should_override_with_special): Likewise.
5477         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5478         parameter.  Change all callers.
5479         (Symbol_table::do_define_in_output_data): Likewise.
5480         (Symbol_table::define_in_output_segment): Likewise.
5481         (Symbol_table::do_define_in_output_segment): Likewise.
5482         (Symbol_table::define_as_constant): Likewise.
5483         (Symbol_table::do_define_as_constant): Likewise.
5484         * script.h (class Symbol_assignment): Add is_defsym parameter to
5485         constructor; change all callers.
5486         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5487         parameter.  Change all callers.  Add is_defsym_ field.
5488         (class Parser_closure): Add parsing_defsym parameter to
5489         constructor; change all callers.  Add parsing_defsym accessor
5490         function.  Add parsing_defsym_ field.
5491
5492 2009-12-28  Ian Lance Taylor  <iant@google.com>
5493
5494         * gold.cc (queue_middle_tasks): Fix formatting.
5495         * object.cc (Relobj::is_section_name_included): Likewise.
5496
5497 2009-12-23  Ian Lance Taylor  <iant@google.com>
5498
5499         * i386.cc (Target_i386::do_calls_non_split): Recognize
5500         -fsplit-stack prologue for a function with a static chain.
5501         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5502         -fsplit-stack prologue when using %r11.
5503
5504 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5505
5506         * options.cc (General_options::parse_version): Make -v continue and do
5507         the link like GNU ld does.
5508
5509 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5510
5511         * Makefile.am (CCFILES): Add timer.cc.
5512         (HFILES): Add timer.h.
5513         * configure.ac: Check for sysconf and times.
5514         * main.cc: include timer.h.
5515         (main): Use Timer instead of get_run_time.
5516         * timer.cc: New.
5517         * timer.h: New.
5518         * workqueue.cc: include timer.h.
5519         (Workqueue::find_and_run_task):
5520         Report user, sys and wall time.
5521         * Makefile.in: Regenerate.
5522         * config.in: Regenerate.
5523         * configure: Regenerate.
5524
5525 2009-12-16  Doug Kwan  <dougkwan@google.com>
5526
5527         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5528         sections.
5529         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5530         relaxed input sections.
5531         * output.cc (Output_section::find_relaxed_input_section): Change
5532         return type to Output_relaxed_input_section pointer.  Adjust code
5533         for new type of relaxed_input_section_map_.
5534         * output.h (Output_section::find_relaxed_input_section): Change
5535         return type to Output_relaxed_input_section pointer.
5536         (Output_section::Output_relaxed_input_section_by_input_section_map):
5537         New type.
5538         (Output_section::relaxed_input_section_map_): Change type to
5539         Output_section::Output_relaxed_input_section_by_input_section_map.
5540         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5541         input section.
5542
5543 2009-12-15  Ian Lance Taylor  <iant@google.com>
5544
5545         * layout.cc (Layout::create_shstrtab): Only write out after input
5546         sections if we are compressing debug sections.
5547
5548 2009-12-15  Ian Lance Taylor  <iant@google.com>
5549
5550         * archive.cc (Archive::add_symbols): Only look up a symbol without
5551         a version if there is, in fact, a version.
5552
5553 2009-12-14  Ian Lance Taylor  <iant@google.com>
5554
5555         Revert -Wshadow changes, all changes from:
5556         2009-12-11  Doug Kwan  <dougkwan@google.com>
5557         2009-12-11  Nick Clifton  <nickc@redhat.com>
5558         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5559
5560 2009-12-11  Doug Kwan  <dougkwan@google.com>
5561
5562         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5563         due to -Wshadow.
5564         * attributes.cc (Object_attribute::size): Ditto.
5565         (Attributes_section_data::size): Ditto.
5566         (Attributes_section_data::Attributes_section_data): Ditto.
5567         (Output_attributes_section_data::do_write): Ditto.
5568         * attributes.h (Object_attribute::set_type): Ditto.
5569         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5570
5571 2009-12-11  Nick Clifton  <nickc@redhat.com>
5572
5573         * archive.cc: Fix shadowed variable warnings.
5574         * arm.cc: Likewise.
5575         * compressed_output.cc: Likewise.
5576         * compressed_output.h: Likewise.
5577         * configure: Likewise.
5578         * dwarf_reader.cc: Likewise.
5579         * dynobj.cc: Likewise.
5580         * dynobj.h: Likewise.
5581         * ehframe.cc: Likewise.
5582         * ehframe.h: Likewise.
5583         * errors.cc: Likewise.
5584         * expression.cc: Likewise.
5585         * fileread.cc: Likewise.
5586         * fileread.h: Likewise.
5587         * freebsd.h: Likewise.
5588         * i386.cc: Likewise.
5589         * icf.cc: Likewise.
5590         * incremental.h: Likewise.
5591         * layout.cc: Likewise.
5592         * layout.h: Likewise.
5593         * mapfile.cc: Likewise.
5594         * merge.cc: Likewise.
5595         * merge.h: Likewise.
5596         * object.cc: Likewise.
5597         * object.h: Likewise.
5598         * options.h: Likewise.
5599         * output.cc: Likewise.
5600         * output.h: Likewise.
5601         * parameters.cc: Likewise.
5602         * plugin.cc: Likewise.
5603         * powerpc.cc: Likewise.
5604         * reduced_debug_output.cc: Likewise.
5605         * reduced_debug_output.h: Likewise.
5606         * reloc.cc: Likewise.
5607         * reloc.h: Likewise.
5608         * resolve.cc: Likewise.
5609         * script-sections.cc: Likewise.
5610         * script.cc: Likewise.
5611         * script.h: Likewise.
5612         * sparc.cc: Likewise.
5613         * symtab.cc: Likewise.
5614         * symtab.h: Likewise.
5615         * target-select.cc: Likewise.
5616         * target-select.h: Likewise.
5617         * token.h: Likewise.
5618         * workqueue.cc: Likewise.
5619         * workqueue.h: Likewise.
5620         * x86_64.cc: Likewise.
5621
5622 2009-12-10  Doug Kwan  <dougkwan@google.com>
5623
5624         * arm.cc (attributes.h): New include.
5625         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5626         (Arm_relobj::~Arm_relobj): Delete object pointed by
5627         attributes_section_data_.
5628         (Arm_relobj::attributes_section_data): New method definition.
5629         (Arm_relobj::attributes_section_data_): New data member declaration.
5630         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5631         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5632         attributes_section_data_.
5633         (Arm_dynobj::attributes_section_data): New method definition.
5634         (Arm_dynobj::attributes_section_data_): New data member declaration.
5635         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5636         initialization value of may_use_blx_ to false.
5637         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5638         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5639         object attributes to compute results instead of hard-coding.
5640         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5641         Target_arm::get_secondary_compatible_arch,
5642         Target_arm::set_secondary_compatible_arch
5643         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5644         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5645         New method declarations.
5646         (Target_arm::get_aeabi_object_attribute): New method definition.
5647         (Target_arm::attributes_section_data_): New data member declaration.
5648         (read_arm_attributes_section): New template definition.
5649         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5650         (Arm_dynobj::do_read_symbols): Ditto.
5651         (Target_arm::do_finalize_sections): Merge attributes sections from
5652         input.  Check for BLX use after attributes section merging.
5653         Fix __exidx_start and __exidx_end visibility.  Create an
5654         .ARM.attributes section if necessary.
5655         (Target_arm::get_secondary_compatible_arch,
5656         Target_arm::set_secondary_compatible_arch,
5657         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5658         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5659         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5660         New method definitions.
5661
5662 2009-12-09  Ian Lance Taylor  <iant@google.com>
5663
5664         * plugin.cc (Plugin::load): Don't cast from void* to a function
5665         pointer.
5666
5667 2009-12-09  Ian Lance Taylor  <iant@google.com>
5668
5669         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5670         information fields.
5671
5672 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5673
5674         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5675         Replace two_file_shared_1.so with two_file_shared_2.so.
5676         * testsuite/Makefile.in: Regenerated.
5677
5678 2009-12-08  Doug Kwan  <dougkwan@google.com>
5679
5680         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5681         (HFILES): Add attributes.h and int_encoding.h.
5682         * Makefile.in: Regenerate.
5683         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5684         function definitions to int_encoding.cc
5685         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5686         prototypes to int_encoding.h
5687         * reduced_debug_output.cc (int_encoding.h): New include.
5688         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5689         function definitions to int_encoding.cc
5690         (insert_into_vector, read_from_pointer): Move template definitions to
5691         int_encoding.h
5692         * attributes.cc: New file.
5693         * attributes.h: New file.
5694         * int_encoding.cc: New file.
5695         * int_encoding.h: New file.
5696
5697 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5698
5699         PR gold/11055
5700         * incremental-dump.cc (dump_incremental_inputs): New.
5701         (main): Use dump_incremental_inputs.
5702
5703 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5704
5705         PR gold/10893
5706         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5707         checking elfcpp::STT_FUNC.
5708         (Target_i386::Relocate::relocate): Likewise.
5709         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5710
5711         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5712         symbols from shared libraries into normal FUNC symbols.
5713
5714         * symtab.h (Symbol): Add is_func and use it.
5715
5716 2009-12-05  Doug Kwan  <dougkwan@google.com>
5717
5718         * arm.cc (Target_arm::arm_info): Initialize new fields
5719         attributes_section and attributes_vendor.
5720         * i386.cc (Target_i386::i386_info): Same.
5721         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5722         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5723         fields attributes_section and attributes_vendor.
5724         * sparc.cc (Target_sparc::sparc_info): Same.
5725         * target.h (Target::attributes_section, Target::attributes_vendor,
5726         Target::is_attributes_section, Target::attribute_arg_type,
5727         Target::attributes_order): New method definitions.
5728         (Target::Target_info::attributes_section,
5729         Target::Target_info::attributes_vendor): New fields.
5730         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5731         virtual method definitions.
5732         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5733         attributes_section and attributes_vendor.
5734         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5735
5736 2009-12-05  Doug Kwan  <dougkwan@google.com>
5737
5738         * arm.cc: Update comments about interworking and stub generation.
5739         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5740         considered as non-PIC.
5741         (Arm_relocate_functions::base_abs): Fix formatting.
5742         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5743         of function to use GOT entry address instead of offset.
5744         (Target_arm::Scan::global): Issue an error if a symbol would need a
5745         PLT does not get one because it is untyped.  Remove code to create
5746         dynamic symbols for relative branches.
5747         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5748         takes unsigned integer instead of boolean.
5749
5750 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5751
5752         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5753         (two_file_test_LDADD): Likewise.
5754         (common_test_1_LDADD): Likewise.
5755         (exception_test_LDADD) Likewise.
5756         (weak_test_LDADD): Likewise.
5757         (many_sections_test_LDADD): Likewise.
5758         (initpri1_LDADD): Likewise.
5759         (script_test_1_LDADD): Likewise.
5760         (script_test_2_LDADD): Likewise.
5761         (justsyms_LDADD): Likewise.
5762         (binary_test_LDADD): Likewise.
5763         (large_LDADD): Likewise.
5764         * testsuite/Makefile.in: Regenerated.
5765
5766 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5767
5768         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5769         (Symbol_table::override_with_special): Likewise.
5770         (Symbol_table::add_from_object): Likewise.
5771
5772 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5773
5774         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5775         Don't set the data_offset twice.
5776
5777 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5778
5779         * testsuite/Makefile.in: Regenerate.
5780
5781 2009-12-03  Doug Kwan  <dougkwan@google.com>
5782
5783         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5784         (Target_arm::do_finalize_sections): Add parameter for symbol table
5785         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5786         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5787         parameter for symbol table pointer.
5788         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5789         an additional parameter for a pointer to symbol table.
5790         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5791         parameter for a symbol table pointer.
5792         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5793         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5794         Ditto.
5795         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5796         parameter for a symbol table pointer.
5797
5798 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5799
5800         * incremental.cc (Incremental_inputs_header)
5801         (Incremental_inputs_header_write, Incremental_inputs_entry)
5802         (Incremental_inputs_entry_write): Move ...
5803         * incremental.h (Incremental_inputs_header)
5804         (Incremental_inputs_header_write, Incremental_inputs_entry)
5805         (Incremental_inputs_entry_write): here.
5806
5807 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5808
5809         * incremental.cc (make_sized_incremental_binary): Set the target.
5810         Error if it is incompatible.
5811         * output.h (Output_file): Add filename method.
5812
5813 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5814
5815         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5816         from the get_* methods.
5817
5818 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5819
5820         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5821         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5822         Write 0 for the data_offset of scripts.
5823
5824 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5825
5826         * testsuite/Makefile.am: Add the incremental_test.sh test.
5827         * testsuite/incremental_test.sh: New.
5828         * testsuite/incremental_test_1.c: New.
5829         * testsuite/incremental_test_2.c: New.
5830
5831 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5832
5833        * incremental-dump.cc (main): Fix typos.
5834
5835 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5836
5837         PR gold/11025
5838         * incremental-dump.cc (main): Use llu to print 64 bit values.
5839
5840 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5841             H.J. Lu  <hongjiu.lu@intel.com>
5842
5843         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5844         $(LIBDL).
5845         (incremental_dump_LDADD): Likewise.
5846         * Makefile.in: Regenerated.
5847
5848 2009-11-25  Doug Kwan  <dougkwan@google.com>
5849
5850         Revert:
5851
5852         2009-11-25  Doug Kwan  <dougkwan@google.com>
5853
5854                 * arm.cc (Target_arm::Target_arm): Move method definition
5855                 outside of class definition.  Add code to handle
5856                 --target1-rel, --target1-abs and --target2= options.
5857                 (Target_arm::get_reloc_reloc_type): Change method to be
5858                 non-static and const.
5859                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5860                 New data member declaration.
5861                 (Target_arm::Scan::local, Target_arm::Scan::global,
5862                 Target_arm::Relocate::relocate,
5863                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5864                 Adjust call to Target_arm::get_real_reloc_type.
5865                 (Target_arm::get_real_reloc_type): Use command line options
5866                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5867                 * options.h (--target1-rel, --target1-abs, --target2): New
5868                 ARM-only options.
5869
5870 2009-11-25  Doug Kwan  <dougkwan@google.com>
5871
5872         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5873         class definition.  Add code to handle --target1-rel, --target1-abs
5874         and --target2= options.
5875         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5876         and const.
5877         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5878         member declaration.
5879         (Target_arm::Scan::local, Target_arm::Scan::global,
5880         Target_arm::Relocate::relocate,
5881         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5882         call to Target_arm::get_real_reloc_type.
5883         (Target_arm::get_real_reloc_type): Use command line options to
5884         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5885         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5886         options.
5887
5888 2009-11-25  Doug Kwan  <dougkwan@google.com>
5889
5890         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5891         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5892         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5893         formatting.
5894         (Arm_relocate_functions::thm_call): Replace body with a call to
5895         Arm_relocate_functions::thumb_branch_common.
5896         (Arm_relocate_functions::thm_jump24,
5897         Arm_relocate_functions::thm_xpc22): New method definitions.
5898         (Arm_relocate_functions::thumb_branch_common): New method definition.
5899         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5900         operator.
5901         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5902         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5903
5904 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5905
5906         * Makefile.am: Build incremental-dump
5907         * Makefile.in: Regenerate.
5908         * incremental-dump.cc: New.
5909         * incremental.cc (Incremental_inputs_header_data,
5910         Incremental_inputs_entry_data): Move to incremental.h
5911         * incremental.h: (Incremental_inputs_header_data,
5912         Incremental_inputs_entry_data): Move from incremental.cc
5913
5914 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5915
5916         * incremental.cc (Incremental_inputs_header,
5917         Incremental_inputs_header_write, Incremental_inputs_entry,
5918         Incremental_inputs_entry_write): Add a typedef with the data type.
5919
5920 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5921
5922         * incremental.cc (Incremental_inputs_header,
5923         Incremental_inputs_header_write, Incremental_inputs_entry,
5924         Incremental_inputs_entry_write): Update comment about which
5925         type has the filed descriptions.
5926
5927 2009-11-15  Doug Kwan  <dougkwan@google.com>
5928
5929         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5930         (Arm_relocate_functions::arm_branch_common): Change method defintion
5931         in class definition to a method declaration and update list of formal
5932         parameters.
5933         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5934         Arm_relocation_functions::jump24): Adjust call to
5935         Arm_relocate_functions::arm_branch_common.  Update list of formal
5936         parameters.
5937         (Arm_relocate_functions::xpc25): New method definition.
5938         (Arm_relocate_functions::arm_branch_common): Move method defintion
5939         out from class definition.  Use stubs for mode-switching and extending
5940         branch ranges.
5941         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5942         specially.  Change code to enable use of stubs in ARM branches.
5943
5944 2009-11-10  Doug Kwan  <dougkwan@google.com>
5945
5946         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5947         in method declaration.
5948         (Target_arm::relocate_stub): New method declaration.
5949         (Target_arm::default_target): Change to return a pointer instead of
5950         a const reference.
5951         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5952         Target_arm::default_target.
5953         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5954         method definition.
5955         (Target_arm::relocate_section): Adjust view.
5956         (Target_arm::relocate_stub): New method definition.
5957
5958 2009-11-10  Doug Kwan  <dougkwan@google.com>
5959
5960         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5961         a format warning.
5962         * incremental.cc (open_incremental_binary): Initialized local
5963         variables to avoid warnings.
5964         * object.cc (make_elf_object): Ditto.
5965         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5966         a format warning.
5967
5968 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5969
5970         PR gold/10930
5971         * testsuite/plugin_test.c: Include "config.h".
5972
5973 2009-11-09  Doug Kwan  <dougkwan@google.com>
5974
5975         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5976         (arm_symbol_value): Remove.
5977         (Arm_relocate_functions::arm_branch_common,
5978         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5979         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5980         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5981         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5982         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5983         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5984         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5985         Arm_relocate_functions::thm_mobw_abs_nc,
5986         Arm_relocate_functions::thm_mov_abs,
5987         Arm_relocate_functions::movw_prel_nc,
5988         Arm_relocate_functions::thm_movt_abs,
5989         Arm_relocate_functions::movt_prel,
5990         Arm_relocate_functions::thm_movw_prel_nc,
5991         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5992         (Target_arm::Relocate::relocate): Only decompose address into two
5993         parts if relocation type uses the thumb-bit and pass the actual
5994         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5995         calls to methods in Arm_relocate_functions for this change.
5996
5997 2009-11-08  Ian Lance Taylor  <iant@google.com>
5998
5999         PR 10925
6000         * reloc.cc: Instantiate
6001         Sized_relobj::initialize_input_to_output_maps and
6002         Sized_relobj:free_input_to_output_maps.
6003
6004 2009-11-06  Ian Lance Taylor  <iant@google.com>
6005
6006         PR 10876
6007         * defstd.cc (in_segment): Set only_if_ref true for "end".
6008
6009 2009-11-06  Doug Kwan  <dougkwan@google.com>
6010
6011         * arm.cc (class Reloc_stub): Correct a comment.
6012         (Target_arm::Target_arm): Initialize arm_input_section_map_.
6013         (Target_arm::scan_section_for_stubs): New method declaration.
6014         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6015         Change methods from private to protected.
6016         (Target_arm::do_may_relax): New method definition.
6017         (Target_arm::do_relax, Target_arm::group_sections,
6018         Target_arm::scan_reloc_for_stub,
6019         Target_arm::scan_reloc_section_for_stubs): New method declarations.
6020         (Target_arm::arm_input_section_map_): New data member declaration.
6021         (Target_arm::scan_reloc_for_stub,
6022         Target_arm::scan_reloc_section_for_stubs,
6023         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6024         Target_arm::do_relax): New method definitions.
6025
6026 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
6027
6028         * configure.ac: Check for (struct stat)::st_mtim
6029         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6030         * config.in: Regenerate.
6031         * configure: Regenerate.
6032
6033 2009-11-05  Ian Lance Taylor  <iant@google.com>
6034
6035         PR 10910
6036         * output.cc (Output_segment::add_output_section): Add missing
6037         return statement.
6038
6039 2009-11-04  Ian Lance Taylor  <iant@google.com>
6040
6041         PR 10880
6042         * object.h (class Object): Add is_needed and set_is_needed
6043         methods.  Add is_needed_ field.  Make bool fields into bitfields.
6044         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6045         defined in a dynamic object and referenced by a regular object,
6046         set is_needed for the dynamic object.
6047         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6048         if the file is marked with as_needed and it is not needed.
6049
6050 2009-11-04  Ian Lance Taylor  <iant@google.com>
6051
6052         PR 10887
6053         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6054         tags if data is discarded by linker script.
6055         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6056         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6057         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6058         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6059
6060 2009-11-04  Ian Lance Taylor  <iant@google.com>
6061
6062         * layout.cc (Layout::get_output_section): Add is_interp and
6063         is_dynamic_linker_section parameters.  Change all callers.
6064         (Layout::choose_output_section): Likewise.
6065         (Layout::make_output_section): Likewise.
6066         (Layout::add_output_section_data): Add is_dynamic_linker_section
6067         parameter.  Change all callers.
6068         * layout.h (class Layout): Update declarations.
6069         * output.h (class Output_section): Add is_interp, set_is_interp,
6070         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6071         Add is_interp_, is_dynamic_linker_section_ fields.  Change
6072         generate_code_fills_at_write_ to a bitfield.
6073         * output.cc (Output_section::Output_sections): Initialize new
6074         fields.
6075         (Output_segment::add_output_section): Add do_sort parameter.
6076         Change all callers.
6077
6078 2009-11-03  Ian Lance Taylor  <iant@google.com>
6079
6080         PR 10860
6081         * options.h (class General_options): Add --warn-common.
6082         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6083         merging two common symbols.
6084         (Symbol_table::should_override): Handle --warn-common when merging
6085         a common symbol with a defined symbol.  Use report_resolve_problem
6086         for multiple definitions.
6087         (Symbol_table::report_resolve_problem): New function.
6088         * symtab.h (class Symbol_table): Declare report_resolve_problem.
6089
6090 2009-11-03  Doug Kwan  <dougkwan@google.com>
6091
6092         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6093         stub_factory_.
6094         (Target_arm::stub_factory): New method definition.
6095         (Target_arm::new_arm_input_section,
6096         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6097         Target_arm::reloc_uses_thumb_bit): New method declarations.
6098         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6099         New type definitions.
6100         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6101         member declarations.
6102         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6103         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6104         New method definitions.
6105
6106 2009-11-03  Ian Lance Taylor  <iant@google.com>
6107
6108         * options.h (class General_options): Add --warn_constructors.
6109
6110 2009-11-03  Ian Lance Taylor  <iant@google.com>
6111
6112         PR 10893
6113         * defstd.cc (in_section): Add entries for __rel_iplt_start,
6114         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6115
6116 2009-11-03  Ian Lance Taylor  <iant@google.com>
6117
6118         PR 10895
6119         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6120         --msgid-bugs-address.
6121         (install-pdf): New target.
6122         (install-data_yes): Look up one directory to find mkinstalldirs.
6123
6124 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6125
6126         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6127         tree.
6128
6129 2009-10-30  Doug Kwan  <dougkwan@google.com>
6130
6131         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6132
6133 2009-10-30  Doug Kwan  <dougkwan@google.com>
6134
6135         * arm.cc (Stub_addend_reader): New struct template definition
6136         and partial specializations.
6137         (Stub_addend_reader::operator()): New method definition for a
6138         partially specialized template.
6139
6140 2009-10-30  Doug Kwan  <dougkwan@google.com>
6141
6142         * arm.cc (Arm_relobj::processor_specific_flags): New method
6143         definition.
6144         (Arm_relobj::do_read_symbols): New method declaration.
6145         (Arm_relobj::processor_specific_flags_): New data member declaration.
6146         (Arm_dynobj): New class definition.
6147         (Target_arm::do_finalize_sections): Add input_objects parameter.
6148         (Target_arm::do_adjust_elf_header): New method declaration.
6149         (Target_arm::are_eabi_versions_compatible,
6150         (Target_arm::merge_processor_specific_flags): New method declaration.
6151         (Target_arm::do_make_elf_object): New overloaded method definitions
6152         and declaration.
6153         (Arm_relobj::do_read_symbols): New method definition.
6154         (Arm_dynobj::do_read_symbols): Ditto.
6155         (Target_arm::do_finalize_sections): Add input_objects parameters.
6156         Merge processor-specific flags from all input objects.
6157         (Target_arm::are_eabi_versions_compatible,
6158         Target_arm::merge_processor_specific_flags,
6159         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6160         New method definitions.
6161         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6162         Input_objects pointer type parameter.
6163         * layout.cc (Layout::finalize): Pass input objects to target's.
6164         finalize_sections function.
6165         * output.cc (Output_file_header::do_sized_write): Set ELF file
6166         header's processor-specific flags.
6167         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6168         Input_objects pointer type parameter.
6169         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6170         * target.h (Input_objects): New forward class declaration.
6171         (Target::processor_specific_flags,
6172         Target::are_processor_specific_flags_sect): New method definitions.
6173         (Target::finalize_sections): Add input_objects parameter.
6174         (Target::Target): Initialize processor_specific_flags_ and
6175         are_processor_specific_flags_set_.
6176         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6177         parameter.
6178         (Target::set_processor_specific_flags): New method definition.
6179         (Target::processor_specific_flags_,
6180         Target::are_processor_specific_flags_set_): New data member
6181         declarations.
6182         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6183         Input_objects pointer type parameter.
6184
6185 2009-10-30  Doug Kwan  <dougkwan@google.com>
6186
6187         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6188
6189 2009-10-28  Ian Lance Taylor  <iant@google.com>
6190
6191         * object.h (class Relobj): Drop options parameter from
6192         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6193         do_scan_relocs, do_relocate.  Change all callers.
6194         (class Sized_relobj): Drop options parameters from
6195         do_gc_process_relocs, do_scan_relocs, do_relocate,
6196         do_relocate_sections, relocate_sections, emit_relocs_scan,
6197         emit_relocs_scan_reltype.  Change all callers.
6198         (struct Relocate_info): Remove options field and all references to
6199         it.
6200         * reloc.h (class Read_relocs): Remove options constructor
6201         parameter and options_ field.  Change all callers.
6202         (class Gc_process_relocs, class Scan_relocs): Likewise.
6203         (class Relocate_task): Likewise.
6204         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6205         all callers.
6206         (scan_relocatable_relocs): Likewise.
6207         * target.h (class Sized_target): Remove options parameter from
6208         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6209         all callers.
6210         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6211         callers.
6212         * arm.cc: Update functions to remove options parameters.
6213         * i386.cc: Likewise.
6214         * powerpc.cc: Likewise.
6215         * sparc.cc: Likewise.
6216         * x86_64.cc: Likewise.
6217         * testsuite/testfile.cc: Likewise.
6218
6219 2009-10-28  Doug Kwan  <dougkwan@google.com>
6220
6221         * arm.cc (Arm_relobj): New class definition.
6222         (Arm_relobj::scan_sections_for_stubs,
6223         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6224         New method definitions.
6225
6226 2009-10-28  Cary Coutant  <ccoutant@google.com>
6227
6228         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6229         (Plugin::cleanup_done_): New member.
6230         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6231         (Plugin_manager::cleanup_done_): Remove.
6232         (Plugin_manager::add_input_file): Edit error message.
6233         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6234         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6235
6236 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6237
6238         * fileread.cc: (File_read::View::~View): Use the new
6239         data_ownership_ filed.
6240         (File_read::~File_read): Dispose the new whole_file_view_.
6241         (File_read::open): Mmap the whole file if needed.
6242         (File_read::open): Use whole_file_view_ instead of contents_.
6243         (File_read::find_view): Use whole_file_view_ if applicable.
6244         (File_read::do_read): Use whole_file_view_ instead of contents_.
6245         (File_read::make_view): Use whole_file_view_ instead of contents_,
6246         update File_read::View::View call.
6247         (File_read::find_or_make_view): Update File_read::View::View
6248         call.
6249         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6250         remove contents_
6251         (File_read::View::Data_ownership): New enum.
6252         (File_read::View::View): Replace bool mapped_ with Data_ownership
6253         argument.
6254         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6255         (File_read::View::data_ownership_): New field.
6256         (File_read::contents_): Remove (replaced by whole_file_view_).
6257         (File_read::whole_file_view_): New field.
6258         * options.h (class General_options): Add --keep-files-mapped.
6259
6260 2009-10-27  Cary Coutant  <ccoutant@google.com>
6261
6262         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6263         * testsuite/Makefile.am (plugin_test_5): New test case.
6264         * testsuite/Makefile.in: Regenerate.
6265
6266 2009-10-25  Doug Kwan  <dougkwan@google.com>
6267
6268         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6269         from private to protected to allow access by child class.
6270         (Sized_relobj::do_relocate_sections): New method declaration.
6271         (Sized_relobj::relocate_sections): Virtualize.
6272         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6273         Sized_relobj::relocate_sections.  Instantiate template explicitly
6274         for different target sizes and endianity.
6275
6276 2009-10-24  Doug Kwan  <dougkwan@google.com>
6277
6278         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6279         (Arm_input_section::as_arm_input_section): New method.
6280         (Arm_output_section): New class definition.
6281         (Arm_output_section::create_stub_group,
6282         Arm_output_section::group_sections): New method definitions.
6283
6284 2009-10-22  Doug Kwan  <dougkwan@google.com>
6285
6286         * arm.cc (Arm_input_section): New class definition.
6287         (Arm_input_section::init, Arm_input_section:do_write,
6288         Arm_input_section::set_final_data_size,
6289         Arm_input_section::do_reset_address_and_file_offset): New method
6290         definitions.
6291
6292 2009-10-21  Doug Kwan  <dougkwan@google.com>
6293
6294         * arm.cc (Stub_table, Arm_input_section): New forward class
6295         declarations.
6296         (Stub_table): New class defintion.
6297         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6298         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6299         New method definition.
6300
6301 2009-10-21  Doug Kwan  <dougkwan@google.com>
6302
6303         * arm.cc: Update copyright comments.
6304         (Target_arm): New forward class template declaration.
6305         (Arm_address): New type.
6306         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6307         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6308         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6309         constants.
6310         (Insn_template): Same.
6311         (DEF_STUBS): New macro.
6312         (Stub_type): New enum type.
6313         (Stub_template): New class definition.
6314         (Stub): Same.
6315         (Reloc_stub): Same.
6316         (Stub_factory): Same.
6317         (Target_arm::Target_arm): Initialize may_use_blx_ and
6318         should_force_pic_veneer_.
6319         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6320         Target_arm::should_force_pic_veneer,
6321         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6322         Target_arm::using_thumb_only, Target_arm:;default_target): New
6323         method defintions.
6324         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6325         New data member declarations.
6326         (Insn_template::size, Insn_template::alignment): New method defintions.
6327         (Stub_template::Stub_template): New method definition.
6328         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6329         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6330         (Stub_factory::Stub_factory): New method definition.
6331         * gold.h (string_hash): New template.
6332         * output.h (Input_section_specifier::hash_value): Use
6333         gold::string_hash.
6334         (Input_section_specifier::string_hash): Remove.
6335         * stringpool.cc (Stringpool_template::string_hash): Use
6336         gold::string_hash.
6337
6338 2009-10-20  Doug Kwan  <dougkwan@google.com>
6339
6340         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6341         symbols of relaxed input sections.
6342         * output.h (Output_section::find_relaxed_input_section): Make
6343         method public.
6344
6345 2009-10-16  Doug Kwan  <dougkwan@google.com>
6346
6347         * dynobj.cc (Versions::Versions): Initialize version_script_.
6348         Only insert base version symbol definition for a shared object
6349         if version script defines any version versions.
6350         (Versions::define_base_version): New method definition.
6351         (Versions::add_def): Check that base version is not needed.
6352         (Versions::add_need): Define base version lazily.
6353         * dynobj.h (Versions::define_base_version): New method declaration.
6354         (Versions::needs_base_version_): New data member declaration.
6355         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6356         (check_DATA): Add no_version_test.stdout.
6357         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6358         New make rules.
6359         * testsuite/Makefile.in: Regenerate.
6360         * testsuite/no_version_test.c: New file.
6361         * testsuite/no_version_test.sh: Ditto.
6362
6363 2009-10-16  Doug Kwan  <dougkwan@google.com>
6364
6365         * expression.cc (class Segment_start_expression): New class definition.
6366         (Segment_start_expression::value): New method definition.
6367         (script_exp_function_segment_start): Return a new
6368         Segment_start_expression.
6369         * gold/script-c.h (script_saw_segment_start_expression): New function
6370         prototype.
6371         * script-sections.cc (Script_sections::Script_sections): Initialize
6372         SAW_SEGMENT_START_EXPRESSION_ to false.
6373         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6374         and -Tbbs options to specify section addresses if given in
6375         command line and no SEGMENT_START expression is seen in a script.
6376         * script-sections.h (Script_sections::saw_segment_start_expression,
6377         Script_sections::set_saw_segment_start_expression): New method
6378         definition.
6379         (Script_sections::saw_segment_start_expression_): New data member
6380         declaration.
6381         * script.cc (script_saw_segment_start_expression): New function.
6382         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6383         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6384         script_test_7.sh and script_test_8.sh.
6385         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6386         script_test_8.stdout.
6387         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6388         (script_test_6, script_test_6.stdout, script_test_7,
6389         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6390         * Makefile.in: Regenerate.
6391         * testsuite/script_test_6.sh: New file.
6392         * testsuite/script_test_6.t: Same.
6393         * testsuite/script_test_7.sh: Same.
6394         * testsuite/script_test_7.t: Same.
6395         * testsuite/script_test_8.sh: Same.
6396
6397 2009-10-16  Doug Kwan  <dougkwan@google.com>
6398
6399         * output.cc (Output_segment::set_section_list_address): Cast
6400         expressions to unsigned long long type to avoid format warnings.
6401
6402 2009-10-15  Ian Lance Taylor  <iant@google.com>
6403
6404         * script.cc (Script_options::add_symbol_assignment): Always add a
6405         dot assignment to script_sections_.
6406         * script-sections.cc (Script_sections::add_dot_assignment):
6407         Initialize if necessary.
6408
6409         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6410         program headers with no load segment if there is a linker script.
6411
6412         * layout.cc (Layout::set_segment_offsets): Align the file offset
6413         to the segment aligment for -N or -n with no load segment.
6414         * output.cc (Output_segment::add_output_section): Don't crash if
6415         the first section is a TLS section.
6416         (Output_segment::set_section_list_addresses): Print an error
6417         message if the address moves backward in a linker script.
6418         * script-sections.cc
6419         (Output_section_element_input::set_section_addresses): Don't
6420         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6421         (Orphan_output_section::set_section_addresses): Likewise.
6422
6423 2009-10-15  Doug Kwan  <dougkwan@google.com>
6424
6425         * layout.cc (Layout::finish_dynamic_section): Generate tags
6426         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6427         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6428         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6429
6430 2009-10-14  Ian Lance Taylor  <iant@google.com>
6431
6432         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6433         fields.
6434         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6435         data_shdr fields of relinfo.
6436         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6437         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6438         R_386_TLS_LDO_32, adjust based on section flags.
6439         (Target_i386::Relocate::fix_up_ldo): Remove.
6440
6441 2009-10-13  Ian Lance Taylor  <iant@google.com>
6442
6443         Add support for -pie.
6444         * options.h (class General_options): Add -pie and
6445         --pic-executable.
6446         (General_options::output_is_position_independent): Test -pie.
6447         (General_options::output_is_executable): Return true if not shared
6448         and not relocatable.
6449         (General_options::output_is_pie): Remove.
6450         * options.cc (General_options::finalize): Reject incompatible uses
6451         of -pie.
6452         * gold.cc (queue_middle_tasks): A -pie link is not static.
6453         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6454         * symtab.cc (Symbol::final_value_is_known): Return false if
6455         output_is_position_independent.
6456         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6457         output_is_position_independent.
6458         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6459         output_is_position_independent.
6460         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6461         output_is_position_independent.
6462         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6463         two_file_pie_test.
6464         (basic_pie_test.o, basic_pie_test): New targets.
6465         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6466         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6467         (two_file_pie_test): New target.
6468         * testsuite/Makefile.in: Rebuild.
6469         * README: Remove note saying that -pie is not supported.
6470
6471 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6472
6473         * options.h (class General_options): Add -init and -fini.
6474         * layout.cc (Layout::finish_dynamic_section): Emit
6475         given init and fini functions.
6476
6477 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6478
6479         * gc.h (gc_process_relocs): Check if icf is enabled using new
6480         function.
6481         * gold.cc (queue_initial_tasks): Likewise.
6482         (queue_middle_tasks): Likewise.
6483         * object.cc (do_layout): Likewise.
6484         * symtab.cc (is_section_folded): Likewise.
6485         * main.cc (main): Likewise.
6486         * reloc.cc (Read_relocs::run): Likewise.
6487         (Sized_relobj::do_scan_relocs): Likewise.
6488         * icf.cc (is_function_ctor_or_dtor): New function.
6489         (Icf::find_identical_sections): Check if function is ctor or dtor when
6490         safe icf is chosen.
6491         * options.h (General_options::icf): Change option to be an enum.
6492         (Icf_status): New enum.
6493         (icf_enabled): New method.
6494         (icf_safe_folding): New method.
6495         (set_icf_status): New method.
6496         (icf_status_): New variable.
6497         * (options.cc) (General_options::finalize): Set icf_status_.
6498         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6499         icf_test and icf_keep_unique_test to use the --icf enum flag.
6500         * testsuite/icf_safe_test.sh: New file.
6501         * testsuite/icf_safe_test.cc: New file.
6502
6503 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6504
6505         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6506         includes to gc.h and icf.h.
6507         * arm.cc: Include gc.h.
6508         * gold.cc: Likewise.
6509         * i386.cc: Likewise.
6510         * powerpc.cc: Likewise.
6511         * sparc.cc: Likewise.
6512         * x86_64.cc: Likewise.
6513         * gc.h: Include icf.h.
6514
6515 2009-10-11  Ian Lance Taylor  <iant@google.com>
6516
6517         * plugin.cc: Include "gold.h" before other header files.
6518
6519 2009-10-10  Chris Demetriou  <cgd@google.com>
6520
6521         * options.h (Input_file_argument::Input_file_type): New enum.
6522         (Input_file_argument::is_lib_): Replace with...
6523         (Input_file_argument::type_): New member.
6524         (Input_file_argument::Input_file_argument): Take Input_file_type
6525         'type' rather than boolean 'is_lib' as second argument.
6526         (Input_file_argument::is_lib): Use type_.
6527         (Input_file_argument::is_searched_file): New function.
6528         (Input_file_argument::may_need_search): Handle is_searched_file.
6529         * options.cc (General_options::parse_library): Support -l:filename.
6530         (General_options::parse_just_symbols): Update for Input_file_argument
6531         changes.
6532         (Command_line::process): Likewise.
6533         * archive.cc (Archive::get_file_and_offset): Likewise.
6534         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6535         * script.cc (read_script_file, script_add_file): Likewise.
6536         * fileread.cc (Input_file::Input_file): Likewise.
6537         (Input_file::will_search_for): Handle is_searched_file.
6538         (Input_file::open): Likewise.
6539         * readsyms.cc (Read_symbols::get_name): Likewise.
6540         * testsuite/Makefile.am (searched_file_test): New test.
6541         * testsuite/Makefile.in: Regenerate.
6542         * testsuite/searched_file_test.cc: New file.
6543         * testsuite/searched_file_test_lib.cc: New file.
6544
6545 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6546             Ian Lance Taylor  <iant@google.com>
6547
6548         * descriptor.cc: Include <cstdio> and "binary-io.h".
6549         (Descriptors::open): Open the files in binary mode always.
6550         * script.cc (Lex::get_token): Treat \r as whitespace.
6551
6552 2009-10-09  Ian Lance Taylor  <iant@google.com>
6553
6554         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6555
6556 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6557             Ian Lance Taylor  <iant@google.com>
6558
6559         * configure.ac: Check for readv function also.
6560         * fileread.cc (readv): Define if not HAVE_READV.
6561         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6562         does not exist.
6563         * config.in: Regenerate.
6564         * configure: Regenerate.
6565
6566 2009-10-09  Doug Kwan  <dougkwan@google.com>
6567
6568         * layout.cc (Layout::make_output_section): Call target hook to make
6569         ordinary output section.
6570         (Layout::finalize): Adjust parameter list of call the
6571         Target::may_relax().
6572         * layout.h (class Layout::section_list): New method.
6573         * merge.h (Output_merge_base::entsize): Change visibility to public.
6574         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6575         New methods.
6576         (Output_merge_string::do_is_string): New method.
6577         * object.cc (Sized_relobj::do_setup): renamed from
6578         Sized_relobj::set_up.
6579         * object.h (Sized_relobj::adjust_shndx,
6580         Sized_relobj::initializ_input_to_output_maps,
6581         Sized_relobj::free_input_to_output_maps): Change visibilities to
6582         protected.
6583         (Sized_relobj::setup): Virtualize.
6584         (Sized_relobj::do_setup): New method declaration.
6585         (Sized_relobj::invalidate_section_offset,
6586         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6587         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6588         * options.cc (parse_int): New function.
6589         * options.h (parse_int): New declaration.
6590         (DEFINE_int): New macro.
6591         (stub_group_size): New option.
6592         * output.cc (Output_section::Output_section): Initialize memebers
6593         merge_section_map_, merge_section_by_properties_map_,
6594         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6595         (Output_section::add_input_section): Handled deferred code-fill
6596         generation and remove an old comment.
6597         (Output_section::add_relaxed_input_section): New method definition.
6598         (Output_section::add_merge_input_section): Use merge section by
6599         properties map to speed to search.  Update merge section maps
6600         as appropriate.
6601         (Output_section::build_relaxation_map): New method definition.
6602         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6603         Same.
6604         (Output_section::relax_input_section): Renamed to
6605         Output_section::convert_input_sections_to_relaxed_sections and change
6606         interface to take a vector of pointers to relaxed sections.
6607         (Output_section::find_merge_section,
6608         Output_section::find_relaxed_input_section): New method definitions.
6609         (Output_section::is_input_address_mapped,
6610         Output_section::output_offset, Output_section::output_address):
6611         Use output section data maps to speed up searching.
6612         (Output_section::find_starting_output_address): Add comments.
6613         (Output_section::do_write,
6614         Output_section::write_to_postprocessing_buffer): Do code-fill
6615         generation as appropriate.
6616         (Output_section::get_input_sections): Invalidate relaxed input section
6617         map.
6618         (Output_section::restore_states): Adjust type of checkpoint .
6619         Invalidate relaxed input section map.
6620         * output.h (Output_merge_base): New class declaration.
6621         (Input_section_specifier): New class defintion.
6622         (class Output_relaxed_input_section) Change base class to
6623         Output_section_data_build.
6624         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6625         base class initializer.
6626         (Output_section::add_relaxed_input_section): New method declaration.
6627         (Output_section::Input_section): Change visibility to protected.
6628         (Output_section::Input_section::relobj,
6629         Output_section::Input_section::shndx): Handle relaxed input sections.
6630         Output_section::input_sections) Change visibility to protected.  Also
6631         define overload to return a non-const pointer.
6632         (Output_section::Merge_section_properties): New class defintion.
6633         (Output_section::Merge_section_by_properties_map,
6634         Output_section::Output_section_data_by_input_section_map,
6635         Output_section::Relaxation_map): New types.
6636         (Output_section::relax_input_section): Rename method to
6637         Output_section::convert_input_sections_to_relaxed_sections and change
6638         interface to take a vector of relaxed section pointers.
6639         (Output_section::find_merge_section,
6640         Output_section::find_relaxed_input_section,
6641         Output_section::build_relaxation_map,
6642         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6643         New method declarations.
6644         (Output_section::merge_section_map_
6645         Output_section::merge_section_by_properties_map_,
6646         Output_section::relaxed_input_section_map_,
6647         Output_section::is_relaxed_input_section_map_valid_,
6648         Output_section::generate_code_fills_at_write_): New data members.
6649         * script-sections.cc
6650         (Output_section_element_input::set_section_addresses): Call
6651         current_data_size and addralign methods of relaxed input sections.
6652         (Orphan_output_section::set_section_addresses): Call current_data_size
6653         and addralign methods of relaxed input sections.
6654         * symtab.cc (Symbol_table::compute_final_value): Extract template
6655         from the body of Symbol_table::sized_finalize_symbol.
6656         (Symbol_table::sized_finalized_symbol): Call
6657         Symbol_table::compute_final_value.
6658         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6659         (Symbol_table::compute_final_value): New templated method declaration.
6660         * target.cc (Target::do_make_output_section): New method defintion.
6661         * target.h (Target::make_output_section): New method declaration.
6662         (Target::relax): Add more parameters for input objects, symbol table
6663         and layout.  Adjust call to do_relax.
6664         (Target::do_make_output_section): New method declaration.
6665         (Target::do_relax): Add parameters for input objects, symbol table
6666         and layout.
6667
6668 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6669
6670         * pread.c: Include stdio.h.
6671
6672 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6673
6674         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6675         defined.
6676
6677 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6678
6679         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6680         Change read_shndx type to unsigned int.
6681         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6682         int.
6683         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6684         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6685         Change read_shndx type to unsigned int.
6686         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6687         int.
6688         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6689         * layout.cc (Layout::create_symtab_sections): Cast the result of
6690         local_symcount * symsize to off_t in the gold_assert.
6691
6692 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6693
6694         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6695         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6696         R_ARM_BASE_ABS.
6697         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6698         (Arm_relocate_functions::thm_abs5): New function.
6699         (Arm_relocate_functions::abs12): New function.
6700         (Arm_relocate_functions::abs16): New function.
6701         (Arm_relocate_functions::base_abs): New function.
6702         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6703         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6704         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6705         R_ARM_BASE_ABS.
6706         (Scan::global): Likewise.
6707         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6708         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6709         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6710         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6711         R_ARM_BASE_ABS.
6712
6713 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6714
6715         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6716         (Arm_relocate_functions::movt_prel): New function.
6717         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6718         (Arm_relocate_functions::thm_movt_prel): New function.
6719         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6720         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6721         (Scan::global, Relocate::relocate): Likewise.
6722         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6723
6724 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6725
6726         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6727         Incremental_checker.
6728         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6729         unsigned int.
6730         (class Incremental_inputs_header): New class.
6731         (Incremental_inputs_header_writer): Edit comment.
6732         (Incremental_inputs_entry): New class.
6733         (Incremental_inputs_entry_writer): Edit comment.
6734         (Sized_incremental_binary::do_find_incremental_inputs_section):
6735         Add *strtab_shndx parameter, fill it.
6736         (Sized_incremental_binary::do_check_inputs): New method.
6737         (Incremental_checker::can_incrementally_link_output_file): Use
6738         Sized_incremental_binary::check_inputs.
6739         (Incremental_inputs::report_command_line): Save command line in
6740         command_line_.
6741         * incremental.h:
6742         (Incremental_binary::find_incremental_inputs_section): New
6743         method.
6744         (Incremental_binary::do_find_incremental_inputs_section): Add
6745         strtab_shndx parameter.
6746         (Incremental_binary::do_check_inputs): New pure virtual method.
6747         (Sized_incremental_binary::do_check_inputs): Declare.
6748         (Incremental_checker::Incremental_checker): Add incremental_inputs
6749         parameter, use it to initialize incremental_inputs_.
6750         (Incremental_checker::incremental_inputs_): New field.
6751         (Incremental_checker::command_line): New method.
6752         (Incremental_checker::inputs): New method.
6753         (Incremental_checker::command_line_): New field.
6754
6755 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6756
6757         * incremental.cc: Include <cstdarg> and "target-select.h".
6758         (vexplain_no_incremental): New function.
6759         (explain_no_incremental): New function.
6760         (Incremental_binary::error): New method.
6761         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6762         method.
6763         (make_sized_incremental_binary): New function.
6764         (open_incremental_binary): New function.
6765         (can_incrementally_link_file): Add checks if output is ELF and has
6766         inputs section.
6767         * incremental.h: Include "elfcpp_file.h" and "output.h".
6768         (Incremental_binary): New class.
6769         (Sized_incremental_binary): New class.
6770         (open_incremental_binary): Declare.
6771         * object.cc (is_elf_object): Use
6772         elfcpp::Elf_recognizer::is_elf_file.
6773         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6774         * output.h (Output_file::filesize): New method.
6775
6776 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6777
6778         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6779         New function.
6780         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6781         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6782         function.
6783         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6784         function.
6785         (Arm_relocate_functions::movw_abs_nc): New function.
6786         (Arm_relocate_functions::movt_abs): New function.
6787         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6788         (Arm_relocate_functions::thm_movt_abs): New function.
6789         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6790         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6791         (Scan::global): Likewise.
6792         (Relocate::relocate): Likewise.
6793         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6794
6795 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6796
6797         * arm.cc (Arm_relocate_functions::got_prel) New function.
6798         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6799         (Relocate::relocate): Likewise.
6800         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6801
6802 2009-10-06  Ian Lance Taylor  <iant@google.com>
6803
6804         * options.h (class General_options): Define
6805         split_stack_adjust_size parameter.
6806         * object.h (class Object): Add uses_split_stack_ and
6807         has_no_split_stack_ fields.  Add uses_split_stack and
6808         has_no_split_stack accessor functions.  Declare
6809         handle_split_stack_section.
6810         (class Reloc_symbol_changes): Define.
6811         (class Sized_relobj): Define Function_offsets.  Declare
6812         split_stack_adjust, split_stack_adjust_reltype, and
6813         find_functions.
6814         * object.cc (Object::handle_split_stack_section): New function.
6815         (Sized_relobj::do_layout): Call handle_split_stack_section.
6816         * dynobj.cc (Sized_dynobj::do_layout): Call
6817         handle_split_stack_section.
6818         * reloc.cc (Sized_relobj::relocate_sections): Call
6819         split_stack_adjust for executable sections in split_stack
6820         objects.  Pass reloc_map to relocate_section.
6821         (Sized_relobj::split_stack_adjust): New function.
6822         (Sized_relobj::split_stack_adjust_reltype): New function.
6823         (Sized_relobj::find_functions): New function.
6824         * target-reloc.h: Include "object.h".
6825         (relocate_section): Add reloc_symbol_changes parameter.  Change
6826         all callers.
6827         * target.h (class Target): Add calls_non_split method.  Declare
6828         do_calls_non_split virtual method.  Declare match_view and
6829         set_view_to_nop.
6830         * target.cc: Include "elfcpp.h".
6831         (Target::do_calls_non_split): New function.
6832         (Target::match_view): New function.
6833         (Target::set_view_to_nop): New function.
6834         * gold.cc (queue_middle_tasks): Give an error if mixing
6835         split-stack and non-split-stack objects with -r.
6836         * i386.cc (Target_i386::relocate_section): Add
6837         reloc_symbol_changes parameter.
6838         (Target_i386::do_calls_non_split): New function.
6839         * x86_64.cc (Target_x86_64::relocate_section): Add
6840         reloc_symbol_changes parameter.
6841         (Target_x86_64::do_calls_non_split): New function.
6842         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6843         parameter.
6844         * powerpc.cc (Target_powerpc::relocate_section): Add
6845         reloc_symbol_changes parameter.
6846         * sparc.cc (Target_sparc::relocate_section): Add
6847         reloc_symbol_changes parameter.
6848         * configure.ac: Call AM_CONDITIONAL for the default target.
6849         * configure: Rebuild.
6850         * testsuite/Makefile.am (TEST_AS): New variable.
6851         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6852         (check_DATA): Add split_i386 and split_x86_64 files.
6853         (SPLIT_DEFSYMS): Define.
6854         (split_i386_[1234n].o): New targets.
6855         (split_i386_[124]): New targets.
6856         (split_i386_[1234r].stdout): New targets.
6857         (split_x86_64_[1234n].o): New targets.
6858         (split_x86_64_[124]): New targets.
6859         (split_x86_64_[1234r].stdout): New targets.
6860         (MOSTLYCLEANFILES): Add new executables.
6861         * testsuite/split_i386.sh: New file.
6862         * testsuite/split_x86_64.sh: New file.
6863         * testsuite/split_i386_1.s: New file.
6864         * testsuite/split_i386_2.s: New file.
6865         * testsuite/split_i386_3.s: New file.
6866         * testsuite/split_i386_4.s: New file.
6867         * testsuite/split_i386_n.s: New file.
6868         * testsuite/split_x86_64_1.s: New file.
6869         * testsuite/split_x86_64_2.s: New file.
6870         * testsuite/split_x86_64_3.s: New file.
6871         * testsuite/split_x86_64_4.s: New file.
6872         * testsuite/split_x86_64_n.s: New file.
6873         * testsuite/testfile.cc (Target_test): Update relocation_section
6874         function.
6875         * testsuite/Makefile.in: Rebuild.
6876
6877 2009-10-06  Ian Lance Taylor  <iant@google.com>
6878
6879         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6880         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6881         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6882         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6883         the address on ldo_addrs_.
6884         (Target_i386::Relocate::fix_up_ldo): New function.
6885
6886 2009-10-06   Rafael Espindola  <espindola@google.com>
6887
6888         * plugin.cc (add_input_library): New.
6889         (Plugin::load): Add add_input_library to tv.
6890         (Plugin_manager::add_input_file): Add the is_lib argument.
6891         (add_input_file): Update call to Plugin_manager::add_input_file.
6892         (add_input_library): New.
6893         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6894
6895 2009-09-30  Doug Kwan  <dougkwan@google.com>
6896
6897         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6898         symbol and call Symbol::may_need_copy_reloc to determine if
6899         a copy reloc is needed.
6900         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6901         nocopyreloc is given in command line.
6902         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6903         given in command line.
6904         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6905         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6906         of the removed Target_i386::may_need_copy_reloc.
6907         * options.h (copyreloc): New option with default value false.
6908         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6909         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6910         instead of the removed Target_powerpc::may_need_copy_reloc.
6911         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6912         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6913         instead of the removed Target_sparc::may_need_copy_reloc.
6914         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6915         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6916         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6917         instead of the removed Target_x86_64::may_need_copy_reloc.
6918
6919 2009-09-30  Ian Lance Taylor  <iant@google.com>
6920
6921         * object.h (class Object): Remove target_ field, and target,
6922         sized_target, and set_target methods.
6923         (Object::sized_target): Remove.
6924         (class Sized_relobj): Update declarations.  Remove sized_target.
6925         * object.cc (Sized_relobj::setup): Remove target parameter.
6926         Change all callers.
6927         (Input_objects::add_object): Don't do anything with the target.
6928         (make_elf_sized_object): Add punconfigured parameter.  Change all
6929         callers.  Set or test parameter target.
6930         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6931         Change all callers.
6932         * parameters.cc (Parameters::set_target): Change parameter type to
6933         be non-const.
6934         (Parameters::default_target): Remove.
6935         (set_parameters_target): Change parameter type to be non-const.
6936         (parameters_force_valid_target): New function.
6937         (parameters_clear_target): New function.
6938         * parameters.h (class Parameters): Update declarations.  Remove
6939         default_target method.  Add sized_target and clear_target
6940         methods.  Change target_ to be non-const.
6941         (set_parameters_target): Update declaration.
6942         (parameters_force_valid_target): Declare.
6943         (parameters_clear_target): Declare.
6944         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6945         as NULL if we aren't searching.
6946         (Add_symbols::run): Don't check for compatible target.
6947         * fileread.cc (Input_file::open_binary): Call
6948         parameters_force_valid_target.
6949         * gold.cc (queue_middle_tasks): Likewise.
6950         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6951         set_target on object.
6952         * dynobj.h (class Sized_dynobj): Update declarations.
6953         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6954         make_elf_object returns NULL.
6955         (Archive::include_member): Don't check whether object target is
6956         compatible.
6957         * output.cc (Output_section::add_input_section): Get target from
6958         parameters.
6959         (Output_section::relax_input_section): Likewise.
6960         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6961         parameters.
6962         (Sized_relobj::do_scan_relocs): Likewise.
6963         (Sized_relobj::relocate_sections): Likewise.
6964         * resolve.cc (Symbol_table::resolve): Likewise.
6965         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6966         parameter.  Change all callers.
6967         (Symbol_table::add_from_object): Get target from parameters.
6968         (Symbol_table::add_from_relobj): Don't check object target.
6969         (Symbol_table::add_from_dynobj): Likewise.
6970         (Symbol_table::define_special_symbol): Get target from
6971         parameters.
6972         * symtab.h (class Symbol_table): Update declaration.
6973         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6974         parameter.  Change all callers.  Clear parameter target.
6975         (Binary_test): Test target here.
6976         * testsuite/object_unittest.cc (gold_testsuite): Remove
6977         target_test_pointer parameter.  Change all callers.
6978         (Object_test): Test target here.
6979
6980 2009-09-26  Ian Lance Taylor  <iant@google.com>
6981
6982         * testsuite/initpri1.c: Don't try to use constructor priorities if
6983         compiling with gcc before 4.3.
6984
6985 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6986
6987         * testsuite/retain_symbols_file_test.sh (check_present): Change
6988         output file name to retain_symbols_file_test.stdout.
6989         (check_absent): Likewise.
6990
6991 2009-09-18  Craig Silverstein  <csilvers@google.com>
6992
6993         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6994         * options.cc: Include <cerrno> and <fstream>.
6995         (General_options::finalize): Parse -retain-symbols-file tag.
6996         * options.h: New flag.
6997         (General_options): New method should_retain_symbol, new
6998         variable symbols_to_retain.
6999         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7000         should_retain_symbol map.
7001         * testsuite/Makefile.am (retain_symbols_file_test): New test.
7002         * testsuite/Makefile.in: Regenerate.
7003         * testsuite/retain_symbols_file_test.sh: New file.
7004
7005 2009-09-18  Nick Clifton  <nickc@redhat.com>
7006
7007         * po/es.po: Updated Spanish translation.
7008
7009 2009-09-17  Doug Kwan  <dougkwan@google.com>
7010
7011         * debug.h (DEBUG_RELAXATION): New constant.
7012         (DEBUG_ALL): Add DEBUG_RELAXATION.
7013         (debug_string_to_enum): Add relaxation debug option.
7014         * layout.cc
7015         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7016         Layout::Relaxation_debug_check::read_sections,
7017         Layout::Relaxation_debug_check::read_sections): New method definitions.
7018         (Layout::Layout): Initialize data members
7019         record_output_section_data_from_scrips_,
7020         script_output_section_data_list_ and relaxation_debug_check_.
7021         (Layout::save_segments, Layout::restore_segments,
7022         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7023         Layout::relaxation_loop_body): New method definitions.
7024         (Layout::finalize): Support relaxation.  Move section layout code to
7025         Layout::relaxation_loop_body.
7026         (Layout::set_asection_address_from_script): Move code for orphan
7027         section placement out.
7028         (Layout::place_orphan_sections_in_script): New method definition.
7029         * layout.h (Output_segment_headers, Output_file_header):
7030         New forward class declarations.
7031         (Layout::~Layout): Define.
7032         (Layout::new_output_section_data_from_script): New method definition.
7033         (Layout::place_orphan_sections_in_script): New method declaration.
7034         (Layout::Segment_states): New type declaration.
7035         (Layout::save_segments, Layout::restore_segments,
7036         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7037         Layout::relaxation_loop_body): New method declarations.
7038         (Layout::Output_section_data_list): New type declaration.
7039         (Layout::Relaxation_debug_check): New class definition.
7040         (Layout::record_output_section_data_from_script_,
7041         Layout::script_output_section_data_list_, Layout::segment_states_,
7042         Layout::relaxation_debug_check_): New data members.
7043         * output.cc: (Output_section_headers::do_size): New method definition.
7044         (Output_section_headers::Output_section_headers): Move size
7045         computation to Output_section_headers::do_size.
7046         (Output_segment_headers::do_size): New method definition.
7047         (Output_file_header::Output_file_header): Move size computation to
7048         Output_file_header::do_size and call it.
7049         (Output_file_header::do_size): New method definition.
7050         (Output_data_group::Output_data_group): Adjust call to
7051         Output_section_data.
7052         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7053         (Output_symtab_xindex::do_write): Add array bound check.
7054         (Output_section::Input_section::print_to_mapfile): Handle
7055         RELAXED_INPUT_SECTION_CODE.
7056         (Output_section::Output_section): Initialize data member checkpoint_.
7057         (Output_section::~Output_section): Delete checkpoint object pointed
7058         by checkpoint_.
7059         (Output_section::add_input_section): Always add an Input_section if
7060         relaxing.
7061         (Output_section::add_merge_input_section): Add assert.
7062         (Output_section::relax_input_section): New method definition.
7063         (Output_section::set_final_data_size): Set load address to zero for
7064         an unallocated section.
7065         (Output_section::do_address_and_file_offset_have_reset_values):
7066         New method definition.
7067         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7068         Handle relaxed input section.
7069         (Output_section::sort_attached_input_sections): Checkpoint input
7070         section list lazily.
7071         (Output_section::get_input_sections): Change type of input_sections to
7072         list of Simple_input_section pointers.  Checkpoint input section list
7073         lazily.  Also handle relaxed input sections.
7074         (Output_section::add_input_section_for_script): Take a reference to
7075         a Simple_input_section object instead of Relobj pointer and section
7076         index as parameter.  Handle relaxed input sections.
7077         (Output_section::save_states, Output_section::restore_states): New
7078         method definitions.
7079         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7080         (Output_data::is_data_size_fixed): New method definition.
7081         (Output_data::reset_addresss_and_file_offset): Do not reset data size
7082         if it is fixed.
7083         (Output_data::address_and_file_offset_have_reset_values): New method
7084         definition.
7085         (Output_data::do_address_and_file_offset_have_reset_values): New method
7086         definition.
7087         (Output_data::set_data_size): Check that data size is not fixed.
7088         (Output_data::fix_data_size): New method definition.
7089         (Output_data::is_data_size_fixed_): New data member.
7090         (Output_section_headers::set_final_data_size): New method definition.
7091         (Output_section_headers::do_size): New method declaration.
7092         (Output_segment_headers::set_final_data_size): New method definition.
7093         (Output_segment_headers::do_size): New method declaration.
7094         (Output_file_header::set_final_data_size)::New method definition.
7095         (Output_file_header::do_size)::New method declaration.
7096         (Output_section_data::Output_section_data): Add new parameter
7097         is_data_size_fixed and use it to fix data size.
7098         (Output_data_const::Output_data_const): Adjust call to base class
7099         constructor and fix data size.
7100         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7101         base class constructor and fix data size.
7102         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7103         base class constructor and fix data size.
7104         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7105         class constructor and fix data size.
7106         (Output_data_group::set_final_data_size): New method definition.
7107         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7108         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7109         class constructor and fix data size.
7110         (Output_relaxed_input_section): New class definition.
7111         (Output_section::Simple_input_section): New class definition.
7112         (Output_section::get_input_sections): Adjust parameter list.
7113         (Output_section::add_input_section_for_script): Same.
7114         (Output_section::save_states, Output_section::restore_states,
7115         Output_section::do_address_and_file_offset_have_reset_values,
7116         (Output_section::Input_section::Input_section): Handle
7117         RELAXED_INPUT_SECTION_CODE.  Add new overload for
7118         Output_relaxed_input_section.
7119         (Output_section::Input_section::is_input_section,
7120         Output_section::Input_section::set_output_section): Handle relaxed
7121         input section.
7122         (Output_section::Input_section::is_relaxed_input_section,
7123         Output_section::Input_section::output_section_data,
7124         Output_section::Input_section::relaxed_input_section): New method
7125         definitions.
7126         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7127         value.
7128         (Output_section::Input_section::u1_): Update comments.
7129         (Output_section::Input_section::u2_): Add new union member poris.
7130         (Output_section::Checkpoint_output_section): New classs definition.
7131         (Output_section::relax_input_section): New method declaration.
7132         (Output_section::checkpoint_): New data member.
7133         (Output_segment): Update comments.
7134         (Output_segment::Output_segment): Un-privatize copy constructor.
7135         (Output_segment::operator=): Un-privatize.
7136         * script-sections.cc (Output_section_element::Input_section_list):
7137         Change element type to Output_section::Simple_input_section.
7138         (Output_section_element_dot_assignment::set_section_addresses):
7139         Register output section data for relaxation clean up.
7140         (Output_data_exression::Output_data_expression): Adjust call to base
7141         constructor to fix data size.
7142         (Output_section_element_data::set_section_addresses): Register
7143         Output_data_expression object for relaxation clean up.
7144         (struct Input_section_info): Replace Relobj pointer and section index
7145         pair with Output_section::Simple_input_section and Convert struct to a
7146         class.
7147         (Input_section_sorter::operator()): Adjust access to
7148         Input_section_info data member to use accessors.
7149         (Output_section_element_input::set_section_addresses): Use layout
7150         parameter.  Adjust code to use Output_section::Simple_input_section
7151         and Input_secction_info classes.  Register filler for relaxation
7152         clean up.
7153         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7154         and section index pair with Output_section::Simple_input_section
7155         class.  Adjust code accordingly.
7156         (Phdrs_element::release_segment): New method definition.
7157         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7158         segment list.
7159         (Script_sections::release_segments): New method definition.
7160         * gold/script-sections.h (Script_sections::release_segments): New
7161         method declaration.
7162         * gold/target.h (Target::may_relax, Target::relax,
7163         Target::do_may_relax, Target::do_relax): New method definitions.
7164
7165 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7166
7167         * arm.cc (has_signed_unsigned_overflow): New function.
7168         (Arm_relocate_functions::abs8): New function.
7169         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7170         (Target_arm::Scan::global): Likewise.
7171         (Target_arm::relocate::relocate): Likewise.
7172         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7173         Likewise.
7174
7175 2009-09-16  Cary Coutant  <ccoutant@google.com>
7176
7177         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7178         * testsuite/Makefile.in: Regenerate.
7179
7180 2009-09-11  Nick Clifton  <nickc@redhat.com>
7181
7182         * po/gold.pot: Updated by the Translation project.
7183
7184 2009-09-08  Cary Coutant  <ccoutant@google.com>
7185
7186         * output.cc (Output_file::open): Add execute permission to empty file.
7187         * testsuite/Makefile.am (permission_test): New test.
7188         * testsuite/Makefile.in: Regenerate.
7189
7190 2009-09-02  Ian Lance Taylor  <iant@google.com>
7191
7192         * output.cc (Output_file::resize): Call map_no_anonymous rather
7193         than map.
7194
7195 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7196
7197         * gold.cc: Include "incremental.h".
7198         (queue_initial_tasks): Call Incremental_checker methods.
7199         * incremental.cc: Include "output.h".
7200         (Incremental_checker::can_incrementally_link_output_file): New
7201         method.
7202         * incremental.h (Incremental_checker): New class.
7203
7204         * output.cc (Output_file::open_for_modification): New method.
7205         (Output_file::map_anonymous): Changed return type to bool.  Record
7206         map in base_ field.
7207         (Output_file::map_no_anonymous): New method, broken out of map.
7208         (Output_file::map): Use map_no_anonymous and map_anonymous.
7209         * output.h (class Output_file): Update declarations.
7210
7211 2009-08-24  Cary Coutant  <ccoutant@google.com>
7212
7213         * options.h (Command_line::Pre_options): New class.
7214         (Command_line::pre_options): New member.
7215         * options.cc (gold::options::ready_to_register): New variable.
7216         (One_option::register_option): Do nothing if not registering options.
7217         Assert if same short option registered twice.
7218         (General_options::General_options): Turn off option registration when
7219         done constructing.
7220         (Command_line::Pre_options::Pre_options): New constructor.
7221
7222 2009-08-24  Cary Coutant  <ccoutant@google.com>
7223
7224         * options.h (General_options::no_keep_memory): Remove incorrect
7225         short option.
7226
7227 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7228
7229         * Makefile.am (am__skiplex, am__skipyacc): New.
7230         * Makefile.in: Regenerate.
7231
7232 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7233
7234         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7235         (INCLUDES): ... this.
7236         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7237         (AM_CPPFLAGS): Renamed from ...
7238         (INCLUDE): ... this.
7239         * Makefile.in, testsuite/Makefile.in: Regenerate.
7240
7241         * Makefile.in: Regenerate.
7242         * aclocal.m4: Likewise.
7243         * config.in: Likewise.
7244         * configure: Likewise.
7245         * testsuite/Makefile.in: Likewise.
7246
7247         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7248         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7249         * Makefile.in: Regenerate.
7250         * testsuite/Makefile.in: Regenerate.
7251
7252 2009-08-19  Cary Coutant  <ccoutant@google.com>
7253
7254         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7255         symbols in shared libraries overridden by hidden or internal symbols
7256         in the main program.
7257
7258 2009-08-19  Chris Demetriou  <cgd@google.com>
7259
7260         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7261         checking source file names in error messages.
7262
7263 2009-08-18  Doug Kwan  <dougkwan@google.com>
7264
7265         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7266         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7267         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7268         an elfcpp::Ehdr as parameter.
7269         * object.cc (Object::set_target): Remove the version that looks up
7270         a target and sets it.
7271         (Sized_relobj::setup): Take a Target object instead of
7272         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7273         (make_elf_sized_object): Find target and ask target to
7274         make an ELF object.
7275         * object.h: (Object::set_target): Remove the version that looks up
7276         a target and sets it.
7277         (Sized_relobj::setup): Take a Target object instead of
7278         an elfcpp:Ehdr as parameter.
7279         * target.cc: Include dynobj.h.
7280         (Target::do_make_elf_object_implementation): New.
7281         (Target::do_make_elf_object): New.
7282         * target.h (Target::make_elf_object): New template declaration.
7283         (Target::do_make_elf_object): New method declarations.
7284         (Target::do_make_elf_object_implementation): New template declaration.
7285
7286 2009-08-14  Ian Lance Taylor  <iant@google.com>
7287
7288         * gold.h (FUNCTION_NAME): Define.
7289         (gold_unreachable): Use FUNCTION_NAME.
7290
7291 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7292
7293         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7294         symbol in the --keep-unique list is not found.
7295
7296 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7297
7298         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7299         been maked as --keep-unique.
7300         (Icf::unfold_section): New function.
7301         * icf.h (Icf::unfold_section): New function.
7302         * options.h (General_options::keep_unique): New option.
7303         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7304         * testsuite/Makefile.in: Regenerate.
7305         * testsuite/icf_keep_unique_test.sh: New file.
7306         * testsuite/icf_keep_unique_test.cc: New file.
7307
7308 2009-08-12  Cary Coutant  <ccoutant@google.com>
7309
7310         PR 10471
7311         * resolve.cc (Symbol_table::resolve): Check for references from
7312         dynamic objects to hidden and internal symbols.
7313         * testsuite/Makefile.am (hidden_test.sh): New test.
7314         * testsuite/Makefile.in: Regenerate.
7315         * testsuite/hidden_test.sh: New script.
7316         * testsuite/hidden_test_1.c: New test source.
7317         * testsuite/hidden_test_main.c: New test source.
7318
7319 2009-08-11  Doug Kwan  <dougkwan@google.com>
7320
7321         * arm.cc: Update comments.
7322         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7323         segment to locate the .ARM.exidx section if present.
7324
7325 2009-08-09  Doug Kwan  <dougkwan@google.com>
7326
7327         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7328         patch.
7329
7330 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7331         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7332         compiler warnings.
7333
7334 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7335
7336         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7337         valid tls_segment only for non-debug-section relocations.
7338         * testsuite/Makefile.am: Add gc_tls_test.
7339         * testsuite/Makefile.in: Regenerate.
7340         * testsuite/gc_tls_test.cc: New file.
7341         * testsuite/gc_tls_test.sh: New file.
7342
7343 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7344
7345         * icf.cc: New file.
7346         * icf.h: New file.
7347         * Makefile.am (CCFILES): Add icf.cc.
7348         (HFILES): Add icf.h
7349         * Makefile.in: Regenerate.
7350         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7351         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7352         section, symbol and addend information for the relocs.
7353         * gold.cc (queue_middle_tasks): Call identical code folding.
7354         * gold.h: Add defines for multimap.
7355         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7356         to the call of finalize_local_symbols.
7357         * main.cc (main): Create object of class Icf.
7358         * object.cc (Sized_relobj::do_layout): Allow this function to be
7359         called twice during icf.
7360         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7361         to sections marked as identical by icf.
7362         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7363         when available.
7364         (Sized_relobj::do_section_entsize): New function.
7365         * object.h (Object::section_entsize): New function.
7366         (Object::do_section_entsize): New pure virtual function.
7367         (Relobj::finalize_local_symbols): Add new parameter.
7368         (Relobj::do_section_entsize): New function.
7369         * options.h (General_options::icf): New option.
7370         (General_options::icf_iterations): New option.
7371         (General_options::print_icf_sections): New option.
7372         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7373         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7374         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7375         icf.
7376         * symtab.cc (Symbol_table::is_section_folded): New function.
7377         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7378         to sections marked as identical by icf.
7379         * symtab.h (Symbol_table::set_icf): New function.
7380         (Symbol_table::icf): New function.
7381         (Symbol_table::is_section_folded): New function.
7382         (Symbol_table::icf_): New data member.
7383         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7384         * testsuite/Makefile.am: Add commands to build icf_test.
7385         * testsuite/Makefile.in: Regenerate.
7386         * testsuite/icf_test.sh: New file.
7387         * testsuite/icf_test.cc: New file.
7388
7389 2009-07-24  Chris Demetriou  <cgd@google.com>
7390
7391         * layout.cc (is_compressible_debug_section): Fix incorrect
7392         comment about compressed section names.
7393
7394 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7395
7396         PR 10419
7397         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7398
7399 2009-07-16  Ian Lance Taylor  <iant@google.com>
7400
7401         PR 10400
7402         * layout.h: #include <map>.
7403         (class Kept_section): Change from struct to class.  Add accessors
7404         and setters.  Add section size to Comdat_group mapping.  Change
7405         Comdat_group to std::map.  Add is_comdat_ field.  Add
7406         linkonce_size field in union.
7407         (class Layout): Update declaration of find_or_add_kept_section.
7408         Don't declare find_kept_object.
7409         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7410         parameter.  Add object, shndx, is_comdat, and is_group_name
7411         parameters.  Change all callers.  Adjust for new Kept_section.
7412         (Layout::find_kept_object): Remove.
7413         * object.cc (Sized_relobj::include_section_group): Update use of
7414         Kept_section.  Rename secnum to shndx.  Only record
7415         Kept_comdat_section if sections are the same size.
7416         (Sized_relobj::include_linkonce_section): Update use of
7417         Kept_section.  Only record Kept_comdat_section if sections are the
7418         same size.  Set size of linkonce section.
7419         (Sized_relobj::map_to_kept_section): Update call to
7420         get_kept_comdat_section.
7421         * object.h (class Sized_relobj): Rename fields in
7422         Kept_comdat_section to drop trailing underscores; change object
7423         field to Relobj*.  Change Kept_comdat_section_table to store
7424         struct rather than pointer.
7425         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7426         Add kept_object and kept_shndx parameters.  Change all callers.
7427         (Sized_relobj::get_kept_comdat_section): Change return type to
7428         bool.  Add kept_object and kept_shndx parameters.  Change all
7429         callers.
7430         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7431         Layout::find_or_add_kept_section.
7432
7433 2009-07-09  Ian Lance Taylor  <iant@google.com>
7434
7435         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7436         Reserve space in the hash table.
7437
7438 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7439
7440         * fileread.cc (File_read::get_mtime): New method.
7441         * fileread.h (Timespec): New structure.
7442         (File_read::get_mtime): New method.
7443         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7444         Renamed from timestamp_nsec.
7445         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7446         Elf_Xword.
7447         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7448         timestamp_nsec.
7449         (Incremental_inputs::report_archive): Save mtime; style fix.
7450         (Incremental_inputs::report_obejct): Save mtime; style fix.
7451         (Incremental_inputs::report_script): Save mtime; style fix.
7452         (Incremental_inputs::finalize_inputs): Style fix.
7453         (Incremental_inputs::finalize): Style fix.
7454         (Incremental_inputs::create_input_section_data): Store inputs
7455         mtime.
7456         * incremental.h (Incremental_inputs::report_script): Add mtime
7457         argument.
7458         (Incremental_inputs::Input_info::Input_info): Intialize only one
7459         union member.
7460         (Incremental_inputs::Input_info::archive): Move to nameless
7461         union.
7462         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7463         (Incremental_inputs::Input_info::script): Move to nameless union.
7464         (Incremental_inputs::mtime): New field.
7465         * script.cc (read_input_script): Pass file mtime to
7466         Incremental_input.
7467         * script.h (Script_info::inputs): Style fix.
7468
7469 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7470
7471         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7472         instead of 32.
7473
7474 2009-06-24  Ian Lance Taylor  <iant@google.com>
7475
7476         PR 10156
7477         * layout.cc (Layout::choose_output_section): If we find an
7478         existing section, update the flags.
7479         (Layout::create_notes): New function, broken out of
7480         Layout::finalize.
7481         (Layout::finalize): Don't create note sections.
7482         (Layout::create_note): Don't crash if linker script discards
7483         section.
7484         (Layout::create_gold_note): Likewise.
7485         (Layout::create_build_id): Likewise.  Don't set
7486         after_input_sections on the section.
7487         (Layout::create_executable_stack_info): Remove target parameter.
7488         Change caller.
7489         * layout.h (class Layout): Declare create_notes.  Update
7490         declaration of create_executable_stack_info.
7491         * gold.cc (queue_middle_tasks): Call create_notes.
7492         * output.cc (Output_section::update_flags_for_input_section): Move
7493         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7494         invalid.
7495         * output.h (Output_data::mark_address_invalid): New function.
7496         (class Output_section): Only declare, not define,
7497         update_flags_for_input_section.  Remove set_flags.
7498
7499 2009-06-24  Ian Lance Taylor  <iant@google.com>
7500
7501         * script-sections.cc (Output_section_definition::
7502         set_section_addresses): Rename shadowing local load_address to
7503         laddr.
7504
7505 2009-06-24  Ian Lance Taylor  <iant@google.com>
7506
7507         PR 10244
7508         * reloc.cc (relocate_sections): Skip empty relocation sections.
7509
7510 2009-06-23  Ian Lance Taylor  <iant@google.com>
7511
7512         PR 10156
7513         * layout.cc (Layout::create_note): Use choose_output_section
7514         rather than make_output_section.
7515
7516 2009-06-23  Ian Lance Taylor  <iant@google.com>
7517
7518         PR 10237
7519         * options.cc (General_options::parse_V): Set printed_version_.
7520         (General_options::General_options): Initialize printed_version_.
7521         * options.h (class General_options): Add printed_version_ field.
7522         * gold.cc (queue_initial_tasks): If there are no input files,
7523         don't give a fatal error if we printed the version information.
7524         (queue_middle_tasks): If using -r with a shared object, give a
7525         fatal error rather than an ordinary error.
7526
7527 2009-06-23  Ian Lance Taylor  <iant@google.com>
7528
7529         PR 10219
7530         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7531         (Layout::make_output_section): Set have_stabstr_section_ if we see
7532         a .stab*str section.
7533         (Layout::finalize): Call link_stabs_sections.
7534         (Layout::link_stabs_sections): New file.
7535         * layout.h (class Layout): Add have_stabstr_section_ field.
7536         Declare link_stabs_sections.
7537
7538 2009-06-23  Doug Kwan  <dougkwan@google.com>
7539
7540         * Makefile.am (libgold_a_LIBADD): New.
7541         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7542         * Makefile.in: Regenerate.
7543         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7544         * configure: Regenerate.
7545         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7546         * fileread.cc: Include sys/state.h
7547         * gold.h: Declare memmem and strndup if found missing.
7548         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7549
7550 2009-06-23  Ian Lance Taylor  <iant@google.com>
7551
7552         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7553         * configure: Rebuild.
7554
7555 2009-06-23  Ian Lance Taylor  <iant@google.com>
7556
7557         PR 10147
7558         * object.cc (Object::section_contents): Don't try to get a view if
7559         the section has length zero.
7560         (Object::handle_gnu_warning_section): If the section is empty, use
7561         the name of the section as the warning.
7562
7563 2009-06-23  Ian Lance Taylor  <iant@google.com>
7564
7565         PR 10133
7566         * stringpool.h (class Stringpool_template): Add optimize_ field.
7567         (Stringpool_template::set_optimize): New function.
7568         * stringpool.cc (Stringpool_template::Stringpool_template):
7569         Initialize optimize_ field.
7570         (Stringpool_template::set_string_offsets): Test local optimize
7571         fild rather than parameter.
7572         * layout.cc (Layout::Layout): Call set_optimize on the section
7573         name stringpool.
7574
7575 2009-06-22  Ian Lance Taylor  <iant@google.com>
7576
7577         PR 10030
7578         * yyscript.y: Parse TARGET.
7579         * script.cc (script_set_target): New function.
7580         * script-c.h (script_set_target): Declare.
7581         * options.cc (General_options::string_to_object_format): Rename
7582         from string_to_object_format in anonymous namespace.  Change
7583         callers.
7584         * options.h (class General_options): Declare
7585         string_to_object_format.
7586
7587 2009-06-22  Ian Lance Taylor  <iant@google.com>
7588
7589         * script-sections.cc (Script_sections::create_segments): Don't put
7590         program headers in a PT_LOAD segment if -n or -N.
7591
7592 2009-06-22  Ian Lance Taylor  <iant@google.com>
7593
7594         PR 10141
7595         * options.h (class General_options): Add -z lazy and -z now.  Sort
7596         -z options into alphabetical order.
7597         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7598
7599 2009-06-21  Ian Lance Taylor  <iant@google.com>
7600
7601         * layout.cc (Layout::make_output_section): Call
7602         Target::new_output_section.
7603         (Layout::attach_allocated_section_to_segment): Put large section
7604         sections in a separate load segment with the large segment flag
7605         set.
7606         (Layout::segment_precedes): Sort large data segments after other
7607         load segments.
7608         (align_file_offset): New static function.
7609         (Layout::set_segment_offsets): Use align_file_offset.
7610         * output.h (class Output_section): Add is_small_section_ and
7611         is_large_section_ fields.
7612         (Output_section::is_small_section): New function.
7613         (Output_section::set_is_small_section):  New function.
7614         (Output_section::is_large_section): New function.
7615         (Output_section::set_is_large_section): New function.
7616         (Output_section::is_large_data_section): New function.
7617         (class Output_segment): Add is_large_data_segment_ field.
7618         (Output_segment::is_large_data_segment): New function.
7619         (Output_segment::set_is_large_data_segment): New function.
7620         * output.cc (Output_section::Output_section): Initialize new
7621         fields.
7622         (Output_segment::Output_segment): Likewise.
7623         (Output_segment::add_output_section): Add assertion that large
7624         data sections always go in large data segments.  Force small data
7625         sections to the end of the list of data sections.  Force small BSS
7626         sections to the start of the list of BSS sections.  For large BSS
7627         sections to the end of the list of BSS sections.
7628         * symtab.h (class Symbol): Declare is_common_shndx.
7629         (Symbol::is_defined): Check Symbol::is_common_shndx.
7630         (Symbol::is_common): Likewise.
7631         (class Symbol_table): Define enum Commons_section_type.  Update
7632         declarations.  Add small_commons_ and large_commons_ fields.
7633         * symtab.cc (Symbol::is_common_shndx): New function.
7634         (Symbol_table::Symbol_table): Initialize new fields.
7635         (Symbol_table::add_from_object): Put small and large common
7636         symbols in the right list.
7637         (Symbol_table::sized_finalized_symbol): Check
7638         Symbol::is_common_shndx.
7639         (Symbol_table::sized_write_globals): Likewise.
7640         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7641         common symbol lists.  Don't call do_allocate_commons_list if the
7642         list is empty.
7643         (Symbol_table::do_allocate_commons_list): Remove is_tls
7644         parameter.  Add comons_section_type parameter.  Change all
7645         callers.  Handle small and large common symbols.
7646         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7647         Symbol::is_common_shndx.
7648         * resolve.cc (symbol_to_bits): Likewise.
7649         * target.h (Target::small_common_shndx): New function.
7650         (Target::small_common_section_flags): New function.
7651         (Target::large_common_shndx): New function.
7652         (Target::large_common_section_flags): New function.
7653         (Target::new_output_section): New function.
7654         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7655         small_common_section_flags, and large_common_section_flags
7656         fields.
7657         (Target::do_new_output_section): New virtual function.
7658         * arm.cc (Target_arm::arm_info): Initialize new fields.
7659         * i386.cc (Target_i386::i386_info): Likewise.
7660         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7661         Likewise.
7662         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7663         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7664         (Target_x86_64::do_new_output_section): New function.
7665         * configure.ac: Define conditional MCMODEL_MEDIUM.
7666         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7667         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7668         (large_LDFLAGS): Define.
7669         * testsuite/large.c: New file.
7670         * testsuite/testfile.cc (Target_test::test_target_info):
7671         Initialize new fields.
7672         * configure, testsuite/Makefile.in: Rebuild.
7673
7674 2009-06-05  Doug Kwan  <dougkwan@google.com>
7675
7676         * Makefile.am (CCFILES): Add target.cc.
7677         * Makefile.in: Regenerate.
7678         * i386.cc (class Target_i386): Define new virtual method to
7679         override do_is_local_label_name in parent.
7680         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7681         local symbols if --discard-locals or -X is given.
7682         * options.h (class General_options): Declare new options
7683         '--discard-locals' and '-X' for discarding locals.
7684         * target.h (class Target): Define new methods is_local_label_name.
7685         Declare new virtual method do_is_local_label_name.
7686         * target.cc: New file.
7687         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7688         (check_SCRIPTS): Add discard_locals_test.sh.
7689         (check_DATA): Add discard_local_tests.syms.
7690         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7691         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7692         * testsuite/Makefile.in: Regenerate.
7693         * testsuite/discard_locals_test.c: New file.
7694         * testsuite/discard_locals_test.sh: Same.
7695
7696 2009-06-05  Doug Kwan  <dougkwan@google.com>
7697
7698         * object.cc (Sized_relobj::Sized_relobj): Initialize
7699         discarded_eh_frame_shndx_ to -1U.
7700         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7701         section.
7702         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7703         a discarded .eh_frame section.
7704         (Sized_relobj::do_finalize_local_symbols): Ditto.
7705         * object.h (class Sized_relobj): Declare new member
7706         discarded_eh_frame_shndx_.
7707         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7708         (local_labels_test.o, local_labels_test): New rules.
7709         * testsuite/Makefile.in: Regenerate.
7710
7711 2009-06-04  Doug Kwan  <dougkwan@google.com>
7712
7713         * layout.cc (Layout::section_name_mapping): Add mapping for
7714         special ARM sections.
7715
7716 2009-06-03  Doug Kwan  <dougkwan@google.com>
7717
7718         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7719         (utils::has_overflow): Same.
7720
7721 2009-06-03  Ian Lance Taylor  <iant@google.com>
7722
7723         * layout.cc (Layout::section_name_mapping): New array, replacing
7724         Layout::linkonce_mapping.
7725         (Layout::section_name_mapping_count): New variable, replacing
7726         Layout::linkonce_mapping_count.
7727         (Layout::linkonce_output_name): Remove.
7728         (Layout::output_section_name): Rewrite.
7729         * layout.h (class Layout): Rename Linkonce_mapping to
7730         Section_name_mapping, linkonce_mapping to section_name_mapping,
7731         linkonce_mapping_count to section_name_mapping_count.  Don't
7732         declare linkonce_output_name.
7733
7734 2009-06-03  Doug Kwan  <dougkwan@google.com>
7735
7736         * gold/arm.cc (namespace utils): New.
7737         (Target_arm::reloc_is_non_pic): Define new method.
7738         (class Arm_relocate_functions): New.
7739         (Target_arm::Relocate::relocate): Handle relocation types used by
7740         Android.
7741
7742 2009-06-03  Ian Lance Taylor  <iant@google.com>
7743
7744         * arm.cc (Target_arm::scan::global): Use || instead of |.
7745
7746 2009-06-02  Doug Kwan  <dougkwan@google.com>
7747
7748         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7749         issued_non_pic_error_.
7750         (class Target_arm::Scan): Declare new method check_non_pic.
7751         Define new method symbol_needs_plt_entry.
7752         Declare new data member issued_non_pic_error_.
7753         (class Target_arm::Relocate): Declare new method
7754         should_apply_static_reloc.
7755         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7756         (Target_arm::Scan::check_non_pic): Define new method.
7757         (Target_arm::Scan::local): Handle a small subset of reloc types used
7758         by Android.
7759         (Target_arm::Scan::local): Same.
7760         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7761
7762 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7763
7764         * incremental.cc (Incremental_inputs::report_command_line): Filter
7765         out --incremental-* options.
7766
7767 2009-05-29  Doug Kwan  <dougkwan@google.com>
7768
7769         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7770         template class.
7771         (class Target_arm): Update comment.
7772         (Target_arm::Target_arm): Initialize new data members GOT_,
7773         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7774         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7775         and Target_arm::rel_dyn_section.
7776         Declare new_enum Target_arm::Got_type.
7777         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7778         and DYNBSS_.
7779         Update commments for member do_dynsym_value.
7780         (Target_arm::got_size, Target_arm::plt_section,
7781         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7782         new methods inside class defintion.
7783         (Target_arm::got_section): Define new method.
7784         (Target_arm::rel_dyn_section): Same.
7785         (Output_data_plt_arm): New template class.
7786         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7787         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7788         (Output_data_plt_arm::add_entry): Same.
7789         (Output_data_plt_arm::first_plt_entry): Define new
7790         static data member for PLT instruction template.
7791         (Output_data_plt_arm::plt_entry): Same.
7792         (Output_data_plt_arm::do_write): Define new method.
7793         (Target_arm::make_plt_entry): Same.
7794         (Target_arm::do_finalize_sections): Same.
7795         (Target_arm::do_dynsym_value): Same.
7796
7797 2009-05-28  Doug Kwan  <dougkwan@google.com>
7798
7799         * Makefile.am (TARGETSOURCES): Add arm.cc.
7800         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7801         * Makefile.in: Regenerate.
7802         * arm.cc: New file.
7803         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7804
7805 2009-05-26  Doug Kwan  <dougkwan@google.com>
7806
7807         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7808         (General_options::check_excluded_libs): Strip off directories in
7809         archive name before matching like GNU ld does.
7810         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7811         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7812         (exclude_libs_test_LDFLAGS): Add linker option
7813         -Wl,--exclude-libs,libexclude_libs_test_3
7814         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7815         an explicit archive without using -l.
7816         (alt/libexclude_libs_test_3.a): New make rule.
7817         * testsuite/Makefile.in: Regenerate.
7818         * testsuite/exclude_libs_test.c : Declare lib3_default().
7819         (main): Call it.
7820         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7821         * exclude_libs_test_3.c: New file.
7822
7823 2009-05-26  Nick Clifton  <nickc@redhat.com>
7824
7825         * po/id.po: New Indonesian translation.
7826         * po/gold.pot: Updated template file.
7827
7828 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7829
7830         * testsuite/Makefile.am: Add -ffunction-sections to compile
7831         gc_comdat_test files.  Add -Wl,--gc-sections to build
7832         gc_comdat_test.
7833         * testsuite/Makefile.in: Regenerate.
7834         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7835
7836 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7837
7838         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7839         kept comdat section was garbage collected.
7840         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7841         * testsuite/Makefile.in: Regenerate.
7842         * testsuite/gc_comdat_test.sh: New file.
7843         * testsuite/gc_comdat_test_1.cc: New file.
7844         * testsuite/gc_comdat_test_2.cc: New file.
7845
7846 2009-05-19  Doug Kwan  <dougkwan@google.com>
7847
7848         * archive.cc (Archive::Archive): Move constructor from archive.h
7849         to here.  Initialize no_export_.
7850         (Archive::get_elf_object_for_member): Set no_export flag of object.
7851         * archive.h (Archive::Archive): Move constructor body to
7852         archive.cc.
7853         (Archive::no_export): New method.
7854         (Archive::no_export_): New field.
7855         * object.h (Object::Object): Initialize no_export_ to false.
7856         (Object::no_export, Object::set_no_export): New methods.
7857         (Object::no_export_): New field.
7858         * options.cc (General_options::parse_exclude_libs): New method.
7859         (General_options::check_excluded_libs) Same.
7860         * options.h (exclude_libs): New option.
7861         (General_options::check_excluded_libs): New method declaration.
7862         (General_options::excluded_libs_): New field.
7863         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7864         default or protected visibility if an object has no-export flag set.
7865         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7866         (check_SCRIPTS): Add exclude_libs_test.sh.
7867         (check_DATA): Add exclude_libs_test.syms.
7868         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7869         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7870         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7871         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7872         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7873         libexclude_libs_test_2.a): New rules.
7874         * testsuite/Makefile.in: Regenerate.
7875         * testsuite/exclude_libs_test.c: New file.
7876         * testsuite/exclude_libs_test.sh: Ditto.
7877         * testsuite/exclude_libs_test_1.c: Ditto.
7878         * testsuite/exclude_libs_test_2.c: Ditto.
7879
7880 2009-05-15  Ian Lance Taylor  <iant@google.com>
7881
7882         * configure.ac: Check for declarations for cases where libiberty.h
7883         checks HAVE_DECL_xxx.
7884         * configure, config.in: Rebuild.
7885
7886 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7887
7888         * gold.h (Incremental_argument_list): Remove (invalid) forward
7889         declaration.
7890         * incremental.cc (Incremental_inputs::report_achive): New method.
7891         (Incremental_inputs::report_object): New method.
7892         (Incremental_inputs::report_script): New method.
7893         (Incremental_inputs::finalize_inputs): New method.
7894         (Incremental_inputs::finalize): Call finalize_inputs().
7895         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7896         Create inputs entries.
7897         * incremental.h (Incremental_input_type): New enum.
7898         (Incremental_inputs::Incremental_input): Initialize new fields.
7899         (Incremental_inputs::report_inputs): New method.
7900         (Incremental_inputs::report_achive): New method.
7901         (Incremental_inputs::report_object): New method.
7902         (Incremental_inputs::report_script): New method.
7903         (Incremental_inputs::finalize_inputs): New method.
7904         (Incremental_inputs::Input_info): New struct.
7905         (Incremental_inputs::Input_info_map): New typedef.
7906         (Incremental_inputs::lock_): New field.
7907         (Incremental_inputs::Inputs_): New field.
7908         (Incremental_inputs::Inputs_map): New field.
7909         * main.cc (main): Call Incremental_input::report_inputs.
7910         * options.h (Input_argument_list): Typedef moved from
7911         Input_arguments.
7912         (Input_file_group::Files): Remove, use ::Input_argument_list.
7913         (Input_file_group::Input_argument_list): Remove, use
7914         ::Input_argument_list.
7915         * plugin.cc (Plugin_manager::add_input_file): Add error in
7916         incremental build.
7917         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7918         functions.
7919         * script.cc (read_input_script): Call
7920         Incremental_input::report_script.
7921         * script.h (Script_info): New class.
7922
7923 2009-04-27  Ian Lance Taylor  <iant@google.com>
7924
7925         * x86_64.cc (do_adjust_output_section): Set entsize to
7926         plt_entry_size.
7927
7928 2009-04-23  Elliott Hughes  <enh@google.com>
7929
7930         * output.cc (Output_file::close): After short writes, continue
7931         writing from the correct offset in the buffer being written.
7932
7933 2009-04-23  Chris Demetriou  <cgd@google.com>
7934
7935         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7936         * configure: Regenerate.
7937         * config.in: Regenerate.
7938         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7939         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7940
7941 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7942
7943         * incremental.cc (Incremental_inputs_header_data): Renamed from
7944         Incremental_input_header_data.
7945         (Incremental_inputs_header_data::data_size): New field.
7946         (Incremental_inputs_header_data::put_input_file_count): Renamed
7947         from input_file_count.
7948         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7949         from command_line_offset.
7950         (Incremental_inputs_header_data::put_reserved): Renamed from
7951         put_reserved.
7952         (Incremental_inputs_entry_data): Renamed from
7953         Incremental_input_entry_data.
7954         (Incremental_inputs_entry_data::data_size): New field.
7955         (Incremental_inputs::report_command_line): New method.
7956         (Incremental_inputs::finalize): New method.
7957         (Incremental_inputs::create_incremental_inputs_data): New method.
7958         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7959         * incremental.h: New file.
7960         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7961        (Layout::finalize): Create incremental inputs section in
7962         incremental builds.
7963        (Layout::create_incremental_info_sections): New method.
7964         * layout.h (Layout::incremental_inputs): New method.
7965        (Layout::create_incremental_info_sections): New method.
7966        (Layout::incremental_inputs_): New field.
7967         * main.cc (main): Notify Incremental_input of the command line.
7968
7969 2009-04-01  Ian Lance Taylor  <iant@google.com>
7970             Mikolaj Zalewski  <mikolajz@google.com>
7971
7972         * gold.h (reserve_unordered_map): Define, three versions, one for
7973         each version of Unordered_map.
7974         * layout.cc (Layout::Layout): Remove options parameter.  Add
7975         number_of_input_files parameter.  Don't initialize options_.
7976         Initialize number_of_input_files_ and resized_signatures_.  Move
7977         sections_are_attached_.
7978         (Layout::layout_group): Reserve space for group_signatures_.
7979         (Layout::find_or_add_kept_section): Change name parameter to be a
7980         reference.  Resize signatures_ map when it gets large enough.
7981         (Layout::layout_eh_frame): Use parameters->options() instead of
7982         this->options_.
7983         (Layout::make_output_section): Likewise.
7984         (Layout::attach_allocated_section_to_segment): Likewise.
7985         (Layout::finalize, Layout::create_executable_stack): Likewise.
7986         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7987         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7988         * layout.h (class Layout): Update declarations.  Remove options_
7989         field.  Add number_of_input_files_ and resized_signatures_
7990         fields.  Move sections_are_attached_ field.
7991         * main.cc (main): Pass number of input files to Layout
7992         constructor.  Don't pass options.
7993
7994 2009-03-30  Ian Lance Taylor  <iant@google.com>
7995
7996         * ffsll.c (ffsll): Correct implementation.
7997
7998 2009-03-27  Ian Lance Taylor  <iant@google.com>
7999
8000         * ffsll.c: New file.
8001         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8002         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8003         * ftruncate.c (ftruncate): Declare before definition.
8004         * mremap.c (mremap): Likewise.
8005         * pread.c (pread): Likewise.
8006         * configure, Makefile.in, config.in: Rebuild.
8007
8008         * mremap.c: New file.
8009         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8010         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8011         (mremap): Declare if HAVE_MREMAP is not defined.
8012         * configure, Makefile.in, config.in: Rebuild.
8013
8014 2009-03-27  Cary Coutant  <ccoutant@google.com>
8015
8016         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8017         position independent.
8018         * sparc.cc (Target_sparc::check_non_pic): Likewise.
8019         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8020
8021 2009-03-24  Cary Coutant  <ccoutant@google.com>
8022
8023         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8024         an executable.
8025         (needs_dynamic_reloc): Likewise.
8026
8027 2009-03-24  Ian Lance Taylor  <iant@google.com>
8028
8029         * yyscript.y (file_cmd): Recognize EXTERN.
8030         (extern_name_list, extern_name_list_body): New nonterminals.
8031         * script.cc (script_add_extern): Define.
8032         * script-c.h (script_add_extern): Declare.
8033
8034 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
8035
8036         * object.cc (is_elf_object): Define.
8037         * object.h (is_elf_object): Declare.
8038         * archive.cc (Archive::get_elf_object_for_member): Call
8039         is_elf_object.
8040         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8041
8042 2009-03-24  Elliott Hughes  <enh@google.com>
8043
8044         * output.cc (Output_file::map_anonymous): Define.
8045         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
8046         try an anonymous one.  Report the size if the mmap fails.
8047         * output.h (class Output_file): Declare map_anonymous.
8048
8049 2009-03-24  Ian Lance Taylor  <iant@google.com>
8050
8051         * target-select.cc (instantiate_target): Don't acquire the lock if
8052         the instantiated_target_ field has already been set.
8053
8054 2009-03-23  Ian Lance Taylor  <iant@google.com>
8055
8056         * gold-threads.h (class Initialize_lock): Define.
8057         * gold-threads.cc (class Initialize_lock_once): Define.
8058         (initialize_lock_control): New static variable.
8059         (initialize_lock_pointer): New static variable.
8060         (initialize_lock_once): New static function.
8061         (Initialize_lock::Initialize_lock): Define.
8062         (Initialize_lock::initialize): Define.
8063         * target-select.h: Include "gold-threads.h".
8064         (class Target_selector): Add lock_ and initialize_lock_ fields.
8065         Don't define instantiate_target, just declare it.
8066         * target-select.cc (Target_selector::Target_selector): Initialize
8067         new fields.
8068         (Target_selector::instantiate_target): Define.
8069         * descriptors.h: Include "gold-threads.h".
8070         (class Descriptors): Add initialize_lock_ field.
8071         * descriptors.cc (Descriptors::Descriptors): Initialize new
8072         field.
8073         (Descriptors::open): Use initialize_lock_ field
8074         * errors.h (class Errors): Add initialize_lock_ field.
8075         * errors.cc (Errors::Errors): Initialize new field.
8076         (Errors::initialize_lock): Use initialize_lock_ field.
8077         * powerpc.cc (class Target_selector_powerpc): Remove
8078         instantiated_target_ field.  In do_recognize call
8079         instantiate_target rather than do_instantiate_target.  In
8080         do_instantiate_target just allocate a new target.
8081         * sparc.cc (class Target_selector_sparc): Likewise.
8082
8083         * freebsd.h: New file.
8084         * i386.cc: Include "freebsd.h".
8085         (Target_i386): Derive from Target_freebsd rather than
8086         Sized_target.
8087         (Target_selector_i386): Derive from Target_selector_freebsd rather
8088         than Target_selector.
8089         * x86_64.cc: Include "freebsd.h".
8090         (Target_x86_64): Derive from Target_freebsd rather than
8091         Sized_target.
8092         (Target_selector_x86_64): Derive from Target_selector_freebsd
8093         rather than Target_selector.
8094         * target.h (class Target): Add adjust_elf_header and
8095         do_adjust_elf_header.
8096         * output.cc (Output_file_header:: do_sized_write): Call target
8097         adjust_elf_header routine.
8098         * configure.tgt: Set targ_osabi.
8099         * configure.ac: Define GOLD_DEFAULT_OSABI.
8100         * parameters.cc (Parameters::default_target): Pass
8101         GOLD_DEFAULT_OSABI to select_target.
8102         * target-select.h (class Target_selector): Make instantiate_target
8103         protected rather than private.
8104         * Makefile.am (HFILES): Add freebsd.h.
8105         * configure, Makefile.in, config.in: Rebuild.
8106
8107         * merge.cc (do_add_input_section): Correct pend value.  Change
8108         message about last entry not being null terminated from error to
8109         warning.
8110
8111 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
8112
8113         * incremental.cc: New file.
8114         * Makefile.am (CCFILES): Add incremental.cc.
8115         * Makefile.in: Rebuild.
8116
8117 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
8118
8119         * layout.cc (Layout::output_section_name): Preserve names
8120         of '.note.' sections.
8121
8122 2009-03-19  Ian Lance Taylor  <iant@google.com>
8123
8124         * descriptors.cc (Descriptors::open): Check that the options are
8125         valid before using them.
8126
8127 2009-03-18  Ian Lance Taylor  <iant@google.com>
8128
8129         * script-sections.h: Include <list>.
8130         (class Script_sections): Change Sections_elements from std::vector
8131         to std::list.  Typedef public Elements_iterator.  Add
8132         orphan_section_placement_, data_segment_align_start_, and
8133         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8134         field.
8135         * script-sections.cc (class Orphan_section_placement): New class.
8136         (class Sections_element): Add virtual functions is_relro and
8137         orphan_section_init.  Remove virtual function place_orphan_here.
8138         (class Output_section_definition): Add is_relro and
8139         orphan_section_init.  Remove place_orphan_here.
8140         (class Orphan_output_section): Likewise.
8141         (Script_sections::Script_sections): Update for field changes.
8142         (Script_sections::data_segment_align): Set saw_data_segment_align_
8143         and data_segment_align_start_, not data_segment_align_index.
8144         (Script_sections::data_segment_relro_end): Check
8145         saw_data_segment_align_.  Use data_segment_align_start_ rather
8146         than data_segment_align_index_.
8147         (Script_sections::place_orphan): Rewrite to use
8148         Orphan_section_placement.
8149
8150 2009-03-17  Ian Lance Taylor  <iant@google.com>
8151
8152         * archive.cc (Archive::add_symbols): Check for a version attached
8153         to the symbol name in the archive map.
8154         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8155         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8156         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8157         (ver_test_11.a): New target.
8158         * testsuite/Makefile.in: Rebuild.
8159
8160         * configure.ac: Check for chsize and posix_fallocate.  Replace
8161         ftruncate.
8162         * ftruncate.c: New file, from gnulib.
8163         * output.cc (posix_fallocate): Define dummy version if not
8164         HAVE_POSIX_FALLOCATE.
8165         (Output_file::map): Call posix_fallocate rather than lseek and
8166         write.
8167         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8168         * configure, Makefile.in, config.in: Rebuild.
8169
8170 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8171
8172         * layout.h (Layout::create_note): Add section_name parameter.
8173         * layout.cc (Layout::create_note): Likewise.
8174         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8175
8176 2009-03-17  Ian Lance Taylor  <iant@google.com>
8177
8178         * descriptors.cc: Include "options.h".
8179         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8180         (Descriptors::open): Always use O_CLOEXEC when opening a new
8181         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8182         then set FD_CLOEXEC.
8183
8184         * sparc.cc (class Target_sparc): Add has_got_section.
8185         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8186         make sure we have a GOT section.
8187
8188         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8189         (Target_sparc::Scan::local): Likewise.
8190         (Target_sparc::Scan::global): Likewise.
8191         (Target_sparc::Relocate::relocate): Likewise.
8192         (Target_sparc::Relocate::relocate_tls): Likewise.
8193
8194         * symtab.cc (Symbol_table::define_default_version): New function,
8195         broken out of add_from_object.
8196         (Symbol_table::add_from_object): Call define_default_version.
8197         (Symbol_table::define_special_symbol): Add resolve_oldsym
8198         parameter.  Change all callers.  If the version for a symbol comes
8199         from a version script, resolve it with the symbol with the same
8200         name with no version.  Also add the symbol without a version if
8201         appropriate.
8202         (do_define_in_output_data): If resolving with oldsym, don't delete
8203         sym.
8204         (do_define_in_output_segment): Likewise.
8205         (do_define_as_constant): Likewise.
8206         * symtab.h (class Symbol_table): Update declarations.
8207
8208 2009-03-13  Ian Lance Taylor  <iant@google.com>
8209
8210         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8211         (Read_symbols::requeue): New function.
8212         (Read_symbols::do_read_symbols): If make_elf_object fails because
8213         the target type is not configured, and the file was searched for,
8214         issue a warning and retry with the next directory.
8215         (Add_symbols::run): If the file has an incompatible format, and
8216         it was searched for, requeue the Read_symbols task.  On error,
8217         release the object.
8218         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8219         dirindex parameter to constructor.  Change all callers.  Declare
8220         incompatible_warning and requeue.
8221         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8222         input_argument_ and input_group_ fields.  Add them to
8223         constructor.  Change all callers.
8224         (class Read_script): Add dirindex_ field.  Add it to constructor.
8225         Change all callers.
8226         * archive.cc (Archive::setup): Remove input_objects parameter.
8227         Change all callers.
8228         (Archive::get_file_and_offset): Likewise.
8229         (Archive::read_all_symbols): Likewise.
8230         (Archive::read_symbols): Likewise.
8231         (Archive::get_elf_object_for_member): Remove input_objects
8232         parameter.  Add punconfigured parameter.  Change all callers.
8233         (Archive::add_symbols): Change return type to bool.  Check return
8234         value of include_member.
8235         (Archive::include_all_members): Likewise.
8236         (Archive::include_member): Change return type to bool.  Return
8237         false if first included object has incompatible target.  Set
8238         included_member_ field.
8239         (Add_archive_symbols::run): If add_symbols returns false, requeue
8240         Read_symbols task.
8241         * archive.h (class Archive): Add included_member_ field.
8242         Initialize it in constructor.  Add input_file and searched_for
8243         methods.  Update declarations.
8244         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8245         input_argument_ fields.  Add them to constructor.  Change all
8246         callers.
8247         * script.cc: Include "target-select.h".
8248         (class Parser_closure): Add skip_on_incompatible_target_ and
8249         found_incompatible_target_ fields.  Add
8250         skip_on_incompatible_target parameter to constructor.  Change all
8251         callers.  Add methods skip_on_incompatible_target,
8252         clear_skip_on_incompatible_target, found_incompatible_target, and
8253         set_found_incompatible_target.
8254         (read_input_script): Add dirindex parameter.  Change all callers.
8255         If parser finds an incompatible target, requeue Read_symbols
8256         task.
8257         (script_set_symbol): Clear skip_on_incompatible_target in
8258         closure.
8259         (script_add_assertion, script_parse_option): Likewise.
8260         (script_start_sections, script_add_phdr): Likewise.
8261         (script_check_output_format): New function.
8262         * script.h (read_input_script): Update declaration.
8263         * script-c.h (script_check_output_format): Declare.
8264         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8265         (ignore_cmd): Remove OUTPUT_FORMAT.
8266         * fileread.cc (Input_file::Input_file): Add explicit this.
8267         (Input_file::will_search_for): New function.
8268         (Input_file::open): Add pindex parameter.  Change all callers.
8269         * fileread.h (class Input_file): Add input_file_argument method.
8270         Declare will_search_for.  Update declarations.
8271         * object.cc (make_elf_object): Add punconfigured parameter.
8272         Change all callers.
8273         * object.h (class Object): Make input_file public.  Add
8274         searched_for method.
8275         (make_elf_object): Update declaration.
8276         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8277         restart search.
8278         * dirsearch.h (class Dirsearch): Update declaration.
8279         * options.h (class General_options): Add --warn-search-mismatch.
8280         * parameters.cc (Parameters::is_compatible_target): New function.
8281         * parameters.h (class Parameters): Declare is_compatible_target.
8282         * workqueue.cc (Workqueue::add_blocker): New function.
8283         * workqueue.h (class Workqueue): Declare add_blocker.
8284
8285         * fileread.cc (Input_file::open): Remove options parameter.
8286         Change all callers.
8287         (Input_file::open_binary): Likewise.
8288         * script.cc (read_input_script): Likewise.
8289         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8290         options parameter from constructor.  Change all callers.
8291         (class Read_script): Likewise.
8292         * fileread.h (class Input_file): Update declarations.
8293         * script.h (read_input_script): Update declaration.
8294
8295 2009-03-10  Nick Clifton  <nickc@redhat.com>
8296
8297         * po/es.po: New Spanish translation.
8298
8299 2009-03-06  Cary Coutant  <ccoutant@google.com>
8300
8301         * options.cc (parse_short_option): Keep dash_z from registering itself.
8302
8303 2009-03-03  Ian Lance Taylor  <iant@google.com>
8304
8305         PR 9918
8306         * target-reloc.h (relocate_section): Pass output_section to
8307         relocate.
8308         * i386.cc (Target_i386::should_apply_static_reloc): Add
8309         output_section parameter.  Change all callers.
8310         (Target_i386::Relocate::relocate): Add output_section parameter.
8311         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8312         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8313         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8314         * testsuite/two_file_shared.sh: New script.
8315         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8316         (check_DATA): Add two_file_shared.dbg.
8317         (two_file_shared.dbg): New target.
8318         * testsuite/Makefile.in: Rebuild.
8319
8320 2009-03-01  Ian Lance Taylor  <iant@google.com>
8321
8322         * configure.ac: Check for byteswap.h.
8323         * configure: Rebuild.
8324         * config.in: Rebuild.
8325
8326 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8327
8328         * layout.cc (Layout::find_or_add_kept_section): New function.
8329         (Layout::add_comdat): Removed.
8330         * layout.h (struct Kept_section): Move out of class Layout.
8331         Remove trailing underscores from field names.  Add group_sections
8332         field.  Rename group_ field to is_group.  Change all uses.
8333         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8334         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8335         comdat_groups_ field.
8336         (Sized_relobj::include_section_group): Use
8337         find_or_add_kept_section and Kept_section::group_sections.
8338         (Sized_relobj::include_linkonce_section): Likewise.
8339         * object.cc (class Sized_relobj): Don't define Comdat_group or
8340         Comdat_group_table.  Remove find_comdat_group and
8341         add_comdat_group.  Remove comdat_groups_ field.
8342         * plugin.cc (include_comdat_group): Use
8343         Layout::find_or_add_kept_section.
8344
8345 2009-02-28  Ian Lance Taylor  <iant@google.com>
8346
8347         * README: --gc-sections and map files are now supported.  Document
8348         some build requirements.
8349
8350         PR 6992
8351         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8352         relocatable link set the value of the section symbol to zero.
8353         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8354         relocatable link don't include the section address in the local
8355         symbol value.
8356
8357 2009-02-27  Ian Lance Taylor  <iant@google.com>
8358
8359         PR 6811
8360         * options.h (class Search_directory): Add is_system_directory.
8361         (class General_options): Declare is_in_system_directory.
8362         * options.cc (get_relative_sysroot): Make static.
8363         (get_default_sysroot): Make static.
8364         (General_optoins::is_in_system_directory): New function.
8365         * fileread.cc (Input_file::is_in_system_directory): New function.
8366         * fileread.h (class Input_file): Declare is_in_system_directory.
8367         * object.h (class Object): Add is_in_system_directory.
8368         (class Input_objects): Remove system_library_directory_ field.
8369         * object.cc (Input_objects::add_object): Don't set
8370         system_library_directory_.
8371         (input_objects::found_in_system_library_directory): Remove.
8372         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8373         parameter.  Change all callers.
8374         (Symbol_table::sized_write_globals): Likewise.
8375         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8376         Call Object::is_in_system_directory.
8377         * symtab.h (class Symbol_table): Update declarations.
8378
8379         PR 5990
8380         * descriptors.h (Open_descriptor): Add is_on_stack field.
8381         * descriptors.cc (Descriptors::open): If the descriptor is on the
8382         top of the stack, remove it.  Initialize is_on_stack field.
8383         (Descriptors::release): Only add pod to stack if it is not on the
8384         stack already.
8385         (Descriptors::close_some_descriptor): Clear stack_next and
8386         is_on_stack fields.
8387
8388         PR 7091
8389         * output.cc (Output_section::find_starting_output_address): Rename
8390         from starting_output_address; add PADDR parameter; change return
8391         type.
8392         * output.h (class Output_section): Declare
8393         find_starting_output_address instead of starting_output_address.
8394         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8395         section symbol for which we can't find a merge section.
8396
8397         PR 9836
8398         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8399         hidden or internal, force the symbol to be local.
8400         * resolve.cc (Symbol::override_visibility): Define.
8401         (Symbol::override_base): Use override_visibility.
8402         (Symbol_table::resolve): Likewise.
8403         (Symbol::override_base_with_special): Likewise.
8404         (Symbol_table::override_with_special): If the visibility is hidden
8405         or internal, force the symbol to be local.
8406         * symtab.h (class Symbol): Add set_visibility and
8407         override_visibility.
8408         * testsuite/ver_test_1.sh: New file.
8409         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8410         (check_DATA): Add ver_test_1.syms.
8411         (ver_test_1.syms): New target.
8412         * testsuite/Makefile.in: Rebuild.
8413
8414 2009-02-25  Cary Coutant  <ccoutant@google.com>
8415
8416         * layout.cc (Layout::choose_output_section): Don't rename sections
8417         when using a linker script that has a SECTIONS clause.
8418         * Makefile.in: Regenerate.
8419
8420         * testsuite/Makefile.am (script_test_5.sh): New test case.
8421         * testsuite/Makefile.in: Regenerate.
8422         * testsuite/script_test_5.cc: New file.
8423         * testsuite/script_test_5.sh: New file.
8424         * testsuite/script_test_5.t: New file.
8425
8426 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8427
8428         * archive.cc (Archive::include_member): Update calls to add_symbols.
8429         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8430         the Layout argument.
8431         * dynobj.h (do_add_symbols): Add the Layout argument.
8432         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8433         Layout argument.
8434         * object.h (Object::add_symbols): Add the Layout argument.
8435         (Object::do_add_symbols): Add the Layout argument.
8436         (Sized_relobj::do_add_symbols): Add the Layout argument.
8437         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8438         Unify the two versions.
8439         (Add_plugin_symbols): Remove.
8440         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8441         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8442         (Add_plugin_symbols): Remove.
8443         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8444         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8445         (Add_symbols::run): Make it work with Pulginobj.
8446
8447 2009-02-06  Ian Lance Taylor  <iant@google.com>
8448
8449         * object.cc (Sized_relobj::do_layout): Make info message start
8450         with lower case letter.
8451
8452 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8453
8454         * binary.cc: Fix file comment.
8455
8456         * options.h (enum Incremental_disposition): Define.
8457         (class General_options): Add new options: --incremental,
8458         --incremental_changed, --incremental_unchanged,
8459         --incremental_unknown.  Add incremental_disposition_ and
8460         implicit_incremental_ fields.
8461         (General_options::incremental_disposition): New function.
8462         (class Position_dependent_options): Add incremental_disposition
8463         option.
8464         (Position_dependent_options::copy_from_options): Set incremental
8465         dispositions.
8466         * options.cc (General_options::parse_incremental_changed): New
8467         function.
8468         (General_options::parse_incremental_unchanged): New function.
8469         (General_options::parse_incremental_unknown): New function.
8470         (General_options::General_options): Initialize new fields
8471         incremental_disposition_ and implicit_incremental_.
8472         (General_options::finalize): Check for uasge of --incremental-*
8473         without --incremental.
8474
8475 2009-02-06  Chris Demetriou  <cgd@google.com>
8476
8477         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8478         pointer and to report location as the file name associated with
8479         the symbol.
8480         (gold_undefined_symbol_at_location): New function to replace the
8481         old gold_undefined_symbol functionality.
8482         * target-reloc.h (relocate_section): Update to use
8483         gold_undefined_symbol_at_location.
8484         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8485         Call gold_undefined_symbol function rather than gold_error.
8486         * errors.h (Errors::undefined_symbol): Take location as a
8487         string, rather than calculating it from a relocation.
8488         * errors.cc (Errors::fatal): Print "fatal error:" before the
8489         formatted message.
8490         (Errors::error, Errors::error_at_location): Print "error: "
8491         before the formatted message.
8492         (Errors::undefined_symbol): Take location as a string, rather
8493         than calculating it from a relocation.
8494         (gold_undefined_symbol_at_location): New function akin to
8495         old gold_undefined_symbol, calculates location from relocation.
8496         (gold_undefined_symbol): Change to take only a Symbol pointer
8497         and to report location as the file name associated with the symbol.
8498         * testsuite/debug_msg.sh: Update for changed error messages.
8499         * testsuite/undef_symbol.sh: Likewise.
8500
8501 2009-02-04  Duncan Sands  <baldrick@free.fr>
8502
8503         PR 9812
8504         * reduced_debug_output.h
8505         (Output_reduced_debug_abbrev_section::failed): Use format for
8506         gold_warning.
8507         (Output_reduced_debug_info_section::faild): Likewise.
8508
8509 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8510
8511         * script.cc (Lazy_demangler): New class.
8512         (Version_script_info::get_symbol_version_helper): Demangle a
8513         symbol only once.
8514
8515 2009-01-29  Cary Coutant  <ccoutant@google.com>
8516
8517         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8518         to __tls_get_addr.
8519         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8520
8521 2009-01-28  Ian Lance Taylor  <iant@google.com>
8522
8523         * version.cc (version_string): Bump to 1.9.
8524
8525         * gold.h: Include <cstring> and <stdint.h>.
8526         * version.cc: Include <cstdio>.
8527         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8528         warning.
8529         * reduced_debug_output.cc (insert_into_vector): Rename from
8530         Insert_into_vector; change all callers.  Use Swap_unaligned to
8531         avoid aliasing issue; remove union since it is unnecessary.
8532
8533 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8534
8535         * Makefile.am (CCFILES): Add gc.cc.
8536         (HFILES): Add gc.h.
8537         * Makefile.in: Regenerate.
8538         * gold.cc (Gc_runner): New class.
8539         (queue_initial_tasks): Call garbage collection related tasks
8540         when corresponding options are invoked.
8541         (queue_middle_gc_tasks): New function.
8542         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8543         processed early before laying out sections during garbage collection.
8544         * gold.h (queue_middle_gc_tasks): New function.
8545         (is_prefix_of): Move from "layout.cc".
8546         * i386.cc (Target_i386::gc_process_relocs): New function.
8547         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8548         * main.cc (main): Create object of class "Garbage_collection".
8549         * object.cc (Relobj::copy_symbols_data): New function.
8550         (Relobj::is_section_name_included): New function.
8551         (Sized_relobj::do_layout): Allow this function to be called twice
8552         during garbage collection and defer layout of section during the
8553         first call.
8554         * object.h (Relobj::get_symbols_data): New function.
8555         (Relobj::is_section_name_included): New function.
8556         (Relobj::copy_symbols_data): New function.
8557         (Relobj::set_symbols_data): New function.
8558         (Relobj::get_relocs_data): New function.
8559         (Relobj::set_relocs_data): New function.
8560         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8561         (Relobj::gc_process_relocs): New function.
8562         (Relobj::do_gc_process_relocs): New pure virtual function.
8563         (Relobj::sd_): New data member.
8564         (Sized_relobj::is_output_section_offset_invalid): New function.
8565         (Sized_relobj::do_gc_process_relocs): New function.
8566         * options.h (General_options::gc_sections): Modify to not be a no-op.
8567         (General_options::print_gc_sections): New option.
8568         * plugin.cc (Plugin_finish::run): Remove function call to
8569         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8570         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8571         * reloc.cc (Read_relocs::run): Add task to process relocs and
8572         determine unreferenced sections when doing garbage collection.
8573         (Gc_process_relocs): New class.
8574         (Sized_relobj::do_gc_process_relocs): New function.
8575         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8576         sections that are garbage collected.
8577         * reloc.h (Gc_process_relocs): New class.
8578         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8579         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8580         symbols whose corresponding sections are garbage collected.
8581         (Symbol_table::Symbol_table): Add new parameter for the garbage
8582         collection object.
8583         (Symbol_table::gc_mark_undef_symbols): New function.
8584         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8585         (Symbol_table::gc_mark_dyn_syms): New function.
8586         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8587         as garbage.
8588         (Symbol_table::add_from_object): Likewise.
8589         (Symbol_table::add_from_relobj): When building shared objects, do not
8590         treat externally visible symbols as garbage.
8591         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8592         table information for static and relocatable links.
8593         * symtab.h (Symbol_table::set_gc): New function.
8594         (Symbol_table::gc): New function.
8595         (Symbol_table::gc_mark_undef_symbols): New function.
8596         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8597         (Symbol_table::gc_mark_dyn_syms): New function.
8598         (Symbol_table::gc_): New data member.
8599         * target.h (Sized_target::gc_process_relocs): New pure virtual
8600         function.
8601         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8602         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8603
8604 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8605
8606         * options.h (General_options::gc_sections): Define as a no-op for now.
8607         (General_options::no_keep_memory): Ditto.
8608         (General_options::Bshareable): Define.
8609         * options.cc (General_options::finalize): Honor -Bshareable.
8610
8611 2009-01-20  Andreas Schwab  <schwab@suse.de>
8612
8613         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8614         read the value in the contents, since we don't use it.  Use the
8615         template endianness when writing.
8616         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8617
8618 2009-01-19  Andreas Schwab  <schwab@suse.de>
8619
8620         * configure.tgt (powerpc64-*): Fix targ_obj.
8621
8622 2009-01-15  Ian Lance Taylor  <iant@google.com>
8623
8624         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8625         local symbols when stripping all symbols.
8626
8627 2009-01-14  Cary Coutant  <ccoutant@google.com>
8628
8629         * output.cc (Output_reloc): Add explicit instantiations.
8630
8631 2009-01-14  Cary Coutant  <ccoutant@google.com>
8632
8633         * archive.cc (Archive::get_elf_object_for_member): Remove call
8634         to File_read::claim_for_plugin.
8635         * descriptors.cc (Descriptors::open): Remove reference to
8636         is_claimed.
8637         (Descriptors::claim_for_plugin): Remove.
8638         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8639         (Descriptors::is_claimed): Remove.
8640         (claim_descriptor_for_plugin): Remove.
8641         * fileread.cc (File_read::claim_for_plugin): Remove.
8642         * fileread.h (File_read::claim_for_plugin): Remove.
8643         (File_read::descriptor): Reopen descriptor if necessary.
8644         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8645         (Plugin_manager::all_symbols_read): Add task parameter. Change
8646         all callers.
8647         (Plugin_manager::get_input_file): New function.
8648         (Plugin_manager::release_input_file): New function.
8649         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8650         corresponding data member.
8651         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8652         and pass to base constructor. Change all callers.
8653         (get_input_file, release_input_file): New functions.
8654         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8655         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8656         (Plugin_manager::all_symbols_read): Add task parameter.
8657         (Plugin_manager::get_input_file): New function.
8658         (Plugin_manager::release_input_file): New function.
8659         (Plugin_manager::task_): New data member.
8660         (Pluginobj::Pluginobj): Add filesize parameter.
8661         (Pluginobj::filename): New function.
8662         (Pluginobj::descriptor): New function.
8663         (Pluginobj::filesize): New function.
8664         (Pluginobj::filesize_): New data member.
8665         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8666         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8667         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8668
8669         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8670         with archive libraries.
8671         * testsuite/Makefile.in: Regenerate.
8672         * testsuite/plugin_test.c (struct sym_info): New type.
8673         (get_input_file, release_input_file): New static variables.
8674         (onload): Capture new transfer vector entries.
8675         (claim_file_hook): Stop reading at end of file according to filesize.
8676         Factor out parsing of readelf output into separate function.
8677         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8678         APIs and get the source file name from the symbol table.  Convert
8679         source file name to corresponding object file name.  Print info
8680         message when adding new input files.
8681         (parse_readelf_line): New function.
8682         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8683         * testsuite/plugin_test_2.sh: Likewise.
8684         * testsuite/plugin_test_3.sh: Likewise.
8685         * testsuite/plugin_test_4.sh: New test case.
8686
8687 2009-01-07  Ian Lance Taylor  <iant@google.com>
8688
8689         * version.cc (version_string): Bump to 1.8.
8690
8691 2008-12-23  Cary Coutant  <ccoutant@google.com>
8692
8693         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8694         * plugin.cc (Plugin_manager::finish): Rename as
8695         layout_deferred_objects.  Move cleanup to separate function.
8696         (Plugin_manager::cleanup): New function.
8697         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8698         separately.
8699         * plugin.h (Plugin_manager::finish): Rename as
8700         layout_deferred_objects.
8701         (Plugin_manager::cleanup): New function.
8702         (Plugin_manager::cleanup_done): New field.
8703
8704 2008-12-23  Cary Coutant  <ccoutant@google.com>
8705
8706         * plugin.cc (is_visible_from_outside): New function.
8707         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8708         so we don't return "IR only" status for exported symbols or -r links.
8709
8710         * testsuite/Makefile.am (plugin_test_3): New test case.
8711         * testsuite/Makefile.in: Regenerate.
8712         * testsuite/plugin_test_3.sh: New file.
8713
8714 2008-12-22  Cary Coutant  <ccoutant@google.com>
8715
8716         * object.cc (Sized_relobj::layout_section): New function.
8717         (Sized_relobj::do_layout): Defer layout of input sections until after
8718         plugin has provided replacement files.
8719         (Sized_relobj::do_layout_deferred_sections): New function.
8720         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8721         (Relobj::layout_deferred_sections): New function.
8722         (Relobj::do_layout_deferred_sections): New function.
8723         (Sized_relobj::do_layout_deferred_sections): New function.
8724         (Sized_relobj::layout_section): New function.
8725         (Sized_relobj::Deferred_layout): New structure.
8726         (Sized_relobj::deferred_layout_): New field.
8727         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8728         Change all callers.  Layout deferred sections.
8729         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8730         references.
8731         (Plugin_hook::run): Move code from do_plugin_hook inline.
8732         (Plugin_hook::do_plugin_hook): Remove.
8733         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8734         (Plugin_manager::finish): Renamed, was cleanup.
8735         (Plugin_manager::should_defer_layout): New function.
8736         (Plugin_manager::add_deferred_layout_object): New function.
8737         (Plugin_manager::Deferred_layout_list): New type.
8738         (Plugin_manager::deferred_layout_objects_): New field.
8739         (Plugin_hook::do_plugin_hook): Remove.
8740
8741 2008-12-17  Ian Lance Taylor  <iant@google.com>
8742
8743         * options.h (class General_options): Add --no case for
8744         --export-dynamic.
8745
8746 2008-12-16  Cary Coutant  <ccoutant@google.com>
8747
8748         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8749         vector.
8750         (Plugin_manager::claim_file): Create plugin object even if
8751         plugin did not call the add_symbols callback.
8752         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8753         asking for more symbols than were added.
8754         * testsuite/Makefile.am (plugin_test_1): Add test case with
8755         no global symbols.
8756         (empty.syms): New target.
8757         * testsuite/Makefile.in: Regenerate.
8758         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8759         message. Don't call add_symbols if no globals.
8760         (all_symbols_read_hook): Don't provide replacement for empty
8761         claimed file.
8762
8763 2008-12-12  Ian Lance Taylor  <iant@google.com>
8764
8765         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8766         r_type == 0 for a local symbol with r_sym == 0.
8767         (scan_relocatable_relocs): Pass r_sym to
8768         local_non_section_strategy.
8769         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8770         r_sym parameter.
8771
8772         * configure.ac: Update test for TLS descriptors: they are
8773         supported as of glibc 2.9.
8774         * configure: Rebuild.
8775
8776 2008-12-11  Ian Lance Taylor  <iant@google.com>
8777
8778         PR 7091
8779         * target-reloc.h (Default_scan_relocatable_relocs): For each
8780         function, map r_type == 0 to RELOC_DISCARD.
8781
8782 2008-12-10  Cary Coutant  <ccoutant@google.com>
8783
8784         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8785         object to override a kept COMDAT group from a plugin object.
8786
8787 2008-12-09  Ian Lance Taylor  <iant@google.com>
8788
8789         PR 7088
8790         * yyscript.y (file_cmd): Handle INPUT.
8791
8792         * testsuite/initpri1.c: Change all declarations to be full
8793         prototypes by adding void, to avoid compiler warnings.
8794
8795 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8796
8797         * options.cc (General_options::parse_plugin_opt): New.
8798         (General_options::add_plugin): The argument now is just the filename.
8799         (General_options::add_plugin_option): New.
8800         * options.h (plugin_opt): New.
8801         (add_plugin): Change argument name.
8802         (add_plugin_option): New.
8803         * plugin.cc (Plugin::load): Don't parse the plugin option.
8804         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8805         (Plugin::add_option): New.
8806         (Plugin::args_): Change type.
8807         (Plugin::filename_): New.
8808         (Plugin_manager::add_plugin_option): New.
8809         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8810         * testsuite/Makefile.in: Regenerate.
8811
8812 2008-12-05  Cary Coutant  <ccoutant@google.com>
8813
8814         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8815         Handle --strip-lto-sections option.
8816         * options.h (strip_lto_sections): New option.
8817
8818 2008-12-01  Cary Coutant  <ccoutant@google.com>
8819
8820         * plugin.cc (ld_plugin_message): Change format parameter to const.
8821         Fix mismatch between new[] and delete.
8822
8823 2008-11-14  Cary Coutant  <ccoutant@google.com>
8824
8825         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8826         instead of -1U.
8827
8828 2008-11-05  Craig Silverstein  <csilvers@google.com>
8829
8830         * options.cc (General_options::parse_dynamic_list): New function.
8831         * options.h (General_options): New flags dynamic_list,
8832         dynamic_list_data, dynamic_list_cpp_new, and
8833         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8834         (General_options::in_dynamic_list): New function.
8835         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8836         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8837         (Lex::can_continue_name): Likewise.
8838         (yylex): Likewise.
8839         (read_script_file): New parameter script_options.
8840         (read_dynamic_list): New function.
8841         (Script_options::define_dynamic_list): New function.
8842         (dynamic_list_keyword_parsecodes): New variable.
8843         (dynamic_list_keywords): New variable.
8844         * script.h (Script_options::define_dynamic_list): New function
8845         prototype.
8846         (read_dynamic_list): New function prototype.
8847         * symtab.cc (strprefix): New macro.
8848         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8849         dynamic_list_data, dynamic_list_cpp_new, and
8850         dynamic_list_cpp_typeinfo.
8851         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8852         (dynamic_list_expr): New rule.
8853         (dynamic_list_nodes): Likewise.
8854         (dynamic_list_node): Likewise.
8855         * testsuite/Makefile.am (dynamic_list): New test.
8856         * testsuite/Makefile.in: Regenerated.
8857         * testsuite/dynamic_list.t: New file.
8858         * testsuite/dynamic_list.sh: New file.
8859
8860 2008-11-05  Craig Silverstein  <csilvers@google.com>
8861
8862         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8863         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8864         (t11_last): Likewise.
8865         * testsuite/ver_test_6.c (main): Likewise.
8866
8867 2008-10-07  Cary Coutant  <ccoutant@google.com>
8868
8869         * options.c (General_options::finalize): Add check for -static and
8870         -shared.
8871         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8872         is not empty.
8873
8874 2008-10-02  Cary Coutant  <ccoutant@google.com>
8875
8876         * plugin.cc (make_sized_plugin_object): Fix conditional
8877         compilation to work when not all targets are enabled.
8878
8879 2008-09-29  Cary Coutant  <ccoutant@google.com>
8880
8881         * archive.cc (Archive::get_file_and_offset): Use filename instead
8882         of name to get library path.
8883         (Archive::include_member): Unlock external member of a thin archive.
8884
8885         * testsuite/Makefile.am (TEST_AR): New variable.
8886         (thin_archive_test_1): New test.
8887         (thin_archive_test_2): New test.
8888         * testsuite/Makefile.in: Regenerate.
8889         * testsuite/thin_archive_main.cc: New file.
8890         * testsuite/thin_archive_test_1.cc: New file.
8891         * testsuite/thin_archive_test_2.cc: New file.
8892         * testsuite/thin_archive_test_3.cc: New file.
8893         * testsuite/thin_archive_test_4.cc: New file.
8894
8895 2008-09-29  Cary Coutant  <ccoutant@google.com>
8896
8897         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8898         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8899         instead of -1U.
8900         (Sized_relobj::do_finalize_local_symbols): Likewise.
8901         (Sized_relobj::map_to_kept_section): Likewise.
8902         * object.h (Sized_relobj::invalid_address): New constant.
8903         (Sized_relobj::do_output_section_offset): Check for invalid_address
8904         and return -1ULL.
8905         * output.cc (Output_reloc::local_section_offset): Use constant
8906         invalid_address instead of -1U.
8907         (Output_reloc::get_address): Likewise.
8908         (Output_section::output_address): Change -1U to -1ULL.
8909         * output.h (Output_reloc::invalid_address): New constant.
8910         * reloc.cc (Sized_relobj::write_sections): Use constant
8911         invalid_address instead of -1U.
8912         (Sized_relobj::relocate_sections): Likewise.
8913         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8914         values for merge sections.
8915         * target-reloc.h (relocate_for_relocatable): Use constant
8916         invalid_address instead of -1U.
8917
8918 2008-09-19  Cary Coutant  <ccoutant@google.com>
8919
8920         Add plugin functionality for link-time optimization (LTO).
8921         * configure.ac (plugins): Add --enable-plugins option.
8922         * configure: Regenerate.
8923         * config.in: Regenerate.
8924         * Makefile.am (LIBDL): New variable.
8925         (CCFILES): Add plugin.cc.
8926         (HFILES): Add plugin.h.
8927         (ldadd_var): Add LIBDL.
8928         * Makefile.in: Regenerate.
8929
8930         * archive.cc: Include "plugin.h".
8931         (Archive::setup): Don't preread archive symbols when using a plugin.
8932         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8933         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8934         files.
8935         (Archive::include_member): Add symbols from plugin objects.
8936         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8937         * descriptors.cc (Descriptors::open): Check for file descriptors
8938         abandoned by plugins.
8939         (Descriptors::claim_for_plugin): New function.
8940         * descriptors.h (Descriptors::claim_for_plugin): New function.
8941         (Open_descriptor::is_claimed): New field.
8942         (claim_descriptor_for_plugin): New function.
8943         * fileread.cc (File_read::claim_for_plugin): New function.
8944         * fileread.h (File_read::claim_for_plugin): New function.
8945         (File_read::descriptor): New function.
8946         * gold.cc: Include "plugin.h".
8947         (queue_initial_tasks): Add task to call plugin hooks for generating
8948         new object files.
8949         * main.cc: Include "plugin.h".
8950         (main): Load plugin libraries.
8951         * object.h (Pluginobj): Declare.
8952         (Object::pluginobj): New function.
8953         (Object::do_pluginobj): New function.
8954         (Object::set_target): New function.
8955         * options.cc: Include "plugin.h".
8956         (General_options::parse_plugin): New function.
8957         (General_options::General_options): Initialize plugins_ field.
8958         (General_options::add_plugin): New function.
8959         * options.h (Plugin_manager): Declare.
8960         (General_options): Add --plugin option.
8961         (General_options::has_plugins): New function.
8962         (General_options::plugins): New function.
8963         (General_options::add_plugin): New function.
8964         (General_options::plugins_): New field.
8965         * plugin.cc: New file.
8966         * plugin.h: New file.
8967         * readsyms.cc: Include "plugin.h".
8968         (Read_symbols::do_read_symbols): Check for archive before checking
8969         for ELF file.  Call plugin hooks to claim files.
8970         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8971         from a real object file; force override when processing replacement
8972         files.
8973         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8974         (Symbol::init_base_object): Likewise.
8975         (Symbol::init_base_output_data): Likewise.
8976         (Symbol::init_base_output_segment): Likewise.
8977         (Symbol::init_base_constant): Likewise.
8978         (Symbol::init_base_undefined): Likewise.
8979         (Symbol::output_section): Assert that object is not a plugin.
8980         (Symbol_table::add_from_pluginobj): New function.
8981         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8982         undefined.
8983         (Symbol_table::sized_write_globals): Likewise.
8984         (Symbol_table::add_from_pluginobj): Instantiate template.
8985         * symtab.h (Sized_pluginobj): Declare.
8986         (Symbol::in_real_elf): New function.
8987         (Symbol::set_in_real_elf): New function.
8988         (Symbol::in_real_elf_): New field.
8989         (Symbol_table::add_from_pluginobj): New function.
8990
8991         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8992         (LIBDL): New variable.
8993         (LDADD): Add LIBDL.
8994         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8995         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8996         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8997         (MOSTLYCLEANFILES): Likewise.
8998         * testsuite/Makefile.in: Regenerate.
8999         * testsuite/plugin_test.c: New file.
9000         * testsuite/plugin_test_1.sh: New file.
9001         * testsuite/plugin_test_2.sh: New file.
9002
9003 2008-09-16  Ian Lance Taylor  <iant@google.com>
9004
9005         * target-reloc.h (relocate_section): Check whether a symbol is
9006         defined by the ABI before reporting an undefined symbol error.
9007         * target.h (Target::is_defined_by_abi): Make parameter const.
9008         (Target::do_is_defined_by_abi): Likewise.
9009         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9010         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9011         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9012         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9013         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9014         * testsuite/Makefile.in: Rebuild.
9015
9016         * fileread.cc (make_view): Add casts to avoid warning.
9017
9018 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9019
9020         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9021         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9022
9023 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
9024
9025         * options.h (General_options::output_is_executable): New.
9026         (General_options::output_is_pie): New.
9027         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9028         for shared libraries.
9029         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9030
9031 2008-09-11  Chris Demetriou  <cgd@google.com>
9032
9033         * options.h (origin): New -z option.
9034         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9035         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9036         in DT_FLAGS_1.
9037
9038 2008-09-05  Cary Coutant  <ccoutant@google.com>
9039
9040         * fileread.cc (File_read::make_view): Add check for attempt to map
9041         beyond end of file.
9042
9043 2008-09-05  Cary Coutant  <ccoutant@google.com>
9044
9045         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9046         explicit instantiations.
9047
9048 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
9049
9050         PR gold/6858
9051         * options.cc (General_options::finalize): Allow undefined symbols
9052         in shlibs if linking -shared.
9053
9054         PR gold/6859
9055         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9056         symbols as not needing a dynsym entry.
9057
9058 2008-08-20  Craig Silverstein  <csilvers@google.com>
9059
9060         * fileread.cc (File_read::open): Do not lock the file unless it
9061         was successfully opened.
9062
9063 2008-08-14  Cary Coutant  <ccoutant@google.com>
9064
9065         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9066         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9067         * testsuite/tls_test.cc (struct int128): 128-bit struct
9068         for testing TLS relocs with non-zero addend.
9069         (v12): New TLS variable.
9070         (t12): New test.
9071         (t_last): Add check for v12.
9072         * testsuite/tls_test.h (t12): New function.
9073         * testsuite/tls_test_main.cc (thread_routine): Call new test.
9074
9075 2008-08-13  Ian Lance Taylor  <iant@google.com>
9076
9077         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9078         set tls_segment_ or relro_segment_.
9079         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9080         when appropriate.
9081         * output.h (Output_section::clear_is_relro): New function.
9082         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9083         sections specially even when output_data_ is empty.
9084         (Output_segment::maximum_alignment): When first section is relro,
9085         only force alignment for PT_LOAD segments.
9086         * script.cc (script_data_segment_align): New function.
9087         (script_data_segment_relro_end): New function.
9088         * script-c.h (script_data_segment_align): Declare.
9089         (script_data_segment_relro_end): Declare.
9090         * script-sections.h (class Script_sections): Declare
9091         data_segment_align and data_segment_relro_end.  Add fields
9092         segment_align_index_ and saw_relro_end_.
9093         * script-sections.cc (class Sections_element): Add set_is_relro
9094         virtual function.  Add new bool* parameter to place_orphan_here.
9095         Add get_output_section virtual function.
9096         (class Output_section_definition): Add set_is_relro.  Add new
9097         bool* parameter to place_orphan_here.  Add get_output_section.
9098         Add is_relro_ field.
9099         (Output_section_definition::Output_section_definition): Initialize
9100         evaluated_address_, evaluated_load_address, evaluated_addralign_,
9101         and is_relro_ fields.
9102         (Output_section_definition::place_orphan_here): Add is_relro
9103         parameter.
9104         (Output_section_definition::set_section_addresses): Set relro for
9105         output section.
9106         (Output_section_definition::alternate_constraint): Likewise.
9107         (class Orphan_output_section): Add new bool* parameter to
9108         place_orphan_here.  Add get_output_section.
9109         (Orphan_output_section::place_orphan_here): Add is_relro
9110         parameter.
9111         (Script_sections::Script_sections): Initialize
9112         data_segment_align_index_ and saw_relro_end_.
9113         (Script_sections::data_segment_align): New function.
9114         (Script_sections::data_segment_relro_end): New function.
9115         (Script_sections::place_orphan): Set or clear is_relro.
9116         (Script_sections::set_section_addresses): Force alignment of first
9117         TLS section.
9118         * yyscript.y (exp): Call script_data_segment_align and
9119         script_data_segment_relro_end.
9120         * testsuite/relro_script_test.t: New file.
9121         * testsuite/relro_test.cc (using_script): Declare.
9122         (t1, t2): Test using_script.
9123         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9124         (relro_script_test_SOURCES): Define.
9125         (relro_script_test_DEPENDENCIES): Define.
9126         (relro_script_test_LDFLAGS): Define.
9127         (relro_script_test_LDADD): Define.
9128         (relro_script_test.so): New target.
9129         * testsuite/Makefile.in: Rebuild.
9130
9131 2008-08-06  Cary Coutant <ccoutant@google.com>
9132
9133         * archive.cc (Archive::total_archives, Archive::total_members)
9134         (Archive::total_members_loaded): New variables.
9135         (Archive::setup): Add parameter.  Add option to preread
9136         archive symbols.
9137         (Archive::read_armap): Add counter.
9138         (Archive::get_file_and_offset): New function.
9139         (Archive::get_elf_object_for_member): New function.
9140         (Archive::read_all_symbols): New function.
9141         (Archive::read_symbols): New function.
9142         (Archive::add_symbols): Add counters.
9143         (Archive::include_all_members): Use armap to find members if it's
9144         already built.
9145         (Archive::include_member): Skip reading symbols if already read.
9146         Factored code into Archive::get_file_and_offset and
9147         Archive::get_elf_object_for_member.  Changed call to
9148         Mapfile::report_include_archive_member.
9149         (Archive::print_stats): New function.
9150         * archive.h: Declare Object and Read_symbols_data classes.
9151         (Archive::Archive): Add initializers for new members.
9152         (Archive::setup): Add parameter.
9153         (Archive::print_stats): New function.
9154         (Archive::total_archives, Archive::total_members)
9155         (Archive::total_members_loaded): New variables.
9156         (Archive::get_file_and_offset): New function.
9157         (Archive::get_elf_object_for_member): New function.
9158         (Archive::read_all_symbols): New function.
9159         (Archive::read_symbols): New function.
9160         (Archive::Archive_member): New class.
9161         (Archive::members_): New member.
9162         (Archive::num_members_): New member.
9163         * main.cc: Include archive.h.
9164         (main): Call Archive::print_stats.
9165         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9166         archive parameter; member_name is now the fully-decorated name.
9167         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9168         * options.h: (General_options): Add --preread-archive-symbols option.
9169         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9170         Archive::setup.
9171
9172 2008-08-04  Ian Lance Taylor  <iant@google.com>
9173
9174         * symtab.h (Symbol::use_plt_offset): New function.
9175         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9176         * powerpc.cc (Relocate::relocate): Likewise.
9177         * sparc.cc (Relocate::relocate): Likewise.
9178         * x86_64.cc (Relocate::relocate): Likewise.
9179         * testsuite/weak_plt.sh: New test.
9180         * testsuite/weak_plt_main.cc: New test.
9181         * testsuite/weak_plt_shared.cc: New test.
9182         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9183         (check_PROGRAMS): Add weak_plt.
9184         (check_DATA): Add weak_plt_shared.so.
9185         (weak_plt_main_pic.o, weak_plt): New targets.
9186         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9187         * testsuite/Makefile.in: Rebuild.
9188
9189         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9190         gcctestdir/ld.
9191         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9192         * testsuite/Makefile.in: Rebuild.
9193
9194 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9195
9196         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9197         * Makefile.in: Regenerate.
9198         * po/POTFILES.in: Regenerate.
9199
9200 2008-07-29  Ian Lance Taylor  <iant@google.com>
9201
9202         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9203         symbols before other symbols.
9204         * testsuite/script_test_2.cc (test_addr): Declare.
9205         (test_addr_alias): Declare.
9206         (main): Check that test_addr and test_addr_alias have the right
9207         values.
9208         * testsuite/script_test_2.t: Define test_addr_alias and
9209         test_addr.
9210
9211 2008-07-24  Ian Lance Taylor  <iant@google.com>
9212
9213         PR 5990
9214         * descriptors.cc: New file.
9215         * descriptors.h: New file.
9216         * gold-threads.h (class Hold_optional_lock): New class.
9217         * fileread.cc: Include "descriptors.h".
9218         (File_read::~File_read): Release descriptor rather than closing
9219         it.
9220         (File_read::open) [file]: Call open_descriptor rather than open.
9221         Set is_descriptor_opened_.
9222         (File_read::open) [memory]: Assert that descriptor is not open.
9223         (File_read::reopen_descriptor): New function.
9224         (File_read::release): Release descriptor.
9225         (File_read::do_read): Make non-const.  Reopen descriptor.
9226         (File_read::read): Make non-const.
9227         (File_read::make_view): Reopen descriptor.
9228         (File_read::do_readv): Likewise.
9229         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9230         Update declarations.
9231         * layout.cc: Include "descriptors.h".
9232         (Layout::create_build_id): Use open_descriptor rather than open.
9233         * output.cc: Include "descriptors.h".
9234         (Output_file::open): Use open_descriptor rather than open.
9235         * archive.cc (Archive::const_iterator): Change Archive to be
9236         non-const.
9237         (Archive::begin, Archive::end): Make non-const.
9238         (Archive::count_members): Likewise.
9239         * archive.h (class Archive): Update declarations.
9240         * object.h (Object::read): Make non-const.
9241         * Makefile.am (CCFILES): Add descriptors.cc.
9242         (HFILES): Add descriptors.h.
9243         * Makefile.in: Rebuild.
9244
9245         PR 6716
9246         * gold.h: Always include <clocale>.  Add Solaris workarounds
9247         following code in binutils/sysdep.h.
9248
9249         PR 6048
9250         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9251         this->eh_frame_hdr_ is NULL before using it.
9252
9253         * dynobj.cc (Versions::Versions): Update comment.
9254
9255         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9256         the base version name.
9257
9258         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9259         array size plus one.
9260         (Stringpool_template::set_string_offsets): Subtract one from key
9261         before using it as an array index.
9262         (Stringpool_template::get_offset_with_length): Likewise.
9263         (Stringpool_template::write_to_buffer): Likewise.
9264         * stringpool.h (Stringpool_template::get_offset_from_key):
9265         Likewise.
9266
9267 2008-07-23  Ian Lance Taylor  <iant@google.com>
9268
9269         PR 6658
9270         * object.h (Merged_symbol_value::value): Do our best to handle a
9271         negative addend.
9272
9273         PR 6647
9274         * script.cc (Version_script_info::get_versions): Don't add empty
9275         version tag to return value.
9276         (Version_script_info::get_symbol_version_helper): Change return
9277         type to bool.  Add pversion parameter.  Change all callers.
9278         (script_register_vers_node): Don't require a non-NULL tag.
9279         * script.h (class Version_script_info): Update declarations.
9280         (Version_script_info::get_symbol_version): Change return type to
9281         bool.  Add version parameter.  Change all callers.
9282         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9283         handling.  Handle an empty version from a version script.
9284         (Symbol_table::define_special_symbol): Likewise.
9285         * testsuite/ver_test_10.script: New file.
9286         * testsuite/ver_test_10.sh: New file.
9287         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9288         (check_DATA): Add ver_test_10.syms.
9289         (ver_test_10.syms, ver_test_10.so): New target.
9290         * testsuite/Makefile.in: Rebuild.
9291
9292 2008-07-23  Simon Baldwin  <simonb@google.com>
9293
9294         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9295         to zero for undefined symbols from dynamic libraries.
9296
9297 2008-07-23  Ian Lance Taylor  <iant@google.com>
9298
9299         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9300         Change all callers.
9301         * symtab.h (class Symbol_table): Update declaration.
9302         * testsuite/ver_test_9.cc: New file.
9303         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9304         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9305         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9306         (ver_test_9.so, ver_test_9.o): New targets.
9307         * testsuite/Makefile.in: Rebuild.
9308
9309 2008-07-22  Ian Lance Taylor  <iant@google.com>
9310
9311         * options.h (class General_options): Define --check-sections.
9312         * layout.cc (Layout::set_segment_offsets): Handle
9313         --check-sections.
9314
9315         * options.h (class General_options): Define -n/--nmagic and
9316         -N/--omagic.
9317         * options.cc (General_options::finalize): For -n/--nmagic or
9318         -N/--omagic, set -static.
9319         * layout.cc (Layout::attach_allocated_section_to_segment): If
9320         -N/--omagic, don't put read-only and read-write sections in
9321         different segments.
9322         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9323         finding a read-only segment.
9324         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9325         don't set the minimum segment alignment to the common page size,
9326         and don't set the file offset to the address modulo the page size.
9327         * script-sections.cc (Script_sections::create_segments): If
9328         -n/--omagic, don't put read-only and read-write sections in
9329         different segments.
9330
9331         * cref.cc: New file.
9332         * cref.h: New file.
9333         * options.h (class General_options): Add --print-symbol-counts.
9334         * main.cc (main): Issue defined symbol report if requested.
9335         * archive.cc (Archive::interpret_header): Make into a const member
9336         function.
9337         (Archive::add_symbols): Call Input_objects::archive_start and
9338         archive_stop.
9339         (Archive::const_iterator): Define new class.
9340         (Archive::begin, Archive::end): New functions.
9341         (Archive::include_all_members): Rewrite to use iterator.
9342         (Archive::count_members): New function.
9343         * archive.h (class Archive): Update declarations.
9344         (Archive::filename): New function.
9345         * object.cc: Include "cref.h".
9346         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9347         (Sized_relobj::do_get_global_symbol_counts): New function.
9348         (Input_objects::add_object): Add object to cross-referencer.
9349         (Input_objects::archive_start): New function.
9350         (Input_objects::archive_stop): New function.
9351         (Input_objects::print_symbol_counts): New function.
9352         * object.h: Declare Cref and Archive.
9353         (Object::get_global_symbol_counts): New function.
9354         (Object::do_get_global_symbol_counts): New pure virtual function.
9355         (class Sized_relobj): Add defined_count_ field.  Update
9356         declarations.
9357         (class Input_objects): Add cref_ field.  Update constructor.
9358         Update declarations.
9359         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9360         defined_count_.
9361         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9362         symbol counts.
9363         (Sized_dynobj::do_get_global_symbol_counts): New function.
9364         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9365         defined_count_.  Update declarations.  Define Symbols typedef.
9366         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9367         parameter.  Change all callers.
9368         (Symbol_table::add_from_dynobj): Add sympointers and defined
9369         parameters.  Change all callers.
9370         * symtab.h (class Symbol_table): Update declarations.
9371         * Makefile.am (CCFILES): Add cref.cc.
9372         (HFILES): Add cref.h.
9373         * Makefile.in: Rebuild.
9374
9375 2008-07-22  Simon Baldwin  <simonb@google.com>
9376
9377         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9378         to zero when writing undefined symbols.
9379
9380 2008-07-22  Ian Lance Taylor  <iant@google.com>
9381
9382         * output.cc (Output_section::add_input_section): Don't try to
9383         merge empty merge sections.
9384
9385 2008-07-21  Craig Silverstein  <csilvers@google.com>
9386
9387         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9388         Include symbol version in error message.
9389
9390 2008-07-20  Chris Demetriou  <cgd@google.com>
9391
9392         * configure.ac (gold_cv_c_random_seed): New configured variable.
9393         (RANDOM_SEED_CFLAGS): New substituted variable.
9394         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9395         * configure: Rebuild.
9396         * Makefile.in: Likewise.
9397         * testsuite/Makefile.in: Likewise.
9398
9399 2008-07-18  Ian Lance Taylor  <iant@google.com>
9400
9401         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9402         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9403         * testsuite/ver_test_main.cc (main): Call t4.
9404         (t4, t4_2a): Define.
9405         * testsuite/ver_test_2.cc (t4_2): Define.
9406         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9407         * testsuite/ver_test_4.cc (t4_2a): Define.
9408         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9409         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9410
9411 2008-07-17  Ian Lance Taylor  <iant@google.com>
9412
9413         * dynobj.cc (Versions::add_def): If we give an error about a
9414         missing version, go ahead and create the version anyhow.
9415
9416 2008-07-10  Ian Lance Taylor  <iant@google.com>
9417
9418         Handle output sections with more than 0x7fffffff bytes.
9419         * object.h (class Relobj): Change map_to_output_ to
9420         output_sections_, and just keep a section pointer.  Change all
9421         uses.  Move comdat group support to Sized_relobj.
9422         (Relobj::is_section_specially_mapped): Remove.
9423         (Relobj::output_section): Remove poff parameter.  Change all
9424         callers.
9425         (Relobj::output_section_offset): New function.
9426         (Relobj::set_section_offset): Rewrite.
9427         (Relobj::map_to_output): Remove.
9428         (Relobj::output_sections): New function.
9429         (Relobj::do_output_section_offset): New pure virtual function.
9430         (Relobj::do_set_section_offset): Likewise.
9431         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9432         group support from Relobj.  Update declarations.
9433         (Sized_relobj::get_output_section_offset): New function.
9434         (Sized_relobj::do_output_section_offset): New function.
9435         (Sized_relobj::do_set_section_offset): New function.
9436         * object.cc (Relobj::output_section_address): Remove.
9437         (Sized_relobj::Sized_relobj): Initialize new fields.
9438         (Sized_relobj::include_section_group): Cast find_kept_object to
9439         Sized_relobj.
9440         (Sized_relobj::include_linkonce_section): Likewise.
9441         (Sized_relobj::do_layout): Use separate arrays for output section
9442         and output offset.
9443         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9444         output_sections.
9445         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9446         output_sections and section_offsets.
9447         (Sized_relobj::write_local_symbols): Likewise.
9448         (map_to_kept_section): Compute output address directly.
9449         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9450         output_sections and section_offsets.
9451         (Sized_relobj::write_sections): Likewise.
9452         (Sized_relobj::relocate_sections): Likewise.
9453         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9454         * output.h (class Output_reloc): Update declarations.  Change
9455         u2_.relobj to Sized_relobj*.
9456         (class Output_data_reloc): Change add functions to use
9457         Sized_relobj*.
9458         * output.cc (Output_reloc::Output_reloc): Change relobj to
9459         Sized_relobj*.
9460         (Output_reloc::local_section_offset): Change return type to
9461         Elf_Addr.  Use get_output_section_offset.
9462         (Output_reloc::get_address): Likewise.
9463         (Output_section::is_input_address_mapped): Don't call
9464         is_section_specially_mapped.
9465         (Output_section::output_offset): Likewise.
9466         (Output_section::output_address): Likewise.
9467         (Output_section::starting_output_address): Likewise.
9468         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9469         parameter to Sized_relobj*.
9470         (Copy_relocs::need_copy_reloc): Likewise.
9471         (Copy_relocs::save): Likewise.
9472         * copy-relocs.h (class Copy_relocs): Update declarations.
9473         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9474         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9475         * target-reloc.h (relocate_for_relocatable): Change
9476         offset_in_output_section type to Elf_Addr.  Change code that uses
9477         it as well.
9478         * layout.cc (Layout::layout): Always set *off.
9479         * mapfile.cc (Mapfile::print_input_section): Use
9480         output_section_offset.
9481         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9482         Sized_relobj*.
9483         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9484         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9485         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9486
9487 2008-07-03  Ian Lance Taylor  <iant@google.com>
9488
9489         * layout.cc (Layout::include_section): Do not discard unrecognized
9490         SHT_STRTAB sections.
9491
9492 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9493
9494         * script.cc (Lex::can_continue_name): Make '?' allowable in
9495         version-script names.
9496         * testsuite/version_script.map: Change glob pattern to use '?'
9497
9498 2008-06-30  Manish Singh  <yosh@gimp.org>
9499
9500         PR 6585
9501         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9502         Correct typo.
9503
9504 2008-06-30  Ian Lance Taylor  <iant@google.com>
9505
9506         PR 6660
9507         PR 6682
9508         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9509         versions]: Don't try to read the value in the contents, since we
9510         don't use it.  Use the template endianness when writing.
9511
9512 2008-06-25  Cary Coutant  <ccoutant@google.com>
9513
9514         * fileread.cc (File_read::make_view): Assert on zero-length view.
9515         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9516         symbol table when there are no symbols to read.
9517
9518 2008-06-23  Craig Silverstein  <csilvers@google.com>
9519
9520         * version.cc (version_string): Bump to 1.7
9521
9522 2008-06-18  Craig Silverstein  <csilvers@google.com>
9523
9524         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9525         constant 0xFFFF to type Valtype.
9526         (Powerpc_relocate_functions::rel16_ha): Likewise.
9527
9528 2008-06-17  Ian Lance Taylor  <iant@google.com>
9529
9530         * output.h (Output_section::Input_section): Initialize p2align_ to
9531         zero for Output_section_data constructors.
9532         (Output_section::Input_section::addralign): If not an input
9533         section, return the alignment of the Output_section_data.
9534         * testsuite/copy_test.cc: New file.
9535         * testsuite/copy_test_1.cc: New file.
9536         * testsuite/copy_test_2.cc: New file.
9537         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9538         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9539         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9540         (copy_test_1_pic.o, copy_test_1.so): New targets.
9541         (copy_test_2_pic.o, copy_test_2.so): New targets.
9542         * testsuite/Makefile.in: Rebuild.
9543
9544         * script-sections.cc (Script_sections::place_orphan): Initialize
9545         local variable exact.
9546
9547 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9548
9549         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9550
9551 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9552             David S. Miller  <davem@davemloft.net>
9553
9554         * powerpc.cc: New file.
9555         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9556         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9557         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9558         * Makefile.in: Rebuild.
9559
9560 2008-06-09  Ian Lance Taylor  <iant@google.com>
9561
9562         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9563         <exception>.
9564         (throwing, orig_terminate): New static variables.
9565         (terminate_handler): New static function.
9566         (t2): Set terminate handler.
9567
9568 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9569
9570         PR 6584
9571         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9572         alignment.
9573
9574 2008-05-30  Cary Coutant  <ccoutant@google.com>
9575
9576         * archive.cc (Archive::include_all_members) Correct to step
9577         over symbol table and extended name table in thin archives.
9578
9579 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9580
9581         PR 6407
9582         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9583         calculation.
9584
9585 2008-05-28  Caleb Howe  <cshowe@google.com>
9586
9587         * reduced_debug_output.cc: New file.
9588         * reduced_debug_output.h: New file.
9589         * options.h (class General_options): Add --strip-debug-non-line.
9590         * options.cc (General_options::finalize): Add strip_debug_non_line
9591         to the strip heirarchy.
9592         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9593         fields.
9594         * layout.cc: Include "reduced_debug_output.h".
9595         (Layout::Layout): Initialize new fields.
9596         (line_only_debug_sections): New static array.
9597         (is_lines_only_debug_sections): New static inline function.
9598         (Layout::include_section): Handle --strip-debug-non-line.
9599         (Layout::make_output_section): If --strip-debug-non-line, build
9600         new output sections for .debug_abbrev and .debug_info.
9601         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9602         gold.  Warn about possible overflow.
9603         (read_signed_LEB_128): Likewise.
9604         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9605         (read_signed_LEB_128): Declare.
9606         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9607         (HFILES): Add reduced_debug_output.h.
9608         * Makefile.in: Rebuild.
9609
9610 2008-05-21  Ian Lance Taylor  <iant@google.com>
9611
9612         * mapfile.cc: New file.
9613         * mapfile.h: New file.
9614         * options.h (class General_options): Add -M/--print-map and -Map.
9615         * options.cc (General_options::finalize): Make -M equivalent to
9616         -Map -.
9617         * main.cc: Include <cstdio> and "mapfile.h".
9618         (main): Open mapfile if requested.
9619         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9620         constructor.  Change caller.
9621         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9622         (queue_middle_tasks): Likewise.
9623         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9624         declarations.
9625         * archive.cc: Include "mapfile.h".
9626         (Archive::add_symbols): Add mapfile parameter.  Change all
9627         callers.  Pass mapfile, symbol, and reason to include_member.
9628         (Archive::include_all_members): Add mapfile parameter.  Change all
9629         callers.
9630         (Archive::include_member): Add mapfile, sym, and why parameters.
9631         Change all callers.  Report inclusion to map file.
9632         * archive.h: Include "fileread.h".
9633         (class Archive): Update declarations.
9634         (Archive::file): New const method.
9635         (class Add_archive_symbols): Add mapfile_ field.  Update
9636         constructor.  Change all callers.
9637         * readsyms.h (class Read_symbols): Likewise.
9638         (class Finish_group): Likewise.
9639         (class Read_script): Likewise.
9640         * common.cc: Include "mapfile.h".
9641         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9642         all callers.
9643         (Symbol_table::do_allocate_commons): Likewise.
9644         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9645         symbol allocation to mapfile.
9646         * common.h (class Allocate_commons_task): Add mapfile_ field.
9647         Update constructor.  Change all callers.
9648         * symtab.h (class Symbol_table): Update declarations.
9649         * layout.cc: Include "mapfile.h".
9650         (Layout_task_runner::run): Print information to mapfile.
9651         (Layout::create_gold_note): Change Output_data_fixed_space to
9652         Output_data_zero_fill.
9653         (Layout::create_build_id): Likewise.
9654         (Layout::print_to_mapfile): New function.
9655         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9656         constructor.  Change caller.
9657         (class Layout): Declare print_to_mapfile.
9658         * output.cc (Output_section::Input_section::print_to_mapfile): New
9659         function.
9660         (Output_section::add_input_section): If producing a map, always
9661         add to input_sections_ list.
9662         (Output_section::do_print_to_mapfile): New function.
9663         (Output_segment::print_sections_to_mapfile): New function.
9664         (Output_segment::print_section_list_to_mapfile): New function.
9665         * output.h: Include "mapfile.h".
9666         (Output_data::print_to_mapfile): New function.
9667         (Output_data::do_print_to_mapfile): New virtual function.
9668         (Output_segment_headers::do_print_to_mapfile): New function.
9669         (Output_file_header::do_print_to_mapfile): New function.
9670         (Output_data_const::do_print_to_mapfile): New function.
9671         (class Output_data_const_buffer): Add map_name_ field.  Update
9672         constructor.  Change all callers.  Add do_print_to_mapfile
9673         function.
9674         (class Output_data_fixed_space): Likewise.
9675         (class Output_data_space): Likewise.
9676         (class Output_data_zero_fill): New class.
9677         (Output_data_strtab::do_print_to_mapfile): New function.
9678         (Output_data_reloc_base::do_print_to_mapfile): New function.
9679         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9680         (Output_data_group::do_print_to_mapfile): New function.
9681         (Output_data_got::do_print_to_mapfile): New function.
9682         (Output_data_dynamic::do_print_to_mapfile): New function.
9683         (Output_symtab_xindex::do_print_to_mapfile): New function.
9684         (class Output_section): Declare do_print_to_mapflie.  Declare
9685         print_to_mapfile in Input_section.
9686         (class Output_segment): Declare new functions.
9687         * object.h (Sized_relobj::symbol_count): New function.
9688         * script-sections.cc
9689         (Output_section_element_dot_assignment::set_section_addresses):
9690         Change Output_data_fixed_space to Output_data_zero_fill.
9691         (Output_data_expression::do_print_to_mapfile): New function.
9692         * script.cc (read_input_script): Add mapfile parameter.  Change
9693         all callers.
9694         * script.h (read_input_script): Update declaration.
9695         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9696         (Eh_frame::do_print_to_mapfile): New function.
9697         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9698         (Output_merge_string::do_print_to_mapfile): New function.
9699         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9700         function.
9701         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9702         function.
9703         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9704         function.
9705         * Makefile.am (CCFILES): Add mapfile.cc.
9706         (HFILES): Add mapfile.h.
9707         * Makefile.in: Rebuild.
9708
9709 2008-05-19  Ian Lance Taylor  <iant@google.com>
9710
9711         * options.h (class General_options): Add -z relro.
9712         * layout.cc (Layout::Layout): Initialize relro_segment_.
9713         (Layout::add_output_section_data): Return the output section.
9714         (Layout::make_output_section): Rcognize relro sections and mark
9715         them appropriately.
9716         (Layout::attach_allocated_section_to_segment): Put relro sections
9717         in a PT_GNU_RELRO segment.
9718         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9719         section as relro.
9720         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9721         PT_TLS segments.
9722         (Layout::linkonce_mapping): Map d.rel.ro.local to
9723         .data.rel.ro.local.
9724         (Layout::output_section_name): Us .data.rel.ro.local for any
9725         section which begins with that.
9726         * layout.h (class Layout): Update add_output_section_data
9727         declaration.  Add relro_segment_ field.
9728         * output.cc (Output_section::Output_section): Initialize is_relro_
9729         and is_relro_local_ fields.
9730         (Output_segment::add_output_section): Group relro sections.
9731         (Output_segment::is_first_section_relro): New function.
9732         (Output_segment::maximum_alignment): If there is a relro section,
9733         align the segment to the common page size.
9734         (Output_segment::set_section_addresses): Track whether we are
9735         looking at relro sections.  If the last section is a relro
9736         section, align to the common page size.
9737         (Output_segment::set_section_list_addresses): Add in_relro
9738         parameter.  Change all callers.  Align to the page size when
9739         moving from relro to non-relro section.
9740         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9741         segment.
9742         * output.h (class Output_section): Add is_relro_ and
9743         is_relro_local_ fields.
9744         (Output_section::is_relro): New function.
9745         (Output_section::set_is_relro): New function.
9746         (Output_section::is_relro_local): New function.
9747         (Output_section::set_is_relro_local): New function.
9748         (class Output_segment): Update declarations.
9749         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9750         * sparc.cc (Target_sparc::got_section): Likewise.
9751         * x86_64.cc (Target_x86_64::got_section): Likewise.
9752         * testsuite/relro_test_main.cc: New file.
9753         * testsuite/relro_test.cc: New file.
9754         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9755         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9756         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9757         (relro_test.so, relro_test_pic.o): New targets.
9758         * testsuite/Makefile.in: Rebuild.
9759
9760 2008-05-16  Ian Lance Taylor  <iant@google.com>
9761
9762         * output.cc (Output_segment::add_output_section): Remove front
9763         parameter.
9764         * output.h (class Output_segment): Remove
9765         add_initial_output_section and overloaded add_output_section.
9766         Update declaration of remaining add_output_section.
9767         * layout.cc (Layout::create_interp): Call add_output_section
9768         rather than add_initial_output_section.
9769         (Layout::finish_dynamic_section): Likewise.
9770
9771         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9772         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9773         know the dynamic type.
9774         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9775         field.  Initialize it in constructor.
9776         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9777         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9778         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9779         reloc.
9780
9781         * output.cc (Output_reloc::get_address): Change return type to
9782         Elf_Addr.
9783         * output.h (class Output_reloc): Update get_address declaration.
9784         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9785         for section addresses.
9786
9787 2008-05-09  Ian Lance Taylor  <iant@google.com>
9788
9789         PR 6493
9790         * gold.cc (gold_nomem): Use return value of write.
9791
9792 2008-05-08  Ian Lance Taylor  <iant@google.com>
9793
9794         * symtab.c (Symbol::init_base_output_data): Add version
9795         parameter.  Change all callers.
9796         (Symbol::init_base_output_segment): Likewise.
9797         (Symbol::init_base_constant): Likewise.
9798         (Symbol::init_base_undefined): Likewise.
9799         (Sized_symbol::init_output_data): Likewise.
9800         (Sized_symbol::init_output_segment): Likewise.
9801         (Sized_symbol::init_constant): Likewise.
9802         (Sized_symbol::init_undefined): Likewise.
9803         (Symbol_table::do_define_in_output_data): If the new symbol has a
9804         version, mark it as the default.
9805         (Symbol_table::do_define_in_output_segment): Likewise.
9806         (Symbol_table::do_define_as_constant): Likewise.
9807         * symtab.h (class Symbol): Update declarations.
9808         (class Sized_symbol): Likewise.
9809         * resolve.cc (Symbol::override_version): New function.
9810         (Symbol::override_base): Call override_version.
9811         (Symbol::override_base_with_special): Likewise.
9812         * testsuite/ver_script_8.script: New file.
9813         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9814         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9815         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9816         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9817
9818 2008-05-06  Ian Lance Taylor  <iant@google.com>
9819
9820         PR 6049
9821         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9822         functions.
9823         (class General_options): Remove existing --undefined, and add
9824         --no-undefined instead.  Add new --undefined as synonym for -u.
9825         * archive.cc (Archive::add_symbols): Check whether symbol was
9826         named with -u.
9827         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9828         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9829         all uses.  Add IS_UNDEFINED.  Update declarations to split
9830         different versions of init_base.  Declare init_base_undefined.
9831         (Symbol::is_defined): Handle IS_UNDEFINED.
9832         (Symbol::is_undefined): Likewise.
9833         (Symbol::is_weak_undefined): Call is_undefined.
9834         (Symbol::is_absolute): Handle IS_CONSTANT.
9835         (class Sized_symbol): Update declarations to split different
9836         versions of init.  Declare init_undefined.
9837         (class Symbol_table): Declare new functions.
9838         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9839         Change all callers.
9840         (Symbol::init_base_output_data): Likewise.
9841         (Symbol::init_base_output_segment): Likewise.
9842         (Symbol::init_base_constant): Likewise.
9843         (Symbol::init_base_undefined): New function.
9844         (Sized_symbol::init_object): Rename from init.  Change all
9845         callers.
9846         (Sized_symbol::init_output_data): Likewise.
9847         (Sized_symbol::init_output_segment): Likewise.
9848         (Sized_symbol::init_constant): Likewise.
9849         (Sized_symbol::init_undefined): New function.
9850         (Symbol_table::add_undefined_symbols_from_command_line): New
9851         function.
9852         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9853         function.
9854         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9855         (Symbol::output_section): Likewise.
9856         (Symbol::set_output_section): Likewise.
9857         (Symbol_table::sized_finalize_symbol): Likewise.
9858         (Symbol_table::sized_write_globals): Likewise.
9859         * resolve.cc (Symbol_table::should_override): Likewise.
9860         (Symbol::override_base_with_special): Likewise.
9861
9862         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9863         symbol, change it to have default visibility.
9864         * testsuite/protected_1.cc: New file.
9865         * testsuite/protected_2.cc: New file.
9866         * testsuite/protected_3.cc: New file.
9867         * testsuite/protected_main_1.cc: New file.
9868         * testsuite/protected_main_2.cc: New file.
9869         * testsuite/protected_main_3.cc: New file.
9870         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9871         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9872         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9873         (protected_1.so): New target.
9874         (protected_1_pic.o, protected_2_pic.o): New targets.
9875         (protected_3_pic.o): New target.
9876         (check_PROGRAMS): Add protected_2.
9877         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9878         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9879         * testsuite/Makefile.in: Rebuild.
9880
9881         * options.h (DEFINE_var): Add set_user_set_##varname__.
9882         (DEFINE_bool_alias): New macro.
9883         (class General_options): Define -Bstatic using DEFINE_bool_alias
9884         rather than DEFINE_special.  Add --undefined as an alias for -z
9885         defs.
9886         * options.cc (General_options::parse_Bstatic): Remove.
9887
9888         * options.h (class General_options): Add --fatal-warnings.
9889         * main.cc (main): Implement --fatal-warnings.
9890         * errors.h (Errors::warning_count): New function.
9891
9892         * options.h (class General_options): Add -Bsymbolic-functions.
9893         * symtab.h (Symbol::is_preemptible): Check for
9894         -Bsymbolic-functions.
9895
9896 2008-05-05  Ian Lance Taylor  <iant@google.com>
9897
9898         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9899         as noVARNAME rather than no-VARNAME.
9900         (class General_options): Add option -z combreloc.
9901         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9902         get_address.
9903         (Output_reloc::sort_before) [SHT_REL]: New function.
9904         (Output_reloc::sort_before) [SHT_RELA]: New function.
9905         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9906         Sort_relocs_comparison.
9907         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9908         parameter.  Change all callers.
9909         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9910         sort_relocs parameter.  Change all callers.
9911         * output.cc (Output_reloc::get_address): New function, broken out
9912         of write_rel.
9913         (Output_reloc::write_rel): Call it.
9914         (Output_reloc::compare): New function.
9915         (Output_data_reloc_base::do_write): Optionally sort relocs.
9916
9917         * configure.ac: If targ_extra_obj is set, link it in.
9918         * configure.tgt: Initialize all variables.
9919         (x86_64*): Set targ_extra_obj and targ_extra_size.
9920         * configure: Rebuild.
9921
9922         * object.cc (Sized_relobj::include_section_group): Adjust section
9923         indexes read from group data.  Build vector to pass to
9924         layout_group.
9925         * layout.cc (Layout::layout_group): Add flags and shndxes
9926         parameters.  Remove contents parameter.  Change caller.  Update
9927         explicit instantiations.
9928         * layout.h (class Layout): Update layout_group declaration.
9929         * output.cc (Output_data_group::Output_data_group): Add flags and
9930         input_shndxes parameters.  Remove contents parameter.  Change
9931         caller.
9932         (Output_data_group::do_write): Change input_sections_ to
9933         input_shndxes_.
9934         * output.h (class Output_data_group): Update constructor
9935         declaration.  Rename input_sections_ to input_shndxes_.
9936         * testsuite/many_sections_test.cc: Add template.
9937
9938 2008-04-30  Cary Coutant  <ccoutant@google.com>
9939
9940         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9941
9942         * layout.cc (Layout::include_section): Refactored check for debug
9943         info section.
9944         (Layout::add_comdat): Add new parameters.  Change type
9945         of signature parameter.  Add object and shndx to signatures table.
9946         (Layout::find_kept_object): New function.
9947         * layout.h: Include <cstring>.
9948         (Layout::is_debug_info_section): New function.
9949         (Layout::add_comdat): Add new parameters.
9950         (Layout::find_kept_object): New function.
9951         (Layout::Kept_section): New struct.
9952         (Layout::Signatures): Change type of map range.
9953         * object.cc (Relobj::output_section_address): New function.
9954         (Sized_relobj::include_section_group): Add new parameters.  Change
9955         calls to Layout::add_comdat.  Change to build table of kept comdat
9956         groups and table mapping discarded sections to kept sections.
9957         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9958         (Sized_relobj::do_layout): Change calls to include_section_group and
9959         include_linkonce_section.
9960         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9961         value to zero when section is discarded.
9962         (Sized_relobj::map_to_kept_section): New function.
9963         * object.h (Relobj::output_section_address): New function.
9964         (Relobj::Comdat_group): New type.
9965         (Relobj::find_comdat_group): New function.
9966         (Relobj::Comdat_group_table): New type.
9967         (Relobj::Kept_comdat_section): New type.
9968         (Relobj::Kept_comdat_section_table): New type.
9969         (Relobj::add_comdat_group): New function.
9970         (Relobj::set_kept_comdat_section): New function.
9971         (Relobj::get_kept_comdat_section): New function.
9972         (Relobj::comdat_groups_): New field.
9973         (Relobj::kept_comdat_sections_): New field.
9974         (Symbol_value::input_value): Update comment.
9975         (Sized_relobj::map_to_kept_section) New function.
9976         (Sized_relobj::include_linkonce_section): Add new parameter.
9977         * target-reloc.h (Comdat_behavior): New type.
9978         (get_comdat_behavior): New function.
9979         (relocate_section): Add code to map a discarded section to the
9980         corresponding kept section when applying a relocation.
9981
9982 2008-04-30  Craig Silverstein  <csilvers@google.com>
9983
9984         * dwarf_reader.cc (next_generation_count): New static var.
9985         (Addr2line_cache_entry): New struct.
9986         (addr2line_cache): New static var.
9987         (Dwarf_line_info::one_addr2line): Added caching.
9988         (Dwarf_line_info::clear_addr2line_cache): New function.
9989         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9990         cache-size parameter.
9991         (Dwarf_line_info::one_addr2line_cache): New function.
9992         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9993         new cache-size argument to one_addr2line(), and clear cache.
9994
9995 2008-04-28  Cary Coutant  <ccoutant@google.com>
9996
9997         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9998         R_386_PC8 relocations.
9999
10000 2008-04-23  Ian Lance Taylor  <iant@google.com>
10001
10002         * object.cc (Sized_relobj::include_section_group): Check for
10003         invalid section group.
10004
10005         * object.cc (make_elf_object): Correct test for 64-bit ELF file
10006         header size.
10007
10008         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10009         than read for file header.
10010         * archive.cc (Archive::include_member): Likewise.
10011
10012 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
10013
10014         * aclocal.m4: Regenerate.
10015         * configure: Regenerate.
10016
10017 2008-04-19  Ian Lance Taylor  <iant@google.com>
10018
10019         * version.cc (version_string): Bump to 1.6.
10020
10021         * testsuite/Makefile.am (many_sections_r_test): New target.
10022         (many_sections_r_test_SOURCES): Remove.
10023         (many_sections_r_test_DEPENDENCIES): Remove.
10024         (many_sections_r_test_LDFLAGS): Remove.
10025         (many_sections_r_test_LDADD): Remove.
10026
10027         * object.cc (Sized_relobj::do_add_symbols): Always pass
10028         local_symbol_count_ to add_from_relobj.
10029
10030         * testsuite/Makefile.am (many_sections_check.h): Only check one in
10031         every thousand variables.
10032         * testsuite/Makefile.in: Rebuild.
10033
10034         * object.cc (Xindex::initialize_symtab_xindex): New function.
10035         (Xindex::read_symtab_xindex): New function.
10036         (Xindex::sym_xindex_to_shndx): New function.
10037         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10038         available.
10039         (Sized_relobj::do_initialize_xindex): New function.
10040         (Sized_relobj::do_read_symbols): Adjust section links.
10041         (Sized_relobj::symbol_section_and_value): Add is_ordinary
10042         parameter.  Change all callers.
10043         (Sized_relobj::include_section_group): Adjust section links and
10044         symbol section indexes.
10045         (Sized_relobj::do_layout): Adjust section links.
10046         (Sized_relobj::do_count_local_symbols): Adjust section links and
10047         symbol section indexes.
10048         (Sized_relobj::do_finalize_local_symbols): Distinguish between
10049         ordinary and special symbols.
10050         (Sized_relobj::write_local_symbols): Add symtab_xindex and
10051         dynsym_xindex parameters.  Change all callers.  Adjust section
10052         links.  Use SHN_XINDEX when needed.
10053         (Sized_relobj::get_symbol_location_info): Adjust section links.
10054         Don't get fooled by special symbols.
10055         * object.h (class Xindex): Define.
10056         (class Object): Add xindex_ parameter.  Declare virtual functoin
10057         do_initialize_xindex.
10058         (Object::adjust_sym_shndx): New function.
10059         (Object::set_xindex): New protected function.
10060         (class Symbol_value): Add is_ordinary_shndx_ field.
10061         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10062         (Symbol_value::value): Assert ordinary section.
10063         (Symbol_value::initialize_input_to_output_map): Likewise.
10064         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10065         Change all callers.
10066         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
10067         all callers.
10068         (class Sized_relobj): Update declarations.
10069         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10070         parameter.  Change all callers.
10071         (Sized_relobj::adjust_shndx): New function.
10072         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10073         field.
10074         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10075         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
10076         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
10077         (Sized_dynobj::read_dynsym_section): Adjust section links.
10078         (Sized_dynobj::read_dynamic): Likewise.
10079         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
10080         section links.
10081         (Sized_dynobj::do_initialize_xindex): New function.
10082         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
10083         do_initialize_xindex.
10084         (Sized_dynobj::adjust_shndx): New function.
10085         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10086         dynsym_xindex_ fields.
10087         (Layout::finalize): Add a call to set_section_indexes before
10088         creating the symtab sections.
10089         (Layout::set_section_indexes): Don't do anything if the section
10090         already has a section index.
10091         (Layout::create_symtab_sections): Add shnum parameter.  Change
10092         caller.  Create .symtab_shndx section if needed.
10093         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
10094         caller.
10095         (Layout::allocated_output_section_count): New function.
10096         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10097         needed.
10098         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10099         fields.  Update declarations.
10100         (Layout::symtab_xindex): New function.
10101         (Layout::dynsym_xindex): New function.
10102         (class Write_symbols_task): Add layout_ field.
10103         (Write_symbols_task::Write_symbols_task): Add layout parameter.
10104         Change caller.
10105         * output.cc (Output_section_headers::Output_section_headers): Add
10106         shstrtab_section parameter.  Change all callers.
10107         (Output_section_headers::do_sized_write): Store overflow values
10108         for section count and section string table section index in
10109         section header zero.
10110         (Output_file_header::do_sized_write): Check for overflow of
10111         section count and section string table section index.
10112         (Output_symtab_xindex::do_write): New function.
10113         (Output_symtab_xindex::endian_do_write): New function.
10114         * output.h (class Output_section_headers): Add shstrtab_section_.
10115         Update declarations.
10116         (class Output_symtab_xindex): Define.
10117         (Output_section::has_out_shndx): New function.
10118         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10119         field.
10120         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10121         Change all callers.
10122         (Sized_symbol::init): Likewise.
10123         (Symbol::output_section): Check for ordinary symbol.
10124         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10125         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10126         callers.
10127         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10128         Change all callers.  Simplify handling of symbols from sections
10129         not included in the link.
10130         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10131         distinction.
10132         (Weak_alias_sorter::operator()): Assert that symbols are
10133         ordinary.
10134         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10135         distinction.
10136         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10137         parameters.  Change all callers.
10138         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10139         symbol distinction.  Use SHN_XINDEX when needed.
10140         (Symbol_table::write_section_symbol): Add symtab_xindex
10141         parameter.  Change all callers.
10142         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10143         SHN_XINDEX when needed.
10144         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10145         declarations.
10146         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10147         (Symbol::is_defined): Check is_ordinary.
10148         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10149         (Symbol::is_absolute, Symbol::is_common): Likewise.
10150         (class Sized_symbol): Update declarations.
10151         (class Symbol_table): Update declarations.
10152         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10153         parameters.  Change all callers.
10154         (Sized_symbol::override): Likewise.
10155         (Symbol_table::override): Likewise.
10156         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10157         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10158         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10159         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10160         to be in an ordinary section.
10161         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10162         object and is_ordinary parameters.  Change all callers.
10163         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10164         Change all callers.  Don't add undefined or non-ordinary symbols
10165         to reloc_map_.
10166         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10167         Change all callers.
10168         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10169         declarations.
10170         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10171         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10172         (Sized_relobj::relocate_sections): Likewise.
10173         * target-reloc.h (scan_relocs): Adjust section symbol index.
10174         (scan_relocatable_relocs): Likewise.
10175         * i386.cc (Scan::local): Check for ordinary symbols.
10176         * sparc.cc (Scan::local): Likewise.
10177         * x86_64.cc (Scan::local): Likewise.
10178         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10179         to symbol_section_and_value.
10180         * testsuite/many_sections_test.cc: New file.
10181         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10182         (check_PROGRAMS): Add many_sections_test.
10183         (many_sections_test_SOURCES): Define.
10184         (many_sections_test_DEPENDENCIES): Define.
10185         (many_sections_test_LDFLAGS): Define.
10186         (BUILT_SOURCES): Add many_sections_define.h.
10187         (many_sections_define.h): New target.
10188         (BUILT_SOURCES): Add many_sections_check.h.
10189         (many_sections_check.h): New target.
10190         (check_PROGRAMS): Add many_sections_r_test.
10191         (many_sections_r_test_SOURCES): Define.
10192         (many_sections_r_test_DEPENDENCIES): Define.
10193         (many_sections_r_test_LDFLAGS): Define.
10194         (many_sections_r_test_LDADD): Define.
10195         (many_sections_r_test.o): New target.
10196         * testsuite/Makefile.in: Rebuild.
10197
10198 2008-04-17  Cary Coutant  <ccoutant@google.com>
10199
10200         * errors.cc (Errors::info): New function.
10201         (gold_info): New function.
10202         * errors.h (Errors::info): New function.
10203         * gold.h (gold_info): New function.
10204         * object.cc (Input_objects::add_object): Print trace output.
10205         * options.cc (options::parse_set): New function.
10206         (General_options::parse_wrap): Deleted.
10207         (General_options::General_options): Deleted initializer.
10208         * options.h (options::String_set): New typedef.
10209         (options::parse_set): New function.
10210         (DEFINE_set): New macro.
10211         (General_options::wrap): Changed to use DEFINE_set. Changed
10212         callers of any_wrap_symbols and is_wrap_symbol.
10213         (General_options::trace, General_options::trace_symbol):
10214         New options.
10215         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10216         (General_options::wrap_symbols_): Deleted.
10217         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10218
10219 2008-04-17  David S. Miller  <davem@davemloft.net>
10220
10221         * options.cc (General_options::parse_V): New function.
10222         * options.h: Add entries for -V and -Qy.
10223
10224 2008-04-17  Ian Lance Taylor  <iant@google.com>
10225
10226         * common.cc (Symbol_table::allocate_commons): Remove options
10227         parameter.  Change caller.
10228         (Symbol_table::do_allocate_commons): Remove options parameter.
10229         Change caller.  Just call do_allocate_commons_list twice.
10230         (Symbol_table::do_allocate_commons_list): New function, broken out
10231         of do_allocate_commons.
10232         * common.h (class Allocate_commons_task): Remove options_ field.
10233         Update constructor.
10234         * symtab.cc (Symbol_table::Symbol_table): Initialize
10235         tls_commons_.
10236         (Symbol_table::add_from_object): Put TLS common symbols on
10237         tls_commons_ list.
10238         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10239         which are IN_OUTPUT_DATA.
10240         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10241         allocate_commons and do_allocate_commons declarations.  Declare
10242         do_allocate_commons_list.
10243         * gold.cc (queue_middle_tasks): Update creation of
10244         Allocate_commons_task to not pass options.
10245         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10246         (TLS_TEST_C_FLAGS): New variable.
10247         (tls_test_c_pic.o): New target.
10248         (tls_test_shared.so): Link in tls_test_c_pic.o.
10249         (tls_test_c_pic_ie.o): New target.
10250         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10251         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10252         (tls_test_c.o): New target.
10253         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10254         (tls_pic_test_LDADD): Likewise.
10255         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10256         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10257         (tls_test_c_gnu2.o): New target.
10258         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10259         tls_test_c_gnu2.o.
10260         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10261         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10262         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10263         * testsuite/tls_test.cc: Include "config.h".
10264         (t_last): Call t11_last.
10265         * testsuite/tls_test.h (t11, t11_last): Declare.
10266         * testsuite/tls_test_c.c: New file.
10267         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10268         * configure.ac: Check for OpenMP support.
10269         * configure, config.in, Makefile.in: Rebuild.
10270         * testsuite/Makefile.in: Rebuild.
10271
10272 2008-04-16  Cary Coutant  <ccoutant@google.com>
10273
10274         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10275         (Target_i386::tls_base_symbol_defined_): New field.
10276         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10277         (Target_i386::Scan::global): Likewise.
10278         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10279         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10280         (Target_x86_64::tls_base_symbol_defined_): New field.
10281         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10282         (Target_x86_64::Scan::global): Likewise.
10283
10284 2008-04-16  Cary Coutant  <ccoutant@google.com>
10285
10286         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10287         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10288         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10289         building shared libraries.
10290         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10291         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10292         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10293         * testsuite/Makefile.in: Rebuild.
10294         * testsuite/weak_undef.h: New file.
10295         * testsuite/weak_undef_file1.cc: Add extra test cases.
10296         * testsuite/weak_undef_file2.cc: Likewise.
10297         * testsuite/weak_undef_test.cc: Likewise.
10298
10299 2008-04-16  David S. Miller  <davem@davemloft.net>
10300
10301         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10302         Add issued_non_pic_error_ field.  Declare check_non_pic.
10303         (Target_sparc::Scan::check_non_pic): New function.
10304         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10305         (Target_sparc::Scan::global): Likewise.
10306
10307         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10308         * configure: Rebuild.
10309
10310         * options.h (DEFINE_enable): New macro.
10311         (new_dtags): New enable option.
10312         (initfirst, interpose, loadfltr, nodefaultlib,
10313         nodelete, nodlopen, nodump): New -z options.
10314         * layout.cc (Layout:finish_dynamic_section): If new
10315         dtags enabled, emit DT_RUNPATH.  Also, emit a
10316         DT_FLAGS_1 containing any specified -z flags.
10317
10318 2008-04-16  Ian Lance Taylor  <iant@google.com>
10319
10320         * copy-relocs.cc: New file.
10321         * copy-relocs.h: New file.
10322         * reloc.cc: Remove Copy_relocs code.
10323         * reloc.h: Likewise.
10324         * reloc-types.h (struct Reloc_types) [both versions]: Add
10325         get_reloc_addend_noerror.
10326         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10327         variants of add_global which take an addend which must be zero.
10328         * i386.cc: Include "copy-relocs.h".
10329         (class Target_i386): Change type of copy_relocs_ to variable,
10330         update initializer.
10331         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10332         Change all callers.
10333         (Target_i386::do_finalize_sections): Change handling of
10334         copy_relocs_.
10335         * sparc.cc: Include "copy-relocs.h".
10336         (class Target_sparc): Change type of copy_relocs_ to variable,
10337         update initializer.
10338         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10339         Change all callers.
10340         (Target_sparc::do_finalize_sections): Change handling of
10341         copy_relocs_.
10342         * x86_64.cc: Include "copy-relocs.h".
10343         (class Target_x86_64): Change type of copy_relocs_ to variable,
10344         update initializer.
10345         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10346         class.  Change all callers.
10347         (Target_x86_64::do_finalize_sections): Change handling of
10348         copy_relocs_.
10349         * Makefile.am (CCFILES): Add copy-relocs.cc.
10350         (HFILES): Add copy-relocs.h.
10351
10352         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10353
10354         * testsuite/script_test_4.sh: Permit leading zeroes.
10355
10356 2008-04-15  Ian Lance Taylor  <iant@google.com>
10357
10358         * script-sections.cc (Script_sections::create_segments): Use
10359         header_size_adjustment even when there is enough room for the
10360         headers.
10361         * testsuite/script_test_4.sh: New file.
10362         * testsuite/script_test_4.t: New file.
10363         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10364         (check_DATA): Add script_test_4.stdout.
10365         (MOSTLYCLEANFILES): Likewise.
10366         (script_test_4): New target.
10367         (script_test_4.stdout): New target.
10368         * testsuite/Makefile.in: Rebuild.
10369
10370         * sparc.cc: Add definitions for Output_data_plt_sparc class
10371         constants.
10372
10373 2008-04-14  David S. Miller  <davem@davemloft.net>
10374
10375         * sparc.cc: New file.
10376         * Makefile.am (TARGETSOURCES): Add sparc.cc
10377         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10378         * configure.tgt: Document targ_extra_size and
10379         targ_extra_big_endian.  Add entries for sparc-* and
10380         sparc64-*.
10381         * configure.ac: Handle targ_extra_size and
10382         targ_extra_big_endian.
10383         * Makefile.in: Rebuild.
10384         * configure: Likewise.
10385         * po/POTFILES.in: Likewise.
10386         * po/gold.pot: Likewise.
10387
10388 2008-04-14  Ian Lance Taylor  <iant@google.com>
10389
10390         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10391         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10392         in the name/type/flags to section mapping.  Don't call
10393         allocate_output_section.
10394         (Layout::choose_output_section): Change parameter from adjust_name
10395         to is_input_section.  Don't permit input sections after sections
10396         are attached to segments.  Don't call allocate_output_section.
10397         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10398         not write_enable_output_section.
10399         (Layout::make_output_section): Don't push to
10400         unattached_section_list_ nor call attach_to_segment.  Call
10401         attach_section_to_segment if sections are attached.
10402         (Layout::attach_sections_to_segments): New function.
10403         (Layout::attach_section_to_segment): New function.
10404         (Layout::attach_allocated_section_to_segment): Rename from
10405         attach_to_segment.  Remove flags parameter.
10406         (Layout::allocate_output_section): Remove function.
10407         (Layout::write_enable_output_section): Remove function.
10408         * layout.h (class Layout): Update for above changes.  Add new
10409         field sections_are_attached_.
10410         * output.h (Output_section::update_flags_for_input_section): New
10411         function.
10412         * output.cc (Output_section::add_input_section): Call
10413         update_flags_for_input_section.
10414         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10415
10416 2008-04-11  Cary Coutant  <ccoutant@google.com>
10417
10418         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10419         thought unnecessary.
10420         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10421
10422 2008-04-11  Ian Lance Taylor  <iant@google.com>
10423
10424         * output.h (class Output_section_data): Remove inline definition
10425         of set_addralign.
10426         * output.cc (Output_section_data::set_addralign): New function.
10427
10428 2008-04-11  Cary Coutant  <ccoutant@google.com>
10429
10430         Add support for TLS descriptors for i386 and x86_64.
10431         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10432         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10433         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10434         GOT_TYPE_TLS_DESC.
10435         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10436         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10437         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10438         relocations.
10439         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10440         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10441         Fix problem with initial-exec relocations.
10442         (Target_i386::Relocate::relocate_tls): Likewise.
10443         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10444         relaxation.
10445         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10446         support for section-plus-offset dynamic table entries.
10447         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10448         (Output_data_dynamic::Dynamic_entry): Add support for
10449         section-plus-offset dynamic table entries.
10450         (Output_data_dynamic::Classification): Likewise.
10451         (Output_data_dynamic::classification_): Renamed offset_.
10452         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10453         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10454         (Target_x86_64::make_plt_section): New function.
10455         (Target_x86_64::reserve_tlsdesc_entries): New function.
10456         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10457         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10458         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10459         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10460         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10461         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10462         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10463         add extra PLT entry for TLS descriptors.
10464         (Output_data_plt_x86_64::got_): New field.
10465         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10466         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10467         fields.
10468         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10469         descriptors.
10470         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10471         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10472         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10473         R_386_TLS_DESC_CALL relocations.
10474         (Target_x86_64::Scan::global): Likewise.
10475         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10476         for TLS descriptors.
10477         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10478         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10479         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10480         GD-to-IE relaxation.
10481         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10482         and TLS_DESCRIPTORS.
10483         * Makefile.in: Rebuild.
10484         * configure: Rebuild.
10485         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10486         (tls_test_shared2.so): New target.
10487         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10488         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10489         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10490         (tls_shared_gd_to_ie_test_LDADD): New variable.
10491         (tls_shared_gnu2_gd_to_ie_test): New target.
10492         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10493         New targets.
10494         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10495         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10496         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10497         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10498         (tls_shared_gnu2_test): New target.
10499         (tls_test_gnu2_shared.so): New target.
10500         (tls_shared_gnu2_test_SOURCES): New variable.
10501         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10502         (tls_shared_gnu2_test_LDFLAGS): New variable.
10503         (tls_shared_gnu2_test_LDADD): New variable.
10504         * testsuite/Makefile.in: Rebuild.
10505         * testsuite/Makefile.
10506
10507 2008-04-11  Ian Lance Taylor  <iant@google.com>
10508
10509         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10510         justsyms.t.
10511         * testsuite/Makefile.in: Rebuild.
10512
10513         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10514         long.
10515         * testsuite/script_test_2.cc (main): Adjust test.
10516
10517 2008-04-11  David S. Miller  <davem@davemloft.net>
10518             Ian Lance Taylor  <iant@google.com>
10519
10520         * options.h (General_options): Add entries for '-Y' and
10521         '-relax'.
10522         * options.cc (General_options:finalize): If -Y was used, add those
10523         entries to the library path instead of the default "/lib" and
10524         "/usr/lib".
10525
10526 2008-04-11  David S. Miller  <davem@davemloft.net>
10527
10528         * testsuite/justsyms.t: Start at 0x100.
10529         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10530         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10531         long.
10532         * testsuite/script_test_2.cc: Adjust string and section length
10533         checks.
10534
10535 2008-04-09  Ian Lance Taylor  <iant@google.com>
10536
10537         PR gold/5996
10538         * script-sections.cc (Sections_element::allocate_to_segment): Add
10539         orphan parameter.
10540         (Output_section_definition::allocate_to_segment): Likewise.
10541         (Orphan_output_section::allocate_to_segment): Likewise.
10542         (Script_sections::attach_sections_using_phdrs_clause): Don't
10543         propagate non-PT_LOAD segments to orphan sections.
10544         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10545         readelf rather than objdump.
10546         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10547         .interp section and PT_INTERP segment are the same size.
10548         * testsuite/Makefile.in: Rebuild.
10549
10550         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10551         aliases for symbols defined in the same object.
10552         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10553         (weak_alias_test_SOURCES): New variable.
10554         (weak_alias_test_DEPENDENCIES): New variable.
10555         (weak_alias_test_LDFLAGS): New variable.
10556         (weak_alias_test_LDADD): New variable.
10557         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10558         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10559         (weak_alias_test_3.o): New target.
10560         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10561         * testsuite/weak_alias_test_main.cc: New file.
10562         * testsuite/weak_alias_test_1.cc: New file.
10563         * testsuite/weak_alias_test_2.cc: New file.
10564         * testsuite/weak_alias_test_3.cc: New file.
10565
10566 2008-04-08  Ian Lance Taylor  <iant@google.com>
10567
10568         * options.h (class General_options): Add --noinhibit-exec option.
10569         * main.cc (main): Check --noinhibit-exec.
10570
10571         * options.h (class General_options): Define --wrap as a special
10572         option.  Add wrap_symbols_ field.
10573         (General_options::any_wrap_symbols): New function.
10574         (General_options::is_wrap_symbol): New function.
10575         * options.cc (General_options::parse_wrap): New function.
10576         (General_options::General_options): Initialize wrap_symbols_.
10577         * symtab.cc (Symbol_table::wrap_symbol): New function.
10578         (Symbol_table::add_from_object): Handle --wrap.
10579         * symtab.h (class Symbol_table): Declare wrap_symbol.
10580         * target.h (Target::wrap_char): New function.
10581         (Target::Target_info): Add wrap_char field.
10582         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10583         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10584         * testsuite/testfile.cc (Target_test::test_target_info):
10585         Likewise.
10586
10587         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10588         there is one.
10589
10590         * layout.h (class Layout): Add added_eh_frame_data_ field.
10591         * layout.cc (Layout::Layout): Initialize new field.
10592         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10593         output section until we find a section we merged successfully.
10594         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10595         that the size be non-zero.
10596
10597         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10598         qualifier.
10599
10600 2008-04-08  Craig Silverstein  <csilvers@google.com>
10601
10602         * configure.ac: Export new conditional variable HAVE_ZLIB.
10603         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10604         on HAVE_ZLIB.
10605         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10606         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10607
10608 2008-04-07  Ian Lance Taylor  <iant@google.com>
10609
10610         * version.cc (version_string): Set to "1.5".
10611
10612         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10613         Add issued_non_pic_error_ field.  Declare check_non_pic.
10614         (Target_x86_64::Scan::check_non_pic): New function.
10615         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10616         (Target_x86_64::Scan::global): Likewise.
10617
10618         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10619         addend parameter.  Change caller.  Handle merge sections.
10620         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10621         Address to Addend.  Don't add in the result of
10622         local_section_offset, pass down the addend and use the returned
10623         value.
10624         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10625         Update declarations of local_section_offset and symbol_value.
10626         * testsuite/two_file_test_1.cc (t18): New function.
10627         * testsuite/two_file_test_2.cc (f18): New function.
10628         * testsuite/two_file_test_main.cc (main): Call t18.
10629         * testsuite/two_file_test.h (t18, f18): Declare.
10630
10631         * configure.ac: Don't test for objdump, c++filt, or readelf.
10632         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10633         conditionals.
10634         (TEST_READELF): New variable.
10635         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10636         (check_PROGRAMS): Add two_file_strip_test.
10637         (two_file_strip_test): New target.
10638         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10639         (two_file_same_shared_strip_test_SOURCES): New variable.
10640         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10641         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10642         (two_file_same_shared_strip_test_LDADD): New variable.
10643         (two_file_shared_strip.so): New target.
10644         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10645         (ver_test_5.syms, ver_test_7.syms): Likewise.
10646         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10647         (strip_test_3.stdout): Use TEST_OBJDUMP.
10648         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10649
10650 2008-04-04  Cary Coutant  <ccoutant@google.com>
10651
10652         * symtab.h (Symbol::is_weak_undefined): New function.
10653         (Symbol::is_strong_undefined): New function.
10654         (Symbol::is_absolute): New function.
10655         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10656         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10657         absolute symbols.
10658         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10659         (weak_undef_test): New target.
10660         * testsuite/Makefile.in: Rebuild.
10661         * testsuite/weak_undef_file1.cc: New file.
10662         * testsuite/weak_undef_file2.cc: New file.
10663         * testsuite/weak_undef_test.cc: New file.
10664
10665 2008-04-03  Craig Silverstein  <csilvers@google.com>
10666
10667         * compressed_output.h (class Output_compressed_section): Use
10668         unsigned buffer.
10669         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10670         add zlib header.
10671         (zlib_compressed_suffix): Removed.
10672         (Output_compressed_section::set_final_data_size): Use unsigned
10673         buffers.
10674         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10675         Fix linker invocation.
10676         (flagstest_o_specialfile_and_compress_debug_sections):
10677         Likewise.
10678         * testsuite/Makefile.in: Regenerated.
10679
10680 2008-04-02  David S. Miller  <davem@davemloft.net>
10681
10682         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10683         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10684
10685 2008-04-02  Craig Silverstein  <csilvers@google.com>
10686
10687         * TODO: New file.
10688
10689 2008-04-02  Ian Lance Taylor  <iant@google.com>
10690
10691         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10692         parameters.  Update for new key type to views_.  Change all
10693         callers.
10694         (File_read::read): Adjust for byteshift in returned view.
10695         (File_read::add_view): New function, broken out of
10696         find_and_make_view.
10697         (File_read::make_view): New function, broken out of
10698         find_and_make_view.
10699         (File_read::find_or_make_view): Add offset and aligned
10700         parameters.  Rewrite accordingly.  Change all callers.
10701         (File_read::get_view): Add offset and aligned parameters.  Adjust
10702         for byteshift in return value.
10703         (File_read::get_lasting_view): Likewise.
10704         * fileread.h (class File_read): Update declarations.
10705         (class File_read::View): Add byteshift_ field.  Add byteshift to
10706         constructor.  Add byteshift method.
10707         * archive.h (Archive::clear_uncached_views): New function.
10708         (Archive::get_view): Add aligned parameter.  Change all callers.
10709         * object.h (Object::get_view): Add aligned parameter.  Change all
10710         callers.
10711         (Object::get_lasting_view): Likewise.
10712
10713         * fileread.cc (File_read::release): Don't call clear_views if
10714         there are multiple objects.
10715         * fileread.h (File_read::clear_uncached_views): New function.
10716         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10717         on the archive.
10718
10719 2008-03-31  Cary Coutant  <ccoutant@google.com>
10720
10721         Add thin archive support.
10722         * archive.cc (Archive::armagt): New const.
10723         (Archive::setup): Remove task parameter and calls to unlock.
10724         (Archive::unlock_nested_archives): New function.
10725         (Archive::read_header): Add nested_off parameter. Change
10726         all callers.
10727         (Archive::interpret_header): Likewise.
10728         (Archive::include_all_members): Change to handle thin
10729         archives.
10730         (Archive::include_member): Likewise.
10731         * archive.h (Archive::Archive): Add new parameters and
10732         initializers.
10733         (Archive::armagt): New const.
10734         (Archive::setup): Remove task parameter.
10735         (Archive::unlock_nested_archives): New function.
10736         (Archive::read_header): Add nested_off parameter.
10737         (Archive::interpret_header): Likewise.
10738         (Archive::Nested_archive_table): New typedef.
10739         (Archive::is_thin_archive_): New field.
10740         (Archive::nested_archives_): New field.
10741         (Archive::options_): New field.
10742         (Archive::dirpath_): New field.
10743         (Archive::task_): New field.
10744         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10745         for thin archives.  Pass additional parameters to
10746         Archive::Archive.  Unlock the archive file after calling
10747         Archive::setup.
10748
10749 2008-03-29  Ian Lance Taylor  <iant@google.com>
10750
10751         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10752         version symbol to be local.
10753         * testsuite/ver_test_4.sh: New file.
10754         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10755         (check_DATA): Add ver_test_4.syms.
10756         (ver_test_4.syms): New target.
10757         * testsuite/Makefile.in: Rebuild.
10758
10759         * output.cc
10760         (Output_section::Input_section_sort_entry::has_priority): New
10761         function.
10762         (Output_section::Input_section_sort_entry::match_file_name): New
10763         function.
10764         (Output_section::Input_section_sort_entry::match_section_name):
10765         Remove.
10766         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10767         Remove.
10768         (Output_section::Input_section_sort_entry::match_section_file):
10769         Remove.
10770         (Output_section::Input_section_sort_compare::operator()): Rewrite
10771         using new Input_section_sort_entry functions.  Sort crtbegin and
10772         crtend first.  Sort sections with no priority before sections with
10773         a priority.
10774         * testsuite/initpri1.c (d3): Check j != 4.
10775         (cd5): New constructor/destructor function.
10776         (main): Check j != 2.
10777
10778         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10779         new symbol when resolving, don't call set_is_default.
10780         * testsuite/ver_test_7.cc: New file.
10781         * testsuite/ver_test_7.sh: New file.
10782         * testsuite/Makefile.am (ver_test_7.so): New target.
10783         (ver_test_7.o): New target.
10784         (check_SCRIPTS): Add ver_test_7.sh.
10785         (check_DATA): Add ver_test_7.syms.
10786         (ver_test_7.syms): New target.
10787
10788 2008-03-28  Ian Lance Taylor  <iant@google.com>
10789
10790         * layout.cc (Layout::layout): If we see an input section with a
10791         name that needs sorting, set the must_sort flag for the output
10792         section.
10793         (Layout::make_output_section): If the name of the output section
10794         indicates that it might require sorting, set the may_sort flag.
10795         * output.h (Output_section::may_sort_attached_input_sections): New
10796         function.
10797         (Output_section::set_may_sort_attached_input_sections): New
10798         function.
10799         (Output_section::must_sort_attached_input_sections): New
10800         function.
10801         (Output_section::set_must_sort_attached_input_sections): New
10802         function.
10803         (class Output_section): Declare Input_section_sort_entry.  Define
10804         Input_section_sort_compare.  Declare
10805         sort_attached_input_sections.  Add new fields:
10806         may_sort_attached_input_sections_,
10807         must_sort_attached_input_sections_,
10808         attached_input_sections_are_sorted_.
10809         * output.cc (Output_section::Output_section): Initialize new
10810         fields.
10811         (Output_section::add_input_section): Add an entry to
10812         input_sections_ if may_sort or must_sort are true.
10813         (Output_section::set_final_data_size): Call
10814         sort_attached_input_sections if necessary.
10815         (Output_section::Input_section_sort_entry): Define new class.
10816         (Output_section::Input_section_sort_compare::operator()): New
10817         function.
10818         (Output_section::sort_attached_input_sections): New function.
10819         * configure.ac: Check whether the compiler supports constructor
10820         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10821         * testsuite/initpri1.c: New file.
10822         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10823         CONSTRUCTOR_PRIORITY.
10824         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10825         (initpri1_LDFLAGS): New variable.
10826         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10827
10828 2008-03-27  Ian Lance Taylor  <iant@google.com>
10829
10830         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10831         * testsuite/common_test_1.c: New file.
10832         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10833         (common_test_1_SOURCES): New variable.
10834         (common_test_1_DEPENDENCIES): New variable.
10835         (common_test_1_LDFLAGS): New variable.
10836
10837         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10838         and commons_ correctly when NAME/VERSION does not override
10839         NAME/NULL.
10840         * testsuite/ver_test_6.c: New file.
10841         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10842         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10843         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10844
10845 2008-03-26  Ian Lance Taylor  <iant@google.com>
10846
10847         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10848         of an undefined symbol from a version script.
10849         * testsuite/Makefile.am (ver_test_5.so): New target.
10850         (ver_test_5.o): New target.
10851         (check_SCRIPTS): Add ver_test_5.sh.
10852         (check_DATA): Add ver_test_5.syms.
10853         (ver_test_5.syms): New target.
10854         * testsuite/ver_test_5.cc: New file.
10855         * testsuite/ver_test_5.script: New file.
10856         * testsuite/ver_test_5.sh: New file.
10857         * Makefile.in, testsuite/Makefile.in: Rebuild.
10858
10859         PR gold/5986
10860         Fix problems building gold with gcc 4.3.0.
10861         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10862         (gold_error_at_location, gold_warning_at_location): Use it.
10863         * configure.ac: Check whether we can compile and use a template
10864         function with a printf attribute.
10865         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10866         when jumping over bytes.
10867         * object.cc: Instantiate Object::read_section_data.
10868         * debug.h: Include <cstring>
10869         * dwarf_reader.cc: Include <algorithm>
10870         * main.cc: Include <cstring>.
10871         * options.cc: Include <cstring>.
10872         * output.cc: Include <cstring>.
10873         * script.cc: Include <cstring>.
10874         * script.h: Include <string>.
10875         * symtab.cc: Include <cstring> and <algorithm>.
10876         * target-select.cc: Include <cstring>.
10877         * version.cc: Include <string>.
10878         * testsuite/testmain.cc: Include <cstdlib>.
10879         * configure, config.in: Rebuild.
10880
10881 2008-03-25  Ian Lance Taylor  <iant@google.com>
10882
10883         * options.cc: Include "../bfd/bfdver.h".
10884         (options::help): Print bug reporting address.
10885
10886         * version.cc (print_version): Adjust output for current value of
10887         BFD_VERSION_STRING.
10888
10889         * NEWS: New file.
10890
10891         * options.cc (options::help): Print list of supported targets.
10892         * target-select.h: Include <vector>.
10893         (class Target_selector): Make machine_, size_, and is_big_endian_
10894         fields const.  Add bfd_name_ and instantiated_target_ fields.
10895         (Target_selector::Target_selector): Add bfd_name parameter.
10896         (Target_selector::recognize): Make non-virtual, call
10897         do_recognize.
10898         (Target_selector::recognize_by_name): Make non-virtual, call
10899         do_recognize_by_name.
10900         (Target_selector::supported_names): New function.
10901         (Target_selector::bfd_name): New function.
10902         (Target_selector::do_instantiate_target): New pure virtual
10903         function.
10904         (Target_selector::do_recognize): New virtual function.
10905         (Target_selector::do_recognize_by_name): New virtual function.
10906         (Target_selector::instantiate_target): New private function.
10907         (supported_target_names): Declare.
10908         * target-select.cc (Target_selector::Target_selector): Update for
10909         new parameter and fields.
10910         (select_target_by_name): Check that the name matches before
10911         calling recognize_by_name.
10912         (supported_target_names): New function.
10913         * i386.cc (class Target_selector_i386): Update Target_selector
10914         constructor call.  Remove recognize and recognize_by_name.  Add
10915         do_instantiate_target.
10916         * x86_64.cc (class Target_selector_x86_64): Likewise.
10917         * testsuite/testfile.cc (class Target_selector_test): Update for
10918         changes to Target_selector.
10919
10920         * README: Rewrite, with some notes on unsupported features.
10921
10922 2008-03-24  Cary Coutant  <ccoutant@google.com>
10923
10924         * i386.cc (Target_i386::Got_type): New enum declaration.
10925         (Target_i386::Scan::local): Updated callers of Output_data_got
10926         member functions.
10927         (Target_i386::Scan::global): Likewise.
10928         (Target_i386::Relocate::relocate): Likewise.
10929         (Target_i386::Relocate::relocate_tls): Likewise.
10930         * object.h (Got_offset_list): New class.
10931         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10932         (Sized_relobj::local_got_offset): Likewise.
10933         (Sized_relobj::set_local_got_offset): Likewise.
10934         (Sized_relobj::local_has_tls_got_offset): Removed.
10935         (Sized_relobj::local_tls_got_offset): Removed.
10936         (Sized_relobj::set_local_tls_got_offset): Removed.
10937         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10938         * output.cc (Output_data_got::add_global): Added got_type parameter.
10939         (Output_data_got::add_global_with_rel): Likewise.
10940         (Output_data_got::add_global_with_rela): Likewise.
10941         (Output_data_got::add_global_pair_with_rel): New function.
10942         (Output_data_got::add_global_pair_with_rela): New function.
10943         (Output_data_got::add_local): Added got_type parameter.
10944         (Output_data_got::add_local_with_rel): Likewise.
10945         (Output_data_got::add_local_with_rela): Likewise.
10946         (Output_data_got::add_local_pair_with_rel): New function.
10947         (Output_data_got::add_local_pair_with_rela): New function.
10948         (Output_data_got::add_global_tls): Removed.
10949         (Output_data_got::add_global_tls_with_rel): Removed.
10950         (Output_data_got::add_global_tls_with_rela): Removed.
10951         (Output_data_got::add_local_tls): Removed.
10952         (Output_data_got::add_local_tls_with_rel): Removed.
10953         (Output_data_got::add_local_tls_with_rela): Removed.
10954         * output.h (Output_data_got::add_global): Added got_type parameter.
10955         (Output_data_got::add_global_with_rel): Likewise.
10956         (Output_data_got::add_global_with_rela): Likewise.
10957         (Output_data_got::add_global_pair_with_rel): New function.
10958         (Output_data_got::add_global_pair_with_rela): New function.
10959         (Output_data_got::add_local): Added got_type parameter.
10960         (Output_data_got::add_local_with_rel): Likewise.
10961         (Output_data_got::add_local_with_rela): Likewise.
10962         (Output_data_got::add_local_pair_with_rel): New function.
10963         (Output_data_got::add_local_pair_with_rela): New function.
10964         (Output_data_got::add_global_tls): Removed.
10965         (Output_data_got::add_global_tls_with_rel): Removed.
10966         (Output_data_got::add_global_tls_with_rela): Removed.
10967         (Output_data_got::add_local_tls): Removed.
10968         (Output_data_got::add_local_tls_with_rel): Removed.
10969         (Output_data_got::add_local_tls_with_rela): Removed.
10970         * resolve.cc (Symbol::override_base_with_special): Removed
10971         reference to has_got_offset_ field.
10972         * symtab.cc (Symbol::init_fields): Replaced initialization
10973         of got_offset_ with got_offsets_.  Removed initialization
10974         of has_got_offset_
10975         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10976         (Symbol::got_offset): Likewise.
10977         (Symbol::set_got_offset): Likewise.
10978         (Symbol::has_tls_got_offset): Removed.
10979         (Symbol::tls_got_offset): Removed.
10980         (Symbol::set_tls_got_offset): Removed.
10981         (Symbol::got_offset_): Removed.
10982         (Symbol::tls_mod_got_offset_): Removed.
10983         (Symbol::tls_pair_got_offset_): Removed.
10984         (Symbol::got_offsets_): New field.
10985         (Symbol::has_got_offset): Removed.
10986         (Symbol::has_tls_mod_got_offset): Removed.
10987         (Symbol::has_tls_pair_got_offset): Removed.
10988         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10989         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10990         member functions.
10991         (Target_x86_64::Scan::global): Likewise.
10992         (Target_x86_64::Relocate::relocate): Likewise.
10993         (Target_x86_64::Relocate::relocate_tls): Likewise.
10994
10995 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10996
10997         * yyscript.y: Fix spelling error in comment.
10998
10999 2008-03-24  Ian Lance Taylor  <iant@google.com>
11000
11001         * options.h (class General_options): Define build_id option.
11002         * layout.h (class Layout): Declare write_build_id, create_note,
11003         create_build_id.  Add build_id_note_ member.
11004         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11005         "libiberty.h", "md5.h", "sha1.h".
11006         (Layout::Layout): Initialize eh_frame_data_,
11007         eh_frame_hdr_section_, and build_id_note_.
11008         (Layout::finalize): Call create_build_id.
11009         (Layout::create_note): New function, broken out of
11010         Layout::create_gold_note.
11011         (Layout::create_gold_note): Call create_note.
11012         (Layout::create_build_id): New function.
11013         (Layout::write_build_id): New function.
11014         (Close_task_runner::run): Call write_build_id.
11015
11016         * x86_64.cc: Correct license to GPLv3.
11017
11018 2008-03-23  Ian Lance Taylor  <iant@google.com>
11019
11020         * options.cc: Include "demangle.h".
11021         (parse_optional_string): New function.
11022         (parse_long_option): Handle takes_optional_argument.
11023         (parse_short_option): Update dash_z initializer.  Handle
11024         takes_optional_argument.
11025         (General_options::General_options): Initialize do_demangle_.
11026         (General_options::finalize): Set do_demangle_.  Handle demangling
11027         style.
11028         * options.h (parse_optional_string): Declare.
11029         (struct One_option): Add optional_arg field.  Update constructor.
11030         Update call constructor calls.  Add takes_optional_argument
11031         function.
11032         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
11033         (DEFINE_optional_string): Define.
11034         (General_options::demangle): Change from DEFINE_bool to
11035         DEFINE_optional_string.
11036         (General_options::no_demangle): New function.
11037         (General_options::do_demangle): New function.
11038         (General_options::set_do_demangle): New function.
11039         (General_options::execstack_status_): Move definition to end of
11040         class definition.
11041         (General_options::static_): Likewise.
11042         (General_options::do_demangle_): New field.
11043         * object.cc (big_endian>::get_symbol_location_info): Call
11044         Options::do_demangle, not Options::demangle.
11045         * symtab.cc (demangle): Likewise.
11046
11047 2008-03-22  Ian Lance Taylor  <iant@google.com>
11048
11049         * gold.h: Include <cstddef> and <sys/types.h>
11050         * options.h: Include <cstring>.
11051
11052 2008-03-21  Ian Lance Taylor  <iant@google.com>
11053
11054         * Added source code to GNU binutils.