bce6bc8504a718c2868c2615d34954ce99ece06b
[platform/upstream/binutils.git] / gold / ChangeLog
1 2011-05-24 Cary Coutant  <ccoutant@google.com>
2
3         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4         incremental_test_4.
5         * testsuite/Makefile.in: Regenerate.
6         * testsuite/two_file_test_1_v1.cc: New test source file.
7         * testsuite/two_file_test_1b_v1.cc: New test source file.
8         * testsuite/two_file_test_2_v1.cc: New test source file.
9
10 2011-05-24 Cary Coutant  <ccoutant@google.com>
11
12         * dynobj.h (Dynobj::do_dynobj): New function.
13         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
14         flag and soname for shared objects.
15         * incremental.cc (Incremental_inputs::report_object): Make
16         either Incremental_object_entry or Incremental_dynobj_entry; add
17         soname to string table.
18         (Incremental_inputs::report_input_section): Add assertion.
19         (Output_section_incremental_inputs::set_final_data_size): Adjust
20         type of input file entry for shared libraries; adjust size of
21         shared library info entry.
22         (Output_section_incremental_inputs::write_input_files): Write
23         as_needed flag for shared libraries.
24         (Output_section_incremental_inputs::write_info_blocks): Adjust type
25         of input file entry for shared libraries; write soname.
26         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
27         soname from incremental info.
28         * incremental.h (enum Incremental_input_flags): Add
29         INCREMENTAL_INPUT_AS_NEEDED.
30         (Incremental_input_entry::Incremental_input_entry): Initialize new
31         data member.
32         (Incremental_input_entry::set_as_needed): New function.
33         (Incremental_input_entry::as_needed): New function.
34         (Incremental_input_entry::do_dynobj_entry): New function.
35         (Incremental_input_entry::as_needed_): New data member.
36         (Incremental_object_entry::Incremental_object_entry): Don't check
37         for shared library.
38         (Incremental_object_entry::do_type): Likewise.
39         (class Incremental_dynobj_entry): New class.
40         (Incremental_input_entry_reader::as_needed): New function.
41         (Incremental_input_entry_reader::get_soname): New function.
42         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
43         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
44         size of shared library info entry.
45         * layout.cc (Layout::finish_dynamic_section): Don't test for 
46         incremental link when adding DT_NEEDED entries.
47         * object.h (Object::Object): Initialize new data member.
48         (Object::dynobj): New function.
49         (Object::set_as_needed): New function.
50         (Object::as_needed): New function.
51         (Object::do_dynobj): New function.
52         (Object::as_needed_): New data member.
53
54 2011-05-24 Cary Coutant  <ccoutant@google.com>
55
56         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
57         info; adjust display of GOT entries.
58         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
59         vector of input objects; remove file_status_.
60         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
61         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
62         got_plt reader; call target hooks to reserve GOT entries.
63         (Output_section_incremental_inputs::set_final_data_size): Adjust size
64         of input file info header and GOT info entry.
65         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
66         relocation info.
67         (Got_plt_view_info::got_descriptor): Remove.
68         (Got_plt_view_info::sym_index): New data member.
69         (Got_plt_view_info::input_index): New data member.
70         (Local_got_offset_visitor::visit): Write input file index.
71         (Global_got_offset_visitor::visit): Write 0 for input file index.
72         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
73         with sym_index and input_index.
74         (Output_section_incremental_inputs::write_got_plt): Adjust size of
75         incremental info GOT entry; replace got_descriptor with input_index.
76         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
77         map from input file index to object.
78         (Sized_relobj_incr::do_layout): Replace direct data member reference
79         with accessor function.
80         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
81         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
82         Adjust size of input file info header.
83         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
84         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
85         (Incremental_input_entry_reader::get_input_section): Adjust size of
86         input file info header.
87         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
88         of incremental info GOT entry.
89         (Incremental_got_plt_reader::get_got_desc): Remove.
90         (Incremental_got_plt_reader::get_got_symndx): New function.
91         (Incremental_got_plt_reader::get_got_input_index): New function.
92         (Sized_incremental_binary::Sized_incremental_binary): Remove
93         file_status_; add input_objects_.
94         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
95         (Sized_incremental_binary::set_file_is_unchanged): Remove.
96         (Sized_incremental_binary::file_is_unchanged): Remove.
97         (Sized_incremental_binary::set_input_object): New function.
98         (Sized_incremental_binary::input_object): New function.
99         (Sized_incremental_binary::file_status_): Remove.
100         (Sized_incremental_binary::input_objects_): New data member.
101         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
102         references.
103         (Sized_relobj_incr::invalid_address): Move to base class.
104         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
105         class.
106         (Sized_relobj_incr::do_output_section_offset): Likewise.
107         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
108         (Sized_relobj_incr::section_offsets_): Likewise.
109         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
110         function.
111         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
112         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
113         with accessor function.
114         (Sized_relobj_file::do_layout): Likewise.
115         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
116         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
117         (Sized_relobj_file::compute_final_local_value): Replace refs to
118         section_offsets_ with accessor function.
119         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
120         * object.h (Relobj::Relobj): Initialize new data members.
121         (Relobj::add_dyn_reloc): New function.
122         (Relobj::first_dyn_reloc): New function.
123         (Relobj::dyn_reloc_count): New function.
124         (Relobj::first_dyn_reloc_): New data member.
125         (Relobj::dyn_reloc_count_): New data member.
126         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
127         references.
128         (Sized_relobj::Address): New typedef.
129         (Sized_relobj::invalid_address): Move here from child class.
130         (Sized_relobj::Sized_relobj): Initialize new data members.
131         (Sized_relobj::sized_relobj): New function.
132         (Sized_relobj::is_output_section_offset_invalid): Move here from
133         child class.
134         (Sized_relobj::get_output_section_offset): Likewise.
135         (Sized_relobj::local_has_got_offset): Likewise.
136         (Sized_relobj::local_got_offset): Likewise.
137         (Sized_relobj::set_local_got_offset): Likewise.
138         (Sized_relobj::do_for_all_local_got_entries): Likewise.
139         (Sized_relobj::clear_got_offsets): New function.
140         (Sized_relobj::section_offsets): Move here from child class.
141         (Sized_relobj::do_output_section_offset): Likewise.
142         (Sized_relobj::do_set_section_offset): Likewise.
143         (Sized_relobj::Local_got_offsets): Likewise.
144         (Sized_relobj::local_got_offsets_): Likewise.
145         (Sized_relobj::section_offsets_): Likewise.
146         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
147         references.
148         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
149         class.
150         (Sized_relobj_file::sized_relobj): New function
151         (Sized_relobj_file::local_has_got_offset): Move to base class.
152         (Sized_relobj_file::local_got_offset): Likewise.
153         (Sized_relobj_file::set_local_got_offset): Likewise.
154         (Sized_relobj_file::get_output_section_offset): Likewise.
155         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
156         (Sized_relobj_file::do_output_section_offset): Likewise.
157         (Sized_relobj_file::do_set_section_offset): Likewise.
158         (Sized_relobj_file::Local_got_offsets): Likewise.
159         (Sized_relobj_file::local_got_offsets_): Likewise.
160         (Sized_relobj_file::section_offsets_): Likewise.
161         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
162         (all constructors).
163         (set_needs_dynsym_index): Convert relobj to derived class pointer.
164         (Output_reloc::get_symbol_index): Likewise.
165         (Output_reloc::local_section_offset): Likewise.
166         (Output_reloc::get_address): Likewise.
167         (Output_reloc::symbol_value): Likewise.
168         (Output_data_got::reserve_slot): Move to class definition.
169         (Output_data_got::reserve_local): New function.
170         (Output_data_got::reserve_slot_for_global): Remove.
171         (Output_data_got::reserve_global): New function.
172         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
173         (all constructors, two instantiations).
174         (Output_reloc::get_relobj): New function (two instantiations).
175         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
176         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
177         (Output_data_reloc::add_global): Adjust type of relobj.
178         (Output_data_reloc::add_global_relative): Likewise.
179         (Output_data_reloc::add_symbolless_global_addend): Likewise.
180         (Output_data_reloc::add_local): Likewise.
181         (Output_data_reloc::add_local_relative): Likewise.
182         (Output_data_reloc::add_symbolless_local_addend): Likewise.
183         (Output_data_reloc::add_local_section): Likewise.
184         (Output_data_reloc::add_output_section): Likewise.
185         (Output_data_reloc::add_absolute): Likewise.
186         (Output_data_reloc::add_target_specific): Likewise.
187         (Output_data_got::reserve_slot): Move definition here.
188         (Output_data_got::reserve_local): New function.
189         (Output_data_got::reserve_global): New function.
190         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
191         section_offsets_ with accessor function.
192         (Sized_relobj_file::write_sections): Likewise.
193         (Sized_relobj_file::do_relocate_sections): Likewise.
194         * target.h (Sized_target::reserve_local_got_entry): New function.
195         (Sized_target::reserve_global_got_entry): New function.
196         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
197         (Target_x86_64::reserve_global_got_entry): New function.
198         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
199
200 2011-05-23 Cary Coutant  <ccoutant@google.com>
201
202         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
203         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
204         bit when checking got_type.
205         * incremental.cc (Sized_incremental_binary::setup_readers):
206         Store symbol table and string table locations; initialize bit vector
207         of file status flags.
208         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
209         unchanged files.
210         (Sized_incremental_binary::do_process_got_plt): New function.
211         (Sized_incremental_binary::get_symtab_view): Use stored locations.
212         (Output_section_incremental_inputs::set_final_data_size): Record
213         file index for each input file.
214         (Output_section_incremental_inputs::write_got_plt): Store file index
215         instead of input entry offset for each GOT entry.
216         * incremental.h
217         (Incremental_input_entry::Incremental_input_entry): Initialize new
218         data member.
219         (Incremental_input_entry::set_offset): Store file index.
220         (Incremental_input_entry::get_file_index): New function.
221         (Incremental_input_entry::file_index_): New data member.
222         (Incremental_binary::process_got_plt): New function.
223         (Incremental_binary::do_process_got_plt): New function.
224         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
225         data members.
226         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
227         (Sized_incremental_binary::set_file_is_unchanged): New function.
228         (Sized_incremental_binary::file_is_unchanged): New function.
229         (Sized_incremental_binary::do_process_got_plt): New function.
230         (Sized_incremental_binary::file_status_): New data member.
231         (Sized_incremental_binary::main_symtab_loc_): New data member.
232         (Sized_incremental_binary::main_strtab_loc_): New data member.
233         * output.cc (Output_data_got::Got_entry::write): Add case
234         RESERVED_CODE.
235         (Output_data_got::add_global): Call add_got_entry.
236         (Output_data_got::add_global_plt): Likewise.
237         (Output_data_got::add_global_with_rel): Likewise.
238         (Output_data_got::add_global_with_rela): Likewise.
239         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
240         (Output_data_got::add_global_pair_with_rela): Likewise.
241         (Output_data_got::add_local): Call add_got_entry.
242         (Output_data_got::add_local_plt): Likewise.
243         (Output_data_got::add_local_with_rel): Likewise.
244         (Output_data_got::add_local_with_rela): Likewise.
245         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
246         (Output_data_got::add_local_pair_with_rela): Likewise.
247         (Output_data_got::reserve_slot): New function.
248         (Output_data_got::reserve_slot_for_global): New function.
249         (Output_data_got::add_got_entry): New function.
250         (Output_data_got::add_got_entry_pair): New function.
251         (Output_section::add_output_section_data): Edit FIXME.
252         * output.h
253         (Output_section_data_build::Output_section_data_build): New
254         constructor with size parameter.
255         (Output_data_space::Output_data_space): Likewise.
256         (Output_data_got::Output_data_got): Initialize new data member; new
257         constructor with size parameter.
258         (Output_data_got::add_constant): Call add_got_entry.
259         (Output_data_got::reserve_slot): New function.
260         (Output_data_got::reserve_slot_for_global): New function.
261         (class Output_data_got::Got_entry): Add RESERVED_CODE.
262         (Output_data_got::add_got_entry): New function.
263         (Output_data_got::add_got_entry_pair): New function.
264         (Output_data_got::free_list_): New data member.
265         * target.h (Sized_target::init_got_plt_for_update): New function.
266         (Sized_target::register_global_plt_entry): New function.
267         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
268         Initialize new data member; call init; add constructor with PLT count.
269         (Output_data_plt_x86_64::init): New function.
270         (Output_data_plt_x86_64::add_relocation): New function.
271         (Output_data_plt_x86_64::reserve_slot): New function.
272         (Output_data_plt_x86_64::free_list_): New data member.
273         (Target_x86_64::init_got_plt_for_update): New function.
274         (Target_x86_64::register_global_plt_entry): New function.
275         (Output_data_plt_x86_64::add_entry): Allocate from free list for
276         incremental updates.
277         (Output_data_plt_x86_64::add_relocation): New function.
278         * testsuite/object_unittest.cc (Object_test): Set default options.
279
280 2011-05-16  Ian Lance Taylor  <iant@google.com>
281
282         * options.h (class General_options): Make -i a synonym for -r.
283
284 2011-05-16  Ian Lance Taylor  <iant@google.com>
285
286         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
287
288 2011-05-10 Cary Coutant  <ccoutant@google.com>
289
290         * object.cc (Sized_relobj::do_count_local_symbols): Check for
291         strip_all (-s).
292
293 2011-05-06  Ian Lance Taylor  <iant@google.com>
294
295         * layout.cc (Layout::layout): If the output section flags change,
296         update the ordering.
297
298 2011-04-25 Cary Coutant  <ccoutant@google.com>
299
300         * incremental-dump.cc (dump_incremental_inputs): Print local
301         symbol info for each input file.
302         * incremental.cc
303         (Output_section_incremental_inputs::set_final_data_size): Add local
304         symbol info to input file entries in incremental info.
305         (Output_section_incremental_inputs::write_info_blocks): Likewise.
306         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
307         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
308         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
309         implementation.
310         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
311         (Sized_incr_relobj::do_relocate): Write the local symbols.
312         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
313         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
314         Adjust size of input file header.
315         (Incremental_inputs_reader::get_local_symbol_offset): New function.
316         (Incremental_inputs_reader::get_local_symbol_count): New function.
317         (Incremental_inputs_reader::get_input_section): Adjust size of input
318         file header.
319         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
320         (Sized_incr_relobj::This): New typedef.
321         (Sized_incr_relobj::sym_size): New const data member.
322         (Sized_incr_relobj::Local_symbol): New struct.
323         (Sized_incr_relobj::do_output_local_symbol_count): New function.
324         (Sized_incr_relobj::do_local_symbol_offset): New function.
325         (Sized_incr_relobj::local_symbol_count_): New data member.
326         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
327         (Sized_incr_relobj::local_symbol_index_): New data member.
328         (Sized_incr_relobj::local_symbol_offset_): New data member.
329         (Sized_incr_relobj::local_dynsym_offset_): New data member.
330         (Sized_incr_relobj::local_symbols_): New data member.
331         * object.h (Relobj::output_local_symbol_count): New function.
332         (Relobj::local_symbol_offset): New function.
333         (Relobj::do_output_local_symbol_count): New function.
334         (Relobj::do_local_symbol_offset): New function.
335         (Sized_relobj::do_output_local_symbol_count): New function.
336         (Sized_relobj::do_local_symbol_offset): New function.
337
338 2011-04-22  Vladimir Simonov  <sv@sw.ru>
339
340         * descriptors.cc (set_close_on_exec): New function.
341         (Descriptors::open): Use set_close_on_exec.
342         * output.cc (S_ISLNK): Define if not defined.
343
344 2011-04-22 Cary Coutant  <ccoutant@google.com>
345
346         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
347         global symbol map.
348         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
349         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
350         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
351         relocations.
352         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
353         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
354         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
355         * incremental.h
356         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
357         function.
358         (Incremental_binary::apply_incremental_relocs): New function.
359         (Incremental_binary::do_apply_incremental_relocs): New function.
360         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
361         data member.
362         (Sized_incremental_binary::add_global_symbol): New function.
363         (Sized_incremental_binary::global_symbol): New function.
364         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
365         (Sized_incremental_binary::symbol_map_): New data member.
366         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
367         * target.h (Sized_target::apply_relocation): New function.
368         * target-reloc.h (apply_relocation): New function.
369         * x86_64.cc (Target_x86_64::apply_relocation): New function.
370
371 2011-04-22  Doug Kwan  <dougkwan@google.com>
372
373         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
374         flag of a SHT_ARM_EXIDX section.
375         * testsuite/Makefile.am (arm_exidx_test): New test rules.
376         * testsuite/Makefile.in: Regenerate.
377         * testsuite/arm_exidx_test.s: New file.
378         * testsuite/arm_exidx_test.sh: Same.
379
380 2011-04-20 Cary Coutant  <ccoutant@google.com>
381
382         PR gold/12689
383         * archive.h (Incremental_archive_entry::Archive_member):
384         Initialize arg_serial_ (second constructor).
385
386 2011-04-17  Ian Lance Taylor  <iant@google.com>
387
388         * object.cc (Relocate_info::location): Simplify location string.
389         * errors.cc (Errors::error_at_location): Don't print program
390         name.
391         (Errors::warning_at_location): Likewise.
392         (Errors::undefined_symbol): Likewise.
393         * testsuite/debug_msg.sh: Update accordingly.
394
395 2011-04-14 Cary Coutant  <ccoutant@google.com>
396
397         * gold/layout.cc (Layout::symtab_section_offset): New function.
398         * gold/layout.h (Layout::symtab_section_offset): New function.
399         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
400
401 2011-04-12  Ian Lance Taylor  <iant@google.com>
402
403         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
404         with MREMAP_MAYMOVE.
405         * output.h (class Output_file): Add map_is_allocated_ field.
406         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
407         not available, provide stubs.  If mremap is not available, #define
408         it to gold_mremap.
409         (MREMAP_MAYMOVE): Define if not defined.
410         (Output_file::Output_file): Initialize map_is_allocated_.
411         (Output_file::resize): Check map_is_allocated_.
412         (Output_file::map_anonymous): If mmap fails, use malloc.
413         (Output_file::unmap): Don't do anything for an anonymous map.
414         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
415         is not available, provide stubs.
416         (File_read::View::~View): Use free rather than delete[].
417         (File_read::make_view): Use malloc rather than new[].  If mmap
418         fails, use malloc.
419         (File_read::find_or_make_view): Use malloc rather than new[].
420         * gold.h: Remove HAVE_REMAP code.
421         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
422         exists.  Rename mremap to gold_mremap.  If mmap is not available
423         don't do anything.
424         * configure, config.in: Rebuild.
425
426 2011-04-11  Ian Lance Taylor  <iant@google.com>
427
428         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
429         initialize local variable v.
430
431 2011-04-11  Cary Coutant  <ccoutant@google.com>
432
433         * archive.cc (Archive::include_member): Adjust call to
434         report_object.
435         (Add_archive_symbols::run): Track argument serial numbers.
436         (Lib_group::include_member): Likewise.
437         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
438         * archive.h (Incremental_archive_entry::Archive_member):
439         Initialize arg_serial_.
440         (Archive_member::arg_serial_): New data member.
441         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
442         (Sized_dynobj::do_add_symbols): Track symbols when doing an
443         incremental link.
444         (Sized_dynobj::do_for_all_local_got_entries): New function.
445         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
446         function.
447         * fileread.cc (get_mtime): New function.
448         * fileread.h (get_mtime): New function.
449         * gold.cc (queue_initial_tasks): Check for incremental update.
450         (process_incremental_input): New function.
451         (queue_middle_tasks): Don't force valid target for incremental
452         update.
453         * incremental-dump.cc (find_input_containing_global): Adjust
454         size of symbol info entry.
455         (dump_incremental_inputs): Dump argument serial number and
456         in_system_directory flag; bias shndx by 1; print symbol names
457         when dumping per-file symbol lists; use new symbol info readers.
458         * incremental.cc
459         (Output_section_incremental_inputs:update_data_size): New function.
460         (Sized_incremental_binary::setup_readers): Setup input readers
461         for each input file; build maps for files added from libraries
462         and scripts.
463         (Sized_incremental_binary::check_input_args): New function.
464         (Sized_incremental_binary::do_check_inputs): Build map of argument
465         serial numbers to input arguments.
466         (Sized_incremental_binary::do_file_has_changed): Rename
467         do_file_is_unchanged to this; compare file modification times.
468         (Sized_incremental_binary::do_init_layout): New function.
469         (Sized_incremental_binary::do_reserve_layout): New function.
470         (Sized_incremental_binary::do_get_input_reader): Remove.
471         (Sized_incremental_binary::get_symtab_view): New function.
472         (Incremental_checker::can_incrementally_link_output_file): Remove.
473         (Incremental_inputs::report_command_line): Exclude --debug options.
474         (Incremental_inputs::report_archive_begin): Add parameter; track
475         argument serial numbers; don't put input file entry for archive
476         before archive members.
477         (Incremental_inputs::report_archive_end): Put input file entry
478         for archive after archive members.
479         (Incremental_inputs::report_object): Add parameter; track argument
480         serial numbers and in_system_directory flag.
481         (Incremental_inputs::report_script): Add parameter; track argument
482         serial numbers.
483         (Output_section_incremental_inputs::set_final_data_size): Adjust
484         size of symbol info entry; check for forwarding symbols.
485         (Output_section_incremental_inputs::write_input_files): Write
486         in_system_directory flag and argument serial number.
487         (Output_section_incremental_inputs::write_info_blocks): Map section
488         indices between incremental info and original input file; store
489         input section index for each symbol.
490         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
491         change operator() to visit().
492         (class Global_got_offset_visitor): Likewise.
493         (class Global_symbol_visitor_got_plt):
494         (Output_section_incremental_inputs::write_got_plt): Use new visitor
495         classes.
496         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
497         (Sized_incr_relobj::do_read_symbols): New function.
498         (Sized_incr_relobj::do_layout): New function.
499         (Sized_incr_relobj::do_layout_deferred_sections): New function.
500         (Sized_incr_relobj::do_add_symbols): New function.
501         (Sized_incr_relobj::do_should_include_member): New function.
502         (Sized_incr_relobj::do_for_all_global_symbols): New function.
503         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
504         (Sized_incr_relobj::do_section_size): New function.
505         (Sized_incr_relobj::do_section_name): New function.
506         (Sized_incr_relobj::do_section_contents): New function.
507         (Sized_incr_relobj::do_section_flags): New function.
508         (Sized_incr_relobj::do_section_entsize): New function.
509         (Sized_incr_relobj::do_section_address): New function.
510         (Sized_incr_relobj::do_section_type): New function.
511         (Sized_incr_relobj::do_section_link): New function.
512         (Sized_incr_relobj::do_section_info): New function.
513         (Sized_incr_relobj::do_section_addralign): New function.
514         (Sized_incr_relobj::do_initialize_xindex): New function.
515         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
516         (Sized_incr_relobj::do_read_relocs): New function.
517         (Sized_incr_relobj::do_gc_process_relocs): New function.
518         (Sized_incr_relobj::do_scan_relocs): New function.
519         (Sized_incr_relobj::do_count_local_symbols): New function.
520         (Sized_incr_relobj::do_finalize_local_symbols): New function.
521         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
522         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
523         (Sized_incr_relobj::do_relocate): New function.
524         (Sized_incr_relobj::do_set_section_offset): New function.
525         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
526         (Sized_incr_dynobj::do_read_symbols): New function.
527         (Sized_incr_dynobj::do_layout): New function.
528         (Sized_incr_dynobj::do_add_symbols): New function.
529         (Sized_incr_dynobj::do_should_include_member): New function.
530         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
531         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
532         (Sized_incr_dynobj::do_section_size): New function.
533         (Sized_incr_dynobj::do_section_name): New function.
534         (Sized_incr_dynobj::do_section_contents): New function.
535         (Sized_incr_dynobj::do_section_flags): New function.
536         (Sized_incr_dynobj::do_section_entsize): New function.
537         (Sized_incr_dynobj::do_section_address): New function.
538         (Sized_incr_dynobj::do_section_type): New function.
539         (Sized_incr_dynobj::do_section_link): New function.
540         (Sized_incr_dynobj::do_section_info): New function.
541         (Sized_incr_dynobj::do_section_addralign): New function.
542         (Sized_incr_dynobj::do_initialize_xindex): New function.
543         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
544         (make_sized_incremental_object): New function.
545         (Incremental_library::copy_unused_symbols): New function.
546         (Incremental_library::do_for_all_unused_symbols): New function.
547         * incremental.h (enum Incremental_input_flags): New type.
548         (class Incremental_checker): Remove.
549         (Incremental_input_entry::Incremental_input_entry): Add argument
550         serial number.
551         (Incremental_input_entry::arg_serial): New function.
552         (Incremental_input_entry::set_is_in_system_directory): New function.
553         (Incremental_input_entry::is_in_system_directory): New function.
554         (Incremental_input_entry::arg_serial_): New data member.
555         (Incremental_input_entry::is_in_system_directory_): New data member.
556         (class Script_info): Move here from script.h.
557         (Script_info::Script_info): Add filename parameter.
558         (Script_info::filename): New function.
559         (Script_info::filename_): New data member.
560         (Incremental_script_entry::Incremental_script_entry): Add argument
561         serial number.
562         (Incremental_object_entry::Incremental_object_entry): Likewise.
563         (Incremental_object_entry::add_input_section): Build list of input
564         sections with map to original shndx.
565         (Incremental_object_entry::get_input_section_index): New function.
566         (Incremental_object_entry::shndx_): New data member.
567         (Incremental_object_entry::name_key_): Rename; adjust all refs.
568         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
569         (Incremental_archive_entry::Incremental_archive_entry): Add argument
570         serial number.
571         (Incremental_inputs::report_archive_begin): Likewise.
572         (Incremental_inputs::report_object): Likewise.
573         (Incremental_inputs::report_script): Likewise.
574         (class Incremental_global_symbol_reader): New class.
575         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
576         and store flags and input file type.
577         (Incremental_input_entry_reader::arg_serial): New function.
578         (Incremental_input_entry_reader::type): Extract type from flags.
579         (Incremental_input_entry_reader::is_in_system_directory): New function.
580         (Incremental_input_entry_reader::get_input_section_count): Call
581         accessor function for type.
582         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
583         function for type; adjust size of global symbol entry.
584         (Incremental_input_entry_reader::get_global_symbol_count): Call
585         accessor function for type.
586         (Incremental_input_entry_reader::get_object_count): Likewise.
587         (Incremental_input_entry_reader::get_object_offset): Likewise.
588         (Incremental_input_entry_reader::get_member_count): Likewise.
589         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
590         (Incremental_input_entry_reader::get_member_offset): Likewise.
591         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
592         (Incremental_input_entry_reader::Global_symbol_info): Remove.
593         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
594         (Incremental_input_entry_reader::get_global_symbol_reader): New
595         function.
596         (Incremental_input_entry_reader::get_output_symbol_index): New
597         function.
598         (Incremental_input_entry_reader::type_): Remove.
599         (Incremental_input_entry_reader::flags_): New data member.
600         (Incremental_inputs_reader::input_file_offset): New function.
601         (Incremental_inputs_reader::input_file_index): New function.
602         (Incremental_inputs_reader::input_file): Call input_file_offset.
603         (Incremental_inputs_reader::input_file_at_offset): New function.
604         (Incremental_relocs_reader::get_r_type): Reformat.
605         (Incremental_relocs_reader::get_r_shndx): Reformat.
606         (Incremental_relocs_reader::get_r_offset): Reformat.
607         (Incremental_relocs_reader::data): New function.
608         (Incremental_binary::Incremental_binary): Initialize new data members.
609         (Incremental_binary::check_inputs): Add cmdline parameter.
610         (Incremental_binary::file_is_unchanged): Remove.
611         (Input_reader::arg_serial): New function.
612         (Input_reader::get_unused_symbol_count): New function.
613         (Input_reader::get_unused_symbol): New function.
614         (Input_reader::do_arg_serial): New function.
615         (Input_reader::do_get_unused_symbol_count): New function.
616         (Input_reader::do_get_unused_symbol): New function.
617         (Incremental_binary::input_file_count): New function.
618         (Incremental_binary::get_input_reader): Change signature to use
619         index instead of filename.
620         (Incremental_binary::file_has_changed): New function.
621         (Incremental_binary::get_input_argument): New function.
622         (Incremental_binary::get_library): New function.
623         (Incremental_binary::get_script_info): New function.
624         (Incremental_binary::init_layout): New function.
625         (Incremental_binary::reserve_layout): New function.
626         (Incremental_binary::output_file): New function.
627         (Incremental_binary::do_check_inputs): New function.
628         (Incremental_binary::do_file_is_unchanged): Remove.
629         (Incremental_binary::do_file_has_changed): New function.
630         (Incremental_binary::do_init_layout): New function.
631         (Incremental_binary::do_reserve_layout): New function.
632         (Incremental_binary::do_input_file_count): New function.
633         (Incremental_binary::do_get_input_reader): Change signature.
634         (Incremental_binary::input_args_map_): New data member.
635         (Incremental_binary::library_map_): New data member.
636         (Incremental_binary::script_map_): New data member.
637         (Sized_incremental_binary::Sized_incremental_binary): Initialize
638         new data members.
639         (Sized_incremental_binary::output_section): New function.
640         (Sized_incremental_binary::inputs_reader): Add const.
641         (Sized_incremental_binary::symtab_reader): Add const.
642         (Sized_incremental_binary::relocs_reader): Add const.
643         (Sized_incremental_binary::got_plt_reader): Add const.
644         (Sized_incremental_binary::get_symtab_view): New function.
645         (Sized_incremental_binary::Inputs_reader): New typedef.
646         (Sized_incremental_binary::Input_entry_reader): New typedef.
647         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
648         (Sized_incremental_binary::do_file_is_unchanged): Remove.
649         (Sized_incremental_binary::do_file_has_changed): New function.
650         (Sized_incremental_binary::do_init_layout): New function.
651         (Sized_incremental_binary::do_reserve_layout): New function.
652         (Sized_input_reader::Inputs_reader): Remove.
653         (Sized_input_reader::Input_entry_reader): Remove.
654         (Sized_input_reader::do_arg_serial): New function.
655         (Sized_input_reader::do_get_unused_symbol_count): New function.
656         (Sized_input_reader::do_get_unused_symbol): New function.
657         (Sized_incremental_binary::do_input_file_count): New function.
658         (Sized_incremental_binary::do_get_input_reader): Change signature;
659         use index instead of filename.
660         (Sized_incremental_binary::section_map_): New data member.
661         (Sized_incremental_binary::input_entry_readers_): New data member.
662         (class Sized_incr_relobj): New class.
663         (class Sized_incr_dynobj): New class.
664         (make_sized_incremental_object): New function.
665         (class Incremental_library): New class.
666         * layout.cc (Free_list::num_lists): New static data member.
667         (Free_list::num_nodes): New static data member.
668         (Free_list::num_removes): New static data member.
669         (Free_list::num_remove_visits): New static data member.
670         (Free_list::num_allocates): New static data member.
671         (Free_list::num_allocate_visits): New static data member.
672         (Free_list::init): New function.
673         (Free_list::remove): New function.
674         (Free_list::allocate): New function.
675         (Free_list::dump): New function.
676         (Free_list::print_stats): New function.
677         (Layout_task_runner::run): Resize output file for incremental updates.
678         (Layout::Layout): Initialize new data members.
679         (Layout::set_incremental_base): New function.
680         (Layout::init_fixed_output_section): New function.
681         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
682         incremental updates.
683         (Layout::create_gold_note): Do not create gold note section for
684         incremental updates.
685         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
686         for incremental updates.
687         (Layout::set_section_offsets): For incremental updates, allocate space
688         from free list.
689         (Layout::create_symtab_sections): Layout with offsets relative to
690         start of section; for incremental updates, allocate space from free
691         list.
692         (Layout::create_shdrs): For incremental updates, allocate space from
693         free list.
694         (Layout::finish_dynamic_section): For incremental updates, do not
695         check --as-needed (fixed in subsequent patch).
696         * layout.h (class Free_list): New class.
697         (Layout::set_incremental_base): New function.
698         (Layout::incremental_base): New function.
699         (Layout::init_fixed_output_section): New function.
700         (Layout::allocate): New function.
701         (Layout::incremental_base_): New data member.
702         (Layout::free_list_): New data member.
703         * main.cc (main): Print Free_list statistics.
704         * object.cc (Relobj::finalize_incremental_relocs): Add
705         clear_counts parameter; clear counts only when clear_counts is set.
706         (Sized_relobj::Sized_relobj): Initialize new base class.
707         (Sized_relobj::do_layout): Don't report special sections.
708         (Sized_relobj::do_for_all_local_got_entries): New function.
709         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
710         symtab_off to all symbol table offsets.
711         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
712         * object.h (class Got_offset_list): Move to top of file.
713         (Object::Object): Allow case where input_file == NULL.
714         (Object::~Object): Likewise.
715         (Object::input_file): Assert that input_file != NULL.
716         (Object::lock): Allow case where input_file == NULL.
717         (Object::unlock): Likewise.
718         (Object::is_locked): Likewise.
719         (Object::token): Likewise.
720         (Object::release): Likewise.
721         (Object::is_incremental): New function.
722         (Object::get_mtime): New function.
723         (Object::for_all_local_got_entries): New function.
724         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
725         (Object::set_is_in_system_directory): New function.
726         (Object::is_in_system_directory): New function.
727         (Object::do_is_incremental): New function.
728         (Object::do_get_mtime): New function.
729         (Object::do_for_all_local_got_entries): New function.
730         (Object::is_in_system_directory_): New data member.
731         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
732         (class Sized_relobj_base): New class.
733         (class Sized_relobj): Derive from Sized_relobj_base.
734         (class Sized_relobj::Symbols): Redeclare from base class.
735         (class Sized_relobj::local_got_offset_list): Remove.
736         (class Sized_relobj::Output_sections): Redeclare from base class.
737         (class Sized_relobj::do_for_all_local_got_entries): New function.
738         (class Sized_relobj::write_local_symbols): Add offset parameter.
739         (class Sized_relobj::local_symbol_offset_): Update comment.
740         (class Sized_relobj::local_dynsym_offset_): Update comment.
741         * options.cc (Input_arguments::add_file): Remove const.
742         * options.h (Input_file_argument::Input_file_argument):
743         Initialize arg_serial_ (all constructors).
744         (Input_file_argument::set_arg_serial): New function.
745         (Input_file_argument::arg_serial): New function.
746         (Input_file_argument::arg_serial_): New data member.
747         (Input_arguments::Input_arguments): Initialize file_count_.
748         (Input_arguments::add_file): Remove const.
749         (Input_arguments::number_of_input_files): New function.
750         (Input_arguments::file_count_): New data member.
751         (Command_line::number_of_input_files): Call
752         Input_arguments::number_of_input_files.
753         * output.cc (Output_segment_headers::Output_segment_headers):
754         Set current size.
755         (Output_section::Input_section::current_data_size): New function.
756         (Output_section::Output_section): Initialize new data members.
757         (Output_section::add_input_section): Don't do merge sections for
758         an incremental link; allocate space from free list for an
759         incremental update.
760         (Output_section::add_output_section_data): Allocate space from
761         free list for an incremental update.
762         (Output_section::update_data_size): New function.
763         (Output_section::set_fixed_layout): New function.
764         (Output_section::reserve): New function.
765         (Output_segment::set_section_addresses): Remove const.
766         (Output_segment::set_section_list_addresses): Remove const; allocate
767         space from free list for an incremental update.
768         (Output_segment::set_offset): Adjust size of RELRO segment for an
769         incremental update.
770         * output.h (Output_data::current_data_size): Move here from
771         child classes.
772         (Output_data::pre_finalize_data_size): New function.
773         (Output_data::update_data_size): New function.
774         (Output_section_headers::update_data_size): new function.
775         (Output_section_data_build::current_data_size): Move to Output_data.
776         (Output_data_strtab::update_data_size): New function.
777         (Output_section::current_data_size): Move to Output_data.
778         (Output_section::set_fixed_layout): New function.
779         (Output_section::has_fixed_layout): New function.
780         (Output_section::reserve): New function.
781         (Output_section::update_data_size): New function.
782         (Output_section::has_fixed_layout_): New data member.
783         (Output_section::free_list_): New data member.
784         (Output_segment::set_section_addresses): Remove const.
785         (Output_segment::set_section_list_addresses): Remove const.
786         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
787         New function.
788         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
789         New function.
790         * readsyms.cc (Read_symbols::do_read_symbols): Add library
791         parameter when calling Add_symbols constructor; store argument
792         serial number for members of a lib group.
793         (Add_symbols::locks): Allow case where token == NULL.
794         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
795         (Read_member::~Read_member): New function.
796         (Read_member::is_runnable): New function.
797         (Read_member::locks): New function.
798         (Read_member::run): New function.
799         (Check_script::~Check_script): New function.
800         (Check_script::is_runnable): New function.
801         (Check_script::locks): New function.
802         (Check_script::run): New function.
803         (Check_library::~Check_library): New function.
804         (Check_library::is_runnable): New function.
805         (Check_library::locks): New function.
806         (Check_library::run): New function.
807         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
808         (Add_symbols::library_): New data member.
809         (class Read_member): New class.
810         (class Check_script): New class.
811         (class Check_library): New class.
812         * reloc.cc (Read_relocs::is_runnable): Allow case where
813         token == NULL.
814         (Read_relocs::locks): Likewise.
815         (Scan_relocs::locks): Likewise.
816         (Relocate_task::locks): Likewise.
817         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
818         to clear counters.
819         (Sized_relobj::incremental_relocs_scan): Fix comment.
820         (Sized_relobj::do_relocate): Pass output file offset to
821         write_local_symbols.
822         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
823         from class declaration.
824         * script.cc (read_input_script): Allocate Script_info; pass
825         argument serial number to report_script.
826         * script.h (class Script_info): Move to incremental.h.
827         * symtab.cc (Symbol_table::add_from_incrobj): New function.
828         * symtab.h (Symbol_table::add_from_incrobj): New function.
829         (Symbol_table::set_file_offset): New function.
830
831 2011-04-05  Cary Coutant  <ccoutant@google.com>
832
833         * incremental-dump.cc (dump_incremental_inputs): Change signature
834         to take a Sized_incremental_binary; change caller.  Use readers
835         in Sized_incremental_binary.
836         * incremental.cc
837         (Sized_incremental_binary::find_incremental_inputs_sections):
838         Rename do_find_incremental_inputs_sections to this.
839         (Sized_incremental_binary::setup_readers): New function.
840         (Sized_incremental_binary::do_check_inputs): Check
841         has_incremental_info_ flag; move setup code to setup_readers;
842         use input readers.
843         (Sized_incremental_binary::do_file_is_unchanged): New function.
844         (Sized_incremental_binary::do_get_input_reader): New function.
845         * incremental.h (class Incremental_binary): Move to end of file.
846         (Incremental_binary::file_is_unchanged): New function.
847         (Incremental_binary::do_file_is_unchanged): New function.
848         (Incremental_binary::Input_reader): New class.
849         (Incremental_binary::get_input_reader): New function.
850         (class Sized_incremental_binary): Move to end of file.
851         (Sized_incremental_binary::Sized_incremental_binary): Setup the
852         input section reader classes.
853         (Sized_incremental_binary::has_incremental_info): New function.
854         (Sized_incremental_binary::inputs_reader): New function.
855         (Sized_incremental_binary::symtab_reader): New function.
856         (Sized_incremental_binary::relocs_reader): New function.
857         (Sized_incremental_binary::got_plt_reader): New function.
858         (Sized_incremental_binary::do_file_is_unchanged): New function.
859         (Sized_incremental_binary::Sized_input_reader): New class.
860         (Sized_incremental_binary::get_input_reader): New function.
861         (Sized_incremental_binary::find_incremental_inputs_sections):
862         Rename do_find_incremental_inputs_sections to this.
863         (Sized_incremental_binary::setup_readers): New function.
864         (Sized_incremental_binary::has_incremental_info_): New data member.
865         (Sized_incremental_binary::inputs_reader_): New data member.
866         (Sized_incremental_binary::symtab_reader_): New data member.
867         (Sized_incremental_binary::relocs_reader_): New data member.
868         (Sized_incremental_binary::got_plt_reader_): New data member.
869         (Sized_incremental_binary::current_input_file_): New data member.
870
871 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
872
873         PR gold/12640
874         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
875         violation.
876
877 2011-03-30  Cary Coutant  <ccoutant@google.com>
878
879         * archive.cc (Archive::include_member): Adjust call to report_object.
880         (Add_archive_symbols::run): Add script_info to call to
881         report_archive_begin.
882         (Lib_group::include_member): Adjust call to report_object.
883         (Add_lib_group_symbols::run): Adjust call to report_object.
884         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
885         blocks.  Add object count for script input files.
886         * incremental.cc (Incremental_inputs::report_archive_begin): Add
887         script_info parameter; change all callers.
888         (Incremental_inputs::report_object): Add script_info parameter;
889         change all callers.
890         (Incremental_inputs::report_script): Store backpointer to
891         incremental info entry.
892         (Output_section_incremental_inputs::set_final_data_size): Record
893         additional information for scripts.
894         (Output_section_incremental_inputs::write_info_blocks): Likewise.
895         * incremental.h (Incremental_script_entry::add_object): New function.
896         (Incremental_script_entry::get_object_count): New function.
897         (Incremental_script_entry::get_object): New function.
898         (Incremental_script_entry::objects_): New data member; adjust
899         constructor.
900         (Incremental_inputs::report_archive_begin): Add script_info parameter.
901         (Incremental_inputs::report_object): Add script_info parameter.
902         (Incremental_inputs_reader::get_object_count): New function.
903         (Incremental_inputs_reader::get_object_offset): New function.
904         * options.cc (Input_arguments::add_file): Return reference to
905         new input argument.
906         * options.h (Input_argument::set_script_info): New function.
907         (Input_argument::script_info): New function.
908         (Input_argument::script_info_): New data member; adjust all
909         constructors.
910         (Input_file_group::add_file): Return reference to new input argument.
911         (Input_file_lib::add_file): Likewise.
912         (Input_arguments::add_file): Likewise.
913         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
914         * script.cc (Parser_closure::Parser_closure): Add script_info
915         parameter; adjust all callers.
916         (Parser_closure::script_info): New function.
917         (Parser_closure::script_info_): New data member.
918         (read_input_script): Report scripts earlier to incremental info.
919         (script_add_file): Set script_info in Input_argument.
920         (script_add_library): Likewise.
921         * script.h (Script_options::Script_info): Rewrite class.
922
923 2011-03-29  Cary Coutant  <ccoutant@google.com>
924
925         * archive.cc (Library_base::should_include_member): Move
926         method here from class Archive.
927         (Archive::Archive): Initialize base class.
928         (Archive::should_include_member): Move to base class.
929         (Archive::do_for_all_unused_symbols): New function.
930         (Add_archive_symbols::run): Remove redundant access to
931         incremental_inputs.
932         (Lib_group::Lib_group): Initialize base class.
933         (Lib_group::do_filename): New function.
934         (Lib_group::include_member): Pass pointer to Lib_group to
935         report_object.
936         (Lib_group::do_for_all_unused_symbols): New function.
937         (Add_lib_group_symbols::run): Report archive information for
938         incremental links.
939         * archive.h (class Library_base): New base class.
940         (class Archive): Derive from Library_base.
941         (Archive::filename): Move to base class.
942         (Archive::set_incremental_info): Likewise.
943         (Archive::incremental_info): Likewise.
944         (Archive::Should_include): Likewise.
945         (Archive::should_include_member): Likewise.
946         (Archive::Armap_entry): Remove.
947         (Archive::Unused_symbol_iterator): Remove.
948         (Archive::unused_symbols_begin): Remove.
949         (Archive::unused_symbols_end): Remove.
950         (Archive::do_filename): New function.
951         (Archive::do_get_mtime): New function.
952         (Archive::do_for_all_unused_symbols): New function.
953         (Archive::task_): Move to base class.
954         (Archive::incremental_info_): Likewise.
955         (class Lib_group): Derive from Library_base.
956         (Lib_group::do_filename): New function.
957         (Lib_group::do_get_mtime): New function.
958         (Lib_group::do_for_all_unused_symbols): New function.
959         (Lib_group::task_): Move to base class.
960         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
961         function.
962         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
963         function.
964         * incremental.cc (Incremental_inputs::report_archive_begin):
965         Use Library_base; call library's get_mtime; add incremental inputs
966         entry before members.
967         (class Unused_symbol_visitor): New class.
968         (Incremental_inputs::report_archive_end): Use Library_base; use
969         visitor class to record unused symbols; don't add incremental inputs
970         entry after members.
971         (Incremental_inputs::report_object): Use Library_base.
972         * incremental.h
973         (Incremental_archive_entry::Incremental_archive_entry): Remove
974         unused Archive parameter.
975         (Incremental_inputs::report_archive_begin): Use Library_base.
976         (Incremental_inputs::report_archive_end): Likewise.
977         (Incremental_inputs::report_object): Likewise.
978         * object.cc (Sized_relobj::do_for_all_global_symbols): New
979         function.
980         * object.h (Object::for_all_global_symbols): New function.
981         (Object::do_for_all_global_symbols): New function.
982         (Sized_relobj::do_for_all_global_symbols): New function.
983         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
984         function.
985         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
986         function.
987
988 2011-03-27  Ian Lance Taylor  <iant@google.com>
989
990         * archive.cc (Archive::interpret_header): Return -1 if something
991         goes wrong.  Change callers accordingly.
992
993 2011-03-25  Cary Coutant  <ccoutant@google.com>
994
995         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
996         * testsuite/Makefile.in: Regenerate.
997
998 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
999
1000         * plugin.cc (get_view): New.
1001         (Plugin::load): Pass get_view to the plugin.
1002         (Plugin_manager::get_view): New.
1003
1004 2011-03-21  Ian Lance Taylor  <iant@google.com>
1005
1006         * testsuite/final_layout.sh: Rewrite to not use dc.
1007         * testsuite/relro_test.sh: Fail if dc is not present.
1008
1009 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
1010
1011         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1012         Change == to -eq.
1013         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1014         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1015         Change == to -eq.
1016         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1017         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1018
1019 2011-03-14  Ian Lance Taylor  <iant@google.com>
1020
1021         * script-sections.cc (Sort_output_sections::script_compare):
1022         Rename from is_before, change return type.
1023         (Sort_output_sections::operator()): Adjust accordingly.
1024
1025 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
1026
1027         PR gold/12572
1028         * testsuite/odr_violation2.cc: Add comment to make all error line
1029         numbers double digits.
1030         * testsuite/debug_msg.sh: Adjust expected errors.
1031
1032 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
1033
1034         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1035         but mark earlier ones as non-canonical
1036         (offset_to_iterator): Update search target and example
1037         (do_addr2line): Return extra lines in a vector*
1038         (format_file_lineno): Extract from do_addr2line
1039         (one_addr2line): Add vector* out-param
1040         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1041         when a lineno entry appeared last for its instruction
1042         (Dwarf_line_info): Add vector* out-param
1043         * object.cc (Relocate_info): Pass NULL for the vector* out-param
1044         * symtab.cc (Odr_violation_compare): Include the lineno in the
1045         comparison again.
1046         (linenos_from_loc): New. Combine the canonical line for an
1047         address with its other lines.
1048         (True_if_intersect): New. Helper functor to make
1049         std::set_intersection a query.
1050         (detect_odr_violations): Compare sets of lines instead of just
1051         one line for each function. This became less deterministic, but
1052         has fewer false positives.
1053         * symtab.h: Declarations.
1054         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1055         mix an optimized and non-optimized object in the same binary
1056         (odr_violation2.so): Same.
1057         * testsuite/Makefile.in: Regenerate from Makefile.am.
1058         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1059         * testsuite/debug_msg.sh: Update line numbers and add
1060         assertions.
1061         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1062         non-optimized context.
1063         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1064         isn't inlined, and use OdrDerived in an optimized context.
1065         * testsuite/odr_header1.h: Defines OdrDerived, where
1066         optimization will change the
1067         first-instruction-in-the-destructor's file and line number.
1068         * testsuite/odr_header2.h: Defines OdrBase.
1069
1070 2011-03-09  Ian Lance Taylor  <iant@google.com>
1071
1072         * fileread.cc (File_read::clear_views): Don't delete the whole
1073         file view.
1074
1075 2011-03-08  Ian Lance Taylor  <iant@google.com>
1076
1077         PR gold/12525
1078         * fileread.cc: #include <climits>.
1079         (GOLD_IOV_MAX): Define.
1080         (File_read::read_multiple): Limit number of entries by iov_max.
1081         * fileread.h (class File_read): Always set max_readv_entries to
1082         128.
1083
1084 2011-03-07  Ian Lance Taylor  <iant@google.com>
1085
1086         PR gold/12525
1087         * options.h (class General_options): Add -dy and -dn.
1088
1089 2011-03-02  Cary Coutant  <ccoutant@google.com>
1090
1091         * testsuite/script_test_9.t: Add TLS segment.
1092
1093 2011-03-02  Simon Baldwin  <simonb@google.com>
1094
1095         * configure.ac: Add check for gnu_indirect_function support in
1096         the toolchain building binutils.
1097         * configure: Rebuild.
1098
1099 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1100
1101         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1102         plugin only symbols.
1103         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1104         in plugin files as not needed in the symbol table.
1105
1106 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1107
1108         * output.cc (Output_section::add_input_section): Delay fill
1109         generation for section ordering.
1110
1111 2011-02-09  Ian Lance Taylor  <iant@google.com>
1112
1113         PR gold/12316
1114         * object.h (class Sized_relobj): Remove clear_local_symbols.
1115         * reloc.cc (Sized_relobj::do_relocate): Don't call
1116         clear_local_symbols.
1117
1118 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1119
1120         * plugin.cc (is_visible_from_outside): Return true for symbols
1121         in the -u option.
1122
1123 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1124
1125         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1126         filename.
1127
1128 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1129
1130         * icf.h (is_section_foldable_candidate): Change type of parameter
1131         to std::string.
1132         * icf.cc (Icf::find_identical_sections): Change type of local variable
1133         section_name to be std::string.
1134         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1135
1136 2011-01-25  Ian Lance Taylor  <iant@google.com>
1137
1138         * script.cc (script_add_extern): Rewrite to use
1139         add_symbol_reference.
1140
1141 2011-01-25  Doug Kwan  <dougkwan@google.com>
1142
1143         * icf.cc (get_section_contents): Always lock section's object.
1144
1145 2011-01-24  Ian Lance Taylor  <iant@google.com>
1146
1147         * options.h (class General_options): Accept
1148         --no-detect-odr-violations.
1149
1150 2011-01-24  Ian Lance Taylor  <iant@google.com>
1151
1152         * version.cc (version_string): Bump to 1.11.
1153
1154 2011-01-24  Ian Lance Taylor  <iant@google.com>
1155
1156         * plugin.cc (class Plugin_rescan): Define new class.
1157         (Plugin_manager::claim_file): Set any_claimed_.
1158         (Plugin_manager::save_archive): New function.
1159         (Plugin_manager::save_input_group): New function.
1160         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1161         necessary.
1162         (Plugin_manager::new_undefined_symbol): New function.
1163         (Plugin_manager::rescan): New function.
1164         (Plugin_manager::rescannable_defines): New function.
1165         (Plugin_manager::add_input_file): Set any_added_.
1166         * plugin.h (class Plugin_manager): define new fields rescannable_,
1167         undefined_symbols_, any_claimed_, and any_added_.  Declare
1168         Plugin_rescan as friend.  Declare new functions.
1169         (Plugin_manager::Rescannable): Define type.
1170         (Plugin_manager::Rescannable_list): Define type.
1171         (Plugin_manager::Undefined_symbol_list): Define type.
1172         (Plugin_manager::Plugin_manager): Initialize new fields.
1173         * archive.cc (Archive::defines_symbol): New function.
1174         (Add_archive_symbols::run): Pass archive to plugins if any.
1175         * archive.h (class Archive): Declare defines_symbol.
1176         * readsyms.cc (Input_group::~Input_group): New function.
1177         (Finish_group::run): Pass input_group to plugins if any.
1178         * readsyms.h (class Input_group): Declare destructor.
1179         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1180         any.
1181
1182 2011-01-10  Ian Lance Taylor  <iant@google.com>
1183
1184         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1185         section as relro.
1186         (Layout::set_segment_offsets): Reset increase_relro before calling
1187         set_section_addresses a second time.
1188
1189 2011-01-04  Cary Coutant  <ccoutant@google.com>
1190
1191         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1192         sections before NOBITS sections.
1193
1194 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1195
1196         * version.cc (print_version): Update copyright to 2011.
1197
1198 2010-12-23  Cary Coutant  <ccoutant@google.com>
1199
1200         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1201         of OS to this->add.  Add OD parameter to second form of the function.
1202
1203 2010-12-20  Ian Lance Taylor  <iant@google.com>
1204
1205         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1206         second of two consecutive entries with same offset.
1207
1208 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1209
1210         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1211         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1212         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1213         to avoid unneeded links against $(LDADD).
1214         * testsuite/Makefile.in: Regenerate.
1215
1216 2010-12-15  Ian Lance Taylor  <iant@google.com>
1217
1218         PR gold/12324
1219         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1220         for R_X86_64_32 and R_X86_64_PC32.
1221         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1222         ver_matching_def_pic.o.
1223         (ver_matching_def_pic.o): New target.
1224
1225 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1226
1227         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1228         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1229         Move definition before File_read::View member definitions.
1230         (File_read::View::~View): Initialize and hold lock before
1231         updating current_mapped_bytes.
1232
1233 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1234
1235         * dwarf_reader.cc: Remove outdated comment.
1236         * gold-threads.cc: Fix typo in error message.
1237         * archive.cc: Fix typos in comments.
1238         * archive.h: Likewise.
1239         * arm-reloc-property.cc: Likewise.
1240         * arm-reloc-property.h: Likewise.
1241         * arm-reloc.def: Likewise.
1242         * arm.cc: Likewise.
1243         * attributes.h: Likewise.
1244         * cref.cc: Likewise.
1245         * ehframe.cc: Likewise.
1246         * fileread.h: Likewise.
1247         * gold.h: Likewise.
1248         * i386.cc: Likewise.
1249         * icf.cc: Likewise.
1250         * incremental.h: Likewise.
1251         * int_encoding.cc: Likewise.
1252         * layout.h: Likewise.
1253         * main.cc: Likewise.
1254         * merge.h: Likewise.
1255         * object.cc: Likewise.
1256         * object.h: Likewise.
1257         * options.cc: Likewise.
1258         * readsyms.cc: Likewise.
1259         * reduced_debug_output.cc: Likewise.
1260         * reloc.cc: Likewise.
1261         * script-sections.cc: Likewise.
1262         * sparc.cc: Likewise.
1263         * symtab.h: Likewise.
1264         * target-reloc.h: Likewise.
1265         * target.cc: Likewise.
1266         * target.h: Likewise.
1267         * timer.cc: Likewise.
1268         * timer.h: Likewise.
1269         * x86_64.cc: Likewise.
1270
1271 2010-12-09  Cary Coutant  <ccoutant@google.com>
1272
1273         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1274         stack.
1275         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1276         parameter; change all callers.
1277         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1278         * options.h (warn_execstack): New option.
1279
1280 2010-12-07  Doug Kwan  <dougkwan@google.com>
1281
1282         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1283         like function call relocations.
1284
1285 2010-12-07  Ian Lance Taylor  <iant@google.com>
1286
1287         * archive.cc (Archive::get_elf_object_for_member): Permit
1288         punconfigured to be NULL.
1289         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1290         (Archive::include_member): Pass NULL to get_elf_object_for_member
1291         if we searched for the archive and this is the first included
1292         object.
1293
1294 2010-12-01  Ian Lance Taylor  <iant@google.com>
1295
1296         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1297         track_relocs_type_ field.
1298         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1299         Set track_relocs_type_.
1300         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1301         contents when using RELA relocs.
1302         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1303         reloc_map_.
1304         * reloc.cc (Track_relocs::next_addend): New function.
1305         * reloc.h (class Track_relocs): Declare next_addend.
1306
1307 2010-12-01  Ian Lance Taylor  <iant@google.com>
1308
1309         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1310         virtual destructor.
1311
1312 2010-12-01  Ian Lance Taylor  <iant@google.com>
1313
1314         * README: Update compilers known to work and fail.
1315
1316 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1317
1318         * configure.in: For --enable-gold, handle value `default' instead of
1319         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1320         not the default.
1321         * configure: Regenerate.
1322
1323 2010-11-18  Doug Kwan  <dougkwan@google.com>
1324
1325         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1326         and right_alignment to be zero.  Store result alignment only if it is
1327         greater than existing alignment.
1328
1329 2010-11-16  Cary Coutant  <ccoutant@google.com>
1330
1331         PR gold/12220
1332         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1333         Check for ".zdebug_line".
1334
1335 2010-11-16  Doug Kwan  <dougkwan@google.com>
1336             Cary Coutant  <ccoutant@google.com>
1337
1338         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1339         by reference; adjust all callers.
1340         * output.cc (Output_segment::set_section_addresses): Adjust references
1341         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1342         list is empty.
1343         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1344         end at page boundary.
1345
1346 2010-11-16  Cary Coutant  <ccoutant@google.com>
1347
1348         PR gold/12220
1349         * layout.cc (Layout::choose_output_section): Transform names of
1350         compressed sections even when using a script with a SECTIONS clause.
1351         (Layout::output_section_name): Remove code to transform
1352         compressed debug section names.
1353         * output.cc (Output_section::add_input_section): Use uncompressed
1354         section size when tracking input sections.
1355
1356 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1357
1358         * symtab.h (Symbol::NON_PIC_REF): Remove.
1359         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1360         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1361         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1362         (Symbol::use_plt_offset): Take a flags argument and pass it
1363         directly to needs_dynamic_reloc.  Restrict check for undefined
1364         weak symbols to function calls.
1365         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1366         (Target_arm::Scan::global): Use it.
1367         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1368         (Target_arm::Relocate::relocate): Likewise.
1369         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1370         parameter with an r_type parameter.  Use get_reference_flags
1371         to get the flags.
1372         (Target_arm::Relocate::relocate): Update accordingly.
1373         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1374         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1375         (Target_i386::Scan::global): Likewise.
1376         (Target_i386::Relocate::relocate): Likewise.
1377         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1378         parameter with an r_type parameter.  Use get_reference_flags
1379         to get the flags.
1380         (Target_i386::Relocate::relocate): Update accordingly.
1381         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1382         (Target_powerpc::Scan::global): Use it.
1383         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1384         (Target_powerpc::Relocate::relocate): Likewise.
1385         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1386         (Target_sparc::Scan::global): Use it.
1387         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1388         (Target_sparc::Relocate::relocate): Likewise.
1389         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1390         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1391         (Target_x86_64::Scan::global): Likewise.
1392         (Target_x86_64::Relocate::relocate): Likewise.
1393
1394 2010-11-08  Doug Kwan  <dougkwan@google.com>
1395             Cary Coutant  <ccoutant@google.com>
1396
1397         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1398         (Arm_exidx_merge_section::section_contents_): New data member.
1399         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1400         (Arm_input_section::~Arm_input_section): De-allocate memory.
1401         (Arm_input_section::original_contents_): New data member.       
1402         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1403         in parameters instead of calling Object::section_contents without
1404         locking.
1405         (Arm_output_section::group_section): New parameter TASK.  Pass it
1406         to callees that need locking objects.
1407         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1408         to lock EXIDX input sections.  Fix a formatting issue.  Call
1409         Arm_exidx_merged_section::build_contents to create merged section
1410         contents.
1411         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1412         to lock object of stub table owner.
1413         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1414         TEXT_SIZE to initialize data member TEXT_SIZE_.
1415         (Arm_exidx_input_section::addralign): Fix typo in comment.
1416         (Arm_exidx_input_section::text_size): New method.
1417         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1418         that require locking objects.  Lock objects before scanning for stubs
1419         and updating local symbols.
1420         (Arm_input_section<big_endian>::init): Copy contents of original
1421         input section.
1422         (Arm_input_section<big_endian>::do_write): Use saved contents of
1423         original input section instead of calling Object::section_contents
1424         without locking.
1425         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1426         size without calling Object::section_size().
1427         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1428         for size.  Allocate a buffer for merged EXIDX entries.
1429         (Arm_exidx_merged_section::build_contents): New method.
1430         (Arm_exidx_merged_section::do_write): Move merge section contents
1431         building code to Arm_exidx_merged_section::build_contetns.  Write
1432         out contetns in buffer instead of building it on the fly.
1433         (Arm_relobj::make_exidx_input_section): Also pass text section size
1434         to Arm_exidx_input_section constructor.
1435         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1436         (Arm_dynobj::do_read_symbols): Fix memory leak.
1437         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1438         * target.h: (class Task): Add forward declaration.
1439         (Target::relax): Add new parameter TASK and pass it to
1440         Target::do_relax().
1441         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1442
1443 2010-11-05  Cary Coutant  <ccoutant@google.com>
1444
1445         PR gold/10708
1446         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1447         object when reading from the file.
1448         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1449         second layout pass.
1450         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1451         when reading section contents.
1452         (get_section_contents): Likewise.
1453         (icf::find_identical_sections): Likewise.
1454         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1455         object when reading from the file.
1456         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1457         the object when doing deferred section layout.
1458
1459 2010-11-03  Nick Clifton  <nickc@redhat.com>
1460
1461         PR gold/12001
1462         * script.h (class Symbol_assignment: name): New member.  Returns
1463         the name of the symbol.
1464         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1465         Returns true if the given symbol name is on the list of
1466         assignments wating to be processed.
1467         * archive.cc (should_incldue_member): If the symbol is undefined,
1468         check to see if it is on the list of symbols pending assignment.
1469
1470 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1471
1472         * script-sections.cc (Script_sections::find_memory_region): Check
1473         for a NULL output section pointer.
1474
1475 2010-10-29  Doug Kwan  <dougkwan@google.com>
1476
1477         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1478         Output_section::add_relaxed_input_section.
1479         * output.cc (Output_section::add_relaxed_input_section): Add new
1480         arguments LAYOUT and NAME.  Set section order index.
1481         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1482         Copy section order index.
1483         * output.h (Output_section::add_relaxed_input_section): Add new
1484         arguments LAYOUT and NAME.
1485
1486 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1487
1488         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1489         NATIVE_OR_CROSS_LINKER.
1490         * testsuite/Makefile.in: Regenerate.
1491
1492 2010-10-20  Doug Kwan  <dougkwan@google.com>
1493
1494         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1495         without SHF_LINK_ORDER flags.
1496         * layout.cc (Layout::choose_output_section): Do not filter
1497         SHF_LINK_ORDER flag in a relocatable link.
1498
1499 2010-10-17  Cary Coutant  <ccoutant@google.com>
1500
1501         * output.h (Output_segment::set_section_addresses): Change function
1502         signature.  Update all callers.
1503         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1504         sections.
1505         (Output_segment::set_section_addresses): Align after last TLS
1506         section.  Add padding before last relro section instead of after.
1507
1508 2010-10-17  Doug Kwan  <dougkwan@google.com>
1509
1510         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1511         GOT output section to be writable.
1512
1513 2010-10-14  Cary Coutant  <ccoutant@google.com>
1514
1515         * debug.h (DEBUG_INCREMENTAL): New flag.
1516         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1517         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1518         mode.
1519         * incremental.cc (report_command_line): Ignore all forms of
1520         --incremental.
1521         * layout.cc (Layout::Layout): Check parameters for incremental link
1522         mode.
1523         * options.cc (General_options::parse_incremental): New function.
1524         (General_options::parse_no_incremental): New function.
1525         (General_options::parse_incremental_full): New function.
1526         (General_options::parse_incremental_update): New function.
1527         (General_options::incremental_mode_): New data member.
1528         (General_options::finalize): Check incremental_mode_.
1529         * options.h (General_options): Update help text for --incremental.
1530         Add --no-incremental, --incremental-full, --incremental-update.
1531         (General_options::Incremental_mode): New enum type.
1532         (General_options::incremental_mode): New function.
1533         (General_options::incremental_mode_): New data member.
1534         * parameters.cc (Parameters::incremental_mode_): New data member.
1535         (Parameters::set_options): Set incremental_mode_.
1536         (Parameters::set_incremental_full): New function.
1537         (Parameters::incremental): New function.
1538         (Parameters::incremental_update): New function.
1539         (set_parameters_incremental_full): New function.
1540         * parameters.h (Parameters::set_incremental_full): New function.
1541         (Parameters::incremental): New function.
1542         (Parameters::incremental_update): New function.
1543         (Parameters::incremental_mode_): New data member.
1544         (set_parameters_incremental_full): New function.
1545         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1546         incremental link mode.
1547         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1548         (Sized_relobj::do_relocate_sections): Likewise.
1549         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1550         option.
1551         * testsuite/Makefile.in: Regenerate.
1552         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1553
1554 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1555
1556         * script-sections.h (class Script_sections): Make
1557         Sections_elements typedef public.
1558         * script-sections.cc (class Sort_output_sections): Add elements_
1559         field.  Add constructor which sets it; change all callers.
1560         (Sort_output_sections::is_before): New function.
1561         (Sort_output_sections::operator()): Call is_before.
1562         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1563         conditional.
1564         * testsuite/script_test_10.sh: New test. Test script section
1565         order.
1566         * testsuite/script_test_10.t: Likewise.
1567         * testsuite/script_test_10.s: Likewise.
1568         * testsuite/Makefile.am: Wrap the cross linker tests and the
1569         common tests into NATIVE_OR_CROSS_LINKER.
1570         (check_SCRIPTS): Add script_test_10.sh.
1571         (check_DATA): Add script_test_10.stdout.
1572         (script_test_10.o, script_test_10): New targets.
1573         (script_test_10.stdout): New target.
1574         * configure, testsuite/Makefile.in: Regenerate.
1575
1576 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1577
1578         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1579         error for the deprecated relocations.
1580         (Target_arm::Scan::global): Likewise.
1581         (Target_arm::Relocate::relocate): Likewise.
1582
1583 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1584
1585         * fileread.cc (Input_file::find_file): Initialize *found_name
1586         and *namep when using the fallback search for case 4.
1587
1588 2010-10-11  Cary Coutant  <ccoutant@google.com>
1589
1590         * options.h (class General_options): Redefine -z lazy as an alias for
1591         the negation of -z now.
1592
1593 2010-10-11  Ian Lance Taylor  <iant@google.com>
1594
1595         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1596         binding.
1597
1598 2010-10-06  Nick Clifton  <nickc@redhat.com>
1599
1600         * script-sections.cc(class Memory_region): Remove
1601         current_lma_offset_ field.  Rename current_vma_offset_ to
1602         current_offset_.  Add last_section_ field.
1603         (Memory_region::get_current_vma_address): Rename to
1604         get_current_address.
1605         (Memory_region::get_current_lma_address): Delete.
1606         (Memory_region::increment_vma_offset): Rename to
1607         increment_offset.
1608         (Memory_region::increment_lma_offset): Delete.
1609         (Memory_region::attributes_compatible): New method.  Returns
1610         true if the provided section is compatible with the region.
1611         (Memory_region::get_last_section): New method.  Returns the last
1612         section to use the region.
1613         (Memory_region::set_last_section): New method.  Stores the last
1614         section to use the region.
1615         (Script_sections::block_in_region): New method.  Returns true if
1616         a block of memory is contained within a region.
1617         (Script_sections::find_memory_region): New method.  Locates a
1618         memory region to be used to set a VMA or LMA address.
1619         (Output_section_definition::set_section_addresses): Add code to
1620         check for addresses set by memory regions.
1621         (Output_segment::set_section_addresses): Remove memory region
1622         walking code.
1623         (Script_sections::create_segment): Add a warning if a header
1624         segment is created outside of any region.
1625         * script-sections.h (class Script_sections): Add prototypes for
1626         find_memory_region and block_in_region methods.
1627         * testsuite/memory_test.s: Use .long instead of .word.
1628         * testsuite/memory_test.t: Add some more output sections.
1629         * testsuite/memory_test.sh: Update expected output.
1630
1631 2010-10-02  Doug Kwan  <dougkwan@google.com>
1632
1633         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1634         defintion to symtab.h
1635         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1636         declaration to defintion.
1637
1638 2010-10-01  Nick Clifton  <nickc@redhat.com>
1639
1640         * expression.cc (eval): Replace dummy argument with NULL.
1641         (eval_maybe_dot): Check for a NULL result section pointer.
1642         (Symbol_expression::value): Likewise.
1643         (Dot_expression::value): Likewise.
1644         (BINARY_EXPRESSION): Likewise.
1645         (Max_expression::value): Likewise.
1646         (Min_expression::value): Likewise.
1647         (Absolute_expression::value): Likewise.
1648         (Addr_expression::value_from_output_section): Likewise.
1649         (Loaddddr_expression::value_from_output_section): Likewise.
1650         (Segment_start_expression::value): Likewise.
1651         * script-sections.cc
1652         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1653         argument with NULL.
1654         (Sections_elememt_dot_assignment::set_section_addresses):
1655         Likewise.
1656         (Output_data_expression::do_write_to_buffer): Likewise.
1657         (Output_section_definition::finalize_symbols): Likewise.
1658         (Output_section_definition::set_section_addresses): Likewise.
1659
1660 2010-09-30  Doug Kwan  <dougkwan@google.com>
1661
1662         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1663
1664 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1665
1666         * target.h (Target::can_icf_inline_merge_sections): New virtual
1667         function.
1668         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1669         virtual function.
1670         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1671         virtual function.
1672         * icf.cc (get_section_contents): Inline merge sections only when
1673         target allows it.
1674
1675 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1676
1677         * configure: Regenerate.
1678
1679 2010-09-17  Ian Lance Taylor  <iant@google.com>
1680
1681         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1682         * testsuite/Makefile.am (memory_test.o): New target.
1683         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1684         memory_test.t.
1685         * testsuite/Makefile.in: Rebuild.
1686
1687 2010-09-17  Doug Kwan  <dougkwan@google.com>
1688
1689         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1690         defintion if relocation uses GOT entries of the symbol.
1691         * testsuite/icf_safe_test.sh: Fix test.
1692         * testsuite/icf_safe_so_test.sh: Fix test.
1693
1694 2010-09-16  Cary Coutant  <ccoutant@google.com>
1695
1696         * script_sections.cc (class Memory_region): Remove "NULL" from
1697         vector initializations.
1698
1699 2010-09-15  Cary Coutant  <ccoutant@google.com>
1700
1701         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1702         Resolve forwarding symbols.
1703
1704 2010-09-15  Doug Kwan  <dougkwan@google.com>
1705
1706         * gold/testsuite/script_test_3.t: Add ARM special sections.
1707         * gold/testsuite/script_test_4.t: Same.
1708         * gold/testsuite/script_test_5.t: Same.
1709         * gold/testsuite/script_test_6.t: Same.
1710         * gold/testsuite/script_test_7.t: Same.
1711         * gold/testsuite/script_test_7.t: Same.
1712         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1713
1714 2010-09-14  Cary Coutant  <ccoutant@google.com>
1715
1716         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1717         (Target_x86_64::Relocate::relocate_tls): Replace check for
1718         saw_tls_block_reloc_ with test for executable section.
1719
1720 2010-09-12  Cary Coutant  <ccoutant@google.com>
1721
1722         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1723         position-independent executables to shared libraries need dynamic
1724         relocations.
1725         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1726         position-independent executables.
1727         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1728         * testsuite/Makefile.in: Regenerate.
1729
1730 2010-09-10  Nick Clifton  <nickc@redhat.com>
1731
1732         PR gold/11997
1733         * testsuite/memory_test.t: Discard any sections that are not
1734         needed.
1735
1736 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1737
1738         PR gold/11996
1739         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1740         "This::" to work around a bug in gcc 4.2.
1741
1742         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1743
1744 2010-09-09  Rafael Espindola  <espindola@google.com>
1745
1746         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1747         sections with different PF_X flags in the same segment.
1748         (Layout::find_first_load_seg): Search all segments to find the first
1749         one.
1750         * options.h (rosegment): New.
1751
1752 2010-09-08  Rafael Espindola  <espindola@google.com>
1753
1754         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1755
1756 2010-09-08  Doug Kwan  <dougkwan@google.com>
1757
1758         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1759         (Arm_relobj::do_relocate_sections): Add new parameter for output
1760         file to match the parent.
1761         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1762         of local symbols instead of input values.  Update code to track
1763         changes in gold::relocate_section.
1764         * object.cc (Sized_relobj::compute_final_local_value): New methods.
1765         (Sized_relobj::compute_final_local_value_internal): New methods.
1766         (Sized_relobj::do_finalize_local_symbols): Move code from loop
1767         body into private version of Sized_relobj::compute_final_local_value.
1768         Call the inline method.
1769         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
1770         merged symbol value if there is one.
1771         (Symbol_value::has_output_value): New method defintiion.
1772         (Sized_relobj::Compute_final_local_value_status): New enum type.
1773         (Sized_relobj::compute_final_local_value): New methods.
1774         (Sized_relobj::compute_final_local_value_internal): New methods.
1775         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1776         and arm_cortex_a8.sh.
1777         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1778         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1779         New tests.
1780         * Makefile.in: Regenerate.
1781         * testsuite/arm_bl_out_of_range.s: Update test.
1782         * testsuite/thumb_bl_out_of_range.s: Ditto.
1783         * testsuite/thumb_blx_out_of_range.s: Ditto.
1784         * testsuite/arm_branch_out_of_range.sh: New file.
1785         * testsuite/arm_cortex_a8.sh: Ditto.
1786         * testsuite/arm_cortex_a8_b.s: Ditto.
1787         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1788         * testsuite/arm_cortex_a8_b_local.s: Ditto.
1789         * testsuite/arm_cortex_a8_bl.s: Ditto.
1790         * testsuite/arm_cortex_a8_blx.s: Ditto.
1791         * testsuite/arm_cortex_a8_local.s: Ditto.
1792         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1793         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1794
1795 2010-09-08  Rafael Espindola  <espindola@google.com>
1796
1797         * Makefile.am (memory_test.stdout): Run readelf with -W.
1798         * Makefile.in: Regenerate.
1799         * testsuite/memory_test.sh: Make the regexps accept both 32 and
1800         64 bit output.
1801
1802 2010-09-08  Rafael Espindola  <espindola@google.com>
1803
1804         * script-sections.cc (Script_sections::add_memory_region): Convert
1805         field precision to int.
1806         * script.cc (script_set_section_region, script_set_section_region):
1807         Convert field precision to int.
1808
1809 2010-09-08  Rafael Espindola  <espindola@google.com>
1810
1811         * arm.cc (do_finalize_sections): Create the __exidx_start and
1812         __exdix_end symbols even when the section is missing.
1813
1814 2010-09-08  Nick Clifton  <nickc@redhat.com>
1815
1816         * README: Remove claim that MEMORY is not supported.
1817         * expression.cc (script_exp_function_origin)
1818         (script_exp_function_length): Move from here to ...
1819         * script.cc: ... here.
1820         (script_set_section_region, script_add_memory)
1821         (script_parse_memory_attr, script_include_directive): New
1822         functions.
1823         * script-sections.cc
1824         (class Memory_region): New class.
1825         (class Output_section_definition): Add set_memory_region,
1826         set_section_vma, set_section_lma and get_section_name methods.
1827         (class Script_Sections): Add add_memory_region,
1828         find_memory_region, find_memory_region_origin,
1829         find_memory_region_length and set_memory_region methods.
1830         Have set_section_addresses method walk the list of set memory
1831         regions.
1832         Extend the print methos to display memory regions.
1833         * script-sections.h: Add prototypes for new methods.
1834         Add enum for MEMORY region attributes.
1835         * yyscript.y: Add support for parsing MEMORY regions.
1836         * script-c.h: Add prototypes for new functions.
1837         * testsuite/Makefile.am: Add test of MEMORY region functionality.
1838         * testsuite/Makefile.in: Regenerate.
1839         * testsuite/memory_test.sh: New script.
1840         * testsuite/memory_test.s: New assembler source file.
1841         * testsuite/memory_test.t: New linker script.
1842
1843 2010-08-27  Doug Kwan  <dougkwan@google.com>
1844
1845         * gold/resolve.cc (Symbol_table::should_override): Let a weak
1846         reference override an existing dynamic weak reference.
1847         * testsuite/Makefile.am: Add new test dyn_weak_ref.
1848         * testsuite/Makefile.in: Regenerate.
1849         * testsuite/dyn_weak_ref.sh: New file.
1850         * testsuite/dyn_weak_ref_1.c: Ditto.
1851         * testsuite/dyn_weak_ref_2.c: Ditto.
1852
1853 2010-08-27  Ian Lance Taylor  <iant@google.com>
1854
1855         * incremental.h (class Incremental_input_entry): Add virtual
1856         destructor.
1857
1858 2010-08-27  Ian Lance Taylor  <iant@google.com>
1859
1860         * testsuite/start_lib_test_3.c: Mark t3 as used.
1861
1862 2010-08-27  Nick Clifton  <nickc@redhat.com>
1863
1864         * options.cc (version_script): Fix small typo in previous
1865         whitespace tidyup.
1866
1867 2010-08-25  Nick Clifton  <nickc@redhat.com>
1868
1869         * archive.cc: Formatting fixes: Remove whitespace between
1870         typename and following asterisk.  Remove whitespace between
1871         function name and opening parenthesis.
1872         * archive.h: Likewise.
1873         * arm.cc: Likewise.
1874         * attributes.cc: Likewise.
1875         * attributes.h: Likewise.
1876         * common.cc: Likewise.
1877         * copy-relocs.cc: Likewise.
1878         * dirsearch.h: Likewise.
1879         * dynobj.cc: Likewise.
1880         * ehframe.cc: Likewise.
1881         * ehframe.h: Likewise.
1882         * expression.cc: Likewise.
1883         * fileread.cc: Likewise.
1884         * fileread.h: Likewise.
1885         * gc.h: Likewise.
1886         * gold-threads.cc: Likewise.
1887         * gold.cc: Likewise.
1888         * i386.cc: Likewise.
1889         * icf.h: Likewise.
1890         * incremental-dump.cc: Likewise.
1891         * incremental.cc: Likewise.
1892         * layout.cc: Likewise.
1893         * layout.h: Likewise.
1894         * main.cc: Likewise.
1895         * merge.cc: Likewise.
1896         * merge.h: Likewise.
1897         * object.cc: Likewise.
1898         * object.h: Likewise.
1899         * options.cc: Likewise.
1900         * options.h: Likewise.
1901         * output.cc: Likewise.
1902         * output.h: Likewise.
1903         * plugin.cc: Likewise.
1904         * plugin.h: Likewise.
1905         * powerpc.cc: Likewise.
1906         * reloc.cc: Likewise.
1907         * script-c.h: Likewise.
1908         * script-sections.cc: Likewise.
1909         * script.cc: Likewise.
1910         * stringpool.cc: Likewise.
1911         * symtab.cc: Likewise.
1912         * symtab.h: Likewise.
1913         * target.cc: Likewise.
1914         * timer.cc: Likewise.
1915         * timer.h: Likewise.
1916         * version.cc: Likewise.
1917         * x86_64.cc: Likewise.
1918
1919 2010-08-24  Nick Clifton  <nickc@redhat.com>
1920
1921         PR 11899
1922         * layout.cc (segment_precedes): Sort segments by their physical
1923         addresses, if they have been set.
1924
1925 2010-08-23  Cary Coutant  <ccoutant@google.com>
1926
1927         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1928         symbols data.
1929         (Lib_group::include_member): Unlock object after deleting its
1930         symbols data.
1931         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1932         the bug fixed here.
1933
1934 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
1935             Cary Coutant  <ccoutant@google.com>
1936
1937         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1938         constructor, and set_blocker.
1939         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1940         readsyms_blocker_.
1941         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1942         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1943         * testsuite/Makefile.am (start_lib_test): New test case.
1944         * testsuite/Makefile.in: Regenerate.
1945         * testsuite/start_lib_test_main.c: New file.
1946         * testsuite/start_lib_test_1.c: New file.
1947         * testsuite/start_lib_test_2.c: New file.
1948         * testsuite/start_lib_test_3.c: New file.
1949
1950 2010-08-19  Ian Lance Taylor  <iant@google.com>
1951
1952         * Makefile.in: Rebuild with automake 1.11.1.
1953         * aclocal.m4: Likewise.
1954         * testsuite/Makefile.in: Likewise.
1955
1956 2010-08-19  Ian Lance Taylor  <iant@google.com>
1957
1958         PR 10893
1959         * i386.cc (class Output_data_plt_i386): Update declarations.
1960         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
1961         local_ifuncs_ fields.
1962         (Target_i386::do_plt_section_for_global): New function.
1963         (Target_i386::do_plt_section_for_local): New function.
1964         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1965         parameter; change all callers.  Initialize global_ifuncs_ and
1966         local_ifuncs_.  If doing a static link define __rel_iplt_start and
1967         __rel_iplt_end.
1968         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1969         (Output_data_plt_i386::add_local_ifunc_entry): New function.
1970         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1971         symbols.
1972         (Target_i386::make_plt_section): New function, broken out of
1973         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
1974         (Target_i386::make_plt_entry): Call make_plt_section.
1975         (Target_i386::make_local_ifunc_plt_entry): New function.
1976         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1977         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
1978         R_386_IRELATIVE to switch.
1979         (Target_i386::Scan::global): Likewise.
1980         (Target_i386::Relocate::relocate): Likewise.
1981         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1982         switch.
1983         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1984         (Target_x86_64::do_plt_section_for_global): New function.
1985         (Target_x86_64::do_plt_section_for_local): New function.
1986         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1987         parameter; change all callers.  If doing a static link define
1988         __rela_iplt_start and __rela_iplt_end.
1989         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1990         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1991         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1992         to point to .plt.
1993         (Target_x86_64::make_local_ifunc_plt_entry): New function.
1994         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1995         switch.
1996         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1997         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
1998         R_X86_64_IRELATIVE to switch.
1999         (Target_x86_64::Scan::global): Likewise.
2000         (Target_x86_64::Relocate::relocate): Likewise.
2001         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2002         switch.
2003         * target.h (class Target): Add plt_section_for_global and
2004         plt_section_for_local functions.  Add do_plt_section_for_global
2005         and do_plt_section_for_local virtual functions.
2006         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
2007         clarifying comments.
2008         (Symbol::use_plt_offset): Handle IFUNC symbol.
2009         * object.cc (Sized_relobj::Sized_relobj): Initialize
2010         local_plt_offsets_.
2011         (Sized_relobj::local_has_plt_offset): New function.
2012         (Sized_relobj::local_plt_offset): New function.
2013         (Sized_relobj::set_local_plt_offset): New function.
2014         (Sized_relobj::do_count): Handle IFUNC symbol.
2015         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
2016         a bit away from input_shndx_ field.  Add set_is_func_symbol and
2017         is_ifunc_symbol functions.
2018         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
2019         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
2020         local_plt_offsets_ field.
2021         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2022         * output.h (class Output_section_data): Add non-const
2023         output_section function.
2024         (class Output_data_got): Update declarations.
2025         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2026         Add use_plt_offset parameter to global and local constructors.
2027         Change all callers.  Change local_sym_index_ field to 31 bits.
2028         Change GSYM_CODE and CONSTANT_CODE accordingly.
2029         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2030         doing a static link don't set sh_link field.
2031         (Output_data_got::Got_entry::write): Use PLT offset if
2032         appropriate.
2033         (Output_data_got::add_global_plt): New function.
2034         (Output_data_got::add_local_plt): New function.
2035         * target-reloc.h (relocate_section): Handle IFUNC symbol.
2036         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2037         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2038         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2039         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2040         IFUNC conditional.
2041         * testsuite/ifunc-sel.h: New file.
2042         * testsuite/ifuncmain1.c: New file.
2043         * testsuite/ifuncmain1vis.c: New file.
2044         * testsuite/ifuncmod1.c: New file.
2045         * testsuite/ifuncdep2.c: New file.
2046         * testsuite/ifuncmain2.c: New file.
2047         * testsuite/ifuncmain3.c: New file.
2048         * testsuite/ifuncmod3.c: New file.
2049         * testsuite/ifuncmain4.c: New file.
2050         * testsuite/ifuncmain5.c: New file.
2051         * testsuite/ifuncmod5.c: New file.
2052         * testsuite/ifuncmain6pie.c: New file.
2053         * testsuite/ifuncmod6.c: New file.
2054         * testsuite/ifuncmain7.c: New file.
2055         * configure, testsuite/Makefile.in: Rebuild.
2056
2057 2010-08-18  Ian Lance Taylor  <iant@google.com>
2058
2059         * incremental.cc
2060         (Output_section_incremental_inputs::write_input_files): Add cast
2061         to avoid signed/unsigned comparison warning.
2062         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2063
2064 2010-08-12  Cary Coutant  <ccoutant@google.com>
2065
2066         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2067
2068 2010-08-13  Ian Lance Taylor  <iant@google.com>
2069
2070         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2071
2072 2010-08-12  Cary Coutant  <ccoutant@google.com>
2073             Doug Kwan  <dougkwan@google.com>
2074
2075         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2076         defintion overrides non-weak undef, remember that the original undef
2077         is not weak.
2078         * symtab.cc (Symbol_table::sized_write_global): For undef without
2079         an original weak binding, set binding to global in output.
2080         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2081         * testsuite/Makefile.in: Regenerate.
2082         * testsuite/strong_ref_weak_def.sh: New file.
2083         * testsuite/strong_ref_weak_def_1.c: Ditto.
2084         * testsuite/strong_ref_weak_def_2.c: Ditto.
2085
2086 2010-08-12  Cary Coutant  <ccoutant@google.com>
2087
2088         * testsuite/incremental_test.sh: Rewrite.
2089         * testsuite/incremental_test_1.c: Rewrite.
2090         * testsuite/incremental_test_2.c: Rewrite.
2091
2092 2010-08-12  Cary Coutant  <ccoutant@google.com>
2093
2094         * arm.cc (Target_arm::got_size): Add const.
2095         (Target_arm::got_entry_count): New function.
2096         (Target_arm::plt_entry_count): New function.
2097         (Target_arm::first_plt_entry_offset): New function.
2098         (Target_arm::plt_entry_size): New function.
2099         (Output_data_plt_arm::entry_count): New function.
2100         (Output_data_plt_arm::first_plt_entry_offset): New function.
2101         (Output_data_plt_arm::get_plt_entry_size): New function.
2102         * i386.cc (Target_i386::got_size): Add const.
2103         (Target_i386::got_entry_count): New function.
2104         (Target_i386::plt_entry_count): New function.
2105         (Target_i386::first_plt_entry_offset): New function.
2106         (Target_i386::plt_entry_size): New function.
2107         (Output_data_plt_i386::entry_count): New function.
2108         (Output_data_plt_i386::first_plt_entry_offset): New function.
2109         (Output_data_plt_i386::get_plt_entry_size): New function.
2110         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2111         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2112         * incremental.cc: Include target.h.
2113         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2114         parameter.  Adjust all callers.  Find incremental_got_plt section.
2115         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2116         section.
2117         (Output_section_incremental_inputs::set_final_data_size): Calculate
2118         size of incremental_got_plt section.
2119         (Output_section_incremental_inputs::do_write): Write the
2120         incremental_got_plt section.
2121         (Got_plt_view_info): New struct.
2122         (Local_got_offset_visitor): New class.
2123         (Global_got_offset_visitor): New class.
2124         (Global_symbol_visitor_got_plt): New class.
2125         (Output_section_incremental_inputs::write_got_plt): New function.
2126         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2127         Add parameter.  Adjust all callers.
2128         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2129         (Incremental_inputs::got_plt_section): New function.
2130         (Incremental_inputs::got_plt_section_): New data member.
2131         (Incremental_got_plt_reader): New class.
2132         * layout.cc (Layout::create_incremental_info_sections): Add the
2133         incremental_got_plt section.
2134         * object.h (Got_offset_list::get_list): New function.
2135         (Got offset_list::for_all_got_offsets): New function.
2136         (Sized_relobj::local_got_offset_list): New function.
2137         * powerpc.cc (Target_powerpc::got_size): Add const.
2138         (Target_powerpc::got_entry_count): New function.
2139         (Target_powerpc::plt_entry_count): New function.
2140         (Target_powerpc::first_plt_entry_offset): New function.
2141         (Target_powerpc::plt_entry_size): New function.
2142         (Output_data_plt_powerpc::entry_count): New function.
2143         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2144         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2145         * sparc.cc (Target_sparc::got_size): Add const.
2146         (Target_sparc::got_entry_count): New function.
2147         (Target_sparc::plt_entry_count): New function.
2148         (Target_sparc::first_plt_entry_offset): New function.
2149         (Target_sparc::plt_entry_size): New function.
2150         (Output_data_plt_sparc::entry_count): New function.
2151         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2152         (Output_data_plt_sparc::get_plt_entry_size): New function.
2153         * symtab.h (Symbol::got_offset_list): New function.
2154         (Symbol_table::for_all_symbols): New function.
2155         * target.h (Sized_target::got_entry_count): New function.
2156         (Sized_target::plt_entry_count): New function.
2157         (Sized_target::plt_entry_size): New function.
2158         * x86_64.cc (Target_x86_64::got_size): Add const.
2159         (Target_x86_64::got_entry_count): New function.
2160         (Target_x86_64::plt_entry_count): New function.
2161         (Target_x86_64::first_plt_entry_offset): New function.
2162         (Target_x86_64::plt_entry_size): New function.
2163         (Output_data_plt_x86_64::entry_count): New function.
2164         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2165         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2166
2167 2010-08-12  Cary Coutant  <ccoutant@google.com>
2168
2169         * archive.cc: Include incremental.h.
2170         (Archive::Archive): Initialize incremental_info_.
2171         (Archive::include_member): Record archive members in incremental info.
2172         (Add_archive_symbols::run): Record begin and end of an archive in
2173         incremental info.
2174         (Lib_group::include_member): Record objects in incremental info.
2175         * archive.h (Incremental_archive_entry): Forward declaration.
2176         (Archive::set_incremental_info): New member function.
2177         (Archive::incremental_info): New member function.
2178         (Archive::Unused_symbol_iterator): New class.
2179         (Archive::unused_symbols_begin): New member function.
2180         (Archive::unused_symbols_end): New member function.
2181         (Archive::incremental_info_): New data member.
2182         * incremental-dump.cc (find_input_containing_global): New function.
2183         (dump_incremental_inputs): Dump new incremental info sections.
2184         * incremental.cc: Include symtab.h.
2185         (Output_section_incremental_inputs): New class.
2186         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2187         new incremental info sections.
2188         (Sized_incremental_binary::do_check_inputs): Likewise.
2189         (Incremental_inputs::report_archive): Remove.
2190         (Incremental_inputs::report_archive_begin): New function.
2191         (Incremental_inputs::report_archive_end): New function.
2192         (Incremental_inputs::report_object): New function.
2193         (Incremental_inputs::finalize_inputs): Remove.
2194         (Incremental_inputs::report_input_section): New function.
2195         (Incremental_inputs::report_script): Rewrite.
2196         (Incremental_inputs::finalize): Do nothing but finalize string table.
2197         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2198         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2199         (Incremental_inputs::create_data_sections): New function.
2200         (Incremental_inputs::relocs_entsize): New function.
2201         (Output_section_incremental_inputs::set_final_data_size): New function.
2202         (Output_section_incremental_inputs::do_write): New function.
2203         (Output_section_incremental_inputs::write_header): New function.
2204         (Output_section_incremental_inputs::write_input_files): New function.
2205         (Output_section_incremental_inputs::write_info_blocks): New function.
2206         (Output_section_incremental_inputs::write_symtab): New function.
2207         * incremental.h (Incremental_script_entry): Forward declaration.
2208         (Incremental_object_entry): Forward declaration.
2209         (Incremental_archive_entry): Forward declaration.
2210         (Incremental_inputs): Forward declaration.
2211         (Incremental_inputs_header_data): Remove.
2212         (Incremental_inputs_header): Remove.
2213         (Incremental_inputs_header_write): Remove.
2214         (Incremental_inputs_entry_data): Remove.
2215         (Incremental_inputs_entry): Remove.
2216         (Incremental_inputs_entry_write): Remove.
2217         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2218         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2219         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2220         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2221         Likewise.
2222         (Incremental_input_entry): New class.
2223         (Incremental_script_entry): New class.
2224         (Incremental_object_entry): New class.
2225         (Incremental_archive_entry): New class.
2226         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2227         (Incremental_inputs::report_inputs): Remove.
2228         (Incremental_inputs::report_archive): Remove.
2229         (Incremental_inputs::report_archive_begin): New function.
2230         (Incremental_inputs::report_archive_end): New function.
2231         (Incremental_inputs::report_object): Change prototype.
2232         (Incremental_inputs::report_input_section): New function.
2233         (Incremental_inputs::report_script): Change prototype.
2234         (Incremental_inputs::get_reloc_count): New function.
2235         (Incremental_inputs::set_reloc_count): New function.
2236         (Incremental_inputs::create_data_sections): New function.
2237         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2238         (Incremental_inputs::inputs_section): New function.
2239         (Incremental_inputs::symtab_section): New function.
2240         (Incremental_inputs::relocs_section): New function.
2241         (Incremental_inputs::get_stringpool): Add const.
2242         (Incremental_inputs::command_line): Add const.
2243         (Incremental_inputs::inputs): Remove.
2244         (Incremental_inputs::command_line_key): New function.
2245         (Incremental_inputs::input_file_count): New function.
2246         (Incremental_inputs::input_files): New function.
2247         (Incremental_inputs::relocs_entsize): New function.
2248         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2249         (Incremental_inputs::finalize_inputs): Remove.
2250         (Incremental_inputs::Input_info): Remove.
2251         (Incremental_inputs::lock_): Remove.
2252         (Incremental_inputs::inputs_): Change type.
2253         (Incremental_inputs::inputs_map_): Remove.
2254         (Incremental_inputs::current_object_entry_): New data member.
2255         (Incremental_inputs::inputs_section_): New data member.
2256         (Incremental_inputs::symtab_section_): New data member.
2257         (Incremental_inputs::relocs_section_): New data member.
2258         (Incremental_inputs::reloc_count_): New data member.
2259         (Incremental_inputs_reader): New class.
2260         (Incremental_symtab_reader): New class.
2261         (Incremental_relocs_reader): New class.
2262         * layout.cc (Layout::finalize): Move finalization of incremental info
2263         and creation of incremental info sections to follow finalization of
2264         symbol table.  Set offsets for postprocessing sections.
2265         (Layout::create_incremental_info_sections): Call
2266         Incremental_inputs::create_data_sections.  Add incremental symtab
2267         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2268         sections to layout after input sections.
2269         * layout.h (struct Timespec): Forward declaration.
2270         (Layout::incremental_inputs): Add const.
2271         (Layout::create_incremental_info_sections): Add parameter.
2272         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2273         * object.cc: Include incremental.h.
2274         (Relobj::finalize_incremental_relocs): New function.
2275         (Sized_relobj::do_layout): Record input sections in incremental info.
2276         * object.h (Object::output_section): New function.
2277         (Object::output_section_offset): Moved from Relobj.
2278         (Object::get_incremental_reloc_base): New function.
2279         (Object::get_incremental_reloc_count): New function.
2280         (Object::do_output_section): New function.
2281         (Object::do_output_section_offset): Moved from Relobj.
2282         (Object::do_get_incremental_reloc_base): New function.
2283         (Object::do_get_incremental_reloc_count): New function.
2284         (Object::Object): Initialize new data members.
2285         (Relobj::output_section): Renamed do_output_section and moved to
2286         protected.
2287         (Relobj::output_section_offset): Moved to Object.
2288         (Relobj::do_get_incremental_reloc_base): New function.
2289         (Relobj::do_get_incremental_reloc_count): New function.
2290         (Relobj::allocate_incremental_reloc_counts): New function.
2291         (Relobj::count_incremental_reloc): New function.
2292         (Relobj::finalize_incremental_relocs): New function.
2293         (Relobj::next_incremental_reloc_index): New function.
2294         (Relobj::reloc_counts_): New data member.
2295         (Relobj::reloc_bases_): New data member.
2296         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2297         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2298         (Sized_relobj::incremental_relocs_scan): New function.
2299         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2300         (Sized_relobj::incremental_relocs_write): New function.
2301         (Sized_relobj::incremental_relocs_write_reltype): New function.
2302         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2303         incremental link.
2304         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2305         archives and object files elsewhere.
2306         (Add_symbols::run): Report object files here.
2307         (Finish_group::run): Report end of archive at end of group.
2308         * reloc.cc: Include layout.h, incremental.h.
2309         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2310         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2311         (Sized_relobj::incremental_relocs_scan): New function.
2312         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2313         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2314         (Sized_relobj::incremental_relocs_write): New function.
2315         (Sized_relobj::incremental_relocs_write_reltype): New function.
2316         * script.cc (read_input_script): Rewrite test for incremental link.
2317         Change call to Incremental_inputs::report_script.
2318         * symtab.h (Symbol_table::first_global_index): New function.
2319         (Symbol_table::output_count): New function.
2320
2321 2010-08-12  Doug Kwan  <dougkwan@google.com>
2322
2323         * arm.cc (Target_arm::merge_object_attributes): Check command line
2324         options --no-wchar-size-warning and --no-enum-size-warning.
2325         * options.h (General_options): Add ld-compatible options
2326         --no-enum-size-warning and --no-wchar-size-warning.
2327
2328 2010-08-04  Ian Lance Taylor  <iant@google.com>
2329
2330         * x86_64.cc (Target_x86_64::Scan::local): Use
2331         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2332         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2333         (Target_x86_64::Scan::global): Likewise.
2334         (Target_x86_64::Relocate::relocate): Likewise.
2335         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2336         Likewise.
2337
2338 2010-08-03  Cary Coutant  <ccoutant@google.com>
2339
2340         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2341         to reserve space in merged_strings vector. Keep total input size
2342         for stats.
2343         (Output_merge_string::do_print_merge_stats): Print total input size.
2344         * merge.h (Output_merge_string): Add input_size_ field.
2345         * stringpool.cc (Stringpool_template::string_length): Move
2346         implementations out of Stringpool_template class and place in
2347         stringpool.h.
2348         * stringpool.h (string_length): Move out of Stringpool_template.
2349
2350 2010-08-03  Ian Lance Taylor  <iant@google.com>
2351
2352         PR 11712
2353         * layout.cc (relaxation_loop_body): If address of load segment is
2354         set, adjust address to include headers if possible.
2355
2356 2010-08-03  Ian Lance Taylor  <iant@google.com>
2357
2358         * version.cc (version_string): Bump to 1.10.
2359
2360 2010-08-03  Ian Lance Taylor  <iant@google.com>
2361
2362         PR 11805
2363         * layout.h (enum Output_section_order): Define.
2364         (class Layout): Update declarations.
2365         * layout.cc (Layout::get_output_section): Add order parameter.
2366         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2367         is_first_non_relro parameters.  Change all callers.
2368         (Layout::choose_output_section): Likewise.
2369         (Layout::add_output_section_data): Likewise.
2370         (Layout::make_output_section): Likewise.  Set order.
2371         (Layout::default_section_order): New function.
2372         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2373         * output.cc (Output_section::Output_section): Initialize order_.
2374         Don't initialize deleted fields.
2375         (Output_segment::Output_segment): Don't initialize deleted
2376         fields.
2377         (Output_segment::add_output_section_to_load): New function
2378         replacing add_output_section.  Change all callers to call this or
2379         add_output_section_to_nonload.
2380         (Output_segment::add_output_section_to_nonload): New function.
2381         (Output_segment::remove_output_section): Rewrite.
2382         (Output_segment::add_initial_output_data): Likewise.
2383         (Output_segment::has_any_data_sections): Likewise.
2384         (Output_segment::is_first_section_relro): Likewise.
2385         (Output_segment::maximum_alignment): Likewise.
2386         (Output_segment::has_dynamic_reloc): New function replacing
2387         dynamic_reloc_count.  Change all callers.
2388         (Output_segment::has_dynamic_reloc_list): New function replacing
2389         dynamic_reloc_count_list.  Change all callers.
2390         (Output_segment::set_section_addresses): Rewrite.
2391         (Output_segment::set_offset): Rewrite.
2392         (Output_segment::find_first_and_last_list): Remove.
2393         (Output_segment::set_tls_offsets): Rewrite.
2394         (Output_segment::first_section_load_address): Likewise.
2395         (Output_segment::output_section_count): Likewise.
2396         (Output_segment::section_with_lowest_load_address): Likewise.
2397         (Output_segment::write_section_headers): Likewise.
2398         (Output_segment::print_sections_to_map): Likewise.
2399         * output.h (class Output_data): Remove dynamic_reloc_count_
2400         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2401         (Output_data::add_dynamic_reloc): Rewrite.
2402         (Output_data::has_dynamic_reloc): New function.
2403         (Output_data::dynamic_reloc_count): Remove.
2404         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2405         is_last_relro_, is_first_non_relro_, is_interp_,
2406         is_dynamic_linker_section_ fields.  Add order and set_order
2407         functions.  Remove is_relro_local, set_is_relro_local,
2408         is_last_relro, set_is_last_relro, is_first_non_relro,
2409         set_is_first_non_relro functions, is_interp, set_is_interp,
2410         is_dynamic_linker_section, and set_is_dynamic_linker_section
2411         functions.
2412         (class Output_segment): Change Output_data_list from std::list to
2413         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2414         output_bss_ fields.  Update declarations.
2415
2416 2010-08-02  Ian Lance Taylor  <iant@google.com>
2417
2418         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2419         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2420         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2421
2422 2010-08-02  Ian Lance Taylor  <iant@google.com>
2423
2424         PR 11855
2425         * script.cc (Script_options::Script_options): Initialize
2426         symbol_definitions_ and symbol_references_.
2427         (Script_options::add_symbol_assignment): Update
2428         symbol_definitions_ and symbol_references_.
2429         (Script_options::add_symbol_reference): New function.
2430         (script_symbol): New function.
2431         * script.h (class Script_options): Add symbol_definitions_ and
2432         symbol_references_ fields.
2433         (Script_options::referenced_const_iterator): New type.
2434         (Script_options::referenced_begin): New function.
2435         (Script_options::referenced_end): New function.
2436         (Script_options::is_referenced): New function.
2437         (Script_options::any_unreferenced): New function.
2438         * script-c.h (script_symbol): Declare.
2439         * yyscript.y (exp): Call script_symbol.
2440         * symtab.cc: Include "script.h".
2441         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2442         Change all callers.  Check symbols referenced by scripts.
2443         (Symbol_table::add_undefined_symbols_from_command_line): Add
2444         layout parameter.  Change all callers.
2445         (Symbol_table::do_add_undefined_symbols_from_command_line):
2446         Likewise.  Break out loop body.  Check symbols referenced by
2447         scripts.
2448         (Symbol_table::add_undefined_symbol_from_command_line): New
2449         function broken out of
2450         do_add_undefined_symbols_from_command_line.
2451         * symtab.h (class Symbol_table): Update declarations.
2452         * archive.cc: Include "layout.h".
2453         (Archive::should_include_member): Add layout parameter.  Change
2454         all callers.  Check for symbol mentioned in expression.
2455         * archive.h (class Archive): Update declaration.
2456         * object.cc (Sized_relobj::do_should_include_member): Add layout
2457         parameter.
2458         * object.h (Object::should_include_member): Add layout parameter.
2459         Change all callers.
2460         (Object::do_should_include_member): Add layout parameter.
2461         (class Sized_relobj): Update declaration.
2462         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2463         parameter.
2464         * dynobj.h (class Sized_dynobj): Update declaration.
2465         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2466         layout parameter.
2467         * plugin.h (class Sized_pluginobj): Update declaration.
2468
2469 2010-08-02  Ian Lance Taylor  <iant@google.com>
2470
2471         PR 11866
2472         * output.cc (Output_segment::set_offset): Search for the first and
2473         last sections rather than assuming that the list is in order.
2474         (Output_segment::find_first_and_last_list): New function.
2475         * output.h (class Output_segment): Update declarations.
2476         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2477         (relro_strip_test_SOURCES): New variable.
2478         (relro_strip_test_DEPENDENCIES): New variable.
2479         (relro_strip_test_LDFLAGS): New variable.
2480         (relro_strip_test_LDADD): New variable.
2481         (relro_strip_test.so): New target.
2482
2483 2010-08-02  Ian Lance Taylor  <iant@google.com>
2484
2485         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2486         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2487         (Target_i386::got_tlsdesc_section): New function.
2488         (Target_i386::got_section): Create space for GOT entries for
2489         TLSDESC relocations.
2490         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2491         R_386_TLS_GOTDESC.
2492         (Target_i386::Scan::global): Likewise.
2493         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2494         using TLSDESC GOT.
2495         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2496         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2497         (Target_x86_64::got_tlsdesc_section): New function.
2498         (Target_x86_64::got_section): Create space for GOT entries for
2499         TLSDESC relocations.
2500         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2501         R_386_TLS_GOTDESC.
2502         (Target_x86_64::Scan::global): Likewise.
2503         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2504         using TLSDESC GOT.
2505
2506 2010-08-02  Ian Lance Taylor  <iant@google.com>
2507
2508         * testsuite/final_layout.sh: Use dc to convert from hex to
2509         decimal.
2510
2511 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2512
2513         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2514         paramter to the call to gold::gc_process_relocs.
2515         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2516         paramter to the call to gold::gc_process_relocs.
2517         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2518         parameter to the call to gold::gc_process_relocs.
2519         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2520         template parameter to the call to gold::gc_process_relocs.
2521         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2522         paramter to the call to gold::gc_process_relocs.
2523         * gc.h (get_embedded_addend_size): New function.
2524         (gc_process_relocs): Save the size of the reloc for use by ICF.
2525         * icf.cc (get_section_contents): Get the addend from the text section
2526         for SHT_REL relocation sections.
2527         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2528         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2529         * int_encoding.h (read_from_pointer): New overloaded function.
2530         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2531         * testsuite/icf_sht_rel_addend_test.sh: New file.
2532         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2533         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2534
2535 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2536
2537         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2538         * Makefile.in: Regenerate.
2539         * testsuite/Makefile.in: Regenerate.
2540
2541 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2542
2543         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2544         * gold/testsuite/debug_msg.cc: Likewise.
2545         * gold/testsuite/odr_violation1.cc
2546         * gold/testsuite/odr_violation2.cc
2547
2548 2010-07-21  Cary Coutant  <ccoutant@google.com>
2549
2550         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2551         string, and length fields.
2552         (Output_merge_string::Merged_strings_list): New type.
2553         (Output_merge_string::Merged_strings_lists): New typedef.
2554         (Output_merge_string): Replace merged_strings_ with
2555         merged_strings_lists_.
2556         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2557         Merged_strings_list per input object and section.  Don't store pointer
2558         to the string.  Don't store length with each merged string entry.
2559         (Output_merge_string::finalize_merged_data): Loop over list of merged
2560         strings lists.  Recompute length of each merged string.
2561
2562 2010-07-15  Cary Coutant  <ccoutant@google.com>
2563
2564         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2565         here.
2566
2567 2010-07-14  Ian Lance Taylor  <iant@google.com>
2568
2569         * descriptors.cc (Descriptors::open): Report correct name in error
2570         message.
2571
2572 2010-07-13  Doug Kwan  <dougkwan@google.com>
2573
2574         * arm.cc (Arm_input_section::Arm_input_section): For a
2575         SHT_ARM_EXIDX section, always keeps the input sections.
2576         (Arm_input_section::set_exidx_section_link): New method.
2577         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2578         has_errors_ to false.
2579         (Arm_exidx_input_section::has_errors,
2580         Arm_exidx_input_section::set_has_errors): New methods.
2581         (Arm_exidx_input_section::has_errors_): New data member.
2582         (Arm_relobj::get_exidx_shndx_list): New method.
2583         (Arm_output_section::append_text_sections_to_list): Do not skip
2584         section without SHF_EXECINSTR.
2585         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2586         errors.
2587         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2588         section header.  Make error messages more verbose.  Check for
2589         a non-executable section linked to an EXIDX section.
2590         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2591         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2592         check that there is no deferred EXIDX section if we exit early.
2593         Instead of not making an EXIDX section in case of an error, make one
2594         and set the has_errors flag of it.
2595         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2596         in a relocatable link.
2597         (Target_arm::do_relax): Look for the EXIDX output section instead of
2598         assuming that it is called .ARM.exidx.
2599         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2600         section list.  Do not check for SHF_EXECINSTR section flags but
2601         skip any input section with errors.
2602         * output.cc (Output_section::Output_section): Initialize
2603         always_keeps_input_sections_ to false.
2604         (Output_section::add_input_section): Check for
2605         always_keeps_input_sections_.
2606         *  output.h (Output_section::always_keeps_input_sections,
2607         Output_section::set_always_keeps_input_sections): New methods.
2608         (Output_section::always_keeps_input_sections): New data member.
2609
2610 2010-07-13  Rafael Espindola  <espindola@google.com>
2611
2612         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2613         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2614
2615 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2616             Ian Lance Taylor  <iant@google.com>
2617
2618         * output.h (Output_section_lookup_maps::add_merge_section):
2619         Correct check of whether value was inserted.
2620         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2621         (Output_section_lookup_maps::add_relaxed_input_section):
2622         Likewise.
2623         * arm.cc (Target_arm::got_section): Remove used local os.
2624         * i386.cc (Target_i386::got_section): Likewise.
2625         * x86_64.cc (Target_x86_64::got_section): Likewise.
2626         * sparc.cc (Target_sparc::got_section): Likewise.
2627         (Target_sparc::relocate): Remove unused local have_got_offset.
2628         * powerpc.cc (Target_powerpc::relocate): Likewise.
2629
2630 2010-07-13  Ian Lance Taylor  <iant@google.com>
2631
2632         * compressed_output.cc (zlib_decompress): Fix signature in
2633         !HAVE_ZLIB_H case.
2634
2635         * archive.cc (Archive::include_member): Unlock an external member
2636         of a thin archive.  Don't bother to delete an object we know is
2637         NULL.
2638
2639 2010-07-12  Cary Coutant  <ccoutant@google.com>
2640
2641         * compressed_output.cc (zlib_decompress): New function.
2642         (get_uncompressed_size): New function.
2643         (decompress_input_section): New function.
2644         * compressed_output.h (get_uncompressed_size): New function.
2645         (decompress_input_section): New function.
2646         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2647         Handle compressed debug sections.
2648         * layout.cc (is_compressed_debug_section): New function.
2649         (Layout::output_section_name): Map compressed section names to
2650         canonical names.
2651         * layout.h (is_compressed_debug_section): New function.
2652         (is_debug_info_section): Recognize compressed debug sections.
2653         * merge.cc: Include compressed_output.h.
2654         (Output_merge_data::do_add_input_section): Handle compressed
2655         debug sections.
2656         (Output_merge_string::do_add_input_section): Handle compressed
2657         debug sections.
2658         * object.cc: Include compressed_output.h.
2659         (Sized_relobj::Sized_relobj): Initialize new data members.
2660         (build_compressed_section_map): New function.
2661         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2662         * object.h (Object::section_is_compressed): New method.
2663         (Object::do_section_is_compressed): New method.
2664         (Sized_relobj::Compressed_section_map): New type.
2665         (Sized_relobj::do_section_is_compressed): New method.
2666         (Sized_relobj::compressed_sections_): New data member.
2667         * output.cc (Output_section::add_input_section): Handle compressed
2668         debug sections.
2669         * reloc.cc: Include compressed_output.h.
2670         (Sized_relobj::write_sections): Handle compressed debug sections.
2671
2672 2010-07-08  Cary Coutant  <ccoutant@google.com>
2673
2674         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2675         weak when resolving to a dynamic def.
2676         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2677         for weak undef/dynamic def cases. Adjust callers.
2678         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2679         undef_binding_weak_.
2680         (Symbol_table::sized_write_globals): Adjust symbol binding.
2681         (Symbol_table::sized_write_symbol): Add binding parameter.
2682         * symtab.h (Symbol::set_undef_binding): New method.
2683         (Symbol::is_undef_binding_weak): New method.
2684         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2685         (Symbol_table::should_override): Add new parameter.
2686         (Symbol_table::sized_write_symbol): Add new parameter.
2687
2688         * testsuite/weak_undef_file1.cc: Add new test case.
2689         * testsuite/weak_undef_file2.cc: Fix header comment.
2690         * testsuite/weak_undef_test.cc: Add new test case.
2691
2692 2010-06-29  Doug Kwan  <dougkwan@google.com>
2693
2694         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2695         Initialize USE_SYMBOL_.
2696         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2697         definition.
2698         (Arm_reloc_property::uses_symbol_): New data member declaration.
2699         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2700         uses symbol value and symbol is undefined but not weakly undefined.
2701
2702 2010-06-28  Rafael Espindola  <espindola@google.com>
2703
2704         * plugin.cc (Plugin::load): Use dlerror.
2705
2706 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2707
2708         * symtab.cc (detect_odr_violations): When reporting an ODR
2709         violation, report an object where the symbol is defined.
2710
2711 2010-06-25  Doug Kwan  <dougkwan@google.com>
2712
2713         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2714         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2715         definition.
2716         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2717         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2718         target hook to detect function points.
2719         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2720         * icf.h (Icf::check_section_for_function_pointers): Change type of
2721         parameter SECTION_NAME to const reference to std::string.  Use
2722         target hook to determine if section may have unsafe pointers.
2723         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2724         method definition.
2725
2726 2010-06-21  Rafael Espindola  <espindola@google.com>
2727
2728         * fileread.cc (Input_file::find_fie): New
2729         (Input_file::open): Use Input_file::find_fie.
2730         * fileread.h (Input_file::find_fie): New
2731         * plugin.cc (set_extra_library_path): New.
2732         (Plugin::load): Add set_extra_library_path to the transfer vector.
2733         (Plugin_manager::set_extra_library_path): New.
2734         (Plugin_manager::add_input_file): Use the extra search path if set.
2735         (set_extra_library_path(): New.
2736         * plugin.h (Plugin_manager): Add set_extra_library_path and
2737         extra_search_path_.
2738
2739 2010-06-19  Cary Coutant  <ccoutant@google.com>
2740
2741         * layout.cc (gdb_sections): Add .debug_types.
2742         (lines_only_debug_sections): Likewise.
2743
2744 2010-06-18  Rafael Espindola  <espindola@google.com>
2745
2746         * plugin.cc (add_input_file,add_input_library)
2747         (Plugin_manager::add_input_file): Make filename arguments const.
2748         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2749         const.
2750
2751 2010-06-16  Doug Kwan  <dougkwan@google.com>
2752
2753         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2754         .ARM.attributes section if we have not merged any input
2755         attributes sections.
2756
2757 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2758
2759         * arm.cc: Allow combining objects with no EABI version
2760         information.
2761
2762 2010-06-15  Rafael Espindola  <espindola@google.com>
2763
2764         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2765
2766 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2767
2768         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2769         (struct iovec): Correct !HAVE_READV definition.
2770
2771 2010-06-10  Cary Coutant  <ccoutant@google.com>
2772
2773         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2774         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2775         reloc sections.
2776         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2777
2778         PR 11683
2779         * symtab.h (Symbol::is_placeholder): New member function.
2780         * target-reloc.h (relocate_section): Check for placeholder symbols.
2781
2782         * testsuite/Makefile.am (plugin_test_8): New test.
2783         (plugin_test_9): New test.
2784         * testsuite/Makefile.in: Regenerate.
2785
2786 2010-06-09  Nick Clifton  <nickc@redhat.com>
2787
2788         * yyscript.y (input_list_element): Allow strings prefixed with
2789         the '-' character.  Treat these as libraries.
2790         * script.cc (script_add_library): New function.  Adds a library
2791         specified by "-l<name>" found in an input script.
2792         * script-c.h: Add prototype for script_add_library.
2793
2794 2010-06-07  Doug Kwan  <dougkwan@google.com>
2795
2796         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2797         Restrict stub-group size to be within long conditional branch
2798         range when working around cortex-A8 erratum.
2799
2800 2010-06-07  Damien Diederen  <dd@crosstwine.com>
2801
2802         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2803         #ifdef typo.
2804
2805 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
2806
2807         PR gold/11658
2808         * output.cc
2809         (Output_section::Input_section_sort_entry::compare_section_ordering):
2810         Change to return non-zero correctly.
2811         (Output_section::Input_section_sort_section_order_index_compare
2812         ::operator()): Change to fix ambiguity in comparisons.
2813
2814 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
2815
2816         * gold.h (is_wildcard_string): New function.
2817         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2818         (Layout::layout_eh_frame): Ditto.
2819         (Layout::find_section_order_index): New method.
2820         (Layout::read_layout_from_file): New method.
2821         * layout.h (Layout::find_section_order_index): New method.
2822         (Layout::read_layout_from_file): New method.
2823         (Layout::input_section_position_): New private member.
2824         (Layout::input_section_glob_): New private member.
2825         * main.cc (main): Call read_layout_from_file here.
2826         * options.h (--section-ordering-file): New option.
2827         * output.cc (Output_section::input_section_order_specified_): New
2828         member.
2829         (Output_section::Output_section): Initialize new member.
2830         (Output_section::add_input_section): Add new parameter.
2831         Keep input sections when --section-ordering-file is used.
2832         (Output_section::set_final_data_size): Sort input sections when
2833         section ordering file is specified.
2834         (Output_section::Input_section_sort_entry): Add new parameter.
2835         Check sorting type.
2836         (Output_section::Input_section_sort_entry::compare_section_ordering):
2837         New method.
2838         (Output_section::Input_section_sort_compare::operator()): Change to
2839         consider section_order_index.
2840         (Output_section::Input_section_sort_init_fini_compare::operator()):
2841         Change to consider section_order_index.
2842         (Output_section::Input_section_sort_section_order_index_compare
2843         ::operator()): New method.
2844         (Output_section::sort_attached_input_sections): Change to sort
2845         according to section order when specified.
2846         (Output_section::add_input_section<32, true>): Add new parameter.
2847         (Output_section::add_input_section<64, true>): Add new parameter.
2848         (Output_section::add_input_section<32, false>): Add new parameter.
2849         (Output_section::add_input_section<64, false>): Add new parameter.
2850         * output.h (Output_section::add_input_section): Add new parameter.
2851         (Output_section::input_section_order_specified): New
2852         method.
2853         (Output_section::set_input_section_order_specified): New method.
2854         (Input_section::Input_section): Initialize section_order_index_.
2855         (Input_section::section_order_index): New method.
2856         (Input_section::set_section_order_index): New method.
2857         (Input_section::section_order_index_): New member.
2858         (Input_section::Input_section_sort_section_order_index_compare): New
2859         struct.
2860         (Output_section::input_section_order_specified_): New member.
2861         * script-sections.cc (is_wildcard_string): Delete and move modified
2862         method to gold.h.
2863         (Output_section_element_input::Output_section_element_input): Modify
2864         call to is_wildcard_string.
2865         (Output_section_element_input::Input_section_pattern
2866         ::Input_section_pattern): Ditto.
2867         (Output_section_element_input::Output_section_element_input): Ditto.
2868         * testsuite/Makefile.am (final_layout): New test case.
2869         * testsuite/Makefile.in: Regenerate.
2870         * testsuite/final_layout.cc: New file.
2871         * testsuite/final_layout.sh: New file.
2872
2873 2010-06-01  Rafael Espindola  <espindola@google.com>
2874
2875         * plugin.cc (Plugin::load): Pass the output name to the plugin.
2876
2877 2010-06-01  Rafael Espindola  <espindola@google.com>
2878
2879         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2880         visibility of symbols.
2881
2882 2010-05-27  Doug Kwan  <dougkwan@google.com>
2883
2884         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2885         from start of output section instead of address for a local symbol
2886         in a merged or relaxed section when doing a relocatable link.
2887
2888 2010-05-26  Rafael Espindola  <espindola@google.com>
2889
2890        PR 11604
2891         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2892         adding sections the garbage collector removed.
2893         * gold/testsuite/Makefile.am: Add test.
2894         * gold/testsuite/Makefile.in: Regenerate.
2895         * gold/testsuite/plugin_test_7.sh: New.
2896         * gold/testsuite/plugin_test_7_1.c: New.
2897         * gold/testsuite/plugin_test_7_2.c: New.
2898
2899 2010-05-26  Rafael Espindola  <espindola@google.com>
2900
2901         * script-sections.cc (Output_section_definition::set_section_addresses):
2902         Check for --section-start.
2903
2904 2010-05-26  Doug Kwan  <dougkwan@google.com>
2905
2906         * arm.cc (Arm_scan_relocatable_relocs): New class.
2907         (Target_arm::relocate_special_relocatable): New method.
2908         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2909         (Arm_relocate_functions::thumb_branch_common): Same.
2910         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2911         instead of Default_scan_relocatable_relocs.
2912         * target-reloc.h (relocate_for_relocatable): Let target handle
2913         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2914         * target.h (Sized_target::relocate_special_relocatable): New method.
2915
2916 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2917
2918         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2919
2920 2010-05-23  Doug Kwan  <dougkwan@google.com>
2921
2922         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2923         instead of a cast.
2924         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2925         with a direct branch, not a conditional branch, to a stub.
2926         * merge.cc (Output_merge_base::record_input_section): New method
2927         defintion.
2928         (Output_merge_data::do_add_input_section): Record input section if
2929         keeps-input-sections flag is set.
2930         (Output_merge_string::do_add_input_section): Ditto.
2931         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2932         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2933         INPUT_SECTIONS_.
2934         (Output_merge_base::keeps_input_sections,
2935         Output_merge_base::set_keeps_input_sections,
2936         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2937         method definitions.
2938         (Output_merge_base::Input_sections): New type declaration.
2939         (Output_merge_base::input_sections_begin,
2940         Output_merge_base::input_sections_end,
2941         Output_merge_base::do_set_keeps_input_sections): New method definitions.
2942         (Output_merge_base::bool keeps_input_sections_,
2943         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2944         Output_merge_base::input_sections_): New data members.
2945         (Output_merge_data::do_set_keeps_input_sections): New method
2946         defintion.
2947         (Output_merge_string::do_set_keeps_input_sections): Ditto.
2948         * output.cc (Output_section::Input_section::relobj): Move method
2949         defintion from class declaration to here and handle merge sections.
2950         (Output_section::Input_section::shndx): Ditto.
2951         (Output_section::Output_section): Remove initializations of removed
2952         data members and initialize new data member LOOKUP_MAPS_.
2953         (Output_section::add_input_section): Set keeps-input-sections flag
2954         for a newly created merge output section as appropriate.  Adjust code
2955         to use Output_section_lookup_maps class.
2956         (Output_section::add_relaxed_input_section): Adjst code for lookup
2957         maps code refactoring.
2958         (Output_section::add_merge_input_section): Add a new parameter
2959         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
2960         class.  If adding input section to a newly created merge output
2961         section fails, remove the new merge section.
2962         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2963         Adjust code for use of the Output_section_lookup_maps class.
2964         (Output_section::find_merge_section): Ditto.
2965         (Output_section::build_lookup_maps): New method defintion.
2966         (Output_section::find_relaxed_input_section): Adjust code to use
2967         Output_section_lookup_maps class.
2968         (Output_section::get_input_sections): Export merge sections.  Adjust
2969         code to use Output_section_lookup_maps class.
2970         (Output_section:::add_script_input_section): Adjust code to use
2971         Output_section_lookup_maps class.  Update lookup maps for merge
2972         sections also.
2973         (Output_section::discard_states): Use Output_section_lookup_maps.
2974         (Output_section::restore_states): Same.
2975         * output.h (Merge_section_properties): Move class defintion out of
2976         Output_section.
2977         (Output_section_lookup_maps): New class.
2978         (Output_section::Input_section::is_merge_section): New method
2979         defintion.
2980         (Output_section::Input_section::relobj): Move defintion out of class
2981         defintion.  Declare method only.
2982         (Output_section::Input_section::shndx): Ditto.
2983         (Output_section::Input_section::output_merge_base): New method defintion.
2984         (Output_section::Input_section::u2_.pomb): New union field.
2985         (Output_section::Merge_section_by_properties_map,
2986         Output_section::Output_section_data_by_input_section_map,
2987         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2988         Remove types.
2989         (Output_section::add_merge_input_section): Add new parameter
2990         KEEPS_INPUT_SECTIONS.
2991         (Output_section::build_lookup_maps): New method declaration.
2992         (Output_section::merge_section_map_,
2993         Output_section::merge_section_by_properties_map_,
2994         Output_section::relaxed_input_section_map_,
2995         Output_section::is_relaxed_input_section_map_valid_): Remove data
2996         members.
2997         (Output_section::lookup_maps_): New data member.
2998
2999 2010-05-21  Doug Kwan  <dougkwan@google.com>
3000
3001         PR gold/11619
3002         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3003         avoid a compilation error.
3004
3005 2010-05-19  Rafael Espindola  <espindola@google.com>
3006
3007         * script-sections.cc (Output_section_definition::allocate_to_segment):
3008         Update the phdrs_list even when the output section is NULL.
3009         * testsuite/Makefile.am: Add test.
3010         * testsuite/Makefile.in: Regenerate.
3011         * testsuite/script_test_9.cc: New.
3012         * testsuite/script_test_9.sh: New.
3013         * testsuite/script_test_9.t: New.
3014
3015 2010-05-19  Doug Kwan  <dougkwan@google.com>
3016
3017         * arm.cc (Arm_input_section::original_size): New method.
3018         (Arm_input_section::do_addralign): Add a cast.
3019         (Arm_input_section::do_output_offset): Remove static cast.
3020         (Arm_input_section::original_addralign,
3021          Arm_input_section::original_size_): Change type to uint32_t.
3022         (Arm_input_section::init): Add safe casts for section alignment
3023         and size.
3024         (Arm_input_section::set_final_data_size): Do not set address and
3025         offset of stub table.
3026         (Arm_output_section::fix_exidx_coverage): Change use of of
3027         Output_section::Simple_input_section to that of
3028         Output_section::Input_section.
3029         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3030         except for the first pass.
3031         * output.cc (Output_section::get_input_sections): Change type of
3032         input_sections to std::list<Input_section>.
3033         (Output_section::add_script_input_section): Rename from
3034         Output_section::add_simple_input_section.  Change type of SIS
3035         parameter from Simple_input_section to Input_section.
3036         * output.h (Output_section::Simple_input_section): Remove class.
3037         (Output_section::Input_section): Change class visibility to public.
3038         (Output_section::Input_section::addralign): Use stored alignments
3039         for special input sections if set.
3040         (Output_section::Input_section::set_addralign): New method.
3041         (Output_section::get_input_sections): Change parameter type from
3042         list of Simple_input_section to list of Input_section.
3043         (Output_section::add_script_input_section): Rename from
3044         Output_section::add_simple_input_section. Change first parameter's
3045         type from Simple_input_section to Input_section and remove the
3046         second and third parameters.
3047         * script-sections.cc (Input_section::Input_section_list): Change
3048         type to list of Output_section::Input_section/
3049         (Input_section_info::Input_section_info): Change parameter type of
3050         INPUT_SECTION to Output_section::Input_section.
3051         (Input_section_info::input_section): Change return type.
3052         (Input_section_info::input_section_): Change type to
3053         Output_section::Input_section.
3054         (Output_section_element_input::set_section_addresses): Adjust code
3055         to use Output_section::Input_section instead of
3056         Output_section::Simple_input_section.  Adjust code for renaming
3057         of Output_section::add_simple_input_section.
3058         (Orphan_output_section::set_section_addresses): Ditto.
3059
3060 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3061
3062         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3063         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3064
3065 2010-05-18  Rafael Espindola  <espindola@google.com>
3066
3067         * options.cc (General_options::finalize): Handle -nostdlib.
3068         * options.h (nostdlib): New option.
3069         * script.cc (script_add_search_dir): Handle -nostdlib.
3070
3071 2010-05-12  Doug Kwan  <dougkwan@google.com>
3072
3073         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3074         attributes section only if there no attributes section after merging.
3075         (Target_arm::merge_object_attributes): Move value of
3076         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3077         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3078         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3079         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3080         and arm_attr_merge_7.stdout.
3081         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3082         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3083         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3084         arm_attr_merge_7b.o): New rules.
3085         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3086         arm_attr_merge_7
3087         * testsuite/Makefile.in: Regenerate.
3088         * testsuite/arm_attr_merge.sh: New file.
3089         * testsuite/arm_attr_merge_[67][ab].s: Same.
3090
3091 2010-05-05  Nick Clifton  <nickc@redhat.com>
3092
3093         * po/es.po: Updated Spanish translation.
3094
3095 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3096
3097         * Makefile.am (install-exec-local): Properly install gold as
3098         default cross linker.
3099         * Makefile.in: Regenerated.
3100
3101 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3102             Nick Clifton  <nickc@redhat.com>
3103
3104         * configure.ac (install_as_default): Define and set to false
3105         unless --enable-gold or --enable-gold=both/gold has been
3106         specified.
3107         * configure: Regenerate.
3108
3109         * Makefile.am (install-exec-local): Install the executable as
3110         'ld.gold'.  If install_as_default is true then also install it as
3111         'ld'.
3112         * Makefile.in: Regenerated.
3113
3114 2010-04-24  Ian Lance Taylor  <iant@google.com>
3115
3116         * layout.cc (Layout::layout_reloc): In relocatable link don't
3117         combine reloc sections for grouped sections.
3118
3119 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3120
3121         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3122         sections that are not ordinary to icf.
3123         * icf.cc (get_section_contents): Handle relocation pointing to section
3124         with no object or shndx information.
3125         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3126         * testsuite/Makefile.in: Regenerate.
3127         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3128         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3129
3130 2010-04-22  Ian Lance Taylor  <iant@google.com>
3131
3132         * expression.cc (Expression::Expression_eval_info): Add
3133         result_alignment_pointer field.
3134         (Expression::eval_with_dot): Add result_alignment_pointer
3135         parameter.  Change all callers.
3136         (Expression::eval_maybe_dot): Likewise.
3137         (class Binary_expression): Add alignment_pointer parameter to
3138         left_value and right_value.  Change all callers.
3139         (BINARY_EXPRESSION): Set result alignment.
3140         (class Trinary_expression): Add alignment_pointer parameter to
3141         arg2_value and arg3_value.  Change all callers.
3142         (Trinary_cond::value): Set result alignment.
3143         (Max_expression::value, Min_expression::value): Likewise.
3144         (Align_expression::value): Likewise.
3145         * script-sections.cc (class Sections_element): Add dot_alignment
3146         parameter to set_section_addresses virtual function.  Update
3147         instantiations.
3148         (class Output_section_element): Likewise.
3149         (Script_sections::create_segments): Add dot_alignment parameter.
3150         Change all callers.
3151         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3152         (Script_sections::set_phdrs_clause_addresses): Likewise.
3153         * script-sections.h: Update declarations.
3154         * script.h: Update declarations.
3155         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3156         min_p_align.
3157         * testsuite/script_test_3.t: Set large alignment.
3158         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3159         segment has expected alignment.
3160
3161 2010-04-22  Nick Clifton  <nickc@redhat.com>
3162
3163         * po/gold.pot: Updated by the Translation project.
3164         * po/vi.po: Updated Vietnamese translation.
3165
3166 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3167
3168         * testsuite/Makefile.am (check_PROGRAMS): Add
3169         icf_virtual_function_folding_test.
3170         * testsuite/Makefile.in: Regenerated.
3171
3172 2010-04-15  Andrew Haley  <aph@redhat.com>
3173
3174         * options.h (merge_exidx_entries): New option.
3175         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3176         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3177         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3178         (Target_arm::merge_exidx_entries): New function.
3179         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3180         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3181         to Arm_exidx_fixup constructor.
3182         Add new arg, merge_exidx_entries.
3183         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3184         Arm_output_section::fix_exidx_coverage.
3185
3186 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3187
3188         * icf.cc (get_section_contents): Check for preemptible functions.
3189         Ignore addend when appropriate.
3190         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3191         section folded.
3192         (add_from_relobj): Check for section folded.
3193         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3194         * symtab.h (should_add_dynsym_entry): Add new parameter.
3195         * target-reloc.h (scan_relocs): Check for section folded.
3196         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3197         Check reloc types for function pointers in shared objects.
3198         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3199         case.
3200         (icf_preemptible_functions_test): New test case.
3201         (icf_string_merge_test): New test case.
3202         * testsuite.Makefile.in: Regenerate.
3203         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3204         bar_glob.  Refactor code.
3205         * testsuite/icf_preemptible_functions_test.cc: New file.
3206         * testsuite/icf_preemptible_functions_test.sh: New file.
3207         * testsuite/icf_string_merge_test.cc: New file.
3208         * testsuite/icf_string_merge_test.sh: New file.
3209         * testsuite/icf_virtual_function_folding_test.cc: New file.
3210         * testsuite/icf_virtual_function_folding_test.sh: New file.
3211
3212 2010-04-14  Doug Kwan  <dougkwan@google.com>
3213
3214         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3215         for local symbol recounting if we remove a section due to ICF.
3216         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3217         there are no regular objects in input.
3218
3219 2010-04-13  Doug Kwan  <dougkwan@google.com>
3220
3221         * arm.cc (Arm_input_section::set_final_data_size): Compute
3222         accurate final data size instead of using current data size.
3223
3224 2010-04-09  Doug Kwan  <dougkwan@google.com>
3225
3226         * layout.cc (Layout::choose_output_section): Handle script section
3227         types.
3228         (Layout::make_output_section_for_script): Add section type parameter.
3229         Handle script section types.
3230         * layout.h (Layout::make_output_section_for_script): Add section
3231         type parameter.
3232         * output.cc (Output_section::Output_section): Initialize data member
3233         is_noload_.
3234         (Output_section::do_reset_address_and_file_offset): Do not set address
3235         to 0 if section is a NOLOAD section.
3236         * output.h (Output_section::is_noload): New method.
3237         (Output_section::set_is_noload): Ditto.
3238         (Output_section::is_noload_): New data member.
3239         * script-c.h (Script_section_type): New enum type.
3240         (struct Parser_output_section_header): Add new file section_type.
3241         * script-sections.cc (Sections_element::output_section_name): Add
3242         parameter for returning script section type.
3243         (Output_section_definition::output_section_name): Ditto.
3244         (Output_section_definition::section_type)P; New method.
3245         (Output_section_definiton::script_section_type_name): Ditto.
3246         (Output_section_definition::script_section_type_): New data member.
3247         (Output_section_definition::Output_section_definition): Initialize
3248         data member Output_section_definition::script_section_type_.
3249         (Output_section_definition::create_sections): Pass script section type
3250         to Layout::make_output_section_for_script.
3251         (Output_section_definition::output_section_name): Return script
3252         section type to caller.
3253         (Output_section_definition::set_section_address): Do not advance
3254         dot value and load address if section type is NOLOAD.  Set address
3255         of NOLOAD sections regardless of section flags.
3256         (Output_section_definition::print): Print section type if it is
3257         not SCRIPT_SECTION_TYPE_NONE.
3258         (Output_section_definition::section_type): New method.
3259         (Output_section_definition::script_section_type_name): Ditto.
3260         (Script_sections::output_section_name): Add new parameter
3261         PSECTION_TYPE for returning script section type.  Pass it to
3262         section elements.  Handle discard sections.
3263         (Sort_output_sections::operator()): Handle NOLOAD sections.
3264         * script-sections.h (Script_sections::Section_type): New enum type.
3265         (Script_sections::output_section_name): Add a new parameter for
3266         returning script section type.
3267         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3268         INFO and NOLOAD.
3269         * yyscript.y (union): Add new field SECTION_TYPE.
3270         (COPY, DSECT, INFO, NOLOAD): New tokens.
3271         (opt_address_and_section_type): Change type to output_section_header.
3272         (section_type): New non-terminal
3273         (section_header): Handle section type.
3274         (opt_address_and_section_type): Return section type value.
3275
3276 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3277
3278         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3279         * testsuite/plugin_common_test_2.c (foo): Likewise.
3280
3281 2010-04-08  Doug Kwan  <dougkwan@google.com>
3282
3283         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3284         Output_merge_data.
3285         * output.cc (Output_section::add_merge_input_section): Simplify
3286         code and return status of Output_merge_base::add_input_section.
3287         Update merge section map only if Output_merge_base::add_input_section
3288         returns true.
3289
3290 2010-04-07  Doug Kwan  <dougkwan@google.com>
3291
3292         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3293         if section is marked as containing instructions but has no mapping
3294         symbols.
3295         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3296         correct section index.
3297         (Arm_relobj::find_linked_text_section): Ditto.
3298
3299 2010-04-07  Cary Coutant  <ccoutant@google.com>
3300
3301         * archive.cc (include_member): Destroy Read_symbols_data object before
3302         releasing file.
3303         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3304         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3305         (Read_symbols_data::~Read_symbols_data) New destructor.
3306         (Section_relocs::Section_relocs) New constructor.
3307         (Section_relocs::~Section_relocs) New destructor.
3308         (Read_relocs_data::Read_relocs_data) New constructor.
3309         (Read_relocs_data::~Read_relocs_data) New destructor.
3310         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3311         pointers to NULL after deleting.
3312
3313 2010-04-07  Doug Kwan  <dougkwan@google.com>
3314
3315         * arm.cc: Replace "endianity" with "endianness" in comments.
3316         (Arm_exidx_cantunwind): Ditto.
3317         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3318         (Arm_relobj::merge_flags_and_attributes): New method.
3319         (Arm_relobj::merge_flags_and_attributes_): New data member.
3320         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3321         (Arm_relobj::scan_sections_for_stubs): Ditto.
3322         (Arm_relobj::do_read_symbols): Check to see if we really want to
3323         merge processor-specific flags and attributes.  Exit early if
3324         an object is empty except for section names and the undefined symbol.
3325         (Target_arm::do_finalize_sections): Move check for ELF format to
3326         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3327         attributes from a regular object only when we have determined that
3328         it is aapropriate.  Do not create an .ARM.attributes section in
3329         output if there is no regular input object.
3330         (Target_arm::merge_processor_specific_flags): Check
3331         --warn-mismatch before printing any error.
3332         (Target_arm::merge_object_attributes): Ditto.
3333         * gold.cc (queue_middle_tasks): Handle the case in which there is
3334         no regular object in input.
3335         * options.cc (General_options::parse_EB): New method.
3336         (General_options::parse_EL): Same.
3337         (General_options::General_options): Initialize endianness_.
3338         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3339         New options.
3340         (General_options::Endianness): New enum.
3341         (General_options::endianness): New method.
3342         (General_options::endianness_): New data member.
3343         * parameters.cc (Parameters::set_options): Check target endianness.
3344         (Parameters::set_target_once): Ditto.
3345         (Parameters::check_target_endianness): New method.
3346         (parameters_force_valid_target): If either -EL or -EB is specified,
3347         use it to define endianness of default target.
3348         * parameters.h (Parameters::check_target_endianness): New method
3349         declaration.
3350         * target.h (class Target): Change "endianity" to "endianness"
3351         in comments.
3352
3353 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3354
3355         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3356         * configure: Regenerate.
3357         * Makefile.in: Regenerate.
3358         * testsuite/Makefile.in: Regenerate.
3359
3360 2010-04-06  Cary Coutant  <ccoutant@google.com>
3361
3362         gcc PR lto/42757
3363         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3364         prevailing definitions of common symbols.
3365         * testsuite/plugin_test_6.sh: New test case.
3366         * testsuite/plugin_common_test_1.c: New test case.
3367         * testsuite/plugin_common_test_2.c: New test case.
3368         * testsuite/Makefile.am (plugin_test_6): New test case.
3369         * testsuite/Makefile.in: Regenerate.
3370
3371 2010-04-06  Nick Clifton  <nickc@redhat.com>
3372
3373         * po/vi.po: New Vietnamese translation.
3374
3375 2010-03-30  Doug Kwan  <dougkwan@google.com>
3376
3377         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3378
3379 2010-03-25  Doug Kwan  <dougkwan@google.com>
3380
3381         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3382         to avoid a conversion warning on a 32-bit host.
3383
3384 2010-03-24  Ian Lance Taylor  <iant@google.com>
3385
3386         * testsuite/script_test_3.t: Add a TLS segment.
3387         * testsuite/Makefile.am (check_PROGRAMS): Add
3388         tls_phdrs_script_test.
3389         (tls_phdrs_script_test_SOURCES): Define.
3390         (tls_phdrs_script_test_DEPENDENCIES): Define.
3391         (tls_phdrs_script_test_LDFLAGS): Define.
3392         (tls_phdrs_script_test_LDADD): Define.
3393         * testsuite/Makefile.in: Rebuild.
3394
3395 2010-03-23  Cary Coutant  <ccoutant@google.com>
3396
3397         * fileread.cc (find_or_make_view): Fix comment.
3398
3399 2010-03-23  Ian Lance Taylor  <iant@google.com>
3400
3401         * script-sections.cc (class Orphan_section_placement): Define
3402         PLACE_TLS and PLACE_TLS_BSS.
3403         (Orphan_section_placement::Orphan_section_placement): Initialize
3404         new places.
3405         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3406         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3407         (tls_script_test_SOURCES): Define.
3408         (tls_script_test_DEPENDENCIES): Define.
3409         (tls_script_test_LDFLAGS): Define.
3410         (tls_script_test_LDADD): Define.
3411         * testsuite/Makefile.in: Rebuild.
3412
3413 2010-03-22  Doug Kwan  <dougkwan@google.com>
3414
3415         * arm.cc (Arm_relocate_functions::abs8,
3416         Arm_relocate_functions::abs16): Use correct check for overflow
3417         specified in the ARM ELF specs.
3418         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3419         target of a BLX instruction specially.
3420         (Reloc_stub::stub_type_for_reloc): Ditto.
3421         (Relocate::relocate): Use symbolic names instead of numeric relocation
3422         codes to report error.
3423         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3424         workaround.
3425         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3426         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3427         thumb2_blx_out_of_range.stdout
3428         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3429         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3430         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3431         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3432         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3433         thumb2_blx_in_range, thumb2_blx_in_range.o,
3434         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3435         thumb2_blx_out_of_range.o): New rules.
3436         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3437         thumb2_blx_in_range and thumb2_blx_out_of_range.
3438         * testsuite/Makefile.in: Regenerate.
3439         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3440         * testsuite/thumb_blx_in_range.s: New file.
3441         * testsuite/thumb_blx_out_of_range.s: New file.
3442
3443 2010-03-22  Rafael Espindola  <espindola@google.com>
3444
3445         * archive.cc (Should_include): Move to archive.h.
3446         (should_include_member): Make it a member of Archive.
3447         (Lib_group): New.
3448         (Add_lib_group_symbols): New.
3449         * archive.h: Include options.h.
3450         (Archive_member): Moved from Archive.
3451         (Should_include): Moved from archive.cc.
3452         (Lib_group): New.
3453         (Add_lib_group_symbols): New.
3454         * dynobj.cc (do_should_include_member): New.
3455         * dynobj.h (do_should_include_member): New.
3456         * gold.cc (queue_initial_tasks): Update call to queue.
3457         * main.cc (main): Print lib group stats.
3458         * object.cc (do_should_include_member): New.
3459         * object.h: Include archive.h.
3460         (Object::should_include_member): New.
3461         (Object::do_should_include_member): New.
3462         (Sized_relobj::do_should_include_member): New.
3463         * options.cc (General_options::parse_start_lib): New.
3464         (General_options::parse_end_lib): New.
3465         (Input_arguments::add_file): Handle lib groups.
3466         (Input_arguments::start_group): Check we are not in a lib.
3467         (Input_arguments::start_lib): New.
3468         (Input_arguments::end_lib): New.
3469         * options.h (General_options): Add start_lib and end_lib.
3470         (Input_argument::lib_): New.
3471         (Input_argument::lib): New.
3472         (Input_argument::is_lib): New.
3473         (Input_file_lib): New.
3474         (Input_arguments::in_lib_): New.
3475         (Input_arguments::in_lib): New.
3476         (Input_arguments::start_lib): New.
3477         (Input_arguments::end_lib_): New.
3478         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3479         in unused members as preempted.
3480         (Sized_pluginobj::do_should_include_member): New.
3481         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3482         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3483         return the blocker.
3484         (Read_symbols::do_whole_lib_group): New.
3485         (Read_symbols::do_lib_group): New.
3486         (Read_symbols::do_read_symbols): Handle lib groups.
3487         (Read_symbols::get_name): Handle lib groups.
3488         * readsyms.h (Read_symbols): Add an archive member pointer.
3489         (Read_symbols::do_whole_lib_group): New.
3490         (Read_symbols::do_lib_group): New.
3491         (Read_symbols::member_): New.
3492         * script.cc (read_input_script): Update call to queue_soon.
3493
3494 2010-03-19  Doug Kwan  <dougkwan@google.com>
3495
3496         * arm.cc (Stub_table::Stub_table): Initialize new data members
3497         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3498         (Stub_table::add_reloc_stub): Assign stub offset and update
3499         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3500         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3501         New data members.
3502         (Stub_table::update_data_size_and_addralign): Use
3503         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3504         instead of going over all reloc stubs.
3505         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3506         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3507         Stringpool_template::offset_ to size of Stringpool_char.
3508         (Stringpool_template::new_key_offset): Remove code to initialize
3509         Stringpool_template::offset_.
3510         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3511         Stringpool_template::offset_ to zero.
3512
3513 2010-03-15  Doug Kwan  <dougkwan@google.com>
3514
3515         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3516         offset_.
3517         (Stringpool_template::new_key_offset): New method.
3518         (Stringpool_template::add_string): Assign offsets when adding new
3519         strings.
3520         (Stringpool_template::set_string_offsets): Do not set string offsets
3521         when not optimizing.
3522         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3523         member size_.
3524         (Chunked_vector::clear): Clear size_.
3525         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3526         (Chunked_vector::size): Return size_.
3527         (Chunked_vector::push_back): Use size_ to find insert position.
3528         (Chunked_vector::size_): New data member.
3529         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3530         (Stringpool_template::new_key_offset): New method declaration.
3531         (Stringpool_template::offset_): New data member.
3532
3533 2010-03-15   Rafael Espindola  <espindola@google.com>
3534
3535         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3536         Add_symbols' constructor.
3537         * readsyms.h (Add_symbols): Remove the input_group member.
3538
3539 2010-03-10  Ian Lance Taylor  <iant@google.com>
3540
3541         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3542         target to ask whether a reference to a symbol requires a stack
3543         split.
3544         * target.h (Target::is_call_to_non_split): New function.
3545         (Target::do_is_call_to_non_split): Declare virtual function.
3546         * target.cc: Include "symtab.h".
3547         (Target::do_is_call_to_non_split): New function.
3548         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3549
3550 2010-03-10  Cary Coutant  <ccoutant@google.com>
3551
3552         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3553         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3554         (File_read::open[2]): Add whole_file_view_ to list of views.
3555         (File_read::make_view): Remove test of whole_file_view_.
3556         (File_read::find_or_make_view): Create whole_file_view_ if
3557         necessary.
3558         (File_read::clear_views): Replace bool parameter with enum;
3559         adjust all callers.  Don't delete views with permanent data;
3560         do delete cached views and views from archives if
3561         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3562         if clearing the corresponding view.
3563         * fileread.h (File_read::Clear_views_mode): New enum.
3564         (File_read::View::is_permanent_view): New method.
3565         (File_read::clear_views): Replace bool parameter
3566         with enum; adjust all callers.
3567         * options.h (General_options): Change keep_files_mapped option;
3568         add map_whole_files.
3569         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3570         releasing the file.
3571         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3572         the file.
3573
3574 2010-03-10  David S. Miller  <davem@davemloft.net>
3575
3576         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3577
3578 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3579
3580         * icf.cc (get_section_contents): Add '@' marker after processing the
3581         merge reloc.
3582
3583 2010-03-08  Doug Kwan  <dougkwan@google.com>
3584
3585         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3586         due to a conversion warning.
3587         (Arm_relobj::update_output_local_symbol_count): Check for local
3588         symbol with unset output index.
3589
3590 2010-03-05  Ian Lance Taylor  <iant@google.com>
3591
3592         * options.h (class General_options): Add --spare-dynamic-tags.
3593         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3594         --spare-dynamic-tags.
3595
3596 2010-03-05  Ian Lance Taylor  <iant@google.com>
3597
3598         * incremental.cc: Include "libiberty.h".
3599
3600 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3601
3602         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3603         function, is_info_ member.
3604         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3605         (Versions::Versions): Update caller.
3606         (Versions::define_base_version): Likewise.
3607         (Versions::add_def): Likewise.
3608
3609 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3610
3611         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3612         (Scan::possible_function_pointer_reloc): New function.
3613         (Scan::local_reloc_may_be_function_pointer): Change to call
3614         possible_function_pointer_reloc.
3615         (Scan::global_reloc_may_be_function_pointer): Ditto.
3616         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3617         relocations in ".data.rel.ro._ZTV" section.
3618         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3619         * testsuite/icf_safe_so_test.cc: Ditto.
3620         * testsuite/icf_safe_test.cc: Ditto.
3621         * testsuite/icf_safe_test.sh: Ditto.
3622
3623 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3624             Ian Lance Taylor  <iant@google.com>
3625
3626         * target-reloc.h (relocate_section): Check the symbol table index
3627         for -1U before setting the local symbol index.
3628         (scan_relocatable_relocs): If copying the relocation, record that
3629         the local symbol is required.
3630         * object.h (Symbol_value::is_output_symtab_index_set): New
3631         function.
3632         (Symbol_value::may_be_discarded_from_output_symtab): New
3633         function.
3634         (Symbol_value::has_output_symtab_entry): New function.
3635         (Symbol_value::needs_output_symtab_entry): Remove.
3636         (Symbol_value::output_symtab_index): Make sure the symbol index is
3637         set.
3638         (Symbol_value::set_output_symtab_index): Make sure the symbol
3639         index is not set.  Make sure the new index is valid.
3640         (Symbol_value::set_must_have_output_symtab_entry): New function.
3641         (Symbol_value::has_output_dynsym_entry): New function.
3642         (Symbol_value::set_output_dynsym_index): Make sure the new index
3643         is valid.
3644         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3645         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3646         local symbol if permitted.
3647         (Sized_relobj::do_finalize_local_symbols): Call
3648         is_output_symtab_index_set rather than needs_output_symtab_entry.
3649         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3650         rather than needs_output_symtab_entry.  Call
3651         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3652         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3653         is_output_symtab_index_set rather than needs_output_symtab_entry.
3654         * testsuite/discard_locals_relocatable_test.c: New file.
3655         * testsuite/discard_locals_test.sh: Test -r.
3656         * testsuite/Makefile.am (check_DATA): Add
3657         discard_locals_relocatable_test1.syms,
3658         discard_local_relocatable_test2.syms.
3659         (MOSTLYCLEANFILES): Likewise.  Also add
3660         discard_locals_relocatable_test1.lout and
3661         discard_locals_relocatable_test2.out.
3662         (discard_locals_relocatable_test1.syms): New target.
3663         (discard_locals_relocatable_test.o): New target.
3664         (discard_locals_relocatable_test1.out): New target.
3665         (discard_locals_relocatable_test2.syms): New target.
3666         (discard_locals_relocatable_test2.out): New target.
3667         (various): Add missing ../ld-new dependencies.
3668         * testsuite/Makefile.in: Rebuild.
3669
3670 2010-03-03  Nick Clifton  <nickc@redhat.com>
3671
3672         * po/fi.po: New Finnish translation.
3673
3674 2010-03-01  Doug Kwan  <dougkwan@google.com>
3675
3676         * layout.cc (Layout::Layout): Force section types of .init_array*,
3677         .preinit_array* and .fini_array* sections.
3678         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3679         Fix check of return value of std::string::find.().
3680         (Output_section::Input_section_sort_compare::operator()): Remove
3681         comment about .init_array.
3682         (Output_section::Input_section_sort_init_fini_compare::operator()):
3683         New method.
3684         (Output_section::sort_attached_input_sections): Handle .init_array
3685         and .fini_array specially.
3686         * output.h (Output_section::Inut_section_sort_compare): Update
3687         comment.
3688         (Output_section::Input_section_sort_init_fini_compare): New struct.
3689
3690 2010-02-26  Doug Kwan  <dougkwan@google.com>
3691
3692         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3693         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3694         * testsuite/debug_msg.sh: Avoid matching source line number for
3695         use of global variable undef_int.
3696
3697 2010-02-26  Doug Kwan  <dougkwan@google.com>
3698
3699         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3700         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3701         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3702         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3703         * options.cc (General_options::General_options): Initialize member
3704         fix_v4bx_.
3705         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3706         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3707         and rm_no_fix_v4bx.stdout
3708         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3709         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3710         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3711         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3712         and arm_no_fix_v4bx.
3713         * Makefile.in: Regenerate.
3714         * testsuite/arm_fix_v4bx.s: New file.
3715         * testsuite/arm_fix_v4bx.sh: Ditto.
3716
3717 2010-02-24  Doug Kwan  <dougkwan@google.com>
3718
3719         * arm.cc (Target_arm::got_section): Make the .got section the first
3720         non RELRO section in the data segment.
3721         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3722         suffixes of section names.
3723
3724 2010-02-24  Doug Kwan  <dougkwan@google.com>
3725
3726         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3727         flags and attributes merging if an input file is a binary file.
3728         * fileread.cc (Input_file::open): Record format of original file.
3729         * fileread.h (Input_file::Format): New enum type.
3730         (Input_file::Input_file): Initialize data member format_.
3731         (Input_file::format): New method definition.
3732         (Input_file::format_):: New data member.
3733
3734 2010-02-24  Doug Kwan  <dougkwan@google.com>
3735
3736         * arm.cc (Arm_output_data_got): New class.
3737         (ARM_TCB_SIZE): New constant
3738         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3739         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3740         If user uses a script with a SECTIONS clause, issue only a warning
3741         for a misplaced EXIDX input section.  Otherwise, issue an error.
3742         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3743         garbage collection.
3744         (Target_arm::got_mode_index_entry): Handle static linking.
3745         (Target_arm::Scan::local): Ditto.
3746         (Target_arm::Scan::global): Ditto.
3747         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3748         all incorrectly implemented relocations.
3749         (Target_arm::fix_exidx_coverage): Pass layout to
3750         Arm_output_section::fix_exidx_coverage.
3751         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3752         from ".ARM.exidx." and ".ARM.extab.".
3753
3754 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3755
3756         * arm.cc (Target_arm::do_finalize_sections): Create attribute
3757         section if it does not already exist.
3758         * attributes.cc (Attributes_section_data::Attributes_section_data):
3759         Don't crash if size is zero.
3760
3761 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3762             Ian Lance Taylor  <iant@google.com>
3763
3764         * gold.cc (queue_middle_tasks): If no input files were opened,
3765         exit.
3766         * workqueue.h (Task_function::Task_function): Assert that there is
3767         a blocker.
3768
3769 2010-02-22  Doug Kwan  <dougkwan@google.com>
3770
3771         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3772         * icf.cc (get_section_contents): Cast snprintf arguments to long long
3773         types to avoid warnings due to different uint64_t implementations
3774         on different hosts.
3775
3776 2010-02-21  Doug Kwan  <dougkwan@google.com>
3777
3778         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3779         handling of the maximum backward branch offset.
3780         (Arm_relocate_functions::thumb_branch_common): Ditto.
3781         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3782         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3783         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3784         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3785         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3786         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3787         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3788         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3789         thumb_bl_out_of_range thumb_bl_out_of_range.o,
3790         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3791         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3792         thumb2_bl_out_of_range.o): New rules.
3793         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3794         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3795         thumb2_bl_out_of_range
3796         * testsuite/Makefile.in: Regenerate.
3797         * testsuite/arm_bl_in_range.s: New file.
3798         * testsuite/arm_bl_out_of_range.s: Ditto.
3799         * testsuite/arm_branch_in_range.sh: Ditto.
3800         * testsuite/arm_branch_range.t: Ditto.
3801         * testsuite/thumb2_branch_range.t: Ditto.
3802         * testsuite/thumb_bl_in_range.s: Ditto.
3803         * testsuite/thumb_bl_out_of_range.s: Ditto.
3804         * testsuite/thumb_branch_range.t: Ditto.
3805
3806 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
3807
3808         * gc.h (gc_process_relocs): Change vectors to point to the new list.
3809         Add reloc offset information.
3810         * icf.cc (get_section_contents): Change iterators to point to the new
3811         vectors. Add reloc offset information to the contents.
3812         * icf.h (Icf::Sections_reachable_info): New typedef.
3813         (Icf::Sections_reachable_list): New typedef.
3814         (Icf::Offset_info): New typedef.
3815         (Icf::Reloc_info): New struct typedef.
3816         (Icf::Reloc_info_list): New typedef.
3817         (Icf::symbol_reloc_list): Delete method.
3818         (Icf::addend_reloc_list): Delete method.
3819         (Icf::section_reloc_list): Delete method.
3820         (Icf::reloc_info_list): New method.
3821         (Icf::reloc_info_list_): New member.
3822
3823 2010-02-19  Doug Kwan  <dougkwan@google.com>
3824
3825         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3826         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3827         * arm.cc (Arm_relocation_functions): New forward declaration.
3828         (Target_arm::Target_arm): Initialize new data members
3829         got_mod_index_offset_ and tls_base_symbol_defined_.
3830         (Target_arm::Relocate::relocate_tls): New method.
3831         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3832          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3833         New methods.
3834         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3835         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3836         (Target_arm::got_mod_index_offset_,
3837         Target_arm::tls_base_symbol_defined_): New data members.
3838         (Target_arm::Scan::local, Target::Scan::global,
3839         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3840         relocations.
3841
3842 2010-02-18  Doug Kwan  <dougkwan@google.com>
3843
3844         * arm.cc (Arm_relobj::find_linked_text_section): New method.
3845         (Arm_relobj::make_exidx_input_section): Pass section index of linked
3846         text section as a parameter becuase some broken tools may not set
3847         the link in section header.
3848         (Target_arm::has_got_section): New method.
3849         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3850         without any mapping symbol as data only.  Remove warning.
3851         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3852         link in its section header, try to discover the link by inspecting the
3853         REL31 relocation at the beginning of the section.
3854         (Target_arm::Scan::check_non_pic): Report name of offending relocation
3855         in error message.
3856         (Target_arm::Scan::global): Treat any reference to the symbol
3857         _GLOBAL_OFFSET_TABLE_ as a GOT access.
3858
3859 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
3860
3861         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3862         (Scan::global_reloc_may_be_function_pointer): New function.
3863         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3864         (Scan::global_reloc_may_be_function_pointer): New function.
3865         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3866         (Scan::global_reloc_may_be_function_pointer): New function.
3867         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3868         (Scan::global_reloc_may_be_function_pointer): New function.
3869         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3870         (Scan::global_reloc_may_be_function_pointer): New function.
3871         (Scan::possible_function_pointer_reloc): New function.
3872         (Target_x86_64::can_check_for_function_pointers): New function.
3873         * gc.h (gc_process_relocs): Scan relocation types to determine if
3874         function pointers were taken for targets that support it.
3875         * icf.cc (Icf::find_identical_sections): Include functions for
3876         folding in safe ICF whose pointer is not taken.
3877         * icf.h (Secn_fptr_taken_set): New typedef.
3878         (fptr_section_id_): New member.
3879         (section_has_function_pointers): New function.
3880         (set_section_has_function_pointers): New function.
3881         (check_section_for_function_pointers): New function.
3882         * options.h: Fix comment for safe ICF option.
3883         * target.h (can_check_for_function_pointers): New function.
3884         * testsuite/Makefile.am: Add icf_safe_so_test test case.
3885         Modify icf_safe_test for X86-64.
3886         * testsuite/Makefile.in: Regenerate.
3887         * testsuite/icf_safe_so_test.cc: New file.
3888         * testsuite/icf_safe_so_test.sh: New file.
3889         * testsuite/icf_safe_test.cc (kept_func_3): New function.
3890         (main): Change to take pointer to function kept_func_3.
3891         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3892         folding is done correctly for X86-64.
3893
3894 2010-02-12  David S. Miller  <davem@davemloft.net>
3895
3896         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3897         is_symbolless parameter.
3898         (Output_reloc<SHT_REL>::is_symbolless): New.
3899         (Output_reloc<SHT_REL>::is_symbolless_): New.
3900         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3901         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3902         (Output_reloc<SHT_RELA>::is_symbolless): New.
3903         (Output_data_reloc::add_global): Handle is_symbolless.
3904         (Output_data_reloc::add_global_relative): Likewise.
3905         (Output_data_reloc::add_local): Likewise.
3906         (Output_data_reloc::add_local_relative): Likewise.
3907         (Output_data_reloc::add_symbolless_global_addend): New.
3908         (Output_data_reloc::add_symbolless_local_addend): New.
3909         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3910         is_symbolless.
3911         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3912         instead of ->is_relative_
3913         (Output_reloc::write): Likewise.
3914         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3915         (Output_reloc::write_rel): Simplify.
3916
3917         * sparc.cc (Target_sparc::Scan::local): Use
3918         ->add_symbolless_local_addend as needed.
3919         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3920         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
3921         based upon relocation offset.
3922
3923 2010-02-11  Doug Kwan  <dougkwan@google.com>
3924
3925         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3926         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
3927         beginning of function.
3928         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3929         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
3930         parameter is_32bit in calls to should_apply_static_reloc.
3931         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3932         (check_DATA): Add arm_abs_global.stdout.
3933         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3934         arm_abs_global.stdout): New rules.
3935         (MOSTLLYCLEANFILES): Add arm_abs_global
3936         * Makefile.in: Regenerate.
3937         * testsuite/arm_abs_global.s: New file.
3938         * testsuite/arm_abs_global.sh: Ditto.
3939         * testsuite/arm_abs_lib.s: Ditto.
3940
3941 2010-02-11  Ian Lance Taylor  <iant@google.com>
3942
3943         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3944         Read_relocs task.
3945         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
3946         Allocate_commons_task first.
3947         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3948         task, rather than symtab_lock_.
3949         (Gc_process_relocs::~Gc_process_relocs): New function.
3950         (Gc_process_relocs::is_runnable): Check this_blocker_.
3951         (Gc_process_relocs::locks): Use next_blocker_ rather than
3952         blocker_.
3953         (Scan_relocs::~Scan_relocs): New function.
3954         (Scan_relocs::is_runnable): Check this_blocker_ rather than
3955         symtab_lock_.
3956         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
3957         next_blocker_.
3958         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3959         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
3960         constructor accordingly.
3961         (class Gc_process_relocs): Likewise.
3962         (class Scan_relocs): Likewise.
3963         * common.h (class Allocate_commons_task): Remove symtab_lock_
3964         field, and corresponding constructor parameter.
3965         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3966         symtab_lock_.
3967         (Allocate_commons_task::locks): Likewise.
3968
3969 2010-02-11  Ian Lance Taylor  <iant@google.com>
3970
3971         * gold-threads.h (class Once): Define.
3972         (class Initialize_lock): Rewrite as child of Once.
3973         * gold-threads.cc (class Once_initialize): Define.
3974         (once_pointer_control): New static variable.
3975         (once_pointer, once_arg): New static variables.
3976         (c_run_once): New static function.
3977         (Once::Once, Once::run_once, Once::internal_run): New functions.
3978         (class Initialize_lock_once): Remove.
3979         (initialize_lock_control): Remove.
3980         (initialize_lock_pointer): Remove.
3981         (initialize_lock_once): Remove.
3982         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3983         (Initialize_lock::initialize): Rewrite.
3984         (Initialize_lock::do_run_once): New function.
3985         * archive.cc (Archive::interpret_header): Only clear name if it is
3986         not already empty.
3987         * fileread.cc: Include "gold-threads.h"
3988         (file_counts_lock): New static variable.
3989         (file_counts_initialize_lock): Likewise.
3990         (File_read::release): Only increment counts when using --stats.
3991         Use a lock around the increment.
3992         * parameters.cc (class Set_parameters_target_once): Define.
3993         (set_parameters_target_once): New static variable.
3994         (Parameters::Parameters): Move here from parameters.h.
3995         (Parameters::set_target): Rewrite.
3996         (Parameters::set_target_once): New function.
3997         (Parameters::clear_target): Move here and rewrite.
3998         * parameters.h (class Parameters): Update declarations.  Add
3999         set_parameters_target_once_ field.
4000         (Parameters::Parameters): Move to parameters.cc.
4001         (Parameters::clear_target): Likewise.
4002         * readsyms.cc (Read_symbols::do_group): Create a Start_group
4003         task.
4004         (Start_group::~Start_group): New function.
4005         (Start_group::is_runnable): New function.
4006         (Start_group::locks, Start_group::run): New functions.
4007         (Finish_group::run): Change saw_undefined to size_t.
4008         * readsyms.h (class Start_group): Define.
4009         (class Finish_group): Change saw_undefined_ field to size_t.
4010         (Finish_group::Finish_group): Remove saw_undefined and
4011         this_blocker parameters.  Change all callers.
4012         (Finish_group::set_saw_undefined): New function.
4013         (Finish_group::set_blocker): New function.
4014         * symtab.h (class Symbol_table): Change saw_undefined to return
4015         size_t.  Change saw_undefined_ field to size_t.
4016         * target-select.cc (Set_target_once::do_run_once): New function.
4017         (Target_selector::Target_selector): Initialize set_target_once_
4018         field.  Don't initialize lock_ and initialize_lock_ fields.
4019         (Target_selector::instantiate_target): Rewrite.
4020         (Target_selector::set_target): New function.
4021         * target-select.h (class Set_target_once): Define.
4022         (class Target_selector): Update declarations.  Make
4023         Set_target_once a friend.  Remove lock_ and initialize_lock_
4024         fields.  Add set_target_once_ field.
4025
4026 2010-02-10  Ian Lance Taylor  <iant@google.com>
4027
4028         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4029         queueing any tasks.
4030         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
4031         (queue_middle_tasks): Add all blockers before queueing any tasks.
4032         (queue_final_tasks): Likewise.
4033         * token.h (Task_token::add_blockers): New function.
4034         * object.h (Input_objects::number_of_relobjs): New function.
4035
4036 2010-02-10  Ian Lance Taylor  <iant@google.com>
4037
4038         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4039         shared, not if not position independent.
4040         * x86_64.cc (Relocate::relocate_tls): Likewise.
4041         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4042         (tls_pie_pic_test): New target.
4043         * testsuite/Makefile.in: Rebuild.
4044
4045         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4046         (tls_test_main_pie.o, tls_test_pie.o): New targets.
4047         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4048         * testsuite/Makefile.in: Rebuild.
4049
4050 2010-02-09  David S. Miller  <davem@davemloft.net>
4051
4052         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4053         R_SPARC_RELATIVE using ->add_local_relative().
4054         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4055
4056         * output.h (Output_data_dynamic::add_section_size): New method
4057         that takes two Output_data objects.
4058         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4059         entry param.  Handle it in initializers.
4060         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4061         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4062         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4063         arg.
4064         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4065         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4066         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4067         for dynrel_includes_plt.
4068         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4069         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4070         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4071         before .rela.plt
4072         (Target_sparc::do_finalize_sections): Update to pass true for
4073         dynrel_includes_plt.
4074         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4075         output before .rela.plt
4076         (Target_powerpc::do_finalize_sections): Update to pass true for
4077         dynrel_includes_plt when 32-bit.
4078
4079 2010-02-08  Doug Kwan  <dougkwan@google.com>
4080
4081         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4082         method.
4083         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4084         Arm_relobj::scan_section_for_cortex_a8_stubs,
4085         Arm_relobj::do_relocation_section): Instead of calling
4086         Output_section::output_address, use faster
4087         Arm_relobj::simple_input_section_output_address.
4088
4089 2010-02-08  David S. Miller  <davem@davemloft.net>
4090
4091         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4092         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4093         relocation helper function.
4094
4095         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4096         just like R_SPARC_GOT{10,13,22}.
4097         (Target_sparc::Scan::local): Likewise.
4098         (Target_sparc::Relocate:relocate): Likewise.
4099
4100 2010-02-06  Ian Lance Taylor  <iant@google.com>
4101
4102         * configure.ac: Rewrite targetobjs duplicate removal code to use
4103         only shell constructs.
4104         * configure: Rebuild.
4105
4106 2010-02-05  Doug Kwan  <dougkwan@google.com>
4107
4108         PR 11247
4109         * arm.cc (Arm_relobj::section_is_scannable): New method.
4110         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4111         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4112
4113 2010-02-04  Doug Kwan  <dougkwan@google.com>
4114
4115         PR 11247
4116         * arm-reloc-property.cc (cstdio): Include.
4117         * configure.ac (targetobjs): Remove duplicates.
4118         * configure: Regenerate.
4119         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4120         big and little endian version for a given address size.
4121
4122 2010-02-03  Doug Kwan  <dougkwan@google.com>
4123
4124         * arm-reloc-property.cc
4125         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4126         definition.
4127         * arm-reloc-property.h
4128         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4129         New method definition.
4130         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4131         declaration.
4132         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4133         overflow to N.
4134         (GOT_PREL): Change implemented to Y.
4135         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4136         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4137         (Arm_relocate_functions::movw_abs_nc): Remove method.
4138         (Arm_relocate_functions::movt_abs): Ditto.
4139         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4140         (Arm_relocate_functions::thm_movt_abs): Ditto.
4141         (Arm_relocate_functions::movw_rel_nc): Ditto.
4142         (Arm_relocate_functions::movw_rel): Ditto.
4143         (Arm_relocate_functions::movt_rel): Ditto.
4144         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4145         (Arm_relocate_functions:thm_movw_rel): Ditto.
4146         (Arm_relocate_functions:thm_movt_rel): Ditto.
4147         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4148         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4149         New method definitions.
4150         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4151         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4152         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4153         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4154         (Target_arm::Relocate::relocate): Check for non-static or
4155         unimplemented relocation code and exit early.  Change calls to
4156         Target_arm::reloc_uses_thumb_bit and
4157         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4158         instead.  Refactor code to handle similar relocations to increase
4159         code sharing.  Remove check for unsupported relocation code in switch
4160         statement.
4161         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4162         relocation property table to find out size.  Change error message to
4163         print out the name of a relocation code instead of the numeric value.
4164         (Target_arm::scan_reloc_for_stub): Use relocation property table
4165         instead of calling Target_arm::reloc_uses_thumb_bit().
4166
4167 2010-02-02  Doug Kwan  <dougkwan@google.com>
4168
4169         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4170         types of relaxed input section.
4171
4172 2010-02-02  Doug Kwan  <dougkwan@google.com>
4173
4174         * Makefile.am (HFILES): Add arm-reloc-property.h.
4175         (DEFFILES): New.
4176         (TARGETSOURCES): Add arm-reloc-property.cc
4177         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4178         (libgold_a_SOURCES): $(DEFFILES)
4179         * Makefile.in: Regenerate.
4180         * arm-reloc-property.cc: New file.
4181         * arm-reloc-property.h: New file.
4182         * arm-reloc.def: New file.
4183         * arm.cc: Update comments.
4184         (arm-reloc-property.h): New included header.
4185         (arm_reloc_property_table): New global variable.
4186         (Target_arm::do_select_as_default_target): New method definition.
4187         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4188         arm-reloc-property to targ_extra_obj.
4189         * parameters.cc (set_parameters_target): Call
4190         Target::select_as_default_target().
4191         * target.h (Target::select_as_default_target): New method definition.
4192         (Target::do_select_as_default_target): Same.
4193
4194 2010-02-01  Doug Kwan  <dougkwan@google.com>
4195
4196         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4197         first_output_text_section_.
4198         (Arm_exidx_fixup::first_output_text_section): New method definition.
4199         (Arm_exidx_fixup::first_output_text_section_): New data member.
4200         (Arm_exidx_fixup::process_exidx_section): Record the first text
4201         output section seen.
4202         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4203         and entsize in output section header.
4204
4205 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4206
4207         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4208         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4209         (Arm_relocate_functions::thm_alu11): New Method.
4210         (Arm_relocate_functions::thm_pc8): New Method.
4211         (Arm_relocate_functions::thm_pc12): New Method.
4212         (Target_arm::Scan::local): Handle the relocations.
4213         (Target_arm::Scan::global): Likewise.
4214         (Target_arm::Relocate::relocate): Likewise.
4215         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4216
4217 2010-01-29  Doug Kwan  <dougkwan@google.com>
4218
4219         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4220         of relocation types as ld.
4221
4222 2010-01-29  Doug Kwan  <dougkwan@google.com>
4223
4224         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4225         to public.
4226         (Arm_relocate_functions::thumb_branch_common): Ditto.
4227         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4228         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4229         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4230         Arm_relocate_functions::jump24): Remove.
4231         (Target_arm::Relocate::relocate): Adjust code to call
4232         Arm_relocation_functions::arm_branch_common and
4233         Arm_relocation_functions::thumb_branch_common instead of their removed
4234         wrappers.  Merge switch-cases together to reduce source code size.
4235
4236 2010-01-29  Doug Kwan  <dougkwan@google.com>
4237
4238         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4239         output_local_symbol_count_needs_update_.
4240         (Arm_relobj::output_local_symbol_count_needs_update,
4241          Arm_relobj::set_output_local_symbol_count_needs_update,
4242          Arm_relobj::update_output_local_symbol_count): New methods.
4243         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4244         member.
4245         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4246         of pointed function as in a R_ARM_PREL31 relocation.
4247         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4248         for output local symbol count updating.
4249         (Target_arm::do_relax): Update output local symbol counts in objects
4250         if necessary.
4251         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4252
4253 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4254
4255         * arm.cc: Added support for the ARM relocations:
4256         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4257         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4258         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4259         movw_prel_nc).
4260         (Arm_relocate_functions::movw_rel): New method.
4261         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4262         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4263         thm_movw_prel_nc).
4264         (Arm_relocate_functions::thm_movw_rel): New method.
4265         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4266         thm_movt_prel).
4267         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4268         relocations.
4269         (Target_arm::Scan::global): Likewise.
4270         (Target_arm::Relocate::relocate): Likewise.
4271         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4272         Likewise.
4273
4274 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4275
4276         * arm.cc: Added support for ARM group relocations.
4277         (Target_arm::reloc_needs_sym_origin): New method.
4278         (Arm_relocate_functions::calc_grp_kn): New method.
4279         (Arm_relocate_functions::calc_grp_residual): New method.
4280         (Arm_relocate_functions::calc_grp_gn): New method.
4281         (Arm_relocate_functions::arm_grp_alu): New Method.
4282         (Arm_relocate_functions::arm_grp_ldr): New Method.
4283         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4284         (Arm_relocate_functions::arm_grp_ldc): New Method.
4285         (Target_arm::Scan::local): Handle the ARM group relocations.
4286         (Target_arm::Scan::global): Likewise.
4287         (Target_arm::Relocate::relocate): Likewise.
4288         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4289         Likewise.
4290
4291 2010-01-26  Doug Kwan  <dougkwan@google.com>
4292
4293         * arm.cc (set): Include.
4294         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4295         pointer type.
4296         (Arm_output_section::Text_section_list): New type.
4297         (Arm_output_section::append_text_sections_to_list): New method.
4298         (Arm_output_section::fix_exidx_coverage): Ditto.
4299         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4300         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4301         Relobj::set_section_offset() instead of
4302         Sized_relobj::invalidate_section_offset().
4303         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4304         parameter for section headers. Ignore relocation sections for
4305         unallocated sections and EXIDX sections.
4306         (Target_arm::fix_exidx_coverage): New method.
4307         (Target_arm::output_section_address_less_than): New type.
4308         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4309         linked text section instead of the EXIDX section.
4310         (Arm_output_section::create_stub_group): Add an assertion to check
4311         that this is not an EXIDX output section.
4312         (Arm_output_section::append_text_sections_to_list): New method.
4313         (Arm_output_section::fix_exidx_coverage): Ditto.
4314         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4315         Arm_relobj::section_needs_reloc_stub_scanning.
4316         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4317         first pass.
4318         (Target_arm::fix_exidx_coverage): New method.
4319         * object.h (Relobj::set_output_section): New method.
4320         (Sized_relobj::invalidate_section_offset): Remove method.
4321         (Sized_relobj::do_invalidate_section_offset): Remove method.
4322         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4323
4324 2010-01-25  Doug Kwan  <dougkwan@google.com>
4325
4326         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4327         Fix warning due to signed and unsigned comparison on a 32-bit host.
4328
4329 2010-01-22  Doug Kwan  <dougkwan@google.com>
4330
4331         * arm.cc (Target_arm::do_relax): Record an output section for section
4332         offset adjustment it contains any stub table that has changed.
4333         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4334         offsets in an output section if necessary.
4335         * output.cc (Output_section::Output_section): Initialize
4336         section_offsets_need_adjustments_.
4337         (Output_section::add_input_section_for_script): Renamed to
4338         Output_section::add_simple_input_section.
4339         (Output_section::save_states): Add a comment.
4340         (Output_section::discard_states): New method defintion.
4341         (Output_section::adjust_section_offsets): Same.
4342         * output.h (Output_section::add_input_section_for_script): Renamed to
4343         Output_section::add_simple_input_section.
4344         (Output_section::discard_states): New method declaration.
4345         (Output_section::adjust_section_offsets): Same.
4346         (Output_section::section_offsets_need_adjustment,
4347         Output_section::set_section_offsets_need_adjustment): New method
4348         definitions.
4349         (Output_section::section_offsets_need_adjustment_): New data member.
4350         * script-sections.cc
4351         (Output_section_element_input::set_section_address): Adjust code for
4352         renaming of Output_section::add_input_section_for_script.
4353         (Orphan_output_section::set_section_address): Same.
4354
4355 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4356
4357         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4358         Fix_v4bx enum values .
4359         * gold/options.h (General_options): New option definitions.
4360         (General_options::fix_v4bx): New method.
4361         (General_options::Fix_v4bx): New enum.
4362         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4363         (General_options::parse_fix_v4bx_interworking): New method.
4364
4365 2010-01-22  Doug Kwan  <dougkwan@google.com>
4366
4367         * arm.cc (Arm_exidx_fixup): New class.
4368
4369 2010-01-21  Doug Kwan  <dougkwan@google.com>
4370
4371         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4372         classes.
4373         (Arm_exidx_section_offset_map): New type.
4374
4375 2010-01-21  Doug Kwan  <dougkwan@google.com>
4376
4377         * arm.cc (Arm_exidx_input_section): New class.
4378         (Arm_relobj::exidx_input_section_by_link,
4379         Arm_relobj::exidx_input_section_by_shndx,
4380         Arm_relobj::make_exidx_input_section): New methods.
4381         (read_arm_attributes_section): Remove.
4382         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4383         information about them.
4384         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4385         to here.
4386
4387 2010-01-20  Doug Kwan  <dougkwan@google.com>
4388
4389         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4390         Input_section_specifier to Section_id.
4391         (Target_arm::new_arm_input_section: Adjust code for change of key
4392         type.
4393         (Target_arm::find_arm_input_section): Ditto.
4394         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4395         (Section_id): Remove.
4396         (Garbage_collection::Section_id_hash): Remove.
4397         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4398         (Section_id): Remove.
4399         (Icf::Section_id_hash): Remove.
4400         * object.h (Section_id, Const_section_id, Section_id_hash,
4401         Const_section_id_hash): New type definitions.
4402         * output.cc (Output_section::add_relaxed_input_section): Change to
4403         use Const_section_id instead of Input_section_specifier as key type.
4404         (Output_section::add_merge_input_section): Ditto.
4405         (Output_section::build_relaxation_map): Change to use Section_id
4406         instead of Input_section_specifier as key type.
4407         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4408         Ditto.
4409         (Output_section::convert_input_sections_to_relaxed_sections): Change
4410         to use Const_section_id instead of Input_section_specifier as key type.
4411         (Output_section::find_merge_section): Ditto.
4412         (Output_section::find_relaxed_input_section): Ditto.
4413         * output.h (Input_section_specifier): Remove class.
4414         (Output_section::Output_section_data_by_input_section_map): Change
4415         key type to Const_section_id.
4416         (Output_section::Output_relaxed_input_section_by_input_section_map):
4417         Ditto.
4418         (Output_section::Relaxation_map): Change key type to Section_id.
4419
4420 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4421
4422         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4423         (class Arm_v4bx_stub): New class.
4424         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4425         (Stub_factory::make_arm_v4bx_stub): New method.
4426         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4427         (Stub_table::empty): Handle v4bx stubs.
4428         (Stub_table::add_arm_v4bx_stub): New method.
4429         (Stub_table::find_arm_v4bx_stub): New method.
4430         (Arm_relocate_functions::v4bx): New method.
4431         (Target_arm::fix_v4bx): New method.
4432         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4433         (Stub_table::relocate_stubs): Likewise.
4434         (Stub_table::do_write): Likewise.
4435         (Stub_table::update_data_size_and_addralign): Likewise.
4436         (Stub_table::finalize_stubs):  Likewise.
4437         (Target_arm::Scan::local): Likewise.
4438         (Target_arm::Scan::global): Likewise.
4439         (Target_arm::do_finalize_sections): Likewise.
4440         (Target_arm::Relocate::relocate): Likewise.
4441         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4442         Likewise.
4443         (Target_arm::scan_reloc_for_stub): Likewise.
4444         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4445
4446 2010-01-19  Ian Lance Taylor  <iant@google.com>
4447
4448         * output.cc (Output_section_headers::do_sized_write): Write large
4449         segment count to sh_info field.
4450         (Output_file_header::do_sized_write): For large segment count,
4451         write PN_XNUM to e_phnum field.
4452
4453 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4454
4455         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4456         (Arm_relocate_functions::thm_jump8): New function.
4457         (Arm_relocate_functions::thm_jump11): New function.
4458         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4459         R_ARM_THM_JUMP11.
4460         (Target_arm::Scan::global): Likewise.
4461         (Target_arm::Relocate::relocate): Likewise.
4462         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4463         Likewise.
4464
4465 2010-01-14  Doug Kwan  <dougkwan@google.com>
4466
4467         * arm.cc (map, utility): Include headers.
4468         (Target_arm::apply_cortex_a8_workaround): New method.
4469         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4470         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4471         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4472         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4473         the --[no-]fix-cortex-a8 command line options.
4474         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4475         (Target_arm::relocate_stub): Use addend in instruction template.
4476         * options.h (DEFINE_bool): Set the user-set flag.
4477         (General_options): Add --[no-]-fix-cortex options.
4478         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4479         : Update fast look-up map after conversion.
4480
4481 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4482
4483         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4484         in the first pass of do_layout.
4485
4486 2010-01-13  Doug Kwan  <dougkwan@google.com>
4487
4488         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4489         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4490         apparent compiler problem of not folding static constant integral
4491         data members of elfcpp::Elf_sizes<32>.
4492
4493 2010-01-13  Doug Kwan  <dougkwan@google.com>
4494
4495         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4496         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4497         Arm_relobj::scan_section_for_cortex_a8_erratum,
4498         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4499         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4500         sections to scan for relocation stubs into a new method
4501         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4502         relocation and Cortex-A8 stub scanning.
4503         (Target_arm::do_relax): Force stubs to be after stubbed sections
4504         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4505         the beginning of a new relaxation pass.  Update a comment.
4506         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4507
4508 2010-01-12  Ian Lance Taylor  <iant@google.com>
4509
4510         * target-reloc.h (visibility_error): New inline function.
4511         (relocate_section): Call visibility_error.
4512         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4513         (MOSTLYCLEANFILES): Likewise.
4514         (protected_4_pic.o, protected_3.err): New targets.
4515         * testsuite/protected_4.cc: New file.
4516
4517 2010-01-12  Doug Kwan  <dougkwan@google.com>
4518
4519         * arm.cc (Cortex_a8_reloc): New class.
4520         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4521         and cortex_a8_relocs_info_.
4522         (Target_arm::fix_cortex_a8): New method definition.
4523         (Target_arm::Cortex_a8_relocs_info): New type.
4524         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4525         New data member declarations.
4526         (Target_arm::scan_reloc_for_stub): Record information about
4527         relocations for THUMB branches that might be exempted from the
4528         Cortex-A8 workaround.
4529         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4530         at the beginning of a relaxation pass.
4531
4532 2010-01-12  Doug Kwan  <dougkwan@google.com>
4533
4534         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4535         (Arm_relobj::Mapping_symbol_position,
4536          Arm_reloj::Mapping_symbol_position_less,
4537          Arm_relobj::Mapping_symbols_info): New types.
4538         (Target_arm::is_mapping_symbol_name): New method definition.
4539         (Arm_relobj::do_count_local_symbols): Save information about mapping
4540         symbols.
4541
4542 2010-01-11  Doug Kwan  <dougkwan@google.com>
4543
4544         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4545         Arm_relocate_functions::thumb32_branch_upper,
4546         Arm_relocate_functions::thumb32_branch_lower,
4547         Arm_relocate_functions::thumb32_cond_branch_offset,
4548         Arm_relocate_functions::thumb32_cond_branch_upper,
4549         Arm_relocate_functions::thumb32_cond_branch_lower,
4550         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4551         branch offset encoding.
4552         (Arm_relocate_functions::thumb_branch_common): Use new branch
4553         offset encoding methods to avoid code duplication.
4554         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4555         (Stub_addend_reader::operator()): Use new branch encoding method
4556         to avoid code duplication.
4557
4558 2010-01-11  Doug Kwan  <dougkwan@google.com>
4559
4560         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4561         (Target_arm::do_finalize_sections): Define special EXIDX section
4562         symbols only if referenced.
4563         * gc.h (Garbage_collection::add_reference): New method.
4564         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4565         code duplication.
4566
4567 2010-01-11  Ian Lance Taylor  <iant@google.com>
4568
4569         * script.cc (Version_script_info::build_expression_list_lookup):
4570         Change complaing about duplicate wildcard match from error to
4571         warning.
4572
4573         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4574         of 2009-12-30.
4575         (Version_script_info::Version_script_info): Initialize globs_,
4576         default_version_, default_is_global_, and exact_.  Don't
4577         initialize globals_ or locals_.
4578         (Version_script_info::build_lookup_tables): Build local symbols
4579         first.
4580         (Version_script_info::unquote): New function.
4581         (Version_script_info::add_exact_match): New function.
4582         (Version_script_info::build_expression_list_lookup): Remove lookup
4583         parameter.  Add is_global parameter.  Change all callers.  Handle
4584         wildcard pattern specially.  Unquote pattern.  Call
4585         add_exact_match.
4586         (Version_script_info::get_name_to_match): New function.
4587         (Version_script_info::get_symbol_version): New function.
4588         (Version_script_info::get_symbol_version_helper): Remove.
4589         (Version_script_info::check_unmatched_names): Call unquote.
4590         * script.h (class Version_script_info): Change get_symbol_version
4591         to be non-inline and add is_global parameter; change all callers.
4592         Rewrite symbol_is_local.  Update declarations.  Define struct
4593         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4594         Remove globals_ and locals_ members.  Add exact_, globs_,
4595         default_version_, is_global_.
4596         (Version_script_info::Glob): Remove pattern, add expression and
4597         is_global.  Update constructor.  Change all callers.
4598         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4599         default version.
4600         (Versions::symbol_section_contents): If a symbol is undefined, or
4601         defined in a dynamic object, set the version index to
4602         VER_NDX_LOCAL.
4603         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4604         symbol_is_local.
4605         (Symbol_table::add_from_pluginobj): Likewise.
4606         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4607
4608 2010-01-11  Doug Kwan  <dougkwan@google.com>
4609
4610         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4611         (incremental_dump_LDADD): Add linking option for libintl.
4612         * Makefile.in: Regenerate.
4613
4614 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4615
4616         PR gold/11144
4617         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4618         instead of -Ds.
4619         * testsuite/Makefile.in: Regenerated.
4620
4621 2010-01-10  Doug Kwan  <dougkwan@google.com>
4622
4623         * options.h (DEFINE_var): Use parentheses around argument varname__
4624         in macro body to avoid any unintended subsequent substitutions.
4625
4626 2010-01-10  Ian Lance Taylor  <iant@google.com>
4627
4628         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4629         candidates before doing symbol resolution.
4630
4631         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4632         ODR candidates if only one is weak.
4633
4634 2010-01-08  Ian Lance Taylor  <iant@google.com>
4635
4636         * script.cc (Version_script_info::build_expression_list_lookup):
4637         Don't warn about ambiguous version, just record the ambiguity.
4638         (Version_script_info::get_symbol_version_helper): Give error if
4639         version is ambiguous.
4640
4641 2010-01-08  Doug Kwan  <dougkwan@google.com>
4642
4643         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4644           prev_data_size_ and prev_addralign_.  Remove initializer for
4645           deleted data member has_been_changed_.
4646           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4647           to determine if the table is empty.
4648           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4649           Remove.
4650           (Stub_table::add_reloc_stub): Define method in class definition
4651           instead of just declaring it there.
4652           (Stub_table::add_cortex_a8_stub): New method definition.
4653           (Stub_table::update_data_size_and_addralign): Ditto.
4654           (Stub_table::finalize_stubs): Ditto.
4655           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4656           (Stub_table::do_addralign_): Return address alignment in the
4657           (Stub_table::do_reset_address_and_file_offset): Define method in
4658           class definition instead of declaring it there.  Set current data
4659           size to be the data size of the previous pass.
4660           (Stub_table::set_final_data_size): Use current data size as the
4661           final data size.
4662           (Stub_table::relocate_stub): Change parameter type of stub from
4663           Reloc_stub pointer to Stub pointer.
4664           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4665           (Stub_table::Cortex_a8_stub_list): New typedef.
4666           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4667            Stub_table::prev_addralign_): New data member.
4668           (Arm_relobj::Arm_relobj): Initialize data member
4669           section_has_cortex_a8_workaround_.
4670           (Arm_relobj::section_has_cortex_a8_workaround,
4671            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4672            definitions.
4673           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4674           declarations.
4675           (Target_arm::relocate_stub): Change parameter type of stub from
4676           Reloc_stub pointer to Stub pointer.
4677           (Insn_template::size, Insn_template::alignment): Handle
4678           THUMB16_SPECIAL_TYPE.
4679           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4680            Stub_table::update_data_size_and_addralign,
4681            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4682           definitions.
4683           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4684           (Stub_table::do_write): Ditto.
4685           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4686
4687 2010-01-08  Ian Lance Taylor  <iant@google.com>
4688
4689         PR 11108
4690         * symtab.h (class Symbol): Remove fields is_target_special_ and
4691         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4692         (Symbol::is_defined_in_discarded_section): New function.
4693         (Symbol::set_is_defined_in_discarded_section): New function.
4694         (Symbol::has_plt_offset): Rewrite.
4695         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4696         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4697         Don't initialize is_target_special_ or has_plt_offset_.
4698         Initialize is_defined_in_discarded_section_.
4699         (Symbol_table::add_from_relobj): If appropriate, set
4700         is_defined_in_discarded_section.
4701         * resolve.cc (Symbol::override_base_with_special): Don't test
4702         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4703         * target-reloc.h (relocate_section): Do special handling for
4704         symbols defined in discarded sections for global symbols as well
4705         as local symbols.
4706
4707 2010-01-08  Ian Lance Taylor  <iant@google.com>
4708
4709         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4710         the SHT_SYMTAB case.
4711
4712 2010-01-08  Ian Lance Taylor  <iant@google.com>
4713
4714         * object.cc (Sized_relobj::do_layout): Don't get confused if
4715         layout_eh_frame returns NULL.
4716
4717 2010-01-08  Ian Lance Taylor  <iant@google.com>
4718
4719         PR 11084
4720         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4721         dynamic symbol table, use the normal symbol table.
4722         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4723         symbol table.
4724
4725 2010-01-08  Ian Lance Taylor  <iant@google.com>
4726
4727         PR 11072
4728         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4729         sections.
4730
4731 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4732
4733         * version.cc (print_version): Change to "Copyright 2010".
4734
4735 2010-01-08  Ian Lance Taylor  <iant@google.com>
4736
4737         PR 10287
4738         PR 11063
4739         * i386.cc (class Target_i386): Change return type of plt_section
4740         to be non-const.
4741         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4742         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4743         tls_desc_rel_ field.
4744         (Output_data_plt_i386::rel_tls_desc): New function.
4745         (Target_i386::rel_tls_desc_section): New function.
4746         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4747         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4748         R_386_TLS_DESC reloc in rel_tls_desc_section.
4749         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4750         Define struct Tlsdesc_info.
4751         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4752         (Target_x86_64::do_reloc_symbol_index): New function.
4753         (Target_x86_64::add_tlsdesc_info): New function.
4754         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4755         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4756         tlsdesc_rel_ field.
4757         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
4758         all callers.
4759         (Output_data_plt_x86_64::rela_tlsdesc): New function.
4760         (Target_x86_64::rela_tlsdesc_section): New function.
4761         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4762         handling.
4763         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4764         (Target_x86_64::do_reloc_addend): New function.
4765         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4766         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4767         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
4768         (Output_reloc::type): New function.
4769         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4770         (Output_reloc::is_target_specific): New function.
4771         (Output_reloc::target_arg): New function.
4772         (class Output_reloc) [SHT_RELA]: Add four new constructors for
4773         absolute relocs and target specific relocs.
4774         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4775         add_target_specific.
4776         (class Output_data_reloc) [SHT_RELA]: Likewise.
4777         * output.cc (Output_reloc::Output_reloc): Add four new versions
4778         for absolute relocs and target specific relocs.
4779         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4780         (Output_reloc::get_symbol_index): Likewise.
4781         (Output_reloc::local_section_offset): Check that local_sym_index_
4782         is not TARGET_CODE or 0.
4783         (Output_reloc::symbol_value): Likewise.
4784         (Output_reloc::write) [SHT_RELA]: Call target for target specific
4785         reloc.
4786         * target.h (class Target): Add reloc_symbol_index and reloc_addend
4787         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
4788         functions.
4789         * layout.cc (add_target_dynamic_tags): Use output section for
4790         DT_PLTRELSZ and DT_JMPREL.
4791
4792 2010-01-07  Ian Lance Taylor  <iant@google.com>
4793
4794         PR 11061
4795         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4796         function.
4797         (class Output_data_reloc_generic): Define.
4798         (class Output_data_reloc_base): Change base class to
4799         Output_data_reloc_generic.  Change add() method to call
4800         bump_relative_reloc_count for a relative reloc.  Remove
4801         sort_relocs_ field.
4802         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4803         to sort_relocs().
4804         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4805         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
4806         appropriate.
4807         * layout.h (class Layout): Update declaration.
4808
4809 2010-01-07  Ian Lance Taylor  <iant@google.com>
4810
4811         * output.h (class Output_data): Add const version of
4812         output_section and do_output_section.
4813         (class Output_section_data): Add const version of
4814         do_output_section.
4815         (class Output_section): Likewise.
4816         * layout.cc (Layout::add_target_dynamic_tags): New function.
4817         * layout.h (class Layout): Update declarations.
4818         * arm.cc (Target_arm::do_finalize_sections): Use
4819         add_target_dynamic_tags.
4820         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4821         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4822         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4823         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4824
4825 2010-01-07  Ian Lance Taylor  <iant@google.com>
4826
4827         PR 11042
4828         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4829         object as needed.
4830
4831 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
4832             Ian Lance Taylor  <iant@google.com>
4833
4834         PR 11019
4835         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4836         Xindex::read_symtab_xindex.
4837
4838 2010-01-07  Doug Kwan  <dougkwan@google.com>
4839
4840         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4841         (Insn_template::thumb16_bcond_insn): New method declaration.
4842         (Insn_template): Fix spelling.
4843         (Stub::thumb16_special): New method declaration.
4844         (Stub::do_write): Define virtual method which was previously pure
4845         virtual.
4846         (Stub::do_thumb16_special): New method declaration.
4847         (Stub::do_fixed_endian_write): New template member.
4848         (Reloc_stub::do_write): Remove.
4849         (Reloc_stub::do_fixed_endian_write): Remove.
4850         (Cortex_a8_stub): New class definition.
4851         (Stub_factory::make_cortex_a8_stub): New method definition.
4852         (Stub_factory::Stub_factory): Add missing static storage class
4853         qualifier for elf32_arm_stub_a8_veneer_blx.
4854
4855 2010-01-07  Ian Lance Taylor  <iant@google.com>
4856
4857         PR 10980
4858         * options.h (class General_options): Add --warn-unresolved-symbols
4859         and --error-unresolved-symbols.
4860         * errors.cc (Errors::undefined_symbol): Implement
4861         --warn-unresolved-symbols.
4862
4863         * options.h (class General_options): Add -z text and -z textoff.
4864         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4865
4866 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
4867
4868         * gc.h (Garbage_collection::Cident_section_map): New typedef.
4869         (Garbage_collection::cident_sections): New function.
4870         (Garbage_collection::add_cident_section): New function.
4871         (Garbage_collection::cident_sections_): New member.
4872         (gc_process_relocs): Add references to sections whose names are C
4873         identifiers.
4874         * gold.h (cident_section_start_prefix): New constant.
4875         (cident_section_stop_prefix): New constant.
4876         (is_cident): New function.
4877         * layout.cc (Layout::define_section_symbols): Replace string constants
4878         with the newly defined constants.
4879         * object.cc (Sized_relobj::do_layout): Track sections whose names are
4880         C identifiers.
4881         * testsuite/Makefile.am: Add gc_orphan_section_test.
4882         * testsuite/Makefile.in: Regenerate.
4883         * testsuite/gc_orphan_section_test.cc: New file.
4884         * testsuite/gc_orphan_section_test.sh: New file.
4885
4886 2010-01-06  Ian Lance Taylor  <iant@google.com>
4887
4888         PR 10980
4889         * options.h (class General_options): Add --warn-shared-textrel.
4890         * layout.cc (Layout::finish_dynamic_section): Implement
4891         --warn-shared-textrel.
4892
4893         PR 10980
4894         * options.h (class General_options): Add --warn-multiple-gp.
4895
4896 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4897
4898         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4899         $(THREADSLIB) and $(LIBDL).
4900         * Makefile.in: Rebuild.
4901
4902 2010-01-06  Ian Lance Taylor  <iant@google.com>
4903
4904         PR 10980
4905         * options.cc (General_options::parse_section_start): New function.
4906         (General_options::section_start): New function.
4907         (General_options::General_options): Initialize all members.
4908         * options.h: Include <map>
4909         (class General_options): Add --section-start.  Add section_starts_
4910         member.
4911         * layout.cc (Layout::attach_allocated_section_to_segment): If
4912         --section-start was used, set the address of the segment.  Remove
4913         local sort_sections.
4914         (Layout::relaxation_loop_body): If the address of the load segment
4915         has been set by --section-start, don't use it.
4916         * output.h (Output_segment::update_flags_for_output_section): New
4917         function.
4918         * output.cc (Output_segment::add_output_section): Call
4919         update_flags_for_output_section.
4920
4921 2010-01-05  Ian Lance Taylor  <iant@google.com>
4922
4923         PR 10980
4924         * options.h (class General_options): Add --undefined-version.
4925         * script.cc (struct Version_expression): Add was_matched_by_symbol
4926         field.
4927         (Version_script_info::matched_symbol): New function.
4928         (Version_script_info::get_symbol_version_helper): Call
4929         matched_symbol.
4930         (Version_script_info::check_unmatched_names): New function.
4931         * script.h (class Version_script_info): Update declarations.
4932         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4933
4934         * options.h (class General_options): Use DEFINE_bool_alias for
4935         allow_multiple_definition.
4936         * resolve.cc (Symbol_table::should_override): Don't test
4937         allow_multiple_definition.
4938
4939         PR 10980
4940         * options.h (class General_options): Add --cref.
4941         * main.cc (main): Print cref table if --cref.  Don't close mapfile
4942         until after printing cref table.
4943         * cref.cc: Include "symtab.h".
4944         (class Cref_inputs): Define Cref_table_compare and Cref_table.
4945         (Cref_table_compare::operator()): New function.
4946         (Cref_inputs::gather_cref): New function.
4947         (filecol): New static const.
4948         (Cref_inputs::print_cref): New function.
4949         (Cref::print_cref): New function.
4950         * cref.h: Include <cstdio>.
4951         (class Cref): Update declarations.
4952         * mapfile.h (Mapfile::file): New function.
4953         * object.h (class Object): Define Symbols.  Declare virtual
4954         do_get_global_symbols.
4955         (Object::get_global_symbols): New function.
4956         * object.cc (Input_objects::add_object): Pass object to cref_ if
4957         --cref.
4958         (Input_objects::archive_start): Likewise.
4959         (Input_objects::archive_stop): Likewise.
4960         (Input_objects::print_cref): New function.
4961         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4962         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4963         --cref.
4964         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4965         function.
4966         * plugin.h (class Sized_pluginobj): Update declarations.
4967
4968 2010-01-05  Ian Lance Taylor  <iant@google.com>
4969
4970         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4971         to is_default_version.  Rename insdef to insdefault.
4972         (Symbol_table::add_from_relobj): Rename def to is_default_version
4973         and local to is_forced_local.
4974         (Symbol_table::add_from_pluginobj): Likewise.
4975         (Symbol_table::add_from_dynobj): Likewise.
4976         (Symbol_table::define_special_symbol): Rename insdef to
4977         insdefault.
4978
4979 2010-01-04  Ian Lance Taylor  <iant@google.com>
4980
4981         PR 10980
4982         * options.h (class General_options): Add
4983         --allow-multiple-definition and -z muldefs.
4984         * resolve.cc (Symbol_table::should_override): Don't warn about a
4985         multiple symbol definition if --allow-multiple-definition or -z
4986         muldefs.
4987
4988         PR 10980
4989         * options.h (class General_options): Add --add-needed and
4990         --copy-dt-needed-entries.  Tweak --as-needed help entry.
4991         * object.cc (Input_objects::check_dynamic_dependencies): Give an
4992         error if --copy-dt-needed-entries aka --add-needed is used and
4993         would cause a change in behaviour.
4994
4995         PR 10980
4996         * options.h (class General_options): Add -G as a short version of
4997         --shared.  Add no-op options -assert, -g, and -i.
4998
4999 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
5000
5001         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5002         check for .text or .gnu.linkonce.t sections.
5003         * icf.cc (Icf::find_identical_sections): Ditto.
5004         Change the detection for mangled function name within the section
5005         name.
5006         * icf.h (is_section_foldable_candidate): New function.
5007
5008 2009-12-30  Ian Lance Taylor  <iant@google.com>
5009
5010         PR 10980
5011         * options.h (class General_options): Permit two dashes with
5012         --retain-symbols-file.
5013
5014 2009-12-30  Ian Lance Taylor  <iant@google.com>
5015
5016         PR 10979
5017         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5018         don't put the file header and segment headers in the text
5019         segment.
5020
5021         PR 10979
5022         * common.cc (Sort_commons::operator()): Stabilize sort when both
5023         entries are NULL.
5024         (Symbol_table::do_allocate_commons_list): When allocating common
5025         symbols, skip a symbol which is no longer common.
5026         * symtab.h (Symbol::is_common): Test whether the symbol comes from
5027         an object before checking its type.
5028         * testsuite/common_test_2.c: New file.
5029         * testsuite/common_test_3.c: New file.
5030         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5031         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5032         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5033         (common_test_2_pic.o, common_test_2.so): New targets.
5034         (common_test_3_pic.o, common_test_3.so): New targets.
5035         * testsuite/Makefile.in: Rebuild.
5036
5037         PR 10979
5038         * script.cc (read_input_script): If we see a new SECTIONS clause,
5039         and we have added an input section, give an error.
5040         * layout.h (class Layout): Add have_added_input_section function.
5041         Add have_added_input_section_ field.
5042         * layout.cc (Layout::Layout): Initialize
5043         have_added_input_section_.
5044         (Layout::layout): Set have_added_input_section_.
5045         (Layout::layout_eh_frame): Likewise.
5046
5047 2009-12-30  Ian Lance Taylor  <iant@google.com>
5048
5049         PR 10931
5050         * options.h (class General_options): Add --sort-common option.
5051         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5052         * common.cc (Sort_common): Add sort_order parameter to
5053         constructor.  Add sort_order_ field.
5054         (Sort_commons::operator): Check sort_order_.
5055         (Symbol_table::allocate_commons): Determine the sort order.
5056         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5057         Change all callers.
5058         (Symbol_table::do_allocate_commons_list): Likewise.
5059
5060 2009-12-30  Ian Lance Taylor  <iant@google.com>
5061
5062         PR 10916
5063         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5064         symbols from this object, don't change the visibility of an
5065         undefined symbol.
5066         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5067
5068 2009-12-30  Ian Lance Taylor  <iant@google.com>
5069
5070         PR 10861
5071         * script.h (class Version_script_info): Define Language enum.
5072         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5073         new fields globals_, locals_, and is_finalized_.
5074         * script.cc: Various formatting fixes.
5075         (class Parser_closure): Change language_stack_ from a vector of
5076         std::string to one of Version_script_info::Language.  Adjust all
5077         uses accordingly.
5078         (class Lazy_demangler): Remove.
5079         (struct Version_expression): Change language from std::string to
5080         Version_script_info::Language.
5081         (Version_script_info::Version_script_info): New function.
5082         (Version_script_info::~Version_script_info): Don't call clear.
5083         (Version_script_info::finalize): New function.
5084         (Version_script_info::build_lookup_tables): New function.
5085         (Version_script_info::build_expression_list_lookup): New
5086         function.
5087         (Version_script_info::get_symbol_version_helper): Rewrite to use
5088         lookup tables.
5089         (Version_script_info::print_expression_list): Adjust to use
5090         Version_script_info::Language.
5091         (script_push_lex_into_version_mode): Check that the version script
5092         has not been finalized.
5093         (version_script_push_lang): Change language string to
5094         Version_script_info::Language.
5095         * options.cc (Command_line::version_script): New function.
5096         * options.h (class General_options): Add finalize_dynamic_list
5097         function.  Change version_script from declaration to definition.
5098         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5099         * testsuite/version_script.map: Remove duplicate def of foo.
5100         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5101         version_script.map.
5102         * testsuite/Makefile.in: Rebuild.
5103
5104 2009-12-30  Ian Lance Taylor  <iant@google.com>
5105
5106         PR 10843
5107         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5108         if the input symbol index is 0, make the output symbol index 0.
5109
5110 2009-12-30  Ian Lance Taylor  <iant@google.com>
5111
5112         PR 10670
5113         * options.h (class General_options): Add -x/--discard-all.
5114         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5115         --discard-all.  If the local symbol needs a dynamic entry, check
5116         that before handling --discard-locals.
5117
5118 2009-12-30  Ian Lance Taylor  <iant@google.com>
5119
5120         PR 10450
5121         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5122         flags to PF_R.
5123         (Output_segment::add_output_section): Don't change the flags if
5124         the type is PT_TLS.
5125
5126         PR 10450
5127         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5128         GNU hash table if they need a dynamic value.  Otherwise, don't add
5129         them if they are defined in a dynamic object or are forced local.
5130
5131 2009-12-29  Ian Lance Taylor  <iant@google.com>
5132
5133         PR 10450
5134         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5135         .gnu.hash table for a 32-bit target.
5136
5137         PR 10450
5138         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5139         regular and a dynamic object only needs a dynamic symbol table
5140         entry if it is externally visible.
5141
5142         PR 10450
5143         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5144         constructor.  Add global_offset_table_ field.
5145         (Target_i386::got_section): Set global_offset_table_.
5146         (Target_i386::do_finalize_sections): Set global_offset_table_
5147         size.
5148         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5149         in constructor.  Add global_offset_table_ field.
5150         (Target_x86_64::got_section): Set global_offset_table_.
5151         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5152         size.
5153
5154         * layout.cc (Layout::Layout): Initialize increase_relro_.
5155         (Layout::get_output_section): Add is_relro, is_last_relro, and
5156         is_first_non_relro parameters.  Change all callers.
5157         (Layout::choose_output_section): Likewise.
5158         (Layout::add_output_section_data): Likewise.
5159         (Layout::make_output_section): Likewise.
5160         (Layout::set_segment_offsets): Clear increase_relro when using a
5161         linker script.
5162         * layout.h (class Layout): Add increase_relro method.  Add
5163         increase_relro_ field.  Update declarations.
5164         * output.cc (Output_section::Output_section): Initialize
5165         is_last_relro_ and is_first_non_relro_.
5166         (Output_segment::add_output_section): Group relro sections is
5167         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5168         (Output_segment::maximum_alignment): Remove relro handling.
5169         (Output_segment::set_section_addresses): Add increase_relro
5170         parameter.  Change all callers.  Add initial alignment to align
5171         relro sections on separate page.  Remove old relro handling.
5172         (Output_segment::set_section_list_addresses): Remove in_relro
5173         parameter.  Change all callers.
5174         (Output_segment::set_offset): Add increase parameter.  Change all
5175         callers.  Remove old relro handling.
5176         * output.h (class Output_section): Add new methods: is_last_relro,
5177         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5178         Add is_last_relro_ and is_first_non_relro_ fields.
5179         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5180         Create separate .got.plt section.  Call increase_relro.
5181         * x86_64.cc (Target_x86_64::got_section): Likewise.
5182         * testsuite/relro_script_test.t: Add .got.plt.
5183
5184         PR 10450
5185         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5186         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5187         (Layout::finalize): Call set_dynamic_symbol_size.
5188         (Layout::set_dynamic_symbol_size): New function.
5189         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5190         set_dynamic_symbol_size.
5191
5192         PR 10450
5193         * output.h (class Output_section): Add is_entsize_zero_ field.
5194         * output.cc (Output_section::Output_section): Initialize
5195         is_entsize_zero_.
5196         (Output_section::set_entsize): If two different entsizes are
5197         requested, force it to zero.
5198         (Output_section::add_input_section): Set flags for .debug_str
5199         before updating section flags.  Set entsize.
5200         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5201         and SHF_STRING if all input sections have those flags.
5202
5203 2009-12-29   Rafael Espindola  <espindola@google.com>
5204
5205         * main.cc (main): Fix the sys time reporting.
5206         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5207         reporting.
5208
5209 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5210
5211         * options.cc (General_options::parse_version): Allow -v to exit
5212         without an error if there is nothing to link.
5213
5214 2009-12-29  Ian Lance Taylor  <iant@google.com>
5215
5216         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5217         using a version of gcc before 4.1.
5218         * configure: Rebuild.
5219
5220 2009-12-28  Chris Demetriou  <cgd@google.com>
5221
5222         * attributes.cc (Output_attributes_section_data::do_write): Use
5223         std::vector::front rather than std::vector::data.
5224
5225 2009-12-28  Ian Lance Taylor  <iant@google.com>
5226
5227         * symtab.h (class Symbol_table): Add enum Defined.
5228         * resolve.cc (Symbol_table::should_override): Add defined
5229         parameter.  Change all callers.  Test whether object is NULL
5230         before calling a method on it.
5231         (Symbol_table::report_resolve_problem): Add defined parameter.
5232         Change all callers.
5233         (Symbol_table::should_override_with_special): Likewise.
5234         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5235         parameter.  Change all callers.
5236         (Symbol_table::do_define_in_output_data): Likewise.
5237         (Symbol_table::define_in_output_segment): Likewise.
5238         (Symbol_table::do_define_in_output_segment): Likewise.
5239         (Symbol_table::define_as_constant): Likewise.
5240         (Symbol_table::do_define_as_constant): Likewise.
5241         * script.h (class Symbol_assignment): Add is_defsym parameter to
5242         constructor; change all callers.
5243         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5244         parameter.  Change all callers.  Add is_defsym_ field.
5245         (class Parser_closure): Add parsing_defsym parameter to
5246         constructor; change all callers.  Add parsing_defsym accessor
5247         function.  Add parsing_defsym_ field.
5248
5249 2009-12-28  Ian Lance Taylor  <iant@google.com>
5250
5251         * gold.cc (queue_middle_tasks): Fix formatting.
5252         * object.cc (Relobj::is_section_name_included): Likewise.
5253
5254 2009-12-23  Ian Lance Taylor  <iant@google.com>
5255
5256         * i386.cc (Target_i386::do_calls_non_split): Recognize
5257         -fsplit-stack prologue for a function with a static chain.
5258         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5259         -fsplit-stack prologue when using %r11.
5260
5261 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5262
5263         * options.cc (General_options::parse_version): Make -v continue and do
5264         the link like GNU ld does.
5265
5266 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5267
5268         * Makefile.am (CCFILES): Add timer.cc.
5269         (HFILES): Add timer.h.
5270         * configure.ac: Check for sysconf and times.
5271         * main.cc: include timer.h.
5272         (main): Use Timer instead of get_run_time.
5273         * timer.cc: New.
5274         * timer.h: New.
5275         * workqueue.cc: include timer.h.
5276         (Workqueue::find_and_run_task):
5277         Report user, sys and wall time.
5278         * Makefile.in: Regenerate.
5279         * config.in: Regenerate.
5280         * configure: Regenerate.
5281
5282 2009-12-16  Doug Kwan  <dougkwan@google.com>
5283
5284         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5285         sections.
5286         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5287         relaxed input sections.
5288         * output.cc (Output_section::find_relaxed_input_section): Change
5289         return type to Output_relaxed_input_section pointer.  Adjust code
5290         for new type of relaxed_input_section_map_.
5291         * output.h (Output_section::find_relaxed_input_section): Change
5292         return type to Output_relaxed_input_section pointer.
5293         (Output_section::Output_relaxed_input_section_by_input_section_map):
5294         New type.
5295         (Output_section::relaxed_input_section_map_): Change type to
5296         Output_section::Output_relaxed_input_section_by_input_section_map.
5297         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5298         input section.
5299
5300 2009-12-15  Ian Lance Taylor  <iant@google.com>
5301
5302         * layout.cc (Layout::create_shstrtab): Only write out after input
5303         sections if we are compressing debug sections.
5304
5305 2009-12-15  Ian Lance Taylor  <iant@google.com>
5306
5307         * archive.cc (Archive::add_symbols): Only look up a symbol without
5308         a version if there is, in fact, a version.
5309
5310 2009-12-14  Ian Lance Taylor  <iant@google.com>
5311
5312         Revert -Wshadow changes, all changes from:
5313         2009-12-11  Doug Kwan  <dougkwan@google.com>
5314         2009-12-11  Nick Clifton  <nickc@redhat.com>
5315         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5316
5317 2009-12-11  Doug Kwan  <dougkwan@google.com>
5318
5319         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5320         due to -Wshadow.
5321         * attributes.cc (Object_attribute::size): Ditto.
5322         (Attributes_section_data::size): Ditto.
5323         (Attributes_section_data::Attributes_section_data): Ditto.
5324         (Output_attributes_section_data::do_write): Ditto.
5325         * attributes.h (Object_attribute::set_type): Ditto.
5326         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5327
5328 2009-12-11  Nick Clifton  <nickc@redhat.com>
5329
5330         * archive.cc: Fix shadowed variable warnings.
5331         * arm.cc: Likewise.
5332         * compressed_output.cc: Likewise.
5333         * compressed_output.h: Likewise.
5334         * configure: Likewise.
5335         * dwarf_reader.cc: Likewise.
5336         * dynobj.cc: Likewise.
5337         * dynobj.h: Likewise.
5338         * ehframe.cc: Likewise.
5339         * ehframe.h: Likewise.
5340         * errors.cc: Likewise.
5341         * expression.cc: Likewise.
5342         * fileread.cc: Likewise.
5343         * fileread.h: Likewise.
5344         * freebsd.h: Likewise.
5345         * i386.cc: Likewise.
5346         * icf.cc: Likewise.
5347         * incremental.h: Likewise.
5348         * layout.cc: Likewise.
5349         * layout.h: Likewise.
5350         * mapfile.cc: Likewise.
5351         * merge.cc: Likewise.
5352         * merge.h: Likewise.
5353         * object.cc: Likewise.
5354         * object.h: Likewise.
5355         * options.h: Likewise.
5356         * output.cc: Likewise.
5357         * output.h: Likewise.
5358         * parameters.cc: Likewise.
5359         * plugin.cc: Likewise.
5360         * powerpc.cc: Likewise.
5361         * reduced_debug_output.cc: Likewise.
5362         * reduced_debug_output.h: Likewise.
5363         * reloc.cc: Likewise.
5364         * reloc.h: Likewise.
5365         * resolve.cc: Likewise.
5366         * script-sections.cc: Likewise.
5367         * script.cc: Likewise.
5368         * script.h: Likewise.
5369         * sparc.cc: Likewise.
5370         * symtab.cc: Likewise.
5371         * symtab.h: Likewise.
5372         * target-select.cc: Likewise.
5373         * target-select.h: Likewise.
5374         * token.h: Likewise.
5375         * workqueue.cc: Likewise.
5376         * workqueue.h: Likewise.
5377         * x86_64.cc: Likewise.
5378
5379 2009-12-10  Doug Kwan  <dougkwan@google.com>
5380
5381         * arm.cc (attributes.h): New include.
5382         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5383         (Arm_relobj::~Arm_relobj): Delete object pointed by
5384         attributes_section_data_.
5385         (Arm_relobj::attributes_section_data): New method definition.
5386         (Arm_relobj::attributes_section_data_): New data member declaration.
5387         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5388         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5389         attributes_section_data_.
5390         (Arm_dynobj::attributes_section_data): New method definition.
5391         (Arm_dynobj::attributes_section_data_): New data member declaration.
5392         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5393         initialization value of may_use_blx_ to false.
5394         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5395         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5396         object attributes to compute results instead of hard-coding.
5397         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5398         Target_arm::get_secondary_compatible_arch,
5399         Target_arm::set_secondary_compatible_arch
5400         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5401         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5402         New method declarations.
5403         (Target_arm::get_aeabi_object_attribute): New method definition.
5404         (Target_arm::attributes_section_data_): New data member declaration.
5405         (read_arm_attributes_section): New template definition.
5406         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5407         (Arm_dynobj::do_read_symbols): Ditto.
5408         (Target_arm::do_finalize_sections): Merge attributes sections from
5409         input.  Check for BLX use after attributes section merging.
5410         Fix __exidx_start and __exidx_end visibility.  Create an
5411         .ARM.attributes section if necessary.
5412         (Target_arm::get_secondary_compatible_arch,
5413         Target_arm::set_secondary_compatible_arch,
5414         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5415         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5416         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5417         New method definitions.
5418
5419 2009-12-09  Ian Lance Taylor  <iant@google.com>
5420
5421         * plugin.cc (Plugin::load): Don't cast from void* to a function
5422         pointer.
5423
5424 2009-12-09  Ian Lance Taylor  <iant@google.com>
5425
5426         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5427         information fields.
5428
5429 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5430
5431         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5432         Replace two_file_shared_1.so with two_file_shared_2.so.
5433         * testsuite/Makefile.in: Regenerated.
5434
5435 2009-12-08  Doug Kwan  <dougkwan@google.com>
5436
5437         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5438         (HFILES): Add attributes.h and int_encoding.h.
5439         * Makefile.in: Regenerate.
5440         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5441         function definitions to int_encoding.cc
5442         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5443         prototypes to int_encoding.h
5444         * reduced_debug_output.cc (int_encoding.h): New include.
5445         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5446         function definitions to int_encoding.cc
5447         (insert_into_vector, read_from_pointer): Move template definitions to
5448         int_encoding.h
5449         * attributes.cc: New file.
5450         * attributes.h: New file.
5451         * int_encoding.cc: New file.
5452         * int_encoding.h: New file.
5453
5454 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5455
5456         PR gold/11055
5457         * incremental-dump.cc (dump_incremental_inputs): New.
5458         (main): Use dump_incremental_inputs.
5459
5460 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5461
5462         PR gold/10893
5463         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5464         checking elfcpp::STT_FUNC.
5465         (Target_i386::Relocate::relocate): Likewise.
5466         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5467
5468         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5469         symbols from shared libraries into normal FUNC symbols.
5470
5471         * symtab.h (Symbol): Add is_func and use it.
5472
5473 2009-12-05  Doug Kwan  <dougkwan@google.com>
5474
5475         * arm.cc (Target_arm::arm_info): Initialize new fields
5476         attributes_section and attributes_vendor.
5477         * i386.cc (Target_i386::i386_info): Same.
5478         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5479         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5480         fields attributes_section and attributes_vendor.
5481         * sparc.cc (Target_sparc::sparc_info): Same.
5482         * target.h (Target::attributes_section, Target::attributes_vendor,
5483         Target::is_attributes_section, Target::attribute_arg_type,
5484         Target::attributes_order): New method definitions.
5485         (Target::Target_info::attributes_section,
5486         Target::Target_info::attributes_vendor): New fields.
5487         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5488         virtual method definitions.
5489         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5490         attributes_section and attributes_vendor.
5491         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5492
5493 2009-12-05  Doug Kwan  <dougkwan@google.com>
5494
5495         * arm.cc: Update comments about interworking and stub generation.
5496         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5497         considered as non-PIC.
5498         (Arm_relocate_functions::base_abs): Fix formatting.
5499         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5500         of function to use GOT entry address instead of offset.
5501         (Target_arm::Scan::global): Issue an error if a symbol would need a
5502         PLT does not get one because it is untyped.  Remove code to create
5503         dynamic symbols for relative branches.
5504         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5505         takes unsigned integer instead of boolean.
5506
5507 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5508
5509         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5510         (two_file_test_LDADD): Likewise.
5511         (common_test_1_LDADD): Likewise.
5512         (exception_test_LDADD) Likewise.
5513         (weak_test_LDADD): Likewise.
5514         (many_sections_test_LDADD): Likewise.
5515         (initpri1_LDADD): Likewise.
5516         (script_test_1_LDADD): Likewise.
5517         (script_test_2_LDADD): Likewise.
5518         (justsyms_LDADD): Likewise.
5519         (binary_test_LDADD): Likewise.
5520         (large_LDADD): Likewise.
5521         * testsuite/Makefile.in: Regenerated.
5522
5523 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5524
5525         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5526         (Symbol_table::override_with_special): Likewise.
5527         (Symbol_table::add_from_object): Likewise.
5528
5529 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5530
5531         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5532         Don't set the data_offset twice.
5533
5534 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5535
5536         * testsuite/Makefile.in: Regenerate.
5537
5538 2009-12-03  Doug Kwan  <dougkwan@google.com>
5539
5540         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5541         (Target_arm::do_finalize_sections): Add parameter for symbol table
5542         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5543         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5544         parameter for symbol table pointer.
5545         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5546         an additional parameter for a pointer to symbol table.
5547         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5548         parameter for a symbol table pointer.
5549         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5550         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5551         Ditto.
5552         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5553         parameter for a symbol table pointer.
5554
5555 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5556
5557         * incremental.cc (Incremental_inputs_header)
5558         (Incremental_inputs_header_write, Incremental_inputs_entry)
5559         (Incremental_inputs_entry_write): Move ...
5560         * incremental.h (Incremental_inputs_header)
5561         (Incremental_inputs_header_write, Incremental_inputs_entry)
5562         (Incremental_inputs_entry_write): here.
5563
5564 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5565
5566         * incremental.cc (make_sized_incremental_binary): Set the target.
5567         Error if it is incompatible.
5568         * output.h (Output_file): Add filename method.
5569
5570 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5571
5572         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5573         from the get_* methods.
5574
5575 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5576
5577         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5578         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5579         Write 0 for the data_offset of scripts.
5580
5581 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5582
5583         * testsuite/Makefile.am: Add the incremental_test.sh test.
5584         * testsuite/incremental_test.sh: New.
5585         * testsuite/incremental_test_1.c: New.
5586         * testsuite/incremental_test_2.c: New.
5587
5588 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5589
5590        * incremental-dump.cc (main): Fix typos.
5591
5592 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5593
5594         PR gold/11025
5595         * incremental-dump.cc (main): Use llu to print 64 bit values.
5596
5597 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5598             H.J. Lu  <hongjiu.lu@intel.com>
5599
5600         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5601         $(LIBDL).
5602         (incremental_dump_LDADD): Likewise.
5603         * Makefile.in: Regenerated.
5604
5605 2009-11-25  Doug Kwan  <dougkwan@google.com>
5606
5607         Revert:
5608
5609         2009-11-25  Doug Kwan  <dougkwan@google.com>
5610
5611                 * arm.cc (Target_arm::Target_arm): Move method definition
5612                 outside of class definition.  Add code to handle
5613                 --target1-rel, --target1-abs and --target2= options.
5614                 (Target_arm::get_reloc_reloc_type): Change method to be
5615                 non-static and const.
5616                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5617                 New data member declaration.
5618                 (Target_arm::Scan::local, Target_arm::Scan::global,
5619                 Target_arm::Relocate::relocate,
5620                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5621                 Adjust call to Target_arm::get_real_reloc_type.
5622                 (Target_arm::get_real_reloc_type): Use command line options
5623                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5624                 * options.h (--target1-rel, --target1-abs, --target2): New
5625                 ARM-only options.
5626
5627 2009-11-25  Doug Kwan  <dougkwan@google.com>
5628
5629         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5630         class definition.  Add code to handle --target1-rel, --target1-abs
5631         and --target2= options.
5632         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5633         and const.
5634         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5635         member declaration.
5636         (Target_arm::Scan::local, Target_arm::Scan::global,
5637         Target_arm::Relocate::relocate,
5638         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5639         call to Target_arm::get_real_reloc_type.
5640         (Target_arm::get_real_reloc_type): Use command line options to
5641         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5642         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5643         options.
5644
5645 2009-11-25  Doug Kwan  <dougkwan@google.com>
5646
5647         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5648         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5649         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5650         formatting.
5651         (Arm_relocate_functions::thm_call): Replace body with a call to
5652         Arm_relocate_functions::thumb_branch_common.
5653         (Arm_relocate_functions::thm_jump24,
5654         Arm_relocate_functions::thm_xpc22): New method definitions.
5655         (Arm_relocate_functions::thumb_branch_common): New method definition.
5656         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5657         operator.
5658         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5659         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5660
5661 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5662
5663         * Makefile.am: Build incremental-dump
5664         * Makefile.in: Regenerate.
5665         * incremental-dump.cc: New.
5666         * incremental.cc (Incremental_inputs_header_data,
5667         Incremental_inputs_entry_data): Move to incremental.h
5668         * incremental.h: (Incremental_inputs_header_data,
5669         Incremental_inputs_entry_data): Move from incremental.cc
5670
5671 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5672
5673         * incremental.cc (Incremental_inputs_header,
5674         Incremental_inputs_header_write, Incremental_inputs_entry,
5675         Incremental_inputs_entry_write): Add a typedef with the data type.
5676
5677 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5678
5679         * incremental.cc (Incremental_inputs_header,
5680         Incremental_inputs_header_write, Incremental_inputs_entry,
5681         Incremental_inputs_entry_write): Update comment about which
5682         type has the filed descriptions.
5683
5684 2009-11-15  Doug Kwan  <dougkwan@google.com>
5685
5686         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5687         (Arm_relocate_functions::arm_branch_common): Change method defintion
5688         in class definition to a method declaration and update list of formal
5689         parameters.
5690         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5691         Arm_relocation_functions::jump24): Adjust call to
5692         Arm_relocate_functions::arm_branch_common.  Update list of formal
5693         parameters.
5694         (Arm_relocate_functions::xpc25): New method definition.
5695         (Arm_relocate_functions::arm_branch_common): Move method defintion
5696         out from class definition.  Use stubs for mode-switching and extending
5697         branch ranges.
5698         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5699         specially.  Change code to enable use of stubs in ARM branches.
5700
5701 2009-11-10  Doug Kwan  <dougkwan@google.com>
5702
5703         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5704         in method declaration.
5705         (Target_arm::relocate_stub): New method declaration.
5706         (Target_arm::default_target): Change to return a pointer instead of
5707         a const reference.
5708         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5709         Target_arm::default_target.
5710         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5711         method definition.
5712         (Target_arm::relocate_section): Adjust view.
5713         (Target_arm::relocate_stub): New method definition.
5714
5715 2009-11-10  Doug Kwan  <dougkwan@google.com>
5716
5717         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5718         a format warning.
5719         * incremental.cc (open_incremental_binary): Initialized local
5720         variables to avoid warnings.
5721         * object.cc (make_elf_object): Ditto.
5722         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5723         a format warning.
5724
5725 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5726
5727         PR gold/10930
5728         * testsuite/plugin_test.c: Include "config.h".
5729
5730 2009-11-09  Doug Kwan  <dougkwan@google.com>
5731
5732         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5733         (arm_symbol_value): Remove.
5734         (Arm_relocate_functions::arm_branch_common,
5735         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5736         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5737         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5738         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5739         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5740         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5741         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5742         Arm_relocate_functions::thm_mobw_abs_nc,
5743         Arm_relocate_functions::thm_mov_abs,
5744         Arm_relocate_functions::movw_prel_nc,
5745         Arm_relocate_functions::thm_movt_abs,
5746         Arm_relocate_functions::movt_prel,
5747         Arm_relocate_functions::thm_movw_prel_nc,
5748         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5749         (Target_arm::Relocate::relocate): Only decompose address into two
5750         parts if relocation type uses the thumb-bit and pass the actual
5751         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5752         calls to methods in Arm_relocate_functions for this change.
5753
5754 2009-11-08  Ian Lance Taylor  <iant@google.com>
5755
5756         PR 10925
5757         * reloc.cc: Instantiate
5758         Sized_relobj::initialize_input_to_output_maps and
5759         Sized_relobj:free_input_to_output_maps.
5760
5761 2009-11-06  Ian Lance Taylor  <iant@google.com>
5762
5763         PR 10876
5764         * defstd.cc (in_segment): Set only_if_ref true for "end".
5765
5766 2009-11-06  Doug Kwan  <dougkwan@google.com>
5767
5768         * arm.cc (class Reloc_stub): Correct a comment.
5769         (Target_arm::Target_arm): Initialize arm_input_section_map_.
5770         (Target_arm::scan_section_for_stubs): New method declaration.
5771         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5772         Change methods from private to protected.
5773         (Target_arm::do_may_relax): New method definition.
5774         (Target_arm::do_relax, Target_arm::group_sections,
5775         Target_arm::scan_reloc_for_stub,
5776         Target_arm::scan_reloc_section_for_stubs): New method declarations.
5777         (Target_arm::arm_input_section_map_): New data member declaration.
5778         (Target_arm::scan_reloc_for_stub,
5779         Target_arm::scan_reloc_section_for_stubs,
5780         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5781         Target_arm::do_relax): New method definitions.
5782
5783 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
5784
5785         * configure.ac: Check for (struct stat)::st_mtim
5786         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5787         * config.in: Regenerate.
5788         * configure: Regenerate.
5789
5790 2009-11-05  Ian Lance Taylor  <iant@google.com>
5791
5792         PR 10910
5793         * output.cc (Output_segment::add_output_section): Add missing
5794         return statement.
5795
5796 2009-11-04  Ian Lance Taylor  <iant@google.com>
5797
5798         PR 10880
5799         * object.h (class Object): Add is_needed and set_is_needed
5800         methods.  Add is_needed_ field.  Make bool fields into bitfields.
5801         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5802         defined in a dynamic object and referenced by a regular object,
5803         set is_needed for the dynamic object.
5804         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5805         if the file is marked with as_needed and it is not needed.
5806
5807 2009-11-04  Ian Lance Taylor  <iant@google.com>
5808
5809         PR 10887
5810         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5811         tags if data is discarded by linker script.
5812         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5813         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5814         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5815         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5816
5817 2009-11-04  Ian Lance Taylor  <iant@google.com>
5818
5819         * layout.cc (Layout::get_output_section): Add is_interp and
5820         is_dynamic_linker_section parameters.  Change all callers.
5821         (Layout::choose_output_section): Likewise.
5822         (Layout::make_output_section): Likewise.
5823         (Layout::add_output_section_data): Add is_dynamic_linker_section
5824         parameter.  Change all callers.
5825         * layout.h (class Layout): Update declarations.
5826         * output.h (class Output_section): Add is_interp, set_is_interp,
5827         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5828         Add is_interp_, is_dynamic_linker_section_ fields.  Change
5829         generate_code_fills_at_write_ to a bitfield.
5830         * output.cc (Output_section::Output_sections): Initialize new
5831         fields.
5832         (Output_segment::add_output_section): Add do_sort parameter.
5833         Change all callers.
5834
5835 2009-11-03  Ian Lance Taylor  <iant@google.com>
5836
5837         PR 10860
5838         * options.h (class General_options): Add --warn-common.
5839         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5840         merging two common symbols.
5841         (Symbol_table::should_override): Handle --warn-common when merging
5842         a common symbol with a defined symbol.  Use report_resolve_problem
5843         for multiple definitions.
5844         (Symbol_table::report_resolve_problem): New function.
5845         * symtab.h (class Symbol_table): Declare report_resolve_problem.
5846
5847 2009-11-03  Doug Kwan  <dougkwan@google.com>
5848
5849         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5850         stub_factory_.
5851         (Target_arm::stub_factory): New method definition.
5852         (Target_arm::new_arm_input_section,
5853         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5854         Target_arm::reloc_uses_thumb_bit): New method declarations.
5855         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5856         New type definitions.
5857         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5858         member declarations.
5859         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5860         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5861         New method definitions.
5862
5863 2009-11-03  Ian Lance Taylor  <iant@google.com>
5864
5865         * options.h (class General_options): Add --warn_constructors.
5866
5867 2009-11-03  Ian Lance Taylor  <iant@google.com>
5868
5869         PR 10893
5870         * defstd.cc (in_section): Add entries for __rel_iplt_start,
5871         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5872
5873 2009-11-03  Ian Lance Taylor  <iant@google.com>
5874
5875         PR 10895
5876         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5877         --msgid-bugs-address.
5878         (install-pdf): New target.
5879         (install-data_yes): Look up one directory to find mkinstalldirs.
5880
5881 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
5882
5883         * po/Make-in (.po.gmo): Don't generate .gmo files in source
5884         tree.
5885
5886 2009-10-30  Doug Kwan  <dougkwan@google.com>
5887
5888         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5889
5890 2009-10-30  Doug Kwan  <dougkwan@google.com>
5891
5892         * arm.cc (Stub_addend_reader): New struct template definition
5893         and partial specializations.
5894         (Stub_addend_reader::operator()): New method definition for a
5895         partially specialized template.
5896
5897 2009-10-30  Doug Kwan  <dougkwan@google.com>
5898
5899         * arm.cc (Arm_relobj::processor_specific_flags): New method
5900         definition.
5901         (Arm_relobj::do_read_symbols): New method declaration.
5902         (Arm_relobj::processor_specific_flags_): New data member declaration.
5903         (Arm_dynobj): New class definition.
5904         (Target_arm::do_finalize_sections): Add input_objects parameter.
5905         (Target_arm::do_adjust_elf_header): New method declaration.
5906         (Target_arm::are_eabi_versions_compatible,
5907         (Target_arm::merge_processor_specific_flags): New method declaration.
5908         (Target_arm::do_make_elf_object): New overloaded method definitions
5909         and declaration.
5910         (Arm_relobj::do_read_symbols): New method definition.
5911         (Arm_dynobj::do_read_symbols): Ditto.
5912         (Target_arm::do_finalize_sections): Add input_objects parameters.
5913         Merge processor-specific flags from all input objects.
5914         (Target_arm::are_eabi_versions_compatible,
5915         Target_arm::merge_processor_specific_flags,
5916         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5917         New method definitions.
5918         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5919         Input_objects pointer type parameter.
5920         * layout.cc (Layout::finalize): Pass input objects to target's.
5921         finalize_sections function.
5922         * output.cc (Output_file_header::do_sized_write): Set ELF file
5923         header's processor-specific flags.
5924         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5925         Input_objects pointer type parameter.
5926         * sparc.cc (Target_sparc::do_finalize_sections): Same.
5927         * target.h (Input_objects): New forward class declaration.
5928         (Target::processor_specific_flags,
5929         Target::are_processor_specific_flags_sect): New method definitions.
5930         (Target::finalize_sections): Add input_objects parameter.
5931         (Target::Target): Initialize processor_specific_flags_ and
5932         are_processor_specific_flags_set_.
5933         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5934         parameter.
5935         (Target::set_processor_specific_flags): New method definition.
5936         (Target::processor_specific_flags_,
5937         Target::are_processor_specific_flags_set_): New data member
5938         declarations.
5939         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5940         Input_objects pointer type parameter.
5941
5942 2009-10-30  Doug Kwan  <dougkwan@google.com>
5943
5944         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5945
5946 2009-10-28  Ian Lance Taylor  <iant@google.com>
5947
5948         * object.h (class Relobj): Drop options parameter from
5949         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5950         do_scan_relocs, do_relocate.  Change all callers.
5951         (class Sized_relobj): Drop options parameters from
5952         do_gc_process_relocs, do_scan_relocs, do_relocate,
5953         do_relocate_sections, relocate_sections, emit_relocs_scan,
5954         emit_relocs_scan_reltype.  Change all callers.
5955         (struct Relocate_info): Remove options field and all references to
5956         it.
5957         * reloc.h (class Read_relocs): Remove options constructor
5958         parameter and options_ field.  Change all callers.
5959         (class Gc_process_relocs, class Scan_relocs): Likewise.
5960         (class Relocate_task): Likewise.
5961         * target-reloc.h (scan_relocs): Remove options parameter.  Change
5962         all callers.
5963         (scan_relocatable_relocs): Likewise.
5964         * target.h (class Sized_target): Remove options parameter from
5965         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
5966         all callers.
5967         * gc.h (gc_process_relocs): Remove options parameter.  Change all
5968         callers.
5969         * arm.cc: Update functions to remove options parameters.
5970         * i386.cc: Likewise.
5971         * powerpc.cc: Likewise.
5972         * sparc.cc: Likewise.
5973         * x86_64.cc: Likewise.
5974         * testsuite/testfile.cc: Likewise.
5975
5976 2009-10-28  Doug Kwan  <dougkwan@google.com>
5977
5978         * arm.cc (Arm_relobj): New class definition.
5979         (Arm_relobj::scan_sections_for_stubs,
5980         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5981         New method definitions.
5982
5983 2009-10-28  Cary Coutant  <ccoutant@google.com>
5984
5985         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5986         (Plugin::cleanup_done_): New member.
5987         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5988         (Plugin_manager::cleanup_done_): Remove.
5989         (Plugin_manager::add_input_file): Edit error message.
5990         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5991         (Plugin_manager::cleanup): Remove use of cleanup_done_.
5992
5993 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
5994
5995         * fileread.cc: (File_read::View::~View): Use the new
5996         data_ownership_ filed.
5997         (File_read::~File_read): Dispose the new whole_file_view_.
5998         (File_read::open): Mmap the whole file if needed.
5999         (File_read::open): Use whole_file_view_ instead of contents_.
6000         (File_read::find_view): Use whole_file_view_ if applicable.
6001         (File_read::do_read): Use whole_file_view_ instead of contents_.
6002         (File_read::make_view): Use whole_file_view_ instead of contents_,
6003         update File_read::View::View call.
6004         (File_read::find_or_make_view): Update File_read::View::View
6005         call.
6006         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6007         remove contents_
6008         (File_read::View::Data_ownership): New enum.
6009         (File_read::View::View): Replace bool mapped_ with Data_ownership
6010         argument.
6011         (File_read::View::mapped_): Remove (replaced by data_ownership_).
6012         (File_read::View::data_ownership_): New field.
6013         (File_read::contents_): Remove (replaced by whole_file_view_).
6014         (File_read::whole_file_view_): New field.
6015         * options.h (class General_options): Add --keep-files-mapped.
6016
6017 2009-10-27  Cary Coutant  <ccoutant@google.com>
6018
6019         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6020         * testsuite/Makefile.am (plugin_test_5): New test case.
6021         * testsuite/Makefile.in: Regenerate.
6022
6023 2009-10-25  Doug Kwan  <dougkwan@google.com>
6024
6025         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6026         from private to protected to allow access by child class.
6027         (Sized_relobj::do_relocate_sections): New method declaration.
6028         (Sized_relobj::relocate_sections): Virtualize.
6029         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6030         Sized_relobj::relocate_sections.  Instantiate template explicitly
6031         for different target sizes and endianity.
6032
6033 2009-10-24  Doug Kwan  <dougkwan@google.com>
6034
6035         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6036         (Arm_input_section::as_arm_input_section): New method.
6037         (Arm_output_section): New class definition.
6038         (Arm_output_section::create_stub_group,
6039         Arm_output_section::group_sections): New method definitions.
6040
6041 2009-10-22  Doug Kwan  <dougkwan@google.com>
6042
6043         * arm.cc (Arm_input_section): New class definition.
6044         (Arm_input_section::init, Arm_input_section:do_write,
6045         Arm_input_section::set_final_data_size,
6046         Arm_input_section::do_reset_address_and_file_offset): New method
6047         definitions.
6048
6049 2009-10-21  Doug Kwan  <dougkwan@google.com>
6050
6051         * arm.cc (Stub_table, Arm_input_section): New forward class
6052         declarations.
6053         (Stub_table): New class defintion.
6054         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6055         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6056         New method definition.
6057
6058 2009-10-21  Doug Kwan  <dougkwan@google.com>
6059
6060         * arm.cc: Update copyright comments.
6061         (Target_arm): New forward class template declaration.
6062         (Arm_address): New type.
6063         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6064         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6065         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6066         constants.
6067         (Insn_template): Same.
6068         (DEF_STUBS): New macro.
6069         (Stub_type): New enum type.
6070         (Stub_template): New class definition.
6071         (Stub): Same.
6072         (Reloc_stub): Same.
6073         (Stub_factory): Same.
6074         (Target_arm::Target_arm): Initialize may_use_blx_ and
6075         should_force_pic_veneer_.
6076         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6077         Target_arm::should_force_pic_veneer,
6078         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6079         Target_arm::using_thumb_only, Target_arm:;default_target): New
6080         method defintions.
6081         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6082         New data member declarations.
6083         (Insn_template::size, Insn_template::alignment): New method defintions.
6084         (Stub_template::Stub_template): New method definition.
6085         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6086         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6087         (Stub_factory::Stub_factory): New method definition.
6088         * gold.h (string_hash): New template.
6089         * output.h (Input_section_specifier::hash_value): Use
6090         gold::string_hash.
6091         (Input_section_specifier::string_hash): Remove.
6092         * stringpool.cc (Stringpool_template::string_hash): Use
6093         gold::string_hash.
6094
6095 2009-10-20  Doug Kwan  <dougkwan@google.com>
6096
6097         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6098         symbols of relaxed input sections.
6099         * output.h (Output_section::find_relaxed_input_section): Make
6100         method public.
6101
6102 2009-10-16  Doug Kwan  <dougkwan@google.com>
6103
6104         * dynobj.cc (Versions::Versions): Initialize version_script_.
6105         Only insert base version symbol definition for a shared object
6106         if version script defines any version versions.
6107         (Versions::define_base_version): New method definition.
6108         (Versions::add_def): Check that base version is not needed.
6109         (Versions::add_need): Define base version lazily.
6110         * dynobj.h (Versions::define_base_version): New method declaration.
6111         (Versions::needs_base_version_): New data member declaration.
6112         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6113         (check_DATA): Add no_version_test.stdout.
6114         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6115         New make rules.
6116         * testsuite/Makefile.in: Regenerate.
6117         * testsuite/no_version_test.c: New file.
6118         * testsuite/no_version_test.sh: Ditto.
6119
6120 2009-10-16  Doug Kwan  <dougkwan@google.com>
6121
6122         * expression.cc (class Segment_start_expression): New class definition.
6123         (Segment_start_expression::value): New method definition.
6124         (script_exp_function_segment_start): Return a new
6125         Segment_start_expression.
6126         * gold/script-c.h (script_saw_segment_start_expression): New function
6127         prototype.
6128         * script-sections.cc (Script_sections::Script_sections): Initialize
6129         SAW_SEGMENT_START_EXPRESSION_ to false.
6130         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6131         and -Tbbs options to specify section addresses if given in
6132         command line and no SEGMENT_START expression is seen in a script.
6133         * script-sections.h (Script_sections::saw_segment_start_expression,
6134         Script_sections::set_saw_segment_start_expression): New method
6135         definition.
6136         (Script_sections::saw_segment_start_expression_): New data member
6137         declaration.
6138         * script.cc (script_saw_segment_start_expression): New function.
6139         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6140         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6141         script_test_7.sh and script_test_8.sh.
6142         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6143         script_test_8.stdout.
6144         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6145         (script_test_6, script_test_6.stdout, script_test_7,
6146         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6147         * Makefile.in: Regenerate.
6148         * testsuite/script_test_6.sh: New file.
6149         * testsuite/script_test_6.t: Same.
6150         * testsuite/script_test_7.sh: Same.
6151         * testsuite/script_test_7.t: Same.
6152         * testsuite/script_test_8.sh: Same.
6153
6154 2009-10-16  Doug Kwan  <dougkwan@google.com>
6155
6156         * output.cc (Output_segment::set_section_list_address): Cast
6157         expressions to unsigned long long type to avoid format warnings.
6158
6159 2009-10-15  Ian Lance Taylor  <iant@google.com>
6160
6161         * script.cc (Script_options::add_symbol_assignment): Always add a
6162         dot assignment to script_sections_.
6163         * script-sections.cc (Script_sections::add_dot_assignment):
6164         Initialize if necessary.
6165
6166         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6167         program headers with no load segment if there is a linker script.
6168
6169         * layout.cc (Layout::set_segment_offsets): Align the file offset
6170         to the segment aligment for -N or -n with no load segment.
6171         * output.cc (Output_segment::add_output_section): Don't crash if
6172         the first section is a TLS section.
6173         (Output_segment::set_section_list_addresses): Print an error
6174         message if the address moves backward in a linker script.
6175         * script-sections.cc
6176         (Output_section_element_input::set_section_addresses): Don't
6177         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6178         (Orphan_output_section::set_section_addresses): Likewise.
6179
6180 2009-10-15  Doug Kwan  <dougkwan@google.com>
6181
6182         * layout.cc (Layout::finish_dynamic_section): Generate tags
6183         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6184         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6185         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6186
6187 2009-10-14  Ian Lance Taylor  <iant@google.com>
6188
6189         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6190         fields.
6191         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6192         data_shdr fields of relinfo.
6193         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6194         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6195         R_386_TLS_LDO_32, adjust based on section flags.
6196         (Target_i386::Relocate::fix_up_ldo): Remove.
6197
6198 2009-10-13  Ian Lance Taylor  <iant@google.com>
6199
6200         Add support for -pie.
6201         * options.h (class General_options): Add -pie and
6202         --pic-executable.
6203         (General_options::output_is_position_independent): Test -pie.
6204         (General_options::output_is_executable): Return true if not shared
6205         and not relocatable.
6206         (General_options::output_is_pie): Remove.
6207         * options.cc (General_options::finalize): Reject incompatible uses
6208         of -pie.
6209         * gold.cc (queue_middle_tasks): A -pie link is not static.
6210         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6211         * symtab.cc (Symbol::final_value_is_known): Return false if
6212         output_is_position_independent.
6213         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6214         output_is_position_independent.
6215         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6216         output_is_position_independent.
6217         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6218         output_is_position_independent.
6219         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6220         two_file_pie_test.
6221         (basic_pie_test.o, basic_pie_test): New targets.
6222         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6223         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6224         (two_file_pie_test): New target.
6225         * testsuite/Makefile.in: Rebuild.
6226         * README: Remove note saying that -pie is not supported.
6227
6228 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6229
6230         * options.h (class General_options): Add -init and -fini.
6231         * layout.cc (Layout::finish_dynamic_section): Emit
6232         given init and fini functions.
6233
6234 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6235
6236         * gc.h (gc_process_relocs): Check if icf is enabled using new
6237         function.
6238         * gold.cc (queue_initial_tasks): Likewise.
6239         (queue_middle_tasks): Likewise.
6240         * object.cc (do_layout): Likewise.
6241         * symtab.cc (is_section_folded): Likewise.
6242         * main.cc (main): Likewise.
6243         * reloc.cc (Read_relocs::run): Likewise.
6244         (Sized_relobj::do_scan_relocs): Likewise.
6245         * icf.cc (is_function_ctor_or_dtor): New function.
6246         (Icf::find_identical_sections): Check if function is ctor or dtor when
6247         safe icf is chosen.
6248         * options.h (General_options::icf): Change option to be an enum.
6249         (Icf_status): New enum.
6250         (icf_enabled): New method.
6251         (icf_safe_folding): New method.
6252         (set_icf_status): New method.
6253         (icf_status_): New variable.
6254         * (options.cc) (General_options::finalize): Set icf_status_.
6255         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6256         icf_test and icf_keep_unique_test to use the --icf enum flag.
6257         * testsuite/icf_safe_test.sh: New file.
6258         * testsuite/icf_safe_test.cc: New file.
6259
6260 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6261
6262         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6263         includes to gc.h and icf.h.
6264         * arm.cc: Include gc.h.
6265         * gold.cc: Likewise.
6266         * i386.cc: Likewise.
6267         * powerpc.cc: Likewise.
6268         * sparc.cc: Likewise.
6269         * x86_64.cc: Likewise.
6270         * gc.h: Include icf.h.
6271
6272 2009-10-11  Ian Lance Taylor  <iant@google.com>
6273
6274         * plugin.cc: Include "gold.h" before other header files.
6275
6276 2009-10-10  Chris Demetriou  <cgd@google.com>
6277
6278         * options.h (Input_file_argument::Input_file_type): New enum.
6279         (Input_file_argument::is_lib_): Replace with...
6280         (Input_file_argument::type_): New member.
6281         (Input_file_argument::Input_file_argument): Take Input_file_type
6282         'type' rather than boolean 'is_lib' as second argument.
6283         (Input_file_argument::is_lib): Use type_.
6284         (Input_file_argument::is_searched_file): New function.
6285         (Input_file_argument::may_need_search): Handle is_searched_file.
6286         * options.cc (General_options::parse_library): Support -l:filename.
6287         (General_options::parse_just_symbols): Update for Input_file_argument
6288         changes.
6289         (Command_line::process): Likewise.
6290         * archive.cc (Archive::get_file_and_offset): Likewise.
6291         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6292         * script.cc (read_script_file, script_add_file): Likewise.
6293         * fileread.cc (Input_file::Input_file): Likewise.
6294         (Input_file::will_search_for): Handle is_searched_file.
6295         (Input_file::open): Likewise.
6296         * readsyms.cc (Read_symbols::get_name): Likewise.
6297         * testsuite/Makefile.am (searched_file_test): New test.
6298         * testsuite/Makefile.in: Regenerate.
6299         * testsuite/searched_file_test.cc: New file.
6300         * testsuite/searched_file_test_lib.cc: New file.
6301
6302 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6303             Ian Lance Taylor  <iant@google.com>
6304
6305         * descriptor.cc: Include <cstdio> and "binary-io.h".
6306         (Descriptors::open): Open the files in binary mode always.
6307         * script.cc (Lex::get_token): Treat \r as whitespace.
6308
6309 2009-10-09  Ian Lance Taylor  <iant@google.com>
6310
6311         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6312
6313 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6314             Ian Lance Taylor  <iant@google.com>
6315
6316         * configure.ac: Check for readv function also.
6317         * fileread.cc (readv): Define if not HAVE_READV.
6318         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6319         does not exist.
6320         * config.in: Regenerate.
6321         * configure: Regenerate.
6322
6323 2009-10-09  Doug Kwan  <dougkwan@google.com>
6324
6325         * layout.cc (Layout::make_output_section): Call target hook to make
6326         ordinary output section.
6327         (Layout::finalize): Adjust parameter list of call the
6328         Target::may_relax().
6329         * layout.h (class Layout::section_list): New method.
6330         * merge.h (Output_merge_base::entsize): Change visibility to public.
6331         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6332         New methods.
6333         (Output_merge_string::do_is_string): New method.
6334         * object.cc (Sized_relobj::do_setup): renamed from
6335         Sized_relobj::set_up.
6336         * object.h (Sized_relobj::adjust_shndx,
6337         Sized_relobj::initializ_input_to_output_maps,
6338         Sized_relobj::free_input_to_output_maps): Change visibilities to
6339         protected.
6340         (Sized_relobj::setup): Virtualize.
6341         (Sized_relobj::do_setup): New method declaration.
6342         (Sized_relobj::invalidate_section_offset,
6343         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6344         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6345         * options.cc (parse_int): New function.
6346         * options.h (parse_int): New declaration.
6347         (DEFINE_int): New macro.
6348         (stub_group_size): New option.
6349         * output.cc (Output_section::Output_section): Initialize memebers
6350         merge_section_map_, merge_section_by_properties_map_,
6351         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6352         (Output_section::add_input_section): Handled deferred code-fill
6353         generation and remove an old comment.
6354         (Output_section::add_relaxed_input_section): New method definition.
6355         (Output_section::add_merge_input_section): Use merge section by
6356         properties map to speed to search.  Update merge section maps
6357         as appropriate.
6358         (Output_section::build_relaxation_map): New method definition.
6359         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6360         Same.
6361         (Output_section::relax_input_section): Renamed to
6362         Output_section::convert_input_sections_to_relaxed_sections and change
6363         interface to take a vector of pointers to relaxed sections.
6364         (Output_section::find_merge_section,
6365         Output_section::find_relaxed_input_section): New method definitions.
6366         (Output_section::is_input_address_mapped,
6367         Output_section::output_offset, Output_section::output_address):
6368         Use output section data maps to speed up searching.
6369         (Output_section::find_starting_output_address): Add comments.
6370         (Output_section::do_write,
6371         Output_section::write_to_postprocessing_buffer): Do code-fill
6372         generation as appropriate.
6373         (Output_section::get_input_sections): Invalidate relaxed input section
6374         map.
6375         (Output_section::restore_states): Adjust type of checkpoint .
6376         Invalidate relaxed input section map.
6377         * output.h (Output_merge_base): New class declaration.
6378         (Input_section_specifier): New class defintion.
6379         (class Output_relaxed_input_section) Change base class to
6380         Output_section_data_build.
6381         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6382         base class initializer.
6383         (Output_section::add_relaxed_input_section): New method declaration.
6384         (Output_section::Input_section): Change visibility to protected.
6385         (Output_section::Input_section::relobj,
6386         Output_section::Input_section::shndx): Handle relaxed input sections.
6387         Output_section::input_sections) Change visibility to protected.  Also
6388         define overload to return a non-const pointer.
6389         (Output_section::Merge_section_properties): New class defintion.
6390         (Output_section::Merge_section_by_properties_map,
6391         Output_section::Output_section_data_by_input_section_map,
6392         Output_section::Relaxation_map): New types.
6393         (Output_section::relax_input_section): Rename method to
6394         Output_section::convert_input_sections_to_relaxed_sections and change
6395         interface to take a vector of relaxed section pointers.
6396         (Output_section::find_merge_section,
6397         Output_section::find_relaxed_input_section,
6398         Output_section::build_relaxation_map,
6399         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6400         New method declarations.
6401         (Output_section::merge_section_map_
6402         Output_section::merge_section_by_properties_map_,
6403         Output_section::relaxed_input_section_map_,
6404         Output_section::is_relaxed_input_section_map_valid_,
6405         Output_section::generate_code_fills_at_write_): New data members.
6406         * script-sections.cc
6407         (Output_section_element_input::set_section_addresses): Call
6408         current_data_size and addralign methods of relaxed input sections.
6409         (Orphan_output_section::set_section_addresses): Call current_data_size
6410         and addralign methods of relaxed input sections.
6411         * symtab.cc (Symbol_table::compute_final_value): Extract template
6412         from the body of Symbol_table::sized_finalize_symbol.
6413         (Symbol_table::sized_finalized_symbol): Call
6414         Symbol_table::compute_final_value.
6415         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6416         (Symbol_table::compute_final_value): New templated method declaration.
6417         * target.cc (Target::do_make_output_section): New method defintion.
6418         * target.h (Target::make_output_section): New method declaration.
6419         (Target::relax): Add more parameters for input objects, symbol table
6420         and layout.  Adjust call to do_relax.
6421         (Target::do_make_output_section): New method declaration.
6422         (Target::do_relax): Add parameters for input objects, symbol table
6423         and layout.
6424
6425 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6426
6427         * pread.c: Include stdio.h.
6428
6429 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6430
6431         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6432         defined.
6433
6434 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6435
6436         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6437         Change read_shndx type to unsigned int.
6438         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6439         int.
6440         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6441         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6442         Change read_shndx type to unsigned int.
6443         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6444         int.
6445         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6446         * layout.cc (Layout::create_symtab_sections): Cast the result of
6447         local_symcount * symsize to off_t in the gold_assert.
6448
6449 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6450
6451         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6452         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6453         R_ARM_BASE_ABS.
6454         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6455         (Arm_relocate_functions::thm_abs5): New function.
6456         (Arm_relocate_functions::abs12): New function.
6457         (Arm_relocate_functions::abs16): New function.
6458         (Arm_relocate_functions::base_abs): New function.
6459         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6460         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6461         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6462         R_ARM_BASE_ABS.
6463         (Scan::global): Likewise.
6464         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6465         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6466         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6467         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6468         R_ARM_BASE_ABS.
6469
6470 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6471
6472         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6473         (Arm_relocate_functions::movt_prel): New function.
6474         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6475         (Arm_relocate_functions::thm_movt_prel): New function.
6476         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6477         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6478         (Scan::global, Relocate::relocate): Likewise.
6479         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6480
6481 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6482
6483         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6484         Incremental_checker.
6485         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6486         unsigned int.
6487         (class Incremental_inputs_header): New class.
6488         (Incremental_inputs_header_writer): Edit comment.
6489         (Incremental_inputs_entry): New class.
6490         (Incremental_inputs_entry_writer): Edit comment.
6491         (Sized_incremental_binary::do_find_incremental_inputs_section):
6492         Add *strtab_shndx parameter, fill it.
6493         (Sized_incremental_binary::do_check_inputs): New method.
6494         (Incremental_checker::can_incrementally_link_output_file): Use
6495         Sized_incremental_binary::check_inputs.
6496         (Incremental_inputs::report_command_line): Save command line in
6497         command_line_.
6498         * incremental.h:
6499         (Incremental_binary::find_incremental_inputs_section): New
6500         method.
6501         (Incremental_binary::do_find_incremental_inputs_section): Add
6502         strtab_shndx parameter.
6503         (Incremental_binary::do_check_inputs): New pure virtual method.
6504         (Sized_incremental_binary::do_check_inputs): Declare.
6505         (Incremental_checker::Incremental_checker): Add incremental_inputs
6506         parameter, use it to initialize incremental_inputs_.
6507         (Incremental_checker::incremental_inputs_): New field.
6508         (Incremental_checker::command_line): New method.
6509         (Incremental_checker::inputs): New method.
6510         (Incremental_checker::command_line_): New field.
6511
6512 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6513
6514         * incremental.cc: Include <cstdarg> and "target-select.h".
6515         (vexplain_no_incremental): New function.
6516         (explain_no_incremental): New function.
6517         (Incremental_binary::error): New method.
6518         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6519         method.
6520         (make_sized_incremental_binary): New function.
6521         (open_incremental_binary): New function.
6522         (can_incrementally_link_file): Add checks if output is ELF and has
6523         inputs section.
6524         * incremental.h: Include "elfcpp_file.h" and "output.h".
6525         (Incremental_binary): New class.
6526         (Sized_incremental_binary): New class.
6527         (open_incremental_binary): Declare.
6528         * object.cc (is_elf_object): Use
6529         elfcpp::Elf_recognizer::is_elf_file.
6530         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6531         * output.h (Output_file::filesize): New method.
6532
6533 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6534
6535         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6536         New function.
6537         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6538         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6539         function.
6540         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6541         function.
6542         (Arm_relocate_functions::movw_abs_nc): New function.
6543         (Arm_relocate_functions::movt_abs): New function.
6544         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6545         (Arm_relocate_functions::thm_movt_abs): New function.
6546         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6547         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6548         (Scan::global): Likewise.
6549         (Relocate::relocate): Likewise.
6550         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6551
6552 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6553
6554         * arm.cc (Arm_relocate_functions::got_prel) New function.
6555         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6556         (Relocate::relocate): Likewise.
6557         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6558
6559 2009-10-06  Ian Lance Taylor  <iant@google.com>
6560
6561         * options.h (class General_options): Define
6562         split_stack_adjust_size parameter.
6563         * object.h (class Object): Add uses_split_stack_ and
6564         has_no_split_stack_ fields.  Add uses_split_stack and
6565         has_no_split_stack accessor functions.  Declare
6566         handle_split_stack_section.
6567         (class Reloc_symbol_changes): Define.
6568         (class Sized_relobj): Define Function_offsets.  Declare
6569         split_stack_adjust, split_stack_adjust_reltype, and
6570         find_functions.
6571         * object.cc (Object::handle_split_stack_section): New function.
6572         (Sized_relobj::do_layout): Call handle_split_stack_section.
6573         * dynobj.cc (Sized_dynobj::do_layout): Call
6574         handle_split_stack_section.
6575         * reloc.cc (Sized_relobj::relocate_sections): Call
6576         split_stack_adjust for executable sections in split_stack
6577         objects.  Pass reloc_map to relocate_section.
6578         (Sized_relobj::split_stack_adjust): New function.
6579         (Sized_relobj::split_stack_adjust_reltype): New function.
6580         (Sized_relobj::find_functions): New function.
6581         * target-reloc.h: Include "object.h".
6582         (relocate_section): Add reloc_symbol_changes parameter.  Change
6583         all callers.
6584         * target.h (class Target): Add calls_non_split method.  Declare
6585         do_calls_non_split virtual method.  Declare match_view and
6586         set_view_to_nop.
6587         * target.cc: Include "elfcpp.h".
6588         (Target::do_calls_non_split): New function.
6589         (Target::match_view): New function.
6590         (Target::set_view_to_nop): New function.
6591         * gold.cc (queue_middle_tasks): Give an error if mixing
6592         split-stack and non-split-stack objects with -r.
6593         * i386.cc (Target_i386::relocate_section): Add
6594         reloc_symbol_changes parameter.
6595         (Target_i386::do_calls_non_split): New function.
6596         * x86_64.cc (Target_x86_64::relocate_section): Add
6597         reloc_symbol_changes parameter.
6598         (Target_x86_64::do_calls_non_split): New function.
6599         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6600         parameter.
6601         * powerpc.cc (Target_powerpc::relocate_section): Add
6602         reloc_symbol_changes parameter.
6603         * sparc.cc (Target_sparc::relocate_section): Add
6604         reloc_symbol_changes parameter.
6605         * configure.ac: Call AM_CONDITIONAL for the default target.
6606         * configure: Rebuild.
6607         * testsuite/Makefile.am (TEST_AS): New variable.
6608         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6609         (check_DATA): Add split_i386 and split_x86_64 files.
6610         (SPLIT_DEFSYMS): Define.
6611         (split_i386_[1234n].o): New targets.
6612         (split_i386_[124]): New targets.
6613         (split_i386_[1234r].stdout): New targets.
6614         (split_x86_64_[1234n].o): New targets.
6615         (split_x86_64_[124]): New targets.
6616         (split_x86_64_[1234r].stdout): New targets.
6617         (MOSTLYCLEANFILES): Add new executables.
6618         * testsuite/split_i386.sh: New file.
6619         * testsuite/split_x86_64.sh: New file.
6620         * testsuite/split_i386_1.s: New file.
6621         * testsuite/split_i386_2.s: New file.
6622         * testsuite/split_i386_3.s: New file.
6623         * testsuite/split_i386_4.s: New file.
6624         * testsuite/split_i386_n.s: New file.
6625         * testsuite/split_x86_64_1.s: New file.
6626         * testsuite/split_x86_64_2.s: New file.
6627         * testsuite/split_x86_64_3.s: New file.
6628         * testsuite/split_x86_64_4.s: New file.
6629         * testsuite/split_x86_64_n.s: New file.
6630         * testsuite/testfile.cc (Target_test): Update relocation_section
6631         function.
6632         * testsuite/Makefile.in: Rebuild.
6633
6634 2009-10-06  Ian Lance Taylor  <iant@google.com>
6635
6636         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6637         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6638         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6639         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6640         the address on ldo_addrs_.
6641         (Target_i386::Relocate::fix_up_ldo): New function.
6642
6643 2009-10-06   Rafael Espindola  <espindola@google.com>
6644
6645         * plugin.cc (add_input_library): New.
6646         (Plugin::load): Add add_input_library to tv.
6647         (Plugin_manager::add_input_file): Add the is_lib argument.
6648         (add_input_file): Update call to Plugin_manager::add_input_file.
6649         (add_input_library): New.
6650         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6651
6652 2009-09-30  Doug Kwan  <dougkwan@google.com>
6653
6654         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6655         symbol and call Symbol::may_need_copy_reloc to determine if
6656         a copy reloc is needed.
6657         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6658         nocopyreloc is given in command line.
6659         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6660         given in command line.
6661         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6662         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6663         of the removed Target_i386::may_need_copy_reloc.
6664         * options.h (copyreloc): New option with default value false.
6665         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6666         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6667         instead of the removed Target_powerpc::may_need_copy_reloc.
6668         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6669         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6670         instead of the removed Target_sparc::may_need_copy_reloc.
6671         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6672         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6673         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6674         instead of the removed Target_x86_64::may_need_copy_reloc.
6675
6676 2009-09-30  Ian Lance Taylor  <iant@google.com>
6677
6678         * object.h (class Object): Remove target_ field, and target,
6679         sized_target, and set_target methods.
6680         (Object::sized_target): Remove.
6681         (class Sized_relobj): Update declarations.  Remove sized_target.
6682         * object.cc (Sized_relobj::setup): Remove target parameter.
6683         Change all callers.
6684         (Input_objects::add_object): Don't do anything with the target.
6685         (make_elf_sized_object): Add punconfigured parameter.  Change all
6686         callers.  Set or test parameter target.
6687         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6688         Change all callers.
6689         * parameters.cc (Parameters::set_target): Change parameter type to
6690         be non-const.
6691         (Parameters::default_target): Remove.
6692         (set_parameters_target): Change parameter type to be non-const.
6693         (parameters_force_valid_target): New function.
6694         (parameters_clear_target): New function.
6695         * parameters.h (class Parameters): Update declarations.  Remove
6696         default_target method.  Add sized_target and clear_target
6697         methods.  Change target_ to be non-const.
6698         (set_parameters_target): Update declaration.
6699         (parameters_force_valid_target): Declare.
6700         (parameters_clear_target): Declare.
6701         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6702         as NULL if we aren't searching.
6703         (Add_symbols::run): Don't check for compatible target.
6704         * fileread.cc (Input_file::open_binary): Call
6705         parameters_force_valid_target.
6706         * gold.cc (queue_middle_tasks): Likewise.
6707         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6708         set_target on object.
6709         * dynobj.h (class Sized_dynobj): Update declarations.
6710         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6711         make_elf_object returns NULL.
6712         (Archive::include_member): Don't check whether object target is
6713         compatible.
6714         * output.cc (Output_section::add_input_section): Get target from
6715         parameters.
6716         (Output_section::relax_input_section): Likewise.
6717         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6718         parameters.
6719         (Sized_relobj::do_scan_relocs): Likewise.
6720         (Sized_relobj::relocate_sections): Likewise.
6721         * resolve.cc (Symbol_table::resolve): Likewise.
6722         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6723         parameter.  Change all callers.
6724         (Symbol_table::add_from_object): Get target from parameters.
6725         (Symbol_table::add_from_relobj): Don't check object target.
6726         (Symbol_table::add_from_dynobj): Likewise.
6727         (Symbol_table::define_special_symbol): Get target from
6728         parameters.
6729         * symtab.h (class Symbol_table): Update declaration.
6730         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6731         parameter.  Change all callers.  Clear parameter target.
6732         (Binary_test): Test target here.
6733         * testsuite/object_unittest.cc (gold_testsuite): Remove
6734         target_test_pointer parameter.  Change all callers.
6735         (Object_test): Test target here.
6736
6737 2009-09-26  Ian Lance Taylor  <iant@google.com>
6738
6739         * testsuite/initpri1.c: Don't try to use constructor priorities if
6740         compiling with gcc before 4.3.
6741
6742 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6743
6744         * testsuite/retain_symbols_file_test.sh (check_present): Change
6745         output file name to retain_symbols_file_test.stdout.
6746         (check_absent): Likewise.
6747
6748 2009-09-18  Craig Silverstein  <csilvers@google.com>
6749
6750         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6751         * options.cc: Include <cerrno> and <fstream>.
6752         (General_options::finalize): Parse -retain-symbols-file tag.
6753         * options.h: New flag.
6754         (General_options): New method should_retain_symbol, new
6755         variable symbols_to_retain.
6756         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6757         should_retain_symbol map.
6758         * testsuite/Makefile.am (retain_symbols_file_test): New test.
6759         * testsuite/Makefile.in: Regenerate.
6760         * testsuite/retain_symbols_file_test.sh: New file.
6761
6762 2009-09-18  Nick Clifton  <nickc@redhat.com>
6763
6764         * po/es.po: Updated Spanish translation.
6765
6766 2009-09-17  Doug Kwan  <dougkwan@google.com>
6767
6768         * debug.h (DEBUG_RELAXATION): New constant.
6769         (DEBUG_ALL): Add DEBUG_RELAXATION.
6770         (debug_string_to_enum): Add relaxation debug option.
6771         * layout.cc
6772         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6773         Layout::Relaxation_debug_check::read_sections,
6774         Layout::Relaxation_debug_check::read_sections): New method definitions.
6775         (Layout::Layout): Initialize data members
6776         record_output_section_data_from_scrips_,
6777         script_output_section_data_list_ and relaxation_debug_check_.
6778         (Layout::save_segments, Layout::restore_segments,
6779         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6780         Layout::relaxation_loop_body): New method definitions.
6781         (Layout::finalize): Support relaxation.  Move section layout code to
6782         Layout::relaxation_loop_body.
6783         (Layout::set_asection_address_from_script): Move code for orphan
6784         section placement out.
6785         (Layout::place_orphan_sections_in_script): New method definition.
6786         * layout.h (Output_segment_headers, Output_file_header):
6787         New forward class declarations.
6788         (Layout::~Layout): Define.
6789         (Layout::new_output_section_data_from_script): New method definition.
6790         (Layout::place_orphan_sections_in_script): New method declaration.
6791         (Layout::Segment_states): New type declaration.
6792         (Layout::save_segments, Layout::restore_segments,
6793         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6794         Layout::relaxation_loop_body): New method declarations.
6795         (Layout::Output_section_data_list): New type declaration.
6796         (Layout::Relaxation_debug_check): New class definition.
6797         (Layout::record_output_section_data_from_script_,
6798         Layout::script_output_section_data_list_, Layout::segment_states_,
6799         Layout::relaxation_debug_check_): New data members.
6800         * output.cc: (Output_section_headers::do_size): New method definition.
6801         (Output_section_headers::Output_section_headers): Move size
6802         computation to Output_section_headers::do_size.
6803         (Output_segment_headers::do_size): New method definition.
6804         (Output_file_header::Output_file_header): Move size computation to
6805         Output_file_header::do_size and call it.
6806         (Output_file_header::do_size): New method definition.
6807         (Output_data_group::Output_data_group): Adjust call to
6808         Output_section_data.
6809         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6810         (Output_symtab_xindex::do_write): Add array bound check.
6811         (Output_section::Input_section::print_to_mapfile): Handle
6812         RELAXED_INPUT_SECTION_CODE.
6813         (Output_section::Output_section): Initialize data member checkpoint_.
6814         (Output_section::~Output_section): Delete checkpoint object pointed
6815         by checkpoint_.
6816         (Output_section::add_input_section): Always add an Input_section if
6817         relaxing.
6818         (Output_section::add_merge_input_section): Add assert.
6819         (Output_section::relax_input_section): New method definition.
6820         (Output_section::set_final_data_size): Set load address to zero for
6821         an unallocated section.
6822         (Output_section::do_address_and_file_offset_have_reset_values):
6823         New method definition.
6824         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6825         Handle relaxed input section.
6826         (Output_section::sort_attached_input_sections): Checkpoint input
6827         section list lazily.
6828         (Output_section::get_input_sections): Change type of input_sections to
6829         list of Simple_input_section pointers.  Checkpoint input section list
6830         lazily.  Also handle relaxed input sections.
6831         (Output_section::add_input_section_for_script): Take a reference to
6832         a Simple_input_section object instead of Relobj pointer and section
6833         index as parameter.  Handle relaxed input sections.
6834         (Output_section::save_states, Output_section::restore_states): New
6835         method definitions.
6836         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6837         (Output_data::is_data_size_fixed): New method definition.
6838         (Output_data::reset_addresss_and_file_offset): Do not reset data size
6839         if it is fixed.
6840         (Output_data::address_and_file_offset_have_reset_values): New method
6841         definition.
6842         (Output_data::do_address_and_file_offset_have_reset_values): New method
6843         definition.
6844         (Output_data::set_data_size): Check that data size is not fixed.
6845         (Output_data::fix_data_size): New method definition.
6846         (Output_data::is_data_size_fixed_): New data member.
6847         (Output_section_headers::set_final_data_size): New method definition.
6848         (Output_section_headers::do_size): New method declaration.
6849         (Output_segment_headers::set_final_data_size): New method definition.
6850         (Output_segment_headers::do_size): New method declaration.
6851         (Output_file_header::set_final_data_size)::New method definition.
6852         (Output_file_header::do_size)::New method declaration.
6853         (Output_section_data::Output_section_data): Add new parameter
6854         is_data_size_fixed and use it to fix data size.
6855         (Output_data_const::Output_data_const): Adjust call to base class
6856         constructor and fix data size.
6857         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6858         base class constructor and fix data size.
6859         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6860         base class constructor and fix data size.
6861         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6862         class constructor and fix data size.
6863         (Output_data_group::set_final_data_size): New method definition.
6864         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6865         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6866         class constructor and fix data size.
6867         (Output_relaxed_input_section): New class definition.
6868         (Output_section::Simple_input_section): New class definition.
6869         (Output_section::get_input_sections): Adjust parameter list.
6870         (Output_section::add_input_section_for_script): Same.
6871         (Output_section::save_states, Output_section::restore_states,
6872         Output_section::do_address_and_file_offset_have_reset_values,
6873         (Output_section::Input_section::Input_section): Handle
6874         RELAXED_INPUT_SECTION_CODE.  Add new overload for
6875         Output_relaxed_input_section.
6876         (Output_section::Input_section::is_input_section,
6877         Output_section::Input_section::set_output_section): Handle relaxed
6878         input section.
6879         (Output_section::Input_section::is_relaxed_input_section,
6880         Output_section::Input_section::output_section_data,
6881         Output_section::Input_section::relaxed_input_section): New method
6882         definitions.
6883         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6884         value.
6885         (Output_section::Input_section::u1_): Update comments.
6886         (Output_section::Input_section::u2_): Add new union member poris.
6887         (Output_section::Checkpoint_output_section): New classs definition.
6888         (Output_section::relax_input_section): New method declaration.
6889         (Output_section::checkpoint_): New data member.
6890         (Output_segment): Update comments.
6891         (Output_segment::Output_segment): Un-privatize copy constructor.
6892         (Output_segment::operator=): Un-privatize.
6893         * script-sections.cc (Output_section_element::Input_section_list):
6894         Change element type to Output_section::Simple_input_section.
6895         (Output_section_element_dot_assignment::set_section_addresses):
6896         Register output section data for relaxation clean up.
6897         (Output_data_exression::Output_data_expression): Adjust call to base
6898         constructor to fix data size.
6899         (Output_section_element_data::set_section_addresses): Register
6900         Output_data_expression object for relaxation clean up.
6901         (struct Input_section_info): Replace Relobj pointer and section index
6902         pair with Output_section::Simple_input_section and Convert struct to a
6903         class.
6904         (Input_section_sorter::operator()): Adjust access to
6905         Input_section_info data member to use accessors.
6906         (Output_section_element_input::set_section_addresses): Use layout
6907         parameter.  Adjust code to use Output_section::Simple_input_section
6908         and Input_secction_info classes.  Register filler for relaxation
6909         clean up.
6910         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6911         and section index pair with Output_section::Simple_input_section
6912         class.  Adjust code accordingly.
6913         (Phdrs_element::release_segment): New method definition.
6914         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6915         segment list.
6916         (Script_sections::release_segments): New method definition.
6917         * gold/script-sections.h (Script_sections::release_segments): New
6918         method declaration.
6919         * gold/target.h (Target::may_relax, Target::relax,
6920         Target::do_may_relax, Target::do_relax): New method definitions.
6921
6922 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6923
6924         * arm.cc (has_signed_unsigned_overflow): New function.
6925         (Arm_relocate_functions::abs8): New function.
6926         (Target_arm::Scan::local): Handle R_ARM_ABS8.
6927         (Target_arm::Scan::global): Likewise.
6928         (Target_arm::relocate::relocate): Likewise.
6929         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6930         Likewise.
6931
6932 2009-09-16  Cary Coutant  <ccoutant@google.com>
6933
6934         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6935         * testsuite/Makefile.in: Regenerate.
6936
6937 2009-09-11  Nick Clifton  <nickc@redhat.com>
6938
6939         * po/gold.pot: Updated by the Translation project.
6940
6941 2009-09-08  Cary Coutant  <ccoutant@google.com>
6942
6943         * output.cc (Output_file::open): Add execute permission to empty file.
6944         * testsuite/Makefile.am (permission_test): New test.
6945         * testsuite/Makefile.in: Regenerate.
6946
6947 2009-09-02  Ian Lance Taylor  <iant@google.com>
6948
6949         * output.cc (Output_file::resize): Call map_no_anonymous rather
6950         than map.
6951
6952 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
6953
6954         * gold.cc: Include "incremental.h".
6955         (queue_initial_tasks): Call Incremental_checker methods.
6956         * incremental.cc: Include "output.h".
6957         (Incremental_checker::can_incrementally_link_output_file): New
6958         method.
6959         * incremental.h (Incremental_checker): New class.
6960
6961         * output.cc (Output_file::open_for_modification): New method.
6962         (Output_file::map_anonymous): Changed return type to bool.  Record
6963         map in base_ field.
6964         (Output_file::map_no_anonymous): New method, broken out of map.
6965         (Output_file::map): Use map_no_anonymous and map_anonymous.
6966         * output.h (class Output_file): Update declarations.
6967
6968 2009-08-24  Cary Coutant  <ccoutant@google.com>
6969
6970         * options.h (Command_line::Pre_options): New class.
6971         (Command_line::pre_options): New member.
6972         * options.cc (gold::options::ready_to_register): New variable.
6973         (One_option::register_option): Do nothing if not registering options.
6974         Assert if same short option registered twice.
6975         (General_options::General_options): Turn off option registration when
6976         done constructing.
6977         (Command_line::Pre_options::Pre_options): New constructor.
6978
6979 2009-08-24  Cary Coutant  <ccoutant@google.com>
6980
6981         * options.h (General_options::no_keep_memory): Remove incorrect
6982         short option.
6983
6984 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6985
6986         * Makefile.am (am__skiplex, am__skipyacc): New.
6987         * Makefile.in: Regenerate.
6988
6989 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6990
6991         * Makefile.am (AM_CPPFLAGS): Renamed from ...
6992         (INCLUDES): ... this.
6993         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6994         (AM_CPPFLAGS): Renamed from ...
6995         (INCLUDE): ... this.
6996         * Makefile.in, testsuite/Makefile.in: Regenerate.
6997
6998         * Makefile.in: Regenerate.
6999         * aclocal.m4: Likewise.
7000         * config.in: Likewise.
7001         * configure: Likewise.
7002         * testsuite/Makefile.in: Likewise.
7003
7004         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7005         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7006         * Makefile.in: Regenerate.
7007         * testsuite/Makefile.in: Regenerate.
7008
7009 2009-08-19  Cary Coutant  <ccoutant@google.com>
7010
7011         * resolve.cc (Symbol_table::resolve): Don't complain about defined
7012         symbols in shared libraries overridden by hidden or internal symbols
7013         in the main program.
7014
7015 2009-08-19  Chris Demetriou  <cgd@google.com>
7016
7017         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7018         checking source file names in error messages.
7019
7020 2009-08-18  Doug Kwan  <dougkwan@google.com>
7021
7022         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7023         an elcpp::Ehdr as parameter.  Adjust call to set_target.
7024         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7025         an elfcpp::Ehdr as parameter.
7026         * object.cc (Object::set_target): Remove the version that looks up
7027         a target and sets it.
7028         (Sized_relobj::setup): Take a Target object instead of
7029         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
7030         (make_elf_sized_object): Find target and ask target to
7031         make an ELF object.
7032         * object.h: (Object::set_target): Remove the version that looks up
7033         a target and sets it.
7034         (Sized_relobj::setup): Take a Target object instead of
7035         an elfcpp:Ehdr as parameter.
7036         * target.cc: Include dynobj.h.
7037         (Target::do_make_elf_object_implementation): New.
7038         (Target::do_make_elf_object): New.
7039         * target.h (Target::make_elf_object): New template declaration.
7040         (Target::do_make_elf_object): New method declarations.
7041         (Target::do_make_elf_object_implementation): New template declaration.
7042
7043 2009-08-14  Ian Lance Taylor  <iant@google.com>
7044
7045         * gold.h (FUNCTION_NAME): Define.
7046         (gold_unreachable): Use FUNCTION_NAME.
7047
7048 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7049
7050         * icf.cc (Icf::find_identical_sections): Issue a warning when a
7051         symbol in the --keep-unique list is not found.
7052
7053 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7054
7055         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7056         been maked as --keep-unique.
7057         (Icf::unfold_section): New function.
7058         * icf.h (Icf::unfold_section): New function.
7059         * options.h (General_options::keep_unique): New option.
7060         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7061         * testsuite/Makefile.in: Regenerate.
7062         * testsuite/icf_keep_unique_test.sh: New file.
7063         * testsuite/icf_keep_unique_test.cc: New file.
7064
7065 2009-08-12  Cary Coutant  <ccoutant@google.com>
7066
7067         PR 10471
7068         * resolve.cc (Symbol_table::resolve): Check for references from
7069         dynamic objects to hidden and internal symbols.
7070         * testsuite/Makefile.am (hidden_test.sh): New test.
7071         * testsuite/Makefile.in: Regenerate.
7072         * testsuite/hidden_test.sh: New script.
7073         * testsuite/hidden_test_1.c: New test source.
7074         * testsuite/hidden_test_main.c: New test source.
7075
7076 2009-08-11  Doug Kwan  <dougkwan@google.com>
7077
7078         * arm.cc: Update comments.
7079         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7080         segment to locate the .ARM.exidx section if present.
7081
7082 2009-08-09  Doug Kwan  <dougkwan@google.com>
7083
7084         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7085         patch.
7086
7087 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7088         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7089         compiler warnings.
7090
7091 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7092
7093         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7094         valid tls_segment only for non-debug-section relocations.
7095         * testsuite/Makefile.am: Add gc_tls_test.
7096         * testsuite/Makefile.in: Regenerate.
7097         * testsuite/gc_tls_test.cc: New file.
7098         * testsuite/gc_tls_test.sh: New file.
7099
7100 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7101
7102         * icf.cc: New file.
7103         * icf.h: New file.
7104         * Makefile.am (CCFILES): Add icf.cc.
7105         (HFILES): Add icf.h
7106         * Makefile.in: Regenerate.
7107         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7108         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7109         section, symbol and addend information for the relocs.
7110         * gold.cc (queue_middle_tasks): Call identical code folding.
7111         * gold.h: Add defines for multimap.
7112         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7113         to the call of finalize_local_symbols.
7114         * main.cc (main): Create object of class Icf.
7115         * object.cc (Sized_relobj::do_layout): Allow this function to be
7116         called twice during icf.
7117         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7118         to sections marked as identical by icf.
7119         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7120         when available.
7121         (Sized_relobj::do_section_entsize): New function.
7122         * object.h (Object::section_entsize): New function.
7123         (Object::do_section_entsize): New pure virtual function.
7124         (Relobj::finalize_local_symbols): Add new parameter.
7125         (Relobj::do_section_entsize): New function.
7126         * options.h (General_options::icf): New option.
7127         (General_options::icf_iterations): New option.
7128         (General_options::print_icf_sections): New option.
7129         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7130         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7131         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7132         icf.
7133         * symtab.cc (Symbol_table::is_section_folded): New function.
7134         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7135         to sections marked as identical by icf.
7136         * symtab.h (Symbol_table::set_icf): New function.
7137         (Symbol_table::icf): New function.
7138         (Symbol_table::is_section_folded): New function.
7139         (Symbol_table::icf_): New data member.
7140         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7141         * testsuite/Makefile.am: Add commands to build icf_test.
7142         * testsuite/Makefile.in: Regenerate.
7143         * testsuite/icf_test.sh: New file.
7144         * testsuite/icf_test.cc: New file.
7145
7146 2009-07-24  Chris Demetriou  <cgd@google.com>
7147
7148         * layout.cc (is_compressible_debug_section): Fix incorrect
7149         comment about compressed section names.
7150
7151 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7152
7153         PR 10419
7154         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7155
7156 2009-07-16  Ian Lance Taylor  <iant@google.com>
7157
7158         PR 10400
7159         * layout.h: #include <map>.
7160         (class Kept_section): Change from struct to class.  Add accessors
7161         and setters.  Add section size to Comdat_group mapping.  Change
7162         Comdat_group to std::map.  Add is_comdat_ field.  Add
7163         linkonce_size field in union.
7164         (class Layout): Update declaration of find_or_add_kept_section.
7165         Don't declare find_kept_object.
7166         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7167         parameter.  Add object, shndx, is_comdat, and is_group_name
7168         parameters.  Change all callers.  Adjust for new Kept_section.
7169         (Layout::find_kept_object): Remove.
7170         * object.cc (Sized_relobj::include_section_group): Update use of
7171         Kept_section.  Rename secnum to shndx.  Only record
7172         Kept_comdat_section if sections are the same size.
7173         (Sized_relobj::include_linkonce_section): Update use of
7174         Kept_section.  Only record Kept_comdat_section if sections are the
7175         same size.  Set size of linkonce section.
7176         (Sized_relobj::map_to_kept_section): Update call to
7177         get_kept_comdat_section.
7178         * object.h (class Sized_relobj): Rename fields in
7179         Kept_comdat_section to drop trailing underscores; change object
7180         field to Relobj*.  Change Kept_comdat_section_table to store
7181         struct rather than pointer.
7182         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7183         Add kept_object and kept_shndx parameters.  Change all callers.
7184         (Sized_relobj::get_kept_comdat_section): Change return type to
7185         bool.  Add kept_object and kept_shndx parameters.  Change all
7186         callers.
7187         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7188         Layout::find_or_add_kept_section.
7189
7190 2009-07-09  Ian Lance Taylor  <iant@google.com>
7191
7192         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7193         Reserve space in the hash table.
7194
7195 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7196
7197         * fileread.cc (File_read::get_mtime): New method.
7198         * fileread.h (Timespec): New structure.
7199         (File_read::get_mtime): New method.
7200         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7201         Renamed from timestamp_nsec.
7202         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7203         Elf_Xword.
7204         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7205         timestamp_nsec.
7206         (Incremental_inputs::report_archive): Save mtime; style fix.
7207         (Incremental_inputs::report_obejct): Save mtime; style fix.
7208         (Incremental_inputs::report_script): Save mtime; style fix.
7209         (Incremental_inputs::finalize_inputs): Style fix.
7210         (Incremental_inputs::finalize): Style fix.
7211         (Incremental_inputs::create_input_section_data): Store inputs
7212         mtime.
7213         * incremental.h (Incremental_inputs::report_script): Add mtime
7214         argument.
7215         (Incremental_inputs::Input_info::Input_info): Intialize only one
7216         union member.
7217         (Incremental_inputs::Input_info::archive): Move to nameless
7218         union.
7219         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7220         (Incremental_inputs::Input_info::script): Move to nameless union.
7221         (Incremental_inputs::mtime): New field.
7222         * script.cc (read_input_script): Pass file mtime to
7223         Incremental_input.
7224         * script.h (Script_info::inputs): Style fix.
7225
7226 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7227
7228         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7229         instead of 32.
7230
7231 2009-06-24  Ian Lance Taylor  <iant@google.com>
7232
7233         PR 10156
7234         * layout.cc (Layout::choose_output_section): If we find an
7235         existing section, update the flags.
7236         (Layout::create_notes): New function, broken out of
7237         Layout::finalize.
7238         (Layout::finalize): Don't create note sections.
7239         (Layout::create_note): Don't crash if linker script discards
7240         section.
7241         (Layout::create_gold_note): Likewise.
7242         (Layout::create_build_id): Likewise.  Don't set
7243         after_input_sections on the section.
7244         (Layout::create_executable_stack_info): Remove target parameter.
7245         Change caller.
7246         * layout.h (class Layout): Declare create_notes.  Update
7247         declaration of create_executable_stack_info.
7248         * gold.cc (queue_middle_tasks): Call create_notes.
7249         * output.cc (Output_section::update_flags_for_input_section): Move
7250         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7251         invalid.
7252         * output.h (Output_data::mark_address_invalid): New function.
7253         (class Output_section): Only declare, not define,
7254         update_flags_for_input_section.  Remove set_flags.
7255
7256 2009-06-24  Ian Lance Taylor  <iant@google.com>
7257
7258         * script-sections.cc (Output_section_definition::
7259         set_section_addresses): Rename shadowing local load_address to
7260         laddr.
7261
7262 2009-06-24  Ian Lance Taylor  <iant@google.com>
7263
7264         PR 10244
7265         * reloc.cc (relocate_sections): Skip empty relocation sections.
7266
7267 2009-06-23  Ian Lance Taylor  <iant@google.com>
7268
7269         PR 10156
7270         * layout.cc (Layout::create_note): Use choose_output_section
7271         rather than make_output_section.
7272
7273 2009-06-23  Ian Lance Taylor  <iant@google.com>
7274
7275         PR 10237
7276         * options.cc (General_options::parse_V): Set printed_version_.
7277         (General_options::General_options): Initialize printed_version_.
7278         * options.h (class General_options): Add printed_version_ field.
7279         * gold.cc (queue_initial_tasks): If there are no input files,
7280         don't give a fatal error if we printed the version information.
7281         (queue_middle_tasks): If using -r with a shared object, give a
7282         fatal error rather than an ordinary error.
7283
7284 2009-06-23  Ian Lance Taylor  <iant@google.com>
7285
7286         PR 10219
7287         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7288         (Layout::make_output_section): Set have_stabstr_section_ if we see
7289         a .stab*str section.
7290         (Layout::finalize): Call link_stabs_sections.
7291         (Layout::link_stabs_sections): New file.
7292         * layout.h (class Layout): Add have_stabstr_section_ field.
7293         Declare link_stabs_sections.
7294
7295 2009-06-23  Doug Kwan  <dougkwan@google.com>
7296
7297         * Makefile.am (libgold_a_LIBADD): New.
7298         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7299         * Makefile.in: Regenerate.
7300         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7301         * configure: Regenerate.
7302         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7303         * fileread.cc: Include sys/state.h
7304         * gold.h: Declare memmem and strndup if found missing.
7305         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7306
7307 2009-06-23  Ian Lance Taylor  <iant@google.com>
7308
7309         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7310         * configure: Rebuild.
7311
7312 2009-06-23  Ian Lance Taylor  <iant@google.com>
7313
7314         PR 10147
7315         * object.cc (Object::section_contents): Don't try to get a view if
7316         the section has length zero.
7317         (Object::handle_gnu_warning_section): If the section is empty, use
7318         the name of the section as the warning.
7319
7320 2009-06-23  Ian Lance Taylor  <iant@google.com>
7321
7322         PR 10133
7323         * stringpool.h (class Stringpool_template): Add optimize_ field.
7324         (Stringpool_template::set_optimize): New function.
7325         * stringpool.cc (Stringpool_template::Stringpool_template):
7326         Initialize optimize_ field.
7327         (Stringpool_template::set_string_offsets): Test local optimize
7328         fild rather than parameter.
7329         * layout.cc (Layout::Layout): Call set_optimize on the section
7330         name stringpool.
7331
7332 2009-06-22  Ian Lance Taylor  <iant@google.com>
7333
7334         PR 10030
7335         * yyscript.y: Parse TARGET.
7336         * script.cc (script_set_target): New function.
7337         * script-c.h (script_set_target): Declare.
7338         * options.cc (General_options::string_to_object_format): Rename
7339         from string_to_object_format in anonymous namespace.  Change
7340         callers.
7341         * options.h (class General_options): Declare
7342         string_to_object_format.
7343
7344 2009-06-22  Ian Lance Taylor  <iant@google.com>
7345
7346         * script-sections.cc (Script_sections::create_segments): Don't put
7347         program headers in a PT_LOAD segment if -n or -N.
7348
7349 2009-06-22  Ian Lance Taylor  <iant@google.com>
7350
7351         PR 10141
7352         * options.h (class General_options): Add -z lazy and -z now.  Sort
7353         -z options into alphabetical order.
7354         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7355
7356 2009-06-21  Ian Lance Taylor  <iant@google.com>
7357
7358         * layout.cc (Layout::make_output_section): Call
7359         Target::new_output_section.
7360         (Layout::attach_allocated_section_to_segment): Put large section
7361         sections in a separate load segment with the large segment flag
7362         set.
7363         (Layout::segment_precedes): Sort large data segments after other
7364         load segments.
7365         (align_file_offset): New static function.
7366         (Layout::set_segment_offsets): Use align_file_offset.
7367         * output.h (class Output_section): Add is_small_section_ and
7368         is_large_section_ fields.
7369         (Output_section::is_small_section): New function.
7370         (Output_section::set_is_small_section):  New function.
7371         (Output_section::is_large_section): New function.
7372         (Output_section::set_is_large_section): New function.
7373         (Output_section::is_large_data_section): New function.
7374         (class Output_segment): Add is_large_data_segment_ field.
7375         (Output_segment::is_large_data_segment): New function.
7376         (Output_segment::set_is_large_data_segment): New function.
7377         * output.cc (Output_section::Output_section): Initialize new
7378         fields.
7379         (Output_segment::Output_segment): Likewise.
7380         (Output_segment::add_output_section): Add assertion that large
7381         data sections always go in large data segments.  Force small data
7382         sections to the end of the list of data sections.  Force small BSS
7383         sections to the start of the list of BSS sections.  For large BSS
7384         sections to the end of the list of BSS sections.
7385         * symtab.h (class Symbol): Declare is_common_shndx.
7386         (Symbol::is_defined): Check Symbol::is_common_shndx.
7387         (Symbol::is_common): Likewise.
7388         (class Symbol_table): Define enum Commons_section_type.  Update
7389         declarations.  Add small_commons_ and large_commons_ fields.
7390         * symtab.cc (Symbol::is_common_shndx): New function.
7391         (Symbol_table::Symbol_table): Initialize new fields.
7392         (Symbol_table::add_from_object): Put small and large common
7393         symbols in the right list.
7394         (Symbol_table::sized_finalized_symbol): Check
7395         Symbol::is_common_shndx.
7396         (Symbol_table::sized_write_globals): Likewise.
7397         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7398         common symbol lists.  Don't call do_allocate_commons_list if the
7399         list is empty.
7400         (Symbol_table::do_allocate_commons_list): Remove is_tls
7401         parameter.  Add comons_section_type parameter.  Change all
7402         callers.  Handle small and large common symbols.
7403         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7404         Symbol::is_common_shndx.
7405         * resolve.cc (symbol_to_bits): Likewise.
7406         * target.h (Target::small_common_shndx): New function.
7407         (Target::small_common_section_flags): New function.
7408         (Target::large_common_shndx): New function.
7409         (Target::large_common_section_flags): New function.
7410         (Target::new_output_section): New function.
7411         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7412         small_common_section_flags, and large_common_section_flags
7413         fields.
7414         (Target::do_new_output_section): New virtual function.
7415         * arm.cc (Target_arm::arm_info): Initialize new fields.
7416         * i386.cc (Target_i386::i386_info): Likewise.
7417         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7418         Likewise.
7419         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7420         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7421         (Target_x86_64::do_new_output_section): New function.
7422         * configure.ac: Define conditional MCMODEL_MEDIUM.
7423         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7424         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7425         (large_LDFLAGS): Define.
7426         * testsuite/large.c: New file.
7427         * testsuite/testfile.cc (Target_test::test_target_info):
7428         Initialize new fields.
7429         * configure, testsuite/Makefile.in: Rebuild.
7430
7431 2009-06-05  Doug Kwan  <dougkwan@google.com>
7432
7433         * Makefile.am (CCFILES): Add target.cc.
7434         * Makefile.in: Regenerate.
7435         * i386.cc (class Target_i386): Define new virtual method to
7436         override do_is_local_label_name in parent.
7437         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7438         local symbols if --discard-locals or -X is given.
7439         * options.h (class General_options): Declare new options
7440         '--discard-locals' and '-X' for discarding locals.
7441         * target.h (class Target): Define new methods is_local_label_name.
7442         Declare new virtual method do_is_local_label_name.
7443         * target.cc: New file.
7444         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7445         (check_SCRIPTS): Add discard_locals_test.sh.
7446         (check_DATA): Add discard_local_tests.syms.
7447         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7448         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7449         * testsuite/Makefile.in: Regenerate.
7450         * testsuite/discard_locals_test.c: New file.
7451         * testsuite/discard_locals_test.sh: Same.
7452
7453 2009-06-05  Doug Kwan  <dougkwan@google.com>
7454
7455         * object.cc (Sized_relobj::Sized_relobj): Initialize
7456         discarded_eh_frame_shndx_ to -1U.
7457         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7458         section.
7459         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7460         a discarded .eh_frame section.
7461         (Sized_relobj::do_finalize_local_symbols): Ditto.
7462         * object.h (class Sized_relobj): Declare new member
7463         discarded_eh_frame_shndx_.
7464         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7465         (local_labels_test.o, local_labels_test): New rules.
7466         * testsuite/Makefile.in: Regenerate.
7467
7468 2009-06-04  Doug Kwan  <dougkwan@google.com>
7469
7470         * layout.cc (Layout::section_name_mapping): Add mapping for
7471         special ARM sections.
7472
7473 2009-06-03  Doug Kwan  <dougkwan@google.com>
7474
7475         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7476         (utils::has_overflow): Same.
7477
7478 2009-06-03  Ian Lance Taylor  <iant@google.com>
7479
7480         * layout.cc (Layout::section_name_mapping): New array, replacing
7481         Layout::linkonce_mapping.
7482         (Layout::section_name_mapping_count): New variable, replacing
7483         Layout::linkonce_mapping_count.
7484         (Layout::linkonce_output_name): Remove.
7485         (Layout::output_section_name): Rewrite.
7486         * layout.h (class Layout): Rename Linkonce_mapping to
7487         Section_name_mapping, linkonce_mapping to section_name_mapping,
7488         linkonce_mapping_count to section_name_mapping_count.  Don't
7489         declare linkonce_output_name.
7490
7491 2009-06-03  Doug Kwan  <dougkwan@google.com>
7492
7493         * gold/arm.cc (namespace utils): New.
7494         (Target_arm::reloc_is_non_pic): Define new method.
7495         (class Arm_relocate_functions): New.
7496         (Target_arm::Relocate::relocate): Handle relocation types used by
7497         Android.
7498
7499 2009-06-03  Ian Lance Taylor  <iant@google.com>
7500
7501         * arm.cc (Target_arm::scan::global): Use || instead of |.
7502
7503 2009-06-02  Doug Kwan  <dougkwan@google.com>
7504
7505         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7506         issued_non_pic_error_.
7507         (class Target_arm::Scan): Declare new method check_non_pic.
7508         Define new method symbol_needs_plt_entry.
7509         Declare new data member issued_non_pic_error_.
7510         (class Target_arm::Relocate): Declare new method
7511         should_apply_static_reloc.
7512         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7513         (Target_arm::Scan::check_non_pic): Define new method.
7514         (Target_arm::Scan::local): Handle a small subset of reloc types used
7515         by Android.
7516         (Target_arm::Scan::local): Same.
7517         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7518
7519 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7520
7521         * incremental.cc (Incremental_inputs::report_command_line): Filter
7522         out --incremental-* options.
7523
7524 2009-05-29  Doug Kwan  <dougkwan@google.com>
7525
7526         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7527         template class.
7528         (class Target_arm): Update comment.
7529         (Target_arm::Target_arm): Initialize new data members GOT_,
7530         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7531         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7532         and Target_arm::rel_dyn_section.
7533         Declare new_enum Target_arm::Got_type.
7534         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7535         and DYNBSS_.
7536         Update commments for member do_dynsym_value.
7537         (Target_arm::got_size, Target_arm::plt_section,
7538         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7539         new methods inside class defintion.
7540         (Target_arm::got_section): Define new method.
7541         (Target_arm::rel_dyn_section): Same.
7542         (Output_data_plt_arm): New template class.
7543         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7544         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7545         (Output_data_plt_arm::add_entry): Same.
7546         (Output_data_plt_arm::first_plt_entry): Define new
7547         static data member for PLT instruction template.
7548         (Output_data_plt_arm::plt_entry): Same.
7549         (Output_data_plt_arm::do_write): Define new method.
7550         (Target_arm::make_plt_entry): Same.
7551         (Target_arm::do_finalize_sections): Same.
7552         (Target_arm::do_dynsym_value): Same.
7553
7554 2009-05-28  Doug Kwan  <dougkwan@google.com>
7555
7556         * Makefile.am (TARGETSOURCES): Add arm.cc.
7557         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7558         * Makefile.in: Regenerate.
7559         * arm.cc: New file.
7560         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7561
7562 2009-05-26  Doug Kwan  <dougkwan@google.com>
7563
7564         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7565         (General_options::check_excluded_libs): Strip off directories in
7566         archive name before matching like GNU ld does.
7567         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7568         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7569         (exclude_libs_test_LDFLAGS): Add linker option
7570         -Wl,--exclude-libs,libexclude_libs_test_3
7571         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7572         an explicit archive without using -l.
7573         (alt/libexclude_libs_test_3.a): New make rule.
7574         * testsuite/Makefile.in: Regenerate.
7575         * testsuite/exclude_libs_test.c : Declare lib3_default().
7576         (main): Call it.
7577         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7578         * exclude_libs_test_3.c: New file.
7579
7580 2009-05-26  Nick Clifton  <nickc@redhat.com>
7581
7582         * po/id.po: New Indonesian translation.
7583         * po/gold.pot: Updated template file.
7584
7585 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7586
7587         * testsuite/Makefile.am: Add -ffunction-sections to compile
7588         gc_comdat_test files.  Add -Wl,--gc-sections to build
7589         gc_comdat_test.
7590         * testsuite/Makefile.in: Regenerate.
7591         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7592
7593 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7594
7595         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7596         kept comdat section was garbage collected.
7597         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7598         * testsuite/Makefile.in: Regenerate.
7599         * testsuite/gc_comdat_test.sh: New file.
7600         * testsuite/gc_comdat_test_1.cc: New file.
7601         * testsuite/gc_comdat_test_2.cc: New file.
7602
7603 2009-05-19  Doug Kwan  <dougkwan@google.com>
7604
7605         * archive.cc (Archive::Archive): Move constructor from archive.h
7606         to here.  Initialize no_export_.
7607         (Archive::get_elf_object_for_member): Set no_export flag of object.
7608         * archive.h (Archive::Archive): Move constructor body to
7609         archive.cc.
7610         (Archive::no_export): New method.
7611         (Archive::no_export_): New field.
7612         * object.h (Object::Object): Initialize no_export_ to false.
7613         (Object::no_export, Object::set_no_export): New methods.
7614         (Object::no_export_): New field.
7615         * options.cc (General_options::parse_exclude_libs): New method.
7616         (General_options::check_excluded_libs) Same.
7617         * options.h (exclude_libs): New option.
7618         (General_options::check_excluded_libs): New method declaration.
7619         (General_options::excluded_libs_): New field.
7620         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7621         default or protected visibility if an object has no-export flag set.
7622         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7623         (check_SCRIPTS): Add exclude_libs_test.sh.
7624         (check_DATA): Add exclude_libs_test.syms.
7625         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7626         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7627         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7628         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7629         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7630         libexclude_libs_test_2.a): New rules.
7631         * testsuite/Makefile.in: Regenerate.
7632         * testsuite/exclude_libs_test.c: New file.
7633         * testsuite/exclude_libs_test.sh: Ditto.
7634         * testsuite/exclude_libs_test_1.c: Ditto.
7635         * testsuite/exclude_libs_test_2.c: Ditto.
7636
7637 2009-05-15  Ian Lance Taylor  <iant@google.com>
7638
7639         * configure.ac: Check for declarations for cases where libiberty.h
7640         checks HAVE_DECL_xxx.
7641         * configure, config.in: Rebuild.
7642
7643 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7644
7645         * gold.h (Incremental_argument_list): Remove (invalid) forward
7646         declaration.
7647         * incremental.cc (Incremental_inputs::report_achive): New method.
7648         (Incremental_inputs::report_object): New method.
7649         (Incremental_inputs::report_script): New method.
7650         (Incremental_inputs::finalize_inputs): New method.
7651         (Incremental_inputs::finalize): Call finalize_inputs().
7652         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7653         Create inputs entries.
7654         * incremental.h (Incremental_input_type): New enum.
7655         (Incremental_inputs::Incremental_input): Initialize new fields.
7656         (Incremental_inputs::report_inputs): New method.
7657         (Incremental_inputs::report_achive): New method.
7658         (Incremental_inputs::report_object): New method.
7659         (Incremental_inputs::report_script): New method.
7660         (Incremental_inputs::finalize_inputs): New method.
7661         (Incremental_inputs::Input_info): New struct.
7662         (Incremental_inputs::Input_info_map): New typedef.
7663         (Incremental_inputs::lock_): New field.
7664         (Incremental_inputs::Inputs_): New field.
7665         (Incremental_inputs::Inputs_map): New field.
7666         * main.cc (main): Call Incremental_input::report_inputs.
7667         * options.h (Input_argument_list): Typedef moved from
7668         Input_arguments.
7669         (Input_file_group::Files): Remove, use ::Input_argument_list.
7670         (Input_file_group::Input_argument_list): Remove, use
7671         ::Input_argument_list.
7672         * plugin.cc (Plugin_manager::add_input_file): Add error in
7673         incremental build.
7674         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7675         functions.
7676         * script.cc (read_input_script): Call
7677         Incremental_input::report_script.
7678         * script.h (Script_info): New class.
7679
7680 2009-04-27  Ian Lance Taylor  <iant@google.com>
7681
7682         * x86_64.cc (do_adjust_output_section): Set entsize to
7683         plt_entry_size.
7684
7685 2009-04-23  Elliott Hughes  <enh@google.com>
7686
7687         * output.cc (Output_file::close): After short writes, continue
7688         writing from the correct offset in the buffer being written.
7689
7690 2009-04-23  Chris Demetriou  <cgd@google.com>
7691
7692         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7693         * configure: Regenerate.
7694         * config.in: Regenerate.
7695         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7696         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7697
7698 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7699
7700         * incremental.cc (Incremental_inputs_header_data): Renamed from
7701         Incremental_input_header_data.
7702         (Incremental_inputs_header_data::data_size): New field.
7703         (Incremental_inputs_header_data::put_input_file_count): Renamed
7704         from input_file_count.
7705         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7706         from command_line_offset.
7707         (Incremental_inputs_header_data::put_reserved): Renamed from
7708         put_reserved.
7709         (Incremental_inputs_entry_data): Renamed from
7710         Incremental_input_entry_data.
7711         (Incremental_inputs_entry_data::data_size): New field.
7712         (Incremental_inputs::report_command_line): New method.
7713         (Incremental_inputs::finalize): New method.
7714         (Incremental_inputs::create_incremental_inputs_data): New method.
7715         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7716         * incremental.h: New file.
7717         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7718        (Layout::finalize): Create incremental inputs section in
7719         incremental builds.
7720        (Layout::create_incremental_info_sections): New method.
7721         * layout.h (Layout::incremental_inputs): New method.
7722        (Layout::create_incremental_info_sections): New method.
7723        (Layout::incremental_inputs_): New field.
7724         * main.cc (main): Notify Incremental_input of the command line.
7725
7726 2009-04-01  Ian Lance Taylor  <iant@google.com>
7727             Mikolaj Zalewski  <mikolajz@google.com>
7728
7729         * gold.h (reserve_unordered_map): Define, three versions, one for
7730         each version of Unordered_map.
7731         * layout.cc (Layout::Layout): Remove options parameter.  Add
7732         number_of_input_files parameter.  Don't initialize options_.
7733         Initialize number_of_input_files_ and resized_signatures_.  Move
7734         sections_are_attached_.
7735         (Layout::layout_group): Reserve space for group_signatures_.
7736         (Layout::find_or_add_kept_section): Change name parameter to be a
7737         reference.  Resize signatures_ map when it gets large enough.
7738         (Layout::layout_eh_frame): Use parameters->options() instead of
7739         this->options_.
7740         (Layout::make_output_section): Likewise.
7741         (Layout::attach_allocated_section_to_segment): Likewise.
7742         (Layout::finalize, Layout::create_executable_stack): Likewise.
7743         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7744         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7745         * layout.h (class Layout): Update declarations.  Remove options_
7746         field.  Add number_of_input_files_ and resized_signatures_
7747         fields.  Move sections_are_attached_ field.
7748         * main.cc (main): Pass number of input files to Layout
7749         constructor.  Don't pass options.
7750
7751 2009-03-30  Ian Lance Taylor  <iant@google.com>
7752
7753         * ffsll.c (ffsll): Correct implementation.
7754
7755 2009-03-27  Ian Lance Taylor  <iant@google.com>
7756
7757         * ffsll.c: New file.
7758         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7759         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7760         * ftruncate.c (ftruncate): Declare before definition.
7761         * mremap.c (mremap): Likewise.
7762         * pread.c (pread): Likewise.
7763         * configure, Makefile.in, config.in: Rebuild.
7764
7765         * mremap.c: New file.
7766         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7767         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7768         (mremap): Declare if HAVE_MREMAP is not defined.
7769         * configure, Makefile.in, config.in: Rebuild.
7770
7771 2009-03-27  Cary Coutant  <ccoutant@google.com>
7772
7773         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7774         position independent.
7775         * sparc.cc (Target_sparc::check_non_pic): Likewise.
7776         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7777
7778 2009-03-24  Cary Coutant  <ccoutant@google.com>
7779
7780         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7781         an executable.
7782         (needs_dynamic_reloc): Likewise.
7783
7784 2009-03-24  Ian Lance Taylor  <iant@google.com>
7785
7786         * yyscript.y (file_cmd): Recognize EXTERN.
7787         (extern_name_list, extern_name_list_body): New nonterminals.
7788         * script.cc (script_add_extern): Define.
7789         * script-c.h (script_add_extern): Declare.
7790
7791 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
7792
7793         * object.cc (is_elf_object): Define.
7794         * object.h (is_elf_object): Declare.
7795         * archive.cc (Archive::get_elf_object_for_member): Call
7796         is_elf_object.
7797         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7798
7799 2009-03-24  Elliott Hughes  <enh@google.com>
7800
7801         * output.cc (Output_file::map_anonymous): Define.
7802         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
7803         try an anonymous one.  Report the size if the mmap fails.
7804         * output.h (class Output_file): Declare map_anonymous.
7805
7806 2009-03-24  Ian Lance Taylor  <iant@google.com>
7807
7808         * target-select.cc (instantiate_target): Don't acquire the lock if
7809         the instantiated_target_ field has already been set.
7810
7811 2009-03-23  Ian Lance Taylor  <iant@google.com>
7812
7813         * gold-threads.h (class Initialize_lock): Define.
7814         * gold-threads.cc (class Initialize_lock_once): Define.
7815         (initialize_lock_control): New static variable.
7816         (initialize_lock_pointer): New static variable.
7817         (initialize_lock_once): New static function.
7818         (Initialize_lock::Initialize_lock): Define.
7819         (Initialize_lock::initialize): Define.
7820         * target-select.h: Include "gold-threads.h".
7821         (class Target_selector): Add lock_ and initialize_lock_ fields.
7822         Don't define instantiate_target, just declare it.
7823         * target-select.cc (Target_selector::Target_selector): Initialize
7824         new fields.
7825         (Target_selector::instantiate_target): Define.
7826         * descriptors.h: Include "gold-threads.h".
7827         (class Descriptors): Add initialize_lock_ field.
7828         * descriptors.cc (Descriptors::Descriptors): Initialize new
7829         field.
7830         (Descriptors::open): Use initialize_lock_ field
7831         * errors.h (class Errors): Add initialize_lock_ field.
7832         * errors.cc (Errors::Errors): Initialize new field.
7833         (Errors::initialize_lock): Use initialize_lock_ field.
7834         * powerpc.cc (class Target_selector_powerpc): Remove
7835         instantiated_target_ field.  In do_recognize call
7836         instantiate_target rather than do_instantiate_target.  In
7837         do_instantiate_target just allocate a new target.
7838         * sparc.cc (class Target_selector_sparc): Likewise.
7839
7840         * freebsd.h: New file.
7841         * i386.cc: Include "freebsd.h".
7842         (Target_i386): Derive from Target_freebsd rather than
7843         Sized_target.
7844         (Target_selector_i386): Derive from Target_selector_freebsd rather
7845         than Target_selector.
7846         * x86_64.cc: Include "freebsd.h".
7847         (Target_x86_64): Derive from Target_freebsd rather than
7848         Sized_target.
7849         (Target_selector_x86_64): Derive from Target_selector_freebsd
7850         rather than Target_selector.
7851         * target.h (class Target): Add adjust_elf_header and
7852         do_adjust_elf_header.
7853         * output.cc (Output_file_header:: do_sized_write): Call target
7854         adjust_elf_header routine.
7855         * configure.tgt: Set targ_osabi.
7856         * configure.ac: Define GOLD_DEFAULT_OSABI.
7857         * parameters.cc (Parameters::default_target): Pass
7858         GOLD_DEFAULT_OSABI to select_target.
7859         * target-select.h (class Target_selector): Make instantiate_target
7860         protected rather than private.
7861         * Makefile.am (HFILES): Add freebsd.h.
7862         * configure, Makefile.in, config.in: Rebuild.
7863
7864         * merge.cc (do_add_input_section): Correct pend value.  Change
7865         message about last entry not being null terminated from error to
7866         warning.
7867
7868 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
7869
7870         * incremental.cc: New file.
7871         * Makefile.am (CCFILES): Add incremental.cc.
7872         * Makefile.in: Rebuild.
7873
7874 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
7875
7876         * layout.cc (Layout::output_section_name): Preserve names
7877         of '.note.' sections.
7878
7879 2009-03-19  Ian Lance Taylor  <iant@google.com>
7880
7881         * descriptors.cc (Descriptors::open): Check that the options are
7882         valid before using them.
7883
7884 2009-03-18  Ian Lance Taylor  <iant@google.com>
7885
7886         * script-sections.h: Include <list>.
7887         (class Script_sections): Change Sections_elements from std::vector
7888         to std::list.  Typedef public Elements_iterator.  Add
7889         orphan_section_placement_, data_segment_align_start_, and
7890         saw_data_segment_align_ fields.  Remove data_segment_align_index_
7891         field.
7892         * script-sections.cc (class Orphan_section_placement): New class.
7893         (class Sections_element): Add virtual functions is_relro and
7894         orphan_section_init.  Remove virtual function place_orphan_here.
7895         (class Output_section_definition): Add is_relro and
7896         orphan_section_init.  Remove place_orphan_here.
7897         (class Orphan_output_section): Likewise.
7898         (Script_sections::Script_sections): Update for field changes.
7899         (Script_sections::data_segment_align): Set saw_data_segment_align_
7900         and data_segment_align_start_, not data_segment_align_index.
7901         (Script_sections::data_segment_relro_end): Check
7902         saw_data_segment_align_.  Use data_segment_align_start_ rather
7903         than data_segment_align_index_.
7904         (Script_sections::place_orphan): Rewrite to use
7905         Orphan_section_placement.
7906
7907 2009-03-17  Ian Lance Taylor  <iant@google.com>
7908
7909         * archive.cc (Archive::add_symbols): Check for a version attached
7910         to the symbol name in the archive map.
7911         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7912         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7913         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7914         (ver_test_11.a): New target.
7915         * testsuite/Makefile.in: Rebuild.
7916
7917         * configure.ac: Check for chsize and posix_fallocate.  Replace
7918         ftruncate.
7919         * ftruncate.c: New file, from gnulib.
7920         * output.cc (posix_fallocate): Define dummy version if not
7921         HAVE_POSIX_FALLOCATE.
7922         (Output_file::map): Call posix_fallocate rather than lseek and
7923         write.
7924         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7925         * configure, Makefile.in, config.in: Rebuild.
7926
7927 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
7928
7929         * layout.h (Layout::create_note): Add section_name parameter.
7930         * layout.cc (Layout::create_note): Likewise.
7931         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7932
7933 2009-03-17  Ian Lance Taylor  <iant@google.com>
7934
7935         * descriptors.cc: Include "options.h".
7936         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7937         (Descriptors::open): Always use O_CLOEXEC when opening a new
7938         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
7939         then set FD_CLOEXEC.
7940
7941         * sparc.cc (class Target_sparc): Add has_got_section.
7942         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7943         make sure we have a GOT section.
7944
7945         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7946         (Target_sparc::Scan::local): Likewise.
7947         (Target_sparc::Scan::global): Likewise.
7948         (Target_sparc::Relocate::relocate): Likewise.
7949         (Target_sparc::Relocate::relocate_tls): Likewise.
7950
7951         * symtab.cc (Symbol_table::define_default_version): New function,
7952         broken out of add_from_object.
7953         (Symbol_table::add_from_object): Call define_default_version.
7954         (Symbol_table::define_special_symbol): Add resolve_oldsym
7955         parameter.  Change all callers.  If the version for a symbol comes
7956         from a version script, resolve it with the symbol with the same
7957         name with no version.  Also add the symbol without a version if
7958         appropriate.
7959         (do_define_in_output_data): If resolving with oldsym, don't delete
7960         sym.
7961         (do_define_in_output_segment): Likewise.
7962         (do_define_as_constant): Likewise.
7963         * symtab.h (class Symbol_table): Update declarations.
7964
7965 2009-03-13  Ian Lance Taylor  <iant@google.com>
7966
7967         * readsyms.cc (Read_symbols::incompatible_warning): New function.
7968         (Read_symbols::requeue): New function.
7969         (Read_symbols::do_read_symbols): If make_elf_object fails because
7970         the target type is not configured, and the file was searched for,
7971         issue a warning and retry with the next directory.
7972         (Add_symbols::run): If the file has an incompatible format, and
7973         it was searched for, requeue the Read_symbols task.  On error,
7974         release the object.
7975         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
7976         dirindex parameter to constructor.  Change all callers.  Declare
7977         incompatible_warning and requeue.
7978         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7979         input_argument_ and input_group_ fields.  Add them to
7980         constructor.  Change all callers.
7981         (class Read_script): Add dirindex_ field.  Add it to constructor.
7982         Change all callers.
7983         * archive.cc (Archive::setup): Remove input_objects parameter.
7984         Change all callers.
7985         (Archive::get_file_and_offset): Likewise.
7986         (Archive::read_all_symbols): Likewise.
7987         (Archive::read_symbols): Likewise.
7988         (Archive::get_elf_object_for_member): Remove input_objects
7989         parameter.  Add punconfigured parameter.  Change all callers.
7990         (Archive::add_symbols): Change return type to bool.  Check return
7991         value of include_member.
7992         (Archive::include_all_members): Likewise.
7993         (Archive::include_member): Change return type to bool.  Return
7994         false if first included object has incompatible target.  Set
7995         included_member_ field.
7996         (Add_archive_symbols::run): If add_symbols returns false, requeue
7997         Read_symbols task.
7998         * archive.h (class Archive): Add included_member_ field.
7999         Initialize it in constructor.  Add input_file and searched_for
8000         methods.  Update declarations.
8001         (class Add_archive_symbols): Add dirpath_, dirindex_, and
8002         input_argument_ fields.  Add them to constructor.  Change all
8003         callers.
8004         * script.cc: Include "target-select.h".
8005         (class Parser_closure): Add skip_on_incompatible_target_ and
8006         found_incompatible_target_ fields.  Add
8007         skip_on_incompatible_target parameter to constructor.  Change all
8008         callers.  Add methods skip_on_incompatible_target,
8009         clear_skip_on_incompatible_target, found_incompatible_target, and
8010         set_found_incompatible_target.
8011         (read_input_script): Add dirindex parameter.  Change all callers.
8012         If parser finds an incompatible target, requeue Read_symbols
8013         task.
8014         (script_set_symbol): Clear skip_on_incompatible_target in
8015         closure.
8016         (script_add_assertion, script_parse_option): Likewise.
8017         (script_start_sections, script_add_phdr): Likewise.
8018         (script_check_output_format): New function.
8019         * script.h (read_input_script): Update declaration.
8020         * script-c.h (script_check_output_format): Declare.
8021         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8022         (ignore_cmd): Remove OUTPUT_FORMAT.
8023         * fileread.cc (Input_file::Input_file): Add explicit this.
8024         (Input_file::will_search_for): New function.
8025         (Input_file::open): Add pindex parameter.  Change all callers.
8026         * fileread.h (class Input_file): Add input_file_argument method.
8027         Declare will_search_for.  Update declarations.
8028         * object.cc (make_elf_object): Add punconfigured parameter.
8029         Change all callers.
8030         * object.h (class Object): Make input_file public.  Add
8031         searched_for method.
8032         (make_elf_object): Update declaration.
8033         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
8034         restart search.
8035         * dirsearch.h (class Dirsearch): Update declaration.
8036         * options.h (class General_options): Add --warn-search-mismatch.
8037         * parameters.cc (Parameters::is_compatible_target): New function.
8038         * parameters.h (class Parameters): Declare is_compatible_target.
8039         * workqueue.cc (Workqueue::add_blocker): New function.
8040         * workqueue.h (class Workqueue): Declare add_blocker.
8041
8042         * fileread.cc (Input_file::open): Remove options parameter.
8043         Change all callers.
8044         (Input_file::open_binary): Likewise.
8045         * script.cc (read_input_script): Likewise.
8046         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
8047         options parameter from constructor.  Change all callers.
8048         (class Read_script): Likewise.
8049         * fileread.h (class Input_file): Update declarations.
8050         * script.h (read_input_script): Update declaration.
8051
8052 2009-03-10  Nick Clifton  <nickc@redhat.com>
8053
8054         * po/es.po: New Spanish translation.
8055
8056 2009-03-06  Cary Coutant  <ccoutant@google.com>
8057
8058         * options.cc (parse_short_option): Keep dash_z from registering itself.
8059
8060 2009-03-03  Ian Lance Taylor  <iant@google.com>
8061
8062         PR 9918
8063         * target-reloc.h (relocate_section): Pass output_section to
8064         relocate.
8065         * i386.cc (Target_i386::should_apply_static_reloc): Add
8066         output_section parameter.  Change all callers.
8067         (Target_i386::Relocate::relocate): Add output_section parameter.
8068         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8069         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8070         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8071         * testsuite/two_file_shared.sh: New script.
8072         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8073         (check_DATA): Add two_file_shared.dbg.
8074         (two_file_shared.dbg): New target.
8075         * testsuite/Makefile.in: Rebuild.
8076
8077 2009-03-01  Ian Lance Taylor  <iant@google.com>
8078
8079         * configure.ac: Check for byteswap.h.
8080         * configure: Rebuild.
8081         * config.in: Rebuild.
8082
8083 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8084
8085         * layout.cc (Layout::find_or_add_kept_section): New function.
8086         (Layout::add_comdat): Removed.
8087         * layout.h (struct Kept_section): Move out of class Layout.
8088         Remove trailing underscores from field names.  Add group_sections
8089         field.  Rename group_ field to is_group.  Change all uses.
8090         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8091         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8092         comdat_groups_ field.
8093         (Sized_relobj::include_section_group): Use
8094         find_or_add_kept_section and Kept_section::group_sections.
8095         (Sized_relobj::include_linkonce_section): Likewise.
8096         * object.cc (class Sized_relobj): Don't define Comdat_group or
8097         Comdat_group_table.  Remove find_comdat_group and
8098         add_comdat_group.  Remove comdat_groups_ field.
8099         * plugin.cc (include_comdat_group): Use
8100         Layout::find_or_add_kept_section.
8101
8102 2009-02-28  Ian Lance Taylor  <iant@google.com>
8103
8104         * README: --gc-sections and map files are now supported.  Document
8105         some build requirements.
8106
8107         PR 6992
8108         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8109         relocatable link set the value of the section symbol to zero.
8110         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8111         relocatable link don't include the section address in the local
8112         symbol value.
8113
8114 2009-02-27  Ian Lance Taylor  <iant@google.com>
8115
8116         PR 6811
8117         * options.h (class Search_directory): Add is_system_directory.
8118         (class General_options): Declare is_in_system_directory.
8119         * options.cc (get_relative_sysroot): Make static.
8120         (get_default_sysroot): Make static.
8121         (General_optoins::is_in_system_directory): New function.
8122         * fileread.cc (Input_file::is_in_system_directory): New function.
8123         * fileread.h (class Input_file): Declare is_in_system_directory.
8124         * object.h (class Object): Add is_in_system_directory.
8125         (class Input_objects): Remove system_library_directory_ field.
8126         * object.cc (Input_objects::add_object): Don't set
8127         system_library_directory_.
8128         (input_objects::found_in_system_library_directory): Remove.
8129         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8130         parameter.  Change all callers.
8131         (Symbol_table::sized_write_globals): Likewise.
8132         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8133         Call Object::is_in_system_directory.
8134         * symtab.h (class Symbol_table): Update declarations.
8135
8136         PR 5990
8137         * descriptors.h (Open_descriptor): Add is_on_stack field.
8138         * descriptors.cc (Descriptors::open): If the descriptor is on the
8139         top of the stack, remove it.  Initialize is_on_stack field.
8140         (Descriptors::release): Only add pod to stack if it is not on the
8141         stack already.
8142         (Descriptors::close_some_descriptor): Clear stack_next and
8143         is_on_stack fields.
8144
8145         PR 7091
8146         * output.cc (Output_section::find_starting_output_address): Rename
8147         from starting_output_address; add PADDR parameter; change return
8148         type.
8149         * output.h (class Output_section): Declare
8150         find_starting_output_address instead of starting_output_address.
8151         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8152         section symbol for which we can't find a merge section.
8153
8154         PR 9836
8155         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8156         hidden or internal, force the symbol to be local.
8157         * resolve.cc (Symbol::override_visibility): Define.
8158         (Symbol::override_base): Use override_visibility.
8159         (Symbol_table::resolve): Likewise.
8160         (Symbol::override_base_with_special): Likewise.
8161         (Symbol_table::override_with_special): If the visibility is hidden
8162         or internal, force the symbol to be local.
8163         * symtab.h (class Symbol): Add set_visibility and
8164         override_visibility.
8165         * testsuite/ver_test_1.sh: New file.
8166         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8167         (check_DATA): Add ver_test_1.syms.
8168         (ver_test_1.syms): New target.
8169         * testsuite/Makefile.in: Rebuild.
8170
8171 2009-02-25  Cary Coutant  <ccoutant@google.com>
8172
8173         * layout.cc (Layout::choose_output_section): Don't rename sections
8174         when using a linker script that has a SECTIONS clause.
8175         * Makefile.in: Regenerate.
8176
8177         * testsuite/Makefile.am (script_test_5.sh): New test case.
8178         * testsuite/Makefile.in: Regenerate.
8179         * testsuite/script_test_5.cc: New file.
8180         * testsuite/script_test_5.sh: New file.
8181         * testsuite/script_test_5.t: New file.
8182
8183 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8184
8185         * archive.cc (Archive::include_member): Update calls to add_symbols.
8186         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8187         the Layout argument.
8188         * dynobj.h (do_add_symbols): Add the Layout argument.
8189         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8190         Layout argument.
8191         * object.h (Object::add_symbols): Add the Layout argument.
8192         (Object::do_add_symbols): Add the Layout argument.
8193         (Sized_relobj::do_add_symbols): Add the Layout argument.
8194         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8195         Unify the two versions.
8196         (Add_plugin_symbols): Remove.
8197         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8198         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8199         (Add_plugin_symbols): Remove.
8200         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8201         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8202         (Add_symbols::run): Make it work with Pulginobj.
8203
8204 2009-02-06  Ian Lance Taylor  <iant@google.com>
8205
8206         * object.cc (Sized_relobj::do_layout): Make info message start
8207         with lower case letter.
8208
8209 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8210
8211         * binary.cc: Fix file comment.
8212
8213         * options.h (enum Incremental_disposition): Define.
8214         (class General_options): Add new options: --incremental,
8215         --incremental_changed, --incremental_unchanged,
8216         --incremental_unknown.  Add incremental_disposition_ and
8217         implicit_incremental_ fields.
8218         (General_options::incremental_disposition): New function.
8219         (class Position_dependent_options): Add incremental_disposition
8220         option.
8221         (Position_dependent_options::copy_from_options): Set incremental
8222         dispositions.
8223         * options.cc (General_options::parse_incremental_changed): New
8224         function.
8225         (General_options::parse_incremental_unchanged): New function.
8226         (General_options::parse_incremental_unknown): New function.
8227         (General_options::General_options): Initialize new fields
8228         incremental_disposition_ and implicit_incremental_.
8229         (General_options::finalize): Check for uasge of --incremental-*
8230         without --incremental.
8231
8232 2009-02-06  Chris Demetriou  <cgd@google.com>
8233
8234         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8235         pointer and to report location as the file name associated with
8236         the symbol.
8237         (gold_undefined_symbol_at_location): New function to replace the
8238         old gold_undefined_symbol functionality.
8239         * target-reloc.h (relocate_section): Update to use
8240         gold_undefined_symbol_at_location.
8241         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8242         Call gold_undefined_symbol function rather than gold_error.
8243         * errors.h (Errors::undefined_symbol): Take location as a
8244         string, rather than calculating it from a relocation.
8245         * errors.cc (Errors::fatal): Print "fatal error:" before the
8246         formatted message.
8247         (Errors::error, Errors::error_at_location): Print "error: "
8248         before the formatted message.
8249         (Errors::undefined_symbol): Take location as a string, rather
8250         than calculating it from a relocation.
8251         (gold_undefined_symbol_at_location): New function akin to
8252         old gold_undefined_symbol, calculates location from relocation.
8253         (gold_undefined_symbol): Change to take only a Symbol pointer
8254         and to report location as the file name associated with the symbol.
8255         * testsuite/debug_msg.sh: Update for changed error messages.
8256         * testsuite/undef_symbol.sh: Likewise.
8257
8258 2009-02-04  Duncan Sands  <baldrick@free.fr>
8259
8260         PR 9812
8261         * reduced_debug_output.h
8262         (Output_reduced_debug_abbrev_section::failed): Use format for
8263         gold_warning.
8264         (Output_reduced_debug_info_section::faild): Likewise.
8265
8266 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8267
8268         * script.cc (Lazy_demangler): New class.
8269         (Version_script_info::get_symbol_version_helper): Demangle a
8270         symbol only once.
8271
8272 2009-01-29  Cary Coutant  <ccoutant@google.com>
8273
8274         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8275         to __tls_get_addr.
8276         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8277
8278 2009-01-28  Ian Lance Taylor  <iant@google.com>
8279
8280         * version.cc (version_string): Bump to 1.9.
8281
8282         * gold.h: Include <cstring> and <stdint.h>.
8283         * version.cc: Include <cstdio>.
8284         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8285         warning.
8286         * reduced_debug_output.cc (insert_into_vector): Rename from
8287         Insert_into_vector; change all callers.  Use Swap_unaligned to
8288         avoid aliasing issue; remove union since it is unnecessary.
8289
8290 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8291
8292         * Makefile.am (CCFILES): Add gc.cc.
8293         (HFILES): Add gc.h.
8294         * Makefile.in: Regenerate.
8295         * gold.cc (Gc_runner): New class.
8296         (queue_initial_tasks): Call garbage collection related tasks
8297         when corresponding options are invoked.
8298         (queue_middle_gc_tasks): New function.
8299         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8300         processed early before laying out sections during garbage collection.
8301         * gold.h (queue_middle_gc_tasks): New function.
8302         (is_prefix_of): Move from "layout.cc".
8303         * i386.cc (Target_i386::gc_process_relocs): New function.
8304         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8305         * main.cc (main): Create object of class "Garbage_collection".
8306         * object.cc (Relobj::copy_symbols_data): New function.
8307         (Relobj::is_section_name_included): New function.
8308         (Sized_relobj::do_layout): Allow this function to be called twice
8309         during garbage collection and defer layout of section during the
8310         first call.
8311         * object.h (Relobj::get_symbols_data): New function.
8312         (Relobj::is_section_name_included): New function.
8313         (Relobj::copy_symbols_data): New function.
8314         (Relobj::set_symbols_data): New function.
8315         (Relobj::get_relocs_data): New function.
8316         (Relobj::set_relocs_data): New function.
8317         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8318         (Relobj::gc_process_relocs): New function.
8319         (Relobj::do_gc_process_relocs): New pure virtual function.
8320         (Relobj::sd_): New data member.
8321         (Sized_relobj::is_output_section_offset_invalid): New function.
8322         (Sized_relobj::do_gc_process_relocs): New function.
8323         * options.h (General_options::gc_sections): Modify to not be a no-op.
8324         (General_options::print_gc_sections): New option.
8325         * plugin.cc (Plugin_finish::run): Remove function call to
8326         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8327         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8328         * reloc.cc (Read_relocs::run): Add task to process relocs and
8329         determine unreferenced sections when doing garbage collection.
8330         (Gc_process_relocs): New class.
8331         (Sized_relobj::do_gc_process_relocs): New function.
8332         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8333         sections that are garbage collected.
8334         * reloc.h (Gc_process_relocs): New class.
8335         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8336         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8337         symbols whose corresponding sections are garbage collected.
8338         (Symbol_table::Symbol_table): Add new parameter for the garbage
8339         collection object.
8340         (Symbol_table::gc_mark_undef_symbols): New function.
8341         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8342         (Symbol_table::gc_mark_dyn_syms): New function.
8343         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8344         as garbage.
8345         (Symbol_table::add_from_object): Likewise.
8346         (Symbol_table::add_from_relobj): When building shared objects, do not
8347         treat externally visible symbols as garbage.
8348         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8349         table information for static and relocatable links.
8350         * symtab.h (Symbol_table::set_gc): New function.
8351         (Symbol_table::gc): New function.
8352         (Symbol_table::gc_mark_undef_symbols): New function.
8353         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8354         (Symbol_table::gc_mark_dyn_syms): New function.
8355         (Symbol_table::gc_): New data member.
8356         * target.h (Sized_target::gc_process_relocs): New pure virtual
8357         function.
8358         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8359         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8360
8361 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8362
8363         * options.h (General_options::gc_sections): Define as a no-op for now.
8364         (General_options::no_keep_memory): Ditto.
8365         (General_options::Bshareable): Define.
8366         * options.cc (General_options::finalize): Honor -Bshareable.
8367
8368 2009-01-20  Andreas Schwab  <schwab@suse.de>
8369
8370         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8371         read the value in the contents, since we don't use it.  Use the
8372         template endianness when writing.
8373         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8374
8375 2009-01-19  Andreas Schwab  <schwab@suse.de>
8376
8377         * configure.tgt (powerpc64-*): Fix targ_obj.
8378
8379 2009-01-15  Ian Lance Taylor  <iant@google.com>
8380
8381         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8382         local symbols when stripping all symbols.
8383
8384 2009-01-14  Cary Coutant  <ccoutant@google.com>
8385
8386         * output.cc (Output_reloc): Add explicit instantiations.
8387
8388 2009-01-14  Cary Coutant  <ccoutant@google.com>
8389
8390         * archive.cc (Archive::get_elf_object_for_member): Remove call
8391         to File_read::claim_for_plugin.
8392         * descriptors.cc (Descriptors::open): Remove reference to
8393         is_claimed.
8394         (Descriptors::claim_for_plugin): Remove.
8395         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8396         (Descriptors::is_claimed): Remove.
8397         (claim_descriptor_for_plugin): Remove.
8398         * fileread.cc (File_read::claim_for_plugin): Remove.
8399         * fileread.h (File_read::claim_for_plugin): Remove.
8400         (File_read::descriptor): Reopen descriptor if necessary.
8401         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8402         (Plugin_manager::all_symbols_read): Add task parameter. Change
8403         all callers.
8404         (Plugin_manager::get_input_file): New function.
8405         (Plugin_manager::release_input_file): New function.
8406         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8407         corresponding data member.
8408         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8409         and pass to base constructor. Change all callers.
8410         (get_input_file, release_input_file): New functions.
8411         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8412         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8413         (Plugin_manager::all_symbols_read): Add task parameter.
8414         (Plugin_manager::get_input_file): New function.
8415         (Plugin_manager::release_input_file): New function.
8416         (Plugin_manager::task_): New data member.
8417         (Pluginobj::Pluginobj): Add filesize parameter.
8418         (Pluginobj::filename): New function.
8419         (Pluginobj::descriptor): New function.
8420         (Pluginobj::filesize): New function.
8421         (Pluginobj::filesize_): New data member.
8422         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8423         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8424         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8425
8426         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8427         with archive libraries.
8428         * testsuite/Makefile.in: Regenerate.
8429         * testsuite/plugin_test.c (struct sym_info): New type.
8430         (get_input_file, release_input_file): New static variables.
8431         (onload): Capture new transfer vector entries.
8432         (claim_file_hook): Stop reading at end of file according to filesize.
8433         Factor out parsing of readelf output into separate function.
8434         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8435         APIs and get the source file name from the symbol table.  Convert
8436         source file name to corresponding object file name.  Print info
8437         message when adding new input files.
8438         (parse_readelf_line): New function.
8439         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8440         * testsuite/plugin_test_2.sh: Likewise.
8441         * testsuite/plugin_test_3.sh: Likewise.
8442         * testsuite/plugin_test_4.sh: New test case.
8443
8444 2009-01-07  Ian Lance Taylor  <iant@google.com>
8445
8446         * version.cc (version_string): Bump to 1.8.
8447
8448 2008-12-23  Cary Coutant  <ccoutant@google.com>
8449
8450         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8451         * plugin.cc (Plugin_manager::finish): Rename as
8452         layout_deferred_objects.  Move cleanup to separate function.
8453         (Plugin_manager::cleanup): New function.
8454         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8455         separately.
8456         * plugin.h (Plugin_manager::finish): Rename as
8457         layout_deferred_objects.
8458         (Plugin_manager::cleanup): New function.
8459         (Plugin_manager::cleanup_done): New field.
8460
8461 2008-12-23  Cary Coutant  <ccoutant@google.com>
8462
8463         * plugin.cc (is_visible_from_outside): New function.
8464         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8465         so we don't return "IR only" status for exported symbols or -r links.
8466
8467         * testsuite/Makefile.am (plugin_test_3): New test case.
8468         * testsuite/Makefile.in: Regenerate.
8469         * testsuite/plugin_test_3.sh: New file.
8470
8471 2008-12-22  Cary Coutant  <ccoutant@google.com>
8472
8473         * object.cc (Sized_relobj::layout_section): New function.
8474         (Sized_relobj::do_layout): Defer layout of input sections until after
8475         plugin has provided replacement files.
8476         (Sized_relobj::do_layout_deferred_sections): New function.
8477         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8478         (Relobj::layout_deferred_sections): New function.
8479         (Relobj::do_layout_deferred_sections): New function.
8480         (Sized_relobj::do_layout_deferred_sections): New function.
8481         (Sized_relobj::layout_section): New function.
8482         (Sized_relobj::Deferred_layout): New structure.
8483         (Sized_relobj::deferred_layout_): New field.
8484         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8485         Change all callers.  Layout deferred sections.
8486         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8487         references.
8488         (Plugin_hook::run): Move code from do_plugin_hook inline.
8489         (Plugin_hook::do_plugin_hook): Remove.
8490         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8491         (Plugin_manager::finish): Renamed, was cleanup.
8492         (Plugin_manager::should_defer_layout): New function.
8493         (Plugin_manager::add_deferred_layout_object): New function.
8494         (Plugin_manager::Deferred_layout_list): New type.
8495         (Plugin_manager::deferred_layout_objects_): New field.
8496         (Plugin_hook::do_plugin_hook): Remove.
8497
8498 2008-12-17  Ian Lance Taylor  <iant@google.com>
8499
8500         * options.h (class General_options): Add --no case for
8501         --export-dynamic.
8502
8503 2008-12-16  Cary Coutant  <ccoutant@google.com>
8504
8505         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8506         vector.
8507         (Plugin_manager::claim_file): Create plugin object even if
8508         plugin did not call the add_symbols callback.
8509         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8510         asking for more symbols than were added.
8511         * testsuite/Makefile.am (plugin_test_1): Add test case with
8512         no global symbols.
8513         (empty.syms): New target.
8514         * testsuite/Makefile.in: Regenerate.
8515         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8516         message. Don't call add_symbols if no globals.
8517         (all_symbols_read_hook): Don't provide replacement for empty
8518         claimed file.
8519
8520 2008-12-12  Ian Lance Taylor  <iant@google.com>
8521
8522         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8523         r_type == 0 for a local symbol with r_sym == 0.
8524         (scan_relocatable_relocs): Pass r_sym to
8525         local_non_section_strategy.
8526         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8527         r_sym parameter.
8528
8529         * configure.ac: Update test for TLS descriptors: they are
8530         supported as of glibc 2.9.
8531         * configure: Rebuild.
8532
8533 2008-12-11  Ian Lance Taylor  <iant@google.com>
8534
8535         PR 7091
8536         * target-reloc.h (Default_scan_relocatable_relocs): For each
8537         function, map r_type == 0 to RELOC_DISCARD.
8538
8539 2008-12-10  Cary Coutant  <ccoutant@google.com>
8540
8541         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8542         object to override a kept COMDAT group from a plugin object.
8543
8544 2008-12-09  Ian Lance Taylor  <iant@google.com>
8545
8546         PR 7088
8547         * yyscript.y (file_cmd): Handle INPUT.
8548
8549         * testsuite/initpri1.c: Change all declarations to be full
8550         prototypes by adding void, to avoid compiler warnings.
8551
8552 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8553
8554         * options.cc (General_options::parse_plugin_opt): New.
8555         (General_options::add_plugin): The argument now is just the filename.
8556         (General_options::add_plugin_option): New.
8557         * options.h (plugin_opt): New.
8558         (add_plugin): Change argument name.
8559         (add_plugin_option): New.
8560         * plugin.cc (Plugin::load): Don't parse the plugin option.
8561         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8562         (Plugin::add_option): New.
8563         (Plugin::args_): Change type.
8564         (Plugin::filename_): New.
8565         (Plugin_manager::add_plugin_option): New.
8566         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8567         * testsuite/Makefile.in: Regenerate.
8568
8569 2008-12-05  Cary Coutant  <ccoutant@google.com>
8570
8571         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8572         Handle --strip-lto-sections option.
8573         * options.h (strip_lto_sections): New option.
8574
8575 2008-12-01  Cary Coutant  <ccoutant@google.com>
8576
8577         * plugin.cc (ld_plugin_message): Change format parameter to const.
8578         Fix mismatch between new[] and delete.
8579
8580 2008-11-14  Cary Coutant  <ccoutant@google.com>
8581
8582         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8583         instead of -1U.
8584
8585 2008-11-05  Craig Silverstein  <csilvers@google.com>
8586
8587         * options.cc (General_options::parse_dynamic_list): New function.
8588         * options.h (General_options): New flags dynamic_list,
8589         dynamic_list_data, dynamic_list_cpp_new, and
8590         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8591         (General_options::in_dynamic_list): New function.
8592         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8593         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8594         (Lex::can_continue_name): Likewise.
8595         (yylex): Likewise.
8596         (read_script_file): New parameter script_options.
8597         (read_dynamic_list): New function.
8598         (Script_options::define_dynamic_list): New function.
8599         (dynamic_list_keyword_parsecodes): New variable.
8600         (dynamic_list_keywords): New variable.
8601         * script.h (Script_options::define_dynamic_list): New function
8602         prototype.
8603         (read_dynamic_list): New function prototype.
8604         * symtab.cc (strprefix): New macro.
8605         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8606         dynamic_list_data, dynamic_list_cpp_new, and
8607         dynamic_list_cpp_typeinfo.
8608         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8609         (dynamic_list_expr): New rule.
8610         (dynamic_list_nodes): Likewise.
8611         (dynamic_list_node): Likewise.
8612         * testsuite/Makefile.am (dynamic_list): New test.
8613         * testsuite/Makefile.in: Regenerated.
8614         * testsuite/dynamic_list.t: New file.
8615         * testsuite/dynamic_list.sh: New file.
8616
8617 2008-11-05  Craig Silverstein  <csilvers@google.com>
8618
8619         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8620         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8621         (t11_last): Likewise.
8622         * testsuite/ver_test_6.c (main): Likewise.
8623
8624 2008-10-07  Cary Coutant  <ccoutant@google.com>
8625
8626         * options.c (General_options::finalize): Add check for -static and
8627         -shared.
8628         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8629         is not empty.
8630
8631 2008-10-02  Cary Coutant  <ccoutant@google.com>
8632
8633         * plugin.cc (make_sized_plugin_object): Fix conditional
8634         compilation to work when not all targets are enabled.
8635
8636 2008-09-29  Cary Coutant  <ccoutant@google.com>
8637
8638         * archive.cc (Archive::get_file_and_offset): Use filename instead
8639         of name to get library path.
8640         (Archive::include_member): Unlock external member of a thin archive.
8641
8642         * testsuite/Makefile.am (TEST_AR): New variable.
8643         (thin_archive_test_1): New test.
8644         (thin_archive_test_2): New test.
8645         * testsuite/Makefile.in: Regenerate.
8646         * testsuite/thin_archive_main.cc: New file.
8647         * testsuite/thin_archive_test_1.cc: New file.
8648         * testsuite/thin_archive_test_2.cc: New file.
8649         * testsuite/thin_archive_test_3.cc: New file.
8650         * testsuite/thin_archive_test_4.cc: New file.
8651
8652 2008-09-29  Cary Coutant  <ccoutant@google.com>
8653
8654         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8655         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8656         instead of -1U.
8657         (Sized_relobj::do_finalize_local_symbols): Likewise.
8658         (Sized_relobj::map_to_kept_section): Likewise.
8659         * object.h (Sized_relobj::invalid_address): New constant.
8660         (Sized_relobj::do_output_section_offset): Check for invalid_address
8661         and return -1ULL.
8662         * output.cc (Output_reloc::local_section_offset): Use constant
8663         invalid_address instead of -1U.
8664         (Output_reloc::get_address): Likewise.
8665         (Output_section::output_address): Change -1U to -1ULL.
8666         * output.h (Output_reloc::invalid_address): New constant.
8667         * reloc.cc (Sized_relobj::write_sections): Use constant
8668         invalid_address instead of -1U.
8669         (Sized_relobj::relocate_sections): Likewise.
8670         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8671         values for merge sections.
8672         * target-reloc.h (relocate_for_relocatable): Use constant
8673         invalid_address instead of -1U.
8674
8675 2008-09-19  Cary Coutant  <ccoutant@google.com>
8676
8677         Add plugin functionality for link-time optimization (LTO).
8678         * configure.ac (plugins): Add --enable-plugins option.
8679         * configure: Regenerate.
8680         * config.in: Regenerate.
8681         * Makefile.am (LIBDL): New variable.
8682         (CCFILES): Add plugin.cc.
8683         (HFILES): Add plugin.h.
8684         (ldadd_var): Add LIBDL.
8685         * Makefile.in: Regenerate.
8686
8687         * archive.cc: Include "plugin.h".
8688         (Archive::setup): Don't preread archive symbols when using a plugin.
8689         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8690         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8691         files.
8692         (Archive::include_member): Add symbols from plugin objects.
8693         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8694         * descriptors.cc (Descriptors::open): Check for file descriptors
8695         abandoned by plugins.
8696         (Descriptors::claim_for_plugin): New function.
8697         * descriptors.h (Descriptors::claim_for_plugin): New function.
8698         (Open_descriptor::is_claimed): New field.
8699         (claim_descriptor_for_plugin): New function.
8700         * fileread.cc (File_read::claim_for_plugin): New function.
8701         * fileread.h (File_read::claim_for_plugin): New function.
8702         (File_read::descriptor): New function.
8703         * gold.cc: Include "plugin.h".
8704         (queue_initial_tasks): Add task to call plugin hooks for generating
8705         new object files.
8706         * main.cc: Include "plugin.h".
8707         (main): Load plugin libraries.
8708         * object.h (Pluginobj): Declare.
8709         (Object::pluginobj): New function.
8710         (Object::do_pluginobj): New function.
8711         (Object::set_target): New function.
8712         * options.cc: Include "plugin.h".
8713         (General_options::parse_plugin): New function.
8714         (General_options::General_options): Initialize plugins_ field.
8715         (General_options::add_plugin): New function.
8716         * options.h (Plugin_manager): Declare.
8717         (General_options): Add --plugin option.
8718         (General_options::has_plugins): New function.
8719         (General_options::plugins): New function.
8720         (General_options::add_plugin): New function.
8721         (General_options::plugins_): New field.
8722         * plugin.cc: New file.
8723         * plugin.h: New file.
8724         * readsyms.cc: Include "plugin.h".
8725         (Read_symbols::do_read_symbols): Check for archive before checking
8726         for ELF file.  Call plugin hooks to claim files.
8727         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8728         from a real object file; force override when processing replacement
8729         files.
8730         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8731         (Symbol::init_base_object): Likewise.
8732         (Symbol::init_base_output_data): Likewise.
8733         (Symbol::init_base_output_segment): Likewise.
8734         (Symbol::init_base_constant): Likewise.
8735         (Symbol::init_base_undefined): Likewise.
8736         (Symbol::output_section): Assert that object is not a plugin.
8737         (Symbol_table::add_from_pluginobj): New function.
8738         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8739         undefined.
8740         (Symbol_table::sized_write_globals): Likewise.
8741         (Symbol_table::add_from_pluginobj): Instantiate template.
8742         * symtab.h (Sized_pluginobj): Declare.
8743         (Symbol::in_real_elf): New function.
8744         (Symbol::set_in_real_elf): New function.
8745         (Symbol::in_real_elf_): New field.
8746         (Symbol_table::add_from_pluginobj): New function.
8747
8748         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8749         (LIBDL): New variable.
8750         (LDADD): Add LIBDL.
8751         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8752         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8753         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8754         (MOSTLYCLEANFILES): Likewise.
8755         * testsuite/Makefile.in: Regenerate.
8756         * testsuite/plugin_test.c: New file.
8757         * testsuite/plugin_test_1.sh: New file.
8758         * testsuite/plugin_test_2.sh: New file.
8759
8760 2008-09-16  Ian Lance Taylor  <iant@google.com>
8761
8762         * target-reloc.h (relocate_section): Check whether a symbol is
8763         defined by the ABI before reporting an undefined symbol error.
8764         * target.h (Target::is_defined_by_abi): Make parameter const.
8765         (Target::do_is_defined_by_abi): Likewise.
8766         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8767         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8768         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8769         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8770         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8771         * testsuite/Makefile.in: Rebuild.
8772
8773         * fileread.cc (make_view): Add casts to avoid warning.
8774
8775 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8776
8777         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8778         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8779
8780 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8781
8782         * options.h (General_options::output_is_executable): New.
8783         (General_options::output_is_pie): New.
8784         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8785         for shared libraries.
8786         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8787
8788 2008-09-11  Chris Demetriou  <cgd@google.com>
8789
8790         * options.h (origin): New -z option.
8791         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8792         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8793         in DT_FLAGS_1.
8794
8795 2008-09-05  Cary Coutant  <ccoutant@google.com>
8796
8797         * fileread.cc (File_read::make_view): Add check for attempt to map
8798         beyond end of file.
8799
8800 2008-09-05  Cary Coutant  <ccoutant@google.com>
8801
8802         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8803         explicit instantiations.
8804
8805 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
8806
8807         PR gold/6858
8808         * options.cc (General_options::finalize): Allow undefined symbols
8809         in shlibs if linking -shared.
8810
8811         PR gold/6859
8812         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8813         symbols as not needing a dynsym entry.
8814
8815 2008-08-20  Craig Silverstein  <csilvers@google.com>
8816
8817         * fileread.cc (File_read::open): Do not lock the file unless it
8818         was successfully opened.
8819
8820 2008-08-14  Cary Coutant  <ccoutant@google.com>
8821
8822         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8823         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8824         * testsuite/tls_test.cc (struct int128): 128-bit struct
8825         for testing TLS relocs with non-zero addend.
8826         (v12): New TLS variable.
8827         (t12): New test.
8828         (t_last): Add check for v12.
8829         * testsuite/tls_test.h (t12): New function.
8830         * testsuite/tls_test_main.cc (thread_routine): Call new test.
8831
8832 2008-08-13  Ian Lance Taylor  <iant@google.com>
8833
8834         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8835         set tls_segment_ or relro_segment_.
8836         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8837         when appropriate.
8838         * output.h (Output_section::clear_is_relro): New function.
8839         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8840         sections specially even when output_data_ is empty.
8841         (Output_segment::maximum_alignment): When first section is relro,
8842         only force alignment for PT_LOAD segments.
8843         * script.cc (script_data_segment_align): New function.
8844         (script_data_segment_relro_end): New function.
8845         * script-c.h (script_data_segment_align): Declare.
8846         (script_data_segment_relro_end): Declare.
8847         * script-sections.h (class Script_sections): Declare
8848         data_segment_align and data_segment_relro_end.  Add fields
8849         segment_align_index_ and saw_relro_end_.
8850         * script-sections.cc (class Sections_element): Add set_is_relro
8851         virtual function.  Add new bool* parameter to place_orphan_here.
8852         Add get_output_section virtual function.
8853         (class Output_section_definition): Add set_is_relro.  Add new
8854         bool* parameter to place_orphan_here.  Add get_output_section.
8855         Add is_relro_ field.
8856         (Output_section_definition::Output_section_definition): Initialize
8857         evaluated_address_, evaluated_load_address, evaluated_addralign_,
8858         and is_relro_ fields.
8859         (Output_section_definition::place_orphan_here): Add is_relro
8860         parameter.
8861         (Output_section_definition::set_section_addresses): Set relro for
8862         output section.
8863         (Output_section_definition::alternate_constraint): Likewise.
8864         (class Orphan_output_section): Add new bool* parameter to
8865         place_orphan_here.  Add get_output_section.
8866         (Orphan_output_section::place_orphan_here): Add is_relro
8867         parameter.
8868         (Script_sections::Script_sections): Initialize
8869         data_segment_align_index_ and saw_relro_end_.
8870         (Script_sections::data_segment_align): New function.
8871         (Script_sections::data_segment_relro_end): New function.
8872         (Script_sections::place_orphan): Set or clear is_relro.
8873         (Script_sections::set_section_addresses): Force alignment of first
8874         TLS section.
8875         * yyscript.y (exp): Call script_data_segment_align and
8876         script_data_segment_relro_end.
8877         * testsuite/relro_script_test.t: New file.
8878         * testsuite/relro_test.cc (using_script): Declare.
8879         (t1, t2): Test using_script.
8880         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8881         (relro_script_test_SOURCES): Define.
8882         (relro_script_test_DEPENDENCIES): Define.
8883         (relro_script_test_LDFLAGS): Define.
8884         (relro_script_test_LDADD): Define.
8885         (relro_script_test.so): New target.
8886         * testsuite/Makefile.in: Rebuild.
8887
8888 2008-08-06  Cary Coutant <ccoutant@google.com>
8889
8890         * archive.cc (Archive::total_archives, Archive::total_members)
8891         (Archive::total_members_loaded): New variables.
8892         (Archive::setup): Add parameter.  Add option to preread
8893         archive symbols.
8894         (Archive::read_armap): Add counter.
8895         (Archive::get_file_and_offset): New function.
8896         (Archive::get_elf_object_for_member): New function.
8897         (Archive::read_all_symbols): New function.
8898         (Archive::read_symbols): New function.
8899         (Archive::add_symbols): Add counters.
8900         (Archive::include_all_members): Use armap to find members if it's
8901         already built.
8902         (Archive::include_member): Skip reading symbols if already read.
8903         Factored code into Archive::get_file_and_offset and
8904         Archive::get_elf_object_for_member.  Changed call to
8905         Mapfile::report_include_archive_member.
8906         (Archive::print_stats): New function.
8907         * archive.h: Declare Object and Read_symbols_data classes.
8908         (Archive::Archive): Add initializers for new members.
8909         (Archive::setup): Add parameter.
8910         (Archive::print_stats): New function.
8911         (Archive::total_archives, Archive::total_members)
8912         (Archive::total_members_loaded): New variables.
8913         (Archive::get_file_and_offset): New function.
8914         (Archive::get_elf_object_for_member): New function.
8915         (Archive::read_all_symbols): New function.
8916         (Archive::read_symbols): New function.
8917         (Archive::Archive_member): New class.
8918         (Archive::members_): New member.
8919         (Archive::num_members_): New member.
8920         * main.cc: Include archive.h.
8921         (main): Call Archive::print_stats.
8922         * mapfile.cc (Mapfile::report_include_archive_member): Delete
8923         archive parameter; member_name is now the fully-decorated name.
8924         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8925         * options.h: (General_options): Add --preread-archive-symbols option.
8926         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8927         Archive::setup.
8928
8929 2008-08-04  Ian Lance Taylor  <iant@google.com>
8930
8931         * symtab.h (Symbol::use_plt_offset): New function.
8932         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8933         * powerpc.cc (Relocate::relocate): Likewise.
8934         * sparc.cc (Relocate::relocate): Likewise.
8935         * x86_64.cc (Relocate::relocate): Likewise.
8936         * testsuite/weak_plt.sh: New test.
8937         * testsuite/weak_plt_main.cc: New test.
8938         * testsuite/weak_plt_shared.cc: New test.
8939         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8940         (check_PROGRAMS): Add weak_plt.
8941         (check_DATA): Add weak_plt_shared.so.
8942         (weak_plt_main_pic.o, weak_plt): New targets.
8943         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8944         * testsuite/Makefile.in: Rebuild.
8945
8946         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8947         gcctestdir/ld.
8948         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8949         * testsuite/Makefile.in: Rebuild.
8950
8951 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
8952
8953         * Makefile.am (POTFILES.in): Set LC_ALL=C.
8954         * Makefile.in: Regenerate.
8955         * po/POTFILES.in: Regenerate.
8956
8957 2008-07-29  Ian Lance Taylor  <iant@google.com>
8958
8959         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8960         symbols before other symbols.
8961         * testsuite/script_test_2.cc (test_addr): Declare.
8962         (test_addr_alias): Declare.
8963         (main): Check that test_addr and test_addr_alias have the right
8964         values.
8965         * testsuite/script_test_2.t: Define test_addr_alias and
8966         test_addr.
8967
8968 2008-07-24  Ian Lance Taylor  <iant@google.com>
8969
8970         PR 5990
8971         * descriptors.cc: New file.
8972         * descriptors.h: New file.
8973         * gold-threads.h (class Hold_optional_lock): New class.
8974         * fileread.cc: Include "descriptors.h".
8975         (File_read::~File_read): Release descriptor rather than closing
8976         it.
8977         (File_read::open) [file]: Call open_descriptor rather than open.
8978         Set is_descriptor_opened_.
8979         (File_read::open) [memory]: Assert that descriptor is not open.
8980         (File_read::reopen_descriptor): New function.
8981         (File_read::release): Release descriptor.
8982         (File_read::do_read): Make non-const.  Reopen descriptor.
8983         (File_read::read): Make non-const.
8984         (File_read::make_view): Reopen descriptor.
8985         (File_read::do_readv): Likewise.
8986         * fileread.h (class File_read): Add is_descriptor_opened_ field.
8987         Update declarations.
8988         * layout.cc: Include "descriptors.h".
8989         (Layout::create_build_id): Use open_descriptor rather than open.
8990         * output.cc: Include "descriptors.h".
8991         (Output_file::open): Use open_descriptor rather than open.
8992         * archive.cc (Archive::const_iterator): Change Archive to be
8993         non-const.
8994         (Archive::begin, Archive::end): Make non-const.
8995         (Archive::count_members): Likewise.
8996         * archive.h (class Archive): Update declarations.
8997         * object.h (Object::read): Make non-const.
8998         * Makefile.am (CCFILES): Add descriptors.cc.
8999         (HFILES): Add descriptors.h.
9000         * Makefile.in: Rebuild.
9001
9002         PR 6716
9003         * gold.h: Always include <clocale>.  Add Solaris workarounds
9004         following code in binutils/sysdep.h.
9005
9006         PR 6048
9007         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9008         this->eh_frame_hdr_ is NULL before using it.
9009
9010         * dynobj.cc (Versions::Versions): Update comment.
9011
9012         * dynobj.cc (Versions::Versions): If there is an soname, use it as
9013         the base version name.
9014
9015         * stringpool.cc (Stringpool_template::add_with_length): Set key to
9016         array size plus one.
9017         (Stringpool_template::set_string_offsets): Subtract one from key
9018         before using it as an array index.
9019         (Stringpool_template::get_offset_with_length): Likewise.
9020         (Stringpool_template::write_to_buffer): Likewise.
9021         * stringpool.h (Stringpool_template::get_offset_from_key):
9022         Likewise.
9023
9024 2008-07-23  Ian Lance Taylor  <iant@google.com>
9025
9026         PR 6658
9027         * object.h (Merged_symbol_value::value): Do our best to handle a
9028         negative addend.
9029
9030         PR 6647
9031         * script.cc (Version_script_info::get_versions): Don't add empty
9032         version tag to return value.
9033         (Version_script_info::get_symbol_version_helper): Change return
9034         type to bool.  Add pversion parameter.  Change all callers.
9035         (script_register_vers_node): Don't require a non-NULL tag.
9036         * script.h (class Version_script_info): Update declarations.
9037         (Version_script_info::get_symbol_version): Change return type to
9038         bool.  Add version parameter.  Change all callers.
9039         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9040         handling.  Handle an empty version from a version script.
9041         (Symbol_table::define_special_symbol): Likewise.
9042         * testsuite/ver_test_10.script: New file.
9043         * testsuite/ver_test_10.sh: New file.
9044         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9045         (check_DATA): Add ver_test_10.syms.
9046         (ver_test_10.syms, ver_test_10.so): New target.
9047         * testsuite/Makefile.in: Rebuild.
9048
9049 2008-07-23  Simon Baldwin  <simonb@google.com>
9050
9051         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9052         to zero for undefined symbols from dynamic libraries.
9053
9054 2008-07-23  Ian Lance Taylor  <iant@google.com>
9055
9056         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9057         Change all callers.
9058         * symtab.h (class Symbol_table): Update declaration.
9059         * testsuite/ver_test_9.cc: New file.
9060         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9061         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9062         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9063         (ver_test_9.so, ver_test_9.o): New targets.
9064         * testsuite/Makefile.in: Rebuild.
9065
9066 2008-07-22  Ian Lance Taylor  <iant@google.com>
9067
9068         * options.h (class General_options): Define --check-sections.
9069         * layout.cc (Layout::set_segment_offsets): Handle
9070         --check-sections.
9071
9072         * options.h (class General_options): Define -n/--nmagic and
9073         -N/--omagic.
9074         * options.cc (General_options::finalize): For -n/--nmagic or
9075         -N/--omagic, set -static.
9076         * layout.cc (Layout::attach_allocated_section_to_segment): If
9077         -N/--omagic, don't put read-only and read-write sections in
9078         different segments.
9079         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9080         finding a read-only segment.
9081         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9082         don't set the minimum segment alignment to the common page size,
9083         and don't set the file offset to the address modulo the page size.
9084         * script-sections.cc (Script_sections::create_segments): If
9085         -n/--omagic, don't put read-only and read-write sections in
9086         different segments.
9087
9088         * cref.cc: New file.
9089         * cref.h: New file.
9090         * options.h (class General_options): Add --print-symbol-counts.
9091         * main.cc (main): Issue defined symbol report if requested.
9092         * archive.cc (Archive::interpret_header): Make into a const member
9093         function.
9094         (Archive::add_symbols): Call Input_objects::archive_start and
9095         archive_stop.
9096         (Archive::const_iterator): Define new class.
9097         (Archive::begin, Archive::end): New functions.
9098         (Archive::include_all_members): Rewrite to use iterator.
9099         (Archive::count_members): New function.
9100         * archive.h (class Archive): Update declarations.
9101         (Archive::filename): New function.
9102         * object.cc: Include "cref.h".
9103         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9104         (Sized_relobj::do_get_global_symbol_counts): New function.
9105         (Input_objects::add_object): Add object to cross-referencer.
9106         (Input_objects::archive_start): New function.
9107         (Input_objects::archive_stop): New function.
9108         (Input_objects::print_symbol_counts): New function.
9109         * object.h: Declare Cref and Archive.
9110         (Object::get_global_symbol_counts): New function.
9111         (Object::do_get_global_symbol_counts): New pure virtual function.
9112         (class Sized_relobj): Add defined_count_ field.  Update
9113         declarations.
9114         (class Input_objects): Add cref_ field.  Update constructor.
9115         Update declarations.
9116         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9117         defined_count_.
9118         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9119         symbol counts.
9120         (Sized_dynobj::do_get_global_symbol_counts): New function.
9121         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9122         defined_count_.  Update declarations.  Define Symbols typedef.
9123         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9124         parameter.  Change all callers.
9125         (Symbol_table::add_from_dynobj): Add sympointers and defined
9126         parameters.  Change all callers.
9127         * symtab.h (class Symbol_table): Update declarations.
9128         * Makefile.am (CCFILES): Add cref.cc.
9129         (HFILES): Add cref.h.
9130         * Makefile.in: Rebuild.
9131
9132 2008-07-22  Simon Baldwin  <simonb@google.com>
9133
9134         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9135         to zero when writing undefined symbols.
9136
9137 2008-07-22  Ian Lance Taylor  <iant@google.com>
9138
9139         * output.cc (Output_section::add_input_section): Don't try to
9140         merge empty merge sections.
9141
9142 2008-07-21  Craig Silverstein  <csilvers@google.com>
9143
9144         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9145         Include symbol version in error message.
9146
9147 2008-07-20  Chris Demetriou  <cgd@google.com>
9148
9149         * configure.ac (gold_cv_c_random_seed): New configured variable.
9150         (RANDOM_SEED_CFLAGS): New substituted variable.
9151         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9152         * configure: Rebuild.
9153         * Makefile.in: Likewise.
9154         * testsuite/Makefile.in: Likewise.
9155
9156 2008-07-18  Ian Lance Taylor  <iant@google.com>
9157
9158         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9159         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9160         * testsuite/ver_test_main.cc (main): Call t4.
9161         (t4, t4_2a): Define.
9162         * testsuite/ver_test_2.cc (t4_2): Define.
9163         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9164         * testsuite/ver_test_4.cc (t4_2a): Define.
9165         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9166         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9167
9168 2008-07-17  Ian Lance Taylor  <iant@google.com>
9169
9170         * dynobj.cc (Versions::add_def): If we give an error about a
9171         missing version, go ahead and create the version anyhow.
9172
9173 2008-07-10  Ian Lance Taylor  <iant@google.com>
9174
9175         Handle output sections with more than 0x7fffffff bytes.
9176         * object.h (class Relobj): Change map_to_output_ to
9177         output_sections_, and just keep a section pointer.  Change all
9178         uses.  Move comdat group support to Sized_relobj.
9179         (Relobj::is_section_specially_mapped): Remove.
9180         (Relobj::output_section): Remove poff parameter.  Change all
9181         callers.
9182         (Relobj::output_section_offset): New function.
9183         (Relobj::set_section_offset): Rewrite.
9184         (Relobj::map_to_output): Remove.
9185         (Relobj::output_sections): New function.
9186         (Relobj::do_output_section_offset): New pure virtual function.
9187         (Relobj::do_set_section_offset): Likewise.
9188         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9189         group support from Relobj.  Update declarations.
9190         (Sized_relobj::get_output_section_offset): New function.
9191         (Sized_relobj::do_output_section_offset): New function.
9192         (Sized_relobj::do_set_section_offset): New function.
9193         * object.cc (Relobj::output_section_address): Remove.
9194         (Sized_relobj::Sized_relobj): Initialize new fields.
9195         (Sized_relobj::include_section_group): Cast find_kept_object to
9196         Sized_relobj.
9197         (Sized_relobj::include_linkonce_section): Likewise.
9198         (Sized_relobj::do_layout): Use separate arrays for output section
9199         and output offset.
9200         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9201         output_sections.
9202         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9203         output_sections and section_offsets.
9204         (Sized_relobj::write_local_symbols): Likewise.
9205         (map_to_kept_section): Compute output address directly.
9206         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9207         output_sections and section_offsets.
9208         (Sized_relobj::write_sections): Likewise.
9209         (Sized_relobj::relocate_sections): Likewise.
9210         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9211         * output.h (class Output_reloc): Update declarations.  Change
9212         u2_.relobj to Sized_relobj*.
9213         (class Output_data_reloc): Change add functions to use
9214         Sized_relobj*.
9215         * output.cc (Output_reloc::Output_reloc): Change relobj to
9216         Sized_relobj*.
9217         (Output_reloc::local_section_offset): Change return type to
9218         Elf_Addr.  Use get_output_section_offset.
9219         (Output_reloc::get_address): Likewise.
9220         (Output_section::is_input_address_mapped): Don't call
9221         is_section_specially_mapped.
9222         (Output_section::output_offset): Likewise.
9223         (Output_section::output_address): Likewise.
9224         (Output_section::starting_output_address): Likewise.
9225         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9226         parameter to Sized_relobj*.
9227         (Copy_relocs::need_copy_reloc): Likewise.
9228         (Copy_relocs::save): Likewise.
9229         * copy-relocs.h (class Copy_relocs): Update declarations.
9230         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9231         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9232         * target-reloc.h (relocate_for_relocatable): Change
9233         offset_in_output_section type to Elf_Addr.  Change code that uses
9234         it as well.
9235         * layout.cc (Layout::layout): Always set *off.
9236         * mapfile.cc (Mapfile::print_input_section): Use
9237         output_section_offset.
9238         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9239         Sized_relobj*.
9240         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9241         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9242         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9243
9244 2008-07-03  Ian Lance Taylor  <iant@google.com>
9245
9246         * layout.cc (Layout::include_section): Do not discard unrecognized
9247         SHT_STRTAB sections.
9248
9249 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9250
9251         * script.cc (Lex::can_continue_name): Make '?' allowable in
9252         version-script names.
9253         * testsuite/version_script.map: Change glob pattern to use '?'
9254
9255 2008-06-30  Manish Singh  <yosh@gimp.org>
9256
9257         PR 6585
9258         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9259         Correct typo.
9260
9261 2008-06-30  Ian Lance Taylor  <iant@google.com>
9262
9263         PR 6660
9264         PR 6682
9265         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9266         versions]: Don't try to read the value in the contents, since we
9267         don't use it.  Use the template endianness when writing.
9268
9269 2008-06-25  Cary Coutant  <ccoutant@google.com>
9270
9271         * fileread.cc (File_read::make_view): Assert on zero-length view.
9272         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9273         symbol table when there are no symbols to read.
9274
9275 2008-06-23  Craig Silverstein  <csilvers@google.com>
9276
9277         * version.cc (version_string): Bump to 1.7
9278
9279 2008-06-18  Craig Silverstein  <csilvers@google.com>
9280
9281         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9282         constant 0xFFFF to type Valtype.
9283         (Powerpc_relocate_functions::rel16_ha): Likewise.
9284
9285 2008-06-17  Ian Lance Taylor  <iant@google.com>
9286
9287         * output.h (Output_section::Input_section): Initialize p2align_ to
9288         zero for Output_section_data constructors.
9289         (Output_section::Input_section::addralign): If not an input
9290         section, return the alignment of the Output_section_data.
9291         * testsuite/copy_test.cc: New file.
9292         * testsuite/copy_test_1.cc: New file.
9293         * testsuite/copy_test_2.cc: New file.
9294         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9295         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9296         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9297         (copy_test_1_pic.o, copy_test_1.so): New targets.
9298         (copy_test_2_pic.o, copy_test_2.so): New targets.
9299         * testsuite/Makefile.in: Rebuild.
9300
9301         * script-sections.cc (Script_sections::place_orphan): Initialize
9302         local variable exact.
9303
9304 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9305
9306         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9307
9308 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9309             David S. Miller  <davem@davemloft.net>
9310
9311         * powerpc.cc: New file.
9312         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9313         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9314         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9315         * Makefile.in: Rebuild.
9316
9317 2008-06-09  Ian Lance Taylor  <iant@google.com>
9318
9319         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9320         <exception>.
9321         (throwing, orig_terminate): New static variables.
9322         (terminate_handler): New static function.
9323         (t2): Set terminate handler.
9324
9325 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9326
9327         PR 6584
9328         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9329         alignment.
9330
9331 2008-05-30  Cary Coutant  <ccoutant@google.com>
9332
9333         * archive.cc (Archive::include_all_members) Correct to step
9334         over symbol table and extended name table in thin archives.
9335
9336 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9337
9338         PR 6407
9339         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9340         calculation.
9341
9342 2008-05-28  Caleb Howe  <cshowe@google.com>
9343
9344         * reduced_debug_output.cc: New file.
9345         * reduced_debug_output.h: New file.
9346         * options.h (class General_options): Add --strip-debug-non-line.
9347         * options.cc (General_options::finalize): Add strip_debug_non_line
9348         to the strip heirarchy.
9349         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9350         fields.
9351         * layout.cc: Include "reduced_debug_output.h".
9352         (Layout::Layout): Initialize new fields.
9353         (line_only_debug_sections): New static array.
9354         (is_lines_only_debug_sections): New static inline function.
9355         (Layout::include_section): Handle --strip-debug-non-line.
9356         (Layout::make_output_section): If --strip-debug-non-line, build
9357         new output sections for .debug_abbrev and .debug_info.
9358         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9359         gold.  Warn about possible overflow.
9360         (read_signed_LEB_128): Likewise.
9361         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9362         (read_signed_LEB_128): Declare.
9363         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9364         (HFILES): Add reduced_debug_output.h.
9365         * Makefile.in: Rebuild.
9366
9367 2008-05-21  Ian Lance Taylor  <iant@google.com>
9368
9369         * mapfile.cc: New file.
9370         * mapfile.h: New file.
9371         * options.h (class General_options): Add -M/--print-map and -Map.
9372         * options.cc (General_options::finalize): Make -M equivalent to
9373         -Map -.
9374         * main.cc: Include <cstdio> and "mapfile.h".
9375         (main): Open mapfile if requested.
9376         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9377         constructor.  Change caller.
9378         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9379         (queue_middle_tasks): Likewise.
9380         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9381         declarations.
9382         * archive.cc: Include "mapfile.h".
9383         (Archive::add_symbols): Add mapfile parameter.  Change all
9384         callers.  Pass mapfile, symbol, and reason to include_member.
9385         (Archive::include_all_members): Add mapfile parameter.  Change all
9386         callers.
9387         (Archive::include_member): Add mapfile, sym, and why parameters.
9388         Change all callers.  Report inclusion to map file.
9389         * archive.h: Include "fileread.h".
9390         (class Archive): Update declarations.
9391         (Archive::file): New const method.
9392         (class Add_archive_symbols): Add mapfile_ field.  Update
9393         constructor.  Change all callers.
9394         * readsyms.h (class Read_symbols): Likewise.
9395         (class Finish_group): Likewise.
9396         (class Read_script): Likewise.
9397         * common.cc: Include "mapfile.h".
9398         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9399         all callers.
9400         (Symbol_table::do_allocate_commons): Likewise.
9401         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9402         symbol allocation to mapfile.
9403         * common.h (class Allocate_commons_task): Add mapfile_ field.
9404         Update constructor.  Change all callers.
9405         * symtab.h (class Symbol_table): Update declarations.
9406         * layout.cc: Include "mapfile.h".
9407         (Layout_task_runner::run): Print information to mapfile.
9408         (Layout::create_gold_note): Change Output_data_fixed_space to
9409         Output_data_zero_fill.
9410         (Layout::create_build_id): Likewise.
9411         (Layout::print_to_mapfile): New function.
9412         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9413         constructor.  Change caller.
9414         (class Layout): Declare print_to_mapfile.
9415         * output.cc (Output_section::Input_section::print_to_mapfile): New
9416         function.
9417         (Output_section::add_input_section): If producing a map, always
9418         add to input_sections_ list.
9419         (Output_section::do_print_to_mapfile): New function.
9420         (Output_segment::print_sections_to_mapfile): New function.
9421         (Output_segment::print_section_list_to_mapfile): New function.
9422         * output.h: Include "mapfile.h".
9423         (Output_data::print_to_mapfile): New function.
9424         (Output_data::do_print_to_mapfile): New virtual function.
9425         (Output_segment_headers::do_print_to_mapfile): New function.
9426         (Output_file_header::do_print_to_mapfile): New function.
9427         (Output_data_const::do_print_to_mapfile): New function.
9428         (class Output_data_const_buffer): Add map_name_ field.  Update
9429         constructor.  Change all callers.  Add do_print_to_mapfile
9430         function.
9431         (class Output_data_fixed_space): Likewise.
9432         (class Output_data_space): Likewise.
9433         (class Output_data_zero_fill): New class.
9434         (Output_data_strtab::do_print_to_mapfile): New function.
9435         (Output_data_reloc_base::do_print_to_mapfile): New function.
9436         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9437         (Output_data_group::do_print_to_mapfile): New function.
9438         (Output_data_got::do_print_to_mapfile): New function.
9439         (Output_data_dynamic::do_print_to_mapfile): New function.
9440         (Output_symtab_xindex::do_print_to_mapfile): New function.
9441         (class Output_section): Declare do_print_to_mapflie.  Declare
9442         print_to_mapfile in Input_section.
9443         (class Output_segment): Declare new functions.
9444         * object.h (Sized_relobj::symbol_count): New function.
9445         * script-sections.cc
9446         (Output_section_element_dot_assignment::set_section_addresses):
9447         Change Output_data_fixed_space to Output_data_zero_fill.
9448         (Output_data_expression::do_print_to_mapfile): New function.
9449         * script.cc (read_input_script): Add mapfile parameter.  Change
9450         all callers.
9451         * script.h (read_input_script): Update declaration.
9452         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9453         (Eh_frame::do_print_to_mapfile): New function.
9454         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9455         (Output_merge_string::do_print_to_mapfile): New function.
9456         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9457         function.
9458         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9459         function.
9460         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9461         function.
9462         * Makefile.am (CCFILES): Add mapfile.cc.
9463         (HFILES): Add mapfile.h.
9464         * Makefile.in: Rebuild.
9465
9466 2008-05-19  Ian Lance Taylor  <iant@google.com>
9467
9468         * options.h (class General_options): Add -z relro.
9469         * layout.cc (Layout::Layout): Initialize relro_segment_.
9470         (Layout::add_output_section_data): Return the output section.
9471         (Layout::make_output_section): Rcognize relro sections and mark
9472         them appropriately.
9473         (Layout::attach_allocated_section_to_segment): Put relro sections
9474         in a PT_GNU_RELRO segment.
9475         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9476         section as relro.
9477         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9478         PT_TLS segments.
9479         (Layout::linkonce_mapping): Map d.rel.ro.local to
9480         .data.rel.ro.local.
9481         (Layout::output_section_name): Us .data.rel.ro.local for any
9482         section which begins with that.
9483         * layout.h (class Layout): Update add_output_section_data
9484         declaration.  Add relro_segment_ field.
9485         * output.cc (Output_section::Output_section): Initialize is_relro_
9486         and is_relro_local_ fields.
9487         (Output_segment::add_output_section): Group relro sections.
9488         (Output_segment::is_first_section_relro): New function.
9489         (Output_segment::maximum_alignment): If there is a relro section,
9490         align the segment to the common page size.
9491         (Output_segment::set_section_addresses): Track whether we are
9492         looking at relro sections.  If the last section is a relro
9493         section, align to the common page size.
9494         (Output_segment::set_section_list_addresses): Add in_relro
9495         parameter.  Change all callers.  Align to the page size when
9496         moving from relro to non-relro section.
9497         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9498         segment.
9499         * output.h (class Output_section): Add is_relro_ and
9500         is_relro_local_ fields.
9501         (Output_section::is_relro): New function.
9502         (Output_section::set_is_relro): New function.
9503         (Output_section::is_relro_local): New function.
9504         (Output_section::set_is_relro_local): New function.
9505         (class Output_segment): Update declarations.
9506         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9507         * sparc.cc (Target_sparc::got_section): Likewise.
9508         * x86_64.cc (Target_x86_64::got_section): Likewise.
9509         * testsuite/relro_test_main.cc: New file.
9510         * testsuite/relro_test.cc: New file.
9511         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9512         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9513         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9514         (relro_test.so, relro_test_pic.o): New targets.
9515         * testsuite/Makefile.in: Rebuild.
9516
9517 2008-05-16  Ian Lance Taylor  <iant@google.com>
9518
9519         * output.cc (Output_segment::add_output_section): Remove front
9520         parameter.
9521         * output.h (class Output_segment): Remove
9522         add_initial_output_section and overloaded add_output_section.
9523         Update declaration of remaining add_output_section.
9524         * layout.cc (Layout::create_interp): Call add_output_section
9525         rather than add_initial_output_section.
9526         (Layout::finish_dynamic_section): Likewise.
9527
9528         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9529         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9530         know the dynamic type.
9531         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9532         field.  Initialize it in constructor.
9533         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9534         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9535         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9536         reloc.
9537
9538         * output.cc (Output_reloc::get_address): Change return type to
9539         Elf_Addr.
9540         * output.h (class Output_reloc): Update get_address declaration.
9541         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9542         for section addresses.
9543
9544 2008-05-09  Ian Lance Taylor  <iant@google.com>
9545
9546         PR 6493
9547         * gold.cc (gold_nomem): Use return value of write.
9548
9549 2008-05-08  Ian Lance Taylor  <iant@google.com>
9550
9551         * symtab.c (Symbol::init_base_output_data): Add version
9552         parameter.  Change all callers.
9553         (Symbol::init_base_output_segment): Likewise.
9554         (Symbol::init_base_constant): Likewise.
9555         (Symbol::init_base_undefined): Likewise.
9556         (Sized_symbol::init_output_data): Likewise.
9557         (Sized_symbol::init_output_segment): Likewise.
9558         (Sized_symbol::init_constant): Likewise.
9559         (Sized_symbol::init_undefined): Likewise.
9560         (Symbol_table::do_define_in_output_data): If the new symbol has a
9561         version, mark it as the default.
9562         (Symbol_table::do_define_in_output_segment): Likewise.
9563         (Symbol_table::do_define_as_constant): Likewise.
9564         * symtab.h (class Symbol): Update declarations.
9565         (class Sized_symbol): Likewise.
9566         * resolve.cc (Symbol::override_version): New function.
9567         (Symbol::override_base): Call override_version.
9568         (Symbol::override_base_with_special): Likewise.
9569         * testsuite/ver_script_8.script: New file.
9570         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9571         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9572         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9573         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9574
9575 2008-05-06  Ian Lance Taylor  <iant@google.com>
9576
9577         PR 6049
9578         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9579         functions.
9580         (class General_options): Remove existing --undefined, and add
9581         --no-undefined instead.  Add new --undefined as synonym for -u.
9582         * archive.cc (Archive::add_symbols): Check whether symbol was
9583         named with -u.
9584         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9585         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9586         all uses.  Add IS_UNDEFINED.  Update declarations to split
9587         different versions of init_base.  Declare init_base_undefined.
9588         (Symbol::is_defined): Handle IS_UNDEFINED.
9589         (Symbol::is_undefined): Likewise.
9590         (Symbol::is_weak_undefined): Call is_undefined.
9591         (Symbol::is_absolute): Handle IS_CONSTANT.
9592         (class Sized_symbol): Update declarations to split different
9593         versions of init.  Declare init_undefined.
9594         (class Symbol_table): Declare new functions.
9595         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9596         Change all callers.
9597         (Symbol::init_base_output_data): Likewise.
9598         (Symbol::init_base_output_segment): Likewise.
9599         (Symbol::init_base_constant): Likewise.
9600         (Symbol::init_base_undefined): New function.
9601         (Sized_symbol::init_object): Rename from init.  Change all
9602         callers.
9603         (Sized_symbol::init_output_data): Likewise.
9604         (Sized_symbol::init_output_segment): Likewise.
9605         (Sized_symbol::init_constant): Likewise.
9606         (Sized_symbol::init_undefined): New function.
9607         (Symbol_table::add_undefined_symbols_from_command_line): New
9608         function.
9609         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9610         function.
9611         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9612         (Symbol::output_section): Likewise.
9613         (Symbol::set_output_section): Likewise.
9614         (Symbol_table::sized_finalize_symbol): Likewise.
9615         (Symbol_table::sized_write_globals): Likewise.
9616         * resolve.cc (Symbol_table::should_override): Likewise.
9617         (Symbol::override_base_with_special): Likewise.
9618
9619         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9620         symbol, change it to have default visibility.
9621         * testsuite/protected_1.cc: New file.
9622         * testsuite/protected_2.cc: New file.
9623         * testsuite/protected_3.cc: New file.
9624         * testsuite/protected_main_1.cc: New file.
9625         * testsuite/protected_main_2.cc: New file.
9626         * testsuite/protected_main_3.cc: New file.
9627         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9628         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9629         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9630         (protected_1.so): New target.
9631         (protected_1_pic.o, protected_2_pic.o): New targets.
9632         (protected_3_pic.o): New target.
9633         (check_PROGRAMS): Add protected_2.
9634         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9635         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9636         * testsuite/Makefile.in: Rebuild.
9637
9638         * options.h (DEFINE_var): Add set_user_set_##varname__.
9639         (DEFINE_bool_alias): New macro.
9640         (class General_options): Define -Bstatic using DEFINE_bool_alias
9641         rather than DEFINE_special.  Add --undefined as an alias for -z
9642         defs.
9643         * options.cc (General_options::parse_Bstatic): Remove.
9644
9645         * options.h (class General_options): Add --fatal-warnings.
9646         * main.cc (main): Implement --fatal-warnings.
9647         * errors.h (Errors::warning_count): New function.
9648
9649         * options.h (class General_options): Add -Bsymbolic-functions.
9650         * symtab.h (Symbol::is_preemptible): Check for
9651         -Bsymbolic-functions.
9652
9653 2008-05-05  Ian Lance Taylor  <iant@google.com>
9654
9655         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9656         as noVARNAME rather than no-VARNAME.
9657         (class General_options): Add option -z combreloc.
9658         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9659         get_address.
9660         (Output_reloc::sort_before) [SHT_REL]: New function.
9661         (Output_reloc::sort_before) [SHT_RELA]: New function.
9662         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9663         Sort_relocs_comparison.
9664         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9665         parameter.  Change all callers.
9666         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9667         sort_relocs parameter.  Change all callers.
9668         * output.cc (Output_reloc::get_address): New function, broken out
9669         of write_rel.
9670         (Output_reloc::write_rel): Call it.
9671         (Output_reloc::compare): New function.
9672         (Output_data_reloc_base::do_write): Optionally sort relocs.
9673
9674         * configure.ac: If targ_extra_obj is set, link it in.
9675         * configure.tgt: Initialize all variables.
9676         (x86_64*): Set targ_extra_obj and targ_extra_size.
9677         * configure: Rebuild.
9678
9679         * object.cc (Sized_relobj::include_section_group): Adjust section
9680         indexes read from group data.  Build vector to pass to
9681         layout_group.
9682         * layout.cc (Layout::layout_group): Add flags and shndxes
9683         parameters.  Remove contents parameter.  Change caller.  Update
9684         explicit instantiations.
9685         * layout.h (class Layout): Update layout_group declaration.
9686         * output.cc (Output_data_group::Output_data_group): Add flags and
9687         input_shndxes parameters.  Remove contents parameter.  Change
9688         caller.
9689         (Output_data_group::do_write): Change input_sections_ to
9690         input_shndxes_.
9691         * output.h (class Output_data_group): Update constructor
9692         declaration.  Rename input_sections_ to input_shndxes_.
9693         * testsuite/many_sections_test.cc: Add template.
9694
9695 2008-04-30  Cary Coutant  <ccoutant@google.com>
9696
9697         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9698
9699         * layout.cc (Layout::include_section): Refactored check for debug
9700         info section.
9701         (Layout::add_comdat): Add new parameters.  Change type
9702         of signature parameter.  Add object and shndx to signatures table.
9703         (Layout::find_kept_object): New function.
9704         * layout.h: Include <cstring>.
9705         (Layout::is_debug_info_section): New function.
9706         (Layout::add_comdat): Add new parameters.
9707         (Layout::find_kept_object): New function.
9708         (Layout::Kept_section): New struct.
9709         (Layout::Signatures): Change type of map range.
9710         * object.cc (Relobj::output_section_address): New function.
9711         (Sized_relobj::include_section_group): Add new parameters.  Change
9712         calls to Layout::add_comdat.  Change to build table of kept comdat
9713         groups and table mapping discarded sections to kept sections.
9714         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9715         (Sized_relobj::do_layout): Change calls to include_section_group and
9716         include_linkonce_section.
9717         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9718         value to zero when section is discarded.
9719         (Sized_relobj::map_to_kept_section): New function.
9720         * object.h (Relobj::output_section_address): New function.
9721         (Relobj::Comdat_group): New type.
9722         (Relobj::find_comdat_group): New function.
9723         (Relobj::Comdat_group_table): New type.
9724         (Relobj::Kept_comdat_section): New type.
9725         (Relobj::Kept_comdat_section_table): New type.
9726         (Relobj::add_comdat_group): New function.
9727         (Relobj::set_kept_comdat_section): New function.
9728         (Relobj::get_kept_comdat_section): New function.
9729         (Relobj::comdat_groups_): New field.
9730         (Relobj::kept_comdat_sections_): New field.
9731         (Symbol_value::input_value): Update comment.
9732         (Sized_relobj::map_to_kept_section) New function.
9733         (Sized_relobj::include_linkonce_section): Add new parameter.
9734         * target-reloc.h (Comdat_behavior): New type.
9735         (get_comdat_behavior): New function.
9736         (relocate_section): Add code to map a discarded section to the
9737         corresponding kept section when applying a relocation.
9738
9739 2008-04-30  Craig Silverstein  <csilvers@google.com>
9740
9741         * dwarf_reader.cc (next_generation_count): New static var.
9742         (Addr2line_cache_entry): New struct.
9743         (addr2line_cache): New static var.
9744         (Dwarf_line_info::one_addr2line): Added caching.
9745         (Dwarf_line_info::clear_addr2line_cache): New function.
9746         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9747         cache-size parameter.
9748         (Dwarf_line_info::one_addr2line_cache): New function.
9749         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9750         new cache-size argument to one_addr2line(), and clear cache.
9751
9752 2008-04-28  Cary Coutant  <ccoutant@google.com>
9753
9754         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9755         R_386_PC8 relocations.
9756
9757 2008-04-23  Ian Lance Taylor  <iant@google.com>
9758
9759         * object.cc (Sized_relobj::include_section_group): Check for
9760         invalid section group.
9761
9762         * object.cc (make_elf_object): Correct test for 64-bit ELF file
9763         header size.
9764
9765         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9766         than read for file header.
9767         * archive.cc (Archive::include_member): Likewise.
9768
9769 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
9770
9771         * aclocal.m4: Regenerate.
9772         * configure: Regenerate.
9773
9774 2008-04-19  Ian Lance Taylor  <iant@google.com>
9775
9776         * version.cc (version_string): Bump to 1.6.
9777
9778         * testsuite/Makefile.am (many_sections_r_test): New target.
9779         (many_sections_r_test_SOURCES): Remove.
9780         (many_sections_r_test_DEPENDENCIES): Remove.
9781         (many_sections_r_test_LDFLAGS): Remove.
9782         (many_sections_r_test_LDADD): Remove.
9783
9784         * object.cc (Sized_relobj::do_add_symbols): Always pass
9785         local_symbol_count_ to add_from_relobj.
9786
9787         * testsuite/Makefile.am (many_sections_check.h): Only check one in
9788         every thousand variables.
9789         * testsuite/Makefile.in: Rebuild.
9790
9791         * object.cc (Xindex::initialize_symtab_xindex): New function.
9792         (Xindex::read_symtab_xindex): New function.
9793         (Xindex::sym_xindex_to_shndx): New function.
9794         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9795         available.
9796         (Sized_relobj::do_initialize_xindex): New function.
9797         (Sized_relobj::do_read_symbols): Adjust section links.
9798         (Sized_relobj::symbol_section_and_value): Add is_ordinary
9799         parameter.  Change all callers.
9800         (Sized_relobj::include_section_group): Adjust section links and
9801         symbol section indexes.
9802         (Sized_relobj::do_layout): Adjust section links.
9803         (Sized_relobj::do_count_local_symbols): Adjust section links and
9804         symbol section indexes.
9805         (Sized_relobj::do_finalize_local_symbols): Distinguish between
9806         ordinary and special symbols.
9807         (Sized_relobj::write_local_symbols): Add symtab_xindex and
9808         dynsym_xindex parameters.  Change all callers.  Adjust section
9809         links.  Use SHN_XINDEX when needed.
9810         (Sized_relobj::get_symbol_location_info): Adjust section links.
9811         Don't get fooled by special symbols.
9812         * object.h (class Xindex): Define.
9813         (class Object): Add xindex_ parameter.  Declare virtual functoin
9814         do_initialize_xindex.
9815         (Object::adjust_sym_shndx): New function.
9816         (Object::set_xindex): New protected function.
9817         (class Symbol_value): Add is_ordinary_shndx_ field.
9818         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9819         (Symbol_value::value): Assert ordinary section.
9820         (Symbol_value::initialize_input_to_output_map): Likewise.
9821         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9822         Change all callers.
9823         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
9824         all callers.
9825         (class Sized_relobj): Update declarations.
9826         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9827         parameter.  Change all callers.
9828         (Sized_relobj::adjust_shndx): New function.
9829         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9830         field.
9831         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9832         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
9833         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
9834         (Sized_dynobj::read_dynsym_section): Adjust section links.
9835         (Sized_dynobj::read_dynamic): Likewise.
9836         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
9837         section links.
9838         (Sized_dynobj::do_initialize_xindex): New function.
9839         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
9840         do_initialize_xindex.
9841         (Sized_dynobj::adjust_shndx): New function.
9842         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9843         dynsym_xindex_ fields.
9844         (Layout::finalize): Add a call to set_section_indexes before
9845         creating the symtab sections.
9846         (Layout::set_section_indexes): Don't do anything if the section
9847         already has a section index.
9848         (Layout::create_symtab_sections): Add shnum parameter.  Change
9849         caller.  Create .symtab_shndx section if needed.
9850         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
9851         caller.
9852         (Layout::allocated_output_section_count): New function.
9853         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9854         needed.
9855         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9856         fields.  Update declarations.
9857         (Layout::symtab_xindex): New function.
9858         (Layout::dynsym_xindex): New function.
9859         (class Write_symbols_task): Add layout_ field.
9860         (Write_symbols_task::Write_symbols_task): Add layout parameter.
9861         Change caller.
9862         * output.cc (Output_section_headers::Output_section_headers): Add
9863         shstrtab_section parameter.  Change all callers.
9864         (Output_section_headers::do_sized_write): Store overflow values
9865         for section count and section string table section index in
9866         section header zero.
9867         (Output_file_header::do_sized_write): Check for overflow of
9868         section count and section string table section index.
9869         (Output_symtab_xindex::do_write): New function.
9870         (Output_symtab_xindex::endian_do_write): New function.
9871         * output.h (class Output_section_headers): Add shstrtab_section_.
9872         Update declarations.
9873         (class Output_symtab_xindex): Define.
9874         (Output_section::has_out_shndx): New function.
9875         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9876         field.
9877         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9878         Change all callers.
9879         (Sized_symbol::init): Likewise.
9880         (Symbol::output_section): Check for ordinary symbol.
9881         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
9882         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
9883         callers.
9884         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9885         Change all callers.  Simplify handling of symbols from sections
9886         not included in the link.
9887         (Symbol_table::add_from_dynobj): Handle ordinary symbol
9888         distinction.
9889         (Weak_alias_sorter::operator()): Assert that symbols are
9890         ordinary.
9891         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9892         distinction.
9893         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9894         parameters.  Change all callers.
9895         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
9896         symbol distinction.  Use SHN_XINDEX when needed.
9897         (Symbol_table::write_section_symbol): Add symtab_xindex
9898         parameter.  Change all callers.
9899         (Symbol_table::sized_write_section_symbol): Likewise.  Use
9900         SHN_XINDEX when needed.
9901         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
9902         declarations.
9903         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
9904         (Symbol::is_defined): Check is_ordinary.
9905         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9906         (Symbol::is_absolute, Symbol::is_common): Likewise.
9907         (class Sized_symbol): Update declarations.
9908         (class Symbol_table): Update declarations.
9909         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9910         parameters.  Change all callers.
9911         (Sized_symbol::override): Likewise.
9912         (Symbol_table::override): Likewise.
9913         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
9914         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
9915         is_ordinary, and orig_st_shndx parameters.  Change all callers.
9916         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9917         to be in an ordinary section.
9918         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9919         object and is_ordinary parameters.  Change all callers.
9920         (Sized_dwarf_line_info::read_relocs): Add object parameter.
9921         Change all callers.  Don't add undefined or non-ordinary symbols
9922         to reloc_map_.
9923         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9924         Change all callers.
9925         * dwarf_reader.h (class Sized_dwarf_line_info): Update
9926         declarations.
9927         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9928         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9929         (Sized_relobj::relocate_sections): Likewise.
9930         * target-reloc.h (scan_relocs): Adjust section symbol index.
9931         (scan_relocatable_relocs): Likewise.
9932         * i386.cc (Scan::local): Check for ordinary symbols.
9933         * sparc.cc (Scan::local): Likewise.
9934         * x86_64.cc (Scan::local): Likewise.
9935         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9936         to symbol_section_and_value.
9937         * testsuite/many_sections_test.cc: New file.
9938         * testsuite/Makefile.am (BUILT_SOURCES): Define.
9939         (check_PROGRAMS): Add many_sections_test.
9940         (many_sections_test_SOURCES): Define.
9941         (many_sections_test_DEPENDENCIES): Define.
9942         (many_sections_test_LDFLAGS): Define.
9943         (BUILT_SOURCES): Add many_sections_define.h.
9944         (many_sections_define.h): New target.
9945         (BUILT_SOURCES): Add many_sections_check.h.
9946         (many_sections_check.h): New target.
9947         (check_PROGRAMS): Add many_sections_r_test.
9948         (many_sections_r_test_SOURCES): Define.
9949         (many_sections_r_test_DEPENDENCIES): Define.
9950         (many_sections_r_test_LDFLAGS): Define.
9951         (many_sections_r_test_LDADD): Define.
9952         (many_sections_r_test.o): New target.
9953         * testsuite/Makefile.in: Rebuild.
9954
9955 2008-04-17  Cary Coutant  <ccoutant@google.com>
9956
9957         * errors.cc (Errors::info): New function.
9958         (gold_info): New function.
9959         * errors.h (Errors::info): New function.
9960         * gold.h (gold_info): New function.
9961         * object.cc (Input_objects::add_object): Print trace output.
9962         * options.cc (options::parse_set): New function.
9963         (General_options::parse_wrap): Deleted.
9964         (General_options::General_options): Deleted initializer.
9965         * options.h (options::String_set): New typedef.
9966         (options::parse_set): New function.
9967         (DEFINE_set): New macro.
9968         (General_options::wrap): Changed to use DEFINE_set. Changed
9969         callers of any_wrap_symbols and is_wrap_symbol.
9970         (General_options::trace, General_options::trace_symbol):
9971         New options.
9972         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9973         (General_options::wrap_symbols_): Deleted.
9974         * symtab.cc (Symbol_table::add_from_object): Print trace output.
9975
9976 2008-04-17  David S. Miller  <davem@davemloft.net>
9977
9978         * options.cc (General_options::parse_V): New function.
9979         * options.h: Add entries for -V and -Qy.
9980
9981 2008-04-17  Ian Lance Taylor  <iant@google.com>
9982
9983         * common.cc (Symbol_table::allocate_commons): Remove options
9984         parameter.  Change caller.
9985         (Symbol_table::do_allocate_commons): Remove options parameter.
9986         Change caller.  Just call do_allocate_commons_list twice.
9987         (Symbol_table::do_allocate_commons_list): New function, broken out
9988         of do_allocate_commons.
9989         * common.h (class Allocate_commons_task): Remove options_ field.
9990         Update constructor.
9991         * symtab.cc (Symbol_table::Symbol_table): Initialize
9992         tls_commons_.
9993         (Symbol_table::add_from_object): Put TLS common symbols on
9994         tls_commons_ list.
9995         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9996         which are IN_OUTPUT_DATA.
9997         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
9998         allocate_commons and do_allocate_commons declarations.  Declare
9999         do_allocate_commons_list.
10000         * gold.cc (queue_middle_tasks): Update creation of
10001         Allocate_commons_task to not pass options.
10002         * testsuite/Makefile.am (INCLUDES): Add -I.. .
10003         (TLS_TEST_C_FLAGS): New variable.
10004         (tls_test_c_pic.o): New target.
10005         (tls_test_shared.so): Link in tls_test_c_pic.o.
10006         (tls_test_c_pic_ie.o): New target.
10007         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10008         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10009         (tls_test_c.o): New target.
10010         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10011         (tls_pic_test_LDADD): Likewise.
10012         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10013         (tls_shared_gd_to_ie_test_LDADD): Likewise.
10014         (tls_test_c_gnu2.o): New target.
10015         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10016         tls_test_c_gnu2.o.
10017         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10018         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10019         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10020         * testsuite/tls_test.cc: Include "config.h".
10021         (t_last): Call t11_last.
10022         * testsuite/tls_test.h (t11, t11_last): Declare.
10023         * testsuite/tls_test_c.c: New file.
10024         * testsuite/tls_test_main.cc (thread_routine): Call t11.
10025         * configure.ac: Check for OpenMP support.
10026         * configure, config.in, Makefile.in: Rebuild.
10027         * testsuite/Makefile.in: Rebuild.
10028
10029 2008-04-16  Cary Coutant  <ccoutant@google.com>
10030
10031         * i386.cc (Target_i386::define_tls_base_symbol): New function.
10032         (Target_i386::tls_base_symbol_defined_): New field.
10033         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10034         (Target_i386::Scan::global): Likewise.
10035         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10036         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10037         (Target_x86_64::tls_base_symbol_defined_): New field.
10038         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10039         (Target_x86_64::Scan::global): Likewise.
10040
10041 2008-04-16  Cary Coutant  <ccoutant@google.com>
10042
10043         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10044         (Symbol::needs_plt_entry): Allow weak undefined symbols.
10045         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10046         building shared libraries.
10047         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10048         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10049         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10050         * testsuite/Makefile.in: Rebuild.
10051         * testsuite/weak_undef.h: New file.
10052         * testsuite/weak_undef_file1.cc: Add extra test cases.
10053         * testsuite/weak_undef_file2.cc: Likewise.
10054         * testsuite/weak_undef_test.cc: Likewise.
10055
10056 2008-04-16  David S. Miller  <davem@davemloft.net>
10057
10058         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10059         Add issued_non_pic_error_ field.  Declare check_non_pic.
10060         (Target_sparc::Scan::check_non_pic): New function.
10061         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10062         (Target_sparc::Scan::global): Likewise.
10063
10064         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10065         * configure: Rebuild.
10066
10067         * options.h (DEFINE_enable): New macro.
10068         (new_dtags): New enable option.
10069         (initfirst, interpose, loadfltr, nodefaultlib,
10070         nodelete, nodlopen, nodump): New -z options.
10071         * layout.cc (Layout:finish_dynamic_section): If new
10072         dtags enabled, emit DT_RUNPATH.  Also, emit a
10073         DT_FLAGS_1 containing any specified -z flags.
10074
10075 2008-04-16  Ian Lance Taylor  <iant@google.com>
10076
10077         * copy-relocs.cc: New file.
10078         * copy-relocs.h: New file.
10079         * reloc.cc: Remove Copy_relocs code.
10080         * reloc.h: Likewise.
10081         * reloc-types.h (struct Reloc_types) [both versions]: Add
10082         get_reloc_addend_noerror.
10083         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10084         variants of add_global which take an addend which must be zero.
10085         * i386.cc: Include "copy-relocs.h".
10086         (class Target_i386): Change type of copy_relocs_ to variable,
10087         update initializer.
10088         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10089         Change all callers.
10090         (Target_i386::do_finalize_sections): Change handling of
10091         copy_relocs_.
10092         * sparc.cc: Include "copy-relocs.h".
10093         (class Target_sparc): Change type of copy_relocs_ to variable,
10094         update initializer.
10095         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10096         Change all callers.
10097         (Target_sparc::do_finalize_sections): Change handling of
10098         copy_relocs_.
10099         * x86_64.cc: Include "copy-relocs.h".
10100         (class Target_x86_64): Change type of copy_relocs_ to variable,
10101         update initializer.
10102         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10103         class.  Change all callers.
10104         (Target_x86_64::do_finalize_sections): Change handling of
10105         copy_relocs_.
10106         * Makefile.am (CCFILES): Add copy-relocs.cc.
10107         (HFILES): Add copy-relocs.h.
10108
10109         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10110
10111         * testsuite/script_test_4.sh: Permit leading zeroes.
10112
10113 2008-04-15  Ian Lance Taylor  <iant@google.com>
10114
10115         * script-sections.cc (Script_sections::create_segments): Use
10116         header_size_adjustment even when there is enough room for the
10117         headers.
10118         * testsuite/script_test_4.sh: New file.
10119         * testsuite/script_test_4.t: New file.
10120         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10121         (check_DATA): Add script_test_4.stdout.
10122         (MOSTLYCLEANFILES): Likewise.
10123         (script_test_4): New target.
10124         (script_test_4.stdout): New target.
10125         * testsuite/Makefile.in: Rebuild.
10126
10127         * sparc.cc: Add definitions for Output_data_plt_sparc class
10128         constants.
10129
10130 2008-04-14  David S. Miller  <davem@davemloft.net>
10131
10132         * sparc.cc: New file.
10133         * Makefile.am (TARGETSOURCES): Add sparc.cc
10134         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10135         * configure.tgt: Document targ_extra_size and
10136         targ_extra_big_endian.  Add entries for sparc-* and
10137         sparc64-*.
10138         * configure.ac: Handle targ_extra_size and
10139         targ_extra_big_endian.
10140         * Makefile.in: Rebuild.
10141         * configure: Likewise.
10142         * po/POTFILES.in: Likewise.
10143         * po/gold.pot: Likewise.
10144
10145 2008-04-14  Ian Lance Taylor  <iant@google.com>
10146
10147         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10148         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10149         in the name/type/flags to section mapping.  Don't call
10150         allocate_output_section.
10151         (Layout::choose_output_section): Change parameter from adjust_name
10152         to is_input_section.  Don't permit input sections after sections
10153         are attached to segments.  Don't call allocate_output_section.
10154         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10155         not write_enable_output_section.
10156         (Layout::make_output_section): Don't push to
10157         unattached_section_list_ nor call attach_to_segment.  Call
10158         attach_section_to_segment if sections are attached.
10159         (Layout::attach_sections_to_segments): New function.
10160         (Layout::attach_section_to_segment): New function.
10161         (Layout::attach_allocated_section_to_segment): Rename from
10162         attach_to_segment.  Remove flags parameter.
10163         (Layout::allocate_output_section): Remove function.
10164         (Layout::write_enable_output_section): Remove function.
10165         * layout.h (class Layout): Update for above changes.  Add new
10166         field sections_are_attached_.
10167         * output.h (Output_section::update_flags_for_input_section): New
10168         function.
10169         * output.cc (Output_section::add_input_section): Call
10170         update_flags_for_input_section.
10171         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10172
10173 2008-04-11  Cary Coutant  <ccoutant@google.com>
10174
10175         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10176         thought unnecessary.
10177         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10178
10179 2008-04-11  Ian Lance Taylor  <iant@google.com>
10180
10181         * output.h (class Output_section_data): Remove inline definition
10182         of set_addralign.
10183         * output.cc (Output_section_data::set_addralign): New function.
10184
10185 2008-04-11  Cary Coutant  <ccoutant@google.com>
10186
10187         Add support for TLS descriptors for i386 and x86_64.
10188         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10189         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10190         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10191         GOT_TYPE_TLS_DESC.
10192         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10193         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10194         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10195         relocations.
10196         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10197         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10198         Fix problem with initial-exec relocations.
10199         (Target_i386::Relocate::relocate_tls): Likewise.
10200         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10201         relaxation.
10202         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10203         support for section-plus-offset dynamic table entries.
10204         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10205         (Output_data_dynamic::Dynamic_entry): Add support for
10206         section-plus-offset dynamic table entries.
10207         (Output_data_dynamic::Classification): Likewise.
10208         (Output_data_dynamic::classification_): Renamed offset_.
10209         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10210         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10211         (Target_x86_64::make_plt_section): New function.
10212         (Target_x86_64::reserve_tlsdesc_entries): New function.
10213         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10214         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10215         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10216         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10217         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10218         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10219         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10220         add extra PLT entry for TLS descriptors.
10221         (Output_data_plt_x86_64::got_): New field.
10222         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10223         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10224         fields.
10225         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10226         descriptors.
10227         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10228         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10229         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10230         R_386_TLS_DESC_CALL relocations.
10231         (Target_x86_64::Scan::global): Likewise.
10232         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10233         for TLS descriptors.
10234         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10235         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10236         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10237         GD-to-IE relaxation.
10238         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10239         and TLS_DESCRIPTORS.
10240         * Makefile.in: Rebuild.
10241         * configure: Rebuild.
10242         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10243         (tls_test_shared2.so): New target.
10244         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10245         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10246         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10247         (tls_shared_gd_to_ie_test_LDADD): New variable.
10248         (tls_shared_gnu2_gd_to_ie_test): New target.
10249         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10250         New targets.
10251         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10252         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10253         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10254         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10255         (tls_shared_gnu2_test): New target.
10256         (tls_test_gnu2_shared.so): New target.
10257         (tls_shared_gnu2_test_SOURCES): New variable.
10258         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10259         (tls_shared_gnu2_test_LDFLAGS): New variable.
10260         (tls_shared_gnu2_test_LDADD): New variable.
10261         * testsuite/Makefile.in: Rebuild.
10262         * testsuite/Makefile.
10263
10264 2008-04-11  Ian Lance Taylor  <iant@google.com>
10265
10266         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10267         justsyms.t.
10268         * testsuite/Makefile.in: Rebuild.
10269
10270         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10271         long.
10272         * testsuite/script_test_2.cc (main): Adjust test.
10273
10274 2008-04-11  David S. Miller  <davem@davemloft.net>
10275             Ian Lance Taylor  <iant@google.com>
10276
10277         * options.h (General_options): Add entries for '-Y' and
10278         '-relax'.
10279         * options.cc (General_options:finalize): If -Y was used, add those
10280         entries to the library path instead of the default "/lib" and
10281         "/usr/lib".
10282
10283 2008-04-11  David S. Miller  <davem@davemloft.net>
10284
10285         * testsuite/justsyms.t: Start at 0x100.
10286         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10287         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10288         long.
10289         * testsuite/script_test_2.cc: Adjust string and section length
10290         checks.
10291
10292 2008-04-09  Ian Lance Taylor  <iant@google.com>
10293
10294         PR gold/5996
10295         * script-sections.cc (Sections_element::allocate_to_segment): Add
10296         orphan parameter.
10297         (Output_section_definition::allocate_to_segment): Likewise.
10298         (Orphan_output_section::allocate_to_segment): Likewise.
10299         (Script_sections::attach_sections_using_phdrs_clause): Don't
10300         propagate non-PT_LOAD segments to orphan sections.
10301         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10302         readelf rather than objdump.
10303         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10304         .interp section and PT_INTERP segment are the same size.
10305         * testsuite/Makefile.in: Rebuild.
10306
10307         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10308         aliases for symbols defined in the same object.
10309         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10310         (weak_alias_test_SOURCES): New variable.
10311         (weak_alias_test_DEPENDENCIES): New variable.
10312         (weak_alias_test_LDFLAGS): New variable.
10313         (weak_alias_test_LDADD): New variable.
10314         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10315         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10316         (weak_alias_test_3.o): New target.
10317         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10318         * testsuite/weak_alias_test_main.cc: New file.
10319         * testsuite/weak_alias_test_1.cc: New file.
10320         * testsuite/weak_alias_test_2.cc: New file.
10321         * testsuite/weak_alias_test_3.cc: New file.
10322
10323 2008-04-08  Ian Lance Taylor  <iant@google.com>
10324
10325         * options.h (class General_options): Add --noinhibit-exec option.
10326         * main.cc (main): Check --noinhibit-exec.
10327
10328         * options.h (class General_options): Define --wrap as a special
10329         option.  Add wrap_symbols_ field.
10330         (General_options::any_wrap_symbols): New function.
10331         (General_options::is_wrap_symbol): New function.
10332         * options.cc (General_options::parse_wrap): New function.
10333         (General_options::General_options): Initialize wrap_symbols_.
10334         * symtab.cc (Symbol_table::wrap_symbol): New function.
10335         (Symbol_table::add_from_object): Handle --wrap.
10336         * symtab.h (class Symbol_table): Declare wrap_symbol.
10337         * target.h (Target::wrap_char): New function.
10338         (Target::Target_info): Add wrap_char field.
10339         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10340         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10341         * testsuite/testfile.cc (Target_test::test_target_info):
10342         Likewise.
10343
10344         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10345         there is one.
10346
10347         * layout.h (class Layout): Add added_eh_frame_data_ field.
10348         * layout.cc (Layout::Layout): Initialize new field.
10349         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10350         output section until we find a section we merged successfully.
10351         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10352         that the size be non-zero.
10353
10354         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10355         qualifier.
10356
10357 2008-04-08  Craig Silverstein  <csilvers@google.com>
10358
10359         * configure.ac: Export new conditional variable HAVE_ZLIB.
10360         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10361         on HAVE_ZLIB.
10362         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10363         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10364
10365 2008-04-07  Ian Lance Taylor  <iant@google.com>
10366
10367         * version.cc (version_string): Set to "1.5".
10368
10369         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10370         Add issued_non_pic_error_ field.  Declare check_non_pic.
10371         (Target_x86_64::Scan::check_non_pic): New function.
10372         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10373         (Target_x86_64::Scan::global): Likewise.
10374
10375         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10376         addend parameter.  Change caller.  Handle merge sections.
10377         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10378         Address to Addend.  Don't add in the result of
10379         local_section_offset, pass down the addend and use the returned
10380         value.
10381         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10382         Update declarations of local_section_offset and symbol_value.
10383         * testsuite/two_file_test_1.cc (t18): New function.
10384         * testsuite/two_file_test_2.cc (f18): New function.
10385         * testsuite/two_file_test_main.cc (main): Call t18.
10386         * testsuite/two_file_test.h (t18, f18): Declare.
10387
10388         * configure.ac: Don't test for objdump, c++filt, or readelf.
10389         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10390         conditionals.
10391         (TEST_READELF): New variable.
10392         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10393         (check_PROGRAMS): Add two_file_strip_test.
10394         (two_file_strip_test): New target.
10395         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10396         (two_file_same_shared_strip_test_SOURCES): New variable.
10397         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10398         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10399         (two_file_same_shared_strip_test_LDADD): New variable.
10400         (two_file_shared_strip.so): New target.
10401         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10402         (ver_test_5.syms, ver_test_7.syms): Likewise.
10403         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10404         (strip_test_3.stdout): Use TEST_OBJDUMP.
10405         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10406
10407 2008-04-04  Cary Coutant  <ccoutant@google.com>
10408
10409         * symtab.h (Symbol::is_weak_undefined): New function.
10410         (Symbol::is_strong_undefined): New function.
10411         (Symbol::is_absolute): New function.
10412         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10413         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10414         absolute symbols.
10415         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10416         (weak_undef_test): New target.
10417         * testsuite/Makefile.in: Rebuild.
10418         * testsuite/weak_undef_file1.cc: New file.
10419         * testsuite/weak_undef_file2.cc: New file.
10420         * testsuite/weak_undef_test.cc: New file.
10421
10422 2008-04-03  Craig Silverstein  <csilvers@google.com>
10423
10424         * compressed_output.h (class Output_compressed_section): Use
10425         unsigned buffer.
10426         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10427         add zlib header.
10428         (zlib_compressed_suffix): Removed.
10429         (Output_compressed_section::set_final_data_size): Use unsigned
10430         buffers.
10431         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10432         Fix linker invocation.
10433         (flagstest_o_specialfile_and_compress_debug_sections):
10434         Likewise.
10435         * testsuite/Makefile.in: Regenerated.
10436
10437 2008-04-02  David S. Miller  <davem@davemloft.net>
10438
10439         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10440         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10441
10442 2008-04-02  Craig Silverstein  <csilvers@google.com>
10443
10444         * TODO: New file.
10445
10446 2008-04-02  Ian Lance Taylor  <iant@google.com>
10447
10448         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10449         parameters.  Update for new key type to views_.  Change all
10450         callers.
10451         (File_read::read): Adjust for byteshift in returned view.
10452         (File_read::add_view): New function, broken out of
10453         find_and_make_view.
10454         (File_read::make_view): New function, broken out of
10455         find_and_make_view.
10456         (File_read::find_or_make_view): Add offset and aligned
10457         parameters.  Rewrite accordingly.  Change all callers.
10458         (File_read::get_view): Add offset and aligned parameters.  Adjust
10459         for byteshift in return value.
10460         (File_read::get_lasting_view): Likewise.
10461         * fileread.h (class File_read): Update declarations.
10462         (class File_read::View): Add byteshift_ field.  Add byteshift to
10463         constructor.  Add byteshift method.
10464         * archive.h (Archive::clear_uncached_views): New function.
10465         (Archive::get_view): Add aligned parameter.  Change all callers.
10466         * object.h (Object::get_view): Add aligned parameter.  Change all
10467         callers.
10468         (Object::get_lasting_view): Likewise.
10469
10470         * fileread.cc (File_read::release): Don't call clear_views if
10471         there are multiple objects.
10472         * fileread.h (File_read::clear_uncached_views): New function.
10473         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10474         on the archive.
10475
10476 2008-03-31  Cary Coutant  <ccoutant@google.com>
10477
10478         Add thin archive support.
10479         * archive.cc (Archive::armagt): New const.
10480         (Archive::setup): Remove task parameter and calls to unlock.
10481         (Archive::unlock_nested_archives): New function.
10482         (Archive::read_header): Add nested_off parameter. Change
10483         all callers.
10484         (Archive::interpret_header): Likewise.
10485         (Archive::include_all_members): Change to handle thin
10486         archives.
10487         (Archive::include_member): Likewise.
10488         * archive.h (Archive::Archive): Add new parameters and
10489         initializers.
10490         (Archive::armagt): New const.
10491         (Archive::setup): Remove task parameter.
10492         (Archive::unlock_nested_archives): New function.
10493         (Archive::read_header): Add nested_off parameter.
10494         (Archive::interpret_header): Likewise.
10495         (Archive::Nested_archive_table): New typedef.
10496         (Archive::is_thin_archive_): New field.
10497         (Archive::nested_archives_): New field.
10498         (Archive::options_): New field.
10499         (Archive::dirpath_): New field.
10500         (Archive::task_): New field.
10501         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10502         for thin archives.  Pass additional parameters to
10503         Archive::Archive.  Unlock the archive file after calling
10504         Archive::setup.
10505
10506 2008-03-29  Ian Lance Taylor  <iant@google.com>
10507
10508         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10509         version symbol to be local.
10510         * testsuite/ver_test_4.sh: New file.
10511         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10512         (check_DATA): Add ver_test_4.syms.
10513         (ver_test_4.syms): New target.
10514         * testsuite/Makefile.in: Rebuild.
10515
10516         * output.cc
10517         (Output_section::Input_section_sort_entry::has_priority): New
10518         function.
10519         (Output_section::Input_section_sort_entry::match_file_name): New
10520         function.
10521         (Output_section::Input_section_sort_entry::match_section_name):
10522         Remove.
10523         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10524         Remove.
10525         (Output_section::Input_section_sort_entry::match_section_file):
10526         Remove.
10527         (Output_section::Input_section_sort_compare::operator()): Rewrite
10528         using new Input_section_sort_entry functions.  Sort crtbegin and
10529         crtend first.  Sort sections with no priority before sections with
10530         a priority.
10531         * testsuite/initpri1.c (d3): Check j != 4.
10532         (cd5): New constructor/destructor function.
10533         (main): Check j != 2.
10534
10535         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10536         new symbol when resolving, don't call set_is_default.
10537         * testsuite/ver_test_7.cc: New file.
10538         * testsuite/ver_test_7.sh: New file.
10539         * testsuite/Makefile.am (ver_test_7.so): New target.
10540         (ver_test_7.o): New target.
10541         (check_SCRIPTS): Add ver_test_7.sh.
10542         (check_DATA): Add ver_test_7.syms.
10543         (ver_test_7.syms): New target.
10544
10545 2008-03-28  Ian Lance Taylor  <iant@google.com>
10546
10547         * layout.cc (Layout::layout): If we see an input section with a
10548         name that needs sorting, set the must_sort flag for the output
10549         section.
10550         (Layout::make_output_section): If the name of the output section
10551         indicates that it might require sorting, set the may_sort flag.
10552         * output.h (Output_section::may_sort_attached_input_sections): New
10553         function.
10554         (Output_section::set_may_sort_attached_input_sections): New
10555         function.
10556         (Output_section::must_sort_attached_input_sections): New
10557         function.
10558         (Output_section::set_must_sort_attached_input_sections): New
10559         function.
10560         (class Output_section): Declare Input_section_sort_entry.  Define
10561         Input_section_sort_compare.  Declare
10562         sort_attached_input_sections.  Add new fields:
10563         may_sort_attached_input_sections_,
10564         must_sort_attached_input_sections_,
10565         attached_input_sections_are_sorted_.
10566         * output.cc (Output_section::Output_section): Initialize new
10567         fields.
10568         (Output_section::add_input_section): Add an entry to
10569         input_sections_ if may_sort or must_sort are true.
10570         (Output_section::set_final_data_size): Call
10571         sort_attached_input_sections if necessary.
10572         (Output_section::Input_section_sort_entry): Define new class.
10573         (Output_section::Input_section_sort_compare::operator()): New
10574         function.
10575         (Output_section::sort_attached_input_sections): New function.
10576         * configure.ac: Check whether the compiler supports constructor
10577         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10578         * testsuite/initpri1.c: New file.
10579         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10580         CONSTRUCTOR_PRIORITY.
10581         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10582         (initpri1_LDFLAGS): New variable.
10583         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10584
10585 2008-03-27  Ian Lance Taylor  <iant@google.com>
10586
10587         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10588         * testsuite/common_test_1.c: New file.
10589         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10590         (common_test_1_SOURCES): New variable.
10591         (common_test_1_DEPENDENCIES): New variable.
10592         (common_test_1_LDFLAGS): New variable.
10593
10594         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10595         and commons_ correctly when NAME/VERSION does not override
10596         NAME/NULL.
10597         * testsuite/ver_test_6.c: New file.
10598         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10599         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10600         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10601
10602 2008-03-26  Ian Lance Taylor  <iant@google.com>
10603
10604         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10605         of an undefined symbol from a version script.
10606         * testsuite/Makefile.am (ver_test_5.so): New target.
10607         (ver_test_5.o): New target.
10608         (check_SCRIPTS): Add ver_test_5.sh.
10609         (check_DATA): Add ver_test_5.syms.
10610         (ver_test_5.syms): New target.
10611         * testsuite/ver_test_5.cc: New file.
10612         * testsuite/ver_test_5.script: New file.
10613         * testsuite/ver_test_5.sh: New file.
10614         * Makefile.in, testsuite/Makefile.in: Rebuild.
10615
10616         PR gold/5986
10617         Fix problems building gold with gcc 4.3.0.
10618         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10619         (gold_error_at_location, gold_warning_at_location): Use it.
10620         * configure.ac: Check whether we can compile and use a template
10621         function with a printf attribute.
10622         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10623         when jumping over bytes.
10624         * object.cc: Instantiate Object::read_section_data.
10625         * debug.h: Include <cstring>
10626         * dwarf_reader.cc: Include <algorithm>
10627         * main.cc: Include <cstring>.
10628         * options.cc: Include <cstring>.
10629         * output.cc: Include <cstring>.
10630         * script.cc: Include <cstring>.
10631         * script.h: Include <string>.
10632         * symtab.cc: Include <cstring> and <algorithm>.
10633         * target-select.cc: Include <cstring>.
10634         * version.cc: Include <string>.
10635         * testsuite/testmain.cc: Include <cstdlib>.
10636         * configure, config.in: Rebuild.
10637
10638 2008-03-25  Ian Lance Taylor  <iant@google.com>
10639
10640         * options.cc: Include "../bfd/bfdver.h".
10641         (options::help): Print bug reporting address.
10642
10643         * version.cc (print_version): Adjust output for current value of
10644         BFD_VERSION_STRING.
10645
10646         * NEWS: New file.
10647
10648         * options.cc (options::help): Print list of supported targets.
10649         * target-select.h: Include <vector>.
10650         (class Target_selector): Make machine_, size_, and is_big_endian_
10651         fields const.  Add bfd_name_ and instantiated_target_ fields.
10652         (Target_selector::Target_selector): Add bfd_name parameter.
10653         (Target_selector::recognize): Make non-virtual, call
10654         do_recognize.
10655         (Target_selector::recognize_by_name): Make non-virtual, call
10656         do_recognize_by_name.
10657         (Target_selector::supported_names): New function.
10658         (Target_selector::bfd_name): New function.
10659         (Target_selector::do_instantiate_target): New pure virtual
10660         function.
10661         (Target_selector::do_recognize): New virtual function.
10662         (Target_selector::do_recognize_by_name): New virtual function.
10663         (Target_selector::instantiate_target): New private function.
10664         (supported_target_names): Declare.
10665         * target-select.cc (Target_selector::Target_selector): Update for
10666         new parameter and fields.
10667         (select_target_by_name): Check that the name matches before
10668         calling recognize_by_name.
10669         (supported_target_names): New function.
10670         * i386.cc (class Target_selector_i386): Update Target_selector
10671         constructor call.  Remove recognize and recognize_by_name.  Add
10672         do_instantiate_target.
10673         * x86_64.cc (class Target_selector_x86_64): Likewise.
10674         * testsuite/testfile.cc (class Target_selector_test): Update for
10675         changes to Target_selector.
10676
10677         * README: Rewrite, with some notes on unsupported features.
10678
10679 2008-03-24  Cary Coutant  <ccoutant@google.com>
10680
10681         * i386.cc (Target_i386::Got_type): New enum declaration.
10682         (Target_i386::Scan::local): Updated callers of Output_data_got
10683         member functions.
10684         (Target_i386::Scan::global): Likewise.
10685         (Target_i386::Relocate::relocate): Likewise.
10686         (Target_i386::Relocate::relocate_tls): Likewise.
10687         * object.h (Got_offset_list): New class.
10688         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10689         (Sized_relobj::local_got_offset): Likewise.
10690         (Sized_relobj::set_local_got_offset): Likewise.
10691         (Sized_relobj::local_has_tls_got_offset): Removed.
10692         (Sized_relobj::local_tls_got_offset): Removed.
10693         (Sized_relobj::set_local_tls_got_offset): Removed.
10694         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10695         * output.cc (Output_data_got::add_global): Added got_type parameter.
10696         (Output_data_got::add_global_with_rel): Likewise.
10697         (Output_data_got::add_global_with_rela): Likewise.
10698         (Output_data_got::add_global_pair_with_rel): New function.
10699         (Output_data_got::add_global_pair_with_rela): New function.
10700         (Output_data_got::add_local): Added got_type parameter.
10701         (Output_data_got::add_local_with_rel): Likewise.
10702         (Output_data_got::add_local_with_rela): Likewise.
10703         (Output_data_got::add_local_pair_with_rel): New function.
10704         (Output_data_got::add_local_pair_with_rela): New function.
10705         (Output_data_got::add_global_tls): Removed.
10706         (Output_data_got::add_global_tls_with_rel): Removed.
10707         (Output_data_got::add_global_tls_with_rela): Removed.
10708         (Output_data_got::add_local_tls): Removed.
10709         (Output_data_got::add_local_tls_with_rel): Removed.
10710         (Output_data_got::add_local_tls_with_rela): Removed.
10711         * output.h (Output_data_got::add_global): Added got_type parameter.
10712         (Output_data_got::add_global_with_rel): Likewise.
10713         (Output_data_got::add_global_with_rela): Likewise.
10714         (Output_data_got::add_global_pair_with_rel): New function.
10715         (Output_data_got::add_global_pair_with_rela): New function.
10716         (Output_data_got::add_local): Added got_type parameter.
10717         (Output_data_got::add_local_with_rel): Likewise.
10718         (Output_data_got::add_local_with_rela): Likewise.
10719         (Output_data_got::add_local_pair_with_rel): New function.
10720         (Output_data_got::add_local_pair_with_rela): New function.
10721         (Output_data_got::add_global_tls): Removed.
10722         (Output_data_got::add_global_tls_with_rel): Removed.
10723         (Output_data_got::add_global_tls_with_rela): Removed.
10724         (Output_data_got::add_local_tls): Removed.
10725         (Output_data_got::add_local_tls_with_rel): Removed.
10726         (Output_data_got::add_local_tls_with_rela): Removed.
10727         * resolve.cc (Symbol::override_base_with_special): Removed
10728         reference to has_got_offset_ field.
10729         * symtab.cc (Symbol::init_fields): Replaced initialization
10730         of got_offset_ with got_offsets_.  Removed initialization
10731         of has_got_offset_
10732         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10733         (Symbol::got_offset): Likewise.
10734         (Symbol::set_got_offset): Likewise.
10735         (Symbol::has_tls_got_offset): Removed.
10736         (Symbol::tls_got_offset): Removed.
10737         (Symbol::set_tls_got_offset): Removed.
10738         (Symbol::got_offset_): Removed.
10739         (Symbol::tls_mod_got_offset_): Removed.
10740         (Symbol::tls_pair_got_offset_): Removed.
10741         (Symbol::got_offsets_): New field.
10742         (Symbol::has_got_offset): Removed.
10743         (Symbol::has_tls_mod_got_offset): Removed.
10744         (Symbol::has_tls_pair_got_offset): Removed.
10745         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10746         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10747         member functions.
10748         (Target_x86_64::Scan::global): Likewise.
10749         (Target_x86_64::Relocate::relocate): Likewise.
10750         (Target_x86_64::Relocate::relocate_tls): Likewise.
10751
10752 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10753
10754         * yyscript.y: Fix spelling error in comment.
10755
10756 2008-03-24  Ian Lance Taylor  <iant@google.com>
10757
10758         * options.h (class General_options): Define build_id option.
10759         * layout.h (class Layout): Declare write_build_id, create_note,
10760         create_build_id.  Add build_id_note_ member.
10761         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10762         "libiberty.h", "md5.h", "sha1.h".
10763         (Layout::Layout): Initialize eh_frame_data_,
10764         eh_frame_hdr_section_, and build_id_note_.
10765         (Layout::finalize): Call create_build_id.
10766         (Layout::create_note): New function, broken out of
10767         Layout::create_gold_note.
10768         (Layout::create_gold_note): Call create_note.
10769         (Layout::create_build_id): New function.
10770         (Layout::write_build_id): New function.
10771         (Close_task_runner::run): Call write_build_id.
10772
10773         * x86_64.cc: Correct license to GPLv3.
10774
10775 2008-03-23  Ian Lance Taylor  <iant@google.com>
10776
10777         * options.cc: Include "demangle.h".
10778         (parse_optional_string): New function.
10779         (parse_long_option): Handle takes_optional_argument.
10780         (parse_short_option): Update dash_z initializer.  Handle
10781         takes_optional_argument.
10782         (General_options::General_options): Initialize do_demangle_.
10783         (General_options::finalize): Set do_demangle_.  Handle demangling
10784         style.
10785         * options.h (parse_optional_string): Declare.
10786         (struct One_option): Add optional_arg field.  Update constructor.
10787         Update call constructor calls.  Add takes_optional_argument
10788         function.
10789         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
10790         (DEFINE_optional_string): Define.
10791         (General_options::demangle): Change from DEFINE_bool to
10792         DEFINE_optional_string.
10793         (General_options::no_demangle): New function.
10794         (General_options::do_demangle): New function.
10795         (General_options::set_do_demangle): New function.
10796         (General_options::execstack_status_): Move definition to end of
10797         class definition.
10798         (General_options::static_): Likewise.
10799         (General_options::do_demangle_): New field.
10800         * object.cc (big_endian>::get_symbol_location_info): Call
10801         Options::do_demangle, not Options::demangle.
10802         * symtab.cc (demangle): Likewise.
10803
10804 2008-03-22  Ian Lance Taylor  <iant@google.com>
10805
10806         * gold.h: Include <cstddef> and <sys/types.h>
10807         * options.h: Include <cstring>.
10808
10809 2008-03-21  Ian Lance Taylor  <iant@google.com>
10810
10811         * Added source code to GNU binutils.