Fix spelling mistakes.
[external/binutils.git] / gold / ChangeLog
1 2011-06-02  Nick Clifton  <nickc@redhat.com>
2
3         * dynobj.h: Fix spelling mistake in comment.
4         * output.cc: Likewise.
5
6 2011-05-31  Doug Kwan  <dougkwan@google.com>
7             Asier Llano
8
9         PR gold/12826
10         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
11         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
12         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
13         redundant arm_exidx_test.so.
14         * testsuite/Makefile.in: Regenerate.
15         (check_SCRIPTS): Add pr12826.sh
16         (check_DATA): Add pr12826.stdout
17         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
18         * testsuite/pr12826.sh: New file.
19         * testsuite/pr12826_1.s: Ditto.
20         * testsuite/pr12826_1.s: Ditto.
21
22 2011-05-30  Ian Lance Taylor  <iant@google.com>
23
24         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
25         sections.
26
27 2011-05-29  Ian Lance Taylor  <iant@google.com>
28
29         PR gold/12804
30         * testsuite/Makefile.am: Use different file name for two_file_test
31         temporary file for each incremental test.
32         * testsuite/Makefile.in: Rebuild.
33
34 2011-05-29  Ian Lance Taylor  <iant@google.com>
35
36         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
37         binary input file is empty.
38
39 2011-05-27  Ian Lance Taylor  <iant@google.com>
40
41         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
42         (ver_test_9.so): Likewise.
43         * testsuite/Makefile.in: Rebuild.
44
45 2011-05-26 Cary Coutant  <ccoutant@google.com>
46
47         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
48         * incremental.cc (Incremental_inputs::report_input_section): Fix
49         comment, indentation.
50         (Incremental_inputs::report_comdat_group): New function.
51         (Output_section_incremental_inputs::set_final_data_size): Adjust size
52         of data for incremental input file entry.
53         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
54         group count, COMDAT group signatures.
55         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
56         an unchanged input file.
57         * incremental.h (Incremental_object_entry::Incremental_object_entry):
58         Initialize new data member.
59         (Incremental_object_entry::add_comdat_group): New function.
60         (Incremental_object_entry::get_comdat_group_count): New function.
61         (Incremental_object_entry::get_comdat_signature_key): New function.
62         (Incremental_object_entry::groups_): New data member.
63         (Incremental_inputs::report_comdat_group): New function.
64         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
65         data for incremental input file entry.
66         (Incremental_input_entry_reader::get_comdat_group_count): New function.
67         (Incremental_input_entry_reader::get_input_section): Adjust size of
68         data for incremental input file entry.
69         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
70         (Incremental_input_entry_reader::get_comdat_group_signature): New
71         function.
72         * object.cc (Sized_relobj::include_section_group): Report kept
73         COMDAT groups for incremental links.
74
75 2011-05-24  David Meyer  <pdox@google.com>
76
77         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
78         with name parameter.  Add found_name parameter.
79         * fileread.cc (Input_file::find_file): Adjust code accordingly.
80         * dirsearch.h (class Dirsearch): Update declaration.
81
82 2011-05-24  Ian Lance Taylor  <iant@google.com>
83
84         * archive.cc (Library_base::should_include_member): Pull in object
85         from archive if it defines the entry symbol.
86         * parameters.cc (Parameters::entry): New function.
87         * parameters.h (class Parameters): Declare entry.
88         * output.h (class Output_file_header): Remove entry_ field.
89         * output.cc (Output_file_header::Output_file_header): Remove entry
90         parameter.  Change all callers.
91         (Output_file_header::entry): Use parameters->entry.
92         * gold.cc (queue_middle_tasks): Likewise.
93         * plugin.cc (Plugin_hook::run): Likewise.
94
95 2011-05-24 Cary Coutant  <ccoutant@google.com>
96
97         * gold.cc (queue_initial_tasks): Pass incremental base filename
98         to Output_file::open_base_file; don't print error message.
99         * incremental-dump.cc (main): Adjust call to
100         Output_file::open_for_modification.
101         * incremental-dump.cc (main): Likewise.
102         * incremental.cc (Incremental_inputs::report_command_line):
103         Ignore --incremental-base option when comparing command lines.
104         Ignore parameter when given as separate argument.
105         * options.h (class General_options): Add --incremental-base.
106         * output.cc (Output_file::Output_file):
107         (Output_file::open_base_file): Add base_name and writable parameters;
108         read base file into new file; print error message here.
109         (Output_file::map_no_anonymous): Add writable parameter; adjust all
110         callers.
111         * output.h (Output_file::open_for_modification): Rename to...
112         (Output_file::open_base_file): ...this; add base_name and
113         writable parameters; adjust all callers.
114         (Output_file::map_no_anonymous): Add writable parameter; adjust all
115         callers.
116         * testsuite/Makefile.am (incremental_test_4): Test
117         --incremental-base.
118         * testsuite/Makefile.in: Regenerate.
119
120 2011-05-24 Cary Coutant  <ccoutant@google.com>
121
122         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
123         incremental_test_4.
124         * testsuite/Makefile.in: Regenerate.
125         * testsuite/two_file_test_1_v1.cc: New test source file.
126         * testsuite/two_file_test_1b_v1.cc: New test source file.
127         * testsuite/two_file_test_2_v1.cc: New test source file.
128
129 2011-05-24 Cary Coutant  <ccoutant@google.com>
130
131         * dynobj.h (Dynobj::do_dynobj): New function.
132         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
133         flag and soname for shared objects.
134         * incremental.cc (Incremental_inputs::report_object): Make
135         either Incremental_object_entry or Incremental_dynobj_entry; add
136         soname to string table.
137         (Incremental_inputs::report_input_section): Add assertion.
138         (Output_section_incremental_inputs::set_final_data_size): Adjust
139         type of input file entry for shared libraries; adjust size of
140         shared library info entry.
141         (Output_section_incremental_inputs::write_input_files): Write
142         as_needed flag for shared libraries.
143         (Output_section_incremental_inputs::write_info_blocks): Adjust type
144         of input file entry for shared libraries; write soname.
145         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
146         soname from incremental info.
147         * incremental.h (enum Incremental_input_flags): Add
148         INCREMENTAL_INPUT_AS_NEEDED.
149         (Incremental_input_entry::Incremental_input_entry): Initialize new
150         data member.
151         (Incremental_input_entry::set_as_needed): New function.
152         (Incremental_input_entry::as_needed): New function.
153         (Incremental_input_entry::do_dynobj_entry): New function.
154         (Incremental_input_entry::as_needed_): New data member.
155         (Incremental_object_entry::Incremental_object_entry): Don't check
156         for shared library.
157         (Incremental_object_entry::do_type): Likewise.
158         (class Incremental_dynobj_entry): New class.
159         (Incremental_input_entry_reader::as_needed): New function.
160         (Incremental_input_entry_reader::get_soname): New function.
161         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
162         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
163         size of shared library info entry.
164         * layout.cc (Layout::finish_dynamic_section): Don't test for 
165         incremental link when adding DT_NEEDED entries.
166         * object.h (Object::Object): Initialize new data member.
167         (Object::dynobj): New function.
168         (Object::set_as_needed): New function.
169         (Object::as_needed): New function.
170         (Object::do_dynobj): New function.
171         (Object::as_needed_): New data member.
172
173 2011-05-24 Cary Coutant  <ccoutant@google.com>
174
175         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
176         info; adjust display of GOT entries.
177         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
178         vector of input objects; remove file_status_.
179         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
180         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
181         got_plt reader; call target hooks to reserve GOT entries.
182         (Output_section_incremental_inputs::set_final_data_size): Adjust size
183         of input file info header and GOT info entry.
184         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
185         relocation info.
186         (Got_plt_view_info::got_descriptor): Remove.
187         (Got_plt_view_info::sym_index): New data member.
188         (Got_plt_view_info::input_index): New data member.
189         (Local_got_offset_visitor::visit): Write input file index.
190         (Global_got_offset_visitor::visit): Write 0 for input file index.
191         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
192         with sym_index and input_index.
193         (Output_section_incremental_inputs::write_got_plt): Adjust size of
194         incremental info GOT entry; replace got_descriptor with input_index.
195         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
196         map from input file index to object.
197         (Sized_relobj_incr::do_layout): Replace direct data member reference
198         with accessor function.
199         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
200         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
201         Adjust size of input file info header.
202         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
203         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
204         (Incremental_input_entry_reader::get_input_section): Adjust size of
205         input file info header.
206         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
207         of incremental info GOT entry.
208         (Incremental_got_plt_reader::get_got_desc): Remove.
209         (Incremental_got_plt_reader::get_got_symndx): New function.
210         (Incremental_got_plt_reader::get_got_input_index): New function.
211         (Sized_incremental_binary::Sized_incremental_binary): Remove
212         file_status_; add input_objects_.
213         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
214         (Sized_incremental_binary::set_file_is_unchanged): Remove.
215         (Sized_incremental_binary::file_is_unchanged): Remove.
216         (Sized_incremental_binary::set_input_object): New function.
217         (Sized_incremental_binary::input_object): New function.
218         (Sized_incremental_binary::file_status_): Remove.
219         (Sized_incremental_binary::input_objects_): New data member.
220         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
221         references.
222         (Sized_relobj_incr::invalid_address): Move to base class.
223         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
224         class.
225         (Sized_relobj_incr::do_output_section_offset): Likewise.
226         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
227         (Sized_relobj_incr::section_offsets_): Likewise.
228         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
229         function.
230         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
231         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
232         with accessor function.
233         (Sized_relobj_file::do_layout): Likewise.
234         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
235         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
236         (Sized_relobj_file::compute_final_local_value): Replace refs to
237         section_offsets_ with accessor function.
238         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
239         * object.h (Relobj::Relobj): Initialize new data members.
240         (Relobj::add_dyn_reloc): New function.
241         (Relobj::first_dyn_reloc): New function.
242         (Relobj::dyn_reloc_count): New function.
243         (Relobj::first_dyn_reloc_): New data member.
244         (Relobj::dyn_reloc_count_): New data member.
245         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
246         references.
247         (Sized_relobj::Address): New typedef.
248         (Sized_relobj::invalid_address): Move here from child class.
249         (Sized_relobj::Sized_relobj): Initialize new data members.
250         (Sized_relobj::sized_relobj): New function.
251         (Sized_relobj::is_output_section_offset_invalid): Move here from
252         child class.
253         (Sized_relobj::get_output_section_offset): Likewise.
254         (Sized_relobj::local_has_got_offset): Likewise.
255         (Sized_relobj::local_got_offset): Likewise.
256         (Sized_relobj::set_local_got_offset): Likewise.
257         (Sized_relobj::do_for_all_local_got_entries): Likewise.
258         (Sized_relobj::clear_got_offsets): New function.
259         (Sized_relobj::section_offsets): Move here from child class.
260         (Sized_relobj::do_output_section_offset): Likewise.
261         (Sized_relobj::do_set_section_offset): Likewise.
262         (Sized_relobj::Local_got_offsets): Likewise.
263         (Sized_relobj::local_got_offsets_): Likewise.
264         (Sized_relobj::section_offsets_): Likewise.
265         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
266         references.
267         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
268         class.
269         (Sized_relobj_file::sized_relobj): New function
270         (Sized_relobj_file::local_has_got_offset): Move to base class.
271         (Sized_relobj_file::local_got_offset): Likewise.
272         (Sized_relobj_file::set_local_got_offset): Likewise.
273         (Sized_relobj_file::get_output_section_offset): Likewise.
274         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
275         (Sized_relobj_file::do_output_section_offset): Likewise.
276         (Sized_relobj_file::do_set_section_offset): Likewise.
277         (Sized_relobj_file::Local_got_offsets): Likewise.
278         (Sized_relobj_file::local_got_offsets_): Likewise.
279         (Sized_relobj_file::section_offsets_): Likewise.
280         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
281         (all constructors).
282         (set_needs_dynsym_index): Convert relobj to derived class pointer.
283         (Output_reloc::get_symbol_index): Likewise.
284         (Output_reloc::local_section_offset): Likewise.
285         (Output_reloc::get_address): Likewise.
286         (Output_reloc::symbol_value): Likewise.
287         (Output_data_got::reserve_slot): Move to class definition.
288         (Output_data_got::reserve_local): New function.
289         (Output_data_got::reserve_slot_for_global): Remove.
290         (Output_data_got::reserve_global): New function.
291         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
292         (all constructors, two instantiations).
293         (Output_reloc::get_relobj): New function (two instantiations).
294         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
295         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
296         (Output_data_reloc::add_global): Adjust type of relobj.
297         (Output_data_reloc::add_global_relative): Likewise.
298         (Output_data_reloc::add_symbolless_global_addend): Likewise.
299         (Output_data_reloc::add_local): Likewise.
300         (Output_data_reloc::add_local_relative): Likewise.
301         (Output_data_reloc::add_symbolless_local_addend): Likewise.
302         (Output_data_reloc::add_local_section): Likewise.
303         (Output_data_reloc::add_output_section): Likewise.
304         (Output_data_reloc::add_absolute): Likewise.
305         (Output_data_reloc::add_target_specific): Likewise.
306         (Output_data_got::reserve_slot): Move definition here.
307         (Output_data_got::reserve_local): New function.
308         (Output_data_got::reserve_global): New function.
309         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
310         section_offsets_ with accessor function.
311         (Sized_relobj_file::write_sections): Likewise.
312         (Sized_relobj_file::do_relocate_sections): Likewise.
313         * target.h (Sized_target::reserve_local_got_entry): New function.
314         (Sized_target::reserve_global_got_entry): New function.
315         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
316         (Target_x86_64::reserve_global_got_entry): New function.
317         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
318
319 2011-05-23 Cary Coutant  <ccoutant@google.com>
320
321         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
322         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
323         bit when checking got_type.
324         * incremental.cc (Sized_incremental_binary::setup_readers):
325         Store symbol table and string table locations; initialize bit vector
326         of file status flags.
327         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
328         unchanged files.
329         (Sized_incremental_binary::do_process_got_plt): New function.
330         (Sized_incremental_binary::get_symtab_view): Use stored locations.
331         (Output_section_incremental_inputs::set_final_data_size): Record
332         file index for each input file.
333         (Output_section_incremental_inputs::write_got_plt): Store file index
334         instead of input entry offset for each GOT entry.
335         * incremental.h
336         (Incremental_input_entry::Incremental_input_entry): Initialize new
337         data member.
338         (Incremental_input_entry::set_offset): Store file index.
339         (Incremental_input_entry::get_file_index): New function.
340         (Incremental_input_entry::file_index_): New data member.
341         (Incremental_binary::process_got_plt): New function.
342         (Incremental_binary::do_process_got_plt): New function.
343         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
344         data members.
345         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
346         (Sized_incremental_binary::set_file_is_unchanged): New function.
347         (Sized_incremental_binary::file_is_unchanged): New function.
348         (Sized_incremental_binary::do_process_got_plt): New function.
349         (Sized_incremental_binary::file_status_): New data member.
350         (Sized_incremental_binary::main_symtab_loc_): New data member.
351         (Sized_incremental_binary::main_strtab_loc_): New data member.
352         * output.cc (Output_data_got::Got_entry::write): Add case
353         RESERVED_CODE.
354         (Output_data_got::add_global): Call add_got_entry.
355         (Output_data_got::add_global_plt): Likewise.
356         (Output_data_got::add_global_with_rel): Likewise.
357         (Output_data_got::add_global_with_rela): Likewise.
358         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
359         (Output_data_got::add_global_pair_with_rela): Likewise.
360         (Output_data_got::add_local): Call add_got_entry.
361         (Output_data_got::add_local_plt): Likewise.
362         (Output_data_got::add_local_with_rel): Likewise.
363         (Output_data_got::add_local_with_rela): Likewise.
364         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
365         (Output_data_got::add_local_pair_with_rela): Likewise.
366         (Output_data_got::reserve_slot): New function.
367         (Output_data_got::reserve_slot_for_global): New function.
368         (Output_data_got::add_got_entry): New function.
369         (Output_data_got::add_got_entry_pair): New function.
370         (Output_section::add_output_section_data): Edit FIXME.
371         * output.h
372         (Output_section_data_build::Output_section_data_build): New
373         constructor with size parameter.
374         (Output_data_space::Output_data_space): Likewise.
375         (Output_data_got::Output_data_got): Initialize new data member; new
376         constructor with size parameter.
377         (Output_data_got::add_constant): Call add_got_entry.
378         (Output_data_got::reserve_slot): New function.
379         (Output_data_got::reserve_slot_for_global): New function.
380         (class Output_data_got::Got_entry): Add RESERVED_CODE.
381         (Output_data_got::add_got_entry): New function.
382         (Output_data_got::add_got_entry_pair): New function.
383         (Output_data_got::free_list_): New data member.
384         * target.h (Sized_target::init_got_plt_for_update): New function.
385         (Sized_target::register_global_plt_entry): New function.
386         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
387         Initialize new data member; call init; add constructor with PLT count.
388         (Output_data_plt_x86_64::init): New function.
389         (Output_data_plt_x86_64::add_relocation): New function.
390         (Output_data_plt_x86_64::reserve_slot): New function.
391         (Output_data_plt_x86_64::free_list_): New data member.
392         (Target_x86_64::init_got_plt_for_update): New function.
393         (Target_x86_64::register_global_plt_entry): New function.
394         (Output_data_plt_x86_64::add_entry): Allocate from free list for
395         incremental updates.
396         (Output_data_plt_x86_64::add_relocation): New function.
397         * testsuite/object_unittest.cc (Object_test): Set default options.
398
399 2011-05-16  Ian Lance Taylor  <iant@google.com>
400
401         * options.h (class General_options): Make -i a synonym for -r.
402
403 2011-05-16  Ian Lance Taylor  <iant@google.com>
404
405         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
406
407 2011-05-10 Cary Coutant  <ccoutant@google.com>
408
409         * object.cc (Sized_relobj::do_count_local_symbols): Check for
410         strip_all (-s).
411
412 2011-05-06  Ian Lance Taylor  <iant@google.com>
413
414         * layout.cc (Layout::layout): If the output section flags change,
415         update the ordering.
416
417 2011-04-25 Cary Coutant  <ccoutant@google.com>
418
419         * incremental-dump.cc (dump_incremental_inputs): Print local
420         symbol info for each input file.
421         * incremental.cc
422         (Output_section_incremental_inputs::set_final_data_size): Add local
423         symbol info to input file entries in incremental info.
424         (Output_section_incremental_inputs::write_info_blocks): Likewise.
425         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
426         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
427         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
428         implementation.
429         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
430         (Sized_incr_relobj::do_relocate): Write the local symbols.
431         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
432         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
433         Adjust size of input file header.
434         (Incremental_inputs_reader::get_local_symbol_offset): New function.
435         (Incremental_inputs_reader::get_local_symbol_count): New function.
436         (Incremental_inputs_reader::get_input_section): Adjust size of input
437         file header.
438         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
439         (Sized_incr_relobj::This): New typedef.
440         (Sized_incr_relobj::sym_size): New const data member.
441         (Sized_incr_relobj::Local_symbol): New struct.
442         (Sized_incr_relobj::do_output_local_symbol_count): New function.
443         (Sized_incr_relobj::do_local_symbol_offset): New function.
444         (Sized_incr_relobj::local_symbol_count_): New data member.
445         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
446         (Sized_incr_relobj::local_symbol_index_): New data member.
447         (Sized_incr_relobj::local_symbol_offset_): New data member.
448         (Sized_incr_relobj::local_dynsym_offset_): New data member.
449         (Sized_incr_relobj::local_symbols_): New data member.
450         * object.h (Relobj::output_local_symbol_count): New function.
451         (Relobj::local_symbol_offset): New function.
452         (Relobj::do_output_local_symbol_count): New function.
453         (Relobj::do_local_symbol_offset): New function.
454         (Sized_relobj::do_output_local_symbol_count): New function.
455         (Sized_relobj::do_local_symbol_offset): New function.
456
457 2011-04-22  Vladimir Simonov  <sv@sw.ru>
458
459         * descriptors.cc (set_close_on_exec): New function.
460         (Descriptors::open): Use set_close_on_exec.
461         * output.cc (S_ISLNK): Define if not defined.
462
463 2011-04-22 Cary Coutant  <ccoutant@google.com>
464
465         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
466         global symbol map.
467         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
468         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
469         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
470         relocations.
471         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
472         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
473         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
474         * incremental.h
475         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
476         function.
477         (Incremental_binary::apply_incremental_relocs): New function.
478         (Incremental_binary::do_apply_incremental_relocs): New function.
479         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
480         data member.
481         (Sized_incremental_binary::add_global_symbol): New function.
482         (Sized_incremental_binary::global_symbol): New function.
483         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
484         (Sized_incremental_binary::symbol_map_): New data member.
485         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
486         * target.h (Sized_target::apply_relocation): New function.
487         * target-reloc.h (apply_relocation): New function.
488         * x86_64.cc (Target_x86_64::apply_relocation): New function.
489
490 2011-04-22  Doug Kwan  <dougkwan@google.com>
491
492         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
493         flag of a SHT_ARM_EXIDX section.
494         * testsuite/Makefile.am (arm_exidx_test): New test rules.
495         * testsuite/Makefile.in: Regenerate.
496         * testsuite/arm_exidx_test.s: New file.
497         * testsuite/arm_exidx_test.sh: Same.
498
499 2011-04-20 Cary Coutant  <ccoutant@google.com>
500
501         PR gold/12689
502         * archive.h (Incremental_archive_entry::Archive_member):
503         Initialize arg_serial_ (second constructor).
504
505 2011-04-17  Ian Lance Taylor  <iant@google.com>
506
507         * object.cc (Relocate_info::location): Simplify location string.
508         * errors.cc (Errors::error_at_location): Don't print program
509         name.
510         (Errors::warning_at_location): Likewise.
511         (Errors::undefined_symbol): Likewise.
512         * testsuite/debug_msg.sh: Update accordingly.
513
514 2011-04-14 Cary Coutant  <ccoutant@google.com>
515
516         * gold/layout.cc (Layout::symtab_section_offset): New function.
517         * gold/layout.h (Layout::symtab_section_offset): New function.
518         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
519
520 2011-04-12  Ian Lance Taylor  <iant@google.com>
521
522         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
523         with MREMAP_MAYMOVE.
524         * output.h (class Output_file): Add map_is_allocated_ field.
525         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
526         not available, provide stubs.  If mremap is not available, #define
527         it to gold_mremap.
528         (MREMAP_MAYMOVE): Define if not defined.
529         (Output_file::Output_file): Initialize map_is_allocated_.
530         (Output_file::resize): Check map_is_allocated_.
531         (Output_file::map_anonymous): If mmap fails, use malloc.
532         (Output_file::unmap): Don't do anything for an anonymous map.
533         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
534         is not available, provide stubs.
535         (File_read::View::~View): Use free rather than delete[].
536         (File_read::make_view): Use malloc rather than new[].  If mmap
537         fails, use malloc.
538         (File_read::find_or_make_view): Use malloc rather than new[].
539         * gold.h: Remove HAVE_REMAP code.
540         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
541         exists.  Rename mremap to gold_mremap.  If mmap is not available
542         don't do anything.
543         * configure, config.in: Rebuild.
544
545 2011-04-11  Ian Lance Taylor  <iant@google.com>
546
547         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
548         initialize local variable v.
549
550 2011-04-11  Cary Coutant  <ccoutant@google.com>
551
552         * archive.cc (Archive::include_member): Adjust call to
553         report_object.
554         (Add_archive_symbols::run): Track argument serial numbers.
555         (Lib_group::include_member): Likewise.
556         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
557         * archive.h (Incremental_archive_entry::Archive_member):
558         Initialize arg_serial_.
559         (Archive_member::arg_serial_): New data member.
560         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
561         (Sized_dynobj::do_add_symbols): Track symbols when doing an
562         incremental link.
563         (Sized_dynobj::do_for_all_local_got_entries): New function.
564         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
565         function.
566         * fileread.cc (get_mtime): New function.
567         * fileread.h (get_mtime): New function.
568         * gold.cc (queue_initial_tasks): Check for incremental update.
569         (process_incremental_input): New function.
570         (queue_middle_tasks): Don't force valid target for incremental
571         update.
572         * incremental-dump.cc (find_input_containing_global): Adjust
573         size of symbol info entry.
574         (dump_incremental_inputs): Dump argument serial number and
575         in_system_directory flag; bias shndx by 1; print symbol names
576         when dumping per-file symbol lists; use new symbol info readers.
577         * incremental.cc
578         (Output_section_incremental_inputs:update_data_size): New function.
579         (Sized_incremental_binary::setup_readers): Setup input readers
580         for each input file; build maps for files added from libraries
581         and scripts.
582         (Sized_incremental_binary::check_input_args): New function.
583         (Sized_incremental_binary::do_check_inputs): Build map of argument
584         serial numbers to input arguments.
585         (Sized_incremental_binary::do_file_has_changed): Rename
586         do_file_is_unchanged to this; compare file modification times.
587         (Sized_incremental_binary::do_init_layout): New function.
588         (Sized_incremental_binary::do_reserve_layout): New function.
589         (Sized_incremental_binary::do_get_input_reader): Remove.
590         (Sized_incremental_binary::get_symtab_view): New function.
591         (Incremental_checker::can_incrementally_link_output_file): Remove.
592         (Incremental_inputs::report_command_line): Exclude --debug options.
593         (Incremental_inputs::report_archive_begin): Add parameter; track
594         argument serial numbers; don't put input file entry for archive
595         before archive members.
596         (Incremental_inputs::report_archive_end): Put input file entry
597         for archive after archive members.
598         (Incremental_inputs::report_object): Add parameter; track argument
599         serial numbers and in_system_directory flag.
600         (Incremental_inputs::report_script): Add parameter; track argument
601         serial numbers.
602         (Output_section_incremental_inputs::set_final_data_size): Adjust
603         size of symbol info entry; check for forwarding symbols.
604         (Output_section_incremental_inputs::write_input_files): Write
605         in_system_directory flag and argument serial number.
606         (Output_section_incremental_inputs::write_info_blocks): Map section
607         indices between incremental info and original input file; store
608         input section index for each symbol.
609         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
610         change operator() to visit().
611         (class Global_got_offset_visitor): Likewise.
612         (class Global_symbol_visitor_got_plt):
613         (Output_section_incremental_inputs::write_got_plt): Use new visitor
614         classes.
615         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
616         (Sized_incr_relobj::do_read_symbols): New function.
617         (Sized_incr_relobj::do_layout): New function.
618         (Sized_incr_relobj::do_layout_deferred_sections): New function.
619         (Sized_incr_relobj::do_add_symbols): New function.
620         (Sized_incr_relobj::do_should_include_member): New function.
621         (Sized_incr_relobj::do_for_all_global_symbols): New function.
622         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
623         (Sized_incr_relobj::do_section_size): New function.
624         (Sized_incr_relobj::do_section_name): New function.
625         (Sized_incr_relobj::do_section_contents): New function.
626         (Sized_incr_relobj::do_section_flags): New function.
627         (Sized_incr_relobj::do_section_entsize): New function.
628         (Sized_incr_relobj::do_section_address): New function.
629         (Sized_incr_relobj::do_section_type): New function.
630         (Sized_incr_relobj::do_section_link): New function.
631         (Sized_incr_relobj::do_section_info): New function.
632         (Sized_incr_relobj::do_section_addralign): New function.
633         (Sized_incr_relobj::do_initialize_xindex): New function.
634         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
635         (Sized_incr_relobj::do_read_relocs): New function.
636         (Sized_incr_relobj::do_gc_process_relocs): New function.
637         (Sized_incr_relobj::do_scan_relocs): New function.
638         (Sized_incr_relobj::do_count_local_symbols): New function.
639         (Sized_incr_relobj::do_finalize_local_symbols): New function.
640         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
641         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
642         (Sized_incr_relobj::do_relocate): New function.
643         (Sized_incr_relobj::do_set_section_offset): New function.
644         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
645         (Sized_incr_dynobj::do_read_symbols): New function.
646         (Sized_incr_dynobj::do_layout): New function.
647         (Sized_incr_dynobj::do_add_symbols): New function.
648         (Sized_incr_dynobj::do_should_include_member): New function.
649         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
650         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
651         (Sized_incr_dynobj::do_section_size): New function.
652         (Sized_incr_dynobj::do_section_name): New function.
653         (Sized_incr_dynobj::do_section_contents): New function.
654         (Sized_incr_dynobj::do_section_flags): New function.
655         (Sized_incr_dynobj::do_section_entsize): New function.
656         (Sized_incr_dynobj::do_section_address): New function.
657         (Sized_incr_dynobj::do_section_type): New function.
658         (Sized_incr_dynobj::do_section_link): New function.
659         (Sized_incr_dynobj::do_section_info): New function.
660         (Sized_incr_dynobj::do_section_addralign): New function.
661         (Sized_incr_dynobj::do_initialize_xindex): New function.
662         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
663         (make_sized_incremental_object): New function.
664         (Incremental_library::copy_unused_symbols): New function.
665         (Incremental_library::do_for_all_unused_symbols): New function.
666         * incremental.h (enum Incremental_input_flags): New type.
667         (class Incremental_checker): Remove.
668         (Incremental_input_entry::Incremental_input_entry): Add argument
669         serial number.
670         (Incremental_input_entry::arg_serial): New function.
671         (Incremental_input_entry::set_is_in_system_directory): New function.
672         (Incremental_input_entry::is_in_system_directory): New function.
673         (Incremental_input_entry::arg_serial_): New data member.
674         (Incremental_input_entry::is_in_system_directory_): New data member.
675         (class Script_info): Move here from script.h.
676         (Script_info::Script_info): Add filename parameter.
677         (Script_info::filename): New function.
678         (Script_info::filename_): New data member.
679         (Incremental_script_entry::Incremental_script_entry): Add argument
680         serial number.
681         (Incremental_object_entry::Incremental_object_entry): Likewise.
682         (Incremental_object_entry::add_input_section): Build list of input
683         sections with map to original shndx.
684         (Incremental_object_entry::get_input_section_index): New function.
685         (Incremental_object_entry::shndx_): New data member.
686         (Incremental_object_entry::name_key_): Rename; adjust all refs.
687         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
688         (Incremental_archive_entry::Incremental_archive_entry): Add argument
689         serial number.
690         (Incremental_inputs::report_archive_begin): Likewise.
691         (Incremental_inputs::report_object): Likewise.
692         (Incremental_inputs::report_script): Likewise.
693         (class Incremental_global_symbol_reader): New class.
694         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
695         and store flags and input file type.
696         (Incremental_input_entry_reader::arg_serial): New function.
697         (Incremental_input_entry_reader::type): Extract type from flags.
698         (Incremental_input_entry_reader::is_in_system_directory): New function.
699         (Incremental_input_entry_reader::get_input_section_count): Call
700         accessor function for type.
701         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
702         function for type; adjust size of global symbol entry.
703         (Incremental_input_entry_reader::get_global_symbol_count): Call
704         accessor function for type.
705         (Incremental_input_entry_reader::get_object_count): Likewise.
706         (Incremental_input_entry_reader::get_object_offset): Likewise.
707         (Incremental_input_entry_reader::get_member_count): Likewise.
708         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
709         (Incremental_input_entry_reader::get_member_offset): Likewise.
710         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
711         (Incremental_input_entry_reader::Global_symbol_info): Remove.
712         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
713         (Incremental_input_entry_reader::get_global_symbol_reader): New
714         function.
715         (Incremental_input_entry_reader::get_output_symbol_index): New
716         function.
717         (Incremental_input_entry_reader::type_): Remove.
718         (Incremental_input_entry_reader::flags_): New data member.
719         (Incremental_inputs_reader::input_file_offset): New function.
720         (Incremental_inputs_reader::input_file_index): New function.
721         (Incremental_inputs_reader::input_file): Call input_file_offset.
722         (Incremental_inputs_reader::input_file_at_offset): New function.
723         (Incremental_relocs_reader::get_r_type): Reformat.
724         (Incremental_relocs_reader::get_r_shndx): Reformat.
725         (Incremental_relocs_reader::get_r_offset): Reformat.
726         (Incremental_relocs_reader::data): New function.
727         (Incremental_binary::Incremental_binary): Initialize new data members.
728         (Incremental_binary::check_inputs): Add cmdline parameter.
729         (Incremental_binary::file_is_unchanged): Remove.
730         (Input_reader::arg_serial): New function.
731         (Input_reader::get_unused_symbol_count): New function.
732         (Input_reader::get_unused_symbol): New function.
733         (Input_reader::do_arg_serial): New function.
734         (Input_reader::do_get_unused_symbol_count): New function.
735         (Input_reader::do_get_unused_symbol): New function.
736         (Incremental_binary::input_file_count): New function.
737         (Incremental_binary::get_input_reader): Change signature to use
738         index instead of filename.
739         (Incremental_binary::file_has_changed): New function.
740         (Incremental_binary::get_input_argument): New function.
741         (Incremental_binary::get_library): New function.
742         (Incremental_binary::get_script_info): New function.
743         (Incremental_binary::init_layout): New function.
744         (Incremental_binary::reserve_layout): New function.
745         (Incremental_binary::output_file): New function.
746         (Incremental_binary::do_check_inputs): New function.
747         (Incremental_binary::do_file_is_unchanged): Remove.
748         (Incremental_binary::do_file_has_changed): New function.
749         (Incremental_binary::do_init_layout): New function.
750         (Incremental_binary::do_reserve_layout): New function.
751         (Incremental_binary::do_input_file_count): New function.
752         (Incremental_binary::do_get_input_reader): Change signature.
753         (Incremental_binary::input_args_map_): New data member.
754         (Incremental_binary::library_map_): New data member.
755         (Incremental_binary::script_map_): New data member.
756         (Sized_incremental_binary::Sized_incremental_binary): Initialize
757         new data members.
758         (Sized_incremental_binary::output_section): New function.
759         (Sized_incremental_binary::inputs_reader): Add const.
760         (Sized_incremental_binary::symtab_reader): Add const.
761         (Sized_incremental_binary::relocs_reader): Add const.
762         (Sized_incremental_binary::got_plt_reader): Add const.
763         (Sized_incremental_binary::get_symtab_view): New function.
764         (Sized_incremental_binary::Inputs_reader): New typedef.
765         (Sized_incremental_binary::Input_entry_reader): New typedef.
766         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
767         (Sized_incremental_binary::do_file_is_unchanged): Remove.
768         (Sized_incremental_binary::do_file_has_changed): New function.
769         (Sized_incremental_binary::do_init_layout): New function.
770         (Sized_incremental_binary::do_reserve_layout): New function.
771         (Sized_input_reader::Inputs_reader): Remove.
772         (Sized_input_reader::Input_entry_reader): Remove.
773         (Sized_input_reader::do_arg_serial): New function.
774         (Sized_input_reader::do_get_unused_symbol_count): New function.
775         (Sized_input_reader::do_get_unused_symbol): New function.
776         (Sized_incremental_binary::do_input_file_count): New function.
777         (Sized_incremental_binary::do_get_input_reader): Change signature;
778         use index instead of filename.
779         (Sized_incremental_binary::section_map_): New data member.
780         (Sized_incremental_binary::input_entry_readers_): New data member.
781         (class Sized_incr_relobj): New class.
782         (class Sized_incr_dynobj): New class.
783         (make_sized_incremental_object): New function.
784         (class Incremental_library): New class.
785         * layout.cc (Free_list::num_lists): New static data member.
786         (Free_list::num_nodes): New static data member.
787         (Free_list::num_removes): New static data member.
788         (Free_list::num_remove_visits): New static data member.
789         (Free_list::num_allocates): New static data member.
790         (Free_list::num_allocate_visits): New static data member.
791         (Free_list::init): New function.
792         (Free_list::remove): New function.
793         (Free_list::allocate): New function.
794         (Free_list::dump): New function.
795         (Free_list::print_stats): New function.
796         (Layout_task_runner::run): Resize output file for incremental updates.
797         (Layout::Layout): Initialize new data members.
798         (Layout::set_incremental_base): New function.
799         (Layout::init_fixed_output_section): New function.
800         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
801         incremental updates.
802         (Layout::create_gold_note): Do not create gold note section for
803         incremental updates.
804         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
805         for incremental updates.
806         (Layout::set_section_offsets): For incremental updates, allocate space
807         from free list.
808         (Layout::create_symtab_sections): Layout with offsets relative to
809         start of section; for incremental updates, allocate space from free
810         list.
811         (Layout::create_shdrs): For incremental updates, allocate space from
812         free list.
813         (Layout::finish_dynamic_section): For incremental updates, do not
814         check --as-needed (fixed in subsequent patch).
815         * layout.h (class Free_list): New class.
816         (Layout::set_incremental_base): New function.
817         (Layout::incremental_base): New function.
818         (Layout::init_fixed_output_section): New function.
819         (Layout::allocate): New function.
820         (Layout::incremental_base_): New data member.
821         (Layout::free_list_): New data member.
822         * main.cc (main): Print Free_list statistics.
823         * object.cc (Relobj::finalize_incremental_relocs): Add
824         clear_counts parameter; clear counts only when clear_counts is set.
825         (Sized_relobj::Sized_relobj): Initialize new base class.
826         (Sized_relobj::do_layout): Don't report special sections.
827         (Sized_relobj::do_for_all_local_got_entries): New function.
828         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
829         symtab_off to all symbol table offsets.
830         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
831         * object.h (class Got_offset_list): Move to top of file.
832         (Object::Object): Allow case where input_file == NULL.
833         (Object::~Object): Likewise.
834         (Object::input_file): Assert that input_file != NULL.
835         (Object::lock): Allow case where input_file == NULL.
836         (Object::unlock): Likewise.
837         (Object::is_locked): Likewise.
838         (Object::token): Likewise.
839         (Object::release): Likewise.
840         (Object::is_incremental): New function.
841         (Object::get_mtime): New function.
842         (Object::for_all_local_got_entries): New function.
843         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
844         (Object::set_is_in_system_directory): New function.
845         (Object::is_in_system_directory): New function.
846         (Object::do_is_incremental): New function.
847         (Object::do_get_mtime): New function.
848         (Object::do_for_all_local_got_entries): New function.
849         (Object::is_in_system_directory_): New data member.
850         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
851         (class Sized_relobj_base): New class.
852         (class Sized_relobj): Derive from Sized_relobj_base.
853         (class Sized_relobj::Symbols): Redeclare from base class.
854         (class Sized_relobj::local_got_offset_list): Remove.
855         (class Sized_relobj::Output_sections): Redeclare from base class.
856         (class Sized_relobj::do_for_all_local_got_entries): New function.
857         (class Sized_relobj::write_local_symbols): Add offset parameter.
858         (class Sized_relobj::local_symbol_offset_): Update comment.
859         (class Sized_relobj::local_dynsym_offset_): Update comment.
860         * options.cc (Input_arguments::add_file): Remove const.
861         * options.h (Input_file_argument::Input_file_argument):
862         Initialize arg_serial_ (all constructors).
863         (Input_file_argument::set_arg_serial): New function.
864         (Input_file_argument::arg_serial): New function.
865         (Input_file_argument::arg_serial_): New data member.
866         (Input_arguments::Input_arguments): Initialize file_count_.
867         (Input_arguments::add_file): Remove const.
868         (Input_arguments::number_of_input_files): New function.
869         (Input_arguments::file_count_): New data member.
870         (Command_line::number_of_input_files): Call
871         Input_arguments::number_of_input_files.
872         * output.cc (Output_segment_headers::Output_segment_headers):
873         Set current size.
874         (Output_section::Input_section::current_data_size): New function.
875         (Output_section::Output_section): Initialize new data members.
876         (Output_section::add_input_section): Don't do merge sections for
877         an incremental link; allocate space from free list for an
878         incremental update.
879         (Output_section::add_output_section_data): Allocate space from
880         free list for an incremental update.
881         (Output_section::update_data_size): New function.
882         (Output_section::set_fixed_layout): New function.
883         (Output_section::reserve): New function.
884         (Output_segment::set_section_addresses): Remove const.
885         (Output_segment::set_section_list_addresses): Remove const; allocate
886         space from free list for an incremental update.
887         (Output_segment::set_offset): Adjust size of RELRO segment for an
888         incremental update.
889         * output.h (Output_data::current_data_size): Move here from
890         child classes.
891         (Output_data::pre_finalize_data_size): New function.
892         (Output_data::update_data_size): New function.
893         (Output_section_headers::update_data_size): new function.
894         (Output_section_data_build::current_data_size): Move to Output_data.
895         (Output_data_strtab::update_data_size): New function.
896         (Output_section::current_data_size): Move to Output_data.
897         (Output_section::set_fixed_layout): New function.
898         (Output_section::has_fixed_layout): New function.
899         (Output_section::reserve): New function.
900         (Output_section::update_data_size): New function.
901         (Output_section::has_fixed_layout_): New data member.
902         (Output_section::free_list_): New data member.
903         (Output_segment::set_section_addresses): Remove const.
904         (Output_segment::set_section_list_addresses): Remove const.
905         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
906         New function.
907         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
908         New function.
909         * readsyms.cc (Read_symbols::do_read_symbols): Add library
910         parameter when calling Add_symbols constructor; store argument
911         serial number for members of a lib group.
912         (Add_symbols::locks): Allow case where token == NULL.
913         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
914         (Read_member::~Read_member): New function.
915         (Read_member::is_runnable): New function.
916         (Read_member::locks): New function.
917         (Read_member::run): New function.
918         (Check_script::~Check_script): New function.
919         (Check_script::is_runnable): New function.
920         (Check_script::locks): New function.
921         (Check_script::run): New function.
922         (Check_library::~Check_library): New function.
923         (Check_library::is_runnable): New function.
924         (Check_library::locks): New function.
925         (Check_library::run): New function.
926         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
927         (Add_symbols::library_): New data member.
928         (class Read_member): New class.
929         (class Check_script): New class.
930         (class Check_library): New class.
931         * reloc.cc (Read_relocs::is_runnable): Allow case where
932         token == NULL.
933         (Read_relocs::locks): Likewise.
934         (Scan_relocs::locks): Likewise.
935         (Relocate_task::locks): Likewise.
936         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
937         to clear counters.
938         (Sized_relobj::incremental_relocs_scan): Fix comment.
939         (Sized_relobj::do_relocate): Pass output file offset to
940         write_local_symbols.
941         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
942         from class declaration.
943         * script.cc (read_input_script): Allocate Script_info; pass
944         argument serial number to report_script.
945         * script.h (class Script_info): Move to incremental.h.
946         * symtab.cc (Symbol_table::add_from_incrobj): New function.
947         * symtab.h (Symbol_table::add_from_incrobj): New function.
948         (Symbol_table::set_file_offset): New function.
949
950 2011-04-05  Cary Coutant  <ccoutant@google.com>
951
952         * incremental-dump.cc (dump_incremental_inputs): Change signature
953         to take a Sized_incremental_binary; change caller.  Use readers
954         in Sized_incremental_binary.
955         * incremental.cc
956         (Sized_incremental_binary::find_incremental_inputs_sections):
957         Rename do_find_incremental_inputs_sections to this.
958         (Sized_incremental_binary::setup_readers): New function.
959         (Sized_incremental_binary::do_check_inputs): Check
960         has_incremental_info_ flag; move setup code to setup_readers;
961         use input readers.
962         (Sized_incremental_binary::do_file_is_unchanged): New function.
963         (Sized_incremental_binary::do_get_input_reader): New function.
964         * incremental.h (class Incremental_binary): Move to end of file.
965         (Incremental_binary::file_is_unchanged): New function.
966         (Incremental_binary::do_file_is_unchanged): New function.
967         (Incremental_binary::Input_reader): New class.
968         (Incremental_binary::get_input_reader): New function.
969         (class Sized_incremental_binary): Move to end of file.
970         (Sized_incremental_binary::Sized_incremental_binary): Setup the
971         input section reader classes.
972         (Sized_incremental_binary::has_incremental_info): New function.
973         (Sized_incremental_binary::inputs_reader): New function.
974         (Sized_incremental_binary::symtab_reader): New function.
975         (Sized_incremental_binary::relocs_reader): New function.
976         (Sized_incremental_binary::got_plt_reader): New function.
977         (Sized_incremental_binary::do_file_is_unchanged): New function.
978         (Sized_incremental_binary::Sized_input_reader): New class.
979         (Sized_incremental_binary::get_input_reader): New function.
980         (Sized_incremental_binary::find_incremental_inputs_sections):
981         Rename do_find_incremental_inputs_sections to this.
982         (Sized_incremental_binary::setup_readers): New function.
983         (Sized_incremental_binary::has_incremental_info_): New data member.
984         (Sized_incremental_binary::inputs_reader_): New data member.
985         (Sized_incremental_binary::symtab_reader_): New data member.
986         (Sized_incremental_binary::relocs_reader_): New data member.
987         (Sized_incremental_binary::got_plt_reader_): New data member.
988         (Sized_incremental_binary::current_input_file_): New data member.
989
990 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
991
992         PR gold/12640
993         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
994         violation.
995
996 2011-03-30  Cary Coutant  <ccoutant@google.com>
997
998         * archive.cc (Archive::include_member): Adjust call to report_object.
999         (Add_archive_symbols::run): Add script_info to call to
1000         report_archive_begin.
1001         (Lib_group::include_member): Adjust call to report_object.
1002         (Add_lib_group_symbols::run): Adjust call to report_object.
1003         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1004         blocks.  Add object count for script input files.
1005         * incremental.cc (Incremental_inputs::report_archive_begin): Add
1006         script_info parameter; change all callers.
1007         (Incremental_inputs::report_object): Add script_info parameter;
1008         change all callers.
1009         (Incremental_inputs::report_script): Store backpointer to
1010         incremental info entry.
1011         (Output_section_incremental_inputs::set_final_data_size): Record
1012         additional information for scripts.
1013         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1014         * incremental.h (Incremental_script_entry::add_object): New function.
1015         (Incremental_script_entry::get_object_count): New function.
1016         (Incremental_script_entry::get_object): New function.
1017         (Incremental_script_entry::objects_): New data member; adjust
1018         constructor.
1019         (Incremental_inputs::report_archive_begin): Add script_info parameter.
1020         (Incremental_inputs::report_object): Add script_info parameter.
1021         (Incremental_inputs_reader::get_object_count): New function.
1022         (Incremental_inputs_reader::get_object_offset): New function.
1023         * options.cc (Input_arguments::add_file): Return reference to
1024         new input argument.
1025         * options.h (Input_argument::set_script_info): New function.
1026         (Input_argument::script_info): New function.
1027         (Input_argument::script_info_): New data member; adjust all
1028         constructors.
1029         (Input_file_group::add_file): Return reference to new input argument.
1030         (Input_file_lib::add_file): Likewise.
1031         (Input_arguments::add_file): Likewise.
1032         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1033         * script.cc (Parser_closure::Parser_closure): Add script_info
1034         parameter; adjust all callers.
1035         (Parser_closure::script_info): New function.
1036         (Parser_closure::script_info_): New data member.
1037         (read_input_script): Report scripts earlier to incremental info.
1038         (script_add_file): Set script_info in Input_argument.
1039         (script_add_library): Likewise.
1040         * script.h (Script_options::Script_info): Rewrite class.
1041
1042 2011-03-29  Cary Coutant  <ccoutant@google.com>
1043
1044         * archive.cc (Library_base::should_include_member): Move
1045         method here from class Archive.
1046         (Archive::Archive): Initialize base class.
1047         (Archive::should_include_member): Move to base class.
1048         (Archive::do_for_all_unused_symbols): New function.
1049         (Add_archive_symbols::run): Remove redundant access to
1050         incremental_inputs.
1051         (Lib_group::Lib_group): Initialize base class.
1052         (Lib_group::do_filename): New function.
1053         (Lib_group::include_member): Pass pointer to Lib_group to
1054         report_object.
1055         (Lib_group::do_for_all_unused_symbols): New function.
1056         (Add_lib_group_symbols::run): Report archive information for
1057         incremental links.
1058         * archive.h (class Library_base): New base class.
1059         (class Archive): Derive from Library_base.
1060         (Archive::filename): Move to base class.
1061         (Archive::set_incremental_info): Likewise.
1062         (Archive::incremental_info): Likewise.
1063         (Archive::Should_include): Likewise.
1064         (Archive::should_include_member): Likewise.
1065         (Archive::Armap_entry): Remove.
1066         (Archive::Unused_symbol_iterator): Remove.
1067         (Archive::unused_symbols_begin): Remove.
1068         (Archive::unused_symbols_end): Remove.
1069         (Archive::do_filename): New function.
1070         (Archive::do_get_mtime): New function.
1071         (Archive::do_for_all_unused_symbols): New function.
1072         (Archive::task_): Move to base class.
1073         (Archive::incremental_info_): Likewise.
1074         (class Lib_group): Derive from Library_base.
1075         (Lib_group::do_filename): New function.
1076         (Lib_group::do_get_mtime): New function.
1077         (Lib_group::do_for_all_unused_symbols): New function.
1078         (Lib_group::task_): Move to base class.
1079         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1080         function.
1081         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1082         function.
1083         * incremental.cc (Incremental_inputs::report_archive_begin):
1084         Use Library_base; call library's get_mtime; add incremental inputs
1085         entry before members.
1086         (class Unused_symbol_visitor): New class.
1087         (Incremental_inputs::report_archive_end): Use Library_base; use
1088         visitor class to record unused symbols; don't add incremental inputs
1089         entry after members.
1090         (Incremental_inputs::report_object): Use Library_base.
1091         * incremental.h
1092         (Incremental_archive_entry::Incremental_archive_entry): Remove
1093         unused Archive parameter.
1094         (Incremental_inputs::report_archive_begin): Use Library_base.
1095         (Incremental_inputs::report_archive_end): Likewise.
1096         (Incremental_inputs::report_object): Likewise.
1097         * object.cc (Sized_relobj::do_for_all_global_symbols): New
1098         function.
1099         * object.h (Object::for_all_global_symbols): New function.
1100         (Object::do_for_all_global_symbols): New function.
1101         (Sized_relobj::do_for_all_global_symbols): New function.
1102         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
1103         function.
1104         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
1105         function.
1106
1107 2011-03-27  Ian Lance Taylor  <iant@google.com>
1108
1109         * archive.cc (Archive::interpret_header): Return -1 if something
1110         goes wrong.  Change callers accordingly.
1111
1112 2011-03-25  Cary Coutant  <ccoutant@google.com>
1113
1114         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1115         * testsuite/Makefile.in: Regenerate.
1116
1117 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
1118
1119         * plugin.cc (get_view): New.
1120         (Plugin::load): Pass get_view to the plugin.
1121         (Plugin_manager::get_view): New.
1122
1123 2011-03-21  Ian Lance Taylor  <iant@google.com>
1124
1125         * testsuite/final_layout.sh: Rewrite to not use dc.
1126         * testsuite/relro_test.sh: Fail if dc is not present.
1127
1128 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1129
1130         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1131         Change == to -eq.
1132         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1133         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1134         Change == to -eq.
1135         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1136         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1137
1138 2011-03-14  Ian Lance Taylor  <iant@google.com>
1139
1140         * script-sections.cc (Sort_output_sections::script_compare):
1141         Rename from is_before, change return type.
1142         (Sort_output_sections::operator()): Adjust accordingly.
1143
1144 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1145
1146         PR gold/12572
1147         * testsuite/odr_violation2.cc: Add comment to make all error line
1148         numbers double digits.
1149         * testsuite/debug_msg.sh: Adjust expected errors.
1150
1151 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1152
1153         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1154         but mark earlier ones as non-canonical
1155         (offset_to_iterator): Update search target and example
1156         (do_addr2line): Return extra lines in a vector*
1157         (format_file_lineno): Extract from do_addr2line
1158         (one_addr2line): Add vector* out-param
1159         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1160         when a lineno entry appeared last for its instruction
1161         (Dwarf_line_info): Add vector* out-param
1162         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1163         * symtab.cc (Odr_violation_compare): Include the lineno in the
1164         comparison again.
1165         (linenos_from_loc): New. Combine the canonical line for an
1166         address with its other lines.
1167         (True_if_intersect): New. Helper functor to make
1168         std::set_intersection a query.
1169         (detect_odr_violations): Compare sets of lines instead of just
1170         one line for each function. This became less deterministic, but
1171         has fewer false positives.
1172         * symtab.h: Declarations.
1173         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1174         mix an optimized and non-optimized object in the same binary
1175         (odr_violation2.so): Same.
1176         * testsuite/Makefile.in: Regenerate from Makefile.am.
1177         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1178         * testsuite/debug_msg.sh: Update line numbers and add
1179         assertions.
1180         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1181         non-optimized context.
1182         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1183         isn't inlined, and use OdrDerived in an optimized context.
1184         * testsuite/odr_header1.h: Defines OdrDerived, where
1185         optimization will change the
1186         first-instruction-in-the-destructor's file and line number.
1187         * testsuite/odr_header2.h: Defines OdrBase.
1188
1189 2011-03-09  Ian Lance Taylor  <iant@google.com>
1190
1191         * fileread.cc (File_read::clear_views): Don't delete the whole
1192         file view.
1193
1194 2011-03-08  Ian Lance Taylor  <iant@google.com>
1195
1196         PR gold/12525
1197         * fileread.cc: #include <climits>.
1198         (GOLD_IOV_MAX): Define.
1199         (File_read::read_multiple): Limit number of entries by iov_max.
1200         * fileread.h (class File_read): Always set max_readv_entries to
1201         128.
1202
1203 2011-03-07  Ian Lance Taylor  <iant@google.com>
1204
1205         PR gold/12525
1206         * options.h (class General_options): Add -dy and -dn.
1207
1208 2011-03-02  Cary Coutant  <ccoutant@google.com>
1209
1210         * testsuite/script_test_9.t: Add TLS segment.
1211
1212 2011-03-02  Simon Baldwin  <simonb@google.com>
1213
1214         * configure.ac: Add check for gnu_indirect_function support in
1215         the toolchain building binutils.
1216         * configure: Rebuild.
1217
1218 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1219
1220         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1221         plugin only symbols.
1222         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1223         in plugin files as not needed in the symbol table.
1224
1225 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1226
1227         * output.cc (Output_section::add_input_section): Delay fill
1228         generation for section ordering.
1229
1230 2011-02-09  Ian Lance Taylor  <iant@google.com>
1231
1232         PR gold/12316
1233         * object.h (class Sized_relobj): Remove clear_local_symbols.
1234         * reloc.cc (Sized_relobj::do_relocate): Don't call
1235         clear_local_symbols.
1236
1237 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1238
1239         * plugin.cc (is_visible_from_outside): Return true for symbols
1240         in the -u option.
1241
1242 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1243
1244         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1245         filename.
1246
1247 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1248
1249         * icf.h (is_section_foldable_candidate): Change type of parameter
1250         to std::string.
1251         * icf.cc (Icf::find_identical_sections): Change type of local variable
1252         section_name to be std::string.
1253         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1254
1255 2011-01-25  Ian Lance Taylor  <iant@google.com>
1256
1257         * script.cc (script_add_extern): Rewrite to use
1258         add_symbol_reference.
1259
1260 2011-01-25  Doug Kwan  <dougkwan@google.com>
1261
1262         * icf.cc (get_section_contents): Always lock section's object.
1263
1264 2011-01-24  Ian Lance Taylor  <iant@google.com>
1265
1266         * options.h (class General_options): Accept
1267         --no-detect-odr-violations.
1268
1269 2011-01-24  Ian Lance Taylor  <iant@google.com>
1270
1271         * version.cc (version_string): Bump to 1.11.
1272
1273 2011-01-24  Ian Lance Taylor  <iant@google.com>
1274
1275         * plugin.cc (class Plugin_rescan): Define new class.
1276         (Plugin_manager::claim_file): Set any_claimed_.
1277         (Plugin_manager::save_archive): New function.
1278         (Plugin_manager::save_input_group): New function.
1279         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1280         necessary.
1281         (Plugin_manager::new_undefined_symbol): New function.
1282         (Plugin_manager::rescan): New function.
1283         (Plugin_manager::rescannable_defines): New function.
1284         (Plugin_manager::add_input_file): Set any_added_.
1285         * plugin.h (class Plugin_manager): define new fields rescannable_,
1286         undefined_symbols_, any_claimed_, and any_added_.  Declare
1287         Plugin_rescan as friend.  Declare new functions.
1288         (Plugin_manager::Rescannable): Define type.
1289         (Plugin_manager::Rescannable_list): Define type.
1290         (Plugin_manager::Undefined_symbol_list): Define type.
1291         (Plugin_manager::Plugin_manager): Initialize new fields.
1292         * archive.cc (Archive::defines_symbol): New function.
1293         (Add_archive_symbols::run): Pass archive to plugins if any.
1294         * archive.h (class Archive): Declare defines_symbol.
1295         * readsyms.cc (Input_group::~Input_group): New function.
1296         (Finish_group::run): Pass input_group to plugins if any.
1297         * readsyms.h (class Input_group): Declare destructor.
1298         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1299         any.
1300
1301 2011-01-10  Ian Lance Taylor  <iant@google.com>
1302
1303         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1304         section as relro.
1305         (Layout::set_segment_offsets): Reset increase_relro before calling
1306         set_section_addresses a second time.
1307
1308 2011-01-04  Cary Coutant  <ccoutant@google.com>
1309
1310         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1311         sections before NOBITS sections.
1312
1313 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1314
1315         * version.cc (print_version): Update copyright to 2011.
1316
1317 2010-12-23  Cary Coutant  <ccoutant@google.com>
1318
1319         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1320         of OS to this->add.  Add OD parameter to second form of the function.
1321
1322 2010-12-20  Ian Lance Taylor  <iant@google.com>
1323
1324         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1325         second of two consecutive entries with same offset.
1326
1327 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1328
1329         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1330         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1331         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1332         to avoid unneeded links against $(LDADD).
1333         * testsuite/Makefile.in: Regenerate.
1334
1335 2010-12-15  Ian Lance Taylor  <iant@google.com>
1336
1337         PR gold/12324
1338         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1339         for R_X86_64_32 and R_X86_64_PC32.
1340         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1341         ver_matching_def_pic.o.
1342         (ver_matching_def_pic.o): New target.
1343
1344 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1345
1346         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1347         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1348         Move definition before File_read::View member definitions.
1349         (File_read::View::~View): Initialize and hold lock before
1350         updating current_mapped_bytes.
1351
1352 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1353
1354         * dwarf_reader.cc: Remove outdated comment.
1355         * gold-threads.cc: Fix typo in error message.
1356         * archive.cc: Fix typos in comments.
1357         * archive.h: Likewise.
1358         * arm-reloc-property.cc: Likewise.
1359         * arm-reloc-property.h: Likewise.
1360         * arm-reloc.def: Likewise.
1361         * arm.cc: Likewise.
1362         * attributes.h: Likewise.
1363         * cref.cc: Likewise.
1364         * ehframe.cc: Likewise.
1365         * fileread.h: Likewise.
1366         * gold.h: Likewise.
1367         * i386.cc: Likewise.
1368         * icf.cc: Likewise.
1369         * incremental.h: Likewise.
1370         * int_encoding.cc: Likewise.
1371         * layout.h: Likewise.
1372         * main.cc: Likewise.
1373         * merge.h: Likewise.
1374         * object.cc: Likewise.
1375         * object.h: Likewise.
1376         * options.cc: Likewise.
1377         * readsyms.cc: Likewise.
1378         * reduced_debug_output.cc: Likewise.
1379         * reloc.cc: Likewise.
1380         * script-sections.cc: Likewise.
1381         * sparc.cc: Likewise.
1382         * symtab.h: Likewise.
1383         * target-reloc.h: Likewise.
1384         * target.cc: Likewise.
1385         * target.h: Likewise.
1386         * timer.cc: Likewise.
1387         * timer.h: Likewise.
1388         * x86_64.cc: Likewise.
1389
1390 2010-12-09  Cary Coutant  <ccoutant@google.com>
1391
1392         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1393         stack.
1394         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1395         parameter; change all callers.
1396         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1397         * options.h (warn_execstack): New option.
1398
1399 2010-12-07  Doug Kwan  <dougkwan@google.com>
1400
1401         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1402         like function call relocations.
1403
1404 2010-12-07  Ian Lance Taylor  <iant@google.com>
1405
1406         * archive.cc (Archive::get_elf_object_for_member): Permit
1407         punconfigured to be NULL.
1408         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1409         (Archive::include_member): Pass NULL to get_elf_object_for_member
1410         if we searched for the archive and this is the first included
1411         object.
1412
1413 2010-12-01  Ian Lance Taylor  <iant@google.com>
1414
1415         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1416         track_relocs_type_ field.
1417         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1418         Set track_relocs_type_.
1419         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1420         contents when using RELA relocs.
1421         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1422         reloc_map_.
1423         * reloc.cc (Track_relocs::next_addend): New function.
1424         * reloc.h (class Track_relocs): Declare next_addend.
1425
1426 2010-12-01  Ian Lance Taylor  <iant@google.com>
1427
1428         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1429         virtual destructor.
1430
1431 2010-12-01  Ian Lance Taylor  <iant@google.com>
1432
1433         * README: Update compilers known to work and fail.
1434
1435 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1436
1437         * configure.in: For --enable-gold, handle value `default' instead of
1438         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1439         not the default.
1440         * configure: Regenerate.
1441
1442 2010-11-18  Doug Kwan  <dougkwan@google.com>
1443
1444         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1445         and right_alignment to be zero.  Store result alignment only if it is
1446         greater than existing alignment.
1447
1448 2010-11-16  Cary Coutant  <ccoutant@google.com>
1449
1450         PR gold/12220
1451         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1452         Check for ".zdebug_line".
1453
1454 2010-11-16  Doug Kwan  <dougkwan@google.com>
1455             Cary Coutant  <ccoutant@google.com>
1456
1457         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1458         by reference; adjust all callers.
1459         * output.cc (Output_segment::set_section_addresses): Adjust references
1460         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1461         list is empty.
1462         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1463         end at page boundary.
1464
1465 2010-11-16  Cary Coutant  <ccoutant@google.com>
1466
1467         PR gold/12220
1468         * layout.cc (Layout::choose_output_section): Transform names of
1469         compressed sections even when using a script with a SECTIONS clause.
1470         (Layout::output_section_name): Remove code to transform
1471         compressed debug section names.
1472         * output.cc (Output_section::add_input_section): Use uncompressed
1473         section size when tracking input sections.
1474
1475 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1476
1477         * symtab.h (Symbol::NON_PIC_REF): Remove.
1478         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1479         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1480         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1481         (Symbol::use_plt_offset): Take a flags argument and pass it
1482         directly to needs_dynamic_reloc.  Restrict check for undefined
1483         weak symbols to function calls.
1484         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1485         (Target_arm::Scan::global): Use it.
1486         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1487         (Target_arm::Relocate::relocate): Likewise.
1488         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1489         parameter with an r_type parameter.  Use get_reference_flags
1490         to get the flags.
1491         (Target_arm::Relocate::relocate): Update accordingly.
1492         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1493         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1494         (Target_i386::Scan::global): Likewise.
1495         (Target_i386::Relocate::relocate): Likewise.
1496         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1497         parameter with an r_type parameter.  Use get_reference_flags
1498         to get the flags.
1499         (Target_i386::Relocate::relocate): Update accordingly.
1500         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1501         (Target_powerpc::Scan::global): Use it.
1502         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1503         (Target_powerpc::Relocate::relocate): Likewise.
1504         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1505         (Target_sparc::Scan::global): Use it.
1506         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1507         (Target_sparc::Relocate::relocate): Likewise.
1508         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1509         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1510         (Target_x86_64::Scan::global): Likewise.
1511         (Target_x86_64::Relocate::relocate): Likewise.
1512
1513 2010-11-08  Doug Kwan  <dougkwan@google.com>
1514             Cary Coutant  <ccoutant@google.com>
1515
1516         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1517         (Arm_exidx_merge_section::section_contents_): New data member.
1518         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1519         (Arm_input_section::~Arm_input_section): De-allocate memory.
1520         (Arm_input_section::original_contents_): New data member.       
1521         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1522         in parameters instead of calling Object::section_contents without
1523         locking.
1524         (Arm_output_section::group_section): New parameter TASK.  Pass it
1525         to callees that need locking objects.
1526         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1527         to lock EXIDX input sections.  Fix a formatting issue.  Call
1528         Arm_exidx_merged_section::build_contents to create merged section
1529         contents.
1530         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1531         to lock object of stub table owner.
1532         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1533         TEXT_SIZE to initialize data member TEXT_SIZE_.
1534         (Arm_exidx_input_section::addralign): Fix typo in comment.
1535         (Arm_exidx_input_section::text_size): New method.
1536         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1537         that require locking objects.  Lock objects before scanning for stubs
1538         and updating local symbols.
1539         (Arm_input_section<big_endian>::init): Copy contents of original
1540         input section.
1541         (Arm_input_section<big_endian>::do_write): Use saved contents of
1542         original input section instead of calling Object::section_contents
1543         without locking.
1544         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1545         size without calling Object::section_size().
1546         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1547         for size.  Allocate a buffer for merged EXIDX entries.
1548         (Arm_exidx_merged_section::build_contents): New method.
1549         (Arm_exidx_merged_section::do_write): Move merge section contents
1550         building code to Arm_exidx_merged_section::build_contetns.  Write
1551         out contetns in buffer instead of building it on the fly.
1552         (Arm_relobj::make_exidx_input_section): Also pass text section size
1553         to Arm_exidx_input_section constructor.
1554         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1555         (Arm_dynobj::do_read_symbols): Fix memory leak.
1556         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1557         * target.h: (class Task): Add forward declaration.
1558         (Target::relax): Add new parameter TASK and pass it to
1559         Target::do_relax().
1560         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1561
1562 2010-11-05  Cary Coutant  <ccoutant@google.com>
1563
1564         PR gold/10708
1565         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1566         object when reading from the file.
1567         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1568         second layout pass.
1569         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1570         when reading section contents.
1571         (get_section_contents): Likewise.
1572         (icf::find_identical_sections): Likewise.
1573         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1574         object when reading from the file.
1575         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1576         the object when doing deferred section layout.
1577
1578 2010-11-03  Nick Clifton  <nickc@redhat.com>
1579
1580         PR gold/12001
1581         * script.h (class Symbol_assignment: name): New member.  Returns
1582         the name of the symbol.
1583         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1584         Returns true if the given symbol name is on the list of
1585         assignments wating to be processed.
1586         * archive.cc (should_incldue_member): If the symbol is undefined,
1587         check to see if it is on the list of symbols pending assignment.
1588
1589 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1590
1591         * script-sections.cc (Script_sections::find_memory_region): Check
1592         for a NULL output section pointer.
1593
1594 2010-10-29  Doug Kwan  <dougkwan@google.com>
1595
1596         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1597         Output_section::add_relaxed_input_section.
1598         * output.cc (Output_section::add_relaxed_input_section): Add new
1599         arguments LAYOUT and NAME.  Set section order index.
1600         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1601         Copy section order index.
1602         * output.h (Output_section::add_relaxed_input_section): Add new
1603         arguments LAYOUT and NAME.
1604
1605 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1606
1607         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1608         NATIVE_OR_CROSS_LINKER.
1609         * testsuite/Makefile.in: Regenerate.
1610
1611 2010-10-20  Doug Kwan  <dougkwan@google.com>
1612
1613         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1614         without SHF_LINK_ORDER flags.
1615         * layout.cc (Layout::choose_output_section): Do not filter
1616         SHF_LINK_ORDER flag in a relocatable link.
1617
1618 2010-10-17  Cary Coutant  <ccoutant@google.com>
1619
1620         * output.h (Output_segment::set_section_addresses): Change function
1621         signature.  Update all callers.
1622         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1623         sections.
1624         (Output_segment::set_section_addresses): Align after last TLS
1625         section.  Add padding before last relro section instead of after.
1626
1627 2010-10-17  Doug Kwan  <dougkwan@google.com>
1628
1629         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1630         GOT output section to be writable.
1631
1632 2010-10-14  Cary Coutant  <ccoutant@google.com>
1633
1634         * debug.h (DEBUG_INCREMENTAL): New flag.
1635         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1636         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1637         mode.
1638         * incremental.cc (report_command_line): Ignore all forms of
1639         --incremental.
1640         * layout.cc (Layout::Layout): Check parameters for incremental link
1641         mode.
1642         * options.cc (General_options::parse_incremental): New function.
1643         (General_options::parse_no_incremental): New function.
1644         (General_options::parse_incremental_full): New function.
1645         (General_options::parse_incremental_update): New function.
1646         (General_options::incremental_mode_): New data member.
1647         (General_options::finalize): Check incremental_mode_.
1648         * options.h (General_options): Update help text for --incremental.
1649         Add --no-incremental, --incremental-full, --incremental-update.
1650         (General_options::Incremental_mode): New enum type.
1651         (General_options::incremental_mode): New function.
1652         (General_options::incremental_mode_): New data member.
1653         * parameters.cc (Parameters::incremental_mode_): New data member.
1654         (Parameters::set_options): Set incremental_mode_.
1655         (Parameters::set_incremental_full): New function.
1656         (Parameters::incremental): New function.
1657         (Parameters::incremental_update): New function.
1658         (set_parameters_incremental_full): New function.
1659         * parameters.h (Parameters::set_incremental_full): New function.
1660         (Parameters::incremental): New function.
1661         (Parameters::incremental_update): New function.
1662         (Parameters::incremental_mode_): New data member.
1663         (set_parameters_incremental_full): New function.
1664         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1665         incremental link mode.
1666         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1667         (Sized_relobj::do_relocate_sections): Likewise.
1668         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1669         option.
1670         * testsuite/Makefile.in: Regenerate.
1671         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1672
1673 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1674
1675         * script-sections.h (class Script_sections): Make
1676         Sections_elements typedef public.
1677         * script-sections.cc (class Sort_output_sections): Add elements_
1678         field.  Add constructor which sets it; change all callers.
1679         (Sort_output_sections::is_before): New function.
1680         (Sort_output_sections::operator()): Call is_before.
1681         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1682         conditional.
1683         * testsuite/script_test_10.sh: New test. Test script section
1684         order.
1685         * testsuite/script_test_10.t: Likewise.
1686         * testsuite/script_test_10.s: Likewise.
1687         * testsuite/Makefile.am: Wrap the cross linker tests and the
1688         common tests into NATIVE_OR_CROSS_LINKER.
1689         (check_SCRIPTS): Add script_test_10.sh.
1690         (check_DATA): Add script_test_10.stdout.
1691         (script_test_10.o, script_test_10): New targets.
1692         (script_test_10.stdout): New target.
1693         * configure, testsuite/Makefile.in: Regenerate.
1694
1695 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1696
1697         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1698         error for the deprecated relocations.
1699         (Target_arm::Scan::global): Likewise.
1700         (Target_arm::Relocate::relocate): Likewise.
1701
1702 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1703
1704         * fileread.cc (Input_file::find_file): Initialize *found_name
1705         and *namep when using the fallback search for case 4.
1706
1707 2010-10-11  Cary Coutant  <ccoutant@google.com>
1708
1709         * options.h (class General_options): Redefine -z lazy as an alias for
1710         the negation of -z now.
1711
1712 2010-10-11  Ian Lance Taylor  <iant@google.com>
1713
1714         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1715         binding.
1716
1717 2010-10-06  Nick Clifton  <nickc@redhat.com>
1718
1719         * script-sections.cc(class Memory_region): Remove
1720         current_lma_offset_ field.  Rename current_vma_offset_ to
1721         current_offset_.  Add last_section_ field.
1722         (Memory_region::get_current_vma_address): Rename to
1723         get_current_address.
1724         (Memory_region::get_current_lma_address): Delete.
1725         (Memory_region::increment_vma_offset): Rename to
1726         increment_offset.
1727         (Memory_region::increment_lma_offset): Delete.
1728         (Memory_region::attributes_compatible): New method.  Returns
1729         true if the provided section is compatible with the region.
1730         (Memory_region::get_last_section): New method.  Returns the last
1731         section to use the region.
1732         (Memory_region::set_last_section): New method.  Stores the last
1733         section to use the region.
1734         (Script_sections::block_in_region): New method.  Returns true if
1735         a block of memory is contained within a region.
1736         (Script_sections::find_memory_region): New method.  Locates a
1737         memory region to be used to set a VMA or LMA address.
1738         (Output_section_definition::set_section_addresses): Add code to
1739         check for addresses set by memory regions.
1740         (Output_segment::set_section_addresses): Remove memory region
1741         walking code.
1742         (Script_sections::create_segment): Add a warning if a header
1743         segment is created outside of any region.
1744         * script-sections.h (class Script_sections): Add prototypes for
1745         find_memory_region and block_in_region methods.
1746         * testsuite/memory_test.s: Use .long instead of .word.
1747         * testsuite/memory_test.t: Add some more output sections.
1748         * testsuite/memory_test.sh: Update expected output.
1749
1750 2010-10-02  Doug Kwan  <dougkwan@google.com>
1751
1752         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1753         defintion to symtab.h
1754         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1755         declaration to defintion.
1756
1757 2010-10-01  Nick Clifton  <nickc@redhat.com>
1758
1759         * expression.cc (eval): Replace dummy argument with NULL.
1760         (eval_maybe_dot): Check for a NULL result section pointer.
1761         (Symbol_expression::value): Likewise.
1762         (Dot_expression::value): Likewise.
1763         (BINARY_EXPRESSION): Likewise.
1764         (Max_expression::value): Likewise.
1765         (Min_expression::value): Likewise.
1766         (Absolute_expression::value): Likewise.
1767         (Addr_expression::value_from_output_section): Likewise.
1768         (Loaddddr_expression::value_from_output_section): Likewise.
1769         (Segment_start_expression::value): Likewise.
1770         * script-sections.cc
1771         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1772         argument with NULL.
1773         (Sections_elememt_dot_assignment::set_section_addresses):
1774         Likewise.
1775         (Output_data_expression::do_write_to_buffer): Likewise.
1776         (Output_section_definition::finalize_symbols): Likewise.
1777         (Output_section_definition::set_section_addresses): Likewise.
1778
1779 2010-09-30  Doug Kwan  <dougkwan@google.com>
1780
1781         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1782
1783 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1784
1785         * target.h (Target::can_icf_inline_merge_sections): New virtual
1786         function.
1787         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1788         virtual function.
1789         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1790         virtual function.
1791         * icf.cc (get_section_contents): Inline merge sections only when
1792         target allows it.
1793
1794 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1795
1796         * configure: Regenerate.
1797
1798 2010-09-17  Ian Lance Taylor  <iant@google.com>
1799
1800         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1801         * testsuite/Makefile.am (memory_test.o): New target.
1802         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1803         memory_test.t.
1804         * testsuite/Makefile.in: Rebuild.
1805
1806 2010-09-17  Doug Kwan  <dougkwan@google.com>
1807
1808         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1809         defintion if relocation uses GOT entries of the symbol.
1810         * testsuite/icf_safe_test.sh: Fix test.
1811         * testsuite/icf_safe_so_test.sh: Fix test.
1812
1813 2010-09-16  Cary Coutant  <ccoutant@google.com>
1814
1815         * script_sections.cc (class Memory_region): Remove "NULL" from
1816         vector initializations.
1817
1818 2010-09-15  Cary Coutant  <ccoutant@google.com>
1819
1820         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1821         Resolve forwarding symbols.
1822
1823 2010-09-15  Doug Kwan  <dougkwan@google.com>
1824
1825         * gold/testsuite/script_test_3.t: Add ARM special sections.
1826         * gold/testsuite/script_test_4.t: Same.
1827         * gold/testsuite/script_test_5.t: Same.
1828         * gold/testsuite/script_test_6.t: Same.
1829         * gold/testsuite/script_test_7.t: Same.
1830         * gold/testsuite/script_test_7.t: Same.
1831         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1832
1833 2010-09-14  Cary Coutant  <ccoutant@google.com>
1834
1835         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1836         (Target_x86_64::Relocate::relocate_tls): Replace check for
1837         saw_tls_block_reloc_ with test for executable section.
1838
1839 2010-09-12  Cary Coutant  <ccoutant@google.com>
1840
1841         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1842         position-independent executables to shared libraries need dynamic
1843         relocations.
1844         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1845         position-independent executables.
1846         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1847         * testsuite/Makefile.in: Regenerate.
1848
1849 2010-09-10  Nick Clifton  <nickc@redhat.com>
1850
1851         PR gold/11997
1852         * testsuite/memory_test.t: Discard any sections that are not
1853         needed.
1854
1855 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1856
1857         PR gold/11996
1858         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1859         "This::" to work around a bug in gcc 4.2.
1860
1861         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1862
1863 2010-09-09  Rafael Espindola  <espindola@google.com>
1864
1865         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1866         sections with different PF_X flags in the same segment.
1867         (Layout::find_first_load_seg): Search all segments to find the first
1868         one.
1869         * options.h (rosegment): New.
1870
1871 2010-09-08  Rafael Espindola  <espindola@google.com>
1872
1873         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1874
1875 2010-09-08  Doug Kwan  <dougkwan@google.com>
1876
1877         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1878         (Arm_relobj::do_relocate_sections): Add new parameter for output
1879         file to match the parent.
1880         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1881         of local symbols instead of input values.  Update code to track
1882         changes in gold::relocate_section.
1883         * object.cc (Sized_relobj::compute_final_local_value): New methods.
1884         (Sized_relobj::compute_final_local_value_internal): New methods.
1885         (Sized_relobj::do_finalize_local_symbols): Move code from loop
1886         body into private version of Sized_relobj::compute_final_local_value.
1887         Call the inline method.
1888         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
1889         merged symbol value if there is one.
1890         (Symbol_value::has_output_value): New method defintiion.
1891         (Sized_relobj::Compute_final_local_value_status): New enum type.
1892         (Sized_relobj::compute_final_local_value): New methods.
1893         (Sized_relobj::compute_final_local_value_internal): New methods.
1894         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1895         and arm_cortex_a8.sh.
1896         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1897         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1898         New tests.
1899         * Makefile.in: Regenerate.
1900         * testsuite/arm_bl_out_of_range.s: Update test.
1901         * testsuite/thumb_bl_out_of_range.s: Ditto.
1902         * testsuite/thumb_blx_out_of_range.s: Ditto.
1903         * testsuite/arm_branch_out_of_range.sh: New file.
1904         * testsuite/arm_cortex_a8.sh: Ditto.
1905         * testsuite/arm_cortex_a8_b.s: Ditto.
1906         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1907         * testsuite/arm_cortex_a8_b_local.s: Ditto.
1908         * testsuite/arm_cortex_a8_bl.s: Ditto.
1909         * testsuite/arm_cortex_a8_blx.s: Ditto.
1910         * testsuite/arm_cortex_a8_local.s: Ditto.
1911         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1912         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1913
1914 2010-09-08  Rafael Espindola  <espindola@google.com>
1915
1916         * Makefile.am (memory_test.stdout): Run readelf with -W.
1917         * Makefile.in: Regenerate.
1918         * testsuite/memory_test.sh: Make the regexps accept both 32 and
1919         64 bit output.
1920
1921 2010-09-08  Rafael Espindola  <espindola@google.com>
1922
1923         * script-sections.cc (Script_sections::add_memory_region): Convert
1924         field precision to int.
1925         * script.cc (script_set_section_region, script_set_section_region):
1926         Convert field precision to int.
1927
1928 2010-09-08  Rafael Espindola  <espindola@google.com>
1929
1930         * arm.cc (do_finalize_sections): Create the __exidx_start and
1931         __exdix_end symbols even when the section is missing.
1932
1933 2010-09-08  Nick Clifton  <nickc@redhat.com>
1934
1935         * README: Remove claim that MEMORY is not supported.
1936         * expression.cc (script_exp_function_origin)
1937         (script_exp_function_length): Move from here to ...
1938         * script.cc: ... here.
1939         (script_set_section_region, script_add_memory)
1940         (script_parse_memory_attr, script_include_directive): New
1941         functions.
1942         * script-sections.cc
1943         (class Memory_region): New class.
1944         (class Output_section_definition): Add set_memory_region,
1945         set_section_vma, set_section_lma and get_section_name methods.
1946         (class Script_Sections): Add add_memory_region,
1947         find_memory_region, find_memory_region_origin,
1948         find_memory_region_length and set_memory_region methods.
1949         Have set_section_addresses method walk the list of set memory
1950         regions.
1951         Extend the print methos to display memory regions.
1952         * script-sections.h: Add prototypes for new methods.
1953         Add enum for MEMORY region attributes.
1954         * yyscript.y: Add support for parsing MEMORY regions.
1955         * script-c.h: Add prototypes for new functions.
1956         * testsuite/Makefile.am: Add test of MEMORY region functionality.
1957         * testsuite/Makefile.in: Regenerate.
1958         * testsuite/memory_test.sh: New script.
1959         * testsuite/memory_test.s: New assembler source file.
1960         * testsuite/memory_test.t: New linker script.
1961
1962 2010-08-27  Doug Kwan  <dougkwan@google.com>
1963
1964         * gold/resolve.cc (Symbol_table::should_override): Let a weak
1965         reference override an existing dynamic weak reference.
1966         * testsuite/Makefile.am: Add new test dyn_weak_ref.
1967         * testsuite/Makefile.in: Regenerate.
1968         * testsuite/dyn_weak_ref.sh: New file.
1969         * testsuite/dyn_weak_ref_1.c: Ditto.
1970         * testsuite/dyn_weak_ref_2.c: Ditto.
1971
1972 2010-08-27  Ian Lance Taylor  <iant@google.com>
1973
1974         * incremental.h (class Incremental_input_entry): Add virtual
1975         destructor.
1976
1977 2010-08-27  Ian Lance Taylor  <iant@google.com>
1978
1979         * testsuite/start_lib_test_3.c: Mark t3 as used.
1980
1981 2010-08-27  Nick Clifton  <nickc@redhat.com>
1982
1983         * options.cc (version_script): Fix small typo in previous
1984         whitespace tidyup.
1985
1986 2010-08-25  Nick Clifton  <nickc@redhat.com>
1987
1988         * archive.cc: Formatting fixes: Remove whitespace between
1989         typename and following asterisk.  Remove whitespace between
1990         function name and opening parenthesis.
1991         * archive.h: Likewise.
1992         * arm.cc: Likewise.
1993         * attributes.cc: Likewise.
1994         * attributes.h: Likewise.
1995         * common.cc: Likewise.
1996         * copy-relocs.cc: Likewise.
1997         * dirsearch.h: Likewise.
1998         * dynobj.cc: Likewise.
1999         * ehframe.cc: Likewise.
2000         * ehframe.h: Likewise.
2001         * expression.cc: Likewise.
2002         * fileread.cc: Likewise.
2003         * fileread.h: Likewise.
2004         * gc.h: Likewise.
2005         * gold-threads.cc: Likewise.
2006         * gold.cc: Likewise.
2007         * i386.cc: Likewise.
2008         * icf.h: Likewise.
2009         * incremental-dump.cc: Likewise.
2010         * incremental.cc: Likewise.
2011         * layout.cc: Likewise.
2012         * layout.h: Likewise.
2013         * main.cc: Likewise.
2014         * merge.cc: Likewise.
2015         * merge.h: Likewise.
2016         * object.cc: Likewise.
2017         * object.h: Likewise.
2018         * options.cc: Likewise.
2019         * options.h: Likewise.
2020         * output.cc: Likewise.
2021         * output.h: Likewise.
2022         * plugin.cc: Likewise.
2023         * plugin.h: Likewise.
2024         * powerpc.cc: Likewise.
2025         * reloc.cc: Likewise.
2026         * script-c.h: Likewise.
2027         * script-sections.cc: Likewise.
2028         * script.cc: Likewise.
2029         * stringpool.cc: Likewise.
2030         * symtab.cc: Likewise.
2031         * symtab.h: Likewise.
2032         * target.cc: Likewise.
2033         * timer.cc: Likewise.
2034         * timer.h: Likewise.
2035         * version.cc: Likewise.
2036         * x86_64.cc: Likewise.
2037
2038 2010-08-24  Nick Clifton  <nickc@redhat.com>
2039
2040         PR 11899
2041         * layout.cc (segment_precedes): Sort segments by their physical
2042         addresses, if they have been set.
2043
2044 2010-08-23  Cary Coutant  <ccoutant@google.com>
2045
2046         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2047         symbols data.
2048         (Lib_group::include_member): Unlock object after deleting its
2049         symbols data.
2050         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2051         the bug fixed here.
2052
2053 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
2054             Cary Coutant  <ccoutant@google.com>
2055
2056         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2057         constructor, and set_blocker.
2058         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2059         readsyms_blocker_.
2060         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2061         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2062         * testsuite/Makefile.am (start_lib_test): New test case.
2063         * testsuite/Makefile.in: Regenerate.
2064         * testsuite/start_lib_test_main.c: New file.
2065         * testsuite/start_lib_test_1.c: New file.
2066         * testsuite/start_lib_test_2.c: New file.
2067         * testsuite/start_lib_test_3.c: New file.
2068
2069 2010-08-19  Ian Lance Taylor  <iant@google.com>
2070
2071         * Makefile.in: Rebuild with automake 1.11.1.
2072         * aclocal.m4: Likewise.
2073         * testsuite/Makefile.in: Likewise.
2074
2075 2010-08-19  Ian Lance Taylor  <iant@google.com>
2076
2077         PR 10893
2078         * i386.cc (class Output_data_plt_i386): Update declarations.
2079         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
2080         local_ifuncs_ fields.
2081         (Target_i386::do_plt_section_for_global): New function.
2082         (Target_i386::do_plt_section_for_local): New function.
2083         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2084         parameter; change all callers.  Initialize global_ifuncs_ and
2085         local_ifuncs_.  If doing a static link define __rel_iplt_start and
2086         __rel_iplt_end.
2087         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2088         (Output_data_plt_i386::add_local_ifunc_entry): New function.
2089         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2090         symbols.
2091         (Target_i386::make_plt_section): New function, broken out of
2092         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
2093         (Target_i386::make_plt_entry): Call make_plt_section.
2094         (Target_i386::make_local_ifunc_plt_entry): New function.
2095         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2096         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
2097         R_386_IRELATIVE to switch.
2098         (Target_i386::Scan::global): Likewise.
2099         (Target_i386::Relocate::relocate): Likewise.
2100         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2101         switch.
2102         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2103         (Target_x86_64::do_plt_section_for_global): New function.
2104         (Target_x86_64::do_plt_section_for_local): New function.
2105         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2106         parameter; change all callers.  If doing a static link define
2107         __rela_iplt_start and __rela_iplt_end.
2108         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2109         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2110         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2111         to point to .plt.
2112         (Target_x86_64::make_local_ifunc_plt_entry): New function.
2113         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2114         switch.
2115         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2116         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
2117         R_X86_64_IRELATIVE to switch.
2118         (Target_x86_64::Scan::global): Likewise.
2119         (Target_x86_64::Relocate::relocate): Likewise.
2120         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2121         switch.
2122         * target.h (class Target): Add plt_section_for_global and
2123         plt_section_for_local functions.  Add do_plt_section_for_global
2124         and do_plt_section_for_local virtual functions.
2125         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2126         clarifying comments.
2127         (Symbol::use_plt_offset): Handle IFUNC symbol.
2128         * object.cc (Sized_relobj::Sized_relobj): Initialize
2129         local_plt_offsets_.
2130         (Sized_relobj::local_has_plt_offset): New function.
2131         (Sized_relobj::local_plt_offset): New function.
2132         (Sized_relobj::set_local_plt_offset): New function.
2133         (Sized_relobj::do_count): Handle IFUNC symbol.
2134         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2135         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2136         is_ifunc_symbol functions.
2137         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2138         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2139         local_plt_offsets_ field.
2140         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2141         * output.h (class Output_section_data): Add non-const
2142         output_section function.
2143         (class Output_data_got): Update declarations.
2144         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2145         Add use_plt_offset parameter to global and local constructors.
2146         Change all callers.  Change local_sym_index_ field to 31 bits.
2147         Change GSYM_CODE and CONSTANT_CODE accordingly.
2148         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2149         doing a static link don't set sh_link field.
2150         (Output_data_got::Got_entry::write): Use PLT offset if
2151         appropriate.
2152         (Output_data_got::add_global_plt): New function.
2153         (Output_data_got::add_local_plt): New function.
2154         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2155         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2156         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2157         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2158         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2159         IFUNC conditional.
2160         * testsuite/ifunc-sel.h: New file.
2161         * testsuite/ifuncmain1.c: New file.
2162         * testsuite/ifuncmain1vis.c: New file.
2163         * testsuite/ifuncmod1.c: New file.
2164         * testsuite/ifuncdep2.c: New file.
2165         * testsuite/ifuncmain2.c: New file.
2166         * testsuite/ifuncmain3.c: New file.
2167         * testsuite/ifuncmod3.c: New file.
2168         * testsuite/ifuncmain4.c: New file.
2169         * testsuite/ifuncmain5.c: New file.
2170         * testsuite/ifuncmod5.c: New file.
2171         * testsuite/ifuncmain6pie.c: New file.
2172         * testsuite/ifuncmod6.c: New file.
2173         * testsuite/ifuncmain7.c: New file.
2174         * configure, testsuite/Makefile.in: Rebuild.
2175
2176 2010-08-18  Ian Lance Taylor  <iant@google.com>
2177
2178         * incremental.cc
2179         (Output_section_incremental_inputs::write_input_files): Add cast
2180         to avoid signed/unsigned comparison warning.
2181         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2182
2183 2010-08-12  Cary Coutant  <ccoutant@google.com>
2184
2185         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2186
2187 2010-08-13  Ian Lance Taylor  <iant@google.com>
2188
2189         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2190
2191 2010-08-12  Cary Coutant  <ccoutant@google.com>
2192             Doug Kwan  <dougkwan@google.com>
2193
2194         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2195         defintion overrides non-weak undef, remember that the original undef
2196         is not weak.
2197         * symtab.cc (Symbol_table::sized_write_global): For undef without
2198         an original weak binding, set binding to global in output.
2199         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2200         * testsuite/Makefile.in: Regenerate.
2201         * testsuite/strong_ref_weak_def.sh: New file.
2202         * testsuite/strong_ref_weak_def_1.c: Ditto.
2203         * testsuite/strong_ref_weak_def_2.c: Ditto.
2204
2205 2010-08-12  Cary Coutant  <ccoutant@google.com>
2206
2207         * testsuite/incremental_test.sh: Rewrite.
2208         * testsuite/incremental_test_1.c: Rewrite.
2209         * testsuite/incremental_test_2.c: Rewrite.
2210
2211 2010-08-12  Cary Coutant  <ccoutant@google.com>
2212
2213         * arm.cc (Target_arm::got_size): Add const.
2214         (Target_arm::got_entry_count): New function.
2215         (Target_arm::plt_entry_count): New function.
2216         (Target_arm::first_plt_entry_offset): New function.
2217         (Target_arm::plt_entry_size): New function.
2218         (Output_data_plt_arm::entry_count): New function.
2219         (Output_data_plt_arm::first_plt_entry_offset): New function.
2220         (Output_data_plt_arm::get_plt_entry_size): New function.
2221         * i386.cc (Target_i386::got_size): Add const.
2222         (Target_i386::got_entry_count): New function.
2223         (Target_i386::plt_entry_count): New function.
2224         (Target_i386::first_plt_entry_offset): New function.
2225         (Target_i386::plt_entry_size): New function.
2226         (Output_data_plt_i386::entry_count): New function.
2227         (Output_data_plt_i386::first_plt_entry_offset): New function.
2228         (Output_data_plt_i386::get_plt_entry_size): New function.
2229         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2230         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2231         * incremental.cc: Include target.h.
2232         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2233         parameter.  Adjust all callers.  Find incremental_got_plt section.
2234         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2235         section.
2236         (Output_section_incremental_inputs::set_final_data_size): Calculate
2237         size of incremental_got_plt section.
2238         (Output_section_incremental_inputs::do_write): Write the
2239         incremental_got_plt section.
2240         (Got_plt_view_info): New struct.
2241         (Local_got_offset_visitor): New class.
2242         (Global_got_offset_visitor): New class.
2243         (Global_symbol_visitor_got_plt): New class.
2244         (Output_section_incremental_inputs::write_got_plt): New function.
2245         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2246         Add parameter.  Adjust all callers.
2247         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2248         (Incremental_inputs::got_plt_section): New function.
2249         (Incremental_inputs::got_plt_section_): New data member.
2250         (Incremental_got_plt_reader): New class.
2251         * layout.cc (Layout::create_incremental_info_sections): Add the
2252         incremental_got_plt section.
2253         * object.h (Got_offset_list::get_list): New function.
2254         (Got offset_list::for_all_got_offsets): New function.
2255         (Sized_relobj::local_got_offset_list): New function.
2256         * powerpc.cc (Target_powerpc::got_size): Add const.
2257         (Target_powerpc::got_entry_count): New function.
2258         (Target_powerpc::plt_entry_count): New function.
2259         (Target_powerpc::first_plt_entry_offset): New function.
2260         (Target_powerpc::plt_entry_size): New function.
2261         (Output_data_plt_powerpc::entry_count): New function.
2262         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2263         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2264         * sparc.cc (Target_sparc::got_size): Add const.
2265         (Target_sparc::got_entry_count): New function.
2266         (Target_sparc::plt_entry_count): New function.
2267         (Target_sparc::first_plt_entry_offset): New function.
2268         (Target_sparc::plt_entry_size): New function.
2269         (Output_data_plt_sparc::entry_count): New function.
2270         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2271         (Output_data_plt_sparc::get_plt_entry_size): New function.
2272         * symtab.h (Symbol::got_offset_list): New function.
2273         (Symbol_table::for_all_symbols): New function.
2274         * target.h (Sized_target::got_entry_count): New function.
2275         (Sized_target::plt_entry_count): New function.
2276         (Sized_target::plt_entry_size): New function.
2277         * x86_64.cc (Target_x86_64::got_size): Add const.
2278         (Target_x86_64::got_entry_count): New function.
2279         (Target_x86_64::plt_entry_count): New function.
2280         (Target_x86_64::first_plt_entry_offset): New function.
2281         (Target_x86_64::plt_entry_size): New function.
2282         (Output_data_plt_x86_64::entry_count): New function.
2283         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2284         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2285
2286 2010-08-12  Cary Coutant  <ccoutant@google.com>
2287
2288         * archive.cc: Include incremental.h.
2289         (Archive::Archive): Initialize incremental_info_.
2290         (Archive::include_member): Record archive members in incremental info.
2291         (Add_archive_symbols::run): Record begin and end of an archive in
2292         incremental info.
2293         (Lib_group::include_member): Record objects in incremental info.
2294         * archive.h (Incremental_archive_entry): Forward declaration.
2295         (Archive::set_incremental_info): New member function.
2296         (Archive::incremental_info): New member function.
2297         (Archive::Unused_symbol_iterator): New class.
2298         (Archive::unused_symbols_begin): New member function.
2299         (Archive::unused_symbols_end): New member function.
2300         (Archive::incremental_info_): New data member.
2301         * incremental-dump.cc (find_input_containing_global): New function.
2302         (dump_incremental_inputs): Dump new incremental info sections.
2303         * incremental.cc: Include symtab.h.
2304         (Output_section_incremental_inputs): New class.
2305         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2306         new incremental info sections.
2307         (Sized_incremental_binary::do_check_inputs): Likewise.
2308         (Incremental_inputs::report_archive): Remove.
2309         (Incremental_inputs::report_archive_begin): New function.
2310         (Incremental_inputs::report_archive_end): New function.
2311         (Incremental_inputs::report_object): New function.
2312         (Incremental_inputs::finalize_inputs): Remove.
2313         (Incremental_inputs::report_input_section): New function.
2314         (Incremental_inputs::report_script): Rewrite.
2315         (Incremental_inputs::finalize): Do nothing but finalize string table.
2316         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2317         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2318         (Incremental_inputs::create_data_sections): New function.
2319         (Incremental_inputs::relocs_entsize): New function.
2320         (Output_section_incremental_inputs::set_final_data_size): New function.
2321         (Output_section_incremental_inputs::do_write): New function.
2322         (Output_section_incremental_inputs::write_header): New function.
2323         (Output_section_incremental_inputs::write_input_files): New function.
2324         (Output_section_incremental_inputs::write_info_blocks): New function.
2325         (Output_section_incremental_inputs::write_symtab): New function.
2326         * incremental.h (Incremental_script_entry): Forward declaration.
2327         (Incremental_object_entry): Forward declaration.
2328         (Incremental_archive_entry): Forward declaration.
2329         (Incremental_inputs): Forward declaration.
2330         (Incremental_inputs_header_data): Remove.
2331         (Incremental_inputs_header): Remove.
2332         (Incremental_inputs_header_write): Remove.
2333         (Incremental_inputs_entry_data): Remove.
2334         (Incremental_inputs_entry): Remove.
2335         (Incremental_inputs_entry_write): Remove.
2336         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2337         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2338         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2339         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2340         Likewise.
2341         (Incremental_input_entry): New class.
2342         (Incremental_script_entry): New class.
2343         (Incremental_object_entry): New class.
2344         (Incremental_archive_entry): New class.
2345         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2346         (Incremental_inputs::report_inputs): Remove.
2347         (Incremental_inputs::report_archive): Remove.
2348         (Incremental_inputs::report_archive_begin): New function.
2349         (Incremental_inputs::report_archive_end): New function.
2350         (Incremental_inputs::report_object): Change prototype.
2351         (Incremental_inputs::report_input_section): New function.
2352         (Incremental_inputs::report_script): Change prototype.
2353         (Incremental_inputs::get_reloc_count): New function.
2354         (Incremental_inputs::set_reloc_count): New function.
2355         (Incremental_inputs::create_data_sections): New function.
2356         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2357         (Incremental_inputs::inputs_section): New function.
2358         (Incremental_inputs::symtab_section): New function.
2359         (Incremental_inputs::relocs_section): New function.
2360         (Incremental_inputs::get_stringpool): Add const.
2361         (Incremental_inputs::command_line): Add const.
2362         (Incremental_inputs::inputs): Remove.
2363         (Incremental_inputs::command_line_key): New function.
2364         (Incremental_inputs::input_file_count): New function.
2365         (Incremental_inputs::input_files): New function.
2366         (Incremental_inputs::relocs_entsize): New function.
2367         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2368         (Incremental_inputs::finalize_inputs): Remove.
2369         (Incremental_inputs::Input_info): Remove.
2370         (Incremental_inputs::lock_): Remove.
2371         (Incremental_inputs::inputs_): Change type.
2372         (Incremental_inputs::inputs_map_): Remove.
2373         (Incremental_inputs::current_object_entry_): New data member.
2374         (Incremental_inputs::inputs_section_): New data member.
2375         (Incremental_inputs::symtab_section_): New data member.
2376         (Incremental_inputs::relocs_section_): New data member.
2377         (Incremental_inputs::reloc_count_): New data member.
2378         (Incremental_inputs_reader): New class.
2379         (Incremental_symtab_reader): New class.
2380         (Incremental_relocs_reader): New class.
2381         * layout.cc (Layout::finalize): Move finalization of incremental info
2382         and creation of incremental info sections to follow finalization of
2383         symbol table.  Set offsets for postprocessing sections.
2384         (Layout::create_incremental_info_sections): Call
2385         Incremental_inputs::create_data_sections.  Add incremental symtab
2386         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2387         sections to layout after input sections.
2388         * layout.h (struct Timespec): Forward declaration.
2389         (Layout::incremental_inputs): Add const.
2390         (Layout::create_incremental_info_sections): Add parameter.
2391         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2392         * object.cc: Include incremental.h.
2393         (Relobj::finalize_incremental_relocs): New function.
2394         (Sized_relobj::do_layout): Record input sections in incremental info.
2395         * object.h (Object::output_section): New function.
2396         (Object::output_section_offset): Moved from Relobj.
2397         (Object::get_incremental_reloc_base): New function.
2398         (Object::get_incremental_reloc_count): New function.
2399         (Object::do_output_section): New function.
2400         (Object::do_output_section_offset): Moved from Relobj.
2401         (Object::do_get_incremental_reloc_base): New function.
2402         (Object::do_get_incremental_reloc_count): New function.
2403         (Object::Object): Initialize new data members.
2404         (Relobj::output_section): Renamed do_output_section and moved to
2405         protected.
2406         (Relobj::output_section_offset): Moved to Object.
2407         (Relobj::do_get_incremental_reloc_base): New function.
2408         (Relobj::do_get_incremental_reloc_count): New function.
2409         (Relobj::allocate_incremental_reloc_counts): New function.
2410         (Relobj::count_incremental_reloc): New function.
2411         (Relobj::finalize_incremental_relocs): New function.
2412         (Relobj::next_incremental_reloc_index): New function.
2413         (Relobj::reloc_counts_): New data member.
2414         (Relobj::reloc_bases_): New data member.
2415         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2416         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2417         (Sized_relobj::incremental_relocs_scan): New function.
2418         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2419         (Sized_relobj::incremental_relocs_write): New function.
2420         (Sized_relobj::incremental_relocs_write_reltype): New function.
2421         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2422         incremental link.
2423         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2424         archives and object files elsewhere.
2425         (Add_symbols::run): Report object files here.
2426         (Finish_group::run): Report end of archive at end of group.
2427         * reloc.cc: Include layout.h, incremental.h.
2428         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2429         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2430         (Sized_relobj::incremental_relocs_scan): New function.
2431         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2432         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2433         (Sized_relobj::incremental_relocs_write): New function.
2434         (Sized_relobj::incremental_relocs_write_reltype): New function.
2435         * script.cc (read_input_script): Rewrite test for incremental link.
2436         Change call to Incremental_inputs::report_script.
2437         * symtab.h (Symbol_table::first_global_index): New function.
2438         (Symbol_table::output_count): New function.
2439
2440 2010-08-12  Doug Kwan  <dougkwan@google.com>
2441
2442         * arm.cc (Target_arm::merge_object_attributes): Check command line
2443         options --no-wchar-size-warning and --no-enum-size-warning.
2444         * options.h (General_options): Add ld-compatible options
2445         --no-enum-size-warning and --no-wchar-size-warning.
2446
2447 2010-08-04  Ian Lance Taylor  <iant@google.com>
2448
2449         * x86_64.cc (Target_x86_64::Scan::local): Use
2450         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2451         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2452         (Target_x86_64::Scan::global): Likewise.
2453         (Target_x86_64::Relocate::relocate): Likewise.
2454         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2455         Likewise.
2456
2457 2010-08-03  Cary Coutant  <ccoutant@google.com>
2458
2459         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2460         to reserve space in merged_strings vector. Keep total input size
2461         for stats.
2462         (Output_merge_string::do_print_merge_stats): Print total input size.
2463         * merge.h (Output_merge_string): Add input_size_ field.
2464         * stringpool.cc (Stringpool_template::string_length): Move
2465         implementations out of Stringpool_template class and place in
2466         stringpool.h.
2467         * stringpool.h (string_length): Move out of Stringpool_template.
2468
2469 2010-08-03  Ian Lance Taylor  <iant@google.com>
2470
2471         PR 11712
2472         * layout.cc (relaxation_loop_body): If address of load segment is
2473         set, adjust address to include headers if possible.
2474
2475 2010-08-03  Ian Lance Taylor  <iant@google.com>
2476
2477         * version.cc (version_string): Bump to 1.10.
2478
2479 2010-08-03  Ian Lance Taylor  <iant@google.com>
2480
2481         PR 11805
2482         * layout.h (enum Output_section_order): Define.
2483         (class Layout): Update declarations.
2484         * layout.cc (Layout::get_output_section): Add order parameter.
2485         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2486         is_first_non_relro parameters.  Change all callers.
2487         (Layout::choose_output_section): Likewise.
2488         (Layout::add_output_section_data): Likewise.
2489         (Layout::make_output_section): Likewise.  Set order.
2490         (Layout::default_section_order): New function.
2491         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2492         * output.cc (Output_section::Output_section): Initialize order_.
2493         Don't initialize deleted fields.
2494         (Output_segment::Output_segment): Don't initialize deleted
2495         fields.
2496         (Output_segment::add_output_section_to_load): New function
2497         replacing add_output_section.  Change all callers to call this or
2498         add_output_section_to_nonload.
2499         (Output_segment::add_output_section_to_nonload): New function.
2500         (Output_segment::remove_output_section): Rewrite.
2501         (Output_segment::add_initial_output_data): Likewise.
2502         (Output_segment::has_any_data_sections): Likewise.
2503         (Output_segment::is_first_section_relro): Likewise.
2504         (Output_segment::maximum_alignment): Likewise.
2505         (Output_segment::has_dynamic_reloc): New function replacing
2506         dynamic_reloc_count.  Change all callers.
2507         (Output_segment::has_dynamic_reloc_list): New function replacing
2508         dynamic_reloc_count_list.  Change all callers.
2509         (Output_segment::set_section_addresses): Rewrite.
2510         (Output_segment::set_offset): Rewrite.
2511         (Output_segment::find_first_and_last_list): Remove.
2512         (Output_segment::set_tls_offsets): Rewrite.
2513         (Output_segment::first_section_load_address): Likewise.
2514         (Output_segment::output_section_count): Likewise.
2515         (Output_segment::section_with_lowest_load_address): Likewise.
2516         (Output_segment::write_section_headers): Likewise.
2517         (Output_segment::print_sections_to_map): Likewise.
2518         * output.h (class Output_data): Remove dynamic_reloc_count_
2519         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2520         (Output_data::add_dynamic_reloc): Rewrite.
2521         (Output_data::has_dynamic_reloc): New function.
2522         (Output_data::dynamic_reloc_count): Remove.
2523         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2524         is_last_relro_, is_first_non_relro_, is_interp_,
2525         is_dynamic_linker_section_ fields.  Add order and set_order
2526         functions.  Remove is_relro_local, set_is_relro_local,
2527         is_last_relro, set_is_last_relro, is_first_non_relro,
2528         set_is_first_non_relro functions, is_interp, set_is_interp,
2529         is_dynamic_linker_section, and set_is_dynamic_linker_section
2530         functions.
2531         (class Output_segment): Change Output_data_list from std::list to
2532         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2533         output_bss_ fields.  Update declarations.
2534
2535 2010-08-02  Ian Lance Taylor  <iant@google.com>
2536
2537         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2538         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2539         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2540
2541 2010-08-02  Ian Lance Taylor  <iant@google.com>
2542
2543         PR 11855
2544         * script.cc (Script_options::Script_options): Initialize
2545         symbol_definitions_ and symbol_references_.
2546         (Script_options::add_symbol_assignment): Update
2547         symbol_definitions_ and symbol_references_.
2548         (Script_options::add_symbol_reference): New function.
2549         (script_symbol): New function.
2550         * script.h (class Script_options): Add symbol_definitions_ and
2551         symbol_references_ fields.
2552         (Script_options::referenced_const_iterator): New type.
2553         (Script_options::referenced_begin): New function.
2554         (Script_options::referenced_end): New function.
2555         (Script_options::is_referenced): New function.
2556         (Script_options::any_unreferenced): New function.
2557         * script-c.h (script_symbol): Declare.
2558         * yyscript.y (exp): Call script_symbol.
2559         * symtab.cc: Include "script.h".
2560         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2561         Change all callers.  Check symbols referenced by scripts.
2562         (Symbol_table::add_undefined_symbols_from_command_line): Add
2563         layout parameter.  Change all callers.
2564         (Symbol_table::do_add_undefined_symbols_from_command_line):
2565         Likewise.  Break out loop body.  Check symbols referenced by
2566         scripts.
2567         (Symbol_table::add_undefined_symbol_from_command_line): New
2568         function broken out of
2569         do_add_undefined_symbols_from_command_line.
2570         * symtab.h (class Symbol_table): Update declarations.
2571         * archive.cc: Include "layout.h".
2572         (Archive::should_include_member): Add layout parameter.  Change
2573         all callers.  Check for symbol mentioned in expression.
2574         * archive.h (class Archive): Update declaration.
2575         * object.cc (Sized_relobj::do_should_include_member): Add layout
2576         parameter.
2577         * object.h (Object::should_include_member): Add layout parameter.
2578         Change all callers.
2579         (Object::do_should_include_member): Add layout parameter.
2580         (class Sized_relobj): Update declaration.
2581         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2582         parameter.
2583         * dynobj.h (class Sized_dynobj): Update declaration.
2584         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2585         layout parameter.
2586         * plugin.h (class Sized_pluginobj): Update declaration.
2587
2588 2010-08-02  Ian Lance Taylor  <iant@google.com>
2589
2590         PR 11866
2591         * output.cc (Output_segment::set_offset): Search for the first and
2592         last sections rather than assuming that the list is in order.
2593         (Output_segment::find_first_and_last_list): New function.
2594         * output.h (class Output_segment): Update declarations.
2595         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2596         (relro_strip_test_SOURCES): New variable.
2597         (relro_strip_test_DEPENDENCIES): New variable.
2598         (relro_strip_test_LDFLAGS): New variable.
2599         (relro_strip_test_LDADD): New variable.
2600         (relro_strip_test.so): New target.
2601
2602 2010-08-02  Ian Lance Taylor  <iant@google.com>
2603
2604         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2605         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2606         (Target_i386::got_tlsdesc_section): New function.
2607         (Target_i386::got_section): Create space for GOT entries for
2608         TLSDESC relocations.
2609         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2610         R_386_TLS_GOTDESC.
2611         (Target_i386::Scan::global): Likewise.
2612         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2613         using TLSDESC GOT.
2614         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2615         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2616         (Target_x86_64::got_tlsdesc_section): New function.
2617         (Target_x86_64::got_section): Create space for GOT entries for
2618         TLSDESC relocations.
2619         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2620         R_386_TLS_GOTDESC.
2621         (Target_x86_64::Scan::global): Likewise.
2622         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2623         using TLSDESC GOT.
2624
2625 2010-08-02  Ian Lance Taylor  <iant@google.com>
2626
2627         * testsuite/final_layout.sh: Use dc to convert from hex to
2628         decimal.
2629
2630 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2631
2632         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2633         paramter to the call to gold::gc_process_relocs.
2634         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2635         paramter to the call to gold::gc_process_relocs.
2636         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2637         parameter to the call to gold::gc_process_relocs.
2638         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2639         template parameter to the call to gold::gc_process_relocs.
2640         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2641         paramter to the call to gold::gc_process_relocs.
2642         * gc.h (get_embedded_addend_size): New function.
2643         (gc_process_relocs): Save the size of the reloc for use by ICF.
2644         * icf.cc (get_section_contents): Get the addend from the text section
2645         for SHT_REL relocation sections.
2646         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2647         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2648         * int_encoding.h (read_from_pointer): New overloaded function.
2649         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2650         * testsuite/icf_sht_rel_addend_test.sh: New file.
2651         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2652         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2653
2654 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2655
2656         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2657         * Makefile.in: Regenerate.
2658         * testsuite/Makefile.in: Regenerate.
2659
2660 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2661
2662         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2663         * gold/testsuite/debug_msg.cc: Likewise.
2664         * gold/testsuite/odr_violation1.cc
2665         * gold/testsuite/odr_violation2.cc
2666
2667 2010-07-21  Cary Coutant  <ccoutant@google.com>
2668
2669         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2670         string, and length fields.
2671         (Output_merge_string::Merged_strings_list): New type.
2672         (Output_merge_string::Merged_strings_lists): New typedef.
2673         (Output_merge_string): Replace merged_strings_ with
2674         merged_strings_lists_.
2675         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2676         Merged_strings_list per input object and section.  Don't store pointer
2677         to the string.  Don't store length with each merged string entry.
2678         (Output_merge_string::finalize_merged_data): Loop over list of merged
2679         strings lists.  Recompute length of each merged string.
2680
2681 2010-07-15  Cary Coutant  <ccoutant@google.com>
2682
2683         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2684         here.
2685
2686 2010-07-14  Ian Lance Taylor  <iant@google.com>
2687
2688         * descriptors.cc (Descriptors::open): Report correct name in error
2689         message.
2690
2691 2010-07-13  Doug Kwan  <dougkwan@google.com>
2692
2693         * arm.cc (Arm_input_section::Arm_input_section): For a
2694         SHT_ARM_EXIDX section, always keeps the input sections.
2695         (Arm_input_section::set_exidx_section_link): New method.
2696         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2697         has_errors_ to false.
2698         (Arm_exidx_input_section::has_errors,
2699         Arm_exidx_input_section::set_has_errors): New methods.
2700         (Arm_exidx_input_section::has_errors_): New data member.
2701         (Arm_relobj::get_exidx_shndx_list): New method.
2702         (Arm_output_section::append_text_sections_to_list): Do not skip
2703         section without SHF_EXECINSTR.
2704         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2705         errors.
2706         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2707         section header.  Make error messages more verbose.  Check for
2708         a non-executable section linked to an EXIDX section.
2709         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2710         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2711         check that there is no deferred EXIDX section if we exit early.
2712         Instead of not making an EXIDX section in case of an error, make one
2713         and set the has_errors flag of it.
2714         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2715         in a relocatable link.
2716         (Target_arm::do_relax): Look for the EXIDX output section instead of
2717         assuming that it is called .ARM.exidx.
2718         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2719         section list.  Do not check for SHF_EXECINSTR section flags but
2720         skip any input section with errors.
2721         * output.cc (Output_section::Output_section): Initialize
2722         always_keeps_input_sections_ to false.
2723         (Output_section::add_input_section): Check for
2724         always_keeps_input_sections_.
2725         *  output.h (Output_section::always_keeps_input_sections,
2726         Output_section::set_always_keeps_input_sections): New methods.
2727         (Output_section::always_keeps_input_sections): New data member.
2728
2729 2010-07-13  Rafael Espindola  <espindola@google.com>
2730
2731         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2732         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2733
2734 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2735             Ian Lance Taylor  <iant@google.com>
2736
2737         * output.h (Output_section_lookup_maps::add_merge_section):
2738         Correct check of whether value was inserted.
2739         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2740         (Output_section_lookup_maps::add_relaxed_input_section):
2741         Likewise.
2742         * arm.cc (Target_arm::got_section): Remove used local os.
2743         * i386.cc (Target_i386::got_section): Likewise.
2744         * x86_64.cc (Target_x86_64::got_section): Likewise.
2745         * sparc.cc (Target_sparc::got_section): Likewise.
2746         (Target_sparc::relocate): Remove unused local have_got_offset.
2747         * powerpc.cc (Target_powerpc::relocate): Likewise.
2748
2749 2010-07-13  Ian Lance Taylor  <iant@google.com>
2750
2751         * compressed_output.cc (zlib_decompress): Fix signature in
2752         !HAVE_ZLIB_H case.
2753
2754         * archive.cc (Archive::include_member): Unlock an external member
2755         of a thin archive.  Don't bother to delete an object we know is
2756         NULL.
2757
2758 2010-07-12  Cary Coutant  <ccoutant@google.com>
2759
2760         * compressed_output.cc (zlib_decompress): New function.
2761         (get_uncompressed_size): New function.
2762         (decompress_input_section): New function.
2763         * compressed_output.h (get_uncompressed_size): New function.
2764         (decompress_input_section): New function.
2765         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2766         Handle compressed debug sections.
2767         * layout.cc (is_compressed_debug_section): New function.
2768         (Layout::output_section_name): Map compressed section names to
2769         canonical names.
2770         * layout.h (is_compressed_debug_section): New function.
2771         (is_debug_info_section): Recognize compressed debug sections.
2772         * merge.cc: Include compressed_output.h.
2773         (Output_merge_data::do_add_input_section): Handle compressed
2774         debug sections.
2775         (Output_merge_string::do_add_input_section): Handle compressed
2776         debug sections.
2777         * object.cc: Include compressed_output.h.
2778         (Sized_relobj::Sized_relobj): Initialize new data members.
2779         (build_compressed_section_map): New function.
2780         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2781         * object.h (Object::section_is_compressed): New method.
2782         (Object::do_section_is_compressed): New method.
2783         (Sized_relobj::Compressed_section_map): New type.
2784         (Sized_relobj::do_section_is_compressed): New method.
2785         (Sized_relobj::compressed_sections_): New data member.
2786         * output.cc (Output_section::add_input_section): Handle compressed
2787         debug sections.
2788         * reloc.cc: Include compressed_output.h.
2789         (Sized_relobj::write_sections): Handle compressed debug sections.
2790
2791 2010-07-08  Cary Coutant  <ccoutant@google.com>
2792
2793         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2794         weak when resolving to a dynamic def.
2795         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2796         for weak undef/dynamic def cases. Adjust callers.
2797         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2798         undef_binding_weak_.
2799         (Symbol_table::sized_write_globals): Adjust symbol binding.
2800         (Symbol_table::sized_write_symbol): Add binding parameter.
2801         * symtab.h (Symbol::set_undef_binding): New method.
2802         (Symbol::is_undef_binding_weak): New method.
2803         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2804         (Symbol_table::should_override): Add new parameter.
2805         (Symbol_table::sized_write_symbol): Add new parameter.
2806
2807         * testsuite/weak_undef_file1.cc: Add new test case.
2808         * testsuite/weak_undef_file2.cc: Fix header comment.
2809         * testsuite/weak_undef_test.cc: Add new test case.
2810
2811 2010-06-29  Doug Kwan  <dougkwan@google.com>
2812
2813         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2814         Initialize USE_SYMBOL_.
2815         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2816         definition.
2817         (Arm_reloc_property::uses_symbol_): New data member declaration.
2818         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2819         uses symbol value and symbol is undefined but not weakly undefined.
2820
2821 2010-06-28  Rafael Espindola  <espindola@google.com>
2822
2823         * plugin.cc (Plugin::load): Use dlerror.
2824
2825 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2826
2827         * symtab.cc (detect_odr_violations): When reporting an ODR
2828         violation, report an object where the symbol is defined.
2829
2830 2010-06-25  Doug Kwan  <dougkwan@google.com>
2831
2832         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2833         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2834         definition.
2835         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2836         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2837         target hook to detect function points.
2838         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2839         * icf.h (Icf::check_section_for_function_pointers): Change type of
2840         parameter SECTION_NAME to const reference to std::string.  Use
2841         target hook to determine if section may have unsafe pointers.
2842         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2843         method definition.
2844
2845 2010-06-21  Rafael Espindola  <espindola@google.com>
2846
2847         * fileread.cc (Input_file::find_fie): New
2848         (Input_file::open): Use Input_file::find_fie.
2849         * fileread.h (Input_file::find_fie): New
2850         * plugin.cc (set_extra_library_path): New.
2851         (Plugin::load): Add set_extra_library_path to the transfer vector.
2852         (Plugin_manager::set_extra_library_path): New.
2853         (Plugin_manager::add_input_file): Use the extra search path if set.
2854         (set_extra_library_path(): New.
2855         * plugin.h (Plugin_manager): Add set_extra_library_path and
2856         extra_search_path_.
2857
2858 2010-06-19  Cary Coutant  <ccoutant@google.com>
2859
2860         * layout.cc (gdb_sections): Add .debug_types.
2861         (lines_only_debug_sections): Likewise.
2862
2863 2010-06-18  Rafael Espindola  <espindola@google.com>
2864
2865         * plugin.cc (add_input_file,add_input_library)
2866         (Plugin_manager::add_input_file): Make filename arguments const.
2867         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2868         const.
2869
2870 2010-06-16  Doug Kwan  <dougkwan@google.com>
2871
2872         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2873         .ARM.attributes section if we have not merged any input
2874         attributes sections.
2875
2876 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2877
2878         * arm.cc: Allow combining objects with no EABI version
2879         information.
2880
2881 2010-06-15  Rafael Espindola  <espindola@google.com>
2882
2883         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2884
2885 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2886
2887         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2888         (struct iovec): Correct !HAVE_READV definition.
2889
2890 2010-06-10  Cary Coutant  <ccoutant@google.com>
2891
2892         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2893         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2894         reloc sections.
2895         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2896
2897         PR 11683
2898         * symtab.h (Symbol::is_placeholder): New member function.
2899         * target-reloc.h (relocate_section): Check for placeholder symbols.
2900
2901         * testsuite/Makefile.am (plugin_test_8): New test.
2902         (plugin_test_9): New test.
2903         * testsuite/Makefile.in: Regenerate.
2904
2905 2010-06-09  Nick Clifton  <nickc@redhat.com>
2906
2907         * yyscript.y (input_list_element): Allow strings prefixed with
2908         the '-' character.  Treat these as libraries.
2909         * script.cc (script_add_library): New function.  Adds a library
2910         specified by "-l<name>" found in an input script.
2911         * script-c.h: Add prototype for script_add_library.
2912
2913 2010-06-07  Doug Kwan  <dougkwan@google.com>
2914
2915         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2916         Restrict stub-group size to be within long conditional branch
2917         range when working around cortex-A8 erratum.
2918
2919 2010-06-07  Damien Diederen  <dd@crosstwine.com>
2920
2921         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2922         #ifdef typo.
2923
2924 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
2925
2926         PR gold/11658
2927         * output.cc
2928         (Output_section::Input_section_sort_entry::compare_section_ordering):
2929         Change to return non-zero correctly.
2930         (Output_section::Input_section_sort_section_order_index_compare
2931         ::operator()): Change to fix ambiguity in comparisons.
2932
2933 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
2934
2935         * gold.h (is_wildcard_string): New function.
2936         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2937         (Layout::layout_eh_frame): Ditto.
2938         (Layout::find_section_order_index): New method.
2939         (Layout::read_layout_from_file): New method.
2940         * layout.h (Layout::find_section_order_index): New method.
2941         (Layout::read_layout_from_file): New method.
2942         (Layout::input_section_position_): New private member.
2943         (Layout::input_section_glob_): New private member.
2944         * main.cc (main): Call read_layout_from_file here.
2945         * options.h (--section-ordering-file): New option.
2946         * output.cc (Output_section::input_section_order_specified_): New
2947         member.
2948         (Output_section::Output_section): Initialize new member.
2949         (Output_section::add_input_section): Add new parameter.
2950         Keep input sections when --section-ordering-file is used.
2951         (Output_section::set_final_data_size): Sort input sections when
2952         section ordering file is specified.
2953         (Output_section::Input_section_sort_entry): Add new parameter.
2954         Check sorting type.
2955         (Output_section::Input_section_sort_entry::compare_section_ordering):
2956         New method.
2957         (Output_section::Input_section_sort_compare::operator()): Change to
2958         consider section_order_index.
2959         (Output_section::Input_section_sort_init_fini_compare::operator()):
2960         Change to consider section_order_index.
2961         (Output_section::Input_section_sort_section_order_index_compare
2962         ::operator()): New method.
2963         (Output_section::sort_attached_input_sections): Change to sort
2964         according to section order when specified.
2965         (Output_section::add_input_section<32, true>): Add new parameter.
2966         (Output_section::add_input_section<64, true>): Add new parameter.
2967         (Output_section::add_input_section<32, false>): Add new parameter.
2968         (Output_section::add_input_section<64, false>): Add new parameter.
2969         * output.h (Output_section::add_input_section): Add new parameter.
2970         (Output_section::input_section_order_specified): New
2971         method.
2972         (Output_section::set_input_section_order_specified): New method.
2973         (Input_section::Input_section): Initialize section_order_index_.
2974         (Input_section::section_order_index): New method.
2975         (Input_section::set_section_order_index): New method.
2976         (Input_section::section_order_index_): New member.
2977         (Input_section::Input_section_sort_section_order_index_compare): New
2978         struct.
2979         (Output_section::input_section_order_specified_): New member.
2980         * script-sections.cc (is_wildcard_string): Delete and move modified
2981         method to gold.h.
2982         (Output_section_element_input::Output_section_element_input): Modify
2983         call to is_wildcard_string.
2984         (Output_section_element_input::Input_section_pattern
2985         ::Input_section_pattern): Ditto.
2986         (Output_section_element_input::Output_section_element_input): Ditto.
2987         * testsuite/Makefile.am (final_layout): New test case.
2988         * testsuite/Makefile.in: Regenerate.
2989         * testsuite/final_layout.cc: New file.
2990         * testsuite/final_layout.sh: New file.
2991
2992 2010-06-01  Rafael Espindola  <espindola@google.com>
2993
2994         * plugin.cc (Plugin::load): Pass the output name to the plugin.
2995
2996 2010-06-01  Rafael Espindola  <espindola@google.com>
2997
2998         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2999         visibility of symbols.
3000
3001 2010-05-27  Doug Kwan  <dougkwan@google.com>
3002
3003         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3004         from start of output section instead of address for a local symbol
3005         in a merged or relaxed section when doing a relocatable link.
3006
3007 2010-05-26  Rafael Espindola  <espindola@google.com>
3008
3009        PR 11604
3010         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3011         adding sections the garbage collector removed.
3012         * gold/testsuite/Makefile.am: Add test.
3013         * gold/testsuite/Makefile.in: Regenerate.
3014         * gold/testsuite/plugin_test_7.sh: New.
3015         * gold/testsuite/plugin_test_7_1.c: New.
3016         * gold/testsuite/plugin_test_7_2.c: New.
3017
3018 2010-05-26  Rafael Espindola  <espindola@google.com>
3019
3020         * script-sections.cc (Output_section_definition::set_section_addresses):
3021         Check for --section-start.
3022
3023 2010-05-26  Doug Kwan  <dougkwan@google.com>
3024
3025         * arm.cc (Arm_scan_relocatable_relocs): New class.
3026         (Target_arm::relocate_special_relocatable): New method.
3027         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3028         (Arm_relocate_functions::thumb_branch_common): Same.
3029         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3030         instead of Default_scan_relocatable_relocs.
3031         * target-reloc.h (relocate_for_relocatable): Let target handle
3032         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3033         * target.h (Sized_target::relocate_special_relocatable): New method.
3034
3035 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3036
3037         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3038
3039 2010-05-23  Doug Kwan  <dougkwan@google.com>
3040
3041         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3042         instead of a cast.
3043         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3044         with a direct branch, not a conditional branch, to a stub.
3045         * merge.cc (Output_merge_base::record_input_section): New method
3046         defintion.
3047         (Output_merge_data::do_add_input_section): Record input section if
3048         keeps-input-sections flag is set.
3049         (Output_merge_string::do_add_input_section): Ditto.
3050         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3051         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3052         INPUT_SECTIONS_.
3053         (Output_merge_base::keeps_input_sections,
3054         Output_merge_base::set_keeps_input_sections,
3055         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3056         method definitions.
3057         (Output_merge_base::Input_sections): New type declaration.
3058         (Output_merge_base::input_sections_begin,
3059         Output_merge_base::input_sections_end,
3060         Output_merge_base::do_set_keeps_input_sections): New method definitions.
3061         (Output_merge_base::bool keeps_input_sections_,
3062         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3063         Output_merge_base::input_sections_): New data members.
3064         (Output_merge_data::do_set_keeps_input_sections): New method
3065         defintion.
3066         (Output_merge_string::do_set_keeps_input_sections): Ditto.
3067         * output.cc (Output_section::Input_section::relobj): Move method
3068         defintion from class declaration to here and handle merge sections.
3069         (Output_section::Input_section::shndx): Ditto.
3070         (Output_section::Output_section): Remove initializations of removed
3071         data members and initialize new data member LOOKUP_MAPS_.
3072         (Output_section::add_input_section): Set keeps-input-sections flag
3073         for a newly created merge output section as appropriate.  Adjust code
3074         to use Output_section_lookup_maps class.
3075         (Output_section::add_relaxed_input_section): Adjst code for lookup
3076         maps code refactoring.
3077         (Output_section::add_merge_input_section): Add a new parameter
3078         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
3079         class.  If adding input section to a newly created merge output
3080         section fails, remove the new merge section.
3081         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3082         Adjust code for use of the Output_section_lookup_maps class.
3083         (Output_section::find_merge_section): Ditto.
3084         (Output_section::build_lookup_maps): New method defintion.
3085         (Output_section::find_relaxed_input_section): Adjust code to use
3086         Output_section_lookup_maps class.
3087         (Output_section::get_input_sections): Export merge sections.  Adjust
3088         code to use Output_section_lookup_maps class.
3089         (Output_section:::add_script_input_section): Adjust code to use
3090         Output_section_lookup_maps class.  Update lookup maps for merge
3091         sections also.
3092         (Output_section::discard_states): Use Output_section_lookup_maps.
3093         (Output_section::restore_states): Same.
3094         * output.h (Merge_section_properties): Move class defintion out of
3095         Output_section.
3096         (Output_section_lookup_maps): New class.
3097         (Output_section::Input_section::is_merge_section): New method
3098         defintion.
3099         (Output_section::Input_section::relobj): Move defintion out of class
3100         defintion.  Declare method only.
3101         (Output_section::Input_section::shndx): Ditto.
3102         (Output_section::Input_section::output_merge_base): New method defintion.
3103         (Output_section::Input_section::u2_.pomb): New union field.
3104         (Output_section::Merge_section_by_properties_map,
3105         Output_section::Output_section_data_by_input_section_map,
3106         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3107         Remove types.
3108         (Output_section::add_merge_input_section): Add new parameter
3109         KEEPS_INPUT_SECTIONS.
3110         (Output_section::build_lookup_maps): New method declaration.
3111         (Output_section::merge_section_map_,
3112         Output_section::merge_section_by_properties_map_,
3113         Output_section::relaxed_input_section_map_,
3114         Output_section::is_relaxed_input_section_map_valid_): Remove data
3115         members.
3116         (Output_section::lookup_maps_): New data member.
3117
3118 2010-05-21  Doug Kwan  <dougkwan@google.com>
3119
3120         PR gold/11619
3121         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3122         avoid a compilation error.
3123
3124 2010-05-19  Rafael Espindola  <espindola@google.com>
3125
3126         * script-sections.cc (Output_section_definition::allocate_to_segment):
3127         Update the phdrs_list even when the output section is NULL.
3128         * testsuite/Makefile.am: Add test.
3129         * testsuite/Makefile.in: Regenerate.
3130         * testsuite/script_test_9.cc: New.
3131         * testsuite/script_test_9.sh: New.
3132         * testsuite/script_test_9.t: New.
3133
3134 2010-05-19  Doug Kwan  <dougkwan@google.com>
3135
3136         * arm.cc (Arm_input_section::original_size): New method.
3137         (Arm_input_section::do_addralign): Add a cast.
3138         (Arm_input_section::do_output_offset): Remove static cast.
3139         (Arm_input_section::original_addralign,
3140          Arm_input_section::original_size_): Change type to uint32_t.
3141         (Arm_input_section::init): Add safe casts for section alignment
3142         and size.
3143         (Arm_input_section::set_final_data_size): Do not set address and
3144         offset of stub table.
3145         (Arm_output_section::fix_exidx_coverage): Change use of of
3146         Output_section::Simple_input_section to that of
3147         Output_section::Input_section.
3148         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3149         except for the first pass.
3150         * output.cc (Output_section::get_input_sections): Change type of
3151         input_sections to std::list<Input_section>.
3152         (Output_section::add_script_input_section): Rename from
3153         Output_section::add_simple_input_section.  Change type of SIS
3154         parameter from Simple_input_section to Input_section.
3155         * output.h (Output_section::Simple_input_section): Remove class.
3156         (Output_section::Input_section): Change class visibility to public.
3157         (Output_section::Input_section::addralign): Use stored alignments
3158         for special input sections if set.
3159         (Output_section::Input_section::set_addralign): New method.
3160         (Output_section::get_input_sections): Change parameter type from
3161         list of Simple_input_section to list of Input_section.
3162         (Output_section::add_script_input_section): Rename from
3163         Output_section::add_simple_input_section. Change first parameter's
3164         type from Simple_input_section to Input_section and remove the
3165         second and third parameters.
3166         * script-sections.cc (Input_section::Input_section_list): Change
3167         type to list of Output_section::Input_section/
3168         (Input_section_info::Input_section_info): Change parameter type of
3169         INPUT_SECTION to Output_section::Input_section.
3170         (Input_section_info::input_section): Change return type.
3171         (Input_section_info::input_section_): Change type to
3172         Output_section::Input_section.
3173         (Output_section_element_input::set_section_addresses): Adjust code
3174         to use Output_section::Input_section instead of
3175         Output_section::Simple_input_section.  Adjust code for renaming
3176         of Output_section::add_simple_input_section.
3177         (Orphan_output_section::set_section_addresses): Ditto.
3178
3179 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3180
3181         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3182         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3183
3184 2010-05-18  Rafael Espindola  <espindola@google.com>
3185
3186         * options.cc (General_options::finalize): Handle -nostdlib.
3187         * options.h (nostdlib): New option.
3188         * script.cc (script_add_search_dir): Handle -nostdlib.
3189
3190 2010-05-12  Doug Kwan  <dougkwan@google.com>
3191
3192         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3193         attributes section only if there no attributes section after merging.
3194         (Target_arm::merge_object_attributes): Move value of
3195         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3196         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3197         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3198         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3199         and arm_attr_merge_7.stdout.
3200         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3201         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3202         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3203         arm_attr_merge_7b.o): New rules.
3204         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3205         arm_attr_merge_7
3206         * testsuite/Makefile.in: Regenerate.
3207         * testsuite/arm_attr_merge.sh: New file.
3208         * testsuite/arm_attr_merge_[67][ab].s: Same.
3209
3210 2010-05-05  Nick Clifton  <nickc@redhat.com>
3211
3212         * po/es.po: Updated Spanish translation.
3213
3214 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3215
3216         * Makefile.am (install-exec-local): Properly install gold as
3217         default cross linker.
3218         * Makefile.in: Regenerated.
3219
3220 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3221             Nick Clifton  <nickc@redhat.com>
3222
3223         * configure.ac (install_as_default): Define and set to false
3224         unless --enable-gold or --enable-gold=both/gold has been
3225         specified.
3226         * configure: Regenerate.
3227
3228         * Makefile.am (install-exec-local): Install the executable as
3229         'ld.gold'.  If install_as_default is true then also install it as
3230         'ld'.
3231         * Makefile.in: Regenerated.
3232
3233 2010-04-24  Ian Lance Taylor  <iant@google.com>
3234
3235         * layout.cc (Layout::layout_reloc): In relocatable link don't
3236         combine reloc sections for grouped sections.
3237
3238 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3239
3240         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3241         sections that are not ordinary to icf.
3242         * icf.cc (get_section_contents): Handle relocation pointing to section
3243         with no object or shndx information.
3244         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3245         * testsuite/Makefile.in: Regenerate.
3246         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3247         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3248
3249 2010-04-22  Ian Lance Taylor  <iant@google.com>
3250
3251         * expression.cc (Expression::Expression_eval_info): Add
3252         result_alignment_pointer field.
3253         (Expression::eval_with_dot): Add result_alignment_pointer
3254         parameter.  Change all callers.
3255         (Expression::eval_maybe_dot): Likewise.
3256         (class Binary_expression): Add alignment_pointer parameter to
3257         left_value and right_value.  Change all callers.
3258         (BINARY_EXPRESSION): Set result alignment.
3259         (class Trinary_expression): Add alignment_pointer parameter to
3260         arg2_value and arg3_value.  Change all callers.
3261         (Trinary_cond::value): Set result alignment.
3262         (Max_expression::value, Min_expression::value): Likewise.
3263         (Align_expression::value): Likewise.
3264         * script-sections.cc (class Sections_element): Add dot_alignment
3265         parameter to set_section_addresses virtual function.  Update
3266         instantiations.
3267         (class Output_section_element): Likewise.
3268         (Script_sections::create_segments): Add dot_alignment parameter.
3269         Change all callers.
3270         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3271         (Script_sections::set_phdrs_clause_addresses): Likewise.
3272         * script-sections.h: Update declarations.
3273         * script.h: Update declarations.
3274         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3275         min_p_align.
3276         * testsuite/script_test_3.t: Set large alignment.
3277         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3278         segment has expected alignment.
3279
3280 2010-04-22  Nick Clifton  <nickc@redhat.com>
3281
3282         * po/gold.pot: Updated by the Translation project.
3283         * po/vi.po: Updated Vietnamese translation.
3284
3285 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3286
3287         * testsuite/Makefile.am (check_PROGRAMS): Add
3288         icf_virtual_function_folding_test.
3289         * testsuite/Makefile.in: Regenerated.
3290
3291 2010-04-15  Andrew Haley  <aph@redhat.com>
3292
3293         * options.h (merge_exidx_entries): New option.
3294         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3295         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3296         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3297         (Target_arm::merge_exidx_entries): New function.
3298         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3299         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3300         to Arm_exidx_fixup constructor.
3301         Add new arg, merge_exidx_entries.
3302         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3303         Arm_output_section::fix_exidx_coverage.
3304
3305 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3306
3307         * icf.cc (get_section_contents): Check for preemptible functions.
3308         Ignore addend when appropriate.
3309         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3310         section folded.
3311         (add_from_relobj): Check for section folded.
3312         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3313         * symtab.h (should_add_dynsym_entry): Add new parameter.
3314         * target-reloc.h (scan_relocs): Check for section folded.
3315         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3316         Check reloc types for function pointers in shared objects.
3317         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3318         case.
3319         (icf_preemptible_functions_test): New test case.
3320         (icf_string_merge_test): New test case.
3321         * testsuite.Makefile.in: Regenerate.
3322         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3323         bar_glob.  Refactor code.
3324         * testsuite/icf_preemptible_functions_test.cc: New file.
3325         * testsuite/icf_preemptible_functions_test.sh: New file.
3326         * testsuite/icf_string_merge_test.cc: New file.
3327         * testsuite/icf_string_merge_test.sh: New file.
3328         * testsuite/icf_virtual_function_folding_test.cc: New file.
3329         * testsuite/icf_virtual_function_folding_test.sh: New file.
3330
3331 2010-04-14  Doug Kwan  <dougkwan@google.com>
3332
3333         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3334         for local symbol recounting if we remove a section due to ICF.
3335         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3336         there are no regular objects in input.
3337
3338 2010-04-13  Doug Kwan  <dougkwan@google.com>
3339
3340         * arm.cc (Arm_input_section::set_final_data_size): Compute
3341         accurate final data size instead of using current data size.
3342
3343 2010-04-09  Doug Kwan  <dougkwan@google.com>
3344
3345         * layout.cc (Layout::choose_output_section): Handle script section
3346         types.
3347         (Layout::make_output_section_for_script): Add section type parameter.
3348         Handle script section types.
3349         * layout.h (Layout::make_output_section_for_script): Add section
3350         type parameter.
3351         * output.cc (Output_section::Output_section): Initialize data member
3352         is_noload_.
3353         (Output_section::do_reset_address_and_file_offset): Do not set address
3354         to 0 if section is a NOLOAD section.
3355         * output.h (Output_section::is_noload): New method.
3356         (Output_section::set_is_noload): Ditto.
3357         (Output_section::is_noload_): New data member.
3358         * script-c.h (Script_section_type): New enum type.
3359         (struct Parser_output_section_header): Add new file section_type.
3360         * script-sections.cc (Sections_element::output_section_name): Add
3361         parameter for returning script section type.
3362         (Output_section_definition::output_section_name): Ditto.
3363         (Output_section_definition::section_type)P; New method.
3364         (Output_section_definiton::script_section_type_name): Ditto.
3365         (Output_section_definition::script_section_type_): New data member.
3366         (Output_section_definition::Output_section_definition): Initialize
3367         data member Output_section_definition::script_section_type_.
3368         (Output_section_definition::create_sections): Pass script section type
3369         to Layout::make_output_section_for_script.
3370         (Output_section_definition::output_section_name): Return script
3371         section type to caller.
3372         (Output_section_definition::set_section_address): Do not advance
3373         dot value and load address if section type is NOLOAD.  Set address
3374         of NOLOAD sections regardless of section flags.
3375         (Output_section_definition::print): Print section type if it is
3376         not SCRIPT_SECTION_TYPE_NONE.
3377         (Output_section_definition::section_type): New method.
3378         (Output_section_definition::script_section_type_name): Ditto.
3379         (Script_sections::output_section_name): Add new parameter
3380         PSECTION_TYPE for returning script section type.  Pass it to
3381         section elements.  Handle discard sections.
3382         (Sort_output_sections::operator()): Handle NOLOAD sections.
3383         * script-sections.h (Script_sections::Section_type): New enum type.
3384         (Script_sections::output_section_name): Add a new parameter for
3385         returning script section type.
3386         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3387         INFO and NOLOAD.
3388         * yyscript.y (union): Add new field SECTION_TYPE.
3389         (COPY, DSECT, INFO, NOLOAD): New tokens.
3390         (opt_address_and_section_type): Change type to output_section_header.
3391         (section_type): New non-terminal
3392         (section_header): Handle section type.
3393         (opt_address_and_section_type): Return section type value.
3394
3395 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3396
3397         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3398         * testsuite/plugin_common_test_2.c (foo): Likewise.
3399
3400 2010-04-08  Doug Kwan  <dougkwan@google.com>
3401
3402         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3403         Output_merge_data.
3404         * output.cc (Output_section::add_merge_input_section): Simplify
3405         code and return status of Output_merge_base::add_input_section.
3406         Update merge section map only if Output_merge_base::add_input_section
3407         returns true.
3408
3409 2010-04-07  Doug Kwan  <dougkwan@google.com>
3410
3411         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3412         if section is marked as containing instructions but has no mapping
3413         symbols.
3414         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3415         correct section index.
3416         (Arm_relobj::find_linked_text_section): Ditto.
3417
3418 2010-04-07  Cary Coutant  <ccoutant@google.com>
3419
3420         * archive.cc (include_member): Destroy Read_symbols_data object before
3421         releasing file.
3422         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3423         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3424         (Read_symbols_data::~Read_symbols_data) New destructor.
3425         (Section_relocs::Section_relocs) New constructor.
3426         (Section_relocs::~Section_relocs) New destructor.
3427         (Read_relocs_data::Read_relocs_data) New constructor.
3428         (Read_relocs_data::~Read_relocs_data) New destructor.
3429         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3430         pointers to NULL after deleting.
3431
3432 2010-04-07  Doug Kwan  <dougkwan@google.com>
3433
3434         * arm.cc: Replace "endianity" with "endianness" in comments.
3435         (Arm_exidx_cantunwind): Ditto.
3436         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3437         (Arm_relobj::merge_flags_and_attributes): New method.
3438         (Arm_relobj::merge_flags_and_attributes_): New data member.
3439         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3440         (Arm_relobj::scan_sections_for_stubs): Ditto.
3441         (Arm_relobj::do_read_symbols): Check to see if we really want to
3442         merge processor-specific flags and attributes.  Exit early if
3443         an object is empty except for section names and the undefined symbol.
3444         (Target_arm::do_finalize_sections): Move check for ELF format to
3445         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3446         attributes from a regular object only when we have determined that
3447         it is aapropriate.  Do not create an .ARM.attributes section in
3448         output if there is no regular input object.
3449         (Target_arm::merge_processor_specific_flags): Check
3450         --warn-mismatch before printing any error.
3451         (Target_arm::merge_object_attributes): Ditto.
3452         * gold.cc (queue_middle_tasks): Handle the case in which there is
3453         no regular object in input.
3454         * options.cc (General_options::parse_EB): New method.
3455         (General_options::parse_EL): Same.
3456         (General_options::General_options): Initialize endianness_.
3457         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3458         New options.
3459         (General_options::Endianness): New enum.
3460         (General_options::endianness): New method.
3461         (General_options::endianness_): New data member.
3462         * parameters.cc (Parameters::set_options): Check target endianness.
3463         (Parameters::set_target_once): Ditto.
3464         (Parameters::check_target_endianness): New method.
3465         (parameters_force_valid_target): If either -EL or -EB is specified,
3466         use it to define endianness of default target.
3467         * parameters.h (Parameters::check_target_endianness): New method
3468         declaration.
3469         * target.h (class Target): Change "endianity" to "endianness"
3470         in comments.
3471
3472 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3473
3474         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3475         * configure: Regenerate.
3476         * Makefile.in: Regenerate.
3477         * testsuite/Makefile.in: Regenerate.
3478
3479 2010-04-06  Cary Coutant  <ccoutant@google.com>
3480
3481         gcc PR lto/42757
3482         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3483         prevailing definitions of common symbols.
3484         * testsuite/plugin_test_6.sh: New test case.
3485         * testsuite/plugin_common_test_1.c: New test case.
3486         * testsuite/plugin_common_test_2.c: New test case.
3487         * testsuite/Makefile.am (plugin_test_6): New test case.
3488         * testsuite/Makefile.in: Regenerate.
3489
3490 2010-04-06  Nick Clifton  <nickc@redhat.com>
3491
3492         * po/vi.po: New Vietnamese translation.
3493
3494 2010-03-30  Doug Kwan  <dougkwan@google.com>
3495
3496         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3497
3498 2010-03-25  Doug Kwan  <dougkwan@google.com>
3499
3500         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3501         to avoid a conversion warning on a 32-bit host.
3502
3503 2010-03-24  Ian Lance Taylor  <iant@google.com>
3504
3505         * testsuite/script_test_3.t: Add a TLS segment.
3506         * testsuite/Makefile.am (check_PROGRAMS): Add
3507         tls_phdrs_script_test.
3508         (tls_phdrs_script_test_SOURCES): Define.
3509         (tls_phdrs_script_test_DEPENDENCIES): Define.
3510         (tls_phdrs_script_test_LDFLAGS): Define.
3511         (tls_phdrs_script_test_LDADD): Define.
3512         * testsuite/Makefile.in: Rebuild.
3513
3514 2010-03-23  Cary Coutant  <ccoutant@google.com>
3515
3516         * fileread.cc (find_or_make_view): Fix comment.
3517
3518 2010-03-23  Ian Lance Taylor  <iant@google.com>
3519
3520         * script-sections.cc (class Orphan_section_placement): Define
3521         PLACE_TLS and PLACE_TLS_BSS.
3522         (Orphan_section_placement::Orphan_section_placement): Initialize
3523         new places.
3524         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3525         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3526         (tls_script_test_SOURCES): Define.
3527         (tls_script_test_DEPENDENCIES): Define.
3528         (tls_script_test_LDFLAGS): Define.
3529         (tls_script_test_LDADD): Define.
3530         * testsuite/Makefile.in: Rebuild.
3531
3532 2010-03-22  Doug Kwan  <dougkwan@google.com>
3533
3534         * arm.cc (Arm_relocate_functions::abs8,
3535         Arm_relocate_functions::abs16): Use correct check for overflow
3536         specified in the ARM ELF specs.
3537         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3538         target of a BLX instruction specially.
3539         (Reloc_stub::stub_type_for_reloc): Ditto.
3540         (Relocate::relocate): Use symbolic names instead of numeric relocation
3541         codes to report error.
3542         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3543         workaround.
3544         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3545         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3546         thumb2_blx_out_of_range.stdout
3547         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3548         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3549         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3550         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3551         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3552         thumb2_blx_in_range, thumb2_blx_in_range.o,
3553         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3554         thumb2_blx_out_of_range.o): New rules.
3555         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3556         thumb2_blx_in_range and thumb2_blx_out_of_range.
3557         * testsuite/Makefile.in: Regenerate.
3558         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3559         * testsuite/thumb_blx_in_range.s: New file.
3560         * testsuite/thumb_blx_out_of_range.s: New file.
3561
3562 2010-03-22  Rafael Espindola  <espindola@google.com>
3563
3564         * archive.cc (Should_include): Move to archive.h.
3565         (should_include_member): Make it a member of Archive.
3566         (Lib_group): New.
3567         (Add_lib_group_symbols): New.
3568         * archive.h: Include options.h.
3569         (Archive_member): Moved from Archive.
3570         (Should_include): Moved from archive.cc.
3571         (Lib_group): New.
3572         (Add_lib_group_symbols): New.
3573         * dynobj.cc (do_should_include_member): New.
3574         * dynobj.h (do_should_include_member): New.
3575         * gold.cc (queue_initial_tasks): Update call to queue.
3576         * main.cc (main): Print lib group stats.
3577         * object.cc (do_should_include_member): New.
3578         * object.h: Include archive.h.
3579         (Object::should_include_member): New.
3580         (Object::do_should_include_member): New.
3581         (Sized_relobj::do_should_include_member): New.
3582         * options.cc (General_options::parse_start_lib): New.
3583         (General_options::parse_end_lib): New.
3584         (Input_arguments::add_file): Handle lib groups.
3585         (Input_arguments::start_group): Check we are not in a lib.
3586         (Input_arguments::start_lib): New.
3587         (Input_arguments::end_lib): New.
3588         * options.h (General_options): Add start_lib and end_lib.
3589         (Input_argument::lib_): New.
3590         (Input_argument::lib): New.
3591         (Input_argument::is_lib): New.
3592         (Input_file_lib): New.
3593         (Input_arguments::in_lib_): New.
3594         (Input_arguments::in_lib): New.
3595         (Input_arguments::start_lib): New.
3596         (Input_arguments::end_lib_): New.
3597         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3598         in unused members as preempted.
3599         (Sized_pluginobj::do_should_include_member): New.
3600         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3601         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3602         return the blocker.
3603         (Read_symbols::do_whole_lib_group): New.
3604         (Read_symbols::do_lib_group): New.
3605         (Read_symbols::do_read_symbols): Handle lib groups.
3606         (Read_symbols::get_name): Handle lib groups.
3607         * readsyms.h (Read_symbols): Add an archive member pointer.
3608         (Read_symbols::do_whole_lib_group): New.
3609         (Read_symbols::do_lib_group): New.
3610         (Read_symbols::member_): New.
3611         * script.cc (read_input_script): Update call to queue_soon.
3612
3613 2010-03-19  Doug Kwan  <dougkwan@google.com>
3614
3615         * arm.cc (Stub_table::Stub_table): Initialize new data members
3616         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3617         (Stub_table::add_reloc_stub): Assign stub offset and update
3618         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3619         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3620         New data members.
3621         (Stub_table::update_data_size_and_addralign): Use
3622         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3623         instead of going over all reloc stubs.
3624         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3625         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3626         Stringpool_template::offset_ to size of Stringpool_char.
3627         (Stringpool_template::new_key_offset): Remove code to initialize
3628         Stringpool_template::offset_.
3629         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3630         Stringpool_template::offset_ to zero.
3631
3632 2010-03-15  Doug Kwan  <dougkwan@google.com>
3633
3634         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3635         offset_.
3636         (Stringpool_template::new_key_offset): New method.
3637         (Stringpool_template::add_string): Assign offsets when adding new
3638         strings.
3639         (Stringpool_template::set_string_offsets): Do not set string offsets
3640         when not optimizing.
3641         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3642         member size_.
3643         (Chunked_vector::clear): Clear size_.
3644         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3645         (Chunked_vector::size): Return size_.
3646         (Chunked_vector::push_back): Use size_ to find insert position.
3647         (Chunked_vector::size_): New data member.
3648         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3649         (Stringpool_template::new_key_offset): New method declaration.
3650         (Stringpool_template::offset_): New data member.
3651
3652 2010-03-15   Rafael Espindola  <espindola@google.com>
3653
3654         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3655         Add_symbols' constructor.
3656         * readsyms.h (Add_symbols): Remove the input_group member.
3657
3658 2010-03-10  Ian Lance Taylor  <iant@google.com>
3659
3660         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3661         target to ask whether a reference to a symbol requires a stack
3662         split.
3663         * target.h (Target::is_call_to_non_split): New function.
3664         (Target::do_is_call_to_non_split): Declare virtual function.
3665         * target.cc: Include "symtab.h".
3666         (Target::do_is_call_to_non_split): New function.
3667         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3668
3669 2010-03-10  Cary Coutant  <ccoutant@google.com>
3670
3671         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3672         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3673         (File_read::open[2]): Add whole_file_view_ to list of views.
3674         (File_read::make_view): Remove test of whole_file_view_.
3675         (File_read::find_or_make_view): Create whole_file_view_ if
3676         necessary.
3677         (File_read::clear_views): Replace bool parameter with enum;
3678         adjust all callers.  Don't delete views with permanent data;
3679         do delete cached views and views from archives if
3680         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3681         if clearing the corresponding view.
3682         * fileread.h (File_read::Clear_views_mode): New enum.
3683         (File_read::View::is_permanent_view): New method.
3684         (File_read::clear_views): Replace bool parameter
3685         with enum; adjust all callers.
3686         * options.h (General_options): Change keep_files_mapped option;
3687         add map_whole_files.
3688         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3689         releasing the file.
3690         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3691         the file.
3692
3693 2010-03-10  David S. Miller  <davem@davemloft.net>
3694
3695         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3696
3697 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3698
3699         * icf.cc (get_section_contents): Add '@' marker after processing the
3700         merge reloc.
3701
3702 2010-03-08  Doug Kwan  <dougkwan@google.com>
3703
3704         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3705         due to a conversion warning.
3706         (Arm_relobj::update_output_local_symbol_count): Check for local
3707         symbol with unset output index.
3708
3709 2010-03-05  Ian Lance Taylor  <iant@google.com>
3710
3711         * options.h (class General_options): Add --spare-dynamic-tags.
3712         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3713         --spare-dynamic-tags.
3714
3715 2010-03-05  Ian Lance Taylor  <iant@google.com>
3716
3717         * incremental.cc: Include "libiberty.h".
3718
3719 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3720
3721         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3722         function, is_info_ member.
3723         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3724         (Versions::Versions): Update caller.
3725         (Versions::define_base_version): Likewise.
3726         (Versions::add_def): Likewise.
3727
3728 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3729
3730         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3731         (Scan::possible_function_pointer_reloc): New function.
3732         (Scan::local_reloc_may_be_function_pointer): Change to call
3733         possible_function_pointer_reloc.
3734         (Scan::global_reloc_may_be_function_pointer): Ditto.
3735         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3736         relocations in ".data.rel.ro._ZTV" section.
3737         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3738         * testsuite/icf_safe_so_test.cc: Ditto.
3739         * testsuite/icf_safe_test.cc: Ditto.
3740         * testsuite/icf_safe_test.sh: Ditto.
3741
3742 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3743             Ian Lance Taylor  <iant@google.com>
3744
3745         * target-reloc.h (relocate_section): Check the symbol table index
3746         for -1U before setting the local symbol index.
3747         (scan_relocatable_relocs): If copying the relocation, record that
3748         the local symbol is required.
3749         * object.h (Symbol_value::is_output_symtab_index_set): New
3750         function.
3751         (Symbol_value::may_be_discarded_from_output_symtab): New
3752         function.
3753         (Symbol_value::has_output_symtab_entry): New function.
3754         (Symbol_value::needs_output_symtab_entry): Remove.
3755         (Symbol_value::output_symtab_index): Make sure the symbol index is
3756         set.
3757         (Symbol_value::set_output_symtab_index): Make sure the symbol
3758         index is not set.  Make sure the new index is valid.
3759         (Symbol_value::set_must_have_output_symtab_entry): New function.
3760         (Symbol_value::has_output_dynsym_entry): New function.
3761         (Symbol_value::set_output_dynsym_index): Make sure the new index
3762         is valid.
3763         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3764         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3765         local symbol if permitted.
3766         (Sized_relobj::do_finalize_local_symbols): Call
3767         is_output_symtab_index_set rather than needs_output_symtab_entry.
3768         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3769         rather than needs_output_symtab_entry.  Call
3770         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3771         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3772         is_output_symtab_index_set rather than needs_output_symtab_entry.
3773         * testsuite/discard_locals_relocatable_test.c: New file.
3774         * testsuite/discard_locals_test.sh: Test -r.
3775         * testsuite/Makefile.am (check_DATA): Add
3776         discard_locals_relocatable_test1.syms,
3777         discard_local_relocatable_test2.syms.
3778         (MOSTLYCLEANFILES): Likewise.  Also add
3779         discard_locals_relocatable_test1.lout and
3780         discard_locals_relocatable_test2.out.
3781         (discard_locals_relocatable_test1.syms): New target.
3782         (discard_locals_relocatable_test.o): New target.
3783         (discard_locals_relocatable_test1.out): New target.
3784         (discard_locals_relocatable_test2.syms): New target.
3785         (discard_locals_relocatable_test2.out): New target.
3786         (various): Add missing ../ld-new dependencies.
3787         * testsuite/Makefile.in: Rebuild.
3788
3789 2010-03-03  Nick Clifton  <nickc@redhat.com>
3790
3791         * po/fi.po: New Finnish translation.
3792
3793 2010-03-01  Doug Kwan  <dougkwan@google.com>
3794
3795         * layout.cc (Layout::Layout): Force section types of .init_array*,
3796         .preinit_array* and .fini_array* sections.
3797         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3798         Fix check of return value of std::string::find.().
3799         (Output_section::Input_section_sort_compare::operator()): Remove
3800         comment about .init_array.
3801         (Output_section::Input_section_sort_init_fini_compare::operator()):
3802         New method.
3803         (Output_section::sort_attached_input_sections): Handle .init_array
3804         and .fini_array specially.
3805         * output.h (Output_section::Inut_section_sort_compare): Update
3806         comment.
3807         (Output_section::Input_section_sort_init_fini_compare): New struct.
3808
3809 2010-02-26  Doug Kwan  <dougkwan@google.com>
3810
3811         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3812         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3813         * testsuite/debug_msg.sh: Avoid matching source line number for
3814         use of global variable undef_int.
3815
3816 2010-02-26  Doug Kwan  <dougkwan@google.com>
3817
3818         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3819         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3820         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3821         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3822         * options.cc (General_options::General_options): Initialize member
3823         fix_v4bx_.
3824         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3825         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3826         and rm_no_fix_v4bx.stdout
3827         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3828         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3829         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3830         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3831         and arm_no_fix_v4bx.
3832         * Makefile.in: Regenerate.
3833         * testsuite/arm_fix_v4bx.s: New file.
3834         * testsuite/arm_fix_v4bx.sh: Ditto.
3835
3836 2010-02-24  Doug Kwan  <dougkwan@google.com>
3837
3838         * arm.cc (Target_arm::got_section): Make the .got section the first
3839         non RELRO section in the data segment.
3840         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3841         suffixes of section names.
3842
3843 2010-02-24  Doug Kwan  <dougkwan@google.com>
3844
3845         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3846         flags and attributes merging if an input file is a binary file.
3847         * fileread.cc (Input_file::open): Record format of original file.
3848         * fileread.h (Input_file::Format): New enum type.
3849         (Input_file::Input_file): Initialize data member format_.
3850         (Input_file::format): New method definition.
3851         (Input_file::format_):: New data member.
3852
3853 2010-02-24  Doug Kwan  <dougkwan@google.com>
3854
3855         * arm.cc (Arm_output_data_got): New class.
3856         (ARM_TCB_SIZE): New constant
3857         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3858         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3859         If user uses a script with a SECTIONS clause, issue only a warning
3860         for a misplaced EXIDX input section.  Otherwise, issue an error.
3861         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3862         garbage collection.
3863         (Target_arm::got_mode_index_entry): Handle static linking.
3864         (Target_arm::Scan::local): Ditto.
3865         (Target_arm::Scan::global): Ditto.
3866         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3867         all incorrectly implemented relocations.
3868         (Target_arm::fix_exidx_coverage): Pass layout to
3869         Arm_output_section::fix_exidx_coverage.
3870         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3871         from ".ARM.exidx." and ".ARM.extab.".
3872
3873 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3874
3875         * arm.cc (Target_arm::do_finalize_sections): Create attribute
3876         section if it does not already exist.
3877         * attributes.cc (Attributes_section_data::Attributes_section_data):
3878         Don't crash if size is zero.
3879
3880 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3881             Ian Lance Taylor  <iant@google.com>
3882
3883         * gold.cc (queue_middle_tasks): If no input files were opened,
3884         exit.
3885         * workqueue.h (Task_function::Task_function): Assert that there is
3886         a blocker.
3887
3888 2010-02-22  Doug Kwan  <dougkwan@google.com>
3889
3890         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3891         * icf.cc (get_section_contents): Cast snprintf arguments to long long
3892         types to avoid warnings due to different uint64_t implementations
3893         on different hosts.
3894
3895 2010-02-21  Doug Kwan  <dougkwan@google.com>
3896
3897         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3898         handling of the maximum backward branch offset.
3899         (Arm_relocate_functions::thumb_branch_common): Ditto.
3900         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3901         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3902         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3903         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3904         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3905         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3906         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3907         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3908         thumb_bl_out_of_range thumb_bl_out_of_range.o,
3909         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3910         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3911         thumb2_bl_out_of_range.o): New rules.
3912         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3913         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3914         thumb2_bl_out_of_range
3915         * testsuite/Makefile.in: Regenerate.
3916         * testsuite/arm_bl_in_range.s: New file.
3917         * testsuite/arm_bl_out_of_range.s: Ditto.
3918         * testsuite/arm_branch_in_range.sh: Ditto.
3919         * testsuite/arm_branch_range.t: Ditto.
3920         * testsuite/thumb2_branch_range.t: Ditto.
3921         * testsuite/thumb_bl_in_range.s: Ditto.
3922         * testsuite/thumb_bl_out_of_range.s: Ditto.
3923         * testsuite/thumb_branch_range.t: Ditto.
3924
3925 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
3926
3927         * gc.h (gc_process_relocs): Change vectors to point to the new list.
3928         Add reloc offset information.
3929         * icf.cc (get_section_contents): Change iterators to point to the new
3930         vectors. Add reloc offset information to the contents.
3931         * icf.h (Icf::Sections_reachable_info): New typedef.
3932         (Icf::Sections_reachable_list): New typedef.
3933         (Icf::Offset_info): New typedef.
3934         (Icf::Reloc_info): New struct typedef.
3935         (Icf::Reloc_info_list): New typedef.
3936         (Icf::symbol_reloc_list): Delete method.
3937         (Icf::addend_reloc_list): Delete method.
3938         (Icf::section_reloc_list): Delete method.
3939         (Icf::reloc_info_list): New method.
3940         (Icf::reloc_info_list_): New member.
3941
3942 2010-02-19  Doug Kwan  <dougkwan@google.com>
3943
3944         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3945         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3946         * arm.cc (Arm_relocation_functions): New forward declaration.
3947         (Target_arm::Target_arm): Initialize new data members
3948         got_mod_index_offset_ and tls_base_symbol_defined_.
3949         (Target_arm::Relocate::relocate_tls): New method.
3950         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3951          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3952         New methods.
3953         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3954         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3955         (Target_arm::got_mod_index_offset_,
3956         Target_arm::tls_base_symbol_defined_): New data members.
3957         (Target_arm::Scan::local, Target::Scan::global,
3958         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3959         relocations.
3960
3961 2010-02-18  Doug Kwan  <dougkwan@google.com>
3962
3963         * arm.cc (Arm_relobj::find_linked_text_section): New method.
3964         (Arm_relobj::make_exidx_input_section): Pass section index of linked
3965         text section as a parameter becuase some broken tools may not set
3966         the link in section header.
3967         (Target_arm::has_got_section): New method.
3968         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3969         without any mapping symbol as data only.  Remove warning.
3970         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3971         link in its section header, try to discover the link by inspecting the
3972         REL31 relocation at the beginning of the section.
3973         (Target_arm::Scan::check_non_pic): Report name of offending relocation
3974         in error message.
3975         (Target_arm::Scan::global): Treat any reference to the symbol
3976         _GLOBAL_OFFSET_TABLE_ as a GOT access.
3977
3978 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
3979
3980         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3981         (Scan::global_reloc_may_be_function_pointer): New function.
3982         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3983         (Scan::global_reloc_may_be_function_pointer): New function.
3984         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3985         (Scan::global_reloc_may_be_function_pointer): New function.
3986         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3987         (Scan::global_reloc_may_be_function_pointer): New function.
3988         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3989         (Scan::global_reloc_may_be_function_pointer): New function.
3990         (Scan::possible_function_pointer_reloc): New function.
3991         (Target_x86_64::can_check_for_function_pointers): New function.
3992         * gc.h (gc_process_relocs): Scan relocation types to determine if
3993         function pointers were taken for targets that support it.
3994         * icf.cc (Icf::find_identical_sections): Include functions for
3995         folding in safe ICF whose pointer is not taken.
3996         * icf.h (Secn_fptr_taken_set): New typedef.
3997         (fptr_section_id_): New member.
3998         (section_has_function_pointers): New function.
3999         (set_section_has_function_pointers): New function.
4000         (check_section_for_function_pointers): New function.
4001         * options.h: Fix comment for safe ICF option.
4002         * target.h (can_check_for_function_pointers): New function.
4003         * testsuite/Makefile.am: Add icf_safe_so_test test case.
4004         Modify icf_safe_test for X86-64.
4005         * testsuite/Makefile.in: Regenerate.
4006         * testsuite/icf_safe_so_test.cc: New file.
4007         * testsuite/icf_safe_so_test.sh: New file.
4008         * testsuite/icf_safe_test.cc (kept_func_3): New function.
4009         (main): Change to take pointer to function kept_func_3.
4010         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4011         folding is done correctly for X86-64.
4012
4013 2010-02-12  David S. Miller  <davem@davemloft.net>
4014
4015         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4016         is_symbolless parameter.
4017         (Output_reloc<SHT_REL>::is_symbolless): New.
4018         (Output_reloc<SHT_REL>::is_symbolless_): New.
4019         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4020         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4021         (Output_reloc<SHT_RELA>::is_symbolless): New.
4022         (Output_data_reloc::add_global): Handle is_symbolless.
4023         (Output_data_reloc::add_global_relative): Likewise.
4024         (Output_data_reloc::add_local): Likewise.
4025         (Output_data_reloc::add_local_relative): Likewise.
4026         (Output_data_reloc::add_symbolless_global_addend): New.
4027         (Output_data_reloc::add_symbolless_local_addend): New.
4028         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4029         is_symbolless.
4030         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4031         instead of ->is_relative_
4032         (Output_reloc::write): Likewise.
4033         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4034         (Output_reloc::write_rel): Simplify.
4035
4036         * sparc.cc (Target_sparc::Scan::local): Use
4037         ->add_symbolless_local_addend as needed.
4038         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4039         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
4040         based upon relocation offset.
4041
4042 2010-02-11  Doug Kwan  <dougkwan@google.com>
4043
4044         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4045         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
4046         beginning of function.
4047         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4048         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
4049         parameter is_32bit in calls to should_apply_static_reloc.
4050         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4051         (check_DATA): Add arm_abs_global.stdout.
4052         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4053         arm_abs_global.stdout): New rules.
4054         (MOSTLLYCLEANFILES): Add arm_abs_global
4055         * Makefile.in: Regenerate.
4056         * testsuite/arm_abs_global.s: New file.
4057         * testsuite/arm_abs_global.sh: Ditto.
4058         * testsuite/arm_abs_lib.s: Ditto.
4059
4060 2010-02-11  Ian Lance Taylor  <iant@google.com>
4061
4062         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4063         Read_relocs task.
4064         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
4065         Allocate_commons_task first.
4066         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4067         task, rather than symtab_lock_.
4068         (Gc_process_relocs::~Gc_process_relocs): New function.
4069         (Gc_process_relocs::is_runnable): Check this_blocker_.
4070         (Gc_process_relocs::locks): Use next_blocker_ rather than
4071         blocker_.
4072         (Scan_relocs::~Scan_relocs): New function.
4073         (Scan_relocs::is_runnable): Check this_blocker_ rather than
4074         symtab_lock_.
4075         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
4076         next_blocker_.
4077         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4078         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
4079         constructor accordingly.
4080         (class Gc_process_relocs): Likewise.
4081         (class Scan_relocs): Likewise.
4082         * common.h (class Allocate_commons_task): Remove symtab_lock_
4083         field, and corresponding constructor parameter.
4084         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4085         symtab_lock_.
4086         (Allocate_commons_task::locks): Likewise.
4087
4088 2010-02-11  Ian Lance Taylor  <iant@google.com>
4089
4090         * gold-threads.h (class Once): Define.
4091         (class Initialize_lock): Rewrite as child of Once.
4092         * gold-threads.cc (class Once_initialize): Define.
4093         (once_pointer_control): New static variable.
4094         (once_pointer, once_arg): New static variables.
4095         (c_run_once): New static function.
4096         (Once::Once, Once::run_once, Once::internal_run): New functions.
4097         (class Initialize_lock_once): Remove.
4098         (initialize_lock_control): Remove.
4099         (initialize_lock_pointer): Remove.
4100         (initialize_lock_once): Remove.
4101         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4102         (Initialize_lock::initialize): Rewrite.
4103         (Initialize_lock::do_run_once): New function.
4104         * archive.cc (Archive::interpret_header): Only clear name if it is
4105         not already empty.
4106         * fileread.cc: Include "gold-threads.h"
4107         (file_counts_lock): New static variable.
4108         (file_counts_initialize_lock): Likewise.
4109         (File_read::release): Only increment counts when using --stats.
4110         Use a lock around the increment.
4111         * parameters.cc (class Set_parameters_target_once): Define.
4112         (set_parameters_target_once): New static variable.
4113         (Parameters::Parameters): Move here from parameters.h.
4114         (Parameters::set_target): Rewrite.
4115         (Parameters::set_target_once): New function.
4116         (Parameters::clear_target): Move here and rewrite.
4117         * parameters.h (class Parameters): Update declarations.  Add
4118         set_parameters_target_once_ field.
4119         (Parameters::Parameters): Move to parameters.cc.
4120         (Parameters::clear_target): Likewise.
4121         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4122         task.
4123         (Start_group::~Start_group): New function.
4124         (Start_group::is_runnable): New function.
4125         (Start_group::locks, Start_group::run): New functions.
4126         (Finish_group::run): Change saw_undefined to size_t.
4127         * readsyms.h (class Start_group): Define.
4128         (class Finish_group): Change saw_undefined_ field to size_t.
4129         (Finish_group::Finish_group): Remove saw_undefined and
4130         this_blocker parameters.  Change all callers.
4131         (Finish_group::set_saw_undefined): New function.
4132         (Finish_group::set_blocker): New function.
4133         * symtab.h (class Symbol_table): Change saw_undefined to return
4134         size_t.  Change saw_undefined_ field to size_t.
4135         * target-select.cc (Set_target_once::do_run_once): New function.
4136         (Target_selector::Target_selector): Initialize set_target_once_
4137         field.  Don't initialize lock_ and initialize_lock_ fields.
4138         (Target_selector::instantiate_target): Rewrite.
4139         (Target_selector::set_target): New function.
4140         * target-select.h (class Set_target_once): Define.
4141         (class Target_selector): Update declarations.  Make
4142         Set_target_once a friend.  Remove lock_ and initialize_lock_
4143         fields.  Add set_target_once_ field.
4144
4145 2010-02-10  Ian Lance Taylor  <iant@google.com>
4146
4147         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4148         queueing any tasks.
4149         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4150         (queue_middle_tasks): Add all blockers before queueing any tasks.
4151         (queue_final_tasks): Likewise.
4152         * token.h (Task_token::add_blockers): New function.
4153         * object.h (Input_objects::number_of_relobjs): New function.
4154
4155 2010-02-10  Ian Lance Taylor  <iant@google.com>
4156
4157         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4158         shared, not if not position independent.
4159         * x86_64.cc (Relocate::relocate_tls): Likewise.
4160         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4161         (tls_pie_pic_test): New target.
4162         * testsuite/Makefile.in: Rebuild.
4163
4164         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4165         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4166         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4167         * testsuite/Makefile.in: Rebuild.
4168
4169 2010-02-09  David S. Miller  <davem@davemloft.net>
4170
4171         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4172         R_SPARC_RELATIVE using ->add_local_relative().
4173         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4174
4175         * output.h (Output_data_dynamic::add_section_size): New method
4176         that takes two Output_data objects.
4177         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4178         entry param.  Handle it in initializers.
4179         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4180         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4181         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4182         arg.
4183         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4184         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4185         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4186         for dynrel_includes_plt.
4187         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4188         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4189         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4190         before .rela.plt
4191         (Target_sparc::do_finalize_sections): Update to pass true for
4192         dynrel_includes_plt.
4193         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4194         output before .rela.plt
4195         (Target_powerpc::do_finalize_sections): Update to pass true for
4196         dynrel_includes_plt when 32-bit.
4197
4198 2010-02-08  Doug Kwan  <dougkwan@google.com>
4199
4200         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4201         method.
4202         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4203         Arm_relobj::scan_section_for_cortex_a8_stubs,
4204         Arm_relobj::do_relocation_section): Instead of calling
4205         Output_section::output_address, use faster
4206         Arm_relobj::simple_input_section_output_address.
4207
4208 2010-02-08  David S. Miller  <davem@davemloft.net>
4209
4210         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4211         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4212         relocation helper function.
4213
4214         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4215         just like R_SPARC_GOT{10,13,22}.
4216         (Target_sparc::Scan::local): Likewise.
4217         (Target_sparc::Relocate:relocate): Likewise.
4218
4219 2010-02-06  Ian Lance Taylor  <iant@google.com>
4220
4221         * configure.ac: Rewrite targetobjs duplicate removal code to use
4222         only shell constructs.
4223         * configure: Rebuild.
4224
4225 2010-02-05  Doug Kwan  <dougkwan@google.com>
4226
4227         PR 11247
4228         * arm.cc (Arm_relobj::section_is_scannable): New method.
4229         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4230         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4231
4232 2010-02-04  Doug Kwan  <dougkwan@google.com>
4233
4234         PR 11247
4235         * arm-reloc-property.cc (cstdio): Include.
4236         * configure.ac (targetobjs): Remove duplicates.
4237         * configure: Regenerate.
4238         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4239         big and little endian version for a given address size.
4240
4241 2010-02-03  Doug Kwan  <dougkwan@google.com>
4242
4243         * arm-reloc-property.cc
4244         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4245         definition.
4246         * arm-reloc-property.h
4247         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4248         New method definition.
4249         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4250         declaration.
4251         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4252         overflow to N.
4253         (GOT_PREL): Change implemented to Y.
4254         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4255         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4256         (Arm_relocate_functions::movw_abs_nc): Remove method.
4257         (Arm_relocate_functions::movt_abs): Ditto.
4258         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4259         (Arm_relocate_functions::thm_movt_abs): Ditto.
4260         (Arm_relocate_functions::movw_rel_nc): Ditto.
4261         (Arm_relocate_functions::movw_rel): Ditto.
4262         (Arm_relocate_functions::movt_rel): Ditto.
4263         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4264         (Arm_relocate_functions:thm_movw_rel): Ditto.
4265         (Arm_relocate_functions:thm_movt_rel): Ditto.
4266         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4267         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4268         New method definitions.
4269         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4270         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4271         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4272         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4273         (Target_arm::Relocate::relocate): Check for non-static or
4274         unimplemented relocation code and exit early.  Change calls to
4275         Target_arm::reloc_uses_thumb_bit and
4276         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4277         instead.  Refactor code to handle similar relocations to increase
4278         code sharing.  Remove check for unsupported relocation code in switch
4279         statement.
4280         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4281         relocation property table to find out size.  Change error message to
4282         print out the name of a relocation code instead of the numeric value.
4283         (Target_arm::scan_reloc_for_stub): Use relocation property table
4284         instead of calling Target_arm::reloc_uses_thumb_bit().
4285
4286 2010-02-02  Doug Kwan  <dougkwan@google.com>
4287
4288         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4289         types of relaxed input section.
4290
4291 2010-02-02  Doug Kwan  <dougkwan@google.com>
4292
4293         * Makefile.am (HFILES): Add arm-reloc-property.h.
4294         (DEFFILES): New.
4295         (TARGETSOURCES): Add arm-reloc-property.cc
4296         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4297         (libgold_a_SOURCES): $(DEFFILES)
4298         * Makefile.in: Regenerate.
4299         * arm-reloc-property.cc: New file.
4300         * arm-reloc-property.h: New file.
4301         * arm-reloc.def: New file.
4302         * arm.cc: Update comments.
4303         (arm-reloc-property.h): New included header.
4304         (arm_reloc_property_table): New global variable.
4305         (Target_arm::do_select_as_default_target): New method definition.
4306         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4307         arm-reloc-property to targ_extra_obj.
4308         * parameters.cc (set_parameters_target): Call
4309         Target::select_as_default_target().
4310         * target.h (Target::select_as_default_target): New method definition.
4311         (Target::do_select_as_default_target): Same.
4312
4313 2010-02-01  Doug Kwan  <dougkwan@google.com>
4314
4315         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4316         first_output_text_section_.
4317         (Arm_exidx_fixup::first_output_text_section): New method definition.
4318         (Arm_exidx_fixup::first_output_text_section_): New data member.
4319         (Arm_exidx_fixup::process_exidx_section): Record the first text
4320         output section seen.
4321         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4322         and entsize in output section header.
4323
4324 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4325
4326         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4327         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4328         (Arm_relocate_functions::thm_alu11): New Method.
4329         (Arm_relocate_functions::thm_pc8): New Method.
4330         (Arm_relocate_functions::thm_pc12): New Method.
4331         (Target_arm::Scan::local): Handle the relocations.
4332         (Target_arm::Scan::global): Likewise.
4333         (Target_arm::Relocate::relocate): Likewise.
4334         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4335
4336 2010-01-29  Doug Kwan  <dougkwan@google.com>
4337
4338         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4339         of relocation types as ld.
4340
4341 2010-01-29  Doug Kwan  <dougkwan@google.com>
4342
4343         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4344         to public.
4345         (Arm_relocate_functions::thumb_branch_common): Ditto.
4346         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4347         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4348         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4349         Arm_relocate_functions::jump24): Remove.
4350         (Target_arm::Relocate::relocate): Adjust code to call
4351         Arm_relocation_functions::arm_branch_common and
4352         Arm_relocation_functions::thumb_branch_common instead of their removed
4353         wrappers.  Merge switch-cases together to reduce source code size.
4354
4355 2010-01-29  Doug Kwan  <dougkwan@google.com>
4356
4357         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4358         output_local_symbol_count_needs_update_.
4359         (Arm_relobj::output_local_symbol_count_needs_update,
4360          Arm_relobj::set_output_local_symbol_count_needs_update,
4361          Arm_relobj::update_output_local_symbol_count): New methods.
4362         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4363         member.
4364         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4365         of pointed function as in a R_ARM_PREL31 relocation.
4366         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4367         for output local symbol count updating.
4368         (Target_arm::do_relax): Update output local symbol counts in objects
4369         if necessary.
4370         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4371
4372 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4373
4374         * arm.cc: Added support for the ARM relocations:
4375         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4376         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4377         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4378         movw_prel_nc).
4379         (Arm_relocate_functions::movw_rel): New method.
4380         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4381         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4382         thm_movw_prel_nc).
4383         (Arm_relocate_functions::thm_movw_rel): New method.
4384         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4385         thm_movt_prel).
4386         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4387         relocations.
4388         (Target_arm::Scan::global): Likewise.
4389         (Target_arm::Relocate::relocate): Likewise.
4390         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4391         Likewise.
4392
4393 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4394
4395         * arm.cc: Added support for ARM group relocations.
4396         (Target_arm::reloc_needs_sym_origin): New method.
4397         (Arm_relocate_functions::calc_grp_kn): New method.
4398         (Arm_relocate_functions::calc_grp_residual): New method.
4399         (Arm_relocate_functions::calc_grp_gn): New method.
4400         (Arm_relocate_functions::arm_grp_alu): New Method.
4401         (Arm_relocate_functions::arm_grp_ldr): New Method.
4402         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4403         (Arm_relocate_functions::arm_grp_ldc): New Method.
4404         (Target_arm::Scan::local): Handle the ARM group relocations.
4405         (Target_arm::Scan::global): Likewise.
4406         (Target_arm::Relocate::relocate): Likewise.
4407         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4408         Likewise.
4409
4410 2010-01-26  Doug Kwan  <dougkwan@google.com>
4411
4412         * arm.cc (set): Include.
4413         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4414         pointer type.
4415         (Arm_output_section::Text_section_list): New type.
4416         (Arm_output_section::append_text_sections_to_list): New method.
4417         (Arm_output_section::fix_exidx_coverage): Ditto.
4418         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4419         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4420         Relobj::set_section_offset() instead of
4421         Sized_relobj::invalidate_section_offset().
4422         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4423         parameter for section headers. Ignore relocation sections for
4424         unallocated sections and EXIDX sections.
4425         (Target_arm::fix_exidx_coverage): New method.
4426         (Target_arm::output_section_address_less_than): New type.
4427         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4428         linked text section instead of the EXIDX section.
4429         (Arm_output_section::create_stub_group): Add an assertion to check
4430         that this is not an EXIDX output section.
4431         (Arm_output_section::append_text_sections_to_list): New method.
4432         (Arm_output_section::fix_exidx_coverage): Ditto.
4433         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4434         Arm_relobj::section_needs_reloc_stub_scanning.
4435         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4436         first pass.
4437         (Target_arm::fix_exidx_coverage): New method.
4438         * object.h (Relobj::set_output_section): New method.
4439         (Sized_relobj::invalidate_section_offset): Remove method.
4440         (Sized_relobj::do_invalidate_section_offset): Remove method.
4441         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4442
4443 2010-01-25  Doug Kwan  <dougkwan@google.com>
4444
4445         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4446         Fix warning due to signed and unsigned comparison on a 32-bit host.
4447
4448 2010-01-22  Doug Kwan  <dougkwan@google.com>
4449
4450         * arm.cc (Target_arm::do_relax): Record an output section for section
4451         offset adjustment it contains any stub table that has changed.
4452         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4453         offsets in an output section if necessary.
4454         * output.cc (Output_section::Output_section): Initialize
4455         section_offsets_need_adjustments_.
4456         (Output_section::add_input_section_for_script): Renamed to
4457         Output_section::add_simple_input_section.
4458         (Output_section::save_states): Add a comment.
4459         (Output_section::discard_states): New method defintion.
4460         (Output_section::adjust_section_offsets): Same.
4461         * output.h (Output_section::add_input_section_for_script): Renamed to
4462         Output_section::add_simple_input_section.
4463         (Output_section::discard_states): New method declaration.
4464         (Output_section::adjust_section_offsets): Same.
4465         (Output_section::section_offsets_need_adjustment,
4466         Output_section::set_section_offsets_need_adjustment): New method
4467         definitions.
4468         (Output_section::section_offsets_need_adjustment_): New data member.
4469         * script-sections.cc
4470         (Output_section_element_input::set_section_address): Adjust code for
4471         renaming of Output_section::add_input_section_for_script.
4472         (Orphan_output_section::set_section_address): Same.
4473
4474 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4475
4476         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4477         Fix_v4bx enum values .
4478         * gold/options.h (General_options): New option definitions.
4479         (General_options::fix_v4bx): New method.
4480         (General_options::Fix_v4bx): New enum.
4481         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4482         (General_options::parse_fix_v4bx_interworking): New method.
4483
4484 2010-01-22  Doug Kwan  <dougkwan@google.com>
4485
4486         * arm.cc (Arm_exidx_fixup): New class.
4487
4488 2010-01-21  Doug Kwan  <dougkwan@google.com>
4489
4490         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4491         classes.
4492         (Arm_exidx_section_offset_map): New type.
4493
4494 2010-01-21  Doug Kwan  <dougkwan@google.com>
4495
4496         * arm.cc (Arm_exidx_input_section): New class.
4497         (Arm_relobj::exidx_input_section_by_link,
4498         Arm_relobj::exidx_input_section_by_shndx,
4499         Arm_relobj::make_exidx_input_section): New methods.
4500         (read_arm_attributes_section): Remove.
4501         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4502         information about them.
4503         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4504         to here.
4505
4506 2010-01-20  Doug Kwan  <dougkwan@google.com>
4507
4508         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4509         Input_section_specifier to Section_id.
4510         (Target_arm::new_arm_input_section: Adjust code for change of key
4511         type.
4512         (Target_arm::find_arm_input_section): Ditto.
4513         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4514         (Section_id): Remove.
4515         (Garbage_collection::Section_id_hash): Remove.
4516         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4517         (Section_id): Remove.
4518         (Icf::Section_id_hash): Remove.
4519         * object.h (Section_id, Const_section_id, Section_id_hash,
4520         Const_section_id_hash): New type definitions.
4521         * output.cc (Output_section::add_relaxed_input_section): Change to
4522         use Const_section_id instead of Input_section_specifier as key type.
4523         (Output_section::add_merge_input_section): Ditto.
4524         (Output_section::build_relaxation_map): Change to use Section_id
4525         instead of Input_section_specifier as key type.
4526         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4527         Ditto.
4528         (Output_section::convert_input_sections_to_relaxed_sections): Change
4529         to use Const_section_id instead of Input_section_specifier as key type.
4530         (Output_section::find_merge_section): Ditto.
4531         (Output_section::find_relaxed_input_section): Ditto.
4532         * output.h (Input_section_specifier): Remove class.
4533         (Output_section::Output_section_data_by_input_section_map): Change
4534         key type to Const_section_id.
4535         (Output_section::Output_relaxed_input_section_by_input_section_map):
4536         Ditto.
4537         (Output_section::Relaxation_map): Change key type to Section_id.
4538
4539 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4540
4541         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4542         (class Arm_v4bx_stub): New class.
4543         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4544         (Stub_factory::make_arm_v4bx_stub): New method.
4545         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4546         (Stub_table::empty): Handle v4bx stubs.
4547         (Stub_table::add_arm_v4bx_stub): New method.
4548         (Stub_table::find_arm_v4bx_stub): New method.
4549         (Arm_relocate_functions::v4bx): New method.
4550         (Target_arm::fix_v4bx): New method.
4551         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4552         (Stub_table::relocate_stubs): Likewise.
4553         (Stub_table::do_write): Likewise.
4554         (Stub_table::update_data_size_and_addralign): Likewise.
4555         (Stub_table::finalize_stubs):  Likewise.
4556         (Target_arm::Scan::local): Likewise.
4557         (Target_arm::Scan::global): Likewise.
4558         (Target_arm::do_finalize_sections): Likewise.
4559         (Target_arm::Relocate::relocate): Likewise.
4560         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4561         Likewise.
4562         (Target_arm::scan_reloc_for_stub): Likewise.
4563         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4564
4565 2010-01-19  Ian Lance Taylor  <iant@google.com>
4566
4567         * output.cc (Output_section_headers::do_sized_write): Write large
4568         segment count to sh_info field.
4569         (Output_file_header::do_sized_write): For large segment count,
4570         write PN_XNUM to e_phnum field.
4571
4572 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4573
4574         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4575         (Arm_relocate_functions::thm_jump8): New function.
4576         (Arm_relocate_functions::thm_jump11): New function.
4577         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4578         R_ARM_THM_JUMP11.
4579         (Target_arm::Scan::global): Likewise.
4580         (Target_arm::Relocate::relocate): Likewise.
4581         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4582         Likewise.
4583
4584 2010-01-14  Doug Kwan  <dougkwan@google.com>
4585
4586         * arm.cc (map, utility): Include headers.
4587         (Target_arm::apply_cortex_a8_workaround): New method.
4588         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4589         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4590         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4591         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4592         the --[no-]fix-cortex-a8 command line options.
4593         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4594         (Target_arm::relocate_stub): Use addend in instruction template.
4595         * options.h (DEFINE_bool): Set the user-set flag.
4596         (General_options): Add --[no-]-fix-cortex options.
4597         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4598         : Update fast look-up map after conversion.
4599
4600 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4601
4602         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4603         in the first pass of do_layout.
4604
4605 2010-01-13  Doug Kwan  <dougkwan@google.com>
4606
4607         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4608         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4609         apparent compiler problem of not folding static constant integral
4610         data members of elfcpp::Elf_sizes<32>.
4611
4612 2010-01-13  Doug Kwan  <dougkwan@google.com>
4613
4614         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4615         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4616         Arm_relobj::scan_section_for_cortex_a8_erratum,
4617         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4618         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4619         sections to scan for relocation stubs into a new method
4620         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4621         relocation and Cortex-A8 stub scanning.
4622         (Target_arm::do_relax): Force stubs to be after stubbed sections
4623         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4624         the beginning of a new relaxation pass.  Update a comment.
4625         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4626
4627 2010-01-12  Ian Lance Taylor  <iant@google.com>
4628
4629         * target-reloc.h (visibility_error): New inline function.
4630         (relocate_section): Call visibility_error.
4631         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4632         (MOSTLYCLEANFILES): Likewise.
4633         (protected_4_pic.o, protected_3.err): New targets.
4634         * testsuite/protected_4.cc: New file.
4635
4636 2010-01-12  Doug Kwan  <dougkwan@google.com>
4637
4638         * arm.cc (Cortex_a8_reloc): New class.
4639         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4640         and cortex_a8_relocs_info_.
4641         (Target_arm::fix_cortex_a8): New method definition.
4642         (Target_arm::Cortex_a8_relocs_info): New type.
4643         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4644         New data member declarations.
4645         (Target_arm::scan_reloc_for_stub): Record information about
4646         relocations for THUMB branches that might be exempted from the
4647         Cortex-A8 workaround.
4648         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4649         at the beginning of a relaxation pass.
4650
4651 2010-01-12  Doug Kwan  <dougkwan@google.com>
4652
4653         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4654         (Arm_relobj::Mapping_symbol_position,
4655          Arm_reloj::Mapping_symbol_position_less,
4656          Arm_relobj::Mapping_symbols_info): New types.
4657         (Target_arm::is_mapping_symbol_name): New method definition.
4658         (Arm_relobj::do_count_local_symbols): Save information about mapping
4659         symbols.
4660
4661 2010-01-11  Doug Kwan  <dougkwan@google.com>
4662
4663         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4664         Arm_relocate_functions::thumb32_branch_upper,
4665         Arm_relocate_functions::thumb32_branch_lower,
4666         Arm_relocate_functions::thumb32_cond_branch_offset,
4667         Arm_relocate_functions::thumb32_cond_branch_upper,
4668         Arm_relocate_functions::thumb32_cond_branch_lower,
4669         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4670         branch offset encoding.
4671         (Arm_relocate_functions::thumb_branch_common): Use new branch
4672         offset encoding methods to avoid code duplication.
4673         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4674         (Stub_addend_reader::operator()): Use new branch encoding method
4675         to avoid code duplication.
4676
4677 2010-01-11  Doug Kwan  <dougkwan@google.com>
4678
4679         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4680         (Target_arm::do_finalize_sections): Define special EXIDX section
4681         symbols only if referenced.
4682         * gc.h (Garbage_collection::add_reference): New method.
4683         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4684         code duplication.
4685
4686 2010-01-11  Ian Lance Taylor  <iant@google.com>
4687
4688         * script.cc (Version_script_info::build_expression_list_lookup):
4689         Change complaing about duplicate wildcard match from error to
4690         warning.
4691
4692         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4693         of 2009-12-30.
4694         (Version_script_info::Version_script_info): Initialize globs_,
4695         default_version_, default_is_global_, and exact_.  Don't
4696         initialize globals_ or locals_.
4697         (Version_script_info::build_lookup_tables): Build local symbols
4698         first.
4699         (Version_script_info::unquote): New function.
4700         (Version_script_info::add_exact_match): New function.
4701         (Version_script_info::build_expression_list_lookup): Remove lookup
4702         parameter.  Add is_global parameter.  Change all callers.  Handle
4703         wildcard pattern specially.  Unquote pattern.  Call
4704         add_exact_match.
4705         (Version_script_info::get_name_to_match): New function.
4706         (Version_script_info::get_symbol_version): New function.
4707         (Version_script_info::get_symbol_version_helper): Remove.
4708         (Version_script_info::check_unmatched_names): Call unquote.
4709         * script.h (class Version_script_info): Change get_symbol_version
4710         to be non-inline and add is_global parameter; change all callers.
4711         Rewrite symbol_is_local.  Update declarations.  Define struct
4712         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4713         Remove globals_ and locals_ members.  Add exact_, globs_,
4714         default_version_, is_global_.
4715         (Version_script_info::Glob): Remove pattern, add expression and
4716         is_global.  Update constructor.  Change all callers.
4717         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4718         default version.
4719         (Versions::symbol_section_contents): If a symbol is undefined, or
4720         defined in a dynamic object, set the version index to
4721         VER_NDX_LOCAL.
4722         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4723         symbol_is_local.
4724         (Symbol_table::add_from_pluginobj): Likewise.
4725         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4726
4727 2010-01-11  Doug Kwan  <dougkwan@google.com>
4728
4729         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4730         (incremental_dump_LDADD): Add linking option for libintl.
4731         * Makefile.in: Regenerate.
4732
4733 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4734
4735         PR gold/11144
4736         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4737         instead of -Ds.
4738         * testsuite/Makefile.in: Regenerated.
4739
4740 2010-01-10  Doug Kwan  <dougkwan@google.com>
4741
4742         * options.h (DEFINE_var): Use parentheses around argument varname__
4743         in macro body to avoid any unintended subsequent substitutions.
4744
4745 2010-01-10  Ian Lance Taylor  <iant@google.com>
4746
4747         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4748         candidates before doing symbol resolution.
4749
4750         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4751         ODR candidates if only one is weak.
4752
4753 2010-01-08  Ian Lance Taylor  <iant@google.com>
4754
4755         * script.cc (Version_script_info::build_expression_list_lookup):
4756         Don't warn about ambiguous version, just record the ambiguity.
4757         (Version_script_info::get_symbol_version_helper): Give error if
4758         version is ambiguous.
4759
4760 2010-01-08  Doug Kwan  <dougkwan@google.com>
4761
4762         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4763           prev_data_size_ and prev_addralign_.  Remove initializer for
4764           deleted data member has_been_changed_.
4765           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4766           to determine if the table is empty.
4767           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4768           Remove.
4769           (Stub_table::add_reloc_stub): Define method in class definition
4770           instead of just declaring it there.
4771           (Stub_table::add_cortex_a8_stub): New method definition.
4772           (Stub_table::update_data_size_and_addralign): Ditto.
4773           (Stub_table::finalize_stubs): Ditto.
4774           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4775           (Stub_table::do_addralign_): Return address alignment in the
4776           (Stub_table::do_reset_address_and_file_offset): Define method in
4777           class definition instead of declaring it there.  Set current data
4778           size to be the data size of the previous pass.
4779           (Stub_table::set_final_data_size): Use current data size as the
4780           final data size.
4781           (Stub_table::relocate_stub): Change parameter type of stub from
4782           Reloc_stub pointer to Stub pointer.
4783           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4784           (Stub_table::Cortex_a8_stub_list): New typedef.
4785           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4786            Stub_table::prev_addralign_): New data member.
4787           (Arm_relobj::Arm_relobj): Initialize data member
4788           section_has_cortex_a8_workaround_.
4789           (Arm_relobj::section_has_cortex_a8_workaround,
4790            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4791            definitions.
4792           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4793           declarations.
4794           (Target_arm::relocate_stub): Change parameter type of stub from
4795           Reloc_stub pointer to Stub pointer.
4796           (Insn_template::size, Insn_template::alignment): Handle
4797           THUMB16_SPECIAL_TYPE.
4798           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4799            Stub_table::update_data_size_and_addralign,
4800            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4801           definitions.
4802           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4803           (Stub_table::do_write): Ditto.
4804           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4805
4806 2010-01-08  Ian Lance Taylor  <iant@google.com>
4807
4808         PR 11108
4809         * symtab.h (class Symbol): Remove fields is_target_special_ and
4810         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4811         (Symbol::is_defined_in_discarded_section): New function.
4812         (Symbol::set_is_defined_in_discarded_section): New function.
4813         (Symbol::has_plt_offset): Rewrite.
4814         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4815         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4816         Don't initialize is_target_special_ or has_plt_offset_.
4817         Initialize is_defined_in_discarded_section_.
4818         (Symbol_table::add_from_relobj): If appropriate, set
4819         is_defined_in_discarded_section.
4820         * resolve.cc (Symbol::override_base_with_special): Don't test
4821         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4822         * target-reloc.h (relocate_section): Do special handling for
4823         symbols defined in discarded sections for global symbols as well
4824         as local symbols.
4825
4826 2010-01-08  Ian Lance Taylor  <iant@google.com>
4827
4828         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4829         the SHT_SYMTAB case.
4830
4831 2010-01-08  Ian Lance Taylor  <iant@google.com>
4832
4833         * object.cc (Sized_relobj::do_layout): Don't get confused if
4834         layout_eh_frame returns NULL.
4835
4836 2010-01-08  Ian Lance Taylor  <iant@google.com>
4837
4838         PR 11084
4839         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4840         dynamic symbol table, use the normal symbol table.
4841         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4842         symbol table.
4843
4844 2010-01-08  Ian Lance Taylor  <iant@google.com>
4845
4846         PR 11072
4847         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4848         sections.
4849
4850 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4851
4852         * version.cc (print_version): Change to "Copyright 2010".
4853
4854 2010-01-08  Ian Lance Taylor  <iant@google.com>
4855
4856         PR 10287
4857         PR 11063
4858         * i386.cc (class Target_i386): Change return type of plt_section
4859         to be non-const.
4860         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4861         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4862         tls_desc_rel_ field.
4863         (Output_data_plt_i386::rel_tls_desc): New function.
4864         (Target_i386::rel_tls_desc_section): New function.
4865         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4866         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4867         R_386_TLS_DESC reloc in rel_tls_desc_section.
4868         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4869         Define struct Tlsdesc_info.
4870         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4871         (Target_x86_64::do_reloc_symbol_index): New function.
4872         (Target_x86_64::add_tlsdesc_info): New function.
4873         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4874         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4875         tlsdesc_rel_ field.
4876         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
4877         all callers.
4878         (Output_data_plt_x86_64::rela_tlsdesc): New function.
4879         (Target_x86_64::rela_tlsdesc_section): New function.
4880         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4881         handling.
4882         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4883         (Target_x86_64::do_reloc_addend): New function.
4884         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4885         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4886         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
4887         (Output_reloc::type): New function.
4888         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4889         (Output_reloc::is_target_specific): New function.
4890         (Output_reloc::target_arg): New function.
4891         (class Output_reloc) [SHT_RELA]: Add four new constructors for
4892         absolute relocs and target specific relocs.
4893         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4894         add_target_specific.
4895         (class Output_data_reloc) [SHT_RELA]: Likewise.
4896         * output.cc (Output_reloc::Output_reloc): Add four new versions
4897         for absolute relocs and target specific relocs.
4898         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4899         (Output_reloc::get_symbol_index): Likewise.
4900         (Output_reloc::local_section_offset): Check that local_sym_index_
4901         is not TARGET_CODE or 0.
4902         (Output_reloc::symbol_value): Likewise.
4903         (Output_reloc::write) [SHT_RELA]: Call target for target specific
4904         reloc.
4905         * target.h (class Target): Add reloc_symbol_index and reloc_addend
4906         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
4907         functions.
4908         * layout.cc (add_target_dynamic_tags): Use output section for
4909         DT_PLTRELSZ and DT_JMPREL.
4910
4911 2010-01-07  Ian Lance Taylor  <iant@google.com>
4912
4913         PR 11061
4914         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4915         function.
4916         (class Output_data_reloc_generic): Define.
4917         (class Output_data_reloc_base): Change base class to
4918         Output_data_reloc_generic.  Change add() method to call
4919         bump_relative_reloc_count for a relative reloc.  Remove
4920         sort_relocs_ field.
4921         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4922         to sort_relocs().
4923         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4924         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
4925         appropriate.
4926         * layout.h (class Layout): Update declaration.
4927
4928 2010-01-07  Ian Lance Taylor  <iant@google.com>
4929
4930         * output.h (class Output_data): Add const version of
4931         output_section and do_output_section.
4932         (class Output_section_data): Add const version of
4933         do_output_section.
4934         (class Output_section): Likewise.
4935         * layout.cc (Layout::add_target_dynamic_tags): New function.
4936         * layout.h (class Layout): Update declarations.
4937         * arm.cc (Target_arm::do_finalize_sections): Use
4938         add_target_dynamic_tags.
4939         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4940         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4941         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4942         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4943
4944 2010-01-07  Ian Lance Taylor  <iant@google.com>
4945
4946         PR 11042
4947         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4948         object as needed.
4949
4950 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
4951             Ian Lance Taylor  <iant@google.com>
4952
4953         PR 11019
4954         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4955         Xindex::read_symtab_xindex.
4956
4957 2010-01-07  Doug Kwan  <dougkwan@google.com>
4958
4959         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4960         (Insn_template::thumb16_bcond_insn): New method declaration.
4961         (Insn_template): Fix spelling.
4962         (Stub::thumb16_special): New method declaration.
4963         (Stub::do_write): Define virtual method which was previously pure
4964         virtual.
4965         (Stub::do_thumb16_special): New method declaration.
4966         (Stub::do_fixed_endian_write): New template member.
4967         (Reloc_stub::do_write): Remove.
4968         (Reloc_stub::do_fixed_endian_write): Remove.
4969         (Cortex_a8_stub): New class definition.
4970         (Stub_factory::make_cortex_a8_stub): New method definition.
4971         (Stub_factory::Stub_factory): Add missing static storage class
4972         qualifier for elf32_arm_stub_a8_veneer_blx.
4973
4974 2010-01-07  Ian Lance Taylor  <iant@google.com>
4975
4976         PR 10980
4977         * options.h (class General_options): Add --warn-unresolved-symbols
4978         and --error-unresolved-symbols.
4979         * errors.cc (Errors::undefined_symbol): Implement
4980         --warn-unresolved-symbols.
4981
4982         * options.h (class General_options): Add -z text and -z textoff.
4983         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4984
4985 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
4986
4987         * gc.h (Garbage_collection::Cident_section_map): New typedef.
4988         (Garbage_collection::cident_sections): New function.
4989         (Garbage_collection::add_cident_section): New function.
4990         (Garbage_collection::cident_sections_): New member.
4991         (gc_process_relocs): Add references to sections whose names are C
4992         identifiers.
4993         * gold.h (cident_section_start_prefix): New constant.
4994         (cident_section_stop_prefix): New constant.
4995         (is_cident): New function.
4996         * layout.cc (Layout::define_section_symbols): Replace string constants
4997         with the newly defined constants.
4998         * object.cc (Sized_relobj::do_layout): Track sections whose names are
4999         C identifiers.
5000         * testsuite/Makefile.am: Add gc_orphan_section_test.
5001         * testsuite/Makefile.in: Regenerate.
5002         * testsuite/gc_orphan_section_test.cc: New file.
5003         * testsuite/gc_orphan_section_test.sh: New file.
5004
5005 2010-01-06  Ian Lance Taylor  <iant@google.com>
5006
5007         PR 10980
5008         * options.h (class General_options): Add --warn-shared-textrel.
5009         * layout.cc (Layout::finish_dynamic_section): Implement
5010         --warn-shared-textrel.
5011
5012         PR 10980
5013         * options.h (class General_options): Add --warn-multiple-gp.
5014
5015 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5016
5017         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5018         $(THREADSLIB) and $(LIBDL).
5019         * Makefile.in: Rebuild.
5020
5021 2010-01-06  Ian Lance Taylor  <iant@google.com>
5022
5023         PR 10980
5024         * options.cc (General_options::parse_section_start): New function.
5025         (General_options::section_start): New function.
5026         (General_options::General_options): Initialize all members.
5027         * options.h: Include <map>
5028         (class General_options): Add --section-start.  Add section_starts_
5029         member.
5030         * layout.cc (Layout::attach_allocated_section_to_segment): If
5031         --section-start was used, set the address of the segment.  Remove
5032         local sort_sections.
5033         (Layout::relaxation_loop_body): If the address of the load segment
5034         has been set by --section-start, don't use it.
5035         * output.h (Output_segment::update_flags_for_output_section): New
5036         function.
5037         * output.cc (Output_segment::add_output_section): Call
5038         update_flags_for_output_section.
5039
5040 2010-01-05  Ian Lance Taylor  <iant@google.com>
5041
5042         PR 10980
5043         * options.h (class General_options): Add --undefined-version.
5044         * script.cc (struct Version_expression): Add was_matched_by_symbol
5045         field.
5046         (Version_script_info::matched_symbol): New function.
5047         (Version_script_info::get_symbol_version_helper): Call
5048         matched_symbol.
5049         (Version_script_info::check_unmatched_names): New function.
5050         * script.h (class Version_script_info): Update declarations.
5051         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5052
5053         * options.h (class General_options): Use DEFINE_bool_alias for
5054         allow_multiple_definition.
5055         * resolve.cc (Symbol_table::should_override): Don't test
5056         allow_multiple_definition.
5057
5058         PR 10980
5059         * options.h (class General_options): Add --cref.
5060         * main.cc (main): Print cref table if --cref.  Don't close mapfile
5061         until after printing cref table.
5062         * cref.cc: Include "symtab.h".
5063         (class Cref_inputs): Define Cref_table_compare and Cref_table.
5064         (Cref_table_compare::operator()): New function.
5065         (Cref_inputs::gather_cref): New function.
5066         (filecol): New static const.
5067         (Cref_inputs::print_cref): New function.
5068         (Cref::print_cref): New function.
5069         * cref.h: Include <cstdio>.
5070         (class Cref): Update declarations.
5071         * mapfile.h (Mapfile::file): New function.
5072         * object.h (class Object): Define Symbols.  Declare virtual
5073         do_get_global_symbols.
5074         (Object::get_global_symbols): New function.
5075         * object.cc (Input_objects::add_object): Pass object to cref_ if
5076         --cref.
5077         (Input_objects::archive_start): Likewise.
5078         (Input_objects::archive_stop): Likewise.
5079         (Input_objects::print_cref): New function.
5080         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5081         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5082         --cref.
5083         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5084         function.
5085         * plugin.h (class Sized_pluginobj): Update declarations.
5086
5087 2010-01-05  Ian Lance Taylor  <iant@google.com>
5088
5089         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5090         to is_default_version.  Rename insdef to insdefault.
5091         (Symbol_table::add_from_relobj): Rename def to is_default_version
5092         and local to is_forced_local.
5093         (Symbol_table::add_from_pluginobj): Likewise.
5094         (Symbol_table::add_from_dynobj): Likewise.
5095         (Symbol_table::define_special_symbol): Rename insdef to
5096         insdefault.
5097
5098 2010-01-04  Ian Lance Taylor  <iant@google.com>
5099
5100         PR 10980
5101         * options.h (class General_options): Add
5102         --allow-multiple-definition and -z muldefs.
5103         * resolve.cc (Symbol_table::should_override): Don't warn about a
5104         multiple symbol definition if --allow-multiple-definition or -z
5105         muldefs.
5106
5107         PR 10980
5108         * options.h (class General_options): Add --add-needed and
5109         --copy-dt-needed-entries.  Tweak --as-needed help entry.
5110         * object.cc (Input_objects::check_dynamic_dependencies): Give an
5111         error if --copy-dt-needed-entries aka --add-needed is used and
5112         would cause a change in behaviour.
5113
5114         PR 10980
5115         * options.h (class General_options): Add -G as a short version of
5116         --shared.  Add no-op options -assert, -g, and -i.
5117
5118 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5119
5120         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5121         check for .text or .gnu.linkonce.t sections.
5122         * icf.cc (Icf::find_identical_sections): Ditto.
5123         Change the detection for mangled function name within the section
5124         name.
5125         * icf.h (is_section_foldable_candidate): New function.
5126
5127 2009-12-30  Ian Lance Taylor  <iant@google.com>
5128
5129         PR 10980
5130         * options.h (class General_options): Permit two dashes with
5131         --retain-symbols-file.
5132
5133 2009-12-30  Ian Lance Taylor  <iant@google.com>
5134
5135         PR 10979
5136         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5137         don't put the file header and segment headers in the text
5138         segment.
5139
5140         PR 10979
5141         * common.cc (Sort_commons::operator()): Stabilize sort when both
5142         entries are NULL.
5143         (Symbol_table::do_allocate_commons_list): When allocating common
5144         symbols, skip a symbol which is no longer common.
5145         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5146         an object before checking its type.
5147         * testsuite/common_test_2.c: New file.
5148         * testsuite/common_test_3.c: New file.
5149         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5150         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5151         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5152         (common_test_2_pic.o, common_test_2.so): New targets.
5153         (common_test_3_pic.o, common_test_3.so): New targets.
5154         * testsuite/Makefile.in: Rebuild.
5155
5156         PR 10979
5157         * script.cc (read_input_script): If we see a new SECTIONS clause,
5158         and we have added an input section, give an error.
5159         * layout.h (class Layout): Add have_added_input_section function.
5160         Add have_added_input_section_ field.
5161         * layout.cc (Layout::Layout): Initialize
5162         have_added_input_section_.
5163         (Layout::layout): Set have_added_input_section_.
5164         (Layout::layout_eh_frame): Likewise.
5165
5166 2009-12-30  Ian Lance Taylor  <iant@google.com>
5167
5168         PR 10931
5169         * options.h (class General_options): Add --sort-common option.
5170         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5171         * common.cc (Sort_common): Add sort_order parameter to
5172         constructor.  Add sort_order_ field.
5173         (Sort_commons::operator): Check sort_order_.
5174         (Symbol_table::allocate_commons): Determine the sort order.
5175         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5176         Change all callers.
5177         (Symbol_table::do_allocate_commons_list): Likewise.
5178
5179 2009-12-30  Ian Lance Taylor  <iant@google.com>
5180
5181         PR 10916
5182         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5183         symbols from this object, don't change the visibility of an
5184         undefined symbol.
5185         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5186
5187 2009-12-30  Ian Lance Taylor  <iant@google.com>
5188
5189         PR 10861
5190         * script.h (class Version_script_info): Define Language enum.
5191         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5192         new fields globals_, locals_, and is_finalized_.
5193         * script.cc: Various formatting fixes.
5194         (class Parser_closure): Change language_stack_ from a vector of
5195         std::string to one of Version_script_info::Language.  Adjust all
5196         uses accordingly.
5197         (class Lazy_demangler): Remove.
5198         (struct Version_expression): Change language from std::string to
5199         Version_script_info::Language.
5200         (Version_script_info::Version_script_info): New function.
5201         (Version_script_info::~Version_script_info): Don't call clear.
5202         (Version_script_info::finalize): New function.
5203         (Version_script_info::build_lookup_tables): New function.
5204         (Version_script_info::build_expression_list_lookup): New
5205         function.
5206         (Version_script_info::get_symbol_version_helper): Rewrite to use
5207         lookup tables.
5208         (Version_script_info::print_expression_list): Adjust to use
5209         Version_script_info::Language.
5210         (script_push_lex_into_version_mode): Check that the version script
5211         has not been finalized.
5212         (version_script_push_lang): Change language string to
5213         Version_script_info::Language.
5214         * options.cc (Command_line::version_script): New function.
5215         * options.h (class General_options): Add finalize_dynamic_list
5216         function.  Change version_script from declaration to definition.
5217         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5218         * testsuite/version_script.map: Remove duplicate def of foo.
5219         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5220         version_script.map.
5221         * testsuite/Makefile.in: Rebuild.
5222
5223 2009-12-30  Ian Lance Taylor  <iant@google.com>
5224
5225         PR 10843
5226         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5227         if the input symbol index is 0, make the output symbol index 0.
5228
5229 2009-12-30  Ian Lance Taylor  <iant@google.com>
5230
5231         PR 10670
5232         * options.h (class General_options): Add -x/--discard-all.
5233         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5234         --discard-all.  If the local symbol needs a dynamic entry, check
5235         that before handling --discard-locals.
5236
5237 2009-12-30  Ian Lance Taylor  <iant@google.com>
5238
5239         PR 10450
5240         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5241         flags to PF_R.
5242         (Output_segment::add_output_section): Don't change the flags if
5243         the type is PT_TLS.
5244
5245         PR 10450
5246         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5247         GNU hash table if they need a dynamic value.  Otherwise, don't add
5248         them if they are defined in a dynamic object or are forced local.
5249
5250 2009-12-29  Ian Lance Taylor  <iant@google.com>
5251
5252         PR 10450
5253         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5254         .gnu.hash table for a 32-bit target.
5255
5256         PR 10450
5257         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5258         regular and a dynamic object only needs a dynamic symbol table
5259         entry if it is externally visible.
5260
5261         PR 10450
5262         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5263         constructor.  Add global_offset_table_ field.
5264         (Target_i386::got_section): Set global_offset_table_.
5265         (Target_i386::do_finalize_sections): Set global_offset_table_
5266         size.
5267         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5268         in constructor.  Add global_offset_table_ field.
5269         (Target_x86_64::got_section): Set global_offset_table_.
5270         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5271         size.
5272
5273         * layout.cc (Layout::Layout): Initialize increase_relro_.
5274         (Layout::get_output_section): Add is_relro, is_last_relro, and
5275         is_first_non_relro parameters.  Change all callers.
5276         (Layout::choose_output_section): Likewise.
5277         (Layout::add_output_section_data): Likewise.
5278         (Layout::make_output_section): Likewise.
5279         (Layout::set_segment_offsets): Clear increase_relro when using a
5280         linker script.
5281         * layout.h (class Layout): Add increase_relro method.  Add
5282         increase_relro_ field.  Update declarations.
5283         * output.cc (Output_section::Output_section): Initialize
5284         is_last_relro_ and is_first_non_relro_.
5285         (Output_segment::add_output_section): Group relro sections is
5286         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5287         (Output_segment::maximum_alignment): Remove relro handling.
5288         (Output_segment::set_section_addresses): Add increase_relro
5289         parameter.  Change all callers.  Add initial alignment to align
5290         relro sections on separate page.  Remove old relro handling.
5291         (Output_segment::set_section_list_addresses): Remove in_relro
5292         parameter.  Change all callers.
5293         (Output_segment::set_offset): Add increase parameter.  Change all
5294         callers.  Remove old relro handling.
5295         * output.h (class Output_section): Add new methods: is_last_relro,
5296         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5297         Add is_last_relro_ and is_first_non_relro_ fields.
5298         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5299         Create separate .got.plt section.  Call increase_relro.
5300         * x86_64.cc (Target_x86_64::got_section): Likewise.
5301         * testsuite/relro_script_test.t: Add .got.plt.
5302
5303         PR 10450
5304         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5305         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5306         (Layout::finalize): Call set_dynamic_symbol_size.
5307         (Layout::set_dynamic_symbol_size): New function.
5308         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5309         set_dynamic_symbol_size.
5310
5311         PR 10450
5312         * output.h (class Output_section): Add is_entsize_zero_ field.
5313         * output.cc (Output_section::Output_section): Initialize
5314         is_entsize_zero_.
5315         (Output_section::set_entsize): If two different entsizes are
5316         requested, force it to zero.
5317         (Output_section::add_input_section): Set flags for .debug_str
5318         before updating section flags.  Set entsize.
5319         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5320         and SHF_STRING if all input sections have those flags.
5321
5322 2009-12-29   Rafael Espindola  <espindola@google.com>
5323
5324         * main.cc (main): Fix the sys time reporting.
5325         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5326         reporting.
5327
5328 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5329
5330         * options.cc (General_options::parse_version): Allow -v to exit
5331         without an error if there is nothing to link.
5332
5333 2009-12-29  Ian Lance Taylor  <iant@google.com>
5334
5335         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5336         using a version of gcc before 4.1.
5337         * configure: Rebuild.
5338
5339 2009-12-28  Chris Demetriou  <cgd@google.com>
5340
5341         * attributes.cc (Output_attributes_section_data::do_write): Use
5342         std::vector::front rather than std::vector::data.
5343
5344 2009-12-28  Ian Lance Taylor  <iant@google.com>
5345
5346         * symtab.h (class Symbol_table): Add enum Defined.
5347         * resolve.cc (Symbol_table::should_override): Add defined
5348         parameter.  Change all callers.  Test whether object is NULL
5349         before calling a method on it.
5350         (Symbol_table::report_resolve_problem): Add defined parameter.
5351         Change all callers.
5352         (Symbol_table::should_override_with_special): Likewise.
5353         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5354         parameter.  Change all callers.
5355         (Symbol_table::do_define_in_output_data): Likewise.
5356         (Symbol_table::define_in_output_segment): Likewise.
5357         (Symbol_table::do_define_in_output_segment): Likewise.
5358         (Symbol_table::define_as_constant): Likewise.
5359         (Symbol_table::do_define_as_constant): Likewise.
5360         * script.h (class Symbol_assignment): Add is_defsym parameter to
5361         constructor; change all callers.
5362         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5363         parameter.  Change all callers.  Add is_defsym_ field.
5364         (class Parser_closure): Add parsing_defsym parameter to
5365         constructor; change all callers.  Add parsing_defsym accessor
5366         function.  Add parsing_defsym_ field.
5367
5368 2009-12-28  Ian Lance Taylor  <iant@google.com>
5369
5370         * gold.cc (queue_middle_tasks): Fix formatting.
5371         * object.cc (Relobj::is_section_name_included): Likewise.
5372
5373 2009-12-23  Ian Lance Taylor  <iant@google.com>
5374
5375         * i386.cc (Target_i386::do_calls_non_split): Recognize
5376         -fsplit-stack prologue for a function with a static chain.
5377         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5378         -fsplit-stack prologue when using %r11.
5379
5380 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5381
5382         * options.cc (General_options::parse_version): Make -v continue and do
5383         the link like GNU ld does.
5384
5385 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5386
5387         * Makefile.am (CCFILES): Add timer.cc.
5388         (HFILES): Add timer.h.
5389         * configure.ac: Check for sysconf and times.
5390         * main.cc: include timer.h.
5391         (main): Use Timer instead of get_run_time.
5392         * timer.cc: New.
5393         * timer.h: New.
5394         * workqueue.cc: include timer.h.
5395         (Workqueue::find_and_run_task):
5396         Report user, sys and wall time.
5397         * Makefile.in: Regenerate.
5398         * config.in: Regenerate.
5399         * configure: Regenerate.
5400
5401 2009-12-16  Doug Kwan  <dougkwan@google.com>
5402
5403         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5404         sections.
5405         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5406         relaxed input sections.
5407         * output.cc (Output_section::find_relaxed_input_section): Change
5408         return type to Output_relaxed_input_section pointer.  Adjust code
5409         for new type of relaxed_input_section_map_.
5410         * output.h (Output_section::find_relaxed_input_section): Change
5411         return type to Output_relaxed_input_section pointer.
5412         (Output_section::Output_relaxed_input_section_by_input_section_map):
5413         New type.
5414         (Output_section::relaxed_input_section_map_): Change type to
5415         Output_section::Output_relaxed_input_section_by_input_section_map.
5416         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5417         input section.
5418
5419 2009-12-15  Ian Lance Taylor  <iant@google.com>
5420
5421         * layout.cc (Layout::create_shstrtab): Only write out after input
5422         sections if we are compressing debug sections.
5423
5424 2009-12-15  Ian Lance Taylor  <iant@google.com>
5425
5426         * archive.cc (Archive::add_symbols): Only look up a symbol without
5427         a version if there is, in fact, a version.
5428
5429 2009-12-14  Ian Lance Taylor  <iant@google.com>
5430
5431         Revert -Wshadow changes, all changes from:
5432         2009-12-11  Doug Kwan  <dougkwan@google.com>
5433         2009-12-11  Nick Clifton  <nickc@redhat.com>
5434         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5435
5436 2009-12-11  Doug Kwan  <dougkwan@google.com>
5437
5438         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5439         due to -Wshadow.
5440         * attributes.cc (Object_attribute::size): Ditto.
5441         (Attributes_section_data::size): Ditto.
5442         (Attributes_section_data::Attributes_section_data): Ditto.
5443         (Output_attributes_section_data::do_write): Ditto.
5444         * attributes.h (Object_attribute::set_type): Ditto.
5445         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5446
5447 2009-12-11  Nick Clifton  <nickc@redhat.com>
5448
5449         * archive.cc: Fix shadowed variable warnings.
5450         * arm.cc: Likewise.
5451         * compressed_output.cc: Likewise.
5452         * compressed_output.h: Likewise.
5453         * configure: Likewise.
5454         * dwarf_reader.cc: Likewise.
5455         * dynobj.cc: Likewise.
5456         * dynobj.h: Likewise.
5457         * ehframe.cc: Likewise.
5458         * ehframe.h: Likewise.
5459         * errors.cc: Likewise.
5460         * expression.cc: Likewise.
5461         * fileread.cc: Likewise.
5462         * fileread.h: Likewise.
5463         * freebsd.h: Likewise.
5464         * i386.cc: Likewise.
5465         * icf.cc: Likewise.
5466         * incremental.h: Likewise.
5467         * layout.cc: Likewise.
5468         * layout.h: Likewise.
5469         * mapfile.cc: Likewise.
5470         * merge.cc: Likewise.
5471         * merge.h: Likewise.
5472         * object.cc: Likewise.
5473         * object.h: Likewise.
5474         * options.h: Likewise.
5475         * output.cc: Likewise.
5476         * output.h: Likewise.
5477         * parameters.cc: Likewise.
5478         * plugin.cc: Likewise.
5479         * powerpc.cc: Likewise.
5480         * reduced_debug_output.cc: Likewise.
5481         * reduced_debug_output.h: Likewise.
5482         * reloc.cc: Likewise.
5483         * reloc.h: Likewise.
5484         * resolve.cc: Likewise.
5485         * script-sections.cc: Likewise.
5486         * script.cc: Likewise.
5487         * script.h: Likewise.
5488         * sparc.cc: Likewise.
5489         * symtab.cc: Likewise.
5490         * symtab.h: Likewise.
5491         * target-select.cc: Likewise.
5492         * target-select.h: Likewise.
5493         * token.h: Likewise.
5494         * workqueue.cc: Likewise.
5495         * workqueue.h: Likewise.
5496         * x86_64.cc: Likewise.
5497
5498 2009-12-10  Doug Kwan  <dougkwan@google.com>
5499
5500         * arm.cc (attributes.h): New include.
5501         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5502         (Arm_relobj::~Arm_relobj): Delete object pointed by
5503         attributes_section_data_.
5504         (Arm_relobj::attributes_section_data): New method definition.
5505         (Arm_relobj::attributes_section_data_): New data member declaration.
5506         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5507         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5508         attributes_section_data_.
5509         (Arm_dynobj::attributes_section_data): New method definition.
5510         (Arm_dynobj::attributes_section_data_): New data member declaration.
5511         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5512         initialization value of may_use_blx_ to false.
5513         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5514         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5515         object attributes to compute results instead of hard-coding.
5516         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5517         Target_arm::get_secondary_compatible_arch,
5518         Target_arm::set_secondary_compatible_arch
5519         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5520         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5521         New method declarations.
5522         (Target_arm::get_aeabi_object_attribute): New method definition.
5523         (Target_arm::attributes_section_data_): New data member declaration.
5524         (read_arm_attributes_section): New template definition.
5525         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5526         (Arm_dynobj::do_read_symbols): Ditto.
5527         (Target_arm::do_finalize_sections): Merge attributes sections from
5528         input.  Check for BLX use after attributes section merging.
5529         Fix __exidx_start and __exidx_end visibility.  Create an
5530         .ARM.attributes section if necessary.
5531         (Target_arm::get_secondary_compatible_arch,
5532         Target_arm::set_secondary_compatible_arch,
5533         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5534         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5535         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5536         New method definitions.
5537
5538 2009-12-09  Ian Lance Taylor  <iant@google.com>
5539
5540         * plugin.cc (Plugin::load): Don't cast from void* to a function
5541         pointer.
5542
5543 2009-12-09  Ian Lance Taylor  <iant@google.com>
5544
5545         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5546         information fields.
5547
5548 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5549
5550         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5551         Replace two_file_shared_1.so with two_file_shared_2.so.
5552         * testsuite/Makefile.in: Regenerated.
5553
5554 2009-12-08  Doug Kwan  <dougkwan@google.com>
5555
5556         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5557         (HFILES): Add attributes.h and int_encoding.h.
5558         * Makefile.in: Regenerate.
5559         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5560         function definitions to int_encoding.cc
5561         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5562         prototypes to int_encoding.h
5563         * reduced_debug_output.cc (int_encoding.h): New include.
5564         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5565         function definitions to int_encoding.cc
5566         (insert_into_vector, read_from_pointer): Move template definitions to
5567         int_encoding.h
5568         * attributes.cc: New file.
5569         * attributes.h: New file.
5570         * int_encoding.cc: New file.
5571         * int_encoding.h: New file.
5572
5573 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5574
5575         PR gold/11055
5576         * incremental-dump.cc (dump_incremental_inputs): New.
5577         (main): Use dump_incremental_inputs.
5578
5579 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5580
5581         PR gold/10893
5582         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5583         checking elfcpp::STT_FUNC.
5584         (Target_i386::Relocate::relocate): Likewise.
5585         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5586
5587         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5588         symbols from shared libraries into normal FUNC symbols.
5589
5590         * symtab.h (Symbol): Add is_func and use it.
5591
5592 2009-12-05  Doug Kwan  <dougkwan@google.com>
5593
5594         * arm.cc (Target_arm::arm_info): Initialize new fields
5595         attributes_section and attributes_vendor.
5596         * i386.cc (Target_i386::i386_info): Same.
5597         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5598         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5599         fields attributes_section and attributes_vendor.
5600         * sparc.cc (Target_sparc::sparc_info): Same.
5601         * target.h (Target::attributes_section, Target::attributes_vendor,
5602         Target::is_attributes_section, Target::attribute_arg_type,
5603         Target::attributes_order): New method definitions.
5604         (Target::Target_info::attributes_section,
5605         Target::Target_info::attributes_vendor): New fields.
5606         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5607         virtual method definitions.
5608         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5609         attributes_section and attributes_vendor.
5610         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5611
5612 2009-12-05  Doug Kwan  <dougkwan@google.com>
5613
5614         * arm.cc: Update comments about interworking and stub generation.
5615         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5616         considered as non-PIC.
5617         (Arm_relocate_functions::base_abs): Fix formatting.
5618         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5619         of function to use GOT entry address instead of offset.
5620         (Target_arm::Scan::global): Issue an error if a symbol would need a
5621         PLT does not get one because it is untyped.  Remove code to create
5622         dynamic symbols for relative branches.
5623         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5624         takes unsigned integer instead of boolean.
5625
5626 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5627
5628         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5629         (two_file_test_LDADD): Likewise.
5630         (common_test_1_LDADD): Likewise.
5631         (exception_test_LDADD) Likewise.
5632         (weak_test_LDADD): Likewise.
5633         (many_sections_test_LDADD): Likewise.
5634         (initpri1_LDADD): Likewise.
5635         (script_test_1_LDADD): Likewise.
5636         (script_test_2_LDADD): Likewise.
5637         (justsyms_LDADD): Likewise.
5638         (binary_test_LDADD): Likewise.
5639         (large_LDADD): Likewise.
5640         * testsuite/Makefile.in: Regenerated.
5641
5642 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5643
5644         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5645         (Symbol_table::override_with_special): Likewise.
5646         (Symbol_table::add_from_object): Likewise.
5647
5648 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5649
5650         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5651         Don't set the data_offset twice.
5652
5653 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5654
5655         * testsuite/Makefile.in: Regenerate.
5656
5657 2009-12-03  Doug Kwan  <dougkwan@google.com>
5658
5659         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5660         (Target_arm::do_finalize_sections): Add parameter for symbol table
5661         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5662         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5663         parameter for symbol table pointer.
5664         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5665         an additional parameter for a pointer to symbol table.
5666         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5667         parameter for a symbol table pointer.
5668         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5669         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5670         Ditto.
5671         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5672         parameter for a symbol table pointer.
5673
5674 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5675
5676         * incremental.cc (Incremental_inputs_header)
5677         (Incremental_inputs_header_write, Incremental_inputs_entry)
5678         (Incremental_inputs_entry_write): Move ...
5679         * incremental.h (Incremental_inputs_header)
5680         (Incremental_inputs_header_write, Incremental_inputs_entry)
5681         (Incremental_inputs_entry_write): here.
5682
5683 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5684
5685         * incremental.cc (make_sized_incremental_binary): Set the target.
5686         Error if it is incompatible.
5687         * output.h (Output_file): Add filename method.
5688
5689 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5690
5691         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5692         from the get_* methods.
5693
5694 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5695
5696         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5697         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5698         Write 0 for the data_offset of scripts.
5699
5700 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5701
5702         * testsuite/Makefile.am: Add the incremental_test.sh test.
5703         * testsuite/incremental_test.sh: New.
5704         * testsuite/incremental_test_1.c: New.
5705         * testsuite/incremental_test_2.c: New.
5706
5707 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5708
5709        * incremental-dump.cc (main): Fix typos.
5710
5711 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5712
5713         PR gold/11025
5714         * incremental-dump.cc (main): Use llu to print 64 bit values.
5715
5716 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5717             H.J. Lu  <hongjiu.lu@intel.com>
5718
5719         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5720         $(LIBDL).
5721         (incremental_dump_LDADD): Likewise.
5722         * Makefile.in: Regenerated.
5723
5724 2009-11-25  Doug Kwan  <dougkwan@google.com>
5725
5726         Revert:
5727
5728         2009-11-25  Doug Kwan  <dougkwan@google.com>
5729
5730                 * arm.cc (Target_arm::Target_arm): Move method definition
5731                 outside of class definition.  Add code to handle
5732                 --target1-rel, --target1-abs and --target2= options.
5733                 (Target_arm::get_reloc_reloc_type): Change method to be
5734                 non-static and const.
5735                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5736                 New data member declaration.
5737                 (Target_arm::Scan::local, Target_arm::Scan::global,
5738                 Target_arm::Relocate::relocate,
5739                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5740                 Adjust call to Target_arm::get_real_reloc_type.
5741                 (Target_arm::get_real_reloc_type): Use command line options
5742                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5743                 * options.h (--target1-rel, --target1-abs, --target2): New
5744                 ARM-only options.
5745
5746 2009-11-25  Doug Kwan  <dougkwan@google.com>
5747
5748         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5749         class definition.  Add code to handle --target1-rel, --target1-abs
5750         and --target2= options.
5751         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5752         and const.
5753         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5754         member declaration.
5755         (Target_arm::Scan::local, Target_arm::Scan::global,
5756         Target_arm::Relocate::relocate,
5757         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5758         call to Target_arm::get_real_reloc_type.
5759         (Target_arm::get_real_reloc_type): Use command line options to
5760         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5761         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5762         options.
5763
5764 2009-11-25  Doug Kwan  <dougkwan@google.com>
5765
5766         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5767         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5768         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5769         formatting.
5770         (Arm_relocate_functions::thm_call): Replace body with a call to
5771         Arm_relocate_functions::thumb_branch_common.
5772         (Arm_relocate_functions::thm_jump24,
5773         Arm_relocate_functions::thm_xpc22): New method definitions.
5774         (Arm_relocate_functions::thumb_branch_common): New method definition.
5775         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5776         operator.
5777         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5778         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5779
5780 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5781
5782         * Makefile.am: Build incremental-dump
5783         * Makefile.in: Regenerate.
5784         * incremental-dump.cc: New.
5785         * incremental.cc (Incremental_inputs_header_data,
5786         Incremental_inputs_entry_data): Move to incremental.h
5787         * incremental.h: (Incremental_inputs_header_data,
5788         Incremental_inputs_entry_data): Move from incremental.cc
5789
5790 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5791
5792         * incremental.cc (Incremental_inputs_header,
5793         Incremental_inputs_header_write, Incremental_inputs_entry,
5794         Incremental_inputs_entry_write): Add a typedef with the data type.
5795
5796 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5797
5798         * incremental.cc (Incremental_inputs_header,
5799         Incremental_inputs_header_write, Incremental_inputs_entry,
5800         Incremental_inputs_entry_write): Update comment about which
5801         type has the filed descriptions.
5802
5803 2009-11-15  Doug Kwan  <dougkwan@google.com>
5804
5805         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5806         (Arm_relocate_functions::arm_branch_common): Change method defintion
5807         in class definition to a method declaration and update list of formal
5808         parameters.
5809         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5810         Arm_relocation_functions::jump24): Adjust call to
5811         Arm_relocate_functions::arm_branch_common.  Update list of formal
5812         parameters.
5813         (Arm_relocate_functions::xpc25): New method definition.
5814         (Arm_relocate_functions::arm_branch_common): Move method defintion
5815         out from class definition.  Use stubs for mode-switching and extending
5816         branch ranges.
5817         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5818         specially.  Change code to enable use of stubs in ARM branches.
5819
5820 2009-11-10  Doug Kwan  <dougkwan@google.com>
5821
5822         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5823         in method declaration.
5824         (Target_arm::relocate_stub): New method declaration.
5825         (Target_arm::default_target): Change to return a pointer instead of
5826         a const reference.
5827         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5828         Target_arm::default_target.
5829         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5830         method definition.
5831         (Target_arm::relocate_section): Adjust view.
5832         (Target_arm::relocate_stub): New method definition.
5833
5834 2009-11-10  Doug Kwan  <dougkwan@google.com>
5835
5836         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5837         a format warning.
5838         * incremental.cc (open_incremental_binary): Initialized local
5839         variables to avoid warnings.
5840         * object.cc (make_elf_object): Ditto.
5841         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5842         a format warning.
5843
5844 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5845
5846         PR gold/10930
5847         * testsuite/plugin_test.c: Include "config.h".
5848
5849 2009-11-09  Doug Kwan  <dougkwan@google.com>
5850
5851         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5852         (arm_symbol_value): Remove.
5853         (Arm_relocate_functions::arm_branch_common,
5854         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5855         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5856         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5857         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5858         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5859         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5860         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5861         Arm_relocate_functions::thm_mobw_abs_nc,
5862         Arm_relocate_functions::thm_mov_abs,
5863         Arm_relocate_functions::movw_prel_nc,
5864         Arm_relocate_functions::thm_movt_abs,
5865         Arm_relocate_functions::movt_prel,
5866         Arm_relocate_functions::thm_movw_prel_nc,
5867         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5868         (Target_arm::Relocate::relocate): Only decompose address into two
5869         parts if relocation type uses the thumb-bit and pass the actual
5870         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5871         calls to methods in Arm_relocate_functions for this change.
5872
5873 2009-11-08  Ian Lance Taylor  <iant@google.com>
5874
5875         PR 10925
5876         * reloc.cc: Instantiate
5877         Sized_relobj::initialize_input_to_output_maps and
5878         Sized_relobj:free_input_to_output_maps.
5879
5880 2009-11-06  Ian Lance Taylor  <iant@google.com>
5881
5882         PR 10876
5883         * defstd.cc (in_segment): Set only_if_ref true for "end".
5884
5885 2009-11-06  Doug Kwan  <dougkwan@google.com>
5886
5887         * arm.cc (class Reloc_stub): Correct a comment.
5888         (Target_arm::Target_arm): Initialize arm_input_section_map_.
5889         (Target_arm::scan_section_for_stubs): New method declaration.
5890         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5891         Change methods from private to protected.
5892         (Target_arm::do_may_relax): New method definition.
5893         (Target_arm::do_relax, Target_arm::group_sections,
5894         Target_arm::scan_reloc_for_stub,
5895         Target_arm::scan_reloc_section_for_stubs): New method declarations.
5896         (Target_arm::arm_input_section_map_): New data member declaration.
5897         (Target_arm::scan_reloc_for_stub,
5898         Target_arm::scan_reloc_section_for_stubs,
5899         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5900         Target_arm::do_relax): New method definitions.
5901
5902 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
5903
5904         * configure.ac: Check for (struct stat)::st_mtim
5905         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5906         * config.in: Regenerate.
5907         * configure: Regenerate.
5908
5909 2009-11-05  Ian Lance Taylor  <iant@google.com>
5910
5911         PR 10910
5912         * output.cc (Output_segment::add_output_section): Add missing
5913         return statement.
5914
5915 2009-11-04  Ian Lance Taylor  <iant@google.com>
5916
5917         PR 10880
5918         * object.h (class Object): Add is_needed and set_is_needed
5919         methods.  Add is_needed_ field.  Make bool fields into bitfields.
5920         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5921         defined in a dynamic object and referenced by a regular object,
5922         set is_needed for the dynamic object.
5923         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5924         if the file is marked with as_needed and it is not needed.
5925
5926 2009-11-04  Ian Lance Taylor  <iant@google.com>
5927
5928         PR 10887
5929         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5930         tags if data is discarded by linker script.
5931         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5932         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5933         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5934         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5935
5936 2009-11-04  Ian Lance Taylor  <iant@google.com>
5937
5938         * layout.cc (Layout::get_output_section): Add is_interp and
5939         is_dynamic_linker_section parameters.  Change all callers.
5940         (Layout::choose_output_section): Likewise.
5941         (Layout::make_output_section): Likewise.
5942         (Layout::add_output_section_data): Add is_dynamic_linker_section
5943         parameter.  Change all callers.
5944         * layout.h (class Layout): Update declarations.
5945         * output.h (class Output_section): Add is_interp, set_is_interp,
5946         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5947         Add is_interp_, is_dynamic_linker_section_ fields.  Change
5948         generate_code_fills_at_write_ to a bitfield.
5949         * output.cc (Output_section::Output_sections): Initialize new
5950         fields.
5951         (Output_segment::add_output_section): Add do_sort parameter.
5952         Change all callers.
5953
5954 2009-11-03  Ian Lance Taylor  <iant@google.com>
5955
5956         PR 10860
5957         * options.h (class General_options): Add --warn-common.
5958         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5959         merging two common symbols.
5960         (Symbol_table::should_override): Handle --warn-common when merging
5961         a common symbol with a defined symbol.  Use report_resolve_problem
5962         for multiple definitions.
5963         (Symbol_table::report_resolve_problem): New function.
5964         * symtab.h (class Symbol_table): Declare report_resolve_problem.
5965
5966 2009-11-03  Doug Kwan  <dougkwan@google.com>
5967
5968         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5969         stub_factory_.
5970         (Target_arm::stub_factory): New method definition.
5971         (Target_arm::new_arm_input_section,
5972         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5973         Target_arm::reloc_uses_thumb_bit): New method declarations.
5974         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5975         New type definitions.
5976         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5977         member declarations.
5978         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5979         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5980         New method definitions.
5981
5982 2009-11-03  Ian Lance Taylor  <iant@google.com>
5983
5984         * options.h (class General_options): Add --warn_constructors.
5985
5986 2009-11-03  Ian Lance Taylor  <iant@google.com>
5987
5988         PR 10893
5989         * defstd.cc (in_section): Add entries for __rel_iplt_start,
5990         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5991
5992 2009-11-03  Ian Lance Taylor  <iant@google.com>
5993
5994         PR 10895
5995         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5996         --msgid-bugs-address.
5997         (install-pdf): New target.
5998         (install-data_yes): Look up one directory to find mkinstalldirs.
5999
6000 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
6001
6002         * po/Make-in (.po.gmo): Don't generate .gmo files in source
6003         tree.
6004
6005 2009-10-30  Doug Kwan  <dougkwan@google.com>
6006
6007         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6008
6009 2009-10-30  Doug Kwan  <dougkwan@google.com>
6010
6011         * arm.cc (Stub_addend_reader): New struct template definition
6012         and partial specializations.
6013         (Stub_addend_reader::operator()): New method definition for a
6014         partially specialized template.
6015
6016 2009-10-30  Doug Kwan  <dougkwan@google.com>
6017
6018         * arm.cc (Arm_relobj::processor_specific_flags): New method
6019         definition.
6020         (Arm_relobj::do_read_symbols): New method declaration.
6021         (Arm_relobj::processor_specific_flags_): New data member declaration.
6022         (Arm_dynobj): New class definition.
6023         (Target_arm::do_finalize_sections): Add input_objects parameter.
6024         (Target_arm::do_adjust_elf_header): New method declaration.
6025         (Target_arm::are_eabi_versions_compatible,
6026         (Target_arm::merge_processor_specific_flags): New method declaration.
6027         (Target_arm::do_make_elf_object): New overloaded method definitions
6028         and declaration.
6029         (Arm_relobj::do_read_symbols): New method definition.
6030         (Arm_dynobj::do_read_symbols): Ditto.
6031         (Target_arm::do_finalize_sections): Add input_objects parameters.
6032         Merge processor-specific flags from all input objects.
6033         (Target_arm::are_eabi_versions_compatible,
6034         Target_arm::merge_processor_specific_flags,
6035         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6036         New method definitions.
6037         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6038         Input_objects pointer type parameter.
6039         * layout.cc (Layout::finalize): Pass input objects to target's.
6040         finalize_sections function.
6041         * output.cc (Output_file_header::do_sized_write): Set ELF file
6042         header's processor-specific flags.
6043         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6044         Input_objects pointer type parameter.
6045         * sparc.cc (Target_sparc::do_finalize_sections): Same.
6046         * target.h (Input_objects): New forward class declaration.
6047         (Target::processor_specific_flags,
6048         Target::are_processor_specific_flags_sect): New method definitions.
6049         (Target::finalize_sections): Add input_objects parameter.
6050         (Target::Target): Initialize processor_specific_flags_ and
6051         are_processor_specific_flags_set_.
6052         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6053         parameter.
6054         (Target::set_processor_specific_flags): New method definition.
6055         (Target::processor_specific_flags_,
6056         Target::are_processor_specific_flags_set_): New data member
6057         declarations.
6058         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6059         Input_objects pointer type parameter.
6060
6061 2009-10-30  Doug Kwan  <dougkwan@google.com>
6062
6063         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6064
6065 2009-10-28  Ian Lance Taylor  <iant@google.com>
6066
6067         * object.h (class Relobj): Drop options parameter from
6068         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6069         do_scan_relocs, do_relocate.  Change all callers.
6070         (class Sized_relobj): Drop options parameters from
6071         do_gc_process_relocs, do_scan_relocs, do_relocate,
6072         do_relocate_sections, relocate_sections, emit_relocs_scan,
6073         emit_relocs_scan_reltype.  Change all callers.
6074         (struct Relocate_info): Remove options field and all references to
6075         it.
6076         * reloc.h (class Read_relocs): Remove options constructor
6077         parameter and options_ field.  Change all callers.
6078         (class Gc_process_relocs, class Scan_relocs): Likewise.
6079         (class Relocate_task): Likewise.
6080         * target-reloc.h (scan_relocs): Remove options parameter.  Change
6081         all callers.
6082         (scan_relocatable_relocs): Likewise.
6083         * target.h (class Sized_target): Remove options parameter from
6084         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
6085         all callers.
6086         * gc.h (gc_process_relocs): Remove options parameter.  Change all
6087         callers.
6088         * arm.cc: Update functions to remove options parameters.
6089         * i386.cc: Likewise.
6090         * powerpc.cc: Likewise.
6091         * sparc.cc: Likewise.
6092         * x86_64.cc: Likewise.
6093         * testsuite/testfile.cc: Likewise.
6094
6095 2009-10-28  Doug Kwan  <dougkwan@google.com>
6096
6097         * arm.cc (Arm_relobj): New class definition.
6098         (Arm_relobj::scan_sections_for_stubs,
6099         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6100         New method definitions.
6101
6102 2009-10-28  Cary Coutant  <ccoutant@google.com>
6103
6104         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6105         (Plugin::cleanup_done_): New member.
6106         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6107         (Plugin_manager::cleanup_done_): Remove.
6108         (Plugin_manager::add_input_file): Edit error message.
6109         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6110         (Plugin_manager::cleanup): Remove use of cleanup_done_.
6111
6112 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
6113
6114         * fileread.cc: (File_read::View::~View): Use the new
6115         data_ownership_ filed.
6116         (File_read::~File_read): Dispose the new whole_file_view_.
6117         (File_read::open): Mmap the whole file if needed.
6118         (File_read::open): Use whole_file_view_ instead of contents_.
6119         (File_read::find_view): Use whole_file_view_ if applicable.
6120         (File_read::do_read): Use whole_file_view_ instead of contents_.
6121         (File_read::make_view): Use whole_file_view_ instead of contents_,
6122         update File_read::View::View call.
6123         (File_read::find_or_make_view): Update File_read::View::View
6124         call.
6125         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6126         remove contents_
6127         (File_read::View::Data_ownership): New enum.
6128         (File_read::View::View): Replace bool mapped_ with Data_ownership
6129         argument.
6130         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6131         (File_read::View::data_ownership_): New field.
6132         (File_read::contents_): Remove (replaced by whole_file_view_).
6133         (File_read::whole_file_view_): New field.
6134         * options.h (class General_options): Add --keep-files-mapped.
6135
6136 2009-10-27  Cary Coutant  <ccoutant@google.com>
6137
6138         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6139         * testsuite/Makefile.am (plugin_test_5): New test case.
6140         * testsuite/Makefile.in: Regenerate.
6141
6142 2009-10-25  Doug Kwan  <dougkwan@google.com>
6143
6144         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6145         from private to protected to allow access by child class.
6146         (Sized_relobj::do_relocate_sections): New method declaration.
6147         (Sized_relobj::relocate_sections): Virtualize.
6148         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6149         Sized_relobj::relocate_sections.  Instantiate template explicitly
6150         for different target sizes and endianity.
6151
6152 2009-10-24  Doug Kwan  <dougkwan@google.com>
6153
6154         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6155         (Arm_input_section::as_arm_input_section): New method.
6156         (Arm_output_section): New class definition.
6157         (Arm_output_section::create_stub_group,
6158         Arm_output_section::group_sections): New method definitions.
6159
6160 2009-10-22  Doug Kwan  <dougkwan@google.com>
6161
6162         * arm.cc (Arm_input_section): New class definition.
6163         (Arm_input_section::init, Arm_input_section:do_write,
6164         Arm_input_section::set_final_data_size,
6165         Arm_input_section::do_reset_address_and_file_offset): New method
6166         definitions.
6167
6168 2009-10-21  Doug Kwan  <dougkwan@google.com>
6169
6170         * arm.cc (Stub_table, Arm_input_section): New forward class
6171         declarations.
6172         (Stub_table): New class defintion.
6173         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6174         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6175         New method definition.
6176
6177 2009-10-21  Doug Kwan  <dougkwan@google.com>
6178
6179         * arm.cc: Update copyright comments.
6180         (Target_arm): New forward class template declaration.
6181         (Arm_address): New type.
6182         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6183         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6184         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6185         constants.
6186         (Insn_template): Same.
6187         (DEF_STUBS): New macro.
6188         (Stub_type): New enum type.
6189         (Stub_template): New class definition.
6190         (Stub): Same.
6191         (Reloc_stub): Same.
6192         (Stub_factory): Same.
6193         (Target_arm::Target_arm): Initialize may_use_blx_ and
6194         should_force_pic_veneer_.
6195         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6196         Target_arm::should_force_pic_veneer,
6197         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6198         Target_arm::using_thumb_only, Target_arm:;default_target): New
6199         method defintions.
6200         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6201         New data member declarations.
6202         (Insn_template::size, Insn_template::alignment): New method defintions.
6203         (Stub_template::Stub_template): New method definition.
6204         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6205         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6206         (Stub_factory::Stub_factory): New method definition.
6207         * gold.h (string_hash): New template.
6208         * output.h (Input_section_specifier::hash_value): Use
6209         gold::string_hash.
6210         (Input_section_specifier::string_hash): Remove.
6211         * stringpool.cc (Stringpool_template::string_hash): Use
6212         gold::string_hash.
6213
6214 2009-10-20  Doug Kwan  <dougkwan@google.com>
6215
6216         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6217         symbols of relaxed input sections.
6218         * output.h (Output_section::find_relaxed_input_section): Make
6219         method public.
6220
6221 2009-10-16  Doug Kwan  <dougkwan@google.com>
6222
6223         * dynobj.cc (Versions::Versions): Initialize version_script_.
6224         Only insert base version symbol definition for a shared object
6225         if version script defines any version versions.
6226         (Versions::define_base_version): New method definition.
6227         (Versions::add_def): Check that base version is not needed.
6228         (Versions::add_need): Define base version lazily.
6229         * dynobj.h (Versions::define_base_version): New method declaration.
6230         (Versions::needs_base_version_): New data member declaration.
6231         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6232         (check_DATA): Add no_version_test.stdout.
6233         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6234         New make rules.
6235         * testsuite/Makefile.in: Regenerate.
6236         * testsuite/no_version_test.c: New file.
6237         * testsuite/no_version_test.sh: Ditto.
6238
6239 2009-10-16  Doug Kwan  <dougkwan@google.com>
6240
6241         * expression.cc (class Segment_start_expression): New class definition.
6242         (Segment_start_expression::value): New method definition.
6243         (script_exp_function_segment_start): Return a new
6244         Segment_start_expression.
6245         * gold/script-c.h (script_saw_segment_start_expression): New function
6246         prototype.
6247         * script-sections.cc (Script_sections::Script_sections): Initialize
6248         SAW_SEGMENT_START_EXPRESSION_ to false.
6249         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6250         and -Tbbs options to specify section addresses if given in
6251         command line and no SEGMENT_START expression is seen in a script.
6252         * script-sections.h (Script_sections::saw_segment_start_expression,
6253         Script_sections::set_saw_segment_start_expression): New method
6254         definition.
6255         (Script_sections::saw_segment_start_expression_): New data member
6256         declaration.
6257         * script.cc (script_saw_segment_start_expression): New function.
6258         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6259         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6260         script_test_7.sh and script_test_8.sh.
6261         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6262         script_test_8.stdout.
6263         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6264         (script_test_6, script_test_6.stdout, script_test_7,
6265         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6266         * Makefile.in: Regenerate.
6267         * testsuite/script_test_6.sh: New file.
6268         * testsuite/script_test_6.t: Same.
6269         * testsuite/script_test_7.sh: Same.
6270         * testsuite/script_test_7.t: Same.
6271         * testsuite/script_test_8.sh: Same.
6272
6273 2009-10-16  Doug Kwan  <dougkwan@google.com>
6274
6275         * output.cc (Output_segment::set_section_list_address): Cast
6276         expressions to unsigned long long type to avoid format warnings.
6277
6278 2009-10-15  Ian Lance Taylor  <iant@google.com>
6279
6280         * script.cc (Script_options::add_symbol_assignment): Always add a
6281         dot assignment to script_sections_.
6282         * script-sections.cc (Script_sections::add_dot_assignment):
6283         Initialize if necessary.
6284
6285         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6286         program headers with no load segment if there is a linker script.
6287
6288         * layout.cc (Layout::set_segment_offsets): Align the file offset
6289         to the segment aligment for -N or -n with no load segment.
6290         * output.cc (Output_segment::add_output_section): Don't crash if
6291         the first section is a TLS section.
6292         (Output_segment::set_section_list_addresses): Print an error
6293         message if the address moves backward in a linker script.
6294         * script-sections.cc
6295         (Output_section_element_input::set_section_addresses): Don't
6296         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6297         (Orphan_output_section::set_section_addresses): Likewise.
6298
6299 2009-10-15  Doug Kwan  <dougkwan@google.com>
6300
6301         * layout.cc (Layout::finish_dynamic_section): Generate tags
6302         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6303         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6304         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6305
6306 2009-10-14  Ian Lance Taylor  <iant@google.com>
6307
6308         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6309         fields.
6310         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6311         data_shdr fields of relinfo.
6312         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6313         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6314         R_386_TLS_LDO_32, adjust based on section flags.
6315         (Target_i386::Relocate::fix_up_ldo): Remove.
6316
6317 2009-10-13  Ian Lance Taylor  <iant@google.com>
6318
6319         Add support for -pie.
6320         * options.h (class General_options): Add -pie and
6321         --pic-executable.
6322         (General_options::output_is_position_independent): Test -pie.
6323         (General_options::output_is_executable): Return true if not shared
6324         and not relocatable.
6325         (General_options::output_is_pie): Remove.
6326         * options.cc (General_options::finalize): Reject incompatible uses
6327         of -pie.
6328         * gold.cc (queue_middle_tasks): A -pie link is not static.
6329         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6330         * symtab.cc (Symbol::final_value_is_known): Return false if
6331         output_is_position_independent.
6332         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6333         output_is_position_independent.
6334         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6335         output_is_position_independent.
6336         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6337         output_is_position_independent.
6338         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6339         two_file_pie_test.
6340         (basic_pie_test.o, basic_pie_test): New targets.
6341         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6342         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6343         (two_file_pie_test): New target.
6344         * testsuite/Makefile.in: Rebuild.
6345         * README: Remove note saying that -pie is not supported.
6346
6347 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6348
6349         * options.h (class General_options): Add -init and -fini.
6350         * layout.cc (Layout::finish_dynamic_section): Emit
6351         given init and fini functions.
6352
6353 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6354
6355         * gc.h (gc_process_relocs): Check if icf is enabled using new
6356         function.
6357         * gold.cc (queue_initial_tasks): Likewise.
6358         (queue_middle_tasks): Likewise.
6359         * object.cc (do_layout): Likewise.
6360         * symtab.cc (is_section_folded): Likewise.
6361         * main.cc (main): Likewise.
6362         * reloc.cc (Read_relocs::run): Likewise.
6363         (Sized_relobj::do_scan_relocs): Likewise.
6364         * icf.cc (is_function_ctor_or_dtor): New function.
6365         (Icf::find_identical_sections): Check if function is ctor or dtor when
6366         safe icf is chosen.
6367         * options.h (General_options::icf): Change option to be an enum.
6368         (Icf_status): New enum.
6369         (icf_enabled): New method.
6370         (icf_safe_folding): New method.
6371         (set_icf_status): New method.
6372         (icf_status_): New variable.
6373         * (options.cc) (General_options::finalize): Set icf_status_.
6374         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6375         icf_test and icf_keep_unique_test to use the --icf enum flag.
6376         * testsuite/icf_safe_test.sh: New file.
6377         * testsuite/icf_safe_test.cc: New file.
6378
6379 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6380
6381         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6382         includes to gc.h and icf.h.
6383         * arm.cc: Include gc.h.
6384         * gold.cc: Likewise.
6385         * i386.cc: Likewise.
6386         * powerpc.cc: Likewise.
6387         * sparc.cc: Likewise.
6388         * x86_64.cc: Likewise.
6389         * gc.h: Include icf.h.
6390
6391 2009-10-11  Ian Lance Taylor  <iant@google.com>
6392
6393         * plugin.cc: Include "gold.h" before other header files.
6394
6395 2009-10-10  Chris Demetriou  <cgd@google.com>
6396
6397         * options.h (Input_file_argument::Input_file_type): New enum.
6398         (Input_file_argument::is_lib_): Replace with...
6399         (Input_file_argument::type_): New member.
6400         (Input_file_argument::Input_file_argument): Take Input_file_type
6401         'type' rather than boolean 'is_lib' as second argument.
6402         (Input_file_argument::is_lib): Use type_.
6403         (Input_file_argument::is_searched_file): New function.
6404         (Input_file_argument::may_need_search): Handle is_searched_file.
6405         * options.cc (General_options::parse_library): Support -l:filename.
6406         (General_options::parse_just_symbols): Update for Input_file_argument
6407         changes.
6408         (Command_line::process): Likewise.
6409         * archive.cc (Archive::get_file_and_offset): Likewise.
6410         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6411         * script.cc (read_script_file, script_add_file): Likewise.
6412         * fileread.cc (Input_file::Input_file): Likewise.
6413         (Input_file::will_search_for): Handle is_searched_file.
6414         (Input_file::open): Likewise.
6415         * readsyms.cc (Read_symbols::get_name): Likewise.
6416         * testsuite/Makefile.am (searched_file_test): New test.
6417         * testsuite/Makefile.in: Regenerate.
6418         * testsuite/searched_file_test.cc: New file.
6419         * testsuite/searched_file_test_lib.cc: New file.
6420
6421 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6422             Ian Lance Taylor  <iant@google.com>
6423
6424         * descriptor.cc: Include <cstdio> and "binary-io.h".
6425         (Descriptors::open): Open the files in binary mode always.
6426         * script.cc (Lex::get_token): Treat \r as whitespace.
6427
6428 2009-10-09  Ian Lance Taylor  <iant@google.com>
6429
6430         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6431
6432 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6433             Ian Lance Taylor  <iant@google.com>
6434
6435         * configure.ac: Check for readv function also.
6436         * fileread.cc (readv): Define if not HAVE_READV.
6437         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6438         does not exist.
6439         * config.in: Regenerate.
6440         * configure: Regenerate.
6441
6442 2009-10-09  Doug Kwan  <dougkwan@google.com>
6443
6444         * layout.cc (Layout::make_output_section): Call target hook to make
6445         ordinary output section.
6446         (Layout::finalize): Adjust parameter list of call the
6447         Target::may_relax().
6448         * layout.h (class Layout::section_list): New method.
6449         * merge.h (Output_merge_base::entsize): Change visibility to public.
6450         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6451         New methods.
6452         (Output_merge_string::do_is_string): New method.
6453         * object.cc (Sized_relobj::do_setup): renamed from
6454         Sized_relobj::set_up.
6455         * object.h (Sized_relobj::adjust_shndx,
6456         Sized_relobj::initializ_input_to_output_maps,
6457         Sized_relobj::free_input_to_output_maps): Change visibilities to
6458         protected.
6459         (Sized_relobj::setup): Virtualize.
6460         (Sized_relobj::do_setup): New method declaration.
6461         (Sized_relobj::invalidate_section_offset,
6462         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6463         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6464         * options.cc (parse_int): New function.
6465         * options.h (parse_int): New declaration.
6466         (DEFINE_int): New macro.
6467         (stub_group_size): New option.
6468         * output.cc (Output_section::Output_section): Initialize memebers
6469         merge_section_map_, merge_section_by_properties_map_,
6470         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6471         (Output_section::add_input_section): Handled deferred code-fill
6472         generation and remove an old comment.
6473         (Output_section::add_relaxed_input_section): New method definition.
6474         (Output_section::add_merge_input_section): Use merge section by
6475         properties map to speed to search.  Update merge section maps
6476         as appropriate.
6477         (Output_section::build_relaxation_map): New method definition.
6478         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6479         Same.
6480         (Output_section::relax_input_section): Renamed to
6481         Output_section::convert_input_sections_to_relaxed_sections and change
6482         interface to take a vector of pointers to relaxed sections.
6483         (Output_section::find_merge_section,
6484         Output_section::find_relaxed_input_section): New method definitions.
6485         (Output_section::is_input_address_mapped,
6486         Output_section::output_offset, Output_section::output_address):
6487         Use output section data maps to speed up searching.
6488         (Output_section::find_starting_output_address): Add comments.
6489         (Output_section::do_write,
6490         Output_section::write_to_postprocessing_buffer): Do code-fill
6491         generation as appropriate.
6492         (Output_section::get_input_sections): Invalidate relaxed input section
6493         map.
6494         (Output_section::restore_states): Adjust type of checkpoint .
6495         Invalidate relaxed input section map.
6496         * output.h (Output_merge_base): New class declaration.
6497         (Input_section_specifier): New class defintion.
6498         (class Output_relaxed_input_section) Change base class to
6499         Output_section_data_build.
6500         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6501         base class initializer.
6502         (Output_section::add_relaxed_input_section): New method declaration.
6503         (Output_section::Input_section): Change visibility to protected.
6504         (Output_section::Input_section::relobj,
6505         Output_section::Input_section::shndx): Handle relaxed input sections.
6506         Output_section::input_sections) Change visibility to protected.  Also
6507         define overload to return a non-const pointer.
6508         (Output_section::Merge_section_properties): New class defintion.
6509         (Output_section::Merge_section_by_properties_map,
6510         Output_section::Output_section_data_by_input_section_map,
6511         Output_section::Relaxation_map): New types.
6512         (Output_section::relax_input_section): Rename method to
6513         Output_section::convert_input_sections_to_relaxed_sections and change
6514         interface to take a vector of relaxed section pointers.
6515         (Output_section::find_merge_section,
6516         Output_section::find_relaxed_input_section,
6517         Output_section::build_relaxation_map,
6518         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6519         New method declarations.
6520         (Output_section::merge_section_map_
6521         Output_section::merge_section_by_properties_map_,
6522         Output_section::relaxed_input_section_map_,
6523         Output_section::is_relaxed_input_section_map_valid_,
6524         Output_section::generate_code_fills_at_write_): New data members.
6525         * script-sections.cc
6526         (Output_section_element_input::set_section_addresses): Call
6527         current_data_size and addralign methods of relaxed input sections.
6528         (Orphan_output_section::set_section_addresses): Call current_data_size
6529         and addralign methods of relaxed input sections.
6530         * symtab.cc (Symbol_table::compute_final_value): Extract template
6531         from the body of Symbol_table::sized_finalize_symbol.
6532         (Symbol_table::sized_finalized_symbol): Call
6533         Symbol_table::compute_final_value.
6534         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6535         (Symbol_table::compute_final_value): New templated method declaration.
6536         * target.cc (Target::do_make_output_section): New method defintion.
6537         * target.h (Target::make_output_section): New method declaration.
6538         (Target::relax): Add more parameters for input objects, symbol table
6539         and layout.  Adjust call to do_relax.
6540         (Target::do_make_output_section): New method declaration.
6541         (Target::do_relax): Add parameters for input objects, symbol table
6542         and layout.
6543
6544 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6545
6546         * pread.c: Include stdio.h.
6547
6548 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6549
6550         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6551         defined.
6552
6553 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6554
6555         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6556         Change read_shndx type to unsigned int.
6557         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6558         int.
6559         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6560         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6561         Change read_shndx type to unsigned int.
6562         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6563         int.
6564         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6565         * layout.cc (Layout::create_symtab_sections): Cast the result of
6566         local_symcount * symsize to off_t in the gold_assert.
6567
6568 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6569
6570         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6571         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6572         R_ARM_BASE_ABS.
6573         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6574         (Arm_relocate_functions::thm_abs5): New function.
6575         (Arm_relocate_functions::abs12): New function.
6576         (Arm_relocate_functions::abs16): New function.
6577         (Arm_relocate_functions::base_abs): New function.
6578         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6579         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6580         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6581         R_ARM_BASE_ABS.
6582         (Scan::global): Likewise.
6583         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6584         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6585         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6586         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6587         R_ARM_BASE_ABS.
6588
6589 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6590
6591         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6592         (Arm_relocate_functions::movt_prel): New function.
6593         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6594         (Arm_relocate_functions::thm_movt_prel): New function.
6595         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6596         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6597         (Scan::global, Relocate::relocate): Likewise.
6598         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6599
6600 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6601
6602         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6603         Incremental_checker.
6604         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6605         unsigned int.
6606         (class Incremental_inputs_header): New class.
6607         (Incremental_inputs_header_writer): Edit comment.
6608         (Incremental_inputs_entry): New class.
6609         (Incremental_inputs_entry_writer): Edit comment.
6610         (Sized_incremental_binary::do_find_incremental_inputs_section):
6611         Add *strtab_shndx parameter, fill it.
6612         (Sized_incremental_binary::do_check_inputs): New method.
6613         (Incremental_checker::can_incrementally_link_output_file): Use
6614         Sized_incremental_binary::check_inputs.
6615         (Incremental_inputs::report_command_line): Save command line in
6616         command_line_.
6617         * incremental.h:
6618         (Incremental_binary::find_incremental_inputs_section): New
6619         method.
6620         (Incremental_binary::do_find_incremental_inputs_section): Add
6621         strtab_shndx parameter.
6622         (Incremental_binary::do_check_inputs): New pure virtual method.
6623         (Sized_incremental_binary::do_check_inputs): Declare.
6624         (Incremental_checker::Incremental_checker): Add incremental_inputs
6625         parameter, use it to initialize incremental_inputs_.
6626         (Incremental_checker::incremental_inputs_): New field.
6627         (Incremental_checker::command_line): New method.
6628         (Incremental_checker::inputs): New method.
6629         (Incremental_checker::command_line_): New field.
6630
6631 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6632
6633         * incremental.cc: Include <cstdarg> and "target-select.h".
6634         (vexplain_no_incremental): New function.
6635         (explain_no_incremental): New function.
6636         (Incremental_binary::error): New method.
6637         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6638         method.
6639         (make_sized_incremental_binary): New function.
6640         (open_incremental_binary): New function.
6641         (can_incrementally_link_file): Add checks if output is ELF and has
6642         inputs section.
6643         * incremental.h: Include "elfcpp_file.h" and "output.h".
6644         (Incremental_binary): New class.
6645         (Sized_incremental_binary): New class.
6646         (open_incremental_binary): Declare.
6647         * object.cc (is_elf_object): Use
6648         elfcpp::Elf_recognizer::is_elf_file.
6649         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6650         * output.h (Output_file::filesize): New method.
6651
6652 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6653
6654         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6655         New function.
6656         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6657         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6658         function.
6659         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6660         function.
6661         (Arm_relocate_functions::movw_abs_nc): New function.
6662         (Arm_relocate_functions::movt_abs): New function.
6663         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6664         (Arm_relocate_functions::thm_movt_abs): New function.
6665         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6666         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6667         (Scan::global): Likewise.
6668         (Relocate::relocate): Likewise.
6669         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6670
6671 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6672
6673         * arm.cc (Arm_relocate_functions::got_prel) New function.
6674         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6675         (Relocate::relocate): Likewise.
6676         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6677
6678 2009-10-06  Ian Lance Taylor  <iant@google.com>
6679
6680         * options.h (class General_options): Define
6681         split_stack_adjust_size parameter.
6682         * object.h (class Object): Add uses_split_stack_ and
6683         has_no_split_stack_ fields.  Add uses_split_stack and
6684         has_no_split_stack accessor functions.  Declare
6685         handle_split_stack_section.
6686         (class Reloc_symbol_changes): Define.
6687         (class Sized_relobj): Define Function_offsets.  Declare
6688         split_stack_adjust, split_stack_adjust_reltype, and
6689         find_functions.
6690         * object.cc (Object::handle_split_stack_section): New function.
6691         (Sized_relobj::do_layout): Call handle_split_stack_section.
6692         * dynobj.cc (Sized_dynobj::do_layout): Call
6693         handle_split_stack_section.
6694         * reloc.cc (Sized_relobj::relocate_sections): Call
6695         split_stack_adjust for executable sections in split_stack
6696         objects.  Pass reloc_map to relocate_section.
6697         (Sized_relobj::split_stack_adjust): New function.
6698         (Sized_relobj::split_stack_adjust_reltype): New function.
6699         (Sized_relobj::find_functions): New function.
6700         * target-reloc.h: Include "object.h".
6701         (relocate_section): Add reloc_symbol_changes parameter.  Change
6702         all callers.
6703         * target.h (class Target): Add calls_non_split method.  Declare
6704         do_calls_non_split virtual method.  Declare match_view and
6705         set_view_to_nop.
6706         * target.cc: Include "elfcpp.h".
6707         (Target::do_calls_non_split): New function.
6708         (Target::match_view): New function.
6709         (Target::set_view_to_nop): New function.
6710         * gold.cc (queue_middle_tasks): Give an error if mixing
6711         split-stack and non-split-stack objects with -r.
6712         * i386.cc (Target_i386::relocate_section): Add
6713         reloc_symbol_changes parameter.
6714         (Target_i386::do_calls_non_split): New function.
6715         * x86_64.cc (Target_x86_64::relocate_section): Add
6716         reloc_symbol_changes parameter.
6717         (Target_x86_64::do_calls_non_split): New function.
6718         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6719         parameter.
6720         * powerpc.cc (Target_powerpc::relocate_section): Add
6721         reloc_symbol_changes parameter.
6722         * sparc.cc (Target_sparc::relocate_section): Add
6723         reloc_symbol_changes parameter.
6724         * configure.ac: Call AM_CONDITIONAL for the default target.
6725         * configure: Rebuild.
6726         * testsuite/Makefile.am (TEST_AS): New variable.
6727         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6728         (check_DATA): Add split_i386 and split_x86_64 files.
6729         (SPLIT_DEFSYMS): Define.
6730         (split_i386_[1234n].o): New targets.
6731         (split_i386_[124]): New targets.
6732         (split_i386_[1234r].stdout): New targets.
6733         (split_x86_64_[1234n].o): New targets.
6734         (split_x86_64_[124]): New targets.
6735         (split_x86_64_[1234r].stdout): New targets.
6736         (MOSTLYCLEANFILES): Add new executables.
6737         * testsuite/split_i386.sh: New file.
6738         * testsuite/split_x86_64.sh: New file.
6739         * testsuite/split_i386_1.s: New file.
6740         * testsuite/split_i386_2.s: New file.
6741         * testsuite/split_i386_3.s: New file.
6742         * testsuite/split_i386_4.s: New file.
6743         * testsuite/split_i386_n.s: New file.
6744         * testsuite/split_x86_64_1.s: New file.
6745         * testsuite/split_x86_64_2.s: New file.
6746         * testsuite/split_x86_64_3.s: New file.
6747         * testsuite/split_x86_64_4.s: New file.
6748         * testsuite/split_x86_64_n.s: New file.
6749         * testsuite/testfile.cc (Target_test): Update relocation_section
6750         function.
6751         * testsuite/Makefile.in: Rebuild.
6752
6753 2009-10-06  Ian Lance Taylor  <iant@google.com>
6754
6755         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6756         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6757         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6758         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6759         the address on ldo_addrs_.
6760         (Target_i386::Relocate::fix_up_ldo): New function.
6761
6762 2009-10-06   Rafael Espindola  <espindola@google.com>
6763
6764         * plugin.cc (add_input_library): New.
6765         (Plugin::load): Add add_input_library to tv.
6766         (Plugin_manager::add_input_file): Add the is_lib argument.
6767         (add_input_file): Update call to Plugin_manager::add_input_file.
6768         (add_input_library): New.
6769         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6770
6771 2009-09-30  Doug Kwan  <dougkwan@google.com>
6772
6773         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6774         symbol and call Symbol::may_need_copy_reloc to determine if
6775         a copy reloc is needed.
6776         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6777         nocopyreloc is given in command line.
6778         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6779         given in command line.
6780         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6781         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6782         of the removed Target_i386::may_need_copy_reloc.
6783         * options.h (copyreloc): New option with default value false.
6784         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6785         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6786         instead of the removed Target_powerpc::may_need_copy_reloc.
6787         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6788         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6789         instead of the removed Target_sparc::may_need_copy_reloc.
6790         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6791         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6792         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6793         instead of the removed Target_x86_64::may_need_copy_reloc.
6794
6795 2009-09-30  Ian Lance Taylor  <iant@google.com>
6796
6797         * object.h (class Object): Remove target_ field, and target,
6798         sized_target, and set_target methods.
6799         (Object::sized_target): Remove.
6800         (class Sized_relobj): Update declarations.  Remove sized_target.
6801         * object.cc (Sized_relobj::setup): Remove target parameter.
6802         Change all callers.
6803         (Input_objects::add_object): Don't do anything with the target.
6804         (make_elf_sized_object): Add punconfigured parameter.  Change all
6805         callers.  Set or test parameter target.
6806         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6807         Change all callers.
6808         * parameters.cc (Parameters::set_target): Change parameter type to
6809         be non-const.
6810         (Parameters::default_target): Remove.
6811         (set_parameters_target): Change parameter type to be non-const.
6812         (parameters_force_valid_target): New function.
6813         (parameters_clear_target): New function.
6814         * parameters.h (class Parameters): Update declarations.  Remove
6815         default_target method.  Add sized_target and clear_target
6816         methods.  Change target_ to be non-const.
6817         (set_parameters_target): Update declaration.
6818         (parameters_force_valid_target): Declare.
6819         (parameters_clear_target): Declare.
6820         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6821         as NULL if we aren't searching.
6822         (Add_symbols::run): Don't check for compatible target.
6823         * fileread.cc (Input_file::open_binary): Call
6824         parameters_force_valid_target.
6825         * gold.cc (queue_middle_tasks): Likewise.
6826         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6827         set_target on object.
6828         * dynobj.h (class Sized_dynobj): Update declarations.
6829         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6830         make_elf_object returns NULL.
6831         (Archive::include_member): Don't check whether object target is
6832         compatible.
6833         * output.cc (Output_section::add_input_section): Get target from
6834         parameters.
6835         (Output_section::relax_input_section): Likewise.
6836         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6837         parameters.
6838         (Sized_relobj::do_scan_relocs): Likewise.
6839         (Sized_relobj::relocate_sections): Likewise.
6840         * resolve.cc (Symbol_table::resolve): Likewise.
6841         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6842         parameter.  Change all callers.
6843         (Symbol_table::add_from_object): Get target from parameters.
6844         (Symbol_table::add_from_relobj): Don't check object target.
6845         (Symbol_table::add_from_dynobj): Likewise.
6846         (Symbol_table::define_special_symbol): Get target from
6847         parameters.
6848         * symtab.h (class Symbol_table): Update declaration.
6849         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6850         parameter.  Change all callers.  Clear parameter target.
6851         (Binary_test): Test target here.
6852         * testsuite/object_unittest.cc (gold_testsuite): Remove
6853         target_test_pointer parameter.  Change all callers.
6854         (Object_test): Test target here.
6855
6856 2009-09-26  Ian Lance Taylor  <iant@google.com>
6857
6858         * testsuite/initpri1.c: Don't try to use constructor priorities if
6859         compiling with gcc before 4.3.
6860
6861 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6862
6863         * testsuite/retain_symbols_file_test.sh (check_present): Change
6864         output file name to retain_symbols_file_test.stdout.
6865         (check_absent): Likewise.
6866
6867 2009-09-18  Craig Silverstein  <csilvers@google.com>
6868
6869         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6870         * options.cc: Include <cerrno> and <fstream>.
6871         (General_options::finalize): Parse -retain-symbols-file tag.
6872         * options.h: New flag.
6873         (General_options): New method should_retain_symbol, new
6874         variable symbols_to_retain.
6875         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6876         should_retain_symbol map.
6877         * testsuite/Makefile.am (retain_symbols_file_test): New test.
6878         * testsuite/Makefile.in: Regenerate.
6879         * testsuite/retain_symbols_file_test.sh: New file.
6880
6881 2009-09-18  Nick Clifton  <nickc@redhat.com>
6882
6883         * po/es.po: Updated Spanish translation.
6884
6885 2009-09-17  Doug Kwan  <dougkwan@google.com>
6886
6887         * debug.h (DEBUG_RELAXATION): New constant.
6888         (DEBUG_ALL): Add DEBUG_RELAXATION.
6889         (debug_string_to_enum): Add relaxation debug option.
6890         * layout.cc
6891         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6892         Layout::Relaxation_debug_check::read_sections,
6893         Layout::Relaxation_debug_check::read_sections): New method definitions.
6894         (Layout::Layout): Initialize data members
6895         record_output_section_data_from_scrips_,
6896         script_output_section_data_list_ and relaxation_debug_check_.
6897         (Layout::save_segments, Layout::restore_segments,
6898         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6899         Layout::relaxation_loop_body): New method definitions.
6900         (Layout::finalize): Support relaxation.  Move section layout code to
6901         Layout::relaxation_loop_body.
6902         (Layout::set_asection_address_from_script): Move code for orphan
6903         section placement out.
6904         (Layout::place_orphan_sections_in_script): New method definition.
6905         * layout.h (Output_segment_headers, Output_file_header):
6906         New forward class declarations.
6907         (Layout::~Layout): Define.
6908         (Layout::new_output_section_data_from_script): New method definition.
6909         (Layout::place_orphan_sections_in_script): New method declaration.
6910         (Layout::Segment_states): New type declaration.
6911         (Layout::save_segments, Layout::restore_segments,
6912         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6913         Layout::relaxation_loop_body): New method declarations.
6914         (Layout::Output_section_data_list): New type declaration.
6915         (Layout::Relaxation_debug_check): New class definition.
6916         (Layout::record_output_section_data_from_script_,
6917         Layout::script_output_section_data_list_, Layout::segment_states_,
6918         Layout::relaxation_debug_check_): New data members.
6919         * output.cc: (Output_section_headers::do_size): New method definition.
6920         (Output_section_headers::Output_section_headers): Move size
6921         computation to Output_section_headers::do_size.
6922         (Output_segment_headers::do_size): New method definition.
6923         (Output_file_header::Output_file_header): Move size computation to
6924         Output_file_header::do_size and call it.
6925         (Output_file_header::do_size): New method definition.
6926         (Output_data_group::Output_data_group): Adjust call to
6927         Output_section_data.
6928         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6929         (Output_symtab_xindex::do_write): Add array bound check.
6930         (Output_section::Input_section::print_to_mapfile): Handle
6931         RELAXED_INPUT_SECTION_CODE.
6932         (Output_section::Output_section): Initialize data member checkpoint_.
6933         (Output_section::~Output_section): Delete checkpoint object pointed
6934         by checkpoint_.
6935         (Output_section::add_input_section): Always add an Input_section if
6936         relaxing.
6937         (Output_section::add_merge_input_section): Add assert.
6938         (Output_section::relax_input_section): New method definition.
6939         (Output_section::set_final_data_size): Set load address to zero for
6940         an unallocated section.
6941         (Output_section::do_address_and_file_offset_have_reset_values):
6942         New method definition.
6943         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6944         Handle relaxed input section.
6945         (Output_section::sort_attached_input_sections): Checkpoint input
6946         section list lazily.
6947         (Output_section::get_input_sections): Change type of input_sections to
6948         list of Simple_input_section pointers.  Checkpoint input section list
6949         lazily.  Also handle relaxed input sections.
6950         (Output_section::add_input_section_for_script): Take a reference to
6951         a Simple_input_section object instead of Relobj pointer and section
6952         index as parameter.  Handle relaxed input sections.
6953         (Output_section::save_states, Output_section::restore_states): New
6954         method definitions.
6955         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6956         (Output_data::is_data_size_fixed): New method definition.
6957         (Output_data::reset_addresss_and_file_offset): Do not reset data size
6958         if it is fixed.
6959         (Output_data::address_and_file_offset_have_reset_values): New method
6960         definition.
6961         (Output_data::do_address_and_file_offset_have_reset_values): New method
6962         definition.
6963         (Output_data::set_data_size): Check that data size is not fixed.
6964         (Output_data::fix_data_size): New method definition.
6965         (Output_data::is_data_size_fixed_): New data member.
6966         (Output_section_headers::set_final_data_size): New method definition.
6967         (Output_section_headers::do_size): New method declaration.
6968         (Output_segment_headers::set_final_data_size): New method definition.
6969         (Output_segment_headers::do_size): New method declaration.
6970         (Output_file_header::set_final_data_size)::New method definition.
6971         (Output_file_header::do_size)::New method declaration.
6972         (Output_section_data::Output_section_data): Add new parameter
6973         is_data_size_fixed and use it to fix data size.
6974         (Output_data_const::Output_data_const): Adjust call to base class
6975         constructor and fix data size.
6976         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6977         base class constructor and fix data size.
6978         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6979         base class constructor and fix data size.
6980         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6981         class constructor and fix data size.
6982         (Output_data_group::set_final_data_size): New method definition.
6983         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6984         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6985         class constructor and fix data size.
6986         (Output_relaxed_input_section): New class definition.
6987         (Output_section::Simple_input_section): New class definition.
6988         (Output_section::get_input_sections): Adjust parameter list.
6989         (Output_section::add_input_section_for_script): Same.
6990         (Output_section::save_states, Output_section::restore_states,
6991         Output_section::do_address_and_file_offset_have_reset_values,
6992         (Output_section::Input_section::Input_section): Handle
6993         RELAXED_INPUT_SECTION_CODE.  Add new overload for
6994         Output_relaxed_input_section.
6995         (Output_section::Input_section::is_input_section,
6996         Output_section::Input_section::set_output_section): Handle relaxed
6997         input section.
6998         (Output_section::Input_section::is_relaxed_input_section,
6999         Output_section::Input_section::output_section_data,
7000         Output_section::Input_section::relaxed_input_section): New method
7001         definitions.
7002         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7003         value.
7004         (Output_section::Input_section::u1_): Update comments.
7005         (Output_section::Input_section::u2_): Add new union member poris.
7006         (Output_section::Checkpoint_output_section): New classs definition.
7007         (Output_section::relax_input_section): New method declaration.
7008         (Output_section::checkpoint_): New data member.
7009         (Output_segment): Update comments.
7010         (Output_segment::Output_segment): Un-privatize copy constructor.
7011         (Output_segment::operator=): Un-privatize.
7012         * script-sections.cc (Output_section_element::Input_section_list):
7013         Change element type to Output_section::Simple_input_section.
7014         (Output_section_element_dot_assignment::set_section_addresses):
7015         Register output section data for relaxation clean up.
7016         (Output_data_exression::Output_data_expression): Adjust call to base
7017         constructor to fix data size.
7018         (Output_section_element_data::set_section_addresses): Register
7019         Output_data_expression object for relaxation clean up.
7020         (struct Input_section_info): Replace Relobj pointer and section index
7021         pair with Output_section::Simple_input_section and Convert struct to a
7022         class.
7023         (Input_section_sorter::operator()): Adjust access to
7024         Input_section_info data member to use accessors.
7025         (Output_section_element_input::set_section_addresses): Use layout
7026         parameter.  Adjust code to use Output_section::Simple_input_section
7027         and Input_secction_info classes.  Register filler for relaxation
7028         clean up.
7029         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7030         and section index pair with Output_section::Simple_input_section
7031         class.  Adjust code accordingly.
7032         (Phdrs_element::release_segment): New method definition.
7033         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7034         segment list.
7035         (Script_sections::release_segments): New method definition.
7036         * gold/script-sections.h (Script_sections::release_segments): New
7037         method declaration.
7038         * gold/target.h (Target::may_relax, Target::relax,
7039         Target::do_may_relax, Target::do_relax): New method definitions.
7040
7041 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7042
7043         * arm.cc (has_signed_unsigned_overflow): New function.
7044         (Arm_relocate_functions::abs8): New function.
7045         (Target_arm::Scan::local): Handle R_ARM_ABS8.
7046         (Target_arm::Scan::global): Likewise.
7047         (Target_arm::relocate::relocate): Likewise.
7048         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7049         Likewise.
7050
7051 2009-09-16  Cary Coutant  <ccoutant@google.com>
7052
7053         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7054         * testsuite/Makefile.in: Regenerate.
7055
7056 2009-09-11  Nick Clifton  <nickc@redhat.com>
7057
7058         * po/gold.pot: Updated by the Translation project.
7059
7060 2009-09-08  Cary Coutant  <ccoutant@google.com>
7061
7062         * output.cc (Output_file::open): Add execute permission to empty file.
7063         * testsuite/Makefile.am (permission_test): New test.
7064         * testsuite/Makefile.in: Regenerate.
7065
7066 2009-09-02  Ian Lance Taylor  <iant@google.com>
7067
7068         * output.cc (Output_file::resize): Call map_no_anonymous rather
7069         than map.
7070
7071 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
7072
7073         * gold.cc: Include "incremental.h".
7074         (queue_initial_tasks): Call Incremental_checker methods.
7075         * incremental.cc: Include "output.h".
7076         (Incremental_checker::can_incrementally_link_output_file): New
7077         method.
7078         * incremental.h (Incremental_checker): New class.
7079
7080         * output.cc (Output_file::open_for_modification): New method.
7081         (Output_file::map_anonymous): Changed return type to bool.  Record
7082         map in base_ field.
7083         (Output_file::map_no_anonymous): New method, broken out of map.
7084         (Output_file::map): Use map_no_anonymous and map_anonymous.
7085         * output.h (class Output_file): Update declarations.
7086
7087 2009-08-24  Cary Coutant  <ccoutant@google.com>
7088
7089         * options.h (Command_line::Pre_options): New class.
7090         (Command_line::pre_options): New member.
7091         * options.cc (gold::options::ready_to_register): New variable.
7092         (One_option::register_option): Do nothing if not registering options.
7093         Assert if same short option registered twice.
7094         (General_options::General_options): Turn off option registration when
7095         done constructing.
7096         (Command_line::Pre_options::Pre_options): New constructor.
7097
7098 2009-08-24  Cary Coutant  <ccoutant@google.com>
7099
7100         * options.h (General_options::no_keep_memory): Remove incorrect
7101         short option.
7102
7103 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7104
7105         * Makefile.am (am__skiplex, am__skipyacc): New.
7106         * Makefile.in: Regenerate.
7107
7108 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7109
7110         * Makefile.am (AM_CPPFLAGS): Renamed from ...
7111         (INCLUDES): ... this.
7112         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7113         (AM_CPPFLAGS): Renamed from ...
7114         (INCLUDE): ... this.
7115         * Makefile.in, testsuite/Makefile.in: Regenerate.
7116
7117         * Makefile.in: Regenerate.
7118         * aclocal.m4: Likewise.
7119         * config.in: Likewise.
7120         * configure: Likewise.
7121         * testsuite/Makefile.in: Likewise.
7122
7123         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7124         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7125         * Makefile.in: Regenerate.
7126         * testsuite/Makefile.in: Regenerate.
7127
7128 2009-08-19  Cary Coutant  <ccoutant@google.com>
7129
7130         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7131         symbols in shared libraries overridden by hidden or internal symbols
7132         in the main program.
7133
7134 2009-08-19  Chris Demetriou  <cgd@google.com>
7135
7136         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7137         checking source file names in error messages.
7138
7139 2009-08-18  Doug Kwan  <dougkwan@google.com>
7140
7141         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7142         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7143         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7144         an elfcpp::Ehdr as parameter.
7145         * object.cc (Object::set_target): Remove the version that looks up
7146         a target and sets it.
7147         (Sized_relobj::setup): Take a Target object instead of
7148         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7149         (make_elf_sized_object): Find target and ask target to
7150         make an ELF object.
7151         * object.h: (Object::set_target): Remove the version that looks up
7152         a target and sets it.
7153         (Sized_relobj::setup): Take a Target object instead of
7154         an elfcpp:Ehdr as parameter.
7155         * target.cc: Include dynobj.h.
7156         (Target::do_make_elf_object_implementation): New.
7157         (Target::do_make_elf_object): New.
7158         * target.h (Target::make_elf_object): New template declaration.
7159         (Target::do_make_elf_object): New method declarations.
7160         (Target::do_make_elf_object_implementation): New template declaration.
7161
7162 2009-08-14  Ian Lance Taylor  <iant@google.com>
7163
7164         * gold.h (FUNCTION_NAME): Define.
7165         (gold_unreachable): Use FUNCTION_NAME.
7166
7167 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7168
7169         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7170         symbol in the --keep-unique list is not found.
7171
7172 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7173
7174         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7175         been maked as --keep-unique.
7176         (Icf::unfold_section): New function.
7177         * icf.h (Icf::unfold_section): New function.
7178         * options.h (General_options::keep_unique): New option.
7179         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7180         * testsuite/Makefile.in: Regenerate.
7181         * testsuite/icf_keep_unique_test.sh: New file.
7182         * testsuite/icf_keep_unique_test.cc: New file.
7183
7184 2009-08-12  Cary Coutant  <ccoutant@google.com>
7185
7186         PR 10471
7187         * resolve.cc (Symbol_table::resolve): Check for references from
7188         dynamic objects to hidden and internal symbols.
7189         * testsuite/Makefile.am (hidden_test.sh): New test.
7190         * testsuite/Makefile.in: Regenerate.
7191         * testsuite/hidden_test.sh: New script.
7192         * testsuite/hidden_test_1.c: New test source.
7193         * testsuite/hidden_test_main.c: New test source.
7194
7195 2009-08-11  Doug Kwan  <dougkwan@google.com>
7196
7197         * arm.cc: Update comments.
7198         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7199         segment to locate the .ARM.exidx section if present.
7200
7201 2009-08-09  Doug Kwan  <dougkwan@google.com>
7202
7203         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7204         patch.
7205
7206 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7207         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7208         compiler warnings.
7209
7210 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7211
7212         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7213         valid tls_segment only for non-debug-section relocations.
7214         * testsuite/Makefile.am: Add gc_tls_test.
7215         * testsuite/Makefile.in: Regenerate.
7216         * testsuite/gc_tls_test.cc: New file.
7217         * testsuite/gc_tls_test.sh: New file.
7218
7219 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7220
7221         * icf.cc: New file.
7222         * icf.h: New file.
7223         * Makefile.am (CCFILES): Add icf.cc.
7224         (HFILES): Add icf.h
7225         * Makefile.in: Regenerate.
7226         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7227         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7228         section, symbol and addend information for the relocs.
7229         * gold.cc (queue_middle_tasks): Call identical code folding.
7230         * gold.h: Add defines for multimap.
7231         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7232         to the call of finalize_local_symbols.
7233         * main.cc (main): Create object of class Icf.
7234         * object.cc (Sized_relobj::do_layout): Allow this function to be
7235         called twice during icf.
7236         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7237         to sections marked as identical by icf.
7238         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7239         when available.
7240         (Sized_relobj::do_section_entsize): New function.
7241         * object.h (Object::section_entsize): New function.
7242         (Object::do_section_entsize): New pure virtual function.
7243         (Relobj::finalize_local_symbols): Add new parameter.
7244         (Relobj::do_section_entsize): New function.
7245         * options.h (General_options::icf): New option.
7246         (General_options::icf_iterations): New option.
7247         (General_options::print_icf_sections): New option.
7248         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7249         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7250         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7251         icf.
7252         * symtab.cc (Symbol_table::is_section_folded): New function.
7253         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7254         to sections marked as identical by icf.
7255         * symtab.h (Symbol_table::set_icf): New function.
7256         (Symbol_table::icf): New function.
7257         (Symbol_table::is_section_folded): New function.
7258         (Symbol_table::icf_): New data member.
7259         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7260         * testsuite/Makefile.am: Add commands to build icf_test.
7261         * testsuite/Makefile.in: Regenerate.
7262         * testsuite/icf_test.sh: New file.
7263         * testsuite/icf_test.cc: New file.
7264
7265 2009-07-24  Chris Demetriou  <cgd@google.com>
7266
7267         * layout.cc (is_compressible_debug_section): Fix incorrect
7268         comment about compressed section names.
7269
7270 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7271
7272         PR 10419
7273         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7274
7275 2009-07-16  Ian Lance Taylor  <iant@google.com>
7276
7277         PR 10400
7278         * layout.h: #include <map>.
7279         (class Kept_section): Change from struct to class.  Add accessors
7280         and setters.  Add section size to Comdat_group mapping.  Change
7281         Comdat_group to std::map.  Add is_comdat_ field.  Add
7282         linkonce_size field in union.
7283         (class Layout): Update declaration of find_or_add_kept_section.
7284         Don't declare find_kept_object.
7285         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7286         parameter.  Add object, shndx, is_comdat, and is_group_name
7287         parameters.  Change all callers.  Adjust for new Kept_section.
7288         (Layout::find_kept_object): Remove.
7289         * object.cc (Sized_relobj::include_section_group): Update use of
7290         Kept_section.  Rename secnum to shndx.  Only record
7291         Kept_comdat_section if sections are the same size.
7292         (Sized_relobj::include_linkonce_section): Update use of
7293         Kept_section.  Only record Kept_comdat_section if sections are the
7294         same size.  Set size of linkonce section.
7295         (Sized_relobj::map_to_kept_section): Update call to
7296         get_kept_comdat_section.
7297         * object.h (class Sized_relobj): Rename fields in
7298         Kept_comdat_section to drop trailing underscores; change object
7299         field to Relobj*.  Change Kept_comdat_section_table to store
7300         struct rather than pointer.
7301         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7302         Add kept_object and kept_shndx parameters.  Change all callers.
7303         (Sized_relobj::get_kept_comdat_section): Change return type to
7304         bool.  Add kept_object and kept_shndx parameters.  Change all
7305         callers.
7306         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7307         Layout::find_or_add_kept_section.
7308
7309 2009-07-09  Ian Lance Taylor  <iant@google.com>
7310
7311         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7312         Reserve space in the hash table.
7313
7314 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7315
7316         * fileread.cc (File_read::get_mtime): New method.
7317         * fileread.h (Timespec): New structure.
7318         (File_read::get_mtime): New method.
7319         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7320         Renamed from timestamp_nsec.
7321         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7322         Elf_Xword.
7323         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7324         timestamp_nsec.
7325         (Incremental_inputs::report_archive): Save mtime; style fix.
7326         (Incremental_inputs::report_obejct): Save mtime; style fix.
7327         (Incremental_inputs::report_script): Save mtime; style fix.
7328         (Incremental_inputs::finalize_inputs): Style fix.
7329         (Incremental_inputs::finalize): Style fix.
7330         (Incremental_inputs::create_input_section_data): Store inputs
7331         mtime.
7332         * incremental.h (Incremental_inputs::report_script): Add mtime
7333         argument.
7334         (Incremental_inputs::Input_info::Input_info): Intialize only one
7335         union member.
7336         (Incremental_inputs::Input_info::archive): Move to nameless
7337         union.
7338         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7339         (Incremental_inputs::Input_info::script): Move to nameless union.
7340         (Incremental_inputs::mtime): New field.
7341         * script.cc (read_input_script): Pass file mtime to
7342         Incremental_input.
7343         * script.h (Script_info::inputs): Style fix.
7344
7345 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7346
7347         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7348         instead of 32.
7349
7350 2009-06-24  Ian Lance Taylor  <iant@google.com>
7351
7352         PR 10156
7353         * layout.cc (Layout::choose_output_section): If we find an
7354         existing section, update the flags.
7355         (Layout::create_notes): New function, broken out of
7356         Layout::finalize.
7357         (Layout::finalize): Don't create note sections.
7358         (Layout::create_note): Don't crash if linker script discards
7359         section.
7360         (Layout::create_gold_note): Likewise.
7361         (Layout::create_build_id): Likewise.  Don't set
7362         after_input_sections on the section.
7363         (Layout::create_executable_stack_info): Remove target parameter.
7364         Change caller.
7365         * layout.h (class Layout): Declare create_notes.  Update
7366         declaration of create_executable_stack_info.
7367         * gold.cc (queue_middle_tasks): Call create_notes.
7368         * output.cc (Output_section::update_flags_for_input_section): Move
7369         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7370         invalid.
7371         * output.h (Output_data::mark_address_invalid): New function.
7372         (class Output_section): Only declare, not define,
7373         update_flags_for_input_section.  Remove set_flags.
7374
7375 2009-06-24  Ian Lance Taylor  <iant@google.com>
7376
7377         * script-sections.cc (Output_section_definition::
7378         set_section_addresses): Rename shadowing local load_address to
7379         laddr.
7380
7381 2009-06-24  Ian Lance Taylor  <iant@google.com>
7382
7383         PR 10244
7384         * reloc.cc (relocate_sections): Skip empty relocation sections.
7385
7386 2009-06-23  Ian Lance Taylor  <iant@google.com>
7387
7388         PR 10156
7389         * layout.cc (Layout::create_note): Use choose_output_section
7390         rather than make_output_section.
7391
7392 2009-06-23  Ian Lance Taylor  <iant@google.com>
7393
7394         PR 10237
7395         * options.cc (General_options::parse_V): Set printed_version_.
7396         (General_options::General_options): Initialize printed_version_.
7397         * options.h (class General_options): Add printed_version_ field.
7398         * gold.cc (queue_initial_tasks): If there are no input files,
7399         don't give a fatal error if we printed the version information.
7400         (queue_middle_tasks): If using -r with a shared object, give a
7401         fatal error rather than an ordinary error.
7402
7403 2009-06-23  Ian Lance Taylor  <iant@google.com>
7404
7405         PR 10219
7406         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7407         (Layout::make_output_section): Set have_stabstr_section_ if we see
7408         a .stab*str section.
7409         (Layout::finalize): Call link_stabs_sections.
7410         (Layout::link_stabs_sections): New file.
7411         * layout.h (class Layout): Add have_stabstr_section_ field.
7412         Declare link_stabs_sections.
7413
7414 2009-06-23  Doug Kwan  <dougkwan@google.com>
7415
7416         * Makefile.am (libgold_a_LIBADD): New.
7417         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7418         * Makefile.in: Regenerate.
7419         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7420         * configure: Regenerate.
7421         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7422         * fileread.cc: Include sys/state.h
7423         * gold.h: Declare memmem and strndup if found missing.
7424         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7425
7426 2009-06-23  Ian Lance Taylor  <iant@google.com>
7427
7428         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7429         * configure: Rebuild.
7430
7431 2009-06-23  Ian Lance Taylor  <iant@google.com>
7432
7433         PR 10147
7434         * object.cc (Object::section_contents): Don't try to get a view if
7435         the section has length zero.
7436         (Object::handle_gnu_warning_section): If the section is empty, use
7437         the name of the section as the warning.
7438
7439 2009-06-23  Ian Lance Taylor  <iant@google.com>
7440
7441         PR 10133
7442         * stringpool.h (class Stringpool_template): Add optimize_ field.
7443         (Stringpool_template::set_optimize): New function.
7444         * stringpool.cc (Stringpool_template::Stringpool_template):
7445         Initialize optimize_ field.
7446         (Stringpool_template::set_string_offsets): Test local optimize
7447         fild rather than parameter.
7448         * layout.cc (Layout::Layout): Call set_optimize on the section
7449         name stringpool.
7450
7451 2009-06-22  Ian Lance Taylor  <iant@google.com>
7452
7453         PR 10030
7454         * yyscript.y: Parse TARGET.
7455         * script.cc (script_set_target): New function.
7456         * script-c.h (script_set_target): Declare.
7457         * options.cc (General_options::string_to_object_format): Rename
7458         from string_to_object_format in anonymous namespace.  Change
7459         callers.
7460         * options.h (class General_options): Declare
7461         string_to_object_format.
7462
7463 2009-06-22  Ian Lance Taylor  <iant@google.com>
7464
7465         * script-sections.cc (Script_sections::create_segments): Don't put
7466         program headers in a PT_LOAD segment if -n or -N.
7467
7468 2009-06-22  Ian Lance Taylor  <iant@google.com>
7469
7470         PR 10141
7471         * options.h (class General_options): Add -z lazy and -z now.  Sort
7472         -z options into alphabetical order.
7473         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7474
7475 2009-06-21  Ian Lance Taylor  <iant@google.com>
7476
7477         * layout.cc (Layout::make_output_section): Call
7478         Target::new_output_section.
7479         (Layout::attach_allocated_section_to_segment): Put large section
7480         sections in a separate load segment with the large segment flag
7481         set.
7482         (Layout::segment_precedes): Sort large data segments after other
7483         load segments.
7484         (align_file_offset): New static function.
7485         (Layout::set_segment_offsets): Use align_file_offset.
7486         * output.h (class Output_section): Add is_small_section_ and
7487         is_large_section_ fields.
7488         (Output_section::is_small_section): New function.
7489         (Output_section::set_is_small_section):  New function.
7490         (Output_section::is_large_section): New function.
7491         (Output_section::set_is_large_section): New function.
7492         (Output_section::is_large_data_section): New function.
7493         (class Output_segment): Add is_large_data_segment_ field.
7494         (Output_segment::is_large_data_segment): New function.
7495         (Output_segment::set_is_large_data_segment): New function.
7496         * output.cc (Output_section::Output_section): Initialize new
7497         fields.
7498         (Output_segment::Output_segment): Likewise.
7499         (Output_segment::add_output_section): Add assertion that large
7500         data sections always go in large data segments.  Force small data
7501         sections to the end of the list of data sections.  Force small BSS
7502         sections to the start of the list of BSS sections.  For large BSS
7503         sections to the end of the list of BSS sections.
7504         * symtab.h (class Symbol): Declare is_common_shndx.
7505         (Symbol::is_defined): Check Symbol::is_common_shndx.
7506         (Symbol::is_common): Likewise.
7507         (class Symbol_table): Define enum Commons_section_type.  Update
7508         declarations.  Add small_commons_ and large_commons_ fields.
7509         * symtab.cc (Symbol::is_common_shndx): New function.
7510         (Symbol_table::Symbol_table): Initialize new fields.
7511         (Symbol_table::add_from_object): Put small and large common
7512         symbols in the right list.
7513         (Symbol_table::sized_finalized_symbol): Check
7514         Symbol::is_common_shndx.
7515         (Symbol_table::sized_write_globals): Likewise.
7516         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7517         common symbol lists.  Don't call do_allocate_commons_list if the
7518         list is empty.
7519         (Symbol_table::do_allocate_commons_list): Remove is_tls
7520         parameter.  Add comons_section_type parameter.  Change all
7521         callers.  Handle small and large common symbols.
7522         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7523         Symbol::is_common_shndx.
7524         * resolve.cc (symbol_to_bits): Likewise.
7525         * target.h (Target::small_common_shndx): New function.
7526         (Target::small_common_section_flags): New function.
7527         (Target::large_common_shndx): New function.
7528         (Target::large_common_section_flags): New function.
7529         (Target::new_output_section): New function.
7530         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7531         small_common_section_flags, and large_common_section_flags
7532         fields.
7533         (Target::do_new_output_section): New virtual function.
7534         * arm.cc (Target_arm::arm_info): Initialize new fields.
7535         * i386.cc (Target_i386::i386_info): Likewise.
7536         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7537         Likewise.
7538         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7539         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7540         (Target_x86_64::do_new_output_section): New function.
7541         * configure.ac: Define conditional MCMODEL_MEDIUM.
7542         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7543         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7544         (large_LDFLAGS): Define.
7545         * testsuite/large.c: New file.
7546         * testsuite/testfile.cc (Target_test::test_target_info):
7547         Initialize new fields.
7548         * configure, testsuite/Makefile.in: Rebuild.
7549
7550 2009-06-05  Doug Kwan  <dougkwan@google.com>
7551
7552         * Makefile.am (CCFILES): Add target.cc.
7553         * Makefile.in: Regenerate.
7554         * i386.cc (class Target_i386): Define new virtual method to
7555         override do_is_local_label_name in parent.
7556         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7557         local symbols if --discard-locals or -X is given.
7558         * options.h (class General_options): Declare new options
7559         '--discard-locals' and '-X' for discarding locals.
7560         * target.h (class Target): Define new methods is_local_label_name.
7561         Declare new virtual method do_is_local_label_name.
7562         * target.cc: New file.
7563         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7564         (check_SCRIPTS): Add discard_locals_test.sh.
7565         (check_DATA): Add discard_local_tests.syms.
7566         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7567         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7568         * testsuite/Makefile.in: Regenerate.
7569         * testsuite/discard_locals_test.c: New file.
7570         * testsuite/discard_locals_test.sh: Same.
7571
7572 2009-06-05  Doug Kwan  <dougkwan@google.com>
7573
7574         * object.cc (Sized_relobj::Sized_relobj): Initialize
7575         discarded_eh_frame_shndx_ to -1U.
7576         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7577         section.
7578         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7579         a discarded .eh_frame section.
7580         (Sized_relobj::do_finalize_local_symbols): Ditto.
7581         * object.h (class Sized_relobj): Declare new member
7582         discarded_eh_frame_shndx_.
7583         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7584         (local_labels_test.o, local_labels_test): New rules.
7585         * testsuite/Makefile.in: Regenerate.
7586
7587 2009-06-04  Doug Kwan  <dougkwan@google.com>
7588
7589         * layout.cc (Layout::section_name_mapping): Add mapping for
7590         special ARM sections.
7591
7592 2009-06-03  Doug Kwan  <dougkwan@google.com>
7593
7594         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7595         (utils::has_overflow): Same.
7596
7597 2009-06-03  Ian Lance Taylor  <iant@google.com>
7598
7599         * layout.cc (Layout::section_name_mapping): New array, replacing
7600         Layout::linkonce_mapping.
7601         (Layout::section_name_mapping_count): New variable, replacing
7602         Layout::linkonce_mapping_count.
7603         (Layout::linkonce_output_name): Remove.
7604         (Layout::output_section_name): Rewrite.
7605         * layout.h (class Layout): Rename Linkonce_mapping to
7606         Section_name_mapping, linkonce_mapping to section_name_mapping,
7607         linkonce_mapping_count to section_name_mapping_count.  Don't
7608         declare linkonce_output_name.
7609
7610 2009-06-03  Doug Kwan  <dougkwan@google.com>
7611
7612         * gold/arm.cc (namespace utils): New.
7613         (Target_arm::reloc_is_non_pic): Define new method.
7614         (class Arm_relocate_functions): New.
7615         (Target_arm::Relocate::relocate): Handle relocation types used by
7616         Android.
7617
7618 2009-06-03  Ian Lance Taylor  <iant@google.com>
7619
7620         * arm.cc (Target_arm::scan::global): Use || instead of |.
7621
7622 2009-06-02  Doug Kwan  <dougkwan@google.com>
7623
7624         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7625         issued_non_pic_error_.
7626         (class Target_arm::Scan): Declare new method check_non_pic.
7627         Define new method symbol_needs_plt_entry.
7628         Declare new data member issued_non_pic_error_.
7629         (class Target_arm::Relocate): Declare new method
7630         should_apply_static_reloc.
7631         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7632         (Target_arm::Scan::check_non_pic): Define new method.
7633         (Target_arm::Scan::local): Handle a small subset of reloc types used
7634         by Android.
7635         (Target_arm::Scan::local): Same.
7636         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7637
7638 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7639
7640         * incremental.cc (Incremental_inputs::report_command_line): Filter
7641         out --incremental-* options.
7642
7643 2009-05-29  Doug Kwan  <dougkwan@google.com>
7644
7645         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7646         template class.
7647         (class Target_arm): Update comment.
7648         (Target_arm::Target_arm): Initialize new data members GOT_,
7649         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7650         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7651         and Target_arm::rel_dyn_section.
7652         Declare new_enum Target_arm::Got_type.
7653         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7654         and DYNBSS_.
7655         Update commments for member do_dynsym_value.
7656         (Target_arm::got_size, Target_arm::plt_section,
7657         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7658         new methods inside class defintion.
7659         (Target_arm::got_section): Define new method.
7660         (Target_arm::rel_dyn_section): Same.
7661         (Output_data_plt_arm): New template class.
7662         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7663         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7664         (Output_data_plt_arm::add_entry): Same.
7665         (Output_data_plt_arm::first_plt_entry): Define new
7666         static data member for PLT instruction template.
7667         (Output_data_plt_arm::plt_entry): Same.
7668         (Output_data_plt_arm::do_write): Define new method.
7669         (Target_arm::make_plt_entry): Same.
7670         (Target_arm::do_finalize_sections): Same.
7671         (Target_arm::do_dynsym_value): Same.
7672
7673 2009-05-28  Doug Kwan  <dougkwan@google.com>
7674
7675         * Makefile.am (TARGETSOURCES): Add arm.cc.
7676         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7677         * Makefile.in: Regenerate.
7678         * arm.cc: New file.
7679         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7680
7681 2009-05-26  Doug Kwan  <dougkwan@google.com>
7682
7683         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7684         (General_options::check_excluded_libs): Strip off directories in
7685         archive name before matching like GNU ld does.
7686         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7687         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7688         (exclude_libs_test_LDFLAGS): Add linker option
7689         -Wl,--exclude-libs,libexclude_libs_test_3
7690         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7691         an explicit archive without using -l.
7692         (alt/libexclude_libs_test_3.a): New make rule.
7693         * testsuite/Makefile.in: Regenerate.
7694         * testsuite/exclude_libs_test.c : Declare lib3_default().
7695         (main): Call it.
7696         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7697         * exclude_libs_test_3.c: New file.
7698
7699 2009-05-26  Nick Clifton  <nickc@redhat.com>
7700
7701         * po/id.po: New Indonesian translation.
7702         * po/gold.pot: Updated template file.
7703
7704 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7705
7706         * testsuite/Makefile.am: Add -ffunction-sections to compile
7707         gc_comdat_test files.  Add -Wl,--gc-sections to build
7708         gc_comdat_test.
7709         * testsuite/Makefile.in: Regenerate.
7710         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7711
7712 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7713
7714         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7715         kept comdat section was garbage collected.
7716         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7717         * testsuite/Makefile.in: Regenerate.
7718         * testsuite/gc_comdat_test.sh: New file.
7719         * testsuite/gc_comdat_test_1.cc: New file.
7720         * testsuite/gc_comdat_test_2.cc: New file.
7721
7722 2009-05-19  Doug Kwan  <dougkwan@google.com>
7723
7724         * archive.cc (Archive::Archive): Move constructor from archive.h
7725         to here.  Initialize no_export_.
7726         (Archive::get_elf_object_for_member): Set no_export flag of object.
7727         * archive.h (Archive::Archive): Move constructor body to
7728         archive.cc.
7729         (Archive::no_export): New method.
7730         (Archive::no_export_): New field.
7731         * object.h (Object::Object): Initialize no_export_ to false.
7732         (Object::no_export, Object::set_no_export): New methods.
7733         (Object::no_export_): New field.
7734         * options.cc (General_options::parse_exclude_libs): New method.
7735         (General_options::check_excluded_libs) Same.
7736         * options.h (exclude_libs): New option.
7737         (General_options::check_excluded_libs): New method declaration.
7738         (General_options::excluded_libs_): New field.
7739         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7740         default or protected visibility if an object has no-export flag set.
7741         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7742         (check_SCRIPTS): Add exclude_libs_test.sh.
7743         (check_DATA): Add exclude_libs_test.syms.
7744         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7745         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7746         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7747         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7748         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7749         libexclude_libs_test_2.a): New rules.
7750         * testsuite/Makefile.in: Regenerate.
7751         * testsuite/exclude_libs_test.c: New file.
7752         * testsuite/exclude_libs_test.sh: Ditto.
7753         * testsuite/exclude_libs_test_1.c: Ditto.
7754         * testsuite/exclude_libs_test_2.c: Ditto.
7755
7756 2009-05-15  Ian Lance Taylor  <iant@google.com>
7757
7758         * configure.ac: Check for declarations for cases where libiberty.h
7759         checks HAVE_DECL_xxx.
7760         * configure, config.in: Rebuild.
7761
7762 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7763
7764         * gold.h (Incremental_argument_list): Remove (invalid) forward
7765         declaration.
7766         * incremental.cc (Incremental_inputs::report_achive): New method.
7767         (Incremental_inputs::report_object): New method.
7768         (Incremental_inputs::report_script): New method.
7769         (Incremental_inputs::finalize_inputs): New method.
7770         (Incremental_inputs::finalize): Call finalize_inputs().
7771         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7772         Create inputs entries.
7773         * incremental.h (Incremental_input_type): New enum.
7774         (Incremental_inputs::Incremental_input): Initialize new fields.
7775         (Incremental_inputs::report_inputs): New method.
7776         (Incremental_inputs::report_achive): New method.
7777         (Incremental_inputs::report_object): New method.
7778         (Incremental_inputs::report_script): New method.
7779         (Incremental_inputs::finalize_inputs): New method.
7780         (Incremental_inputs::Input_info): New struct.
7781         (Incremental_inputs::Input_info_map): New typedef.
7782         (Incremental_inputs::lock_): New field.
7783         (Incremental_inputs::Inputs_): New field.
7784         (Incremental_inputs::Inputs_map): New field.
7785         * main.cc (main): Call Incremental_input::report_inputs.
7786         * options.h (Input_argument_list): Typedef moved from
7787         Input_arguments.
7788         (Input_file_group::Files): Remove, use ::Input_argument_list.
7789         (Input_file_group::Input_argument_list): Remove, use
7790         ::Input_argument_list.
7791         * plugin.cc (Plugin_manager::add_input_file): Add error in
7792         incremental build.
7793         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7794         functions.
7795         * script.cc (read_input_script): Call
7796         Incremental_input::report_script.
7797         * script.h (Script_info): New class.
7798
7799 2009-04-27  Ian Lance Taylor  <iant@google.com>
7800
7801         * x86_64.cc (do_adjust_output_section): Set entsize to
7802         plt_entry_size.
7803
7804 2009-04-23  Elliott Hughes  <enh@google.com>
7805
7806         * output.cc (Output_file::close): After short writes, continue
7807         writing from the correct offset in the buffer being written.
7808
7809 2009-04-23  Chris Demetriou  <cgd@google.com>
7810
7811         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7812         * configure: Regenerate.
7813         * config.in: Regenerate.
7814         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7815         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7816
7817 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7818
7819         * incremental.cc (Incremental_inputs_header_data): Renamed from
7820         Incremental_input_header_data.
7821         (Incremental_inputs_header_data::data_size): New field.
7822         (Incremental_inputs_header_data::put_input_file_count): Renamed
7823         from input_file_count.
7824         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7825         from command_line_offset.
7826         (Incremental_inputs_header_data::put_reserved): Renamed from
7827         put_reserved.
7828         (Incremental_inputs_entry_data): Renamed from
7829         Incremental_input_entry_data.
7830         (Incremental_inputs_entry_data::data_size): New field.
7831         (Incremental_inputs::report_command_line): New method.
7832         (Incremental_inputs::finalize): New method.
7833         (Incremental_inputs::create_incremental_inputs_data): New method.
7834         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7835         * incremental.h: New file.
7836         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7837        (Layout::finalize): Create incremental inputs section in
7838         incremental builds.
7839        (Layout::create_incremental_info_sections): New method.
7840         * layout.h (Layout::incremental_inputs): New method.
7841        (Layout::create_incremental_info_sections): New method.
7842        (Layout::incremental_inputs_): New field.
7843         * main.cc (main): Notify Incremental_input of the command line.
7844
7845 2009-04-01  Ian Lance Taylor  <iant@google.com>
7846             Mikolaj Zalewski  <mikolajz@google.com>
7847
7848         * gold.h (reserve_unordered_map): Define, three versions, one for
7849         each version of Unordered_map.
7850         * layout.cc (Layout::Layout): Remove options parameter.  Add
7851         number_of_input_files parameter.  Don't initialize options_.
7852         Initialize number_of_input_files_ and resized_signatures_.  Move
7853         sections_are_attached_.
7854         (Layout::layout_group): Reserve space for group_signatures_.
7855         (Layout::find_or_add_kept_section): Change name parameter to be a
7856         reference.  Resize signatures_ map when it gets large enough.
7857         (Layout::layout_eh_frame): Use parameters->options() instead of
7858         this->options_.
7859         (Layout::make_output_section): Likewise.
7860         (Layout::attach_allocated_section_to_segment): Likewise.
7861         (Layout::finalize, Layout::create_executable_stack): Likewise.
7862         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7863         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7864         * layout.h (class Layout): Update declarations.  Remove options_
7865         field.  Add number_of_input_files_ and resized_signatures_
7866         fields.  Move sections_are_attached_ field.
7867         * main.cc (main): Pass number of input files to Layout
7868         constructor.  Don't pass options.
7869
7870 2009-03-30  Ian Lance Taylor  <iant@google.com>
7871
7872         * ffsll.c (ffsll): Correct implementation.
7873
7874 2009-03-27  Ian Lance Taylor  <iant@google.com>
7875
7876         * ffsll.c: New file.
7877         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7878         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7879         * ftruncate.c (ftruncate): Declare before definition.
7880         * mremap.c (mremap): Likewise.
7881         * pread.c (pread): Likewise.
7882         * configure, Makefile.in, config.in: Rebuild.
7883
7884         * mremap.c: New file.
7885         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7886         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7887         (mremap): Declare if HAVE_MREMAP is not defined.
7888         * configure, Makefile.in, config.in: Rebuild.
7889
7890 2009-03-27  Cary Coutant  <ccoutant@google.com>
7891
7892         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7893         position independent.
7894         * sparc.cc (Target_sparc::check_non_pic): Likewise.
7895         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7896
7897 2009-03-24  Cary Coutant  <ccoutant@google.com>
7898
7899         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7900         an executable.
7901         (needs_dynamic_reloc): Likewise.
7902
7903 2009-03-24  Ian Lance Taylor  <iant@google.com>
7904
7905         * yyscript.y (file_cmd): Recognize EXTERN.
7906         (extern_name_list, extern_name_list_body): New nonterminals.
7907         * script.cc (script_add_extern): Define.
7908         * script-c.h (script_add_extern): Declare.
7909
7910 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
7911
7912         * object.cc (is_elf_object): Define.
7913         * object.h (is_elf_object): Declare.
7914         * archive.cc (Archive::get_elf_object_for_member): Call
7915         is_elf_object.
7916         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7917
7918 2009-03-24  Elliott Hughes  <enh@google.com>
7919
7920         * output.cc (Output_file::map_anonymous): Define.
7921         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
7922         try an anonymous one.  Report the size if the mmap fails.
7923         * output.h (class Output_file): Declare map_anonymous.
7924
7925 2009-03-24  Ian Lance Taylor  <iant@google.com>
7926
7927         * target-select.cc (instantiate_target): Don't acquire the lock if
7928         the instantiated_target_ field has already been set.
7929
7930 2009-03-23  Ian Lance Taylor  <iant@google.com>
7931
7932         * gold-threads.h (class Initialize_lock): Define.
7933         * gold-threads.cc (class Initialize_lock_once): Define.
7934         (initialize_lock_control): New static variable.
7935         (initialize_lock_pointer): New static variable.
7936         (initialize_lock_once): New static function.
7937         (Initialize_lock::Initialize_lock): Define.
7938         (Initialize_lock::initialize): Define.
7939         * target-select.h: Include "gold-threads.h".
7940         (class Target_selector): Add lock_ and initialize_lock_ fields.
7941         Don't define instantiate_target, just declare it.
7942         * target-select.cc (Target_selector::Target_selector): Initialize
7943         new fields.
7944         (Target_selector::instantiate_target): Define.
7945         * descriptors.h: Include "gold-threads.h".
7946         (class Descriptors): Add initialize_lock_ field.
7947         * descriptors.cc (Descriptors::Descriptors): Initialize new
7948         field.
7949         (Descriptors::open): Use initialize_lock_ field
7950         * errors.h (class Errors): Add initialize_lock_ field.
7951         * errors.cc (Errors::Errors): Initialize new field.
7952         (Errors::initialize_lock): Use initialize_lock_ field.
7953         * powerpc.cc (class Target_selector_powerpc): Remove
7954         instantiated_target_ field.  In do_recognize call
7955         instantiate_target rather than do_instantiate_target.  In
7956         do_instantiate_target just allocate a new target.
7957         * sparc.cc (class Target_selector_sparc): Likewise.
7958
7959         * freebsd.h: New file.
7960         * i386.cc: Include "freebsd.h".
7961         (Target_i386): Derive from Target_freebsd rather than
7962         Sized_target.
7963         (Target_selector_i386): Derive from Target_selector_freebsd rather
7964         than Target_selector.
7965         * x86_64.cc: Include "freebsd.h".
7966         (Target_x86_64): Derive from Target_freebsd rather than
7967         Sized_target.
7968         (Target_selector_x86_64): Derive from Target_selector_freebsd
7969         rather than Target_selector.
7970         * target.h (class Target): Add adjust_elf_header and
7971         do_adjust_elf_header.
7972         * output.cc (Output_file_header:: do_sized_write): Call target
7973         adjust_elf_header routine.
7974         * configure.tgt: Set targ_osabi.
7975         * configure.ac: Define GOLD_DEFAULT_OSABI.
7976         * parameters.cc (Parameters::default_target): Pass
7977         GOLD_DEFAULT_OSABI to select_target.
7978         * target-select.h (class Target_selector): Make instantiate_target
7979         protected rather than private.
7980         * Makefile.am (HFILES): Add freebsd.h.
7981         * configure, Makefile.in, config.in: Rebuild.
7982
7983         * merge.cc (do_add_input_section): Correct pend value.  Change
7984         message about last entry not being null terminated from error to
7985         warning.
7986
7987 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
7988
7989         * incremental.cc: New file.
7990         * Makefile.am (CCFILES): Add incremental.cc.
7991         * Makefile.in: Rebuild.
7992
7993 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
7994
7995         * layout.cc (Layout::output_section_name): Preserve names
7996         of '.note.' sections.
7997
7998 2009-03-19  Ian Lance Taylor  <iant@google.com>
7999
8000         * descriptors.cc (Descriptors::open): Check that the options are
8001         valid before using them.
8002
8003 2009-03-18  Ian Lance Taylor  <iant@google.com>
8004
8005         * script-sections.h: Include <list>.
8006         (class Script_sections): Change Sections_elements from std::vector
8007         to std::list.  Typedef public Elements_iterator.  Add
8008         orphan_section_placement_, data_segment_align_start_, and
8009         saw_data_segment_align_ fields.  Remove data_segment_align_index_
8010         field.
8011         * script-sections.cc (class Orphan_section_placement): New class.
8012         (class Sections_element): Add virtual functions is_relro and
8013         orphan_section_init.  Remove virtual function place_orphan_here.
8014         (class Output_section_definition): Add is_relro and
8015         orphan_section_init.  Remove place_orphan_here.
8016         (class Orphan_output_section): Likewise.
8017         (Script_sections::Script_sections): Update for field changes.
8018         (Script_sections::data_segment_align): Set saw_data_segment_align_
8019         and data_segment_align_start_, not data_segment_align_index.
8020         (Script_sections::data_segment_relro_end): Check
8021         saw_data_segment_align_.  Use data_segment_align_start_ rather
8022         than data_segment_align_index_.
8023         (Script_sections::place_orphan): Rewrite to use
8024         Orphan_section_placement.
8025
8026 2009-03-17  Ian Lance Taylor  <iant@google.com>
8027
8028         * archive.cc (Archive::add_symbols): Check for a version attached
8029         to the symbol name in the archive map.
8030         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8031         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8032         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8033         (ver_test_11.a): New target.
8034         * testsuite/Makefile.in: Rebuild.
8035
8036         * configure.ac: Check for chsize and posix_fallocate.  Replace
8037         ftruncate.
8038         * ftruncate.c: New file, from gnulib.
8039         * output.cc (posix_fallocate): Define dummy version if not
8040         HAVE_POSIX_FALLOCATE.
8041         (Output_file::map): Call posix_fallocate rather than lseek and
8042         write.
8043         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8044         * configure, Makefile.in, config.in: Rebuild.
8045
8046 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
8047
8048         * layout.h (Layout::create_note): Add section_name parameter.
8049         * layout.cc (Layout::create_note): Likewise.
8050         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8051
8052 2009-03-17  Ian Lance Taylor  <iant@google.com>
8053
8054         * descriptors.cc: Include "options.h".
8055         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8056         (Descriptors::open): Always use O_CLOEXEC when opening a new
8057         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
8058         then set FD_CLOEXEC.
8059
8060         * sparc.cc (class Target_sparc): Add has_got_section.
8061         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8062         make sure we have a GOT section.
8063
8064         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8065         (Target_sparc::Scan::local): Likewise.
8066         (Target_sparc::Scan::global): Likewise.
8067         (Target_sparc::Relocate::relocate): Likewise.
8068         (Target_sparc::Relocate::relocate_tls): Likewise.
8069
8070         * symtab.cc (Symbol_table::define_default_version): New function,
8071         broken out of add_from_object.
8072         (Symbol_table::add_from_object): Call define_default_version.
8073         (Symbol_table::define_special_symbol): Add resolve_oldsym
8074         parameter.  Change all callers.  If the version for a symbol comes
8075         from a version script, resolve it with the symbol with the same
8076         name with no version.  Also add the symbol without a version if
8077         appropriate.
8078         (do_define_in_output_data): If resolving with oldsym, don't delete
8079         sym.
8080         (do_define_in_output_segment): Likewise.
8081         (do_define_as_constant): Likewise.
8082         * symtab.h (class Symbol_table): Update declarations.
8083
8084 2009-03-13  Ian Lance Taylor  <iant@google.com>
8085
8086         * readsyms.cc (Read_symbols::incompatible_warning): New function.
8087         (Read_symbols::requeue): New function.
8088         (Read_symbols::do_read_symbols): If make_elf_object fails because
8089         the target type is not configured, and the file was searched for,
8090         issue a warning and retry with the next directory.
8091         (Add_symbols::run): If the file has an incompatible format, and
8092         it was searched for, requeue the Read_symbols task.  On error,
8093         release the object.
8094         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
8095         dirindex parameter to constructor.  Change all callers.  Declare
8096         incompatible_warning and requeue.
8097         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8098         input_argument_ and input_group_ fields.  Add them to
8099         constructor.  Change all callers.
8100         (class Read_script): Add dirindex_ field.  Add it to constructor.
8101         Change all callers.
8102         * archive.cc (Archive::setup): Remove input_objects parameter.
8103         Change all callers.
8104         (Archive::get_file_and_offset): Likewise.
8105         (Archive::read_all_symbols): Likewise.
8106         (Archive::read_symbols): Likewise.
8107         (Archive::get_elf_object_for_member): Remove input_objects
8108         parameter.  Add punconfigured parameter.  Change all callers.
8109         (Archive::add_symbols): Change return type to bool.  Check return
8110         value of include_member.
8111         (Archive::include_all_members): Likewise.
8112         (Archive::include_member): Change return type to bool.  Return
8113         false if first included object has incompatible target.  Set
8114         included_member_ field.
8115         (Add_archive_symbols::run): If add_symbols returns false, requeue
8116         Read_symbols task.
8117         * archive.h (class Archive): Add included_member_ field.
8118         Initialize it in constructor.  Add input_file and searched_for
8119         methods.  Update declarations.
8120         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8121         input_argument_ fields.  Add them to constructor.  Change all
8122         callers.
8123         * script.cc: Include "target-select.h".
8124         (class Parser_closure): Add skip_on_incompatible_target_ and
8125         found_incompatible_target_ fields.  Add
8126         skip_on_incompatible_target parameter to constructor.  Change all
8127         callers.  Add methods skip_on_incompatible_target,
8128         clear_skip_on_incompatible_target, found_incompatible_target, and
8129         set_found_incompatible_target.
8130         (read_input_script): Add dirindex parameter.  Change all callers.
8131         If parser finds an incompatible target, requeue Read_symbols
8132         task.
8133         (script_set_symbol): Clear skip_on_incompatible_target in
8134         closure.
8135         (script_add_assertion, script_parse_option): Likewise.
8136         (script_start_sections, script_add_phdr): Likewise.
8137         (script_check_output_format): New function.
8138         * script.h (read_input_script): Update declaration.
8139         * script-c.h (script_check_output_format): Declare.
8140         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8141         (ignore_cmd): Remove OUTPUT_FORMAT.
8142         * fileread.cc (Input_file::Input_file): Add explicit this.
8143         (Input_file::will_search_for): New function.
8144         (Input_file::open): Add pindex parameter.  Change all callers.
8145         * fileread.h (class Input_file): Add input_file_argument method.
8146         Declare will_search_for.  Update declarations.
8147         * object.cc (make_elf_object): Add punconfigured parameter.
8148         Change all callers.
8149         * object.h (class Object): Make input_file public.  Add
8150         searched_for method.
8151         (make_elf_object): Update declaration.
8152         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8153         restart search.
8154         * dirsearch.h (class Dirsearch): Update declaration.
8155         * options.h (class General_options): Add --warn-search-mismatch.
8156         * parameters.cc (Parameters::is_compatible_target): New function.
8157         * parameters.h (class Parameters): Declare is_compatible_target.
8158         * workqueue.cc (Workqueue::add_blocker): New function.
8159         * workqueue.h (class Workqueue): Declare add_blocker.
8160
8161         * fileread.cc (Input_file::open): Remove options parameter.
8162         Change all callers.
8163         (Input_file::open_binary): Likewise.
8164         * script.cc (read_input_script): Likewise.
8165         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8166         options parameter from constructor.  Change all callers.
8167         (class Read_script): Likewise.
8168         * fileread.h (class Input_file): Update declarations.
8169         * script.h (read_input_script): Update declaration.
8170
8171 2009-03-10  Nick Clifton  <nickc@redhat.com>
8172
8173         * po/es.po: New Spanish translation.
8174
8175 2009-03-06  Cary Coutant  <ccoutant@google.com>
8176
8177         * options.cc (parse_short_option): Keep dash_z from registering itself.
8178
8179 2009-03-03  Ian Lance Taylor  <iant@google.com>
8180
8181         PR 9918
8182         * target-reloc.h (relocate_section): Pass output_section to
8183         relocate.
8184         * i386.cc (Target_i386::should_apply_static_reloc): Add
8185         output_section parameter.  Change all callers.
8186         (Target_i386::Relocate::relocate): Add output_section parameter.
8187         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8188         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8189         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8190         * testsuite/two_file_shared.sh: New script.
8191         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8192         (check_DATA): Add two_file_shared.dbg.
8193         (two_file_shared.dbg): New target.
8194         * testsuite/Makefile.in: Rebuild.
8195
8196 2009-03-01  Ian Lance Taylor  <iant@google.com>
8197
8198         * configure.ac: Check for byteswap.h.
8199         * configure: Rebuild.
8200         * config.in: Rebuild.
8201
8202 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8203
8204         * layout.cc (Layout::find_or_add_kept_section): New function.
8205         (Layout::add_comdat): Removed.
8206         * layout.h (struct Kept_section): Move out of class Layout.
8207         Remove trailing underscores from field names.  Add group_sections
8208         field.  Rename group_ field to is_group.  Change all uses.
8209         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8210         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8211         comdat_groups_ field.
8212         (Sized_relobj::include_section_group): Use
8213         find_or_add_kept_section and Kept_section::group_sections.
8214         (Sized_relobj::include_linkonce_section): Likewise.
8215         * object.cc (class Sized_relobj): Don't define Comdat_group or
8216         Comdat_group_table.  Remove find_comdat_group and
8217         add_comdat_group.  Remove comdat_groups_ field.
8218         * plugin.cc (include_comdat_group): Use
8219         Layout::find_or_add_kept_section.
8220
8221 2009-02-28  Ian Lance Taylor  <iant@google.com>
8222
8223         * README: --gc-sections and map files are now supported.  Document
8224         some build requirements.
8225
8226         PR 6992
8227         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8228         relocatable link set the value of the section symbol to zero.
8229         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8230         relocatable link don't include the section address in the local
8231         symbol value.
8232
8233 2009-02-27  Ian Lance Taylor  <iant@google.com>
8234
8235         PR 6811
8236         * options.h (class Search_directory): Add is_system_directory.
8237         (class General_options): Declare is_in_system_directory.
8238         * options.cc (get_relative_sysroot): Make static.
8239         (get_default_sysroot): Make static.
8240         (General_optoins::is_in_system_directory): New function.
8241         * fileread.cc (Input_file::is_in_system_directory): New function.
8242         * fileread.h (class Input_file): Declare is_in_system_directory.
8243         * object.h (class Object): Add is_in_system_directory.
8244         (class Input_objects): Remove system_library_directory_ field.
8245         * object.cc (Input_objects::add_object): Don't set
8246         system_library_directory_.
8247         (input_objects::found_in_system_library_directory): Remove.
8248         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8249         parameter.  Change all callers.
8250         (Symbol_table::sized_write_globals): Likewise.
8251         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8252         Call Object::is_in_system_directory.
8253         * symtab.h (class Symbol_table): Update declarations.
8254
8255         PR 5990
8256         * descriptors.h (Open_descriptor): Add is_on_stack field.
8257         * descriptors.cc (Descriptors::open): If the descriptor is on the
8258         top of the stack, remove it.  Initialize is_on_stack field.
8259         (Descriptors::release): Only add pod to stack if it is not on the
8260         stack already.
8261         (Descriptors::close_some_descriptor): Clear stack_next and
8262         is_on_stack fields.
8263
8264         PR 7091
8265         * output.cc (Output_section::find_starting_output_address): Rename
8266         from starting_output_address; add PADDR parameter; change return
8267         type.
8268         * output.h (class Output_section): Declare
8269         find_starting_output_address instead of starting_output_address.
8270         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8271         section symbol for which we can't find a merge section.
8272
8273         PR 9836
8274         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8275         hidden or internal, force the symbol to be local.
8276         * resolve.cc (Symbol::override_visibility): Define.
8277         (Symbol::override_base): Use override_visibility.
8278         (Symbol_table::resolve): Likewise.
8279         (Symbol::override_base_with_special): Likewise.
8280         (Symbol_table::override_with_special): If the visibility is hidden
8281         or internal, force the symbol to be local.
8282         * symtab.h (class Symbol): Add set_visibility and
8283         override_visibility.
8284         * testsuite/ver_test_1.sh: New file.
8285         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8286         (check_DATA): Add ver_test_1.syms.
8287         (ver_test_1.syms): New target.
8288         * testsuite/Makefile.in: Rebuild.
8289
8290 2009-02-25  Cary Coutant  <ccoutant@google.com>
8291
8292         * layout.cc (Layout::choose_output_section): Don't rename sections
8293         when using a linker script that has a SECTIONS clause.
8294         * Makefile.in: Regenerate.
8295
8296         * testsuite/Makefile.am (script_test_5.sh): New test case.
8297         * testsuite/Makefile.in: Regenerate.
8298         * testsuite/script_test_5.cc: New file.
8299         * testsuite/script_test_5.sh: New file.
8300         * testsuite/script_test_5.t: New file.
8301
8302 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8303
8304         * archive.cc (Archive::include_member): Update calls to add_symbols.
8305         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8306         the Layout argument.
8307         * dynobj.h (do_add_symbols): Add the Layout argument.
8308         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8309         Layout argument.
8310         * object.h (Object::add_symbols): Add the Layout argument.
8311         (Object::do_add_symbols): Add the Layout argument.
8312         (Sized_relobj::do_add_symbols): Add the Layout argument.
8313         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8314         Unify the two versions.
8315         (Add_plugin_symbols): Remove.
8316         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8317         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8318         (Add_plugin_symbols): Remove.
8319         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8320         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8321         (Add_symbols::run): Make it work with Pulginobj.
8322
8323 2009-02-06  Ian Lance Taylor  <iant@google.com>
8324
8325         * object.cc (Sized_relobj::do_layout): Make info message start
8326         with lower case letter.
8327
8328 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8329
8330         * binary.cc: Fix file comment.
8331
8332         * options.h (enum Incremental_disposition): Define.
8333         (class General_options): Add new options: --incremental,
8334         --incremental_changed, --incremental_unchanged,
8335         --incremental_unknown.  Add incremental_disposition_ and
8336         implicit_incremental_ fields.
8337         (General_options::incremental_disposition): New function.
8338         (class Position_dependent_options): Add incremental_disposition
8339         option.
8340         (Position_dependent_options::copy_from_options): Set incremental
8341         dispositions.
8342         * options.cc (General_options::parse_incremental_changed): New
8343         function.
8344         (General_options::parse_incremental_unchanged): New function.
8345         (General_options::parse_incremental_unknown): New function.
8346         (General_options::General_options): Initialize new fields
8347         incremental_disposition_ and implicit_incremental_.
8348         (General_options::finalize): Check for uasge of --incremental-*
8349         without --incremental.
8350
8351 2009-02-06  Chris Demetriou  <cgd@google.com>
8352
8353         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8354         pointer and to report location as the file name associated with
8355         the symbol.
8356         (gold_undefined_symbol_at_location): New function to replace the
8357         old gold_undefined_symbol functionality.
8358         * target-reloc.h (relocate_section): Update to use
8359         gold_undefined_symbol_at_location.
8360         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8361         Call gold_undefined_symbol function rather than gold_error.
8362         * errors.h (Errors::undefined_symbol): Take location as a
8363         string, rather than calculating it from a relocation.
8364         * errors.cc (Errors::fatal): Print "fatal error:" before the
8365         formatted message.
8366         (Errors::error, Errors::error_at_location): Print "error: "
8367         before the formatted message.
8368         (Errors::undefined_symbol): Take location as a string, rather
8369         than calculating it from a relocation.
8370         (gold_undefined_symbol_at_location): New function akin to
8371         old gold_undefined_symbol, calculates location from relocation.
8372         (gold_undefined_symbol): Change to take only a Symbol pointer
8373         and to report location as the file name associated with the symbol.
8374         * testsuite/debug_msg.sh: Update for changed error messages.
8375         * testsuite/undef_symbol.sh: Likewise.
8376
8377 2009-02-04  Duncan Sands  <baldrick@free.fr>
8378
8379         PR 9812
8380         * reduced_debug_output.h
8381         (Output_reduced_debug_abbrev_section::failed): Use format for
8382         gold_warning.
8383         (Output_reduced_debug_info_section::faild): Likewise.
8384
8385 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8386
8387         * script.cc (Lazy_demangler): New class.
8388         (Version_script_info::get_symbol_version_helper): Demangle a
8389         symbol only once.
8390
8391 2009-01-29  Cary Coutant  <ccoutant@google.com>
8392
8393         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8394         to __tls_get_addr.
8395         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8396
8397 2009-01-28  Ian Lance Taylor  <iant@google.com>
8398
8399         * version.cc (version_string): Bump to 1.9.
8400
8401         * gold.h: Include <cstring> and <stdint.h>.
8402         * version.cc: Include <cstdio>.
8403         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8404         warning.
8405         * reduced_debug_output.cc (insert_into_vector): Rename from
8406         Insert_into_vector; change all callers.  Use Swap_unaligned to
8407         avoid aliasing issue; remove union since it is unnecessary.
8408
8409 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8410
8411         * Makefile.am (CCFILES): Add gc.cc.
8412         (HFILES): Add gc.h.
8413         * Makefile.in: Regenerate.
8414         * gold.cc (Gc_runner): New class.
8415         (queue_initial_tasks): Call garbage collection related tasks
8416         when corresponding options are invoked.
8417         (queue_middle_gc_tasks): New function.
8418         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8419         processed early before laying out sections during garbage collection.
8420         * gold.h (queue_middle_gc_tasks): New function.
8421         (is_prefix_of): Move from "layout.cc".
8422         * i386.cc (Target_i386::gc_process_relocs): New function.
8423         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8424         * main.cc (main): Create object of class "Garbage_collection".
8425         * object.cc (Relobj::copy_symbols_data): New function.
8426         (Relobj::is_section_name_included): New function.
8427         (Sized_relobj::do_layout): Allow this function to be called twice
8428         during garbage collection and defer layout of section during the
8429         first call.
8430         * object.h (Relobj::get_symbols_data): New function.
8431         (Relobj::is_section_name_included): New function.
8432         (Relobj::copy_symbols_data): New function.
8433         (Relobj::set_symbols_data): New function.
8434         (Relobj::get_relocs_data): New function.
8435         (Relobj::set_relocs_data): New function.
8436         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8437         (Relobj::gc_process_relocs): New function.
8438         (Relobj::do_gc_process_relocs): New pure virtual function.
8439         (Relobj::sd_): New data member.
8440         (Sized_relobj::is_output_section_offset_invalid): New function.
8441         (Sized_relobj::do_gc_process_relocs): New function.
8442         * options.h (General_options::gc_sections): Modify to not be a no-op.
8443         (General_options::print_gc_sections): New option.
8444         * plugin.cc (Plugin_finish::run): Remove function call to
8445         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8446         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8447         * reloc.cc (Read_relocs::run): Add task to process relocs and
8448         determine unreferenced sections when doing garbage collection.
8449         (Gc_process_relocs): New class.
8450         (Sized_relobj::do_gc_process_relocs): New function.
8451         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8452         sections that are garbage collected.
8453         * reloc.h (Gc_process_relocs): New class.
8454         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8455         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8456         symbols whose corresponding sections are garbage collected.
8457         (Symbol_table::Symbol_table): Add new parameter for the garbage
8458         collection object.
8459         (Symbol_table::gc_mark_undef_symbols): New function.
8460         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8461         (Symbol_table::gc_mark_dyn_syms): New function.
8462         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8463         as garbage.
8464         (Symbol_table::add_from_object): Likewise.
8465         (Symbol_table::add_from_relobj): When building shared objects, do not
8466         treat externally visible symbols as garbage.
8467         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8468         table information for static and relocatable links.
8469         * symtab.h (Symbol_table::set_gc): New function.
8470         (Symbol_table::gc): New function.
8471         (Symbol_table::gc_mark_undef_symbols): New function.
8472         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8473         (Symbol_table::gc_mark_dyn_syms): New function.
8474         (Symbol_table::gc_): New data member.
8475         * target.h (Sized_target::gc_process_relocs): New pure virtual
8476         function.
8477         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8478         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8479
8480 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8481
8482         * options.h (General_options::gc_sections): Define as a no-op for now.
8483         (General_options::no_keep_memory): Ditto.
8484         (General_options::Bshareable): Define.
8485         * options.cc (General_options::finalize): Honor -Bshareable.
8486
8487 2009-01-20  Andreas Schwab  <schwab@suse.de>
8488
8489         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8490         read the value in the contents, since we don't use it.  Use the
8491         template endianness when writing.
8492         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8493
8494 2009-01-19  Andreas Schwab  <schwab@suse.de>
8495
8496         * configure.tgt (powerpc64-*): Fix targ_obj.
8497
8498 2009-01-15  Ian Lance Taylor  <iant@google.com>
8499
8500         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8501         local symbols when stripping all symbols.
8502
8503 2009-01-14  Cary Coutant  <ccoutant@google.com>
8504
8505         * output.cc (Output_reloc): Add explicit instantiations.
8506
8507 2009-01-14  Cary Coutant  <ccoutant@google.com>
8508
8509         * archive.cc (Archive::get_elf_object_for_member): Remove call
8510         to File_read::claim_for_plugin.
8511         * descriptors.cc (Descriptors::open): Remove reference to
8512         is_claimed.
8513         (Descriptors::claim_for_plugin): Remove.
8514         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8515         (Descriptors::is_claimed): Remove.
8516         (claim_descriptor_for_plugin): Remove.
8517         * fileread.cc (File_read::claim_for_plugin): Remove.
8518         * fileread.h (File_read::claim_for_plugin): Remove.
8519         (File_read::descriptor): Reopen descriptor if necessary.
8520         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8521         (Plugin_manager::all_symbols_read): Add task parameter. Change
8522         all callers.
8523         (Plugin_manager::get_input_file): New function.
8524         (Plugin_manager::release_input_file): New function.
8525         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8526         corresponding data member.
8527         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8528         and pass to base constructor. Change all callers.
8529         (get_input_file, release_input_file): New functions.
8530         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8531         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8532         (Plugin_manager::all_symbols_read): Add task parameter.
8533         (Plugin_manager::get_input_file): New function.
8534         (Plugin_manager::release_input_file): New function.
8535         (Plugin_manager::task_): New data member.
8536         (Pluginobj::Pluginobj): Add filesize parameter.
8537         (Pluginobj::filename): New function.
8538         (Pluginobj::descriptor): New function.
8539         (Pluginobj::filesize): New function.
8540         (Pluginobj::filesize_): New data member.
8541         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8542         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8543         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8544
8545         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8546         with archive libraries.
8547         * testsuite/Makefile.in: Regenerate.
8548         * testsuite/plugin_test.c (struct sym_info): New type.
8549         (get_input_file, release_input_file): New static variables.
8550         (onload): Capture new transfer vector entries.
8551         (claim_file_hook): Stop reading at end of file according to filesize.
8552         Factor out parsing of readelf output into separate function.
8553         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8554         APIs and get the source file name from the symbol table.  Convert
8555         source file name to corresponding object file name.  Print info
8556         message when adding new input files.
8557         (parse_readelf_line): New function.
8558         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8559         * testsuite/plugin_test_2.sh: Likewise.
8560         * testsuite/plugin_test_3.sh: Likewise.
8561         * testsuite/plugin_test_4.sh: New test case.
8562
8563 2009-01-07  Ian Lance Taylor  <iant@google.com>
8564
8565         * version.cc (version_string): Bump to 1.8.
8566
8567 2008-12-23  Cary Coutant  <ccoutant@google.com>
8568
8569         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8570         * plugin.cc (Plugin_manager::finish): Rename as
8571         layout_deferred_objects.  Move cleanup to separate function.
8572         (Plugin_manager::cleanup): New function.
8573         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8574         separately.
8575         * plugin.h (Plugin_manager::finish): Rename as
8576         layout_deferred_objects.
8577         (Plugin_manager::cleanup): New function.
8578         (Plugin_manager::cleanup_done): New field.
8579
8580 2008-12-23  Cary Coutant  <ccoutant@google.com>
8581
8582         * plugin.cc (is_visible_from_outside): New function.
8583         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8584         so we don't return "IR only" status for exported symbols or -r links.
8585
8586         * testsuite/Makefile.am (plugin_test_3): New test case.
8587         * testsuite/Makefile.in: Regenerate.
8588         * testsuite/plugin_test_3.sh: New file.
8589
8590 2008-12-22  Cary Coutant  <ccoutant@google.com>
8591
8592         * object.cc (Sized_relobj::layout_section): New function.
8593         (Sized_relobj::do_layout): Defer layout of input sections until after
8594         plugin has provided replacement files.
8595         (Sized_relobj::do_layout_deferred_sections): New function.
8596         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8597         (Relobj::layout_deferred_sections): New function.
8598         (Relobj::do_layout_deferred_sections): New function.
8599         (Sized_relobj::do_layout_deferred_sections): New function.
8600         (Sized_relobj::layout_section): New function.
8601         (Sized_relobj::Deferred_layout): New structure.
8602         (Sized_relobj::deferred_layout_): New field.
8603         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8604         Change all callers.  Layout deferred sections.
8605         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8606         references.
8607         (Plugin_hook::run): Move code from do_plugin_hook inline.
8608         (Plugin_hook::do_plugin_hook): Remove.
8609         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8610         (Plugin_manager::finish): Renamed, was cleanup.
8611         (Plugin_manager::should_defer_layout): New function.
8612         (Plugin_manager::add_deferred_layout_object): New function.
8613         (Plugin_manager::Deferred_layout_list): New type.
8614         (Plugin_manager::deferred_layout_objects_): New field.
8615         (Plugin_hook::do_plugin_hook): Remove.
8616
8617 2008-12-17  Ian Lance Taylor  <iant@google.com>
8618
8619         * options.h (class General_options): Add --no case for
8620         --export-dynamic.
8621
8622 2008-12-16  Cary Coutant  <ccoutant@google.com>
8623
8624         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8625         vector.
8626         (Plugin_manager::claim_file): Create plugin object even if
8627         plugin did not call the add_symbols callback.
8628         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8629         asking for more symbols than were added.
8630         * testsuite/Makefile.am (plugin_test_1): Add test case with
8631         no global symbols.
8632         (empty.syms): New target.
8633         * testsuite/Makefile.in: Regenerate.
8634         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8635         message. Don't call add_symbols if no globals.
8636         (all_symbols_read_hook): Don't provide replacement for empty
8637         claimed file.
8638
8639 2008-12-12  Ian Lance Taylor  <iant@google.com>
8640
8641         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8642         r_type == 0 for a local symbol with r_sym == 0.
8643         (scan_relocatable_relocs): Pass r_sym to
8644         local_non_section_strategy.
8645         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8646         r_sym parameter.
8647
8648         * configure.ac: Update test for TLS descriptors: they are
8649         supported as of glibc 2.9.
8650         * configure: Rebuild.
8651
8652 2008-12-11  Ian Lance Taylor  <iant@google.com>
8653
8654         PR 7091
8655         * target-reloc.h (Default_scan_relocatable_relocs): For each
8656         function, map r_type == 0 to RELOC_DISCARD.
8657
8658 2008-12-10  Cary Coutant  <ccoutant@google.com>
8659
8660         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8661         object to override a kept COMDAT group from a plugin object.
8662
8663 2008-12-09  Ian Lance Taylor  <iant@google.com>
8664
8665         PR 7088
8666         * yyscript.y (file_cmd): Handle INPUT.
8667
8668         * testsuite/initpri1.c: Change all declarations to be full
8669         prototypes by adding void, to avoid compiler warnings.
8670
8671 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8672
8673         * options.cc (General_options::parse_plugin_opt): New.
8674         (General_options::add_plugin): The argument now is just the filename.
8675         (General_options::add_plugin_option): New.
8676         * options.h (plugin_opt): New.
8677         (add_plugin): Change argument name.
8678         (add_plugin_option): New.
8679         * plugin.cc (Plugin::load): Don't parse the plugin option.
8680         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8681         (Plugin::add_option): New.
8682         (Plugin::args_): Change type.
8683         (Plugin::filename_): New.
8684         (Plugin_manager::add_plugin_option): New.
8685         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8686         * testsuite/Makefile.in: Regenerate.
8687
8688 2008-12-05  Cary Coutant  <ccoutant@google.com>
8689
8690         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8691         Handle --strip-lto-sections option.
8692         * options.h (strip_lto_sections): New option.
8693
8694 2008-12-01  Cary Coutant  <ccoutant@google.com>
8695
8696         * plugin.cc (ld_plugin_message): Change format parameter to const.
8697         Fix mismatch between new[] and delete.
8698
8699 2008-11-14  Cary Coutant  <ccoutant@google.com>
8700
8701         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8702         instead of -1U.
8703
8704 2008-11-05  Craig Silverstein  <csilvers@google.com>
8705
8706         * options.cc (General_options::parse_dynamic_list): New function.
8707         * options.h (General_options): New flags dynamic_list,
8708         dynamic_list_data, dynamic_list_cpp_new, and
8709         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8710         (General_options::in_dynamic_list): New function.
8711         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8712         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8713         (Lex::can_continue_name): Likewise.
8714         (yylex): Likewise.
8715         (read_script_file): New parameter script_options.
8716         (read_dynamic_list): New function.
8717         (Script_options::define_dynamic_list): New function.
8718         (dynamic_list_keyword_parsecodes): New variable.
8719         (dynamic_list_keywords): New variable.
8720         * script.h (Script_options::define_dynamic_list): New function
8721         prototype.
8722         (read_dynamic_list): New function prototype.
8723         * symtab.cc (strprefix): New macro.
8724         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8725         dynamic_list_data, dynamic_list_cpp_new, and
8726         dynamic_list_cpp_typeinfo.
8727         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8728         (dynamic_list_expr): New rule.
8729         (dynamic_list_nodes): Likewise.
8730         (dynamic_list_node): Likewise.
8731         * testsuite/Makefile.am (dynamic_list): New test.
8732         * testsuite/Makefile.in: Regenerated.
8733         * testsuite/dynamic_list.t: New file.
8734         * testsuite/dynamic_list.sh: New file.
8735
8736 2008-11-05  Craig Silverstein  <csilvers@google.com>
8737
8738         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8739         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8740         (t11_last): Likewise.
8741         * testsuite/ver_test_6.c (main): Likewise.
8742
8743 2008-10-07  Cary Coutant  <ccoutant@google.com>
8744
8745         * options.c (General_options::finalize): Add check for -static and
8746         -shared.
8747         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8748         is not empty.
8749
8750 2008-10-02  Cary Coutant  <ccoutant@google.com>
8751
8752         * plugin.cc (make_sized_plugin_object): Fix conditional
8753         compilation to work when not all targets are enabled.
8754
8755 2008-09-29  Cary Coutant  <ccoutant@google.com>
8756
8757         * archive.cc (Archive::get_file_and_offset): Use filename instead
8758         of name to get library path.
8759         (Archive::include_member): Unlock external member of a thin archive.
8760
8761         * testsuite/Makefile.am (TEST_AR): New variable.
8762         (thin_archive_test_1): New test.
8763         (thin_archive_test_2): New test.
8764         * testsuite/Makefile.in: Regenerate.
8765         * testsuite/thin_archive_main.cc: New file.
8766         * testsuite/thin_archive_test_1.cc: New file.
8767         * testsuite/thin_archive_test_2.cc: New file.
8768         * testsuite/thin_archive_test_3.cc: New file.
8769         * testsuite/thin_archive_test_4.cc: New file.
8770
8771 2008-09-29  Cary Coutant  <ccoutant@google.com>
8772
8773         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8774         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8775         instead of -1U.
8776         (Sized_relobj::do_finalize_local_symbols): Likewise.
8777         (Sized_relobj::map_to_kept_section): Likewise.
8778         * object.h (Sized_relobj::invalid_address): New constant.
8779         (Sized_relobj::do_output_section_offset): Check for invalid_address
8780         and return -1ULL.
8781         * output.cc (Output_reloc::local_section_offset): Use constant
8782         invalid_address instead of -1U.
8783         (Output_reloc::get_address): Likewise.
8784         (Output_section::output_address): Change -1U to -1ULL.
8785         * output.h (Output_reloc::invalid_address): New constant.
8786         * reloc.cc (Sized_relobj::write_sections): Use constant
8787         invalid_address instead of -1U.
8788         (Sized_relobj::relocate_sections): Likewise.
8789         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8790         values for merge sections.
8791         * target-reloc.h (relocate_for_relocatable): Use constant
8792         invalid_address instead of -1U.
8793
8794 2008-09-19  Cary Coutant  <ccoutant@google.com>
8795
8796         Add plugin functionality for link-time optimization (LTO).
8797         * configure.ac (plugins): Add --enable-plugins option.
8798         * configure: Regenerate.
8799         * config.in: Regenerate.
8800         * Makefile.am (LIBDL): New variable.
8801         (CCFILES): Add plugin.cc.
8802         (HFILES): Add plugin.h.
8803         (ldadd_var): Add LIBDL.
8804         * Makefile.in: Regenerate.
8805
8806         * archive.cc: Include "plugin.h".
8807         (Archive::setup): Don't preread archive symbols when using a plugin.
8808         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8809         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8810         files.
8811         (Archive::include_member): Add symbols from plugin objects.
8812         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8813         * descriptors.cc (Descriptors::open): Check for file descriptors
8814         abandoned by plugins.
8815         (Descriptors::claim_for_plugin): New function.
8816         * descriptors.h (Descriptors::claim_for_plugin): New function.
8817         (Open_descriptor::is_claimed): New field.
8818         (claim_descriptor_for_plugin): New function.
8819         * fileread.cc (File_read::claim_for_plugin): New function.
8820         * fileread.h (File_read::claim_for_plugin): New function.
8821         (File_read::descriptor): New function.
8822         * gold.cc: Include "plugin.h".
8823         (queue_initial_tasks): Add task to call plugin hooks for generating
8824         new object files.
8825         * main.cc: Include "plugin.h".
8826         (main): Load plugin libraries.
8827         * object.h (Pluginobj): Declare.
8828         (Object::pluginobj): New function.
8829         (Object::do_pluginobj): New function.
8830         (Object::set_target): New function.
8831         * options.cc: Include "plugin.h".
8832         (General_options::parse_plugin): New function.
8833         (General_options::General_options): Initialize plugins_ field.
8834         (General_options::add_plugin): New function.
8835         * options.h (Plugin_manager): Declare.
8836         (General_options): Add --plugin option.
8837         (General_options::has_plugins): New function.
8838         (General_options::plugins): New function.
8839         (General_options::add_plugin): New function.
8840         (General_options::plugins_): New field.
8841         * plugin.cc: New file.
8842         * plugin.h: New file.
8843         * readsyms.cc: Include "plugin.h".
8844         (Read_symbols::do_read_symbols): Check for archive before checking
8845         for ELF file.  Call plugin hooks to claim files.
8846         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8847         from a real object file; force override when processing replacement
8848         files.
8849         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8850         (Symbol::init_base_object): Likewise.
8851         (Symbol::init_base_output_data): Likewise.
8852         (Symbol::init_base_output_segment): Likewise.
8853         (Symbol::init_base_constant): Likewise.
8854         (Symbol::init_base_undefined): Likewise.
8855         (Symbol::output_section): Assert that object is not a plugin.
8856         (Symbol_table::add_from_pluginobj): New function.
8857         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8858         undefined.
8859         (Symbol_table::sized_write_globals): Likewise.
8860         (Symbol_table::add_from_pluginobj): Instantiate template.
8861         * symtab.h (Sized_pluginobj): Declare.
8862         (Symbol::in_real_elf): New function.
8863         (Symbol::set_in_real_elf): New function.
8864         (Symbol::in_real_elf_): New field.
8865         (Symbol_table::add_from_pluginobj): New function.
8866
8867         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8868         (LIBDL): New variable.
8869         (LDADD): Add LIBDL.
8870         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8871         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8872         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8873         (MOSTLYCLEANFILES): Likewise.
8874         * testsuite/Makefile.in: Regenerate.
8875         * testsuite/plugin_test.c: New file.
8876         * testsuite/plugin_test_1.sh: New file.
8877         * testsuite/plugin_test_2.sh: New file.
8878
8879 2008-09-16  Ian Lance Taylor  <iant@google.com>
8880
8881         * target-reloc.h (relocate_section): Check whether a symbol is
8882         defined by the ABI before reporting an undefined symbol error.
8883         * target.h (Target::is_defined_by_abi): Make parameter const.
8884         (Target::do_is_defined_by_abi): Likewise.
8885         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8886         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8887         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8888         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8889         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8890         * testsuite/Makefile.in: Rebuild.
8891
8892         * fileread.cc (make_view): Add casts to avoid warning.
8893
8894 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8895
8896         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8897         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8898
8899 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8900
8901         * options.h (General_options::output_is_executable): New.
8902         (General_options::output_is_pie): New.
8903         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8904         for shared libraries.
8905         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8906
8907 2008-09-11  Chris Demetriou  <cgd@google.com>
8908
8909         * options.h (origin): New -z option.
8910         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8911         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8912         in DT_FLAGS_1.
8913
8914 2008-09-05  Cary Coutant  <ccoutant@google.com>
8915
8916         * fileread.cc (File_read::make_view): Add check for attempt to map
8917         beyond end of file.
8918
8919 2008-09-05  Cary Coutant  <ccoutant@google.com>
8920
8921         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8922         explicit instantiations.
8923
8924 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
8925
8926         PR gold/6858
8927         * options.cc (General_options::finalize): Allow undefined symbols
8928         in shlibs if linking -shared.
8929
8930         PR gold/6859
8931         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8932         symbols as not needing a dynsym entry.
8933
8934 2008-08-20  Craig Silverstein  <csilvers@google.com>
8935
8936         * fileread.cc (File_read::open): Do not lock the file unless it
8937         was successfully opened.
8938
8939 2008-08-14  Cary Coutant  <ccoutant@google.com>
8940
8941         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8942         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8943         * testsuite/tls_test.cc (struct int128): 128-bit struct
8944         for testing TLS relocs with non-zero addend.
8945         (v12): New TLS variable.
8946         (t12): New test.
8947         (t_last): Add check for v12.
8948         * testsuite/tls_test.h (t12): New function.
8949         * testsuite/tls_test_main.cc (thread_routine): Call new test.
8950
8951 2008-08-13  Ian Lance Taylor  <iant@google.com>
8952
8953         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8954         set tls_segment_ or relro_segment_.
8955         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8956         when appropriate.
8957         * output.h (Output_section::clear_is_relro): New function.
8958         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8959         sections specially even when output_data_ is empty.
8960         (Output_segment::maximum_alignment): When first section is relro,
8961         only force alignment for PT_LOAD segments.
8962         * script.cc (script_data_segment_align): New function.
8963         (script_data_segment_relro_end): New function.
8964         * script-c.h (script_data_segment_align): Declare.
8965         (script_data_segment_relro_end): Declare.
8966         * script-sections.h (class Script_sections): Declare
8967         data_segment_align and data_segment_relro_end.  Add fields
8968         segment_align_index_ and saw_relro_end_.
8969         * script-sections.cc (class Sections_element): Add set_is_relro
8970         virtual function.  Add new bool* parameter to place_orphan_here.
8971         Add get_output_section virtual function.
8972         (class Output_section_definition): Add set_is_relro.  Add new
8973         bool* parameter to place_orphan_here.  Add get_output_section.
8974         Add is_relro_ field.
8975         (Output_section_definition::Output_section_definition): Initialize
8976         evaluated_address_, evaluated_load_address, evaluated_addralign_,
8977         and is_relro_ fields.
8978         (Output_section_definition::place_orphan_here): Add is_relro
8979         parameter.
8980         (Output_section_definition::set_section_addresses): Set relro for
8981         output section.
8982         (Output_section_definition::alternate_constraint): Likewise.
8983         (class Orphan_output_section): Add new bool* parameter to
8984         place_orphan_here.  Add get_output_section.
8985         (Orphan_output_section::place_orphan_here): Add is_relro
8986         parameter.
8987         (Script_sections::Script_sections): Initialize
8988         data_segment_align_index_ and saw_relro_end_.
8989         (Script_sections::data_segment_align): New function.
8990         (Script_sections::data_segment_relro_end): New function.
8991         (Script_sections::place_orphan): Set or clear is_relro.
8992         (Script_sections::set_section_addresses): Force alignment of first
8993         TLS section.
8994         * yyscript.y (exp): Call script_data_segment_align and
8995         script_data_segment_relro_end.
8996         * testsuite/relro_script_test.t: New file.
8997         * testsuite/relro_test.cc (using_script): Declare.
8998         (t1, t2): Test using_script.
8999         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9000         (relro_script_test_SOURCES): Define.
9001         (relro_script_test_DEPENDENCIES): Define.
9002         (relro_script_test_LDFLAGS): Define.
9003         (relro_script_test_LDADD): Define.
9004         (relro_script_test.so): New target.
9005         * testsuite/Makefile.in: Rebuild.
9006
9007 2008-08-06  Cary Coutant <ccoutant@google.com>
9008
9009         * archive.cc (Archive::total_archives, Archive::total_members)
9010         (Archive::total_members_loaded): New variables.
9011         (Archive::setup): Add parameter.  Add option to preread
9012         archive symbols.
9013         (Archive::read_armap): Add counter.
9014         (Archive::get_file_and_offset): New function.
9015         (Archive::get_elf_object_for_member): New function.
9016         (Archive::read_all_symbols): New function.
9017         (Archive::read_symbols): New function.
9018         (Archive::add_symbols): Add counters.
9019         (Archive::include_all_members): Use armap to find members if it's
9020         already built.
9021         (Archive::include_member): Skip reading symbols if already read.
9022         Factored code into Archive::get_file_and_offset and
9023         Archive::get_elf_object_for_member.  Changed call to
9024         Mapfile::report_include_archive_member.
9025         (Archive::print_stats): New function.
9026         * archive.h: Declare Object and Read_symbols_data classes.
9027         (Archive::Archive): Add initializers for new members.
9028         (Archive::setup): Add parameter.
9029         (Archive::print_stats): New function.
9030         (Archive::total_archives, Archive::total_members)
9031         (Archive::total_members_loaded): New variables.
9032         (Archive::get_file_and_offset): New function.
9033         (Archive::get_elf_object_for_member): New function.
9034         (Archive::read_all_symbols): New function.
9035         (Archive::read_symbols): New function.
9036         (Archive::Archive_member): New class.
9037         (Archive::members_): New member.
9038         (Archive::num_members_): New member.
9039         * main.cc: Include archive.h.
9040         (main): Call Archive::print_stats.
9041         * mapfile.cc (Mapfile::report_include_archive_member): Delete
9042         archive parameter; member_name is now the fully-decorated name.
9043         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9044         * options.h: (General_options): Add --preread-archive-symbols option.
9045         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9046         Archive::setup.
9047
9048 2008-08-04  Ian Lance Taylor  <iant@google.com>
9049
9050         * symtab.h (Symbol::use_plt_offset): New function.
9051         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9052         * powerpc.cc (Relocate::relocate): Likewise.
9053         * sparc.cc (Relocate::relocate): Likewise.
9054         * x86_64.cc (Relocate::relocate): Likewise.
9055         * testsuite/weak_plt.sh: New test.
9056         * testsuite/weak_plt_main.cc: New test.
9057         * testsuite/weak_plt_shared.cc: New test.
9058         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9059         (check_PROGRAMS): Add weak_plt.
9060         (check_DATA): Add weak_plt_shared.so.
9061         (weak_plt_main_pic.o, weak_plt): New targets.
9062         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9063         * testsuite/Makefile.in: Rebuild.
9064
9065         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9066         gcctestdir/ld.
9067         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9068         * testsuite/Makefile.in: Rebuild.
9069
9070 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
9071
9072         * Makefile.am (POTFILES.in): Set LC_ALL=C.
9073         * Makefile.in: Regenerate.
9074         * po/POTFILES.in: Regenerate.
9075
9076 2008-07-29  Ian Lance Taylor  <iant@google.com>
9077
9078         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9079         symbols before other symbols.
9080         * testsuite/script_test_2.cc (test_addr): Declare.
9081         (test_addr_alias): Declare.
9082         (main): Check that test_addr and test_addr_alias have the right
9083         values.
9084         * testsuite/script_test_2.t: Define test_addr_alias and
9085         test_addr.
9086
9087 2008-07-24  Ian Lance Taylor  <iant@google.com>
9088
9089         PR 5990
9090         * descriptors.cc: New file.
9091         * descriptors.h: New file.
9092         * gold-threads.h (class Hold_optional_lock): New class.
9093         * fileread.cc: Include "descriptors.h".
9094         (File_read::~File_read): Release descriptor rather than closing
9095         it.
9096         (File_read::open) [file]: Call open_descriptor rather than open.
9097         Set is_descriptor_opened_.
9098         (File_read::open) [memory]: Assert that descriptor is not open.
9099         (File_read::reopen_descriptor): New function.
9100         (File_read::release): Release descriptor.
9101         (File_read::do_read): Make non-const.  Reopen descriptor.
9102         (File_read::read): Make non-const.
9103         (File_read::make_view): Reopen descriptor.
9104         (File_read::do_readv): Likewise.
9105         * fileread.h (class File_read): Add is_descriptor_opened_ field.
9106         Update declarations.
9107         * layout.cc: Include "descriptors.h".
9108         (Layout::create_build_id): Use open_descriptor rather than open.
9109         * output.cc: Include "descriptors.h".
9110         (Output_file::open): Use open_descriptor rather than open.
9111         * archive.cc (Archive::const_iterator): Change Archive to be
9112         non-const.
9113         (Archive::begin, Archive::end): Make non-const.
9114         (Archive::count_members): Likewise.
9115         * archive.h (class Archive): Update declarations.
9116         * object.h (Object::read): Make non-const.
9117         * Makefile.am (CCFILES): Add descriptors.cc.
9118         (HFILES): Add descriptors.h.
9119         * Makefile.in: Rebuild.
9120
9121         PR 6716
9122         * gold.h: Always include <clocale>.  Add Solaris workarounds
9123         following code in binutils/sysdep.h.
9124
9125         PR 6048
9126         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9127         this->eh_frame_hdr_ is NULL before using it.
9128
9129         * dynobj.cc (Versions::Versions): Update comment.
9130
9131         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9132         the base version name.
9133
9134         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9135         array size plus one.
9136         (Stringpool_template::set_string_offsets): Subtract one from key
9137         before using it as an array index.
9138         (Stringpool_template::get_offset_with_length): Likewise.
9139         (Stringpool_template::write_to_buffer): Likewise.
9140         * stringpool.h (Stringpool_template::get_offset_from_key):
9141         Likewise.
9142
9143 2008-07-23  Ian Lance Taylor  <iant@google.com>
9144
9145         PR 6658
9146         * object.h (Merged_symbol_value::value): Do our best to handle a
9147         negative addend.
9148
9149         PR 6647
9150         * script.cc (Version_script_info::get_versions): Don't add empty
9151         version tag to return value.
9152         (Version_script_info::get_symbol_version_helper): Change return
9153         type to bool.  Add pversion parameter.  Change all callers.
9154         (script_register_vers_node): Don't require a non-NULL tag.
9155         * script.h (class Version_script_info): Update declarations.
9156         (Version_script_info::get_symbol_version): Change return type to
9157         bool.  Add version parameter.  Change all callers.
9158         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9159         handling.  Handle an empty version from a version script.
9160         (Symbol_table::define_special_symbol): Likewise.
9161         * testsuite/ver_test_10.script: New file.
9162         * testsuite/ver_test_10.sh: New file.
9163         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9164         (check_DATA): Add ver_test_10.syms.
9165         (ver_test_10.syms, ver_test_10.so): New target.
9166         * testsuite/Makefile.in: Rebuild.
9167
9168 2008-07-23  Simon Baldwin  <simonb@google.com>
9169
9170         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9171         to zero for undefined symbols from dynamic libraries.
9172
9173 2008-07-23  Ian Lance Taylor  <iant@google.com>
9174
9175         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9176         Change all callers.
9177         * symtab.h (class Symbol_table): Update declaration.
9178         * testsuite/ver_test_9.cc: New file.
9179         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9180         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9181         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9182         (ver_test_9.so, ver_test_9.o): New targets.
9183         * testsuite/Makefile.in: Rebuild.
9184
9185 2008-07-22  Ian Lance Taylor  <iant@google.com>
9186
9187         * options.h (class General_options): Define --check-sections.
9188         * layout.cc (Layout::set_segment_offsets): Handle
9189         --check-sections.
9190
9191         * options.h (class General_options): Define -n/--nmagic and
9192         -N/--omagic.
9193         * options.cc (General_options::finalize): For -n/--nmagic or
9194         -N/--omagic, set -static.
9195         * layout.cc (Layout::attach_allocated_section_to_segment): If
9196         -N/--omagic, don't put read-only and read-write sections in
9197         different segments.
9198         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9199         finding a read-only segment.
9200         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9201         don't set the minimum segment alignment to the common page size,
9202         and don't set the file offset to the address modulo the page size.
9203         * script-sections.cc (Script_sections::create_segments): If
9204         -n/--omagic, don't put read-only and read-write sections in
9205         different segments.
9206
9207         * cref.cc: New file.
9208         * cref.h: New file.
9209         * options.h (class General_options): Add --print-symbol-counts.
9210         * main.cc (main): Issue defined symbol report if requested.
9211         * archive.cc (Archive::interpret_header): Make into a const member
9212         function.
9213         (Archive::add_symbols): Call Input_objects::archive_start and
9214         archive_stop.
9215         (Archive::const_iterator): Define new class.
9216         (Archive::begin, Archive::end): New functions.
9217         (Archive::include_all_members): Rewrite to use iterator.
9218         (Archive::count_members): New function.
9219         * archive.h (class Archive): Update declarations.
9220         (Archive::filename): New function.
9221         * object.cc: Include "cref.h".
9222         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9223         (Sized_relobj::do_get_global_symbol_counts): New function.
9224         (Input_objects::add_object): Add object to cross-referencer.
9225         (Input_objects::archive_start): New function.
9226         (Input_objects::archive_stop): New function.
9227         (Input_objects::print_symbol_counts): New function.
9228         * object.h: Declare Cref and Archive.
9229         (Object::get_global_symbol_counts): New function.
9230         (Object::do_get_global_symbol_counts): New pure virtual function.
9231         (class Sized_relobj): Add defined_count_ field.  Update
9232         declarations.
9233         (class Input_objects): Add cref_ field.  Update constructor.
9234         Update declarations.
9235         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9236         defined_count_.
9237         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9238         symbol counts.
9239         (Sized_dynobj::do_get_global_symbol_counts): New function.
9240         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9241         defined_count_.  Update declarations.  Define Symbols typedef.
9242         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9243         parameter.  Change all callers.
9244         (Symbol_table::add_from_dynobj): Add sympointers and defined
9245         parameters.  Change all callers.
9246         * symtab.h (class Symbol_table): Update declarations.
9247         * Makefile.am (CCFILES): Add cref.cc.
9248         (HFILES): Add cref.h.
9249         * Makefile.in: Rebuild.
9250
9251 2008-07-22  Simon Baldwin  <simonb@google.com>
9252
9253         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9254         to zero when writing undefined symbols.
9255
9256 2008-07-22  Ian Lance Taylor  <iant@google.com>
9257
9258         * output.cc (Output_section::add_input_section): Don't try to
9259         merge empty merge sections.
9260
9261 2008-07-21  Craig Silverstein  <csilvers@google.com>
9262
9263         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9264         Include symbol version in error message.
9265
9266 2008-07-20  Chris Demetriou  <cgd@google.com>
9267
9268         * configure.ac (gold_cv_c_random_seed): New configured variable.
9269         (RANDOM_SEED_CFLAGS): New substituted variable.
9270         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9271         * configure: Rebuild.
9272         * Makefile.in: Likewise.
9273         * testsuite/Makefile.in: Likewise.
9274
9275 2008-07-18  Ian Lance Taylor  <iant@google.com>
9276
9277         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9278         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9279         * testsuite/ver_test_main.cc (main): Call t4.
9280         (t4, t4_2a): Define.
9281         * testsuite/ver_test_2.cc (t4_2): Define.
9282         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9283         * testsuite/ver_test_4.cc (t4_2a): Define.
9284         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9285         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9286
9287 2008-07-17  Ian Lance Taylor  <iant@google.com>
9288
9289         * dynobj.cc (Versions::add_def): If we give an error about a
9290         missing version, go ahead and create the version anyhow.
9291
9292 2008-07-10  Ian Lance Taylor  <iant@google.com>
9293
9294         Handle output sections with more than 0x7fffffff bytes.
9295         * object.h (class Relobj): Change map_to_output_ to
9296         output_sections_, and just keep a section pointer.  Change all
9297         uses.  Move comdat group support to Sized_relobj.
9298         (Relobj::is_section_specially_mapped): Remove.
9299         (Relobj::output_section): Remove poff parameter.  Change all
9300         callers.
9301         (Relobj::output_section_offset): New function.
9302         (Relobj::set_section_offset): Rewrite.
9303         (Relobj::map_to_output): Remove.
9304         (Relobj::output_sections): New function.
9305         (Relobj::do_output_section_offset): New pure virtual function.
9306         (Relobj::do_set_section_offset): Likewise.
9307         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9308         group support from Relobj.  Update declarations.
9309         (Sized_relobj::get_output_section_offset): New function.
9310         (Sized_relobj::do_output_section_offset): New function.
9311         (Sized_relobj::do_set_section_offset): New function.
9312         * object.cc (Relobj::output_section_address): Remove.
9313         (Sized_relobj::Sized_relobj): Initialize new fields.
9314         (Sized_relobj::include_section_group): Cast find_kept_object to
9315         Sized_relobj.
9316         (Sized_relobj::include_linkonce_section): Likewise.
9317         (Sized_relobj::do_layout): Use separate arrays for output section
9318         and output offset.
9319         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9320         output_sections.
9321         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9322         output_sections and section_offsets.
9323         (Sized_relobj::write_local_symbols): Likewise.
9324         (map_to_kept_section): Compute output address directly.
9325         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9326         output_sections and section_offsets.
9327         (Sized_relobj::write_sections): Likewise.
9328         (Sized_relobj::relocate_sections): Likewise.
9329         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9330         * output.h (class Output_reloc): Update declarations.  Change
9331         u2_.relobj to Sized_relobj*.
9332         (class Output_data_reloc): Change add functions to use
9333         Sized_relobj*.
9334         * output.cc (Output_reloc::Output_reloc): Change relobj to
9335         Sized_relobj*.
9336         (Output_reloc::local_section_offset): Change return type to
9337         Elf_Addr.  Use get_output_section_offset.
9338         (Output_reloc::get_address): Likewise.
9339         (Output_section::is_input_address_mapped): Don't call
9340         is_section_specially_mapped.
9341         (Output_section::output_offset): Likewise.
9342         (Output_section::output_address): Likewise.
9343         (Output_section::starting_output_address): Likewise.
9344         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9345         parameter to Sized_relobj*.
9346         (Copy_relocs::need_copy_reloc): Likewise.
9347         (Copy_relocs::save): Likewise.
9348         * copy-relocs.h (class Copy_relocs): Update declarations.
9349         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9350         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9351         * target-reloc.h (relocate_for_relocatable): Change
9352         offset_in_output_section type to Elf_Addr.  Change code that uses
9353         it as well.
9354         * layout.cc (Layout::layout): Always set *off.
9355         * mapfile.cc (Mapfile::print_input_section): Use
9356         output_section_offset.
9357         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9358         Sized_relobj*.
9359         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9360         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9361         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9362
9363 2008-07-03  Ian Lance Taylor  <iant@google.com>
9364
9365         * layout.cc (Layout::include_section): Do not discard unrecognized
9366         SHT_STRTAB sections.
9367
9368 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9369
9370         * script.cc (Lex::can_continue_name): Make '?' allowable in
9371         version-script names.
9372         * testsuite/version_script.map: Change glob pattern to use '?'
9373
9374 2008-06-30  Manish Singh  <yosh@gimp.org>
9375
9376         PR 6585
9377         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9378         Correct typo.
9379
9380 2008-06-30  Ian Lance Taylor  <iant@google.com>
9381
9382         PR 6660
9383         PR 6682
9384         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9385         versions]: Don't try to read the value in the contents, since we
9386         don't use it.  Use the template endianness when writing.
9387
9388 2008-06-25  Cary Coutant  <ccoutant@google.com>
9389
9390         * fileread.cc (File_read::make_view): Assert on zero-length view.
9391         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9392         symbol table when there are no symbols to read.
9393
9394 2008-06-23  Craig Silverstein  <csilvers@google.com>
9395
9396         * version.cc (version_string): Bump to 1.7
9397
9398 2008-06-18  Craig Silverstein  <csilvers@google.com>
9399
9400         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9401         constant 0xFFFF to type Valtype.
9402         (Powerpc_relocate_functions::rel16_ha): Likewise.
9403
9404 2008-06-17  Ian Lance Taylor  <iant@google.com>
9405
9406         * output.h (Output_section::Input_section): Initialize p2align_ to
9407         zero for Output_section_data constructors.
9408         (Output_section::Input_section::addralign): If not an input
9409         section, return the alignment of the Output_section_data.
9410         * testsuite/copy_test.cc: New file.
9411         * testsuite/copy_test_1.cc: New file.
9412         * testsuite/copy_test_2.cc: New file.
9413         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9414         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9415         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9416         (copy_test_1_pic.o, copy_test_1.so): New targets.
9417         (copy_test_2_pic.o, copy_test_2.so): New targets.
9418         * testsuite/Makefile.in: Rebuild.
9419
9420         * script-sections.cc (Script_sections::place_orphan): Initialize
9421         local variable exact.
9422
9423 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9424
9425         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9426
9427 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9428             David S. Miller  <davem@davemloft.net>
9429
9430         * powerpc.cc: New file.
9431         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9432         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9433         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9434         * Makefile.in: Rebuild.
9435
9436 2008-06-09  Ian Lance Taylor  <iant@google.com>
9437
9438         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9439         <exception>.
9440         (throwing, orig_terminate): New static variables.
9441         (terminate_handler): New static function.
9442         (t2): Set terminate handler.
9443
9444 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9445
9446         PR 6584
9447         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9448         alignment.
9449
9450 2008-05-30  Cary Coutant  <ccoutant@google.com>
9451
9452         * archive.cc (Archive::include_all_members) Correct to step
9453         over symbol table and extended name table in thin archives.
9454
9455 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9456
9457         PR 6407
9458         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9459         calculation.
9460
9461 2008-05-28  Caleb Howe  <cshowe@google.com>
9462
9463         * reduced_debug_output.cc: New file.
9464         * reduced_debug_output.h: New file.
9465         * options.h (class General_options): Add --strip-debug-non-line.
9466         * options.cc (General_options::finalize): Add strip_debug_non_line
9467         to the strip heirarchy.
9468         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9469         fields.
9470         * layout.cc: Include "reduced_debug_output.h".
9471         (Layout::Layout): Initialize new fields.
9472         (line_only_debug_sections): New static array.
9473         (is_lines_only_debug_sections): New static inline function.
9474         (Layout::include_section): Handle --strip-debug-non-line.
9475         (Layout::make_output_section): If --strip-debug-non-line, build
9476         new output sections for .debug_abbrev and .debug_info.
9477         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9478         gold.  Warn about possible overflow.
9479         (read_signed_LEB_128): Likewise.
9480         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9481         (read_signed_LEB_128): Declare.
9482         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9483         (HFILES): Add reduced_debug_output.h.
9484         * Makefile.in: Rebuild.
9485
9486 2008-05-21  Ian Lance Taylor  <iant@google.com>
9487
9488         * mapfile.cc: New file.
9489         * mapfile.h: New file.
9490         * options.h (class General_options): Add -M/--print-map and -Map.
9491         * options.cc (General_options::finalize): Make -M equivalent to
9492         -Map -.
9493         * main.cc: Include <cstdio> and "mapfile.h".
9494         (main): Open mapfile if requested.
9495         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9496         constructor.  Change caller.
9497         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9498         (queue_middle_tasks): Likewise.
9499         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9500         declarations.
9501         * archive.cc: Include "mapfile.h".
9502         (Archive::add_symbols): Add mapfile parameter.  Change all
9503         callers.  Pass mapfile, symbol, and reason to include_member.
9504         (Archive::include_all_members): Add mapfile parameter.  Change all
9505         callers.
9506         (Archive::include_member): Add mapfile, sym, and why parameters.
9507         Change all callers.  Report inclusion to map file.
9508         * archive.h: Include "fileread.h".
9509         (class Archive): Update declarations.
9510         (Archive::file): New const method.
9511         (class Add_archive_symbols): Add mapfile_ field.  Update
9512         constructor.  Change all callers.
9513         * readsyms.h (class Read_symbols): Likewise.
9514         (class Finish_group): Likewise.
9515         (class Read_script): Likewise.
9516         * common.cc: Include "mapfile.h".
9517         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9518         all callers.
9519         (Symbol_table::do_allocate_commons): Likewise.
9520         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9521         symbol allocation to mapfile.
9522         * common.h (class Allocate_commons_task): Add mapfile_ field.
9523         Update constructor.  Change all callers.
9524         * symtab.h (class Symbol_table): Update declarations.
9525         * layout.cc: Include "mapfile.h".
9526         (Layout_task_runner::run): Print information to mapfile.
9527         (Layout::create_gold_note): Change Output_data_fixed_space to
9528         Output_data_zero_fill.
9529         (Layout::create_build_id): Likewise.
9530         (Layout::print_to_mapfile): New function.
9531         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9532         constructor.  Change caller.
9533         (class Layout): Declare print_to_mapfile.
9534         * output.cc (Output_section::Input_section::print_to_mapfile): New
9535         function.
9536         (Output_section::add_input_section): If producing a map, always
9537         add to input_sections_ list.
9538         (Output_section::do_print_to_mapfile): New function.
9539         (Output_segment::print_sections_to_mapfile): New function.
9540         (Output_segment::print_section_list_to_mapfile): New function.
9541         * output.h: Include "mapfile.h".
9542         (Output_data::print_to_mapfile): New function.
9543         (Output_data::do_print_to_mapfile): New virtual function.
9544         (Output_segment_headers::do_print_to_mapfile): New function.
9545         (Output_file_header::do_print_to_mapfile): New function.
9546         (Output_data_const::do_print_to_mapfile): New function.
9547         (class Output_data_const_buffer): Add map_name_ field.  Update
9548         constructor.  Change all callers.  Add do_print_to_mapfile
9549         function.
9550         (class Output_data_fixed_space): Likewise.
9551         (class Output_data_space): Likewise.
9552         (class Output_data_zero_fill): New class.
9553         (Output_data_strtab::do_print_to_mapfile): New function.
9554         (Output_data_reloc_base::do_print_to_mapfile): New function.
9555         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9556         (Output_data_group::do_print_to_mapfile): New function.
9557         (Output_data_got::do_print_to_mapfile): New function.
9558         (Output_data_dynamic::do_print_to_mapfile): New function.
9559         (Output_symtab_xindex::do_print_to_mapfile): New function.
9560         (class Output_section): Declare do_print_to_mapflie.  Declare
9561         print_to_mapfile in Input_section.
9562         (class Output_segment): Declare new functions.
9563         * object.h (Sized_relobj::symbol_count): New function.
9564         * script-sections.cc
9565         (Output_section_element_dot_assignment::set_section_addresses):
9566         Change Output_data_fixed_space to Output_data_zero_fill.
9567         (Output_data_expression::do_print_to_mapfile): New function.
9568         * script.cc (read_input_script): Add mapfile parameter.  Change
9569         all callers.
9570         * script.h (read_input_script): Update declaration.
9571         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9572         (Eh_frame::do_print_to_mapfile): New function.
9573         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9574         (Output_merge_string::do_print_to_mapfile): New function.
9575         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9576         function.
9577         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9578         function.
9579         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9580         function.
9581         * Makefile.am (CCFILES): Add mapfile.cc.
9582         (HFILES): Add mapfile.h.
9583         * Makefile.in: Rebuild.
9584
9585 2008-05-19  Ian Lance Taylor  <iant@google.com>
9586
9587         * options.h (class General_options): Add -z relro.
9588         * layout.cc (Layout::Layout): Initialize relro_segment_.
9589         (Layout::add_output_section_data): Return the output section.
9590         (Layout::make_output_section): Rcognize relro sections and mark
9591         them appropriately.
9592         (Layout::attach_allocated_section_to_segment): Put relro sections
9593         in a PT_GNU_RELRO segment.
9594         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9595         section as relro.
9596         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9597         PT_TLS segments.
9598         (Layout::linkonce_mapping): Map d.rel.ro.local to
9599         .data.rel.ro.local.
9600         (Layout::output_section_name): Us .data.rel.ro.local for any
9601         section which begins with that.
9602         * layout.h (class Layout): Update add_output_section_data
9603         declaration.  Add relro_segment_ field.
9604         * output.cc (Output_section::Output_section): Initialize is_relro_
9605         and is_relro_local_ fields.
9606         (Output_segment::add_output_section): Group relro sections.
9607         (Output_segment::is_first_section_relro): New function.
9608         (Output_segment::maximum_alignment): If there is a relro section,
9609         align the segment to the common page size.
9610         (Output_segment::set_section_addresses): Track whether we are
9611         looking at relro sections.  If the last section is a relro
9612         section, align to the common page size.
9613         (Output_segment::set_section_list_addresses): Add in_relro
9614         parameter.  Change all callers.  Align to the page size when
9615         moving from relro to non-relro section.
9616         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9617         segment.
9618         * output.h (class Output_section): Add is_relro_ and
9619         is_relro_local_ fields.
9620         (Output_section::is_relro): New function.
9621         (Output_section::set_is_relro): New function.
9622         (Output_section::is_relro_local): New function.
9623         (Output_section::set_is_relro_local): New function.
9624         (class Output_segment): Update declarations.
9625         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9626         * sparc.cc (Target_sparc::got_section): Likewise.
9627         * x86_64.cc (Target_x86_64::got_section): Likewise.
9628         * testsuite/relro_test_main.cc: New file.
9629         * testsuite/relro_test.cc: New file.
9630         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9631         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9632         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9633         (relro_test.so, relro_test_pic.o): New targets.
9634         * testsuite/Makefile.in: Rebuild.
9635
9636 2008-05-16  Ian Lance Taylor  <iant@google.com>
9637
9638         * output.cc (Output_segment::add_output_section): Remove front
9639         parameter.
9640         * output.h (class Output_segment): Remove
9641         add_initial_output_section and overloaded add_output_section.
9642         Update declaration of remaining add_output_section.
9643         * layout.cc (Layout::create_interp): Call add_output_section
9644         rather than add_initial_output_section.
9645         (Layout::finish_dynamic_section): Likewise.
9646
9647         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9648         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9649         know the dynamic type.
9650         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9651         field.  Initialize it in constructor.
9652         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9653         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9654         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9655         reloc.
9656
9657         * output.cc (Output_reloc::get_address): Change return type to
9658         Elf_Addr.
9659         * output.h (class Output_reloc): Update get_address declaration.
9660         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9661         for section addresses.
9662
9663 2008-05-09  Ian Lance Taylor  <iant@google.com>
9664
9665         PR 6493
9666         * gold.cc (gold_nomem): Use return value of write.
9667
9668 2008-05-08  Ian Lance Taylor  <iant@google.com>
9669
9670         * symtab.c (Symbol::init_base_output_data): Add version
9671         parameter.  Change all callers.
9672         (Symbol::init_base_output_segment): Likewise.
9673         (Symbol::init_base_constant): Likewise.
9674         (Symbol::init_base_undefined): Likewise.
9675         (Sized_symbol::init_output_data): Likewise.
9676         (Sized_symbol::init_output_segment): Likewise.
9677         (Sized_symbol::init_constant): Likewise.
9678         (Sized_symbol::init_undefined): Likewise.
9679         (Symbol_table::do_define_in_output_data): If the new symbol has a
9680         version, mark it as the default.
9681         (Symbol_table::do_define_in_output_segment): Likewise.
9682         (Symbol_table::do_define_as_constant): Likewise.
9683         * symtab.h (class Symbol): Update declarations.
9684         (class Sized_symbol): Likewise.
9685         * resolve.cc (Symbol::override_version): New function.
9686         (Symbol::override_base): Call override_version.
9687         (Symbol::override_base_with_special): Likewise.
9688         * testsuite/ver_script_8.script: New file.
9689         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9690         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9691         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9692         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9693
9694 2008-05-06  Ian Lance Taylor  <iant@google.com>
9695
9696         PR 6049
9697         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9698         functions.
9699         (class General_options): Remove existing --undefined, and add
9700         --no-undefined instead.  Add new --undefined as synonym for -u.
9701         * archive.cc (Archive::add_symbols): Check whether symbol was
9702         named with -u.
9703         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9704         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9705         all uses.  Add IS_UNDEFINED.  Update declarations to split
9706         different versions of init_base.  Declare init_base_undefined.
9707         (Symbol::is_defined): Handle IS_UNDEFINED.
9708         (Symbol::is_undefined): Likewise.
9709         (Symbol::is_weak_undefined): Call is_undefined.
9710         (Symbol::is_absolute): Handle IS_CONSTANT.
9711         (class Sized_symbol): Update declarations to split different
9712         versions of init.  Declare init_undefined.
9713         (class Symbol_table): Declare new functions.
9714         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9715         Change all callers.
9716         (Symbol::init_base_output_data): Likewise.
9717         (Symbol::init_base_output_segment): Likewise.
9718         (Symbol::init_base_constant): Likewise.
9719         (Symbol::init_base_undefined): New function.
9720         (Sized_symbol::init_object): Rename from init.  Change all
9721         callers.
9722         (Sized_symbol::init_output_data): Likewise.
9723         (Sized_symbol::init_output_segment): Likewise.
9724         (Sized_symbol::init_constant): Likewise.
9725         (Sized_symbol::init_undefined): New function.
9726         (Symbol_table::add_undefined_symbols_from_command_line): New
9727         function.
9728         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9729         function.
9730         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9731         (Symbol::output_section): Likewise.
9732         (Symbol::set_output_section): Likewise.
9733         (Symbol_table::sized_finalize_symbol): Likewise.
9734         (Symbol_table::sized_write_globals): Likewise.
9735         * resolve.cc (Symbol_table::should_override): Likewise.
9736         (Symbol::override_base_with_special): Likewise.
9737
9738         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9739         symbol, change it to have default visibility.
9740         * testsuite/protected_1.cc: New file.
9741         * testsuite/protected_2.cc: New file.
9742         * testsuite/protected_3.cc: New file.
9743         * testsuite/protected_main_1.cc: New file.
9744         * testsuite/protected_main_2.cc: New file.
9745         * testsuite/protected_main_3.cc: New file.
9746         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9747         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9748         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9749         (protected_1.so): New target.
9750         (protected_1_pic.o, protected_2_pic.o): New targets.
9751         (protected_3_pic.o): New target.
9752         (check_PROGRAMS): Add protected_2.
9753         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9754         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9755         * testsuite/Makefile.in: Rebuild.
9756
9757         * options.h (DEFINE_var): Add set_user_set_##varname__.
9758         (DEFINE_bool_alias): New macro.
9759         (class General_options): Define -Bstatic using DEFINE_bool_alias
9760         rather than DEFINE_special.  Add --undefined as an alias for -z
9761         defs.
9762         * options.cc (General_options::parse_Bstatic): Remove.
9763
9764         * options.h (class General_options): Add --fatal-warnings.
9765         * main.cc (main): Implement --fatal-warnings.
9766         * errors.h (Errors::warning_count): New function.
9767
9768         * options.h (class General_options): Add -Bsymbolic-functions.
9769         * symtab.h (Symbol::is_preemptible): Check for
9770         -Bsymbolic-functions.
9771
9772 2008-05-05  Ian Lance Taylor  <iant@google.com>
9773
9774         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9775         as noVARNAME rather than no-VARNAME.
9776         (class General_options): Add option -z combreloc.
9777         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9778         get_address.
9779         (Output_reloc::sort_before) [SHT_REL]: New function.
9780         (Output_reloc::sort_before) [SHT_RELA]: New function.
9781         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9782         Sort_relocs_comparison.
9783         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9784         parameter.  Change all callers.
9785         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9786         sort_relocs parameter.  Change all callers.
9787         * output.cc (Output_reloc::get_address): New function, broken out
9788         of write_rel.
9789         (Output_reloc::write_rel): Call it.
9790         (Output_reloc::compare): New function.
9791         (Output_data_reloc_base::do_write): Optionally sort relocs.
9792
9793         * configure.ac: If targ_extra_obj is set, link it in.
9794         * configure.tgt: Initialize all variables.
9795         (x86_64*): Set targ_extra_obj and targ_extra_size.
9796         * configure: Rebuild.
9797
9798         * object.cc (Sized_relobj::include_section_group): Adjust section
9799         indexes read from group data.  Build vector to pass to
9800         layout_group.
9801         * layout.cc (Layout::layout_group): Add flags and shndxes
9802         parameters.  Remove contents parameter.  Change caller.  Update
9803         explicit instantiations.
9804         * layout.h (class Layout): Update layout_group declaration.
9805         * output.cc (Output_data_group::Output_data_group): Add flags and
9806         input_shndxes parameters.  Remove contents parameter.  Change
9807         caller.
9808         (Output_data_group::do_write): Change input_sections_ to
9809         input_shndxes_.
9810         * output.h (class Output_data_group): Update constructor
9811         declaration.  Rename input_sections_ to input_shndxes_.
9812         * testsuite/many_sections_test.cc: Add template.
9813
9814 2008-04-30  Cary Coutant  <ccoutant@google.com>
9815
9816         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9817
9818         * layout.cc (Layout::include_section): Refactored check for debug
9819         info section.
9820         (Layout::add_comdat): Add new parameters.  Change type
9821         of signature parameter.  Add object and shndx to signatures table.
9822         (Layout::find_kept_object): New function.
9823         * layout.h: Include <cstring>.
9824         (Layout::is_debug_info_section): New function.
9825         (Layout::add_comdat): Add new parameters.
9826         (Layout::find_kept_object): New function.
9827         (Layout::Kept_section): New struct.
9828         (Layout::Signatures): Change type of map range.
9829         * object.cc (Relobj::output_section_address): New function.
9830         (Sized_relobj::include_section_group): Add new parameters.  Change
9831         calls to Layout::add_comdat.  Change to build table of kept comdat
9832         groups and table mapping discarded sections to kept sections.
9833         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9834         (Sized_relobj::do_layout): Change calls to include_section_group and
9835         include_linkonce_section.
9836         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9837         value to zero when section is discarded.
9838         (Sized_relobj::map_to_kept_section): New function.
9839         * object.h (Relobj::output_section_address): New function.
9840         (Relobj::Comdat_group): New type.
9841         (Relobj::find_comdat_group): New function.
9842         (Relobj::Comdat_group_table): New type.
9843         (Relobj::Kept_comdat_section): New type.
9844         (Relobj::Kept_comdat_section_table): New type.
9845         (Relobj::add_comdat_group): New function.
9846         (Relobj::set_kept_comdat_section): New function.
9847         (Relobj::get_kept_comdat_section): New function.
9848         (Relobj::comdat_groups_): New field.
9849         (Relobj::kept_comdat_sections_): New field.
9850         (Symbol_value::input_value): Update comment.
9851         (Sized_relobj::map_to_kept_section) New function.
9852         (Sized_relobj::include_linkonce_section): Add new parameter.
9853         * target-reloc.h (Comdat_behavior): New type.
9854         (get_comdat_behavior): New function.
9855         (relocate_section): Add code to map a discarded section to the
9856         corresponding kept section when applying a relocation.
9857
9858 2008-04-30  Craig Silverstein  <csilvers@google.com>
9859
9860         * dwarf_reader.cc (next_generation_count): New static var.
9861         (Addr2line_cache_entry): New struct.
9862         (addr2line_cache): New static var.
9863         (Dwarf_line_info::one_addr2line): Added caching.
9864         (Dwarf_line_info::clear_addr2line_cache): New function.
9865         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9866         cache-size parameter.
9867         (Dwarf_line_info::one_addr2line_cache): New function.
9868         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9869         new cache-size argument to one_addr2line(), and clear cache.
9870
9871 2008-04-28  Cary Coutant  <ccoutant@google.com>
9872
9873         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9874         R_386_PC8 relocations.
9875
9876 2008-04-23  Ian Lance Taylor  <iant@google.com>
9877
9878         * object.cc (Sized_relobj::include_section_group): Check for
9879         invalid section group.
9880
9881         * object.cc (make_elf_object): Correct test for 64-bit ELF file
9882         header size.
9883
9884         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9885         than read for file header.
9886         * archive.cc (Archive::include_member): Likewise.
9887
9888 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
9889
9890         * aclocal.m4: Regenerate.
9891         * configure: Regenerate.
9892
9893 2008-04-19  Ian Lance Taylor  <iant@google.com>
9894
9895         * version.cc (version_string): Bump to 1.6.
9896
9897         * testsuite/Makefile.am (many_sections_r_test): New target.
9898         (many_sections_r_test_SOURCES): Remove.
9899         (many_sections_r_test_DEPENDENCIES): Remove.
9900         (many_sections_r_test_LDFLAGS): Remove.
9901         (many_sections_r_test_LDADD): Remove.
9902
9903         * object.cc (Sized_relobj::do_add_symbols): Always pass
9904         local_symbol_count_ to add_from_relobj.
9905
9906         * testsuite/Makefile.am (many_sections_check.h): Only check one in
9907         every thousand variables.
9908         * testsuite/Makefile.in: Rebuild.
9909
9910         * object.cc (Xindex::initialize_symtab_xindex): New function.
9911         (Xindex::read_symtab_xindex): New function.
9912         (Xindex::sym_xindex_to_shndx): New function.
9913         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9914         available.
9915         (Sized_relobj::do_initialize_xindex): New function.
9916         (Sized_relobj::do_read_symbols): Adjust section links.
9917         (Sized_relobj::symbol_section_and_value): Add is_ordinary
9918         parameter.  Change all callers.
9919         (Sized_relobj::include_section_group): Adjust section links and
9920         symbol section indexes.
9921         (Sized_relobj::do_layout): Adjust section links.
9922         (Sized_relobj::do_count_local_symbols): Adjust section links and
9923         symbol section indexes.
9924         (Sized_relobj::do_finalize_local_symbols): Distinguish between
9925         ordinary and special symbols.
9926         (Sized_relobj::write_local_symbols): Add symtab_xindex and
9927         dynsym_xindex parameters.  Change all callers.  Adjust section
9928         links.  Use SHN_XINDEX when needed.
9929         (Sized_relobj::get_symbol_location_info): Adjust section links.
9930         Don't get fooled by special symbols.
9931         * object.h (class Xindex): Define.
9932         (class Object): Add xindex_ parameter.  Declare virtual functoin
9933         do_initialize_xindex.
9934         (Object::adjust_sym_shndx): New function.
9935         (Object::set_xindex): New protected function.
9936         (class Symbol_value): Add is_ordinary_shndx_ field.
9937         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9938         (Symbol_value::value): Assert ordinary section.
9939         (Symbol_value::initialize_input_to_output_map): Likewise.
9940         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9941         Change all callers.
9942         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
9943         all callers.
9944         (class Sized_relobj): Update declarations.
9945         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9946         parameter.  Change all callers.
9947         (Sized_relobj::adjust_shndx): New function.
9948         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9949         field.
9950         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9951         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
9952         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
9953         (Sized_dynobj::read_dynsym_section): Adjust section links.
9954         (Sized_dynobj::read_dynamic): Likewise.
9955         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
9956         section links.
9957         (Sized_dynobj::do_initialize_xindex): New function.
9958         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
9959         do_initialize_xindex.
9960         (Sized_dynobj::adjust_shndx): New function.
9961         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9962         dynsym_xindex_ fields.
9963         (Layout::finalize): Add a call to set_section_indexes before
9964         creating the symtab sections.
9965         (Layout::set_section_indexes): Don't do anything if the section
9966         already has a section index.
9967         (Layout::create_symtab_sections): Add shnum parameter.  Change
9968         caller.  Create .symtab_shndx section if needed.
9969         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
9970         caller.
9971         (Layout::allocated_output_section_count): New function.
9972         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9973         needed.
9974         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9975         fields.  Update declarations.
9976         (Layout::symtab_xindex): New function.
9977         (Layout::dynsym_xindex): New function.
9978         (class Write_symbols_task): Add layout_ field.
9979         (Write_symbols_task::Write_symbols_task): Add layout parameter.
9980         Change caller.
9981         * output.cc (Output_section_headers::Output_section_headers): Add
9982         shstrtab_section parameter.  Change all callers.
9983         (Output_section_headers::do_sized_write): Store overflow values
9984         for section count and section string table section index in
9985         section header zero.
9986         (Output_file_header::do_sized_write): Check for overflow of
9987         section count and section string table section index.
9988         (Output_symtab_xindex::do_write): New function.
9989         (Output_symtab_xindex::endian_do_write): New function.
9990         * output.h (class Output_section_headers): Add shstrtab_section_.
9991         Update declarations.
9992         (class Output_symtab_xindex): Define.
9993         (Output_section::has_out_shndx): New function.
9994         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9995         field.
9996         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9997         Change all callers.
9998         (Sized_symbol::init): Likewise.
9999         (Symbol::output_section): Check for ordinary symbol.
10000         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
10001         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
10002         callers.
10003         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10004         Change all callers.  Simplify handling of symbols from sections
10005         not included in the link.
10006         (Symbol_table::add_from_dynobj): Handle ordinary symbol
10007         distinction.
10008         (Weak_alias_sorter::operator()): Assert that symbols are
10009         ordinary.
10010         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10011         distinction.
10012         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10013         parameters.  Change all callers.
10014         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
10015         symbol distinction.  Use SHN_XINDEX when needed.
10016         (Symbol_table::write_section_symbol): Add symtab_xindex
10017         parameter.  Change all callers.
10018         (Symbol_table::sized_write_section_symbol): Likewise.  Use
10019         SHN_XINDEX when needed.
10020         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
10021         declarations.
10022         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
10023         (Symbol::is_defined): Check is_ordinary.
10024         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10025         (Symbol::is_absolute, Symbol::is_common): Likewise.
10026         (class Sized_symbol): Update declarations.
10027         (class Symbol_table): Update declarations.
10028         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10029         parameters.  Change all callers.
10030         (Sized_symbol::override): Likewise.
10031         (Symbol_table::override): Likewise.
10032         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
10033         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
10034         is_ordinary, and orig_st_shndx parameters.  Change all callers.
10035         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10036         to be in an ordinary section.
10037         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10038         object and is_ordinary parameters.  Change all callers.
10039         (Sized_dwarf_line_info::read_relocs): Add object parameter.
10040         Change all callers.  Don't add undefined or non-ordinary symbols
10041         to reloc_map_.
10042         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10043         Change all callers.
10044         * dwarf_reader.h (class Sized_dwarf_line_info): Update
10045         declarations.
10046         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10047         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10048         (Sized_relobj::relocate_sections): Likewise.
10049         * target-reloc.h (scan_relocs): Adjust section symbol index.
10050         (scan_relocatable_relocs): Likewise.
10051         * i386.cc (Scan::local): Check for ordinary symbols.
10052         * sparc.cc (Scan::local): Likewise.
10053         * x86_64.cc (Scan::local): Likewise.
10054         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10055         to symbol_section_and_value.
10056         * testsuite/many_sections_test.cc: New file.
10057         * testsuite/Makefile.am (BUILT_SOURCES): Define.
10058         (check_PROGRAMS): Add many_sections_test.
10059         (many_sections_test_SOURCES): Define.
10060         (many_sections_test_DEPENDENCIES): Define.
10061         (many_sections_test_LDFLAGS): Define.
10062         (BUILT_SOURCES): Add many_sections_define.h.
10063         (many_sections_define.h): New target.
10064         (BUILT_SOURCES): Add many_sections_check.h.
10065         (many_sections_check.h): New target.
10066         (check_PROGRAMS): Add many_sections_r_test.
10067         (many_sections_r_test_SOURCES): Define.
10068         (many_sections_r_test_DEPENDENCIES): Define.
10069         (many_sections_r_test_LDFLAGS): Define.
10070         (many_sections_r_test_LDADD): Define.
10071         (many_sections_r_test.o): New target.
10072         * testsuite/Makefile.in: Rebuild.
10073
10074 2008-04-17  Cary Coutant  <ccoutant@google.com>
10075
10076         * errors.cc (Errors::info): New function.
10077         (gold_info): New function.
10078         * errors.h (Errors::info): New function.
10079         * gold.h (gold_info): New function.
10080         * object.cc (Input_objects::add_object): Print trace output.
10081         * options.cc (options::parse_set): New function.
10082         (General_options::parse_wrap): Deleted.
10083         (General_options::General_options): Deleted initializer.
10084         * options.h (options::String_set): New typedef.
10085         (options::parse_set): New function.
10086         (DEFINE_set): New macro.
10087         (General_options::wrap): Changed to use DEFINE_set. Changed
10088         callers of any_wrap_symbols and is_wrap_symbol.
10089         (General_options::trace, General_options::trace_symbol):
10090         New options.
10091         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10092         (General_options::wrap_symbols_): Deleted.
10093         * symtab.cc (Symbol_table::add_from_object): Print trace output.
10094
10095 2008-04-17  David S. Miller  <davem@davemloft.net>
10096
10097         * options.cc (General_options::parse_V): New function.
10098         * options.h: Add entries for -V and -Qy.
10099
10100 2008-04-17  Ian Lance Taylor  <iant@google.com>
10101
10102         * common.cc (Symbol_table::allocate_commons): Remove options
10103         parameter.  Change caller.
10104         (Symbol_table::do_allocate_commons): Remove options parameter.
10105         Change caller.  Just call do_allocate_commons_list twice.
10106         (Symbol_table::do_allocate_commons_list): New function, broken out
10107         of do_allocate_commons.
10108         * common.h (class Allocate_commons_task): Remove options_ field.
10109         Update constructor.
10110         * symtab.cc (Symbol_table::Symbol_table): Initialize
10111         tls_commons_.
10112         (Symbol_table::add_from_object): Put TLS common symbols on
10113         tls_commons_ list.
10114         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10115         which are IN_OUTPUT_DATA.
10116         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
10117         allocate_commons and do_allocate_commons declarations.  Declare
10118         do_allocate_commons_list.
10119         * gold.cc (queue_middle_tasks): Update creation of
10120         Allocate_commons_task to not pass options.
10121         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10122         (TLS_TEST_C_FLAGS): New variable.
10123         (tls_test_c_pic.o): New target.
10124         (tls_test_shared.so): Link in tls_test_c_pic.o.
10125         (tls_test_c_pic_ie.o): New target.
10126         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10127         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10128         (tls_test_c.o): New target.
10129         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10130         (tls_pic_test_LDADD): Likewise.
10131         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10132         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10133         (tls_test_c_gnu2.o): New target.
10134         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10135         tls_test_c_gnu2.o.
10136         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10137         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10138         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10139         * testsuite/tls_test.cc: Include "config.h".
10140         (t_last): Call t11_last.
10141         * testsuite/tls_test.h (t11, t11_last): Declare.
10142         * testsuite/tls_test_c.c: New file.
10143         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10144         * configure.ac: Check for OpenMP support.
10145         * configure, config.in, Makefile.in: Rebuild.
10146         * testsuite/Makefile.in: Rebuild.
10147
10148 2008-04-16  Cary Coutant  <ccoutant@google.com>
10149
10150         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10151         (Target_i386::tls_base_symbol_defined_): New field.
10152         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10153         (Target_i386::Scan::global): Likewise.
10154         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10155         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10156         (Target_x86_64::tls_base_symbol_defined_): New field.
10157         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10158         (Target_x86_64::Scan::global): Likewise.
10159
10160 2008-04-16  Cary Coutant  <ccoutant@google.com>
10161
10162         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10163         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10164         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10165         building shared libraries.
10166         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10167         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10168         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10169         * testsuite/Makefile.in: Rebuild.
10170         * testsuite/weak_undef.h: New file.
10171         * testsuite/weak_undef_file1.cc: Add extra test cases.
10172         * testsuite/weak_undef_file2.cc: Likewise.
10173         * testsuite/weak_undef_test.cc: Likewise.
10174
10175 2008-04-16  David S. Miller  <davem@davemloft.net>
10176
10177         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10178         Add issued_non_pic_error_ field.  Declare check_non_pic.
10179         (Target_sparc::Scan::check_non_pic): New function.
10180         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10181         (Target_sparc::Scan::global): Likewise.
10182
10183         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10184         * configure: Rebuild.
10185
10186         * options.h (DEFINE_enable): New macro.
10187         (new_dtags): New enable option.
10188         (initfirst, interpose, loadfltr, nodefaultlib,
10189         nodelete, nodlopen, nodump): New -z options.
10190         * layout.cc (Layout:finish_dynamic_section): If new
10191         dtags enabled, emit DT_RUNPATH.  Also, emit a
10192         DT_FLAGS_1 containing any specified -z flags.
10193
10194 2008-04-16  Ian Lance Taylor  <iant@google.com>
10195
10196         * copy-relocs.cc: New file.
10197         * copy-relocs.h: New file.
10198         * reloc.cc: Remove Copy_relocs code.
10199         * reloc.h: Likewise.
10200         * reloc-types.h (struct Reloc_types) [both versions]: Add
10201         get_reloc_addend_noerror.
10202         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10203         variants of add_global which take an addend which must be zero.
10204         * i386.cc: Include "copy-relocs.h".
10205         (class Target_i386): Change type of copy_relocs_ to variable,
10206         update initializer.
10207         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10208         Change all callers.
10209         (Target_i386::do_finalize_sections): Change handling of
10210         copy_relocs_.
10211         * sparc.cc: Include "copy-relocs.h".
10212         (class Target_sparc): Change type of copy_relocs_ to variable,
10213         update initializer.
10214         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10215         Change all callers.
10216         (Target_sparc::do_finalize_sections): Change handling of
10217         copy_relocs_.
10218         * x86_64.cc: Include "copy-relocs.h".
10219         (class Target_x86_64): Change type of copy_relocs_ to variable,
10220         update initializer.
10221         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10222         class.  Change all callers.
10223         (Target_x86_64::do_finalize_sections): Change handling of
10224         copy_relocs_.
10225         * Makefile.am (CCFILES): Add copy-relocs.cc.
10226         (HFILES): Add copy-relocs.h.
10227
10228         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10229
10230         * testsuite/script_test_4.sh: Permit leading zeroes.
10231
10232 2008-04-15  Ian Lance Taylor  <iant@google.com>
10233
10234         * script-sections.cc (Script_sections::create_segments): Use
10235         header_size_adjustment even when there is enough room for the
10236         headers.
10237         * testsuite/script_test_4.sh: New file.
10238         * testsuite/script_test_4.t: New file.
10239         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10240         (check_DATA): Add script_test_4.stdout.
10241         (MOSTLYCLEANFILES): Likewise.
10242         (script_test_4): New target.
10243         (script_test_4.stdout): New target.
10244         * testsuite/Makefile.in: Rebuild.
10245
10246         * sparc.cc: Add definitions for Output_data_plt_sparc class
10247         constants.
10248
10249 2008-04-14  David S. Miller  <davem@davemloft.net>
10250
10251         * sparc.cc: New file.
10252         * Makefile.am (TARGETSOURCES): Add sparc.cc
10253         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10254         * configure.tgt: Document targ_extra_size and
10255         targ_extra_big_endian.  Add entries for sparc-* and
10256         sparc64-*.
10257         * configure.ac: Handle targ_extra_size and
10258         targ_extra_big_endian.
10259         * Makefile.in: Rebuild.
10260         * configure: Likewise.
10261         * po/POTFILES.in: Likewise.
10262         * po/gold.pot: Likewise.
10263
10264 2008-04-14  Ian Lance Taylor  <iant@google.com>
10265
10266         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10267         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10268         in the name/type/flags to section mapping.  Don't call
10269         allocate_output_section.
10270         (Layout::choose_output_section): Change parameter from adjust_name
10271         to is_input_section.  Don't permit input sections after sections
10272         are attached to segments.  Don't call allocate_output_section.
10273         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10274         not write_enable_output_section.
10275         (Layout::make_output_section): Don't push to
10276         unattached_section_list_ nor call attach_to_segment.  Call
10277         attach_section_to_segment if sections are attached.
10278         (Layout::attach_sections_to_segments): New function.
10279         (Layout::attach_section_to_segment): New function.
10280         (Layout::attach_allocated_section_to_segment): Rename from
10281         attach_to_segment.  Remove flags parameter.
10282         (Layout::allocate_output_section): Remove function.
10283         (Layout::write_enable_output_section): Remove function.
10284         * layout.h (class Layout): Update for above changes.  Add new
10285         field sections_are_attached_.
10286         * output.h (Output_section::update_flags_for_input_section): New
10287         function.
10288         * output.cc (Output_section::add_input_section): Call
10289         update_flags_for_input_section.
10290         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10291
10292 2008-04-11  Cary Coutant  <ccoutant@google.com>
10293
10294         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10295         thought unnecessary.
10296         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10297
10298 2008-04-11  Ian Lance Taylor  <iant@google.com>
10299
10300         * output.h (class Output_section_data): Remove inline definition
10301         of set_addralign.
10302         * output.cc (Output_section_data::set_addralign): New function.
10303
10304 2008-04-11  Cary Coutant  <ccoutant@google.com>
10305
10306         Add support for TLS descriptors for i386 and x86_64.
10307         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10308         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10309         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10310         GOT_TYPE_TLS_DESC.
10311         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10312         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10313         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10314         relocations.
10315         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10316         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10317         Fix problem with initial-exec relocations.
10318         (Target_i386::Relocate::relocate_tls): Likewise.
10319         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10320         relaxation.
10321         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10322         support for section-plus-offset dynamic table entries.
10323         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10324         (Output_data_dynamic::Dynamic_entry): Add support for
10325         section-plus-offset dynamic table entries.
10326         (Output_data_dynamic::Classification): Likewise.
10327         (Output_data_dynamic::classification_): Renamed offset_.
10328         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10329         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10330         (Target_x86_64::make_plt_section): New function.
10331         (Target_x86_64::reserve_tlsdesc_entries): New function.
10332         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10333         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10334         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10335         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10336         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10337         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10338         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10339         add extra PLT entry for TLS descriptors.
10340         (Output_data_plt_x86_64::got_): New field.
10341         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10342         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10343         fields.
10344         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10345         descriptors.
10346         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10347         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10348         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10349         R_386_TLS_DESC_CALL relocations.
10350         (Target_x86_64::Scan::global): Likewise.
10351         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10352         for TLS descriptors.
10353         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10354         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10355         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10356         GD-to-IE relaxation.
10357         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10358         and TLS_DESCRIPTORS.
10359         * Makefile.in: Rebuild.
10360         * configure: Rebuild.
10361         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10362         (tls_test_shared2.so): New target.
10363         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10364         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10365         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10366         (tls_shared_gd_to_ie_test_LDADD): New variable.
10367         (tls_shared_gnu2_gd_to_ie_test): New target.
10368         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10369         New targets.
10370         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10371         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10372         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10373         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10374         (tls_shared_gnu2_test): New target.
10375         (tls_test_gnu2_shared.so): New target.
10376         (tls_shared_gnu2_test_SOURCES): New variable.
10377         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10378         (tls_shared_gnu2_test_LDFLAGS): New variable.
10379         (tls_shared_gnu2_test_LDADD): New variable.
10380         * testsuite/Makefile.in: Rebuild.
10381         * testsuite/Makefile.
10382
10383 2008-04-11  Ian Lance Taylor  <iant@google.com>
10384
10385         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10386         justsyms.t.
10387         * testsuite/Makefile.in: Rebuild.
10388
10389         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10390         long.
10391         * testsuite/script_test_2.cc (main): Adjust test.
10392
10393 2008-04-11  David S. Miller  <davem@davemloft.net>
10394             Ian Lance Taylor  <iant@google.com>
10395
10396         * options.h (General_options): Add entries for '-Y' and
10397         '-relax'.
10398         * options.cc (General_options:finalize): If -Y was used, add those
10399         entries to the library path instead of the default "/lib" and
10400         "/usr/lib".
10401
10402 2008-04-11  David S. Miller  <davem@davemloft.net>
10403
10404         * testsuite/justsyms.t: Start at 0x100.
10405         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10406         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10407         long.
10408         * testsuite/script_test_2.cc: Adjust string and section length
10409         checks.
10410
10411 2008-04-09  Ian Lance Taylor  <iant@google.com>
10412
10413         PR gold/5996
10414         * script-sections.cc (Sections_element::allocate_to_segment): Add
10415         orphan parameter.
10416         (Output_section_definition::allocate_to_segment): Likewise.
10417         (Orphan_output_section::allocate_to_segment): Likewise.
10418         (Script_sections::attach_sections_using_phdrs_clause): Don't
10419         propagate non-PT_LOAD segments to orphan sections.
10420         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10421         readelf rather than objdump.
10422         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10423         .interp section and PT_INTERP segment are the same size.
10424         * testsuite/Makefile.in: Rebuild.
10425
10426         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10427         aliases for symbols defined in the same object.
10428         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10429         (weak_alias_test_SOURCES): New variable.
10430         (weak_alias_test_DEPENDENCIES): New variable.
10431         (weak_alias_test_LDFLAGS): New variable.
10432         (weak_alias_test_LDADD): New variable.
10433         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10434         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10435         (weak_alias_test_3.o): New target.
10436         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10437         * testsuite/weak_alias_test_main.cc: New file.
10438         * testsuite/weak_alias_test_1.cc: New file.
10439         * testsuite/weak_alias_test_2.cc: New file.
10440         * testsuite/weak_alias_test_3.cc: New file.
10441
10442 2008-04-08  Ian Lance Taylor  <iant@google.com>
10443
10444         * options.h (class General_options): Add --noinhibit-exec option.
10445         * main.cc (main): Check --noinhibit-exec.
10446
10447         * options.h (class General_options): Define --wrap as a special
10448         option.  Add wrap_symbols_ field.
10449         (General_options::any_wrap_symbols): New function.
10450         (General_options::is_wrap_symbol): New function.
10451         * options.cc (General_options::parse_wrap): New function.
10452         (General_options::General_options): Initialize wrap_symbols_.
10453         * symtab.cc (Symbol_table::wrap_symbol): New function.
10454         (Symbol_table::add_from_object): Handle --wrap.
10455         * symtab.h (class Symbol_table): Declare wrap_symbol.
10456         * target.h (Target::wrap_char): New function.
10457         (Target::Target_info): Add wrap_char field.
10458         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10459         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10460         * testsuite/testfile.cc (Target_test::test_target_info):
10461         Likewise.
10462
10463         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10464         there is one.
10465
10466         * layout.h (class Layout): Add added_eh_frame_data_ field.
10467         * layout.cc (Layout::Layout): Initialize new field.
10468         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10469         output section until we find a section we merged successfully.
10470         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10471         that the size be non-zero.
10472
10473         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10474         qualifier.
10475
10476 2008-04-08  Craig Silverstein  <csilvers@google.com>
10477
10478         * configure.ac: Export new conditional variable HAVE_ZLIB.
10479         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10480         on HAVE_ZLIB.
10481         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10482         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10483
10484 2008-04-07  Ian Lance Taylor  <iant@google.com>
10485
10486         * version.cc (version_string): Set to "1.5".
10487
10488         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10489         Add issued_non_pic_error_ field.  Declare check_non_pic.
10490         (Target_x86_64::Scan::check_non_pic): New function.
10491         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10492         (Target_x86_64::Scan::global): Likewise.
10493
10494         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10495         addend parameter.  Change caller.  Handle merge sections.
10496         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10497         Address to Addend.  Don't add in the result of
10498         local_section_offset, pass down the addend and use the returned
10499         value.
10500         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10501         Update declarations of local_section_offset and symbol_value.
10502         * testsuite/two_file_test_1.cc (t18): New function.
10503         * testsuite/two_file_test_2.cc (f18): New function.
10504         * testsuite/two_file_test_main.cc (main): Call t18.
10505         * testsuite/two_file_test.h (t18, f18): Declare.
10506
10507         * configure.ac: Don't test for objdump, c++filt, or readelf.
10508         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10509         conditionals.
10510         (TEST_READELF): New variable.
10511         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10512         (check_PROGRAMS): Add two_file_strip_test.
10513         (two_file_strip_test): New target.
10514         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10515         (two_file_same_shared_strip_test_SOURCES): New variable.
10516         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10517         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10518         (two_file_same_shared_strip_test_LDADD): New variable.
10519         (two_file_shared_strip.so): New target.
10520         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10521         (ver_test_5.syms, ver_test_7.syms): Likewise.
10522         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10523         (strip_test_3.stdout): Use TEST_OBJDUMP.
10524         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10525
10526 2008-04-04  Cary Coutant  <ccoutant@google.com>
10527
10528         * symtab.h (Symbol::is_weak_undefined): New function.
10529         (Symbol::is_strong_undefined): New function.
10530         (Symbol::is_absolute): New function.
10531         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10532         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10533         absolute symbols.
10534         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10535         (weak_undef_test): New target.
10536         * testsuite/Makefile.in: Rebuild.
10537         * testsuite/weak_undef_file1.cc: New file.
10538         * testsuite/weak_undef_file2.cc: New file.
10539         * testsuite/weak_undef_test.cc: New file.
10540
10541 2008-04-03  Craig Silverstein  <csilvers@google.com>
10542
10543         * compressed_output.h (class Output_compressed_section): Use
10544         unsigned buffer.
10545         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10546         add zlib header.
10547         (zlib_compressed_suffix): Removed.
10548         (Output_compressed_section::set_final_data_size): Use unsigned
10549         buffers.
10550         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10551         Fix linker invocation.
10552         (flagstest_o_specialfile_and_compress_debug_sections):
10553         Likewise.
10554         * testsuite/Makefile.in: Regenerated.
10555
10556 2008-04-02  David S. Miller  <davem@davemloft.net>
10557
10558         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10559         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10560
10561 2008-04-02  Craig Silverstein  <csilvers@google.com>
10562
10563         * TODO: New file.
10564
10565 2008-04-02  Ian Lance Taylor  <iant@google.com>
10566
10567         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10568         parameters.  Update for new key type to views_.  Change all
10569         callers.
10570         (File_read::read): Adjust for byteshift in returned view.
10571         (File_read::add_view): New function, broken out of
10572         find_and_make_view.
10573         (File_read::make_view): New function, broken out of
10574         find_and_make_view.
10575         (File_read::find_or_make_view): Add offset and aligned
10576         parameters.  Rewrite accordingly.  Change all callers.
10577         (File_read::get_view): Add offset and aligned parameters.  Adjust
10578         for byteshift in return value.
10579         (File_read::get_lasting_view): Likewise.
10580         * fileread.h (class File_read): Update declarations.
10581         (class File_read::View): Add byteshift_ field.  Add byteshift to
10582         constructor.  Add byteshift method.
10583         * archive.h (Archive::clear_uncached_views): New function.
10584         (Archive::get_view): Add aligned parameter.  Change all callers.
10585         * object.h (Object::get_view): Add aligned parameter.  Change all
10586         callers.
10587         (Object::get_lasting_view): Likewise.
10588
10589         * fileread.cc (File_read::release): Don't call clear_views if
10590         there are multiple objects.
10591         * fileread.h (File_read::clear_uncached_views): New function.
10592         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10593         on the archive.
10594
10595 2008-03-31  Cary Coutant  <ccoutant@google.com>
10596
10597         Add thin archive support.
10598         * archive.cc (Archive::armagt): New const.
10599         (Archive::setup): Remove task parameter and calls to unlock.
10600         (Archive::unlock_nested_archives): New function.
10601         (Archive::read_header): Add nested_off parameter. Change
10602         all callers.
10603         (Archive::interpret_header): Likewise.
10604         (Archive::include_all_members): Change to handle thin
10605         archives.
10606         (Archive::include_member): Likewise.
10607         * archive.h (Archive::Archive): Add new parameters and
10608         initializers.
10609         (Archive::armagt): New const.
10610         (Archive::setup): Remove task parameter.
10611         (Archive::unlock_nested_archives): New function.
10612         (Archive::read_header): Add nested_off parameter.
10613         (Archive::interpret_header): Likewise.
10614         (Archive::Nested_archive_table): New typedef.
10615         (Archive::is_thin_archive_): New field.
10616         (Archive::nested_archives_): New field.
10617         (Archive::options_): New field.
10618         (Archive::dirpath_): New field.
10619         (Archive::task_): New field.
10620         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10621         for thin archives.  Pass additional parameters to
10622         Archive::Archive.  Unlock the archive file after calling
10623         Archive::setup.
10624
10625 2008-03-29  Ian Lance Taylor  <iant@google.com>
10626
10627         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10628         version symbol to be local.
10629         * testsuite/ver_test_4.sh: New file.
10630         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10631         (check_DATA): Add ver_test_4.syms.
10632         (ver_test_4.syms): New target.
10633         * testsuite/Makefile.in: Rebuild.
10634
10635         * output.cc
10636         (Output_section::Input_section_sort_entry::has_priority): New
10637         function.
10638         (Output_section::Input_section_sort_entry::match_file_name): New
10639         function.
10640         (Output_section::Input_section_sort_entry::match_section_name):
10641         Remove.
10642         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10643         Remove.
10644         (Output_section::Input_section_sort_entry::match_section_file):
10645         Remove.
10646         (Output_section::Input_section_sort_compare::operator()): Rewrite
10647         using new Input_section_sort_entry functions.  Sort crtbegin and
10648         crtend first.  Sort sections with no priority before sections with
10649         a priority.
10650         * testsuite/initpri1.c (d3): Check j != 4.
10651         (cd5): New constructor/destructor function.
10652         (main): Check j != 2.
10653
10654         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10655         new symbol when resolving, don't call set_is_default.
10656         * testsuite/ver_test_7.cc: New file.
10657         * testsuite/ver_test_7.sh: New file.
10658         * testsuite/Makefile.am (ver_test_7.so): New target.
10659         (ver_test_7.o): New target.
10660         (check_SCRIPTS): Add ver_test_7.sh.
10661         (check_DATA): Add ver_test_7.syms.
10662         (ver_test_7.syms): New target.
10663
10664 2008-03-28  Ian Lance Taylor  <iant@google.com>
10665
10666         * layout.cc (Layout::layout): If we see an input section with a
10667         name that needs sorting, set the must_sort flag for the output
10668         section.
10669         (Layout::make_output_section): If the name of the output section
10670         indicates that it might require sorting, set the may_sort flag.
10671         * output.h (Output_section::may_sort_attached_input_sections): New
10672         function.
10673         (Output_section::set_may_sort_attached_input_sections): New
10674         function.
10675         (Output_section::must_sort_attached_input_sections): New
10676         function.
10677         (Output_section::set_must_sort_attached_input_sections): New
10678         function.
10679         (class Output_section): Declare Input_section_sort_entry.  Define
10680         Input_section_sort_compare.  Declare
10681         sort_attached_input_sections.  Add new fields:
10682         may_sort_attached_input_sections_,
10683         must_sort_attached_input_sections_,
10684         attached_input_sections_are_sorted_.
10685         * output.cc (Output_section::Output_section): Initialize new
10686         fields.
10687         (Output_section::add_input_section): Add an entry to
10688         input_sections_ if may_sort or must_sort are true.
10689         (Output_section::set_final_data_size): Call
10690         sort_attached_input_sections if necessary.
10691         (Output_section::Input_section_sort_entry): Define new class.
10692         (Output_section::Input_section_sort_compare::operator()): New
10693         function.
10694         (Output_section::sort_attached_input_sections): New function.
10695         * configure.ac: Check whether the compiler supports constructor
10696         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10697         * testsuite/initpri1.c: New file.
10698         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10699         CONSTRUCTOR_PRIORITY.
10700         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10701         (initpri1_LDFLAGS): New variable.
10702         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10703
10704 2008-03-27  Ian Lance Taylor  <iant@google.com>
10705
10706         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10707         * testsuite/common_test_1.c: New file.
10708         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10709         (common_test_1_SOURCES): New variable.
10710         (common_test_1_DEPENDENCIES): New variable.
10711         (common_test_1_LDFLAGS): New variable.
10712
10713         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10714         and commons_ correctly when NAME/VERSION does not override
10715         NAME/NULL.
10716         * testsuite/ver_test_6.c: New file.
10717         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10718         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10719         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10720
10721 2008-03-26  Ian Lance Taylor  <iant@google.com>
10722
10723         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10724         of an undefined symbol from a version script.
10725         * testsuite/Makefile.am (ver_test_5.so): New target.
10726         (ver_test_5.o): New target.
10727         (check_SCRIPTS): Add ver_test_5.sh.
10728         (check_DATA): Add ver_test_5.syms.
10729         (ver_test_5.syms): New target.
10730         * testsuite/ver_test_5.cc: New file.
10731         * testsuite/ver_test_5.script: New file.
10732         * testsuite/ver_test_5.sh: New file.
10733         * Makefile.in, testsuite/Makefile.in: Rebuild.
10734
10735         PR gold/5986
10736         Fix problems building gold with gcc 4.3.0.
10737         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10738         (gold_error_at_location, gold_warning_at_location): Use it.
10739         * configure.ac: Check whether we can compile and use a template
10740         function with a printf attribute.
10741         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10742         when jumping over bytes.
10743         * object.cc: Instantiate Object::read_section_data.
10744         * debug.h: Include <cstring>
10745         * dwarf_reader.cc: Include <algorithm>
10746         * main.cc: Include <cstring>.
10747         * options.cc: Include <cstring>.
10748         * output.cc: Include <cstring>.
10749         * script.cc: Include <cstring>.
10750         * script.h: Include <string>.
10751         * symtab.cc: Include <cstring> and <algorithm>.
10752         * target-select.cc: Include <cstring>.
10753         * version.cc: Include <string>.
10754         * testsuite/testmain.cc: Include <cstdlib>.
10755         * configure, config.in: Rebuild.
10756
10757 2008-03-25  Ian Lance Taylor  <iant@google.com>
10758
10759         * options.cc: Include "../bfd/bfdver.h".
10760         (options::help): Print bug reporting address.
10761
10762         * version.cc (print_version): Adjust output for current value of
10763         BFD_VERSION_STRING.
10764
10765         * NEWS: New file.
10766
10767         * options.cc (options::help): Print list of supported targets.
10768         * target-select.h: Include <vector>.
10769         (class Target_selector): Make machine_, size_, and is_big_endian_
10770         fields const.  Add bfd_name_ and instantiated_target_ fields.
10771         (Target_selector::Target_selector): Add bfd_name parameter.
10772         (Target_selector::recognize): Make non-virtual, call
10773         do_recognize.
10774         (Target_selector::recognize_by_name): Make non-virtual, call
10775         do_recognize_by_name.
10776         (Target_selector::supported_names): New function.
10777         (Target_selector::bfd_name): New function.
10778         (Target_selector::do_instantiate_target): New pure virtual
10779         function.
10780         (Target_selector::do_recognize): New virtual function.
10781         (Target_selector::do_recognize_by_name): New virtual function.
10782         (Target_selector::instantiate_target): New private function.
10783         (supported_target_names): Declare.
10784         * target-select.cc (Target_selector::Target_selector): Update for
10785         new parameter and fields.
10786         (select_target_by_name): Check that the name matches before
10787         calling recognize_by_name.
10788         (supported_target_names): New function.
10789         * i386.cc (class Target_selector_i386): Update Target_selector
10790         constructor call.  Remove recognize and recognize_by_name.  Add
10791         do_instantiate_target.
10792         * x86_64.cc (class Target_selector_x86_64): Likewise.
10793         * testsuite/testfile.cc (class Target_selector_test): Update for
10794         changes to Target_selector.
10795
10796         * README: Rewrite, with some notes on unsupported features.
10797
10798 2008-03-24  Cary Coutant  <ccoutant@google.com>
10799
10800         * i386.cc (Target_i386::Got_type): New enum declaration.
10801         (Target_i386::Scan::local): Updated callers of Output_data_got
10802         member functions.
10803         (Target_i386::Scan::global): Likewise.
10804         (Target_i386::Relocate::relocate): Likewise.
10805         (Target_i386::Relocate::relocate_tls): Likewise.
10806         * object.h (Got_offset_list): New class.
10807         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10808         (Sized_relobj::local_got_offset): Likewise.
10809         (Sized_relobj::set_local_got_offset): Likewise.
10810         (Sized_relobj::local_has_tls_got_offset): Removed.
10811         (Sized_relobj::local_tls_got_offset): Removed.
10812         (Sized_relobj::set_local_tls_got_offset): Removed.
10813         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10814         * output.cc (Output_data_got::add_global): Added got_type parameter.
10815         (Output_data_got::add_global_with_rel): Likewise.
10816         (Output_data_got::add_global_with_rela): Likewise.
10817         (Output_data_got::add_global_pair_with_rel): New function.
10818         (Output_data_got::add_global_pair_with_rela): New function.
10819         (Output_data_got::add_local): Added got_type parameter.
10820         (Output_data_got::add_local_with_rel): Likewise.
10821         (Output_data_got::add_local_with_rela): Likewise.
10822         (Output_data_got::add_local_pair_with_rel): New function.
10823         (Output_data_got::add_local_pair_with_rela): New function.
10824         (Output_data_got::add_global_tls): Removed.
10825         (Output_data_got::add_global_tls_with_rel): Removed.
10826         (Output_data_got::add_global_tls_with_rela): Removed.
10827         (Output_data_got::add_local_tls): Removed.
10828         (Output_data_got::add_local_tls_with_rel): Removed.
10829         (Output_data_got::add_local_tls_with_rela): Removed.
10830         * output.h (Output_data_got::add_global): Added got_type parameter.
10831         (Output_data_got::add_global_with_rel): Likewise.
10832         (Output_data_got::add_global_with_rela): Likewise.
10833         (Output_data_got::add_global_pair_with_rel): New function.
10834         (Output_data_got::add_global_pair_with_rela): New function.
10835         (Output_data_got::add_local): Added got_type parameter.
10836         (Output_data_got::add_local_with_rel): Likewise.
10837         (Output_data_got::add_local_with_rela): Likewise.
10838         (Output_data_got::add_local_pair_with_rel): New function.
10839         (Output_data_got::add_local_pair_with_rela): New function.
10840         (Output_data_got::add_global_tls): Removed.
10841         (Output_data_got::add_global_tls_with_rel): Removed.
10842         (Output_data_got::add_global_tls_with_rela): Removed.
10843         (Output_data_got::add_local_tls): Removed.
10844         (Output_data_got::add_local_tls_with_rel): Removed.
10845         (Output_data_got::add_local_tls_with_rela): Removed.
10846         * resolve.cc (Symbol::override_base_with_special): Removed
10847         reference to has_got_offset_ field.
10848         * symtab.cc (Symbol::init_fields): Replaced initialization
10849         of got_offset_ with got_offsets_.  Removed initialization
10850         of has_got_offset_
10851         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10852         (Symbol::got_offset): Likewise.
10853         (Symbol::set_got_offset): Likewise.
10854         (Symbol::has_tls_got_offset): Removed.
10855         (Symbol::tls_got_offset): Removed.
10856         (Symbol::set_tls_got_offset): Removed.
10857         (Symbol::got_offset_): Removed.
10858         (Symbol::tls_mod_got_offset_): Removed.
10859         (Symbol::tls_pair_got_offset_): Removed.
10860         (Symbol::got_offsets_): New field.
10861         (Symbol::has_got_offset): Removed.
10862         (Symbol::has_tls_mod_got_offset): Removed.
10863         (Symbol::has_tls_pair_got_offset): Removed.
10864         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10865         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10866         member functions.
10867         (Target_x86_64::Scan::global): Likewise.
10868         (Target_x86_64::Relocate::relocate): Likewise.
10869         (Target_x86_64::Relocate::relocate_tls): Likewise.
10870
10871 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10872
10873         * yyscript.y: Fix spelling error in comment.
10874
10875 2008-03-24  Ian Lance Taylor  <iant@google.com>
10876
10877         * options.h (class General_options): Define build_id option.
10878         * layout.h (class Layout): Declare write_build_id, create_note,
10879         create_build_id.  Add build_id_note_ member.
10880         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10881         "libiberty.h", "md5.h", "sha1.h".
10882         (Layout::Layout): Initialize eh_frame_data_,
10883         eh_frame_hdr_section_, and build_id_note_.
10884         (Layout::finalize): Call create_build_id.
10885         (Layout::create_note): New function, broken out of
10886         Layout::create_gold_note.
10887         (Layout::create_gold_note): Call create_note.
10888         (Layout::create_build_id): New function.
10889         (Layout::write_build_id): New function.
10890         (Close_task_runner::run): Call write_build_id.
10891
10892         * x86_64.cc: Correct license to GPLv3.
10893
10894 2008-03-23  Ian Lance Taylor  <iant@google.com>
10895
10896         * options.cc: Include "demangle.h".
10897         (parse_optional_string): New function.
10898         (parse_long_option): Handle takes_optional_argument.
10899         (parse_short_option): Update dash_z initializer.  Handle
10900         takes_optional_argument.
10901         (General_options::General_options): Initialize do_demangle_.
10902         (General_options::finalize): Set do_demangle_.  Handle demangling
10903         style.
10904         * options.h (parse_optional_string): Declare.
10905         (struct One_option): Add optional_arg field.  Update constructor.
10906         Update call constructor calls.  Add takes_optional_argument
10907         function.
10908         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
10909         (DEFINE_optional_string): Define.
10910         (General_options::demangle): Change from DEFINE_bool to
10911         DEFINE_optional_string.
10912         (General_options::no_demangle): New function.
10913         (General_options::do_demangle): New function.
10914         (General_options::set_do_demangle): New function.
10915         (General_options::execstack_status_): Move definition to end of
10916         class definition.
10917         (General_options::static_): Likewise.
10918         (General_options::do_demangle_): New field.
10919         * object.cc (big_endian>::get_symbol_location_info): Call
10920         Options::do_demangle, not Options::demangle.
10921         * symtab.cc (demangle): Likewise.
10922
10923 2008-03-22  Ian Lance Taylor  <iant@google.com>
10924
10925         * gold.h: Include <cstddef> and <sys/types.h>
10926         * options.h: Include <cstring>.
10927
10928 2008-03-21  Ian Lance Taylor  <iant@google.com>
10929
10930         * Added source code to GNU binutils.