* incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
[external/binutils.git] / gold / ChangeLog
1 2011-05-24 Cary Coutant  <ccoutant@google.com>
2
3         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4         info; adjust display of GOT entries.
5         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6         vector of input objects; remove file_status_.
7         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
8         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
9         got_plt reader; call target hooks to reserve GOT entries.
10         (Output_section_incremental_inputs::set_final_data_size): Adjust size
11         of input file info header and GOT info entry.
12         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
13         relocation info.
14         (Got_plt_view_info::got_descriptor): Remove.
15         (Got_plt_view_info::sym_index): New data member.
16         (Got_plt_view_info::input_index): New data member.
17         (Local_got_offset_visitor::visit): Write input file index.
18         (Global_got_offset_visitor::visit): Write 0 for input file index.
19         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
20         with sym_index and input_index.
21         (Output_section_incremental_inputs::write_got_plt): Adjust size of
22         incremental info GOT entry; replace got_descriptor with input_index.
23         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
24         map from input file index to object.
25         (Sized_relobj_incr::do_layout): Replace direct data member reference
26         with accessor function.
27         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
28         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
29         Adjust size of input file info header.
30         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
31         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
32         (Incremental_input_entry_reader::get_input_section): Adjust size of
33         input file info header.
34         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
35         of incremental info GOT entry.
36         (Incremental_got_plt_reader::get_got_desc): Remove.
37         (Incremental_got_plt_reader::get_got_symndx): New function.
38         (Incremental_got_plt_reader::get_got_input_index): New function.
39         (Sized_incremental_binary::Sized_incremental_binary): Remove
40         file_status_; add input_objects_.
41         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
42         (Sized_incremental_binary::set_file_is_unchanged): Remove.
43         (Sized_incremental_binary::file_is_unchanged): Remove.
44         (Sized_incremental_binary::set_input_object): New function.
45         (Sized_incremental_binary::input_object): New function.
46         (Sized_incremental_binary::file_status_): Remove.
47         (Sized_incremental_binary::input_objects_): New data member.
48         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
49         references.
50         (Sized_relobj_incr::invalid_address): Move to base class.
51         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
52         class.
53         (Sized_relobj_incr::do_output_section_offset): Likewise.
54         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
55         (Sized_relobj_incr::section_offsets_): Likewise.
56         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
57         function.
58         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
59         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
60         with accessor function.
61         (Sized_relobj_file::do_layout): Likewise.
62         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
63         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
64         (Sized_relobj_file::compute_final_local_value): Replace refs to
65         section_offsets_ with accessor function.
66         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
67         * object.h (Relobj::Relobj): Initialize new data members.
68         (Relobj::add_dyn_reloc): New function.
69         (Relobj::first_dyn_reloc): New function.
70         (Relobj::dyn_reloc_count): New function.
71         (Relobj::first_dyn_reloc_): New data member.
72         (Relobj::dyn_reloc_count_): New data member.
73         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
74         references.
75         (Sized_relobj::Address): New typedef.
76         (Sized_relobj::invalid_address): Move here from child class.
77         (Sized_relobj::Sized_relobj): Initialize new data members.
78         (Sized_relobj::sized_relobj): New function.
79         (Sized_relobj::is_output_section_offset_invalid): Move here from
80         child class.
81         (Sized_relobj::get_output_section_offset): Likewise.
82         (Sized_relobj::local_has_got_offset): Likewise.
83         (Sized_relobj::local_got_offset): Likewise.
84         (Sized_relobj::set_local_got_offset): Likewise.
85         (Sized_relobj::do_for_all_local_got_entries): Likewise.
86         (Sized_relobj::clear_got_offsets): New function.
87         (Sized_relobj::section_offsets): Move here from child class.
88         (Sized_relobj::do_output_section_offset): Likewise.
89         (Sized_relobj::do_set_section_offset): Likewise.
90         (Sized_relobj::Local_got_offsets): Likewise.
91         (Sized_relobj::local_got_offsets_): Likewise.
92         (Sized_relobj::section_offsets_): Likewise.
93         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
94         references.
95         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
96         class.
97         (Sized_relobj_file::sized_relobj): New function
98         (Sized_relobj_file::local_has_got_offset): Move to base class.
99         (Sized_relobj_file::local_got_offset): Likewise.
100         (Sized_relobj_file::set_local_got_offset): Likewise.
101         (Sized_relobj_file::get_output_section_offset): Likewise.
102         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
103         (Sized_relobj_file::do_output_section_offset): Likewise.
104         (Sized_relobj_file::do_set_section_offset): Likewise.
105         (Sized_relobj_file::Local_got_offsets): Likewise.
106         (Sized_relobj_file::local_got_offsets_): Likewise.
107         (Sized_relobj_file::section_offsets_): Likewise.
108         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
109         (all constructors).
110         (set_needs_dynsym_index): Convert relobj to derived class pointer.
111         (Output_reloc::get_symbol_index): Likewise.
112         (Output_reloc::local_section_offset): Likewise.
113         (Output_reloc::get_address): Likewise.
114         (Output_reloc::symbol_value): Likewise.
115         (Output_data_got::reserve_slot): Move to class definition.
116         (Output_data_got::reserve_local): New function.
117         (Output_data_got::reserve_slot_for_global): Remove.
118         (Output_data_got::reserve_global): New function.
119         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
120         (all constructors, two instantiations).
121         (Output_reloc::get_relobj): New function (two instantiations).
122         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
123         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
124         (Output_data_reloc::add_global): Adjust type of relobj.
125         (Output_data_reloc::add_global_relative): Likewise.
126         (Output_data_reloc::add_symbolless_global_addend): Likewise.
127         (Output_data_reloc::add_local): Likewise.
128         (Output_data_reloc::add_local_relative): Likewise.
129         (Output_data_reloc::add_symbolless_local_addend): Likewise.
130         (Output_data_reloc::add_local_section): Likewise.
131         (Output_data_reloc::add_output_section): Likewise.
132         (Output_data_reloc::add_absolute): Likewise.
133         (Output_data_reloc::add_target_specific): Likewise.
134         (Output_data_got::reserve_slot): Move definition here.
135         (Output_data_got::reserve_local): New function.
136         (Output_data_got::reserve_global): New function.
137         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
138         section_offsets_ with accessor function.
139         (Sized_relobj_file::write_sections): Likewise.
140         (Sized_relobj_file::do_relocate_sections): Likewise.
141         * target.h (Sized_target::reserve_local_got_entry): New function.
142         (Sized_target::reserve_global_got_entry): New function.
143         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
144         (Target_x86_64::reserve_global_got_entry): New function.
145         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
146
147 2011-05-23 Cary Coutant  <ccoutant@google.com>
148
149         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
150         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
151         bit when checking got_type.
152         * incremental.cc (Sized_incremental_binary::setup_readers):
153         Store symbol table and string table locations; initialize bit vector
154         of file status flags.
155         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
156         unchanged files.
157         (Sized_incremental_binary::do_process_got_plt): New function.
158         (Sized_incremental_binary::get_symtab_view): Use stored locations.
159         (Output_section_incremental_inputs::set_final_data_size): Record
160         file index for each input file.
161         (Output_section_incremental_inputs::write_got_plt): Store file index
162         instead of input entry offset for each GOT entry.
163         * incremental.h
164         (Incremental_input_entry::Incremental_input_entry): Initialize new
165         data member.
166         (Incremental_input_entry::set_offset): Store file index.
167         (Incremental_input_entry::get_file_index): New function.
168         (Incremental_input_entry::file_index_): New data member.
169         (Incremental_binary::process_got_plt): New function.
170         (Incremental_binary::do_process_got_plt): New function.
171         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
172         data members.
173         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
174         (Sized_incremental_binary::set_file_is_unchanged): New function.
175         (Sized_incremental_binary::file_is_unchanged): New function.
176         (Sized_incremental_binary::do_process_got_plt): New function.
177         (Sized_incremental_binary::file_status_): New data member.
178         (Sized_incremental_binary::main_symtab_loc_): New data member.
179         (Sized_incremental_binary::main_strtab_loc_): New data member.
180         * output.cc (Output_data_got::Got_entry::write): Add case
181         RESERVED_CODE.
182         (Output_data_got::add_global): Call add_got_entry.
183         (Output_data_got::add_global_plt): Likewise.
184         (Output_data_got::add_global_with_rel): Likewise.
185         (Output_data_got::add_global_with_rela): Likewise.
186         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
187         (Output_data_got::add_global_pair_with_rela): Likewise.
188         (Output_data_got::add_local): Call add_got_entry.
189         (Output_data_got::add_local_plt): Likewise.
190         (Output_data_got::add_local_with_rel): Likewise.
191         (Output_data_got::add_local_with_rela): Likewise.
192         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
193         (Output_data_got::add_local_pair_with_rela): Likewise.
194         (Output_data_got::reserve_slot): New function.
195         (Output_data_got::reserve_slot_for_global): New function.
196         (Output_data_got::add_got_entry): New function.
197         (Output_data_got::add_got_entry_pair): New function.
198         (Output_section::add_output_section_data): Edit FIXME.
199         * output.h
200         (Output_section_data_build::Output_section_data_build): New
201         constructor with size parameter.
202         (Output_data_space::Output_data_space): Likewise.
203         (Output_data_got::Output_data_got): Initialize new data member; new
204         constructor with size parameter.
205         (Output_data_got::add_constant): Call add_got_entry.
206         (Output_data_got::reserve_slot): New function.
207         (Output_data_got::reserve_slot_for_global): New function.
208         (class Output_data_got::Got_entry): Add RESERVED_CODE.
209         (Output_data_got::add_got_entry): New function.
210         (Output_data_got::add_got_entry_pair): New function.
211         (Output_data_got::free_list_): New data member.
212         * target.h (Sized_target::init_got_plt_for_update): New function.
213         (Sized_target::register_global_plt_entry): New function.
214         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
215         Initialize new data member; call init; add constructor with PLT count.
216         (Output_data_plt_x86_64::init): New function.
217         (Output_data_plt_x86_64::add_relocation): New function.
218         (Output_data_plt_x86_64::reserve_slot): New function.
219         (Output_data_plt_x86_64::free_list_): New data member.
220         (Target_x86_64::init_got_plt_for_update): New function.
221         (Target_x86_64::register_global_plt_entry): New function.
222         (Output_data_plt_x86_64::add_entry): Allocate from free list for
223         incremental updates.
224         (Output_data_plt_x86_64::add_relocation): New function.
225         * testsuite/object_unittest.cc (Object_test): Set default options.
226
227 2011-05-16  Ian Lance Taylor  <iant@google.com>
228
229         * options.h (class General_options): Make -i a synonym for -r.
230
231 2011-05-16  Ian Lance Taylor  <iant@google.com>
232
233         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
234
235 2011-05-10 Cary Coutant  <ccoutant@google.com>
236
237         * object.cc (Sized_relobj::do_count_local_symbols): Check for
238         strip_all (-s).
239
240 2011-05-06  Ian Lance Taylor  <iant@google.com>
241
242         * layout.cc (Layout::layout): If the output section flags change,
243         update the ordering.
244
245 2011-04-25 Cary Coutant  <ccoutant@google.com>
246
247         * incremental-dump.cc (dump_incremental_inputs): Print local
248         symbol info for each input file.
249         * incremental.cc
250         (Output_section_incremental_inputs::set_final_data_size): Add local
251         symbol info to input file entries in incremental info.
252         (Output_section_incremental_inputs::write_info_blocks): Likewise.
253         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
254         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
255         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
256         implementation.
257         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
258         (Sized_incr_relobj::do_relocate): Write the local symbols.
259         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
260         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
261         Adjust size of input file header.
262         (Incremental_inputs_reader::get_local_symbol_offset): New function.
263         (Incremental_inputs_reader::get_local_symbol_count): New function.
264         (Incremental_inputs_reader::get_input_section): Adjust size of input
265         file header.
266         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
267         (Sized_incr_relobj::This): New typedef.
268         (Sized_incr_relobj::sym_size): New const data member.
269         (Sized_incr_relobj::Local_symbol): New struct.
270         (Sized_incr_relobj::do_output_local_symbol_count): New function.
271         (Sized_incr_relobj::do_local_symbol_offset): New function.
272         (Sized_incr_relobj::local_symbol_count_): New data member.
273         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
274         (Sized_incr_relobj::local_symbol_index_): New data member.
275         (Sized_incr_relobj::local_symbol_offset_): New data member.
276         (Sized_incr_relobj::local_dynsym_offset_): New data member.
277         (Sized_incr_relobj::local_symbols_): New data member.
278         * object.h (Relobj::output_local_symbol_count): New function.
279         (Relobj::local_symbol_offset): New function.
280         (Relobj::do_output_local_symbol_count): New function.
281         (Relobj::do_local_symbol_offset): New function.
282         (Sized_relobj::do_output_local_symbol_count): New function.
283         (Sized_relobj::do_local_symbol_offset): New function.
284
285 2011-04-22  Vladimir Simonov  <sv@sw.ru>
286
287         * descriptors.cc (set_close_on_exec): New function.
288         (Descriptors::open): Use set_close_on_exec.
289         * output.cc (S_ISLNK): Define if not defined.
290
291 2011-04-22 Cary Coutant  <ccoutant@google.com>
292
293         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
294         global symbol map.
295         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
296         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
297         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
298         relocations.
299         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
300         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
301         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
302         * incremental.h
303         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
304         function.
305         (Incremental_binary::apply_incremental_relocs): New function.
306         (Incremental_binary::do_apply_incremental_relocs): New function.
307         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
308         data member.
309         (Sized_incremental_binary::add_global_symbol): New function.
310         (Sized_incremental_binary::global_symbol): New function.
311         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
312         (Sized_incremental_binary::symbol_map_): New data member.
313         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
314         * target.h (Sized_target::apply_relocation): New function.
315         * target-reloc.h (apply_relocation): New function.
316         * x86_64.cc (Target_x86_64::apply_relocation): New function.
317
318 2011-04-22  Doug Kwan  <dougkwan@google.com>
319
320         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
321         flag of a SHT_ARM_EXIDX section.
322         * testsuite/Makefile.am (arm_exidx_test): New test rules.
323         * testsuite/Makefile.in: Regenerate.
324         * testsuite/arm_exidx_test.s: New file.
325         * testsuite/arm_exidx_test.sh: Same.
326
327 2011-04-20 Cary Coutant  <ccoutant@google.com>
328
329         PR gold/12689
330         * archive.h (Incremental_archive_entry::Archive_member):
331         Initialize arg_serial_ (second constructor).
332
333 2011-04-17  Ian Lance Taylor  <iant@google.com>
334
335         * object.cc (Relocate_info::location): Simplify location string.
336         * errors.cc (Errors::error_at_location): Don't print program
337         name.
338         (Errors::warning_at_location): Likewise.
339         (Errors::undefined_symbol): Likewise.
340         * testsuite/debug_msg.sh: Update accordingly.
341
342 2011-04-14 Cary Coutant  <ccoutant@google.com>
343
344         * gold/layout.cc (Layout::symtab_section_offset): New function.
345         * gold/layout.h (Layout::symtab_section_offset): New function.
346         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
347
348 2011-04-12  Ian Lance Taylor  <iant@google.com>
349
350         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
351         with MREMAP_MAYMOVE.
352         * output.h (class Output_file): Add map_is_allocated_ field.
353         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
354         not available, provide stubs.  If mremap is not available, #define
355         it to gold_mremap.
356         (MREMAP_MAYMOVE): Define if not defined.
357         (Output_file::Output_file): Initialize map_is_allocated_.
358         (Output_file::resize): Check map_is_allocated_.
359         (Output_file::map_anonymous): If mmap fails, use malloc.
360         (Output_file::unmap): Don't do anything for an anonymous map.
361         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
362         is not available, provide stubs.
363         (File_read::View::~View): Use free rather than delete[].
364         (File_read::make_view): Use malloc rather than new[].  If mmap
365         fails, use malloc.
366         (File_read::find_or_make_view): Use malloc rather than new[].
367         * gold.h: Remove HAVE_REMAP code.
368         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
369         exists.  Rename mremap to gold_mremap.  If mmap is not available
370         don't do anything.
371         * configure, config.in: Rebuild.
372
373 2011-04-11  Ian Lance Taylor  <iant@google.com>
374
375         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
376         initialize local variable v.
377
378 2011-04-11  Cary Coutant  <ccoutant@google.com>
379
380         * archive.cc (Archive::include_member): Adjust call to
381         report_object.
382         (Add_archive_symbols::run): Track argument serial numbers.
383         (Lib_group::include_member): Likewise.
384         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
385         * archive.h (Incremental_archive_entry::Archive_member):
386         Initialize arg_serial_.
387         (Archive_member::arg_serial_): New data member.
388         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
389         (Sized_dynobj::do_add_symbols): Track symbols when doing an
390         incremental link.
391         (Sized_dynobj::do_for_all_local_got_entries): New function.
392         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
393         function.
394         * fileread.cc (get_mtime): New function.
395         * fileread.h (get_mtime): New function.
396         * gold.cc (queue_initial_tasks): Check for incremental update.
397         (process_incremental_input): New function.
398         (queue_middle_tasks): Don't force valid target for incremental
399         update.
400         * incremental-dump.cc (find_input_containing_global): Adjust
401         size of symbol info entry.
402         (dump_incremental_inputs): Dump argument serial number and
403         in_system_directory flag; bias shndx by 1; print symbol names
404         when dumping per-file symbol lists; use new symbol info readers.
405         * incremental.cc
406         (Output_section_incremental_inputs:update_data_size): New function.
407         (Sized_incremental_binary::setup_readers): Setup input readers
408         for each input file; build maps for files added from libraries
409         and scripts.
410         (Sized_incremental_binary::check_input_args): New function.
411         (Sized_incremental_binary::do_check_inputs): Build map of argument
412         serial numbers to input arguments.
413         (Sized_incremental_binary::do_file_has_changed): Rename
414         do_file_is_unchanged to this; compare file modification times.
415         (Sized_incremental_binary::do_init_layout): New function.
416         (Sized_incremental_binary::do_reserve_layout): New function.
417         (Sized_incremental_binary::do_get_input_reader): Remove.
418         (Sized_incremental_binary::get_symtab_view): New function.
419         (Incremental_checker::can_incrementally_link_output_file): Remove.
420         (Incremental_inputs::report_command_line): Exclude --debug options.
421         (Incremental_inputs::report_archive_begin): Add parameter; track
422         argument serial numbers; don't put input file entry for archive
423         before archive members.
424         (Incremental_inputs::report_archive_end): Put input file entry
425         for archive after archive members.
426         (Incremental_inputs::report_object): Add parameter; track argument
427         serial numbers and in_system_directory flag.
428         (Incremental_inputs::report_script): Add parameter; track argument
429         serial numbers.
430         (Output_section_incremental_inputs::set_final_data_size): Adjust
431         size of symbol info entry; check for forwarding symbols.
432         (Output_section_incremental_inputs::write_input_files): Write
433         in_system_directory flag and argument serial number.
434         (Output_section_incremental_inputs::write_info_blocks): Map section
435         indices between incremental info and original input file; store
436         input section index for each symbol.
437         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
438         change operator() to visit().
439         (class Global_got_offset_visitor): Likewise.
440         (class Global_symbol_visitor_got_plt):
441         (Output_section_incremental_inputs::write_got_plt): Use new visitor
442         classes.
443         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
444         (Sized_incr_relobj::do_read_symbols): New function.
445         (Sized_incr_relobj::do_layout): New function.
446         (Sized_incr_relobj::do_layout_deferred_sections): New function.
447         (Sized_incr_relobj::do_add_symbols): New function.
448         (Sized_incr_relobj::do_should_include_member): New function.
449         (Sized_incr_relobj::do_for_all_global_symbols): New function.
450         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
451         (Sized_incr_relobj::do_section_size): New function.
452         (Sized_incr_relobj::do_section_name): New function.
453         (Sized_incr_relobj::do_section_contents): New function.
454         (Sized_incr_relobj::do_section_flags): New function.
455         (Sized_incr_relobj::do_section_entsize): New function.
456         (Sized_incr_relobj::do_section_address): New function.
457         (Sized_incr_relobj::do_section_type): New function.
458         (Sized_incr_relobj::do_section_link): New function.
459         (Sized_incr_relobj::do_section_info): New function.
460         (Sized_incr_relobj::do_section_addralign): New function.
461         (Sized_incr_relobj::do_initialize_xindex): New function.
462         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
463         (Sized_incr_relobj::do_read_relocs): New function.
464         (Sized_incr_relobj::do_gc_process_relocs): New function.
465         (Sized_incr_relobj::do_scan_relocs): New function.
466         (Sized_incr_relobj::do_count_local_symbols): New function.
467         (Sized_incr_relobj::do_finalize_local_symbols): New function.
468         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
469         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
470         (Sized_incr_relobj::do_relocate): New function.
471         (Sized_incr_relobj::do_set_section_offset): New function.
472         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
473         (Sized_incr_dynobj::do_read_symbols): New function.
474         (Sized_incr_dynobj::do_layout): New function.
475         (Sized_incr_dynobj::do_add_symbols): New function.
476         (Sized_incr_dynobj::do_should_include_member): New function.
477         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
478         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
479         (Sized_incr_dynobj::do_section_size): New function.
480         (Sized_incr_dynobj::do_section_name): New function.
481         (Sized_incr_dynobj::do_section_contents): New function.
482         (Sized_incr_dynobj::do_section_flags): New function.
483         (Sized_incr_dynobj::do_section_entsize): New function.
484         (Sized_incr_dynobj::do_section_address): New function.
485         (Sized_incr_dynobj::do_section_type): New function.
486         (Sized_incr_dynobj::do_section_link): New function.
487         (Sized_incr_dynobj::do_section_info): New function.
488         (Sized_incr_dynobj::do_section_addralign): New function.
489         (Sized_incr_dynobj::do_initialize_xindex): New function.
490         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
491         (make_sized_incremental_object): New function.
492         (Incremental_library::copy_unused_symbols): New function.
493         (Incremental_library::do_for_all_unused_symbols): New function.
494         * incremental.h (enum Incremental_input_flags): New type.
495         (class Incremental_checker): Remove.
496         (Incremental_input_entry::Incremental_input_entry): Add argument
497         serial number.
498         (Incremental_input_entry::arg_serial): New function.
499         (Incremental_input_entry::set_is_in_system_directory): New function.
500         (Incremental_input_entry::is_in_system_directory): New function.
501         (Incremental_input_entry::arg_serial_): New data member.
502         (Incremental_input_entry::is_in_system_directory_): New data member.
503         (class Script_info): Move here from script.h.
504         (Script_info::Script_info): Add filename parameter.
505         (Script_info::filename): New function.
506         (Script_info::filename_): New data member.
507         (Incremental_script_entry::Incremental_script_entry): Add argument
508         serial number.
509         (Incremental_object_entry::Incremental_object_entry): Likewise.
510         (Incremental_object_entry::add_input_section): Build list of input
511         sections with map to original shndx.
512         (Incremental_object_entry::get_input_section_index): New function.
513         (Incremental_object_entry::shndx_): New data member.
514         (Incremental_object_entry::name_key_): Rename; adjust all refs.
515         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
516         (Incremental_archive_entry::Incremental_archive_entry): Add argument
517         serial number.
518         (Incremental_inputs::report_archive_begin): Likewise.
519         (Incremental_inputs::report_object): Likewise.
520         (Incremental_inputs::report_script): Likewise.
521         (class Incremental_global_symbol_reader): New class.
522         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
523         and store flags and input file type.
524         (Incremental_input_entry_reader::arg_serial): New function.
525         (Incremental_input_entry_reader::type): Extract type from flags.
526         (Incremental_input_entry_reader::is_in_system_directory): New function.
527         (Incremental_input_entry_reader::get_input_section_count): Call
528         accessor function for type.
529         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
530         function for type; adjust size of global symbol entry.
531         (Incremental_input_entry_reader::get_global_symbol_count): Call
532         accessor function for type.
533         (Incremental_input_entry_reader::get_object_count): Likewise.
534         (Incremental_input_entry_reader::get_object_offset): Likewise.
535         (Incremental_input_entry_reader::get_member_count): Likewise.
536         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
537         (Incremental_input_entry_reader::get_member_offset): Likewise.
538         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
539         (Incremental_input_entry_reader::Global_symbol_info): Remove.
540         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
541         (Incremental_input_entry_reader::get_global_symbol_reader): New
542         function.
543         (Incremental_input_entry_reader::get_output_symbol_index): New
544         function.
545         (Incremental_input_entry_reader::type_): Remove.
546         (Incremental_input_entry_reader::flags_): New data member.
547         (Incremental_inputs_reader::input_file_offset): New function.
548         (Incremental_inputs_reader::input_file_index): New function.
549         (Incremental_inputs_reader::input_file): Call input_file_offset.
550         (Incremental_inputs_reader::input_file_at_offset): New function.
551         (Incremental_relocs_reader::get_r_type): Reformat.
552         (Incremental_relocs_reader::get_r_shndx): Reformat.
553         (Incremental_relocs_reader::get_r_offset): Reformat.
554         (Incremental_relocs_reader::data): New function.
555         (Incremental_binary::Incremental_binary): Initialize new data members.
556         (Incremental_binary::check_inputs): Add cmdline parameter.
557         (Incremental_binary::file_is_unchanged): Remove.
558         (Input_reader::arg_serial): New function.
559         (Input_reader::get_unused_symbol_count): New function.
560         (Input_reader::get_unused_symbol): New function.
561         (Input_reader::do_arg_serial): New function.
562         (Input_reader::do_get_unused_symbol_count): New function.
563         (Input_reader::do_get_unused_symbol): New function.
564         (Incremental_binary::input_file_count): New function.
565         (Incremental_binary::get_input_reader): Change signature to use
566         index instead of filename.
567         (Incremental_binary::file_has_changed): New function.
568         (Incremental_binary::get_input_argument): New function.
569         (Incremental_binary::get_library): New function.
570         (Incremental_binary::get_script_info): New function.
571         (Incremental_binary::init_layout): New function.
572         (Incremental_binary::reserve_layout): New function.
573         (Incremental_binary::output_file): New function.
574         (Incremental_binary::do_check_inputs): New function.
575         (Incremental_binary::do_file_is_unchanged): Remove.
576         (Incremental_binary::do_file_has_changed): New function.
577         (Incremental_binary::do_init_layout): New function.
578         (Incremental_binary::do_reserve_layout): New function.
579         (Incremental_binary::do_input_file_count): New function.
580         (Incremental_binary::do_get_input_reader): Change signature.
581         (Incremental_binary::input_args_map_): New data member.
582         (Incremental_binary::library_map_): New data member.
583         (Incremental_binary::script_map_): New data member.
584         (Sized_incremental_binary::Sized_incremental_binary): Initialize
585         new data members.
586         (Sized_incremental_binary::output_section): New function.
587         (Sized_incremental_binary::inputs_reader): Add const.
588         (Sized_incremental_binary::symtab_reader): Add const.
589         (Sized_incremental_binary::relocs_reader): Add const.
590         (Sized_incremental_binary::got_plt_reader): Add const.
591         (Sized_incremental_binary::get_symtab_view): New function.
592         (Sized_incremental_binary::Inputs_reader): New typedef.
593         (Sized_incremental_binary::Input_entry_reader): New typedef.
594         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
595         (Sized_incremental_binary::do_file_is_unchanged): Remove.
596         (Sized_incremental_binary::do_file_has_changed): New function.
597         (Sized_incremental_binary::do_init_layout): New function.
598         (Sized_incremental_binary::do_reserve_layout): New function.
599         (Sized_input_reader::Inputs_reader): Remove.
600         (Sized_input_reader::Input_entry_reader): Remove.
601         (Sized_input_reader::do_arg_serial): New function.
602         (Sized_input_reader::do_get_unused_symbol_count): New function.
603         (Sized_input_reader::do_get_unused_symbol): New function.
604         (Sized_incremental_binary::do_input_file_count): New function.
605         (Sized_incremental_binary::do_get_input_reader): Change signature;
606         use index instead of filename.
607         (Sized_incremental_binary::section_map_): New data member.
608         (Sized_incremental_binary::input_entry_readers_): New data member.
609         (class Sized_incr_relobj): New class.
610         (class Sized_incr_dynobj): New class.
611         (make_sized_incremental_object): New function.
612         (class Incremental_library): New class.
613         * layout.cc (Free_list::num_lists): New static data member.
614         (Free_list::num_nodes): New static data member.
615         (Free_list::num_removes): New static data member.
616         (Free_list::num_remove_visits): New static data member.
617         (Free_list::num_allocates): New static data member.
618         (Free_list::num_allocate_visits): New static data member.
619         (Free_list::init): New function.
620         (Free_list::remove): New function.
621         (Free_list::allocate): New function.
622         (Free_list::dump): New function.
623         (Free_list::print_stats): New function.
624         (Layout_task_runner::run): Resize output file for incremental updates.
625         (Layout::Layout): Initialize new data members.
626         (Layout::set_incremental_base): New function.
627         (Layout::init_fixed_output_section): New function.
628         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
629         incremental updates.
630         (Layout::create_gold_note): Do not create gold note section for
631         incremental updates.
632         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
633         for incremental updates.
634         (Layout::set_section_offsets): For incremental updates, allocate space
635         from free list.
636         (Layout::create_symtab_sections): Layout with offsets relative to
637         start of section; for incremental updates, allocate space from free
638         list.
639         (Layout::create_shdrs): For incremental updates, allocate space from
640         free list.
641         (Layout::finish_dynamic_section): For incremental updates, do not
642         check --as-needed (fixed in subsequent patch).
643         * layout.h (class Free_list): New class.
644         (Layout::set_incremental_base): New function.
645         (Layout::incremental_base): New function.
646         (Layout::init_fixed_output_section): New function.
647         (Layout::allocate): New function.
648         (Layout::incremental_base_): New data member.
649         (Layout::free_list_): New data member.
650         * main.cc (main): Print Free_list statistics.
651         * object.cc (Relobj::finalize_incremental_relocs): Add
652         clear_counts parameter; clear counts only when clear_counts is set.
653         (Sized_relobj::Sized_relobj): Initialize new base class.
654         (Sized_relobj::do_layout): Don't report special sections.
655         (Sized_relobj::do_for_all_local_got_entries): New function.
656         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
657         symtab_off to all symbol table offsets.
658         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
659         * object.h (class Got_offset_list): Move to top of file.
660         (Object::Object): Allow case where input_file == NULL.
661         (Object::~Object): Likewise.
662         (Object::input_file): Assert that input_file != NULL.
663         (Object::lock): Allow case where input_file == NULL.
664         (Object::unlock): Likewise.
665         (Object::is_locked): Likewise.
666         (Object::token): Likewise.
667         (Object::release): Likewise.
668         (Object::is_incremental): New function.
669         (Object::get_mtime): New function.
670         (Object::for_all_local_got_entries): New function.
671         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
672         (Object::set_is_in_system_directory): New function.
673         (Object::is_in_system_directory): New function.
674         (Object::do_is_incremental): New function.
675         (Object::do_get_mtime): New function.
676         (Object::do_for_all_local_got_entries): New function.
677         (Object::is_in_system_directory_): New data member.
678         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
679         (class Sized_relobj_base): New class.
680         (class Sized_relobj): Derive from Sized_relobj_base.
681         (class Sized_relobj::Symbols): Redeclare from base class.
682         (class Sized_relobj::local_got_offset_list): Remove.
683         (class Sized_relobj::Output_sections): Redeclare from base class.
684         (class Sized_relobj::do_for_all_local_got_entries): New function.
685         (class Sized_relobj::write_local_symbols): Add offset parameter.
686         (class Sized_relobj::local_symbol_offset_): Update comment.
687         (class Sized_relobj::local_dynsym_offset_): Update comment.
688         * options.cc (Input_arguments::add_file): Remove const.
689         * options.h (Input_file_argument::Input_file_argument):
690         Initialize arg_serial_ (all constructors).
691         (Input_file_argument::set_arg_serial): New function.
692         (Input_file_argument::arg_serial): New function.
693         (Input_file_argument::arg_serial_): New data member.
694         (Input_arguments::Input_arguments): Initialize file_count_.
695         (Input_arguments::add_file): Remove const.
696         (Input_arguments::number_of_input_files): New function.
697         (Input_arguments::file_count_): New data member.
698         (Command_line::number_of_input_files): Call
699         Input_arguments::number_of_input_files.
700         * output.cc (Output_segment_headers::Output_segment_headers):
701         Set current size.
702         (Output_section::Input_section::current_data_size): New function.
703         (Output_section::Output_section): Initialize new data members.
704         (Output_section::add_input_section): Don't do merge sections for
705         an incremental link; allocate space from free list for an
706         incremental update.
707         (Output_section::add_output_section_data): Allocate space from
708         free list for an incremental update.
709         (Output_section::update_data_size): New function.
710         (Output_section::set_fixed_layout): New function.
711         (Output_section::reserve): New function.
712         (Output_segment::set_section_addresses): Remove const.
713         (Output_segment::set_section_list_addresses): Remove const; allocate
714         space from free list for an incremental update.
715         (Output_segment::set_offset): Adjust size of RELRO segment for an
716         incremental update.
717         * output.h (Output_data::current_data_size): Move here from
718         child classes.
719         (Output_data::pre_finalize_data_size): New function.
720         (Output_data::update_data_size): New function.
721         (Output_section_headers::update_data_size): new function.
722         (Output_section_data_build::current_data_size): Move to Output_data.
723         (Output_data_strtab::update_data_size): New function.
724         (Output_section::current_data_size): Move to Output_data.
725         (Output_section::set_fixed_layout): New function.
726         (Output_section::has_fixed_layout): New function.
727         (Output_section::reserve): New function.
728         (Output_section::update_data_size): New function.
729         (Output_section::has_fixed_layout_): New data member.
730         (Output_section::free_list_): New data member.
731         (Output_segment::set_section_addresses): Remove const.
732         (Output_segment::set_section_list_addresses): Remove const.
733         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
734         New function.
735         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
736         New function.
737         * readsyms.cc (Read_symbols::do_read_symbols): Add library
738         parameter when calling Add_symbols constructor; store argument
739         serial number for members of a lib group.
740         (Add_symbols::locks): Allow case where token == NULL.
741         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
742         (Read_member::~Read_member): New function.
743         (Read_member::is_runnable): New function.
744         (Read_member::locks): New function.
745         (Read_member::run): New function.
746         (Check_script::~Check_script): New function.
747         (Check_script::is_runnable): New function.
748         (Check_script::locks): New function.
749         (Check_script::run): New function.
750         (Check_library::~Check_library): New function.
751         (Check_library::is_runnable): New function.
752         (Check_library::locks): New function.
753         (Check_library::run): New function.
754         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
755         (Add_symbols::library_): New data member.
756         (class Read_member): New class.
757         (class Check_script): New class.
758         (class Check_library): New class.
759         * reloc.cc (Read_relocs::is_runnable): Allow case where
760         token == NULL.
761         (Read_relocs::locks): Likewise.
762         (Scan_relocs::locks): Likewise.
763         (Relocate_task::locks): Likewise.
764         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
765         to clear counters.
766         (Sized_relobj::incremental_relocs_scan): Fix comment.
767         (Sized_relobj::do_relocate): Pass output file offset to
768         write_local_symbols.
769         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
770         from class declaration.
771         * script.cc (read_input_script): Allocate Script_info; pass
772         argument serial number to report_script.
773         * script.h (class Script_info): Move to incremental.h.
774         * symtab.cc (Symbol_table::add_from_incrobj): New function.
775         * symtab.h (Symbol_table::add_from_incrobj): New function.
776         (Symbol_table::set_file_offset): New function.
777
778 2011-04-05  Cary Coutant  <ccoutant@google.com>
779
780         * incremental-dump.cc (dump_incremental_inputs): Change signature
781         to take a Sized_incremental_binary; change caller.  Use readers
782         in Sized_incremental_binary.
783         * incremental.cc
784         (Sized_incremental_binary::find_incremental_inputs_sections):
785         Rename do_find_incremental_inputs_sections to this.
786         (Sized_incremental_binary::setup_readers): New function.
787         (Sized_incremental_binary::do_check_inputs): Check
788         has_incremental_info_ flag; move setup code to setup_readers;
789         use input readers.
790         (Sized_incremental_binary::do_file_is_unchanged): New function.
791         (Sized_incremental_binary::do_get_input_reader): New function.
792         * incremental.h (class Incremental_binary): Move to end of file.
793         (Incremental_binary::file_is_unchanged): New function.
794         (Incremental_binary::do_file_is_unchanged): New function.
795         (Incremental_binary::Input_reader): New class.
796         (Incremental_binary::get_input_reader): New function.
797         (class Sized_incremental_binary): Move to end of file.
798         (Sized_incremental_binary::Sized_incremental_binary): Setup the
799         input section reader classes.
800         (Sized_incremental_binary::has_incremental_info): New function.
801         (Sized_incremental_binary::inputs_reader): New function.
802         (Sized_incremental_binary::symtab_reader): New function.
803         (Sized_incremental_binary::relocs_reader): New function.
804         (Sized_incremental_binary::got_plt_reader): New function.
805         (Sized_incremental_binary::do_file_is_unchanged): New function.
806         (Sized_incremental_binary::Sized_input_reader): New class.
807         (Sized_incremental_binary::get_input_reader): New function.
808         (Sized_incremental_binary::find_incremental_inputs_sections):
809         Rename do_find_incremental_inputs_sections to this.
810         (Sized_incremental_binary::setup_readers): New function.
811         (Sized_incremental_binary::has_incremental_info_): New data member.
812         (Sized_incremental_binary::inputs_reader_): New data member.
813         (Sized_incremental_binary::symtab_reader_): New data member.
814         (Sized_incremental_binary::relocs_reader_): New data member.
815         (Sized_incremental_binary::got_plt_reader_): New data member.
816         (Sized_incremental_binary::current_input_file_): New data member.
817
818 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
819
820         PR gold/12640
821         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
822         violation.
823
824 2011-03-30  Cary Coutant  <ccoutant@google.com>
825
826         * archive.cc (Archive::include_member): Adjust call to report_object.
827         (Add_archive_symbols::run): Add script_info to call to
828         report_archive_begin.
829         (Lib_group::include_member): Adjust call to report_object.
830         (Add_lib_group_symbols::run): Adjust call to report_object.
831         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
832         blocks.  Add object count for script input files.
833         * incremental.cc (Incremental_inputs::report_archive_begin): Add
834         script_info parameter; change all callers.
835         (Incremental_inputs::report_object): Add script_info parameter;
836         change all callers.
837         (Incremental_inputs::report_script): Store backpointer to
838         incremental info entry.
839         (Output_section_incremental_inputs::set_final_data_size): Record
840         additional information for scripts.
841         (Output_section_incremental_inputs::write_info_blocks): Likewise.
842         * incremental.h (Incremental_script_entry::add_object): New function.
843         (Incremental_script_entry::get_object_count): New function.
844         (Incremental_script_entry::get_object): New function.
845         (Incremental_script_entry::objects_): New data member; adjust
846         constructor.
847         (Incremental_inputs::report_archive_begin): Add script_info parameter.
848         (Incremental_inputs::report_object): Add script_info parameter.
849         (Incremental_inputs_reader::get_object_count): New function.
850         (Incremental_inputs_reader::get_object_offset): New function.
851         * options.cc (Input_arguments::add_file): Return reference to
852         new input argument.
853         * options.h (Input_argument::set_script_info): New function.
854         (Input_argument::script_info): New function.
855         (Input_argument::script_info_): New data member; adjust all
856         constructors.
857         (Input_file_group::add_file): Return reference to new input argument.
858         (Input_file_lib::add_file): Likewise.
859         (Input_arguments::add_file): Likewise.
860         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
861         * script.cc (Parser_closure::Parser_closure): Add script_info
862         parameter; adjust all callers.
863         (Parser_closure::script_info): New function.
864         (Parser_closure::script_info_): New data member.
865         (read_input_script): Report scripts earlier to incremental info.
866         (script_add_file): Set script_info in Input_argument.
867         (script_add_library): Likewise.
868         * script.h (Script_options::Script_info): Rewrite class.
869
870 2011-03-29  Cary Coutant  <ccoutant@google.com>
871
872         * archive.cc (Library_base::should_include_member): Move
873         method here from class Archive.
874         (Archive::Archive): Initialize base class.
875         (Archive::should_include_member): Move to base class.
876         (Archive::do_for_all_unused_symbols): New function.
877         (Add_archive_symbols::run): Remove redundant access to
878         incremental_inputs.
879         (Lib_group::Lib_group): Initialize base class.
880         (Lib_group::do_filename): New function.
881         (Lib_group::include_member): Pass pointer to Lib_group to
882         report_object.
883         (Lib_group::do_for_all_unused_symbols): New function.
884         (Add_lib_group_symbols::run): Report archive information for
885         incremental links.
886         * archive.h (class Library_base): New base class.
887         (class Archive): Derive from Library_base.
888         (Archive::filename): Move to base class.
889         (Archive::set_incremental_info): Likewise.
890         (Archive::incremental_info): Likewise.
891         (Archive::Should_include): Likewise.
892         (Archive::should_include_member): Likewise.
893         (Archive::Armap_entry): Remove.
894         (Archive::Unused_symbol_iterator): Remove.
895         (Archive::unused_symbols_begin): Remove.
896         (Archive::unused_symbols_end): Remove.
897         (Archive::do_filename): New function.
898         (Archive::do_get_mtime): New function.
899         (Archive::do_for_all_unused_symbols): New function.
900         (Archive::task_): Move to base class.
901         (Archive::incremental_info_): Likewise.
902         (class Lib_group): Derive from Library_base.
903         (Lib_group::do_filename): New function.
904         (Lib_group::do_get_mtime): New function.
905         (Lib_group::do_for_all_unused_symbols): New function.
906         (Lib_group::task_): Move to base class.
907         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
908         function.
909         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
910         function.
911         * incremental.cc (Incremental_inputs::report_archive_begin):
912         Use Library_base; call library's get_mtime; add incremental inputs
913         entry before members.
914         (class Unused_symbol_visitor): New class.
915         (Incremental_inputs::report_archive_end): Use Library_base; use
916         visitor class to record unused symbols; don't add incremental inputs
917         entry after members.
918         (Incremental_inputs::report_object): Use Library_base.
919         * incremental.h
920         (Incremental_archive_entry::Incremental_archive_entry): Remove
921         unused Archive parameter.
922         (Incremental_inputs::report_archive_begin): Use Library_base.
923         (Incremental_inputs::report_archive_end): Likewise.
924         (Incremental_inputs::report_object): Likewise.
925         * object.cc (Sized_relobj::do_for_all_global_symbols): New
926         function.
927         * object.h (Object::for_all_global_symbols): New function.
928         (Object::do_for_all_global_symbols): New function.
929         (Sized_relobj::do_for_all_global_symbols): New function.
930         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
931         function.
932         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
933         function.
934
935 2011-03-27  Ian Lance Taylor  <iant@google.com>
936
937         * archive.cc (Archive::interpret_header): Return -1 if something
938         goes wrong.  Change callers accordingly.
939
940 2011-03-25  Cary Coutant  <ccoutant@google.com>
941
942         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
943         * testsuite/Makefile.in: Regenerate.
944
945 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
946
947         * plugin.cc (get_view): New.
948         (Plugin::load): Pass get_view to the plugin.
949         (Plugin_manager::get_view): New.
950
951 2011-03-21  Ian Lance Taylor  <iant@google.com>
952
953         * testsuite/final_layout.sh: Rewrite to not use dc.
954         * testsuite/relro_test.sh: Fail if dc is not present.
955
956 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
957
958         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
959         Change == to -eq.
960         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
961         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
962         Change == to -eq.
963         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
964         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
965
966 2011-03-14  Ian Lance Taylor  <iant@google.com>
967
968         * script-sections.cc (Sort_output_sections::script_compare):
969         Rename from is_before, change return type.
970         (Sort_output_sections::operator()): Adjust accordingly.
971
972 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
973
974         PR gold/12572
975         * testsuite/odr_violation2.cc: Add comment to make all error line
976         numbers double digits.
977         * testsuite/debug_msg.sh: Adjust expected errors.
978
979 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
980
981         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
982         but mark earlier ones as non-canonical
983         (offset_to_iterator): Update search target and example
984         (do_addr2line): Return extra lines in a vector*
985         (format_file_lineno): Extract from do_addr2line
986         (one_addr2line): Add vector* out-param
987         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
988         when a lineno entry appeared last for its instruction
989         (Dwarf_line_info): Add vector* out-param
990         * object.cc (Relocate_info): Pass NULL for the vector* out-param
991         * symtab.cc (Odr_violation_compare): Include the lineno in the
992         comparison again.
993         (linenos_from_loc): New. Combine the canonical line for an
994         address with its other lines.
995         (True_if_intersect): New. Helper functor to make
996         std::set_intersection a query.
997         (detect_odr_violations): Compare sets of lines instead of just
998         one line for each function. This became less deterministic, but
999         has fewer false positives.
1000         * symtab.h: Declarations.
1001         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1002         mix an optimized and non-optimized object in the same binary
1003         (odr_violation2.so): Same.
1004         * testsuite/Makefile.in: Regenerate from Makefile.am.
1005         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1006         * testsuite/debug_msg.sh: Update line numbers and add
1007         assertions.
1008         * testsuite/odr_violation1.cc: Use OdrDerived, in a
1009         non-optimized context.
1010         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1011         isn't inlined, and use OdrDerived in an optimized context.
1012         * testsuite/odr_header1.h: Defines OdrDerived, where
1013         optimization will change the
1014         first-instruction-in-the-destructor's file and line number.
1015         * testsuite/odr_header2.h: Defines OdrBase.
1016
1017 2011-03-09  Ian Lance Taylor  <iant@google.com>
1018
1019         * fileread.cc (File_read::clear_views): Don't delete the whole
1020         file view.
1021
1022 2011-03-08  Ian Lance Taylor  <iant@google.com>
1023
1024         PR gold/12525
1025         * fileread.cc: #include <climits>.
1026         (GOLD_IOV_MAX): Define.
1027         (File_read::read_multiple): Limit number of entries by iov_max.
1028         * fileread.h (class File_read): Always set max_readv_entries to
1029         128.
1030
1031 2011-03-07  Ian Lance Taylor  <iant@google.com>
1032
1033         PR gold/12525
1034         * options.h (class General_options): Add -dy and -dn.
1035
1036 2011-03-02  Cary Coutant  <ccoutant@google.com>
1037
1038         * testsuite/script_test_9.t: Add TLS segment.
1039
1040 2011-03-02  Simon Baldwin  <simonb@google.com>
1041
1042         * configure.ac: Add check for gnu_indirect_function support in
1043         the toolchain building binutils.
1044         * configure: Rebuild.
1045
1046 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
1047
1048         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1049         plugin only symbols.
1050         (Symbol_table::sized_finalize_symbol) Mark symbol only present
1051         in plugin files as not needed in the symbol table.
1052
1053 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
1054
1055         * output.cc (Output_section::add_input_section): Delay fill
1056         generation for section ordering.
1057
1058 2011-02-09  Ian Lance Taylor  <iant@google.com>
1059
1060         PR gold/12316
1061         * object.h (class Sized_relobj): Remove clear_local_symbols.
1062         * reloc.cc (Sized_relobj::do_relocate): Don't call
1063         clear_local_symbols.
1064
1065 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
1066
1067         * plugin.cc (is_visible_from_outside): Return true for symbols
1068         in the -u option.
1069
1070 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
1071
1072         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1073         filename.
1074
1075 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
1076
1077         * icf.h (is_section_foldable_candidate): Change type of parameter
1078         to std::string.
1079         * icf.cc (Icf::find_identical_sections): Change type of local variable
1080         section_name to be std::string.
1081         (is_function_ctor_or_dtor): Change type of parameter to std::string.
1082
1083 2011-01-25  Ian Lance Taylor  <iant@google.com>
1084
1085         * script.cc (script_add_extern): Rewrite to use
1086         add_symbol_reference.
1087
1088 2011-01-25  Doug Kwan  <dougkwan@google.com>
1089
1090         * icf.cc (get_section_contents): Always lock section's object.
1091
1092 2011-01-24  Ian Lance Taylor  <iant@google.com>
1093
1094         * options.h (class General_options): Accept
1095         --no-detect-odr-violations.
1096
1097 2011-01-24  Ian Lance Taylor  <iant@google.com>
1098
1099         * version.cc (version_string): Bump to 1.11.
1100
1101 2011-01-24  Ian Lance Taylor  <iant@google.com>
1102
1103         * plugin.cc (class Plugin_rescan): Define new class.
1104         (Plugin_manager::claim_file): Set any_claimed_.
1105         (Plugin_manager::save_archive): New function.
1106         (Plugin_manager::save_input_group): New function.
1107         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1108         necessary.
1109         (Plugin_manager::new_undefined_symbol): New function.
1110         (Plugin_manager::rescan): New function.
1111         (Plugin_manager::rescannable_defines): New function.
1112         (Plugin_manager::add_input_file): Set any_added_.
1113         * plugin.h (class Plugin_manager): define new fields rescannable_,
1114         undefined_symbols_, any_claimed_, and any_added_.  Declare
1115         Plugin_rescan as friend.  Declare new functions.
1116         (Plugin_manager::Rescannable): Define type.
1117         (Plugin_manager::Rescannable_list): Define type.
1118         (Plugin_manager::Undefined_symbol_list): Define type.
1119         (Plugin_manager::Plugin_manager): Initialize new fields.
1120         * archive.cc (Archive::defines_symbol): New function.
1121         (Add_archive_symbols::run): Pass archive to plugins if any.
1122         * archive.h (class Archive): Declare defines_symbol.
1123         * readsyms.cc (Input_group::~Input_group): New function.
1124         (Finish_group::run): Pass input_group to plugins if any.
1125         * readsyms.h (class Input_group): Declare destructor.
1126         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1127         any.
1128
1129 2011-01-10  Ian Lance Taylor  <iant@google.com>
1130
1131         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1132         section as relro.
1133         (Layout::set_segment_offsets): Reset increase_relro before calling
1134         set_section_addresses a second time.
1135
1136 2011-01-04  Cary Coutant  <ccoutant@google.com>
1137
1138         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1139         sections before NOBITS sections.
1140
1141 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
1142
1143         * version.cc (print_version): Update copyright to 2011.
1144
1145 2010-12-23  Cary Coutant  <ccoutant@google.com>
1146
1147         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1148         of OS to this->add.  Add OD parameter to second form of the function.
1149
1150 2010-12-20  Ian Lance Taylor  <iant@google.com>
1151
1152         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1153         second of two consecutive entries with same offset.
1154
1155 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1156
1157         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1158         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1159         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1160         to avoid unneeded links against $(LDADD).
1161         * testsuite/Makefile.in: Regenerate.
1162
1163 2010-12-15  Ian Lance Taylor  <iant@google.com>
1164
1165         PR gold/12324
1166         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1167         for R_X86_64_32 and R_X86_64_PC32.
1168         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1169         ver_matching_def_pic.o.
1170         (ver_matching_def_pic.o): New target.
1171
1172 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1173
1174         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1175         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1176         Move definition before File_read::View member definitions.
1177         (File_read::View::~View): Initialize and hold lock before
1178         updating current_mapped_bytes.
1179
1180 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1181
1182         * dwarf_reader.cc: Remove outdated comment.
1183         * gold-threads.cc: Fix typo in error message.
1184         * archive.cc: Fix typos in comments.
1185         * archive.h: Likewise.
1186         * arm-reloc-property.cc: Likewise.
1187         * arm-reloc-property.h: Likewise.
1188         * arm-reloc.def: Likewise.
1189         * arm.cc: Likewise.
1190         * attributes.h: Likewise.
1191         * cref.cc: Likewise.
1192         * ehframe.cc: Likewise.
1193         * fileread.h: Likewise.
1194         * gold.h: Likewise.
1195         * i386.cc: Likewise.
1196         * icf.cc: Likewise.
1197         * incremental.h: Likewise.
1198         * int_encoding.cc: Likewise.
1199         * layout.h: Likewise.
1200         * main.cc: Likewise.
1201         * merge.h: Likewise.
1202         * object.cc: Likewise.
1203         * object.h: Likewise.
1204         * options.cc: Likewise.
1205         * readsyms.cc: Likewise.
1206         * reduced_debug_output.cc: Likewise.
1207         * reloc.cc: Likewise.
1208         * script-sections.cc: Likewise.
1209         * sparc.cc: Likewise.
1210         * symtab.h: Likewise.
1211         * target-reloc.h: Likewise.
1212         * target.cc: Likewise.
1213         * target.h: Likewise.
1214         * timer.cc: Likewise.
1215         * timer.h: Likewise.
1216         * x86_64.cc: Likewise.
1217
1218 2010-12-09  Cary Coutant  <ccoutant@google.com>
1219
1220         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1221         stack.
1222         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1223         parameter; change all callers.
1224         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1225         * options.h (warn_execstack): New option.
1226
1227 2010-12-07  Doug Kwan  <dougkwan@google.com>
1228
1229         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1230         like function call relocations.
1231
1232 2010-12-07  Ian Lance Taylor  <iant@google.com>
1233
1234         * archive.cc (Archive::get_elf_object_for_member): Permit
1235         punconfigured to be NULL.
1236         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1237         (Archive::include_member): Pass NULL to get_elf_object_for_member
1238         if we searched for the archive and this is the first included
1239         object.
1240
1241 2010-12-01  Ian Lance Taylor  <iant@google.com>
1242
1243         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1244         track_relocs_type_ field.
1245         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1246         Set track_relocs_type_.
1247         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1248         contents when using RELA relocs.
1249         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1250         reloc_map_.
1251         * reloc.cc (Track_relocs::next_addend): New function.
1252         * reloc.h (class Track_relocs): Declare next_addend.
1253
1254 2010-12-01  Ian Lance Taylor  <iant@google.com>
1255
1256         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1257         virtual destructor.
1258
1259 2010-12-01  Ian Lance Taylor  <iant@google.com>
1260
1261         * README: Update compilers known to work and fail.
1262
1263 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1264
1265         * configure.in: For --enable-gold, handle value `default' instead of
1266         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1267         not the default.
1268         * configure: Regenerate.
1269
1270 2010-11-18  Doug Kwan  <dougkwan@google.com>
1271
1272         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1273         and right_alignment to be zero.  Store result alignment only if it is
1274         greater than existing alignment.
1275
1276 2010-11-16  Cary Coutant  <ccoutant@google.com>
1277
1278         PR gold/12220
1279         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1280         Check for ".zdebug_line".
1281
1282 2010-11-16  Doug Kwan  <dougkwan@google.com>
1283             Cary Coutant  <ccoutant@google.com>
1284
1285         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1286         by reference; adjust all callers.
1287         * output.cc (Output_segment::set_section_addresses): Adjust references
1288         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1289         list is empty.
1290         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1291         end at page boundary.
1292
1293 2010-11-16  Cary Coutant  <ccoutant@google.com>
1294
1295         PR gold/12220
1296         * layout.cc (Layout::choose_output_section): Transform names of
1297         compressed sections even when using a script with a SECTIONS clause.
1298         (Layout::output_section_name): Remove code to transform
1299         compressed debug section names.
1300         * output.cc (Output_section::add_input_section): Use uncompressed
1301         section size when tracking input sections.
1302
1303 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1304
1305         * symtab.h (Symbol::NON_PIC_REF): Remove.
1306         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1307         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1308         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1309         (Symbol::use_plt_offset): Take a flags argument and pass it
1310         directly to needs_dynamic_reloc.  Restrict check for undefined
1311         weak symbols to function calls.
1312         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1313         (Target_arm::Scan::global): Use it.
1314         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1315         (Target_arm::Relocate::relocate): Likewise.
1316         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1317         parameter with an r_type parameter.  Use get_reference_flags
1318         to get the flags.
1319         (Target_arm::Relocate::relocate): Update accordingly.
1320         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1321         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1322         (Target_i386::Scan::global): Likewise.
1323         (Target_i386::Relocate::relocate): Likewise.
1324         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1325         parameter with an r_type parameter.  Use get_reference_flags
1326         to get the flags.
1327         (Target_i386::Relocate::relocate): Update accordingly.
1328         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1329         (Target_powerpc::Scan::global): Use it.
1330         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1331         (Target_powerpc::Relocate::relocate): Likewise.
1332         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1333         (Target_sparc::Scan::global): Use it.
1334         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1335         (Target_sparc::Relocate::relocate): Likewise.
1336         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1337         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1338         (Target_x86_64::Scan::global): Likewise.
1339         (Target_x86_64::Relocate::relocate): Likewise.
1340
1341 2010-11-08  Doug Kwan  <dougkwan@google.com>
1342             Cary Coutant  <ccoutant@google.com>
1343
1344         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1345         (Arm_exidx_merge_section::section_contents_): New data member.
1346         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1347         (Arm_input_section::~Arm_input_section): De-allocate memory.
1348         (Arm_input_section::original_contents_): New data member.       
1349         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1350         in parameters instead of calling Object::section_contents without
1351         locking.
1352         (Arm_output_section::group_section): New parameter TASK.  Pass it
1353         to callees that need locking objects.
1354         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1355         to lock EXIDX input sections.  Fix a formatting issue.  Call
1356         Arm_exidx_merged_section::build_contents to create merged section
1357         contents.
1358         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1359         to lock object of stub table owner.
1360         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1361         TEXT_SIZE to initialize data member TEXT_SIZE_.
1362         (Arm_exidx_input_section::addralign): Fix typo in comment.
1363         (Arm_exidx_input_section::text_size): New method.
1364         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1365         that require locking objects.  Lock objects before scanning for stubs
1366         and updating local symbols.
1367         (Arm_input_section<big_endian>::init): Copy contents of original
1368         input section.
1369         (Arm_input_section<big_endian>::do_write): Use saved contents of
1370         original input section instead of calling Object::section_contents
1371         without locking.
1372         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1373         size without calling Object::section_size().
1374         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1375         for size.  Allocate a buffer for merged EXIDX entries.
1376         (Arm_exidx_merged_section::build_contents): New method.
1377         (Arm_exidx_merged_section::do_write): Move merge section contents
1378         building code to Arm_exidx_merged_section::build_contetns.  Write
1379         out contetns in buffer instead of building it on the fly.
1380         (Arm_relobj::make_exidx_input_section): Also pass text section size
1381         to Arm_exidx_input_section constructor.
1382         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1383         (Arm_dynobj::do_read_symbols): Fix memory leak.
1384         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1385         * target.h: (class Task): Add forward declaration.
1386         (Target::relax): Add new parameter TASK and pass it to
1387         Target::do_relax().
1388         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1389
1390 2010-11-05  Cary Coutant  <ccoutant@google.com>
1391
1392         PR gold/10708
1393         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1394         object when reading from the file.
1395         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1396         second layout pass.
1397         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1398         when reading section contents.
1399         (get_section_contents): Likewise.
1400         (icf::find_identical_sections): Likewise.
1401         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1402         object when reading from the file.
1403         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1404         the object when doing deferred section layout.
1405
1406 2010-11-03  Nick Clifton  <nickc@redhat.com>
1407
1408         PR gold/12001
1409         * script.h (class Symbol_assignment: name): New member.  Returns
1410         the name of the symbol.
1411         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1412         Returns true if the given symbol name is on the list of
1413         assignments wating to be processed.
1414         * archive.cc (should_incldue_member): If the symbol is undefined,
1415         check to see if it is on the list of symbols pending assignment.
1416
1417 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1418
1419         * script-sections.cc (Script_sections::find_memory_region): Check
1420         for a NULL output section pointer.
1421
1422 2010-10-29  Doug Kwan  <dougkwan@google.com>
1423
1424         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1425         Output_section::add_relaxed_input_section.
1426         * output.cc (Output_section::add_relaxed_input_section): Add new
1427         arguments LAYOUT and NAME.  Set section order index.
1428         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1429         Copy section order index.
1430         * output.h (Output_section::add_relaxed_input_section): Add new
1431         arguments LAYOUT and NAME.
1432
1433 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1434
1435         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1436         NATIVE_OR_CROSS_LINKER.
1437         * testsuite/Makefile.in: Regenerate.
1438
1439 2010-10-20  Doug Kwan  <dougkwan@google.com>
1440
1441         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1442         without SHF_LINK_ORDER flags.
1443         * layout.cc (Layout::choose_output_section): Do not filter
1444         SHF_LINK_ORDER flag in a relocatable link.
1445
1446 2010-10-17  Cary Coutant  <ccoutant@google.com>
1447
1448         * output.h (Output_segment::set_section_addresses): Change function
1449         signature.  Update all callers.
1450         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1451         sections.
1452         (Output_segment::set_section_addresses): Align after last TLS
1453         section.  Add padding before last relro section instead of after.
1454
1455 2010-10-17  Doug Kwan  <dougkwan@google.com>
1456
1457         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1458         GOT output section to be writable.
1459
1460 2010-10-14  Cary Coutant  <ccoutant@google.com>
1461
1462         * debug.h (DEBUG_INCREMENTAL): New flag.
1463         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1464         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1465         mode.
1466         * incremental.cc (report_command_line): Ignore all forms of
1467         --incremental.
1468         * layout.cc (Layout::Layout): Check parameters for incremental link
1469         mode.
1470         * options.cc (General_options::parse_incremental): New function.
1471         (General_options::parse_no_incremental): New function.
1472         (General_options::parse_incremental_full): New function.
1473         (General_options::parse_incremental_update): New function.
1474         (General_options::incremental_mode_): New data member.
1475         (General_options::finalize): Check incremental_mode_.
1476         * options.h (General_options): Update help text for --incremental.
1477         Add --no-incremental, --incremental-full, --incremental-update.
1478         (General_options::Incremental_mode): New enum type.
1479         (General_options::incremental_mode): New function.
1480         (General_options::incremental_mode_): New data member.
1481         * parameters.cc (Parameters::incremental_mode_): New data member.
1482         (Parameters::set_options): Set incremental_mode_.
1483         (Parameters::set_incremental_full): New function.
1484         (Parameters::incremental): New function.
1485         (Parameters::incremental_update): New function.
1486         (set_parameters_incremental_full): New function.
1487         * parameters.h (Parameters::set_incremental_full): New function.
1488         (Parameters::incremental): New function.
1489         (Parameters::incremental_update): New function.
1490         (Parameters::incremental_mode_): New data member.
1491         (set_parameters_incremental_full): New function.
1492         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1493         incremental link mode.
1494         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1495         (Sized_relobj::do_relocate_sections): Likewise.
1496         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1497         option.
1498         * testsuite/Makefile.in: Regenerate.
1499         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1500
1501 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1502
1503         * script-sections.h (class Script_sections): Make
1504         Sections_elements typedef public.
1505         * script-sections.cc (class Sort_output_sections): Add elements_
1506         field.  Add constructor which sets it; change all callers.
1507         (Sort_output_sections::is_before): New function.
1508         (Sort_output_sections::operator()): Call is_before.
1509         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1510         conditional.
1511         * testsuite/script_test_10.sh: New test. Test script section
1512         order.
1513         * testsuite/script_test_10.t: Likewise.
1514         * testsuite/script_test_10.s: Likewise.
1515         * testsuite/Makefile.am: Wrap the cross linker tests and the
1516         common tests into NATIVE_OR_CROSS_LINKER.
1517         (check_SCRIPTS): Add script_test_10.sh.
1518         (check_DATA): Add script_test_10.stdout.
1519         (script_test_10.o, script_test_10): New targets.
1520         (script_test_10.stdout): New target.
1521         * configure, testsuite/Makefile.in: Regenerate.
1522
1523 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1524
1525         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1526         error for the deprecated relocations.
1527         (Target_arm::Scan::global): Likewise.
1528         (Target_arm::Relocate::relocate): Likewise.
1529
1530 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1531
1532         * fileread.cc (Input_file::find_file): Initialize *found_name
1533         and *namep when using the fallback search for case 4.
1534
1535 2010-10-11  Cary Coutant  <ccoutant@google.com>
1536
1537         * options.h (class General_options): Redefine -z lazy as an alias for
1538         the negation of -z now.
1539
1540 2010-10-11  Ian Lance Taylor  <iant@google.com>
1541
1542         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1543         binding.
1544
1545 2010-10-06  Nick Clifton  <nickc@redhat.com>
1546
1547         * script-sections.cc(class Memory_region): Remove
1548         current_lma_offset_ field.  Rename current_vma_offset_ to
1549         current_offset_.  Add last_section_ field.
1550         (Memory_region::get_current_vma_address): Rename to
1551         get_current_address.
1552         (Memory_region::get_current_lma_address): Delete.
1553         (Memory_region::increment_vma_offset): Rename to
1554         increment_offset.
1555         (Memory_region::increment_lma_offset): Delete.
1556         (Memory_region::attributes_compatible): New method.  Returns
1557         true if the provided section is compatible with the region.
1558         (Memory_region::get_last_section): New method.  Returns the last
1559         section to use the region.
1560         (Memory_region::set_last_section): New method.  Stores the last
1561         section to use the region.
1562         (Script_sections::block_in_region): New method.  Returns true if
1563         a block of memory is contained within a region.
1564         (Script_sections::find_memory_region): New method.  Locates a
1565         memory region to be used to set a VMA or LMA address.
1566         (Output_section_definition::set_section_addresses): Add code to
1567         check for addresses set by memory regions.
1568         (Output_segment::set_section_addresses): Remove memory region
1569         walking code.
1570         (Script_sections::create_segment): Add a warning if a header
1571         segment is created outside of any region.
1572         * script-sections.h (class Script_sections): Add prototypes for
1573         find_memory_region and block_in_region methods.
1574         * testsuite/memory_test.s: Use .long instead of .word.
1575         * testsuite/memory_test.t: Add some more output sections.
1576         * testsuite/memory_test.sh: Update expected output.
1577
1578 2010-10-02  Doug Kwan  <dougkwan@google.com>
1579
1580         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1581         defintion to symtab.h
1582         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1583         declaration to defintion.
1584
1585 2010-10-01  Nick Clifton  <nickc@redhat.com>
1586
1587         * expression.cc (eval): Replace dummy argument with NULL.
1588         (eval_maybe_dot): Check for a NULL result section pointer.
1589         (Symbol_expression::value): Likewise.
1590         (Dot_expression::value): Likewise.
1591         (BINARY_EXPRESSION): Likewise.
1592         (Max_expression::value): Likewise.
1593         (Min_expression::value): Likewise.
1594         (Absolute_expression::value): Likewise.
1595         (Addr_expression::value_from_output_section): Likewise.
1596         (Loaddddr_expression::value_from_output_section): Likewise.
1597         (Segment_start_expression::value): Likewise.
1598         * script-sections.cc
1599         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1600         argument with NULL.
1601         (Sections_elememt_dot_assignment::set_section_addresses):
1602         Likewise.
1603         (Output_data_expression::do_write_to_buffer): Likewise.
1604         (Output_section_definition::finalize_symbols): Likewise.
1605         (Output_section_definition::set_section_addresses): Likewise.
1606
1607 2010-09-30  Doug Kwan  <dougkwan@google.com>
1608
1609         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1610
1611 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1612
1613         * target.h (Target::can_icf_inline_merge_sections): New virtual
1614         function.
1615         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1616         virtual function.
1617         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1618         virtual function.
1619         * icf.cc (get_section_contents): Inline merge sections only when
1620         target allows it.
1621
1622 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1623
1624         * configure: Regenerate.
1625
1626 2010-09-17  Ian Lance Taylor  <iant@google.com>
1627
1628         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1629         * testsuite/Makefile.am (memory_test.o): New target.
1630         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1631         memory_test.t.
1632         * testsuite/Makefile.in: Rebuild.
1633
1634 2010-09-17  Doug Kwan  <dougkwan@google.com>
1635
1636         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1637         defintion if relocation uses GOT entries of the symbol.
1638         * testsuite/icf_safe_test.sh: Fix test.
1639         * testsuite/icf_safe_so_test.sh: Fix test.
1640
1641 2010-09-16  Cary Coutant  <ccoutant@google.com>
1642
1643         * script_sections.cc (class Memory_region): Remove "NULL" from
1644         vector initializations.
1645
1646 2010-09-15  Cary Coutant  <ccoutant@google.com>
1647
1648         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1649         Resolve forwarding symbols.
1650
1651 2010-09-15  Doug Kwan  <dougkwan@google.com>
1652
1653         * gold/testsuite/script_test_3.t: Add ARM special sections.
1654         * gold/testsuite/script_test_4.t: Same.
1655         * gold/testsuite/script_test_5.t: Same.
1656         * gold/testsuite/script_test_6.t: Same.
1657         * gold/testsuite/script_test_7.t: Same.
1658         * gold/testsuite/script_test_7.t: Same.
1659         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1660
1661 2010-09-14  Cary Coutant  <ccoutant@google.com>
1662
1663         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1664         (Target_x86_64::Relocate::relocate_tls): Replace check for
1665         saw_tls_block_reloc_ with test for executable section.
1666
1667 2010-09-12  Cary Coutant  <ccoutant@google.com>
1668
1669         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1670         position-independent executables to shared libraries need dynamic
1671         relocations.
1672         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1673         position-independent executables.
1674         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1675         * testsuite/Makefile.in: Regenerate.
1676
1677 2010-09-10  Nick Clifton  <nickc@redhat.com>
1678
1679         PR gold/11997
1680         * testsuite/memory_test.t: Discard any sections that are not
1681         needed.
1682
1683 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1684
1685         PR gold/11996
1686         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1687         "This::" to work around a bug in gcc 4.2.
1688
1689         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1690
1691 2010-09-09  Rafael Espindola  <espindola@google.com>
1692
1693         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1694         sections with different PF_X flags in the same segment.
1695         (Layout::find_first_load_seg): Search all segments to find the first
1696         one.
1697         * options.h (rosegment): New.
1698
1699 2010-09-08  Rafael Espindola  <espindola@google.com>
1700
1701         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1702
1703 2010-09-08  Doug Kwan  <dougkwan@google.com>
1704
1705         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1706         (Arm_relobj::do_relocate_sections): Add new parameter for output
1707         file to match the parent.
1708         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1709         of local symbols instead of input values.  Update code to track
1710         changes in gold::relocate_section.
1711         * object.cc (Sized_relobj::compute_final_local_value): New methods.
1712         (Sized_relobj::compute_final_local_value_internal): New methods.
1713         (Sized_relobj::do_finalize_local_symbols): Move code from loop
1714         body into private version of Sized_relobj::compute_final_local_value.
1715         Call the inline method.
1716         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
1717         merged symbol value if there is one.
1718         (Symbol_value::has_output_value): New method defintiion.
1719         (Sized_relobj::Compute_final_local_value_status): New enum type.
1720         (Sized_relobj::compute_final_local_value): New methods.
1721         (Sized_relobj::compute_final_local_value_internal): New methods.
1722         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1723         and arm_cortex_a8.sh.
1724         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1725         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1726         New tests.
1727         * Makefile.in: Regenerate.
1728         * testsuite/arm_bl_out_of_range.s: Update test.
1729         * testsuite/thumb_bl_out_of_range.s: Ditto.
1730         * testsuite/thumb_blx_out_of_range.s: Ditto.
1731         * testsuite/arm_branch_out_of_range.sh: New file.
1732         * testsuite/arm_cortex_a8.sh: Ditto.
1733         * testsuite/arm_cortex_a8_b.s: Ditto.
1734         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1735         * testsuite/arm_cortex_a8_b_local.s: Ditto.
1736         * testsuite/arm_cortex_a8_bl.s: Ditto.
1737         * testsuite/arm_cortex_a8_blx.s: Ditto.
1738         * testsuite/arm_cortex_a8_local.s: Ditto.
1739         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1740         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1741
1742 2010-09-08  Rafael Espindola  <espindola@google.com>
1743
1744         * Makefile.am (memory_test.stdout): Run readelf with -W.
1745         * Makefile.in: Regenerate.
1746         * testsuite/memory_test.sh: Make the regexps accept both 32 and
1747         64 bit output.
1748
1749 2010-09-08  Rafael Espindola  <espindola@google.com>
1750
1751         * script-sections.cc (Script_sections::add_memory_region): Convert
1752         field precision to int.
1753         * script.cc (script_set_section_region, script_set_section_region):
1754         Convert field precision to int.
1755
1756 2010-09-08  Rafael Espindola  <espindola@google.com>
1757
1758         * arm.cc (do_finalize_sections): Create the __exidx_start and
1759         __exdix_end symbols even when the section is missing.
1760
1761 2010-09-08  Nick Clifton  <nickc@redhat.com>
1762
1763         * README: Remove claim that MEMORY is not supported.
1764         * expression.cc (script_exp_function_origin)
1765         (script_exp_function_length): Move from here to ...
1766         * script.cc: ... here.
1767         (script_set_section_region, script_add_memory)
1768         (script_parse_memory_attr, script_include_directive): New
1769         functions.
1770         * script-sections.cc
1771         (class Memory_region): New class.
1772         (class Output_section_definition): Add set_memory_region,
1773         set_section_vma, set_section_lma and get_section_name methods.
1774         (class Script_Sections): Add add_memory_region,
1775         find_memory_region, find_memory_region_origin,
1776         find_memory_region_length and set_memory_region methods.
1777         Have set_section_addresses method walk the list of set memory
1778         regions.
1779         Extend the print methos to display memory regions.
1780         * script-sections.h: Add prototypes for new methods.
1781         Add enum for MEMORY region attributes.
1782         * yyscript.y: Add support for parsing MEMORY regions.
1783         * script-c.h: Add prototypes for new functions.
1784         * testsuite/Makefile.am: Add test of MEMORY region functionality.
1785         * testsuite/Makefile.in: Regenerate.
1786         * testsuite/memory_test.sh: New script.
1787         * testsuite/memory_test.s: New assembler source file.
1788         * testsuite/memory_test.t: New linker script.
1789
1790 2010-08-27  Doug Kwan  <dougkwan@google.com>
1791
1792         * gold/resolve.cc (Symbol_table::should_override): Let a weak
1793         reference override an existing dynamic weak reference.
1794         * testsuite/Makefile.am: Add new test dyn_weak_ref.
1795         * testsuite/Makefile.in: Regenerate.
1796         * testsuite/dyn_weak_ref.sh: New file.
1797         * testsuite/dyn_weak_ref_1.c: Ditto.
1798         * testsuite/dyn_weak_ref_2.c: Ditto.
1799
1800 2010-08-27  Ian Lance Taylor  <iant@google.com>
1801
1802         * incremental.h (class Incremental_input_entry): Add virtual
1803         destructor.
1804
1805 2010-08-27  Ian Lance Taylor  <iant@google.com>
1806
1807         * testsuite/start_lib_test_3.c: Mark t3 as used.
1808
1809 2010-08-27  Nick Clifton  <nickc@redhat.com>
1810
1811         * options.cc (version_script): Fix small typo in previous
1812         whitespace tidyup.
1813
1814 2010-08-25  Nick Clifton  <nickc@redhat.com>
1815
1816         * archive.cc: Formatting fixes: Remove whitespace between
1817         typename and following asterisk.  Remove whitespace between
1818         function name and opening parenthesis.
1819         * archive.h: Likewise.
1820         * arm.cc: Likewise.
1821         * attributes.cc: Likewise.
1822         * attributes.h: Likewise.
1823         * common.cc: Likewise.
1824         * copy-relocs.cc: Likewise.
1825         * dirsearch.h: Likewise.
1826         * dynobj.cc: Likewise.
1827         * ehframe.cc: Likewise.
1828         * ehframe.h: Likewise.
1829         * expression.cc: Likewise.
1830         * fileread.cc: Likewise.
1831         * fileread.h: Likewise.
1832         * gc.h: Likewise.
1833         * gold-threads.cc: Likewise.
1834         * gold.cc: Likewise.
1835         * i386.cc: Likewise.
1836         * icf.h: Likewise.
1837         * incremental-dump.cc: Likewise.
1838         * incremental.cc: Likewise.
1839         * layout.cc: Likewise.
1840         * layout.h: Likewise.
1841         * main.cc: Likewise.
1842         * merge.cc: Likewise.
1843         * merge.h: Likewise.
1844         * object.cc: Likewise.
1845         * object.h: Likewise.
1846         * options.cc: Likewise.
1847         * options.h: Likewise.
1848         * output.cc: Likewise.
1849         * output.h: Likewise.
1850         * plugin.cc: Likewise.
1851         * plugin.h: Likewise.
1852         * powerpc.cc: Likewise.
1853         * reloc.cc: Likewise.
1854         * script-c.h: Likewise.
1855         * script-sections.cc: Likewise.
1856         * script.cc: Likewise.
1857         * stringpool.cc: Likewise.
1858         * symtab.cc: Likewise.
1859         * symtab.h: Likewise.
1860         * target.cc: Likewise.
1861         * timer.cc: Likewise.
1862         * timer.h: Likewise.
1863         * version.cc: Likewise.
1864         * x86_64.cc: Likewise.
1865
1866 2010-08-24  Nick Clifton  <nickc@redhat.com>
1867
1868         PR 11899
1869         * layout.cc (segment_precedes): Sort segments by their physical
1870         addresses, if they have been set.
1871
1872 2010-08-23  Cary Coutant  <ccoutant@google.com>
1873
1874         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1875         symbols data.
1876         (Lib_group::include_member): Unlock object after deleting its
1877         symbols data.
1878         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1879         the bug fixed here.
1880
1881 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
1882             Cary Coutant  <ccoutant@google.com>
1883
1884         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1885         constructor, and set_blocker.
1886         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1887         readsyms_blocker_.
1888         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1889         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1890         * testsuite/Makefile.am (start_lib_test): New test case.
1891         * testsuite/Makefile.in: Regenerate.
1892         * testsuite/start_lib_test_main.c: New file.
1893         * testsuite/start_lib_test_1.c: New file.
1894         * testsuite/start_lib_test_2.c: New file.
1895         * testsuite/start_lib_test_3.c: New file.
1896
1897 2010-08-19  Ian Lance Taylor  <iant@google.com>
1898
1899         * Makefile.in: Rebuild with automake 1.11.1.
1900         * aclocal.m4: Likewise.
1901         * testsuite/Makefile.in: Likewise.
1902
1903 2010-08-19  Ian Lance Taylor  <iant@google.com>
1904
1905         PR 10893
1906         * i386.cc (class Output_data_plt_i386): Update declarations.
1907         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
1908         local_ifuncs_ fields.
1909         (Target_i386::do_plt_section_for_global): New function.
1910         (Target_i386::do_plt_section_for_local): New function.
1911         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1912         parameter; change all callers.  Initialize global_ifuncs_ and
1913         local_ifuncs_.  If doing a static link define __rel_iplt_start and
1914         __rel_iplt_end.
1915         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1916         (Output_data_plt_i386::add_local_ifunc_entry): New function.
1917         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1918         symbols.
1919         (Target_i386::make_plt_section): New function, broken out of
1920         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
1921         (Target_i386::make_plt_entry): Call make_plt_section.
1922         (Target_i386::make_local_ifunc_plt_entry): New function.
1923         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1924         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
1925         R_386_IRELATIVE to switch.
1926         (Target_i386::Scan::global): Likewise.
1927         (Target_i386::Relocate::relocate): Likewise.
1928         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1929         switch.
1930         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1931         (Target_x86_64::do_plt_section_for_global): New function.
1932         (Target_x86_64::do_plt_section_for_local): New function.
1933         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1934         parameter; change all callers.  If doing a static link define
1935         __rela_iplt_start and __rela_iplt_end.
1936         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1937         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1938         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1939         to point to .plt.
1940         (Target_x86_64::make_local_ifunc_plt_entry): New function.
1941         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1942         switch.
1943         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1944         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
1945         R_X86_64_IRELATIVE to switch.
1946         (Target_x86_64::Scan::global): Likewise.
1947         (Target_x86_64::Relocate::relocate): Likewise.
1948         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1949         switch.
1950         * target.h (class Target): Add plt_section_for_global and
1951         plt_section_for_local functions.  Add do_plt_section_for_global
1952         and do_plt_section_for_local virtual functions.
1953         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
1954         clarifying comments.
1955         (Symbol::use_plt_offset): Handle IFUNC symbol.
1956         * object.cc (Sized_relobj::Sized_relobj): Initialize
1957         local_plt_offsets_.
1958         (Sized_relobj::local_has_plt_offset): New function.
1959         (Sized_relobj::local_plt_offset): New function.
1960         (Sized_relobj::set_local_plt_offset): New function.
1961         (Sized_relobj::do_count): Handle IFUNC symbol.
1962         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
1963         a bit away from input_shndx_ field.  Add set_is_func_symbol and
1964         is_ifunc_symbol functions.
1965         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
1966         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
1967         local_plt_offsets_ field.
1968         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1969         * output.h (class Output_section_data): Add non-const
1970         output_section function.
1971         (class Output_data_got): Update declarations.
1972         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1973         Add use_plt_offset parameter to global and local constructors.
1974         Change all callers.  Change local_sym_index_ field to 31 bits.
1975         Change GSYM_CODE and CONSTANT_CODE accordingly.
1976         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1977         doing a static link don't set sh_link field.
1978         (Output_data_got::Got_entry::write): Use PLT offset if
1979         appropriate.
1980         (Output_data_got::add_global_plt): New function.
1981         (Output_data_got::add_local_plt): New function.
1982         * target-reloc.h (relocate_section): Handle IFUNC symbol.
1983         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1984         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1985         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1986         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1987         IFUNC conditional.
1988         * testsuite/ifunc-sel.h: New file.
1989         * testsuite/ifuncmain1.c: New file.
1990         * testsuite/ifuncmain1vis.c: New file.
1991         * testsuite/ifuncmod1.c: New file.
1992         * testsuite/ifuncdep2.c: New file.
1993         * testsuite/ifuncmain2.c: New file.
1994         * testsuite/ifuncmain3.c: New file.
1995         * testsuite/ifuncmod3.c: New file.
1996         * testsuite/ifuncmain4.c: New file.
1997         * testsuite/ifuncmain5.c: New file.
1998         * testsuite/ifuncmod5.c: New file.
1999         * testsuite/ifuncmain6pie.c: New file.
2000         * testsuite/ifuncmod6.c: New file.
2001         * testsuite/ifuncmain7.c: New file.
2002         * configure, testsuite/Makefile.in: Rebuild.
2003
2004 2010-08-18  Ian Lance Taylor  <iant@google.com>
2005
2006         * incremental.cc
2007         (Output_section_incremental_inputs::write_input_files): Add cast
2008         to avoid signed/unsigned comparison warning.
2009         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2010
2011 2010-08-12  Cary Coutant  <ccoutant@google.com>
2012
2013         * common.cc (Sort_commons::operator()): Remove unnecessary code.
2014
2015 2010-08-13  Ian Lance Taylor  <iant@google.com>
2016
2017         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2018
2019 2010-08-12  Cary Coutant  <ccoutant@google.com>
2020             Doug Kwan  <dougkwan@google.com>
2021
2022         * resolve.cc (Symbol_table::should_override): When a weak dynamic
2023         defintion overrides non-weak undef, remember that the original undef
2024         is not weak.
2025         * symtab.cc (Symbol_table::sized_write_global): For undef without
2026         an original weak binding, set binding to global in output.
2027         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2028         * testsuite/Makefile.in: Regenerate.
2029         * testsuite/strong_ref_weak_def.sh: New file.
2030         * testsuite/strong_ref_weak_def_1.c: Ditto.
2031         * testsuite/strong_ref_weak_def_2.c: Ditto.
2032
2033 2010-08-12  Cary Coutant  <ccoutant@google.com>
2034
2035         * testsuite/incremental_test.sh: Rewrite.
2036         * testsuite/incremental_test_1.c: Rewrite.
2037         * testsuite/incremental_test_2.c: Rewrite.
2038
2039 2010-08-12  Cary Coutant  <ccoutant@google.com>
2040
2041         * arm.cc (Target_arm::got_size): Add const.
2042         (Target_arm::got_entry_count): New function.
2043         (Target_arm::plt_entry_count): New function.
2044         (Target_arm::first_plt_entry_offset): New function.
2045         (Target_arm::plt_entry_size): New function.
2046         (Output_data_plt_arm::entry_count): New function.
2047         (Output_data_plt_arm::first_plt_entry_offset): New function.
2048         (Output_data_plt_arm::get_plt_entry_size): New function.
2049         * i386.cc (Target_i386::got_size): Add const.
2050         (Target_i386::got_entry_count): New function.
2051         (Target_i386::plt_entry_count): New function.
2052         (Target_i386::first_plt_entry_offset): New function.
2053         (Target_i386::plt_entry_size): New function.
2054         (Output_data_plt_i386::entry_count): New function.
2055         (Output_data_plt_i386::first_plt_entry_offset): New function.
2056         (Output_data_plt_i386::get_plt_entry_size): New function.
2057         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2058         find_incremental_inputs_sections.  Dump incremental_got_plt section.
2059         * incremental.cc: Include target.h.
2060         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2061         parameter.  Adjust all callers.  Find incremental_got_plt section.
2062         (Incremental_inputs::create_data_sections): Create incremental_got_plt
2063         section.
2064         (Output_section_incremental_inputs::set_final_data_size): Calculate
2065         size of incremental_got_plt section.
2066         (Output_section_incremental_inputs::do_write): Write the
2067         incremental_got_plt section.
2068         (Got_plt_view_info): New struct.
2069         (Local_got_offset_visitor): New class.
2070         (Global_got_offset_visitor): New class.
2071         (Global_symbol_visitor_got_plt): New class.
2072         (Output_section_incremental_inputs::write_got_plt): New function.
2073         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2074         Add parameter.  Adjust all callers.
2075         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2076         (Incremental_inputs::got_plt_section): New function.
2077         (Incremental_inputs::got_plt_section_): New data member.
2078         (Incremental_got_plt_reader): New class.
2079         * layout.cc (Layout::create_incremental_info_sections): Add the
2080         incremental_got_plt section.
2081         * object.h (Got_offset_list::get_list): New function.
2082         (Got offset_list::for_all_got_offsets): New function.
2083         (Sized_relobj::local_got_offset_list): New function.
2084         * powerpc.cc (Target_powerpc::got_size): Add const.
2085         (Target_powerpc::got_entry_count): New function.
2086         (Target_powerpc::plt_entry_count): New function.
2087         (Target_powerpc::first_plt_entry_offset): New function.
2088         (Target_powerpc::plt_entry_size): New function.
2089         (Output_data_plt_powerpc::entry_count): New function.
2090         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2091         (Output_data_plt_powerpc::get_plt_entry_size): New function.
2092         * sparc.cc (Target_sparc::got_size): Add const.
2093         (Target_sparc::got_entry_count): New function.
2094         (Target_sparc::plt_entry_count): New function.
2095         (Target_sparc::first_plt_entry_offset): New function.
2096         (Target_sparc::plt_entry_size): New function.
2097         (Output_data_plt_sparc::entry_count): New function.
2098         (Output_data_plt_sparc::first_plt_entry_offset): New function.
2099         (Output_data_plt_sparc::get_plt_entry_size): New function.
2100         * symtab.h (Symbol::got_offset_list): New function.
2101         (Symbol_table::for_all_symbols): New function.
2102         * target.h (Sized_target::got_entry_count): New function.
2103         (Sized_target::plt_entry_count): New function.
2104         (Sized_target::plt_entry_size): New function.
2105         * x86_64.cc (Target_x86_64::got_size): Add const.
2106         (Target_x86_64::got_entry_count): New function.
2107         (Target_x86_64::plt_entry_count): New function.
2108         (Target_x86_64::first_plt_entry_offset): New function.
2109         (Target_x86_64::plt_entry_size): New function.
2110         (Output_data_plt_x86_64::entry_count): New function.
2111         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2112         (Output_data_plt_x86_64::get_plt_entry_size): New function.
2113
2114 2010-08-12  Cary Coutant  <ccoutant@google.com>
2115
2116         * archive.cc: Include incremental.h.
2117         (Archive::Archive): Initialize incremental_info_.
2118         (Archive::include_member): Record archive members in incremental info.
2119         (Add_archive_symbols::run): Record begin and end of an archive in
2120         incremental info.
2121         (Lib_group::include_member): Record objects in incremental info.
2122         * archive.h (Incremental_archive_entry): Forward declaration.
2123         (Archive::set_incremental_info): New member function.
2124         (Archive::incremental_info): New member function.
2125         (Archive::Unused_symbol_iterator): New class.
2126         (Archive::unused_symbols_begin): New member function.
2127         (Archive::unused_symbols_end): New member function.
2128         (Archive::incremental_info_): New data member.
2129         * incremental-dump.cc (find_input_containing_global): New function.
2130         (dump_incremental_inputs): Dump new incremental info sections.
2131         * incremental.cc: Include symtab.h.
2132         (Output_section_incremental_inputs): New class.
2133         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2134         new incremental info sections.
2135         (Sized_incremental_binary::do_check_inputs): Likewise.
2136         (Incremental_inputs::report_archive): Remove.
2137         (Incremental_inputs::report_archive_begin): New function.
2138         (Incremental_inputs::report_archive_end): New function.
2139         (Incremental_inputs::report_object): New function.
2140         (Incremental_inputs::finalize_inputs): Remove.
2141         (Incremental_inputs::report_input_section): New function.
2142         (Incremental_inputs::report_script): Rewrite.
2143         (Incremental_inputs::finalize): Do nothing but finalize string table.
2144         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2145         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2146         (Incremental_inputs::create_data_sections): New function.
2147         (Incremental_inputs::relocs_entsize): New function.
2148         (Output_section_incremental_inputs::set_final_data_size): New function.
2149         (Output_section_incremental_inputs::do_write): New function.
2150         (Output_section_incremental_inputs::write_header): New function.
2151         (Output_section_incremental_inputs::write_input_files): New function.
2152         (Output_section_incremental_inputs::write_info_blocks): New function.
2153         (Output_section_incremental_inputs::write_symtab): New function.
2154         * incremental.h (Incremental_script_entry): Forward declaration.
2155         (Incremental_object_entry): Forward declaration.
2156         (Incremental_archive_entry): Forward declaration.
2157         (Incremental_inputs): Forward declaration.
2158         (Incremental_inputs_header_data): Remove.
2159         (Incremental_inputs_header): Remove.
2160         (Incremental_inputs_header_write): Remove.
2161         (Incremental_inputs_entry_data): Remove.
2162         (Incremental_inputs_entry): Remove.
2163         (Incremental_inputs_entry_write): Remove.
2164         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2165         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2166         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2167         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2168         Likewise.
2169         (Incremental_input_entry): New class.
2170         (Incremental_script_entry): New class.
2171         (Incremental_object_entry): New class.
2172         (Incremental_archive_entry): New class.
2173         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2174         (Incremental_inputs::report_inputs): Remove.
2175         (Incremental_inputs::report_archive): Remove.
2176         (Incremental_inputs::report_archive_begin): New function.
2177         (Incremental_inputs::report_archive_end): New function.
2178         (Incremental_inputs::report_object): Change prototype.
2179         (Incremental_inputs::report_input_section): New function.
2180         (Incremental_inputs::report_script): Change prototype.
2181         (Incremental_inputs::get_reloc_count): New function.
2182         (Incremental_inputs::set_reloc_count): New function.
2183         (Incremental_inputs::create_data_sections): New function.
2184         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2185         (Incremental_inputs::inputs_section): New function.
2186         (Incremental_inputs::symtab_section): New function.
2187         (Incremental_inputs::relocs_section): New function.
2188         (Incremental_inputs::get_stringpool): Add const.
2189         (Incremental_inputs::command_line): Add const.
2190         (Incremental_inputs::inputs): Remove.
2191         (Incremental_inputs::command_line_key): New function.
2192         (Incremental_inputs::input_file_count): New function.
2193         (Incremental_inputs::input_files): New function.
2194         (Incremental_inputs::relocs_entsize): New function.
2195         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2196         (Incremental_inputs::finalize_inputs): Remove.
2197         (Incremental_inputs::Input_info): Remove.
2198         (Incremental_inputs::lock_): Remove.
2199         (Incremental_inputs::inputs_): Change type.
2200         (Incremental_inputs::inputs_map_): Remove.
2201         (Incremental_inputs::current_object_entry_): New data member.
2202         (Incremental_inputs::inputs_section_): New data member.
2203         (Incremental_inputs::symtab_section_): New data member.
2204         (Incremental_inputs::relocs_section_): New data member.
2205         (Incremental_inputs::reloc_count_): New data member.
2206         (Incremental_inputs_reader): New class.
2207         (Incremental_symtab_reader): New class.
2208         (Incremental_relocs_reader): New class.
2209         * layout.cc (Layout::finalize): Move finalization of incremental info
2210         and creation of incremental info sections to follow finalization of
2211         symbol table.  Set offsets for postprocessing sections.
2212         (Layout::create_incremental_info_sections): Call
2213         Incremental_inputs::create_data_sections.  Add incremental symtab
2214         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2215         sections to layout after input sections.
2216         * layout.h (struct Timespec): Forward declaration.
2217         (Layout::incremental_inputs): Add const.
2218         (Layout::create_incremental_info_sections): Add parameter.
2219         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2220         * object.cc: Include incremental.h.
2221         (Relobj::finalize_incremental_relocs): New function.
2222         (Sized_relobj::do_layout): Record input sections in incremental info.
2223         * object.h (Object::output_section): New function.
2224         (Object::output_section_offset): Moved from Relobj.
2225         (Object::get_incremental_reloc_base): New function.
2226         (Object::get_incremental_reloc_count): New function.
2227         (Object::do_output_section): New function.
2228         (Object::do_output_section_offset): Moved from Relobj.
2229         (Object::do_get_incremental_reloc_base): New function.
2230         (Object::do_get_incremental_reloc_count): New function.
2231         (Object::Object): Initialize new data members.
2232         (Relobj::output_section): Renamed do_output_section and moved to
2233         protected.
2234         (Relobj::output_section_offset): Moved to Object.
2235         (Relobj::do_get_incremental_reloc_base): New function.
2236         (Relobj::do_get_incremental_reloc_count): New function.
2237         (Relobj::allocate_incremental_reloc_counts): New function.
2238         (Relobj::count_incremental_reloc): New function.
2239         (Relobj::finalize_incremental_relocs): New function.
2240         (Relobj::next_incremental_reloc_index): New function.
2241         (Relobj::reloc_counts_): New data member.
2242         (Relobj::reloc_bases_): New data member.
2243         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2244         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2245         (Sized_relobj::incremental_relocs_scan): New function.
2246         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2247         (Sized_relobj::incremental_relocs_write): New function.
2248         (Sized_relobj::incremental_relocs_write_reltype): New function.
2249         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2250         incremental link.
2251         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2252         archives and object files elsewhere.
2253         (Add_symbols::run): Report object files here.
2254         (Finish_group::run): Report end of archive at end of group.
2255         * reloc.cc: Include layout.h, incremental.h.
2256         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2257         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2258         (Sized_relobj::incremental_relocs_scan): New function.
2259         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2260         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2261         (Sized_relobj::incremental_relocs_write): New function.
2262         (Sized_relobj::incremental_relocs_write_reltype): New function.
2263         * script.cc (read_input_script): Rewrite test for incremental link.
2264         Change call to Incremental_inputs::report_script.
2265         * symtab.h (Symbol_table::first_global_index): New function.
2266         (Symbol_table::output_count): New function.
2267
2268 2010-08-12  Doug Kwan  <dougkwan@google.com>
2269
2270         * arm.cc (Target_arm::merge_object_attributes): Check command line
2271         options --no-wchar-size-warning and --no-enum-size-warning.
2272         * options.h (General_options): Add ld-compatible options
2273         --no-enum-size-warning and --no-wchar-size-warning.
2274
2275 2010-08-04  Ian Lance Taylor  <iant@google.com>
2276
2277         * x86_64.cc (Target_x86_64::Scan::local): Use
2278         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2279         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2280         (Target_x86_64::Scan::global): Likewise.
2281         (Target_x86_64::Relocate::relocate): Likewise.
2282         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2283         Likewise.
2284
2285 2010-08-03  Cary Coutant  <ccoutant@google.com>
2286
2287         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2288         to reserve space in merged_strings vector. Keep total input size
2289         for stats.
2290         (Output_merge_string::do_print_merge_stats): Print total input size.
2291         * merge.h (Output_merge_string): Add input_size_ field.
2292         * stringpool.cc (Stringpool_template::string_length): Move
2293         implementations out of Stringpool_template class and place in
2294         stringpool.h.
2295         * stringpool.h (string_length): Move out of Stringpool_template.
2296
2297 2010-08-03  Ian Lance Taylor  <iant@google.com>
2298
2299         PR 11712
2300         * layout.cc (relaxation_loop_body): If address of load segment is
2301         set, adjust address to include headers if possible.
2302
2303 2010-08-03  Ian Lance Taylor  <iant@google.com>
2304
2305         * version.cc (version_string): Bump to 1.10.
2306
2307 2010-08-03  Ian Lance Taylor  <iant@google.com>
2308
2309         PR 11805
2310         * layout.h (enum Output_section_order): Define.
2311         (class Layout): Update declarations.
2312         * layout.cc (Layout::get_output_section): Add order parameter.
2313         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2314         is_first_non_relro parameters.  Change all callers.
2315         (Layout::choose_output_section): Likewise.
2316         (Layout::add_output_section_data): Likewise.
2317         (Layout::make_output_section): Likewise.  Set order.
2318         (Layout::default_section_order): New function.
2319         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2320         * output.cc (Output_section::Output_section): Initialize order_.
2321         Don't initialize deleted fields.
2322         (Output_segment::Output_segment): Don't initialize deleted
2323         fields.
2324         (Output_segment::add_output_section_to_load): New function
2325         replacing add_output_section.  Change all callers to call this or
2326         add_output_section_to_nonload.
2327         (Output_segment::add_output_section_to_nonload): New function.
2328         (Output_segment::remove_output_section): Rewrite.
2329         (Output_segment::add_initial_output_data): Likewise.
2330         (Output_segment::has_any_data_sections): Likewise.
2331         (Output_segment::is_first_section_relro): Likewise.
2332         (Output_segment::maximum_alignment): Likewise.
2333         (Output_segment::has_dynamic_reloc): New function replacing
2334         dynamic_reloc_count.  Change all callers.
2335         (Output_segment::has_dynamic_reloc_list): New function replacing
2336         dynamic_reloc_count_list.  Change all callers.
2337         (Output_segment::set_section_addresses): Rewrite.
2338         (Output_segment::set_offset): Rewrite.
2339         (Output_segment::find_first_and_last_list): Remove.
2340         (Output_segment::set_tls_offsets): Rewrite.
2341         (Output_segment::first_section_load_address): Likewise.
2342         (Output_segment::output_section_count): Likewise.
2343         (Output_segment::section_with_lowest_load_address): Likewise.
2344         (Output_segment::write_section_headers): Likewise.
2345         (Output_segment::print_sections_to_map): Likewise.
2346         * output.h (class Output_data): Remove dynamic_reloc_count_
2347         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2348         (Output_data::add_dynamic_reloc): Rewrite.
2349         (Output_data::has_dynamic_reloc): New function.
2350         (Output_data::dynamic_reloc_count): Remove.
2351         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2352         is_last_relro_, is_first_non_relro_, is_interp_,
2353         is_dynamic_linker_section_ fields.  Add order and set_order
2354         functions.  Remove is_relro_local, set_is_relro_local,
2355         is_last_relro, set_is_last_relro, is_first_non_relro,
2356         set_is_first_non_relro functions, is_interp, set_is_interp,
2357         is_dynamic_linker_section, and set_is_dynamic_linker_section
2358         functions.
2359         (class Output_segment): Change Output_data_list from std::list to
2360         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2361         output_bss_ fields.  Update declarations.
2362
2363 2010-08-02  Ian Lance Taylor  <iant@google.com>
2364
2365         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2366         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2367         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2368
2369 2010-08-02  Ian Lance Taylor  <iant@google.com>
2370
2371         PR 11855
2372         * script.cc (Script_options::Script_options): Initialize
2373         symbol_definitions_ and symbol_references_.
2374         (Script_options::add_symbol_assignment): Update
2375         symbol_definitions_ and symbol_references_.
2376         (Script_options::add_symbol_reference): New function.
2377         (script_symbol): New function.
2378         * script.h (class Script_options): Add symbol_definitions_ and
2379         symbol_references_ fields.
2380         (Script_options::referenced_const_iterator): New type.
2381         (Script_options::referenced_begin): New function.
2382         (Script_options::referenced_end): New function.
2383         (Script_options::is_referenced): New function.
2384         (Script_options::any_unreferenced): New function.
2385         * script-c.h (script_symbol): Declare.
2386         * yyscript.y (exp): Call script_symbol.
2387         * symtab.cc: Include "script.h".
2388         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2389         Change all callers.  Check symbols referenced by scripts.
2390         (Symbol_table::add_undefined_symbols_from_command_line): Add
2391         layout parameter.  Change all callers.
2392         (Symbol_table::do_add_undefined_symbols_from_command_line):
2393         Likewise.  Break out loop body.  Check symbols referenced by
2394         scripts.
2395         (Symbol_table::add_undefined_symbol_from_command_line): New
2396         function broken out of
2397         do_add_undefined_symbols_from_command_line.
2398         * symtab.h (class Symbol_table): Update declarations.
2399         * archive.cc: Include "layout.h".
2400         (Archive::should_include_member): Add layout parameter.  Change
2401         all callers.  Check for symbol mentioned in expression.
2402         * archive.h (class Archive): Update declaration.
2403         * object.cc (Sized_relobj::do_should_include_member): Add layout
2404         parameter.
2405         * object.h (Object::should_include_member): Add layout parameter.
2406         Change all callers.
2407         (Object::do_should_include_member): Add layout parameter.
2408         (class Sized_relobj): Update declaration.
2409         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2410         parameter.
2411         * dynobj.h (class Sized_dynobj): Update declaration.
2412         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2413         layout parameter.
2414         * plugin.h (class Sized_pluginobj): Update declaration.
2415
2416 2010-08-02  Ian Lance Taylor  <iant@google.com>
2417
2418         PR 11866
2419         * output.cc (Output_segment::set_offset): Search for the first and
2420         last sections rather than assuming that the list is in order.
2421         (Output_segment::find_first_and_last_list): New function.
2422         * output.h (class Output_segment): Update declarations.
2423         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2424         (relro_strip_test_SOURCES): New variable.
2425         (relro_strip_test_DEPENDENCIES): New variable.
2426         (relro_strip_test_LDFLAGS): New variable.
2427         (relro_strip_test_LDADD): New variable.
2428         (relro_strip_test.so): New target.
2429
2430 2010-08-02  Ian Lance Taylor  <iant@google.com>
2431
2432         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2433         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2434         (Target_i386::got_tlsdesc_section): New function.
2435         (Target_i386::got_section): Create space for GOT entries for
2436         TLSDESC relocations.
2437         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2438         R_386_TLS_GOTDESC.
2439         (Target_i386::Scan::global): Likewise.
2440         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2441         using TLSDESC GOT.
2442         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2443         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2444         (Target_x86_64::got_tlsdesc_section): New function.
2445         (Target_x86_64::got_section): Create space for GOT entries for
2446         TLSDESC relocations.
2447         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2448         R_386_TLS_GOTDESC.
2449         (Target_x86_64::Scan::global): Likewise.
2450         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2451         using TLSDESC GOT.
2452
2453 2010-08-02  Ian Lance Taylor  <iant@google.com>
2454
2455         * testsuite/final_layout.sh: Use dc to convert from hex to
2456         decimal.
2457
2458 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2459
2460         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2461         paramter to the call to gold::gc_process_relocs.
2462         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2463         paramter to the call to gold::gc_process_relocs.
2464         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2465         parameter to the call to gold::gc_process_relocs.
2466         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2467         template parameter to the call to gold::gc_process_relocs.
2468         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2469         paramter to the call to gold::gc_process_relocs.
2470         * gc.h (get_embedded_addend_size): New function.
2471         (gc_process_relocs): Save the size of the reloc for use by ICF.
2472         * icf.cc (get_section_contents): Get the addend from the text section
2473         for SHT_REL relocation sections.
2474         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2475         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2476         * int_encoding.h (read_from_pointer): New overloaded function.
2477         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2478         * testsuite/icf_sht_rel_addend_test.sh: New file.
2479         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2480         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2481
2482 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2483
2484         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2485         * Makefile.in: Regenerate.
2486         * testsuite/Makefile.in: Regenerate.
2487
2488 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2489
2490         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2491         * gold/testsuite/debug_msg.cc: Likewise.
2492         * gold/testsuite/odr_violation1.cc
2493         * gold/testsuite/odr_violation2.cc
2494
2495 2010-07-21  Cary Coutant  <ccoutant@google.com>
2496
2497         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2498         string, and length fields.
2499         (Output_merge_string::Merged_strings_list): New type.
2500         (Output_merge_string::Merged_strings_lists): New typedef.
2501         (Output_merge_string): Replace merged_strings_ with
2502         merged_strings_lists_.
2503         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2504         Merged_strings_list per input object and section.  Don't store pointer
2505         to the string.  Don't store length with each merged string entry.
2506         (Output_merge_string::finalize_merged_data): Loop over list of merged
2507         strings lists.  Recompute length of each merged string.
2508
2509 2010-07-15  Cary Coutant  <ccoutant@google.com>
2510
2511         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2512         here.
2513
2514 2010-07-14  Ian Lance Taylor  <iant@google.com>
2515
2516         * descriptors.cc (Descriptors::open): Report correct name in error
2517         message.
2518
2519 2010-07-13  Doug Kwan  <dougkwan@google.com>
2520
2521         * arm.cc (Arm_input_section::Arm_input_section): For a
2522         SHT_ARM_EXIDX section, always keeps the input sections.
2523         (Arm_input_section::set_exidx_section_link): New method.
2524         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2525         has_errors_ to false.
2526         (Arm_exidx_input_section::has_errors,
2527         Arm_exidx_input_section::set_has_errors): New methods.
2528         (Arm_exidx_input_section::has_errors_): New data member.
2529         (Arm_relobj::get_exidx_shndx_list): New method.
2530         (Arm_output_section::append_text_sections_to_list): Do not skip
2531         section without SHF_EXECINSTR.
2532         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2533         errors.
2534         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2535         section header.  Make error messages more verbose.  Check for
2536         a non-executable section linked to an EXIDX section.
2537         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2538         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2539         check that there is no deferred EXIDX section if we exit early.
2540         Instead of not making an EXIDX section in case of an error, make one
2541         and set the has_errors flag of it.
2542         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2543         in a relocatable link.
2544         (Target_arm::do_relax): Look for the EXIDX output section instead of
2545         assuming that it is called .ARM.exidx.
2546         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2547         section list.  Do not check for SHF_EXECINSTR section flags but
2548         skip any input section with errors.
2549         * output.cc (Output_section::Output_section): Initialize
2550         always_keeps_input_sections_ to false.
2551         (Output_section::add_input_section): Check for
2552         always_keeps_input_sections_.
2553         *  output.h (Output_section::always_keeps_input_sections,
2554         Output_section::set_always_keeps_input_sections): New methods.
2555         (Output_section::always_keeps_input_sections): New data member.
2556
2557 2010-07-13  Rafael Espindola  <espindola@google.com>
2558
2559         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2560         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2561
2562 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2563             Ian Lance Taylor  <iant@google.com>
2564
2565         * output.h (Output_section_lookup_maps::add_merge_section):
2566         Correct check of whether value was inserted.
2567         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2568         (Output_section_lookup_maps::add_relaxed_input_section):
2569         Likewise.
2570         * arm.cc (Target_arm::got_section): Remove used local os.
2571         * i386.cc (Target_i386::got_section): Likewise.
2572         * x86_64.cc (Target_x86_64::got_section): Likewise.
2573         * sparc.cc (Target_sparc::got_section): Likewise.
2574         (Target_sparc::relocate): Remove unused local have_got_offset.
2575         * powerpc.cc (Target_powerpc::relocate): Likewise.
2576
2577 2010-07-13  Ian Lance Taylor  <iant@google.com>
2578
2579         * compressed_output.cc (zlib_decompress): Fix signature in
2580         !HAVE_ZLIB_H case.
2581
2582         * archive.cc (Archive::include_member): Unlock an external member
2583         of a thin archive.  Don't bother to delete an object we know is
2584         NULL.
2585
2586 2010-07-12  Cary Coutant  <ccoutant@google.com>
2587
2588         * compressed_output.cc (zlib_decompress): New function.
2589         (get_uncompressed_size): New function.
2590         (decompress_input_section): New function.
2591         * compressed_output.h (get_uncompressed_size): New function.
2592         (decompress_input_section): New function.
2593         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2594         Handle compressed debug sections.
2595         * layout.cc (is_compressed_debug_section): New function.
2596         (Layout::output_section_name): Map compressed section names to
2597         canonical names.
2598         * layout.h (is_compressed_debug_section): New function.
2599         (is_debug_info_section): Recognize compressed debug sections.
2600         * merge.cc: Include compressed_output.h.
2601         (Output_merge_data::do_add_input_section): Handle compressed
2602         debug sections.
2603         (Output_merge_string::do_add_input_section): Handle compressed
2604         debug sections.
2605         * object.cc: Include compressed_output.h.
2606         (Sized_relobj::Sized_relobj): Initialize new data members.
2607         (build_compressed_section_map): New function.
2608         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2609         * object.h (Object::section_is_compressed): New method.
2610         (Object::do_section_is_compressed): New method.
2611         (Sized_relobj::Compressed_section_map): New type.
2612         (Sized_relobj::do_section_is_compressed): New method.
2613         (Sized_relobj::compressed_sections_): New data member.
2614         * output.cc (Output_section::add_input_section): Handle compressed
2615         debug sections.
2616         * reloc.cc: Include compressed_output.h.
2617         (Sized_relobj::write_sections): Handle compressed debug sections.
2618
2619 2010-07-08  Cary Coutant  <ccoutant@google.com>
2620
2621         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2622         weak when resolving to a dynamic def.
2623         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2624         for weak undef/dynamic def cases. Adjust callers.
2625         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2626         undef_binding_weak_.
2627         (Symbol_table::sized_write_globals): Adjust symbol binding.
2628         (Symbol_table::sized_write_symbol): Add binding parameter.
2629         * symtab.h (Symbol::set_undef_binding): New method.
2630         (Symbol::is_undef_binding_weak): New method.
2631         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2632         (Symbol_table::should_override): Add new parameter.
2633         (Symbol_table::sized_write_symbol): Add new parameter.
2634
2635         * testsuite/weak_undef_file1.cc: Add new test case.
2636         * testsuite/weak_undef_file2.cc: Fix header comment.
2637         * testsuite/weak_undef_test.cc: Add new test case.
2638
2639 2010-06-29  Doug Kwan  <dougkwan@google.com>
2640
2641         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2642         Initialize USE_SYMBOL_.
2643         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2644         definition.
2645         (Arm_reloc_property::uses_symbol_): New data member declaration.
2646         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2647         uses symbol value and symbol is undefined but not weakly undefined.
2648
2649 2010-06-28  Rafael Espindola  <espindola@google.com>
2650
2651         * plugin.cc (Plugin::load): Use dlerror.
2652
2653 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2654
2655         * symtab.cc (detect_odr_violations): When reporting an ODR
2656         violation, report an object where the symbol is defined.
2657
2658 2010-06-25  Doug Kwan  <dougkwan@google.com>
2659
2660         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2661         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2662         definition.
2663         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2664         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2665         target hook to detect function points.
2666         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2667         * icf.h (Icf::check_section_for_function_pointers): Change type of
2668         parameter SECTION_NAME to const reference to std::string.  Use
2669         target hook to determine if section may have unsafe pointers.
2670         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2671         method definition.
2672
2673 2010-06-21  Rafael Espindola  <espindola@google.com>
2674
2675         * fileread.cc (Input_file::find_fie): New
2676         (Input_file::open): Use Input_file::find_fie.
2677         * fileread.h (Input_file::find_fie): New
2678         * plugin.cc (set_extra_library_path): New.
2679         (Plugin::load): Add set_extra_library_path to the transfer vector.
2680         (Plugin_manager::set_extra_library_path): New.
2681         (Plugin_manager::add_input_file): Use the extra search path if set.
2682         (set_extra_library_path(): New.
2683         * plugin.h (Plugin_manager): Add set_extra_library_path and
2684         extra_search_path_.
2685
2686 2010-06-19  Cary Coutant  <ccoutant@google.com>
2687
2688         * layout.cc (gdb_sections): Add .debug_types.
2689         (lines_only_debug_sections): Likewise.
2690
2691 2010-06-18  Rafael Espindola  <espindola@google.com>
2692
2693         * plugin.cc (add_input_file,add_input_library)
2694         (Plugin_manager::add_input_file): Make filename arguments const.
2695         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2696         const.
2697
2698 2010-06-16  Doug Kwan  <dougkwan@google.com>
2699
2700         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2701         .ARM.attributes section if we have not merged any input
2702         attributes sections.
2703
2704 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2705
2706         * arm.cc: Allow combining objects with no EABI version
2707         information.
2708
2709 2010-06-15  Rafael Espindola  <espindola@google.com>
2710
2711         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2712
2713 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2714
2715         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2716         (struct iovec): Correct !HAVE_READV definition.
2717
2718 2010-06-10  Cary Coutant  <ccoutant@google.com>
2719
2720         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2721         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2722         reloc sections.
2723         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2724
2725         PR 11683
2726         * symtab.h (Symbol::is_placeholder): New member function.
2727         * target-reloc.h (relocate_section): Check for placeholder symbols.
2728
2729         * testsuite/Makefile.am (plugin_test_8): New test.
2730         (plugin_test_9): New test.
2731         * testsuite/Makefile.in: Regenerate.
2732
2733 2010-06-09  Nick Clifton  <nickc@redhat.com>
2734
2735         * yyscript.y (input_list_element): Allow strings prefixed with
2736         the '-' character.  Treat these as libraries.
2737         * script.cc (script_add_library): New function.  Adds a library
2738         specified by "-l<name>" found in an input script.
2739         * script-c.h: Add prototype for script_add_library.
2740
2741 2010-06-07  Doug Kwan  <dougkwan@google.com>
2742
2743         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2744         Restrict stub-group size to be within long conditional branch
2745         range when working around cortex-A8 erratum.
2746
2747 2010-06-07  Damien Diederen  <dd@crosstwine.com>
2748
2749         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2750         #ifdef typo.
2751
2752 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
2753
2754         PR gold/11658
2755         * output.cc
2756         (Output_section::Input_section_sort_entry::compare_section_ordering):
2757         Change to return non-zero correctly.
2758         (Output_section::Input_section_sort_section_order_index_compare
2759         ::operator()): Change to fix ambiguity in comparisons.
2760
2761 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
2762
2763         * gold.h (is_wildcard_string): New function.
2764         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2765         (Layout::layout_eh_frame): Ditto.
2766         (Layout::find_section_order_index): New method.
2767         (Layout::read_layout_from_file): New method.
2768         * layout.h (Layout::find_section_order_index): New method.
2769         (Layout::read_layout_from_file): New method.
2770         (Layout::input_section_position_): New private member.
2771         (Layout::input_section_glob_): New private member.
2772         * main.cc (main): Call read_layout_from_file here.
2773         * options.h (--section-ordering-file): New option.
2774         * output.cc (Output_section::input_section_order_specified_): New
2775         member.
2776         (Output_section::Output_section): Initialize new member.
2777         (Output_section::add_input_section): Add new parameter.
2778         Keep input sections when --section-ordering-file is used.
2779         (Output_section::set_final_data_size): Sort input sections when
2780         section ordering file is specified.
2781         (Output_section::Input_section_sort_entry): Add new parameter.
2782         Check sorting type.
2783         (Output_section::Input_section_sort_entry::compare_section_ordering):
2784         New method.
2785         (Output_section::Input_section_sort_compare::operator()): Change to
2786         consider section_order_index.
2787         (Output_section::Input_section_sort_init_fini_compare::operator()):
2788         Change to consider section_order_index.
2789         (Output_section::Input_section_sort_section_order_index_compare
2790         ::operator()): New method.
2791         (Output_section::sort_attached_input_sections): Change to sort
2792         according to section order when specified.
2793         (Output_section::add_input_section<32, true>): Add new parameter.
2794         (Output_section::add_input_section<64, true>): Add new parameter.
2795         (Output_section::add_input_section<32, false>): Add new parameter.
2796         (Output_section::add_input_section<64, false>): Add new parameter.
2797         * output.h (Output_section::add_input_section): Add new parameter.
2798         (Output_section::input_section_order_specified): New
2799         method.
2800         (Output_section::set_input_section_order_specified): New method.
2801         (Input_section::Input_section): Initialize section_order_index_.
2802         (Input_section::section_order_index): New method.
2803         (Input_section::set_section_order_index): New method.
2804         (Input_section::section_order_index_): New member.
2805         (Input_section::Input_section_sort_section_order_index_compare): New
2806         struct.
2807         (Output_section::input_section_order_specified_): New member.
2808         * script-sections.cc (is_wildcard_string): Delete and move modified
2809         method to gold.h.
2810         (Output_section_element_input::Output_section_element_input): Modify
2811         call to is_wildcard_string.
2812         (Output_section_element_input::Input_section_pattern
2813         ::Input_section_pattern): Ditto.
2814         (Output_section_element_input::Output_section_element_input): Ditto.
2815         * testsuite/Makefile.am (final_layout): New test case.
2816         * testsuite/Makefile.in: Regenerate.
2817         * testsuite/final_layout.cc: New file.
2818         * testsuite/final_layout.sh: New file.
2819
2820 2010-06-01  Rafael Espindola  <espindola@google.com>
2821
2822         * plugin.cc (Plugin::load): Pass the output name to the plugin.
2823
2824 2010-06-01  Rafael Espindola  <espindola@google.com>
2825
2826         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2827         visibility of symbols.
2828
2829 2010-05-27  Doug Kwan  <dougkwan@google.com>
2830
2831         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2832         from start of output section instead of address for a local symbol
2833         in a merged or relaxed section when doing a relocatable link.
2834
2835 2010-05-26  Rafael Espindola  <espindola@google.com>
2836
2837        PR 11604
2838         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2839         adding sections the garbage collector removed.
2840         * gold/testsuite/Makefile.am: Add test.
2841         * gold/testsuite/Makefile.in: Regenerate.
2842         * gold/testsuite/plugin_test_7.sh: New.
2843         * gold/testsuite/plugin_test_7_1.c: New.
2844         * gold/testsuite/plugin_test_7_2.c: New.
2845
2846 2010-05-26  Rafael Espindola  <espindola@google.com>
2847
2848         * script-sections.cc (Output_section_definition::set_section_addresses):
2849         Check for --section-start.
2850
2851 2010-05-26  Doug Kwan  <dougkwan@google.com>
2852
2853         * arm.cc (Arm_scan_relocatable_relocs): New class.
2854         (Target_arm::relocate_special_relocatable): New method.
2855         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2856         (Arm_relocate_functions::thumb_branch_common): Same.
2857         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2858         instead of Default_scan_relocatable_relocs.
2859         * target-reloc.h (relocate_for_relocatable): Let target handle
2860         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2861         * target.h (Sized_target::relocate_special_relocatable): New method.
2862
2863 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2864
2865         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2866
2867 2010-05-23  Doug Kwan  <dougkwan@google.com>
2868
2869         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2870         instead of a cast.
2871         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2872         with a direct branch, not a conditional branch, to a stub.
2873         * merge.cc (Output_merge_base::record_input_section): New method
2874         defintion.
2875         (Output_merge_data::do_add_input_section): Record input section if
2876         keeps-input-sections flag is set.
2877         (Output_merge_string::do_add_input_section): Ditto.
2878         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2879         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2880         INPUT_SECTIONS_.
2881         (Output_merge_base::keeps_input_sections,
2882         Output_merge_base::set_keeps_input_sections,
2883         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2884         method definitions.
2885         (Output_merge_base::Input_sections): New type declaration.
2886         (Output_merge_base::input_sections_begin,
2887         Output_merge_base::input_sections_end,
2888         Output_merge_base::do_set_keeps_input_sections): New method definitions.
2889         (Output_merge_base::bool keeps_input_sections_,
2890         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2891         Output_merge_base::input_sections_): New data members.
2892         (Output_merge_data::do_set_keeps_input_sections): New method
2893         defintion.
2894         (Output_merge_string::do_set_keeps_input_sections): Ditto.
2895         * output.cc (Output_section::Input_section::relobj): Move method
2896         defintion from class declaration to here and handle merge sections.
2897         (Output_section::Input_section::shndx): Ditto.
2898         (Output_section::Output_section): Remove initializations of removed
2899         data members and initialize new data member LOOKUP_MAPS_.
2900         (Output_section::add_input_section): Set keeps-input-sections flag
2901         for a newly created merge output section as appropriate.  Adjust code
2902         to use Output_section_lookup_maps class.
2903         (Output_section::add_relaxed_input_section): Adjst code for lookup
2904         maps code refactoring.
2905         (Output_section::add_merge_input_section): Add a new parameter
2906         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
2907         class.  If adding input section to a newly created merge output
2908         section fails, remove the new merge section.
2909         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2910         Adjust code for use of the Output_section_lookup_maps class.
2911         (Output_section::find_merge_section): Ditto.
2912         (Output_section::build_lookup_maps): New method defintion.
2913         (Output_section::find_relaxed_input_section): Adjust code to use
2914         Output_section_lookup_maps class.
2915         (Output_section::get_input_sections): Export merge sections.  Adjust
2916         code to use Output_section_lookup_maps class.
2917         (Output_section:::add_script_input_section): Adjust code to use
2918         Output_section_lookup_maps class.  Update lookup maps for merge
2919         sections also.
2920         (Output_section::discard_states): Use Output_section_lookup_maps.
2921         (Output_section::restore_states): Same.
2922         * output.h (Merge_section_properties): Move class defintion out of
2923         Output_section.
2924         (Output_section_lookup_maps): New class.
2925         (Output_section::Input_section::is_merge_section): New method
2926         defintion.
2927         (Output_section::Input_section::relobj): Move defintion out of class
2928         defintion.  Declare method only.
2929         (Output_section::Input_section::shndx): Ditto.
2930         (Output_section::Input_section::output_merge_base): New method defintion.
2931         (Output_section::Input_section::u2_.pomb): New union field.
2932         (Output_section::Merge_section_by_properties_map,
2933         Output_section::Output_section_data_by_input_section_map,
2934         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2935         Remove types.
2936         (Output_section::add_merge_input_section): Add new parameter
2937         KEEPS_INPUT_SECTIONS.
2938         (Output_section::build_lookup_maps): New method declaration.
2939         (Output_section::merge_section_map_,
2940         Output_section::merge_section_by_properties_map_,
2941         Output_section::relaxed_input_section_map_,
2942         Output_section::is_relaxed_input_section_map_valid_): Remove data
2943         members.
2944         (Output_section::lookup_maps_): New data member.
2945
2946 2010-05-21  Doug Kwan  <dougkwan@google.com>
2947
2948         PR gold/11619
2949         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2950         avoid a compilation error.
2951
2952 2010-05-19  Rafael Espindola  <espindola@google.com>
2953
2954         * script-sections.cc (Output_section_definition::allocate_to_segment):
2955         Update the phdrs_list even when the output section is NULL.
2956         * testsuite/Makefile.am: Add test.
2957         * testsuite/Makefile.in: Regenerate.
2958         * testsuite/script_test_9.cc: New.
2959         * testsuite/script_test_9.sh: New.
2960         * testsuite/script_test_9.t: New.
2961
2962 2010-05-19  Doug Kwan  <dougkwan@google.com>
2963
2964         * arm.cc (Arm_input_section::original_size): New method.
2965         (Arm_input_section::do_addralign): Add a cast.
2966         (Arm_input_section::do_output_offset): Remove static cast.
2967         (Arm_input_section::original_addralign,
2968          Arm_input_section::original_size_): Change type to uint32_t.
2969         (Arm_input_section::init): Add safe casts for section alignment
2970         and size.
2971         (Arm_input_section::set_final_data_size): Do not set address and
2972         offset of stub table.
2973         (Arm_output_section::fix_exidx_coverage): Change use of of
2974         Output_section::Simple_input_section to that of
2975         Output_section::Input_section.
2976         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2977         except for the first pass.
2978         * output.cc (Output_section::get_input_sections): Change type of
2979         input_sections to std::list<Input_section>.
2980         (Output_section::add_script_input_section): Rename from
2981         Output_section::add_simple_input_section.  Change type of SIS
2982         parameter from Simple_input_section to Input_section.
2983         * output.h (Output_section::Simple_input_section): Remove class.
2984         (Output_section::Input_section): Change class visibility to public.
2985         (Output_section::Input_section::addralign): Use stored alignments
2986         for special input sections if set.
2987         (Output_section::Input_section::set_addralign): New method.
2988         (Output_section::get_input_sections): Change parameter type from
2989         list of Simple_input_section to list of Input_section.
2990         (Output_section::add_script_input_section): Rename from
2991         Output_section::add_simple_input_section. Change first parameter's
2992         type from Simple_input_section to Input_section and remove the
2993         second and third parameters.
2994         * script-sections.cc (Input_section::Input_section_list): Change
2995         type to list of Output_section::Input_section/
2996         (Input_section_info::Input_section_info): Change parameter type of
2997         INPUT_SECTION to Output_section::Input_section.
2998         (Input_section_info::input_section): Change return type.
2999         (Input_section_info::input_section_): Change type to
3000         Output_section::Input_section.
3001         (Output_section_element_input::set_section_addresses): Adjust code
3002         to use Output_section::Input_section instead of
3003         Output_section::Simple_input_section.  Adjust code for renaming
3004         of Output_section::add_simple_input_section.
3005         (Orphan_output_section::set_section_addresses): Ditto.
3006
3007 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3008
3009         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3010         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3011
3012 2010-05-18  Rafael Espindola  <espindola@google.com>
3013
3014         * options.cc (General_options::finalize): Handle -nostdlib.
3015         * options.h (nostdlib): New option.
3016         * script.cc (script_add_search_dir): Handle -nostdlib.
3017
3018 2010-05-12  Doug Kwan  <dougkwan@google.com>
3019
3020         * arm.cc (Target_arm::do_finalize_sections): Create an empty
3021         attributes section only if there no attributes section after merging.
3022         (Target_arm::merge_object_attributes): Move value of
3023         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3024         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3025         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3026         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3027         and arm_attr_merge_7.stdout.
3028         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3029         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3030         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3031         arm_attr_merge_7b.o): New rules.
3032         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3033         arm_attr_merge_7
3034         * testsuite/Makefile.in: Regenerate.
3035         * testsuite/arm_attr_merge.sh: New file.
3036         * testsuite/arm_attr_merge_[67][ab].s: Same.
3037
3038 2010-05-05  Nick Clifton  <nickc@redhat.com>
3039
3040         * po/es.po: Updated Spanish translation.
3041
3042 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3043
3044         * Makefile.am (install-exec-local): Properly install gold as
3045         default cross linker.
3046         * Makefile.in: Regenerated.
3047
3048 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3049             Nick Clifton  <nickc@redhat.com>
3050
3051         * configure.ac (install_as_default): Define and set to false
3052         unless --enable-gold or --enable-gold=both/gold has been
3053         specified.
3054         * configure: Regenerate.
3055
3056         * Makefile.am (install-exec-local): Install the executable as
3057         'ld.gold'.  If install_as_default is true then also install it as
3058         'ld'.
3059         * Makefile.in: Regenerated.
3060
3061 2010-04-24  Ian Lance Taylor  <iant@google.com>
3062
3063         * layout.cc (Layout::layout_reloc): In relocatable link don't
3064         combine reloc sections for grouped sections.
3065
3066 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
3067
3068         * gc.h (gc_process_relocs): Pass information on relocs pointing to
3069         sections that are not ordinary to icf.
3070         * icf.cc (get_section_contents): Handle relocation pointing to section
3071         with no object or shndx information.
3072         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3073         * testsuite/Makefile.in: Regenerate.
3074         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3075         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3076
3077 2010-04-22  Ian Lance Taylor  <iant@google.com>
3078
3079         * expression.cc (Expression::Expression_eval_info): Add
3080         result_alignment_pointer field.
3081         (Expression::eval_with_dot): Add result_alignment_pointer
3082         parameter.  Change all callers.
3083         (Expression::eval_maybe_dot): Likewise.
3084         (class Binary_expression): Add alignment_pointer parameter to
3085         left_value and right_value.  Change all callers.
3086         (BINARY_EXPRESSION): Set result alignment.
3087         (class Trinary_expression): Add alignment_pointer parameter to
3088         arg2_value and arg3_value.  Change all callers.
3089         (Trinary_cond::value): Set result alignment.
3090         (Max_expression::value, Min_expression::value): Likewise.
3091         (Align_expression::value): Likewise.
3092         * script-sections.cc (class Sections_element): Add dot_alignment
3093         parameter to set_section_addresses virtual function.  Update
3094         instantiations.
3095         (class Output_section_element): Likewise.
3096         (Script_sections::create_segments): Add dot_alignment parameter.
3097         Change all callers.
3098         (Script_sections::create_segments_from_phdrs_clause): Likewise.
3099         (Script_sections::set_phdrs_clause_addresses): Likewise.
3100         * script-sections.h: Update declarations.
3101         * script.h: Update declarations.
3102         * output.h (Output_segment::set_minimum_p_align): Don't decrease
3103         min_p_align.
3104         * testsuite/script_test_3.t: Set large alignment.
3105         * testsuite/script_test_3.sh: Make sure that at least one LOAD
3106         segment has expected alignment.
3107
3108 2010-04-22  Nick Clifton  <nickc@redhat.com>
3109
3110         * po/gold.pot: Updated by the Translation project.
3111         * po/vi.po: Updated Vietnamese translation.
3112
3113 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
3114
3115         * testsuite/Makefile.am (check_PROGRAMS): Add
3116         icf_virtual_function_folding_test.
3117         * testsuite/Makefile.in: Regenerated.
3118
3119 2010-04-15  Andrew Haley  <aph@redhat.com>
3120
3121         * options.h (merge_exidx_entries): New option.
3122         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3123         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3124         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3125         (Target_arm::merge_exidx_entries): New function.
3126         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3127         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3128         to Arm_exidx_fixup constructor.
3129         Add new arg, merge_exidx_entries.
3130         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3131         Arm_output_section::fix_exidx_coverage.
3132
3133 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
3134
3135         * icf.cc (get_section_contents): Check for preemptible functions.
3136         Ignore addend when appropriate.
3137         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
3138         section folded.
3139         (add_from_relobj): Check for section folded.
3140         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3141         * symtab.h (should_add_dynsym_entry): Add new parameter.
3142         * target-reloc.h (scan_relocs): Check for section folded.
3143         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3144         Check reloc types for function pointers in shared objects.
3145         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3146         case.
3147         (icf_preemptible_functions_test): New test case.
3148         (icf_string_merge_test): New test case.
3149         * testsuite.Makefile.in: Regenerate.
3150         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3151         bar_glob.  Refactor code.
3152         * testsuite/icf_preemptible_functions_test.cc: New file.
3153         * testsuite/icf_preemptible_functions_test.sh: New file.
3154         * testsuite/icf_string_merge_test.cc: New file.
3155         * testsuite/icf_string_merge_test.sh: New file.
3156         * testsuite/icf_virtual_function_folding_test.cc: New file.
3157         * testsuite/icf_virtual_function_folding_test.sh: New file.
3158
3159 2010-04-14  Doug Kwan  <dougkwan@google.com>
3160
3161         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3162         for local symbol recounting if we remove a section due to ICF.
3163         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3164         there are no regular objects in input.
3165
3166 2010-04-13  Doug Kwan  <dougkwan@google.com>
3167
3168         * arm.cc (Arm_input_section::set_final_data_size): Compute
3169         accurate final data size instead of using current data size.
3170
3171 2010-04-09  Doug Kwan  <dougkwan@google.com>
3172
3173         * layout.cc (Layout::choose_output_section): Handle script section
3174         types.
3175         (Layout::make_output_section_for_script): Add section type parameter.
3176         Handle script section types.
3177         * layout.h (Layout::make_output_section_for_script): Add section
3178         type parameter.
3179         * output.cc (Output_section::Output_section): Initialize data member
3180         is_noload_.
3181         (Output_section::do_reset_address_and_file_offset): Do not set address
3182         to 0 if section is a NOLOAD section.
3183         * output.h (Output_section::is_noload): New method.
3184         (Output_section::set_is_noload): Ditto.
3185         (Output_section::is_noload_): New data member.
3186         * script-c.h (Script_section_type): New enum type.
3187         (struct Parser_output_section_header): Add new file section_type.
3188         * script-sections.cc (Sections_element::output_section_name): Add
3189         parameter for returning script section type.
3190         (Output_section_definition::output_section_name): Ditto.
3191         (Output_section_definition::section_type)P; New method.
3192         (Output_section_definiton::script_section_type_name): Ditto.
3193         (Output_section_definition::script_section_type_): New data member.
3194         (Output_section_definition::Output_section_definition): Initialize
3195         data member Output_section_definition::script_section_type_.
3196         (Output_section_definition::create_sections): Pass script section type
3197         to Layout::make_output_section_for_script.
3198         (Output_section_definition::output_section_name): Return script
3199         section type to caller.
3200         (Output_section_definition::set_section_address): Do not advance
3201         dot value and load address if section type is NOLOAD.  Set address
3202         of NOLOAD sections regardless of section flags.
3203         (Output_section_definition::print): Print section type if it is
3204         not SCRIPT_SECTION_TYPE_NONE.
3205         (Output_section_definition::section_type): New method.
3206         (Output_section_definition::script_section_type_name): Ditto.
3207         (Script_sections::output_section_name): Add new parameter
3208         PSECTION_TYPE for returning script section type.  Pass it to
3209         section elements.  Handle discard sections.
3210         (Sort_output_sections::operator()): Handle NOLOAD sections.
3211         * script-sections.h (Script_sections::Section_type): New enum type.
3212         (Script_sections::output_section_name): Add a new parameter for
3213         returning script section type.
3214         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3215         INFO and NOLOAD.
3216         * yyscript.y (union): Add new field SECTION_TYPE.
3217         (COPY, DSECT, INFO, NOLOAD): New tokens.
3218         (opt_address_and_section_type): Change type to output_section_header.
3219         (section_type): New non-terminal
3220         (section_header): Handle section type.
3221         (opt_address_and_section_type): Return section type value.
3222
3223 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3224
3225         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3226         * testsuite/plugin_common_test_2.c (foo): Likewise.
3227
3228 2010-04-08  Doug Kwan  <dougkwan@google.com>
3229
3230         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3231         Output_merge_data.
3232         * output.cc (Output_section::add_merge_input_section): Simplify
3233         code and return status of Output_merge_base::add_input_section.
3234         Update merge section map only if Output_merge_base::add_input_section
3235         returns true.
3236
3237 2010-04-07  Doug Kwan  <dougkwan@google.com>
3238
3239         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3240         if section is marked as containing instructions but has no mapping
3241         symbols.
3242         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3243         correct section index.
3244         (Arm_relobj::find_linked_text_section): Ditto.
3245
3246 2010-04-07  Cary Coutant  <ccoutant@google.com>
3247
3248         * archive.cc (include_member): Destroy Read_symbols_data object before
3249         releasing file.
3250         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3251         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3252         (Read_symbols_data::~Read_symbols_data) New destructor.
3253         (Section_relocs::Section_relocs) New constructor.
3254         (Section_relocs::~Section_relocs) New destructor.
3255         (Read_relocs_data::Read_relocs_data) New constructor.
3256         (Read_relocs_data::~Read_relocs_data) New destructor.
3257         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3258         pointers to NULL after deleting.
3259
3260 2010-04-07  Doug Kwan  <dougkwan@google.com>
3261
3262         * arm.cc: Replace "endianity" with "endianness" in comments.
3263         (Arm_exidx_cantunwind): Ditto.
3264         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3265         (Arm_relobj::merge_flags_and_attributes): New method.
3266         (Arm_relobj::merge_flags_and_attributes_): New data member.
3267         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3268         (Arm_relobj::scan_sections_for_stubs): Ditto.
3269         (Arm_relobj::do_read_symbols): Check to see if we really want to
3270         merge processor-specific flags and attributes.  Exit early if
3271         an object is empty except for section names and the undefined symbol.
3272         (Target_arm::do_finalize_sections): Move check for ELF format to
3273         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3274         attributes from a regular object only when we have determined that
3275         it is aapropriate.  Do not create an .ARM.attributes section in
3276         output if there is no regular input object.
3277         (Target_arm::merge_processor_specific_flags): Check
3278         --warn-mismatch before printing any error.
3279         (Target_arm::merge_object_attributes): Ditto.
3280         * gold.cc (queue_middle_tasks): Handle the case in which there is
3281         no regular object in input.
3282         * options.cc (General_options::parse_EB): New method.
3283         (General_options::parse_EL): Same.
3284         (General_options::General_options): Initialize endianness_.
3285         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3286         New options.
3287         (General_options::Endianness): New enum.
3288         (General_options::endianness): New method.
3289         (General_options::endianness_): New data member.
3290         * parameters.cc (Parameters::set_options): Check target endianness.
3291         (Parameters::set_target_once): Ditto.
3292         (Parameters::check_target_endianness): New method.
3293         (parameters_force_valid_target): If either -EL or -EB is specified,
3294         use it to define endianness of default target.
3295         * parameters.h (Parameters::check_target_endianness): New method
3296         declaration.
3297         * target.h (class Target): Change "endianity" to "endianness"
3298         in comments.
3299
3300 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3301
3302         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3303         * configure: Regenerate.
3304         * Makefile.in: Regenerate.
3305         * testsuite/Makefile.in: Regenerate.
3306
3307 2010-04-06  Cary Coutant  <ccoutant@google.com>
3308
3309         gcc PR lto/42757
3310         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3311         prevailing definitions of common symbols.
3312         * testsuite/plugin_test_6.sh: New test case.
3313         * testsuite/plugin_common_test_1.c: New test case.
3314         * testsuite/plugin_common_test_2.c: New test case.
3315         * testsuite/Makefile.am (plugin_test_6): New test case.
3316         * testsuite/Makefile.in: Regenerate.
3317
3318 2010-04-06  Nick Clifton  <nickc@redhat.com>
3319
3320         * po/vi.po: New Vietnamese translation.
3321
3322 2010-03-30  Doug Kwan  <dougkwan@google.com>
3323
3324         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3325
3326 2010-03-25  Doug Kwan  <dougkwan@google.com>
3327
3328         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3329         to avoid a conversion warning on a 32-bit host.
3330
3331 2010-03-24  Ian Lance Taylor  <iant@google.com>
3332
3333         * testsuite/script_test_3.t: Add a TLS segment.
3334         * testsuite/Makefile.am (check_PROGRAMS): Add
3335         tls_phdrs_script_test.
3336         (tls_phdrs_script_test_SOURCES): Define.
3337         (tls_phdrs_script_test_DEPENDENCIES): Define.
3338         (tls_phdrs_script_test_LDFLAGS): Define.
3339         (tls_phdrs_script_test_LDADD): Define.
3340         * testsuite/Makefile.in: Rebuild.
3341
3342 2010-03-23  Cary Coutant  <ccoutant@google.com>
3343
3344         * fileread.cc (find_or_make_view): Fix comment.
3345
3346 2010-03-23  Ian Lance Taylor  <iant@google.com>
3347
3348         * script-sections.cc (class Orphan_section_placement): Define
3349         PLACE_TLS and PLACE_TLS_BSS.
3350         (Orphan_section_placement::Orphan_section_placement): Initialize
3351         new places.
3352         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3353         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3354         (tls_script_test_SOURCES): Define.
3355         (tls_script_test_DEPENDENCIES): Define.
3356         (tls_script_test_LDFLAGS): Define.
3357         (tls_script_test_LDADD): Define.
3358         * testsuite/Makefile.in: Rebuild.
3359
3360 2010-03-22  Doug Kwan  <dougkwan@google.com>
3361
3362         * arm.cc (Arm_relocate_functions::abs8,
3363         Arm_relocate_functions::abs16): Use correct check for overflow
3364         specified in the ARM ELF specs.
3365         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3366         target of a BLX instruction specially.
3367         (Reloc_stub::stub_type_for_reloc): Ditto.
3368         (Relocate::relocate): Use symbolic names instead of numeric relocation
3369         codes to report error.
3370         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3371         workaround.
3372         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3373         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3374         thumb2_blx_out_of_range.stdout
3375         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3376         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3377         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3378         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3379         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3380         thumb2_blx_in_range, thumb2_blx_in_range.o,
3381         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3382         thumb2_blx_out_of_range.o): New rules.
3383         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3384         thumb2_blx_in_range and thumb2_blx_out_of_range.
3385         * testsuite/Makefile.in: Regenerate.
3386         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3387         * testsuite/thumb_blx_in_range.s: New file.
3388         * testsuite/thumb_blx_out_of_range.s: New file.
3389
3390 2010-03-22  Rafael Espindola  <espindola@google.com>
3391
3392         * archive.cc (Should_include): Move to archive.h.
3393         (should_include_member): Make it a member of Archive.
3394         (Lib_group): New.
3395         (Add_lib_group_symbols): New.
3396         * archive.h: Include options.h.
3397         (Archive_member): Moved from Archive.
3398         (Should_include): Moved from archive.cc.
3399         (Lib_group): New.
3400         (Add_lib_group_symbols): New.
3401         * dynobj.cc (do_should_include_member): New.
3402         * dynobj.h (do_should_include_member): New.
3403         * gold.cc (queue_initial_tasks): Update call to queue.
3404         * main.cc (main): Print lib group stats.
3405         * object.cc (do_should_include_member): New.
3406         * object.h: Include archive.h.
3407         (Object::should_include_member): New.
3408         (Object::do_should_include_member): New.
3409         (Sized_relobj::do_should_include_member): New.
3410         * options.cc (General_options::parse_start_lib): New.
3411         (General_options::parse_end_lib): New.
3412         (Input_arguments::add_file): Handle lib groups.
3413         (Input_arguments::start_group): Check we are not in a lib.
3414         (Input_arguments::start_lib): New.
3415         (Input_arguments::end_lib): New.
3416         * options.h (General_options): Add start_lib and end_lib.
3417         (Input_argument::lib_): New.
3418         (Input_argument::lib): New.
3419         (Input_argument::is_lib): New.
3420         (Input_file_lib): New.
3421         (Input_arguments::in_lib_): New.
3422         (Input_arguments::in_lib): New.
3423         (Input_arguments::start_lib): New.
3424         (Input_arguments::end_lib_): New.
3425         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3426         in unused members as preempted.
3427         (Sized_pluginobj::do_should_include_member): New.
3428         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3429         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3430         return the blocker.
3431         (Read_symbols::do_whole_lib_group): New.
3432         (Read_symbols::do_lib_group): New.
3433         (Read_symbols::do_read_symbols): Handle lib groups.
3434         (Read_symbols::get_name): Handle lib groups.
3435         * readsyms.h (Read_symbols): Add an archive member pointer.
3436         (Read_symbols::do_whole_lib_group): New.
3437         (Read_symbols::do_lib_group): New.
3438         (Read_symbols::member_): New.
3439         * script.cc (read_input_script): Update call to queue_soon.
3440
3441 2010-03-19  Doug Kwan  <dougkwan@google.com>
3442
3443         * arm.cc (Stub_table::Stub_table): Initialize new data members
3444         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3445         (Stub_table::add_reloc_stub): Assign stub offset and update
3446         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3447         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3448         New data members.
3449         (Stub_table::update_data_size_and_addralign): Use
3450         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3451         instead of going over all reloc stubs.
3452         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3453         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3454         Stringpool_template::offset_ to size of Stringpool_char.
3455         (Stringpool_template::new_key_offset): Remove code to initialize
3456         Stringpool_template::offset_.
3457         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3458         Stringpool_template::offset_ to zero.
3459
3460 2010-03-15  Doug Kwan  <dougkwan@google.com>
3461
3462         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3463         offset_.
3464         (Stringpool_template::new_key_offset): New method.
3465         (Stringpool_template::add_string): Assign offsets when adding new
3466         strings.
3467         (Stringpool_template::set_string_offsets): Do not set string offsets
3468         when not optimizing.
3469         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3470         member size_.
3471         (Chunked_vector::clear): Clear size_.
3472         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3473         (Chunked_vector::size): Return size_.
3474         (Chunked_vector::push_back): Use size_ to find insert position.
3475         (Chunked_vector::size_): New data member.
3476         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3477         (Stringpool_template::new_key_offset): New method declaration.
3478         (Stringpool_template::offset_): New data member.
3479
3480 2010-03-15   Rafael Espindola  <espindola@google.com>
3481
3482         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3483         Add_symbols' constructor.
3484         * readsyms.h (Add_symbols): Remove the input_group member.
3485
3486 2010-03-10  Ian Lance Taylor  <iant@google.com>
3487
3488         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3489         target to ask whether a reference to a symbol requires a stack
3490         split.
3491         * target.h (Target::is_call_to_non_split): New function.
3492         (Target::do_is_call_to_non_split): Declare virtual function.
3493         * target.cc: Include "symtab.h".
3494         (Target::do_is_call_to_non_split): New function.
3495         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3496
3497 2010-03-10  Cary Coutant  <ccoutant@google.com>
3498
3499         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3500         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3501         (File_read::open[2]): Add whole_file_view_ to list of views.
3502         (File_read::make_view): Remove test of whole_file_view_.
3503         (File_read::find_or_make_view): Create whole_file_view_ if
3504         necessary.
3505         (File_read::clear_views): Replace bool parameter with enum;
3506         adjust all callers.  Don't delete views with permanent data;
3507         do delete cached views and views from archives if
3508         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3509         if clearing the corresponding view.
3510         * fileread.h (File_read::Clear_views_mode): New enum.
3511         (File_read::View::is_permanent_view): New method.
3512         (File_read::clear_views): Replace bool parameter
3513         with enum; adjust all callers.
3514         * options.h (General_options): Change keep_files_mapped option;
3515         add map_whole_files.
3516         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3517         releasing the file.
3518         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3519         the file.
3520
3521 2010-03-10  David S. Miller  <davem@davemloft.net>
3522
3523         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3524
3525 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3526
3527         * icf.cc (get_section_contents): Add '@' marker after processing the
3528         merge reloc.
3529
3530 2010-03-08  Doug Kwan  <dougkwan@google.com>
3531
3532         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3533         due to a conversion warning.
3534         (Arm_relobj::update_output_local_symbol_count): Check for local
3535         symbol with unset output index.
3536
3537 2010-03-05  Ian Lance Taylor  <iant@google.com>
3538
3539         * options.h (class General_options): Add --spare-dynamic-tags.
3540         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3541         --spare-dynamic-tags.
3542
3543 2010-03-05  Ian Lance Taylor  <iant@google.com>
3544
3545         * incremental.cc: Include "libiberty.h".
3546
3547 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3548
3549         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3550         function, is_info_ member.
3551         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3552         (Versions::Versions): Update caller.
3553         (Versions::define_base_version): Likewise.
3554         (Versions::add_def): Likewise.
3555
3556 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3557
3558         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3559         (Scan::possible_function_pointer_reloc): New function.
3560         (Scan::local_reloc_may_be_function_pointer): Change to call
3561         possible_function_pointer_reloc.
3562         (Scan::global_reloc_may_be_function_pointer): Ditto.
3563         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3564         relocations in ".data.rel.ro._ZTV" section.
3565         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3566         * testsuite/icf_safe_so_test.cc: Ditto.
3567         * testsuite/icf_safe_test.cc: Ditto.
3568         * testsuite/icf_safe_test.sh: Ditto.
3569
3570 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3571             Ian Lance Taylor  <iant@google.com>
3572
3573         * target-reloc.h (relocate_section): Check the symbol table index
3574         for -1U before setting the local symbol index.
3575         (scan_relocatable_relocs): If copying the relocation, record that
3576         the local symbol is required.
3577         * object.h (Symbol_value::is_output_symtab_index_set): New
3578         function.
3579         (Symbol_value::may_be_discarded_from_output_symtab): New
3580         function.
3581         (Symbol_value::has_output_symtab_entry): New function.
3582         (Symbol_value::needs_output_symtab_entry): Remove.
3583         (Symbol_value::output_symtab_index): Make sure the symbol index is
3584         set.
3585         (Symbol_value::set_output_symtab_index): Make sure the symbol
3586         index is not set.  Make sure the new index is valid.
3587         (Symbol_value::set_must_have_output_symtab_entry): New function.
3588         (Symbol_value::has_output_dynsym_entry): New function.
3589         (Symbol_value::set_output_dynsym_index): Make sure the new index
3590         is valid.
3591         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3592         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3593         local symbol if permitted.
3594         (Sized_relobj::do_finalize_local_symbols): Call
3595         is_output_symtab_index_set rather than needs_output_symtab_entry.
3596         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3597         rather than needs_output_symtab_entry.  Call
3598         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3599         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3600         is_output_symtab_index_set rather than needs_output_symtab_entry.
3601         * testsuite/discard_locals_relocatable_test.c: New file.
3602         * testsuite/discard_locals_test.sh: Test -r.
3603         * testsuite/Makefile.am (check_DATA): Add
3604         discard_locals_relocatable_test1.syms,
3605         discard_local_relocatable_test2.syms.
3606         (MOSTLYCLEANFILES): Likewise.  Also add
3607         discard_locals_relocatable_test1.lout and
3608         discard_locals_relocatable_test2.out.
3609         (discard_locals_relocatable_test1.syms): New target.
3610         (discard_locals_relocatable_test.o): New target.
3611         (discard_locals_relocatable_test1.out): New target.
3612         (discard_locals_relocatable_test2.syms): New target.
3613         (discard_locals_relocatable_test2.out): New target.
3614         (various): Add missing ../ld-new dependencies.
3615         * testsuite/Makefile.in: Rebuild.
3616
3617 2010-03-03  Nick Clifton  <nickc@redhat.com>
3618
3619         * po/fi.po: New Finnish translation.
3620
3621 2010-03-01  Doug Kwan  <dougkwan@google.com>
3622
3623         * layout.cc (Layout::Layout): Force section types of .init_array*,
3624         .preinit_array* and .fini_array* sections.
3625         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3626         Fix check of return value of std::string::find.().
3627         (Output_section::Input_section_sort_compare::operator()): Remove
3628         comment about .init_array.
3629         (Output_section::Input_section_sort_init_fini_compare::operator()):
3630         New method.
3631         (Output_section::sort_attached_input_sections): Handle .init_array
3632         and .fini_array specially.
3633         * output.h (Output_section::Inut_section_sort_compare): Update
3634         comment.
3635         (Output_section::Input_section_sort_init_fini_compare): New struct.
3636
3637 2010-02-26  Doug Kwan  <dougkwan@google.com>
3638
3639         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3640         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3641         * testsuite/debug_msg.sh: Avoid matching source line number for
3642         use of global variable undef_int.
3643
3644 2010-02-26  Doug Kwan  <dougkwan@google.com>
3645
3646         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3647         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3648         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3649         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3650         * options.cc (General_options::General_options): Initialize member
3651         fix_v4bx_.
3652         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3653         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3654         and rm_no_fix_v4bx.stdout
3655         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3656         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3657         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3658         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3659         and arm_no_fix_v4bx.
3660         * Makefile.in: Regenerate.
3661         * testsuite/arm_fix_v4bx.s: New file.
3662         * testsuite/arm_fix_v4bx.sh: Ditto.
3663
3664 2010-02-24  Doug Kwan  <dougkwan@google.com>
3665
3666         * arm.cc (Target_arm::got_section): Make the .got section the first
3667         non RELRO section in the data segment.
3668         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3669         suffixes of section names.
3670
3671 2010-02-24  Doug Kwan  <dougkwan@google.com>
3672
3673         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3674         flags and attributes merging if an input file is a binary file.
3675         * fileread.cc (Input_file::open): Record format of original file.
3676         * fileread.h (Input_file::Format): New enum type.
3677         (Input_file::Input_file): Initialize data member format_.
3678         (Input_file::format): New method definition.
3679         (Input_file::format_):: New data member.
3680
3681 2010-02-24  Doug Kwan  <dougkwan@google.com>
3682
3683         * arm.cc (Arm_output_data_got): New class.
3684         (ARM_TCB_SIZE): New constant
3685         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3686         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3687         If user uses a script with a SECTIONS clause, issue only a warning
3688         for a misplaced EXIDX input section.  Otherwise, issue an error.
3689         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3690         garbage collection.
3691         (Target_arm::got_mode_index_entry): Handle static linking.
3692         (Target_arm::Scan::local): Ditto.
3693         (Target_arm::Scan::global): Ditto.
3694         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3695         all incorrectly implemented relocations.
3696         (Target_arm::fix_exidx_coverage): Pass layout to
3697         Arm_output_section::fix_exidx_coverage.
3698         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3699         from ".ARM.exidx." and ".ARM.extab.".
3700
3701 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3702
3703         * arm.cc (Target_arm::do_finalize_sections): Create attribute
3704         section if it does not already exist.
3705         * attributes.cc (Attributes_section_data::Attributes_section_data):
3706         Don't crash if size is zero.
3707
3708 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3709             Ian Lance Taylor  <iant@google.com>
3710
3711         * gold.cc (queue_middle_tasks): If no input files were opened,
3712         exit.
3713         * workqueue.h (Task_function::Task_function): Assert that there is
3714         a blocker.
3715
3716 2010-02-22  Doug Kwan  <dougkwan@google.com>
3717
3718         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3719         * icf.cc (get_section_contents): Cast snprintf arguments to long long
3720         types to avoid warnings due to different uint64_t implementations
3721         on different hosts.
3722
3723 2010-02-21  Doug Kwan  <dougkwan@google.com>
3724
3725         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3726         handling of the maximum backward branch offset.
3727         (Arm_relocate_functions::thumb_branch_common): Ditto.
3728         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3729         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3730         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3731         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3732         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3733         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3734         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3735         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3736         thumb_bl_out_of_range thumb_bl_out_of_range.o,
3737         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3738         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3739         thumb2_bl_out_of_range.o): New rules.
3740         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3741         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3742         thumb2_bl_out_of_range
3743         * testsuite/Makefile.in: Regenerate.
3744         * testsuite/arm_bl_in_range.s: New file.
3745         * testsuite/arm_bl_out_of_range.s: Ditto.
3746         * testsuite/arm_branch_in_range.sh: Ditto.
3747         * testsuite/arm_branch_range.t: Ditto.
3748         * testsuite/thumb2_branch_range.t: Ditto.
3749         * testsuite/thumb_bl_in_range.s: Ditto.
3750         * testsuite/thumb_bl_out_of_range.s: Ditto.
3751         * testsuite/thumb_branch_range.t: Ditto.
3752
3753 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
3754
3755         * gc.h (gc_process_relocs): Change vectors to point to the new list.
3756         Add reloc offset information.
3757         * icf.cc (get_section_contents): Change iterators to point to the new
3758         vectors. Add reloc offset information to the contents.
3759         * icf.h (Icf::Sections_reachable_info): New typedef.
3760         (Icf::Sections_reachable_list): New typedef.
3761         (Icf::Offset_info): New typedef.
3762         (Icf::Reloc_info): New struct typedef.
3763         (Icf::Reloc_info_list): New typedef.
3764         (Icf::symbol_reloc_list): Delete method.
3765         (Icf::addend_reloc_list): Delete method.
3766         (Icf::section_reloc_list): Delete method.
3767         (Icf::reloc_info_list): New method.
3768         (Icf::reloc_info_list_): New member.
3769
3770 2010-02-19  Doug Kwan  <dougkwan@google.com>
3771
3772         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3773         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3774         * arm.cc (Arm_relocation_functions): New forward declaration.
3775         (Target_arm::Target_arm): Initialize new data members
3776         got_mod_index_offset_ and tls_base_symbol_defined_.
3777         (Target_arm::Relocate::relocate_tls): New method.
3778         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3779          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3780         New methods.
3781         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3782         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3783         (Target_arm::got_mod_index_offset_,
3784         Target_arm::tls_base_symbol_defined_): New data members.
3785         (Target_arm::Scan::local, Target::Scan::global,
3786         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3787         relocations.
3788
3789 2010-02-18  Doug Kwan  <dougkwan@google.com>
3790
3791         * arm.cc (Arm_relobj::find_linked_text_section): New method.
3792         (Arm_relobj::make_exidx_input_section): Pass section index of linked
3793         text section as a parameter becuase some broken tools may not set
3794         the link in section header.
3795         (Target_arm::has_got_section): New method.
3796         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3797         without any mapping symbol as data only.  Remove warning.
3798         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3799         link in its section header, try to discover the link by inspecting the
3800         REL31 relocation at the beginning of the section.
3801         (Target_arm::Scan::check_non_pic): Report name of offending relocation
3802         in error message.
3803         (Target_arm::Scan::global): Treat any reference to the symbol
3804         _GLOBAL_OFFSET_TABLE_ as a GOT access.
3805
3806 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
3807
3808         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3809         (Scan::global_reloc_may_be_function_pointer): New function.
3810         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3811         (Scan::global_reloc_may_be_function_pointer): New function.
3812         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3813         (Scan::global_reloc_may_be_function_pointer): New function.
3814         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3815         (Scan::global_reloc_may_be_function_pointer): New function.
3816         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3817         (Scan::global_reloc_may_be_function_pointer): New function.
3818         (Scan::possible_function_pointer_reloc): New function.
3819         (Target_x86_64::can_check_for_function_pointers): New function.
3820         * gc.h (gc_process_relocs): Scan relocation types to determine if
3821         function pointers were taken for targets that support it.
3822         * icf.cc (Icf::find_identical_sections): Include functions for
3823         folding in safe ICF whose pointer is not taken.
3824         * icf.h (Secn_fptr_taken_set): New typedef.
3825         (fptr_section_id_): New member.
3826         (section_has_function_pointers): New function.
3827         (set_section_has_function_pointers): New function.
3828         (check_section_for_function_pointers): New function.
3829         * options.h: Fix comment for safe ICF option.
3830         * target.h (can_check_for_function_pointers): New function.
3831         * testsuite/Makefile.am: Add icf_safe_so_test test case.
3832         Modify icf_safe_test for X86-64.
3833         * testsuite/Makefile.in: Regenerate.
3834         * testsuite/icf_safe_so_test.cc: New file.
3835         * testsuite/icf_safe_so_test.sh: New file.
3836         * testsuite/icf_safe_test.cc (kept_func_3): New function.
3837         (main): Change to take pointer to function kept_func_3.
3838         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3839         folding is done correctly for X86-64.
3840
3841 2010-02-12  David S. Miller  <davem@davemloft.net>
3842
3843         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3844         is_symbolless parameter.
3845         (Output_reloc<SHT_REL>::is_symbolless): New.
3846         (Output_reloc<SHT_REL>::is_symbolless_): New.
3847         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3848         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3849         (Output_reloc<SHT_RELA>::is_symbolless): New.
3850         (Output_data_reloc::add_global): Handle is_symbolless.
3851         (Output_data_reloc::add_global_relative): Likewise.
3852         (Output_data_reloc::add_local): Likewise.
3853         (Output_data_reloc::add_local_relative): Likewise.
3854         (Output_data_reloc::add_symbolless_global_addend): New.
3855         (Output_data_reloc::add_symbolless_local_addend): New.
3856         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3857         is_symbolless.
3858         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3859         instead of ->is_relative_
3860         (Output_reloc::write): Likewise.
3861         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3862         (Output_reloc::write_rel): Simplify.
3863
3864         * sparc.cc (Target_sparc::Scan::local): Use
3865         ->add_symbolless_local_addend as needed.
3866         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3867         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
3868         based upon relocation offset.
3869
3870 2010-02-11  Doug Kwan  <dougkwan@google.com>
3871
3872         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3873         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
3874         beginning of function.
3875         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3876         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
3877         parameter is_32bit in calls to should_apply_static_reloc.
3878         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3879         (check_DATA): Add arm_abs_global.stdout.
3880         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3881         arm_abs_global.stdout): New rules.
3882         (MOSTLLYCLEANFILES): Add arm_abs_global
3883         * Makefile.in: Regenerate.
3884         * testsuite/arm_abs_global.s: New file.
3885         * testsuite/arm_abs_global.sh: Ditto.
3886         * testsuite/arm_abs_lib.s: Ditto.
3887
3888 2010-02-11  Ian Lance Taylor  <iant@google.com>
3889
3890         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3891         Read_relocs task.
3892         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
3893         Allocate_commons_task first.
3894         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3895         task, rather than symtab_lock_.
3896         (Gc_process_relocs::~Gc_process_relocs): New function.
3897         (Gc_process_relocs::is_runnable): Check this_blocker_.
3898         (Gc_process_relocs::locks): Use next_blocker_ rather than
3899         blocker_.
3900         (Scan_relocs::~Scan_relocs): New function.
3901         (Scan_relocs::is_runnable): Check this_blocker_ rather than
3902         symtab_lock_.
3903         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
3904         next_blocker_.
3905         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3906         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
3907         constructor accordingly.
3908         (class Gc_process_relocs): Likewise.
3909         (class Scan_relocs): Likewise.
3910         * common.h (class Allocate_commons_task): Remove symtab_lock_
3911         field, and corresponding constructor parameter.
3912         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3913         symtab_lock_.
3914         (Allocate_commons_task::locks): Likewise.
3915
3916 2010-02-11  Ian Lance Taylor  <iant@google.com>
3917
3918         * gold-threads.h (class Once): Define.
3919         (class Initialize_lock): Rewrite as child of Once.
3920         * gold-threads.cc (class Once_initialize): Define.
3921         (once_pointer_control): New static variable.
3922         (once_pointer, once_arg): New static variables.
3923         (c_run_once): New static function.
3924         (Once::Once, Once::run_once, Once::internal_run): New functions.
3925         (class Initialize_lock_once): Remove.
3926         (initialize_lock_control): Remove.
3927         (initialize_lock_pointer): Remove.
3928         (initialize_lock_once): Remove.
3929         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3930         (Initialize_lock::initialize): Rewrite.
3931         (Initialize_lock::do_run_once): New function.
3932         * archive.cc (Archive::interpret_header): Only clear name if it is
3933         not already empty.
3934         * fileread.cc: Include "gold-threads.h"
3935         (file_counts_lock): New static variable.
3936         (file_counts_initialize_lock): Likewise.
3937         (File_read::release): Only increment counts when using --stats.
3938         Use a lock around the increment.
3939         * parameters.cc (class Set_parameters_target_once): Define.
3940         (set_parameters_target_once): New static variable.
3941         (Parameters::Parameters): Move here from parameters.h.
3942         (Parameters::set_target): Rewrite.
3943         (Parameters::set_target_once): New function.
3944         (Parameters::clear_target): Move here and rewrite.
3945         * parameters.h (class Parameters): Update declarations.  Add
3946         set_parameters_target_once_ field.
3947         (Parameters::Parameters): Move to parameters.cc.
3948         (Parameters::clear_target): Likewise.
3949         * readsyms.cc (Read_symbols::do_group): Create a Start_group
3950         task.
3951         (Start_group::~Start_group): New function.
3952         (Start_group::is_runnable): New function.
3953         (Start_group::locks, Start_group::run): New functions.
3954         (Finish_group::run): Change saw_undefined to size_t.
3955         * readsyms.h (class Start_group): Define.
3956         (class Finish_group): Change saw_undefined_ field to size_t.
3957         (Finish_group::Finish_group): Remove saw_undefined and
3958         this_blocker parameters.  Change all callers.
3959         (Finish_group::set_saw_undefined): New function.
3960         (Finish_group::set_blocker): New function.
3961         * symtab.h (class Symbol_table): Change saw_undefined to return
3962         size_t.  Change saw_undefined_ field to size_t.
3963         * target-select.cc (Set_target_once::do_run_once): New function.
3964         (Target_selector::Target_selector): Initialize set_target_once_
3965         field.  Don't initialize lock_ and initialize_lock_ fields.
3966         (Target_selector::instantiate_target): Rewrite.
3967         (Target_selector::set_target): New function.
3968         * target-select.h (class Set_target_once): Define.
3969         (class Target_selector): Update declarations.  Make
3970         Set_target_once a friend.  Remove lock_ and initialize_lock_
3971         fields.  Add set_target_once_ field.
3972
3973 2010-02-10  Ian Lance Taylor  <iant@google.com>
3974
3975         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3976         queueing any tasks.
3977         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
3978         (queue_middle_tasks): Add all blockers before queueing any tasks.
3979         (queue_final_tasks): Likewise.
3980         * token.h (Task_token::add_blockers): New function.
3981         * object.h (Input_objects::number_of_relobjs): New function.
3982
3983 2010-02-10  Ian Lance Taylor  <iant@google.com>
3984
3985         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3986         shared, not if not position independent.
3987         * x86_64.cc (Relocate::relocate_tls): Likewise.
3988         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3989         (tls_pie_pic_test): New target.
3990         * testsuite/Makefile.in: Rebuild.
3991
3992         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3993         (tls_test_main_pie.o, tls_test_pie.o): New targets.
3994         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3995         * testsuite/Makefile.in: Rebuild.
3996
3997 2010-02-09  David S. Miller  <davem@davemloft.net>
3998
3999         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4000         R_SPARC_RELATIVE using ->add_local_relative().
4001         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4002
4003         * output.h (Output_data_dynamic::add_section_size): New method
4004         that takes two Output_data objects.
4005         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4006         entry param.  Handle it in initializers.
4007         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4008         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4009         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4010         arg.
4011         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4012         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4013         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4014         for dynrel_includes_plt.
4015         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4016         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4017         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4018         before .rela.plt
4019         (Target_sparc::do_finalize_sections): Update to pass true for
4020         dynrel_includes_plt.
4021         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4022         output before .rela.plt
4023         (Target_powerpc::do_finalize_sections): Update to pass true for
4024         dynrel_includes_plt when 32-bit.
4025
4026 2010-02-08  Doug Kwan  <dougkwan@google.com>
4027
4028         * arm.cc (Arm_relobj::simple_input_section_output_address): New
4029         method.
4030         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4031         Arm_relobj::scan_section_for_cortex_a8_stubs,
4032         Arm_relobj::do_relocation_section): Instead of calling
4033         Output_section::output_address, use faster
4034         Arm_relobj::simple_input_section_output_address.
4035
4036 2010-02-08  David S. Miller  <davem@davemloft.net>
4037
4038         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4039         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4040         relocation helper function.
4041
4042         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4043         just like R_SPARC_GOT{10,13,22}.
4044         (Target_sparc::Scan::local): Likewise.
4045         (Target_sparc::Relocate:relocate): Likewise.
4046
4047 2010-02-06  Ian Lance Taylor  <iant@google.com>
4048
4049         * configure.ac: Rewrite targetobjs duplicate removal code to use
4050         only shell constructs.
4051         * configure: Rebuild.
4052
4053 2010-02-05  Doug Kwan  <dougkwan@google.com>
4054
4055         PR 11247
4056         * arm.cc (Arm_relobj::section_is_scannable): New method.
4057         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4058         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4059
4060 2010-02-04  Doug Kwan  <dougkwan@google.com>
4061
4062         PR 11247
4063         * arm-reloc-property.cc (cstdio): Include.
4064         * configure.ac (targetobjs): Remove duplicates.
4065         * configure: Regenerate.
4066         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4067         big and little endian version for a given address size.
4068
4069 2010-02-03  Doug Kwan  <dougkwan@google.com>
4070
4071         * arm-reloc-property.cc
4072         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4073         definition.
4074         * arm-reloc-property.h
4075         (Arm_reloc_property_table::get_implemented_static_reloc_property):
4076         New method definition.
4077         (Arm_reloc_property_table::reloc_name_in_error_message): New method
4078         declaration.
4079         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4080         overflow to N.
4081         (GOT_PREL): Change implemented to Y.
4082         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4083         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4084         (Arm_relocate_functions::movw_abs_nc): Remove method.
4085         (Arm_relocate_functions::movt_abs): Ditto.
4086         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4087         (Arm_relocate_functions::thm_movt_abs): Ditto.
4088         (Arm_relocate_functions::movw_rel_nc): Ditto.
4089         (Arm_relocate_functions::movw_rel): Ditto.
4090         (Arm_relocate_functions::movt_rel): Ditto.
4091         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4092         (Arm_relocate_functions:thm_movw_rel): Ditto.
4093         (Arm_relocate_functions:thm_movt_rel): Ditto.
4094         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4095         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4096         New method definitions.
4097         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4098         (Arm_relocation_functions::arm_grp_ldr): Ditto.
4099         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4100         (Arm_relocation_functions::arm_grp_ldc): Ditto.
4101         (Target_arm::Relocate::relocate): Check for non-static or
4102         unimplemented relocation code and exit early.  Change calls to
4103         Target_arm::reloc_uses_thumb_bit and
4104         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4105         instead.  Refactor code to handle similar relocations to increase
4106         code sharing.  Remove check for unsupported relocation code in switch
4107         statement.
4108         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4109         relocation property table to find out size.  Change error message to
4110         print out the name of a relocation code instead of the numeric value.
4111         (Target_arm::scan_reloc_for_stub): Use relocation property table
4112         instead of calling Target_arm::reloc_uses_thumb_bit().
4113
4114 2010-02-02  Doug Kwan  <dougkwan@google.com>
4115
4116         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4117         types of relaxed input section.
4118
4119 2010-02-02  Doug Kwan  <dougkwan@google.com>
4120
4121         * Makefile.am (HFILES): Add arm-reloc-property.h.
4122         (DEFFILES): New.
4123         (TARGETSOURCES): Add arm-reloc-property.cc
4124         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4125         (libgold_a_SOURCES): $(DEFFILES)
4126         * Makefile.in: Regenerate.
4127         * arm-reloc-property.cc: New file.
4128         * arm-reloc-property.h: New file.
4129         * arm-reloc.def: New file.
4130         * arm.cc: Update comments.
4131         (arm-reloc-property.h): New included header.
4132         (arm_reloc_property_table): New global variable.
4133         (Target_arm::do_select_as_default_target): New method definition.
4134         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4135         arm-reloc-property to targ_extra_obj.
4136         * parameters.cc (set_parameters_target): Call
4137         Target::select_as_default_target().
4138         * target.h (Target::select_as_default_target): New method definition.
4139         (Target::do_select_as_default_target): Same.
4140
4141 2010-02-01  Doug Kwan  <dougkwan@google.com>
4142
4143         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4144         first_output_text_section_.
4145         (Arm_exidx_fixup::first_output_text_section): New method definition.
4146         (Arm_exidx_fixup::first_output_text_section_): New data member.
4147         (Arm_exidx_fixup::process_exidx_section): Record the first text
4148         output section seen.
4149         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4150         and entsize in output section header.
4151
4152 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4153
4154         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4155         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4156         (Arm_relocate_functions::thm_alu11): New Method.
4157         (Arm_relocate_functions::thm_pc8): New Method.
4158         (Arm_relocate_functions::thm_pc12): New Method.
4159         (Target_arm::Scan::local): Handle the relocations.
4160         (Target_arm::Scan::global): Likewise.
4161         (Target_arm::Relocate::relocate): Likewise.
4162         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4163
4164 2010-01-29  Doug Kwan  <dougkwan@google.com>
4165
4166         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4167         of relocation types as ld.
4168
4169 2010-01-29  Doug Kwan  <dougkwan@google.com>
4170
4171         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4172         to public.
4173         (Arm_relocate_functions::thumb_branch_common): Ditto.
4174         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4175         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4176         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4177         Arm_relocate_functions::jump24): Remove.
4178         (Target_arm::Relocate::relocate): Adjust code to call
4179         Arm_relocation_functions::arm_branch_common and
4180         Arm_relocation_functions::thumb_branch_common instead of their removed
4181         wrappers.  Merge switch-cases together to reduce source code size.
4182
4183 2010-01-29  Doug Kwan  <dougkwan@google.com>
4184
4185         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4186         output_local_symbol_count_needs_update_.
4187         (Arm_relobj::output_local_symbol_count_needs_update,
4188          Arm_relobj::set_output_local_symbol_count_needs_update,
4189          Arm_relobj::update_output_local_symbol_count): New methods.
4190         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4191         member.
4192         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4193         of pointed function as in a R_ARM_PREL31 relocation.
4194         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4195         for output local symbol count updating.
4196         (Target_arm::do_relax): Update output local symbol counts in objects
4197         if necessary.
4198         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4199
4200 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4201
4202         * arm.cc: Added support for the ARM relocations:
4203         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4204         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4205         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4206         movw_prel_nc).
4207         (Arm_relocate_functions::movw_rel): New method.
4208         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4209         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4210         thm_movw_prel_nc).
4211         (Arm_relocate_functions::thm_movw_rel): New method.
4212         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4213         thm_movt_prel).
4214         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4215         relocations.
4216         (Target_arm::Scan::global): Likewise.
4217         (Target_arm::Relocate::relocate): Likewise.
4218         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4219         Likewise.
4220
4221 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4222
4223         * arm.cc: Added support for ARM group relocations.
4224         (Target_arm::reloc_needs_sym_origin): New method.
4225         (Arm_relocate_functions::calc_grp_kn): New method.
4226         (Arm_relocate_functions::calc_grp_residual): New method.
4227         (Arm_relocate_functions::calc_grp_gn): New method.
4228         (Arm_relocate_functions::arm_grp_alu): New Method.
4229         (Arm_relocate_functions::arm_grp_ldr): New Method.
4230         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4231         (Arm_relocate_functions::arm_grp_ldc): New Method.
4232         (Target_arm::Scan::local): Handle the ARM group relocations.
4233         (Target_arm::Scan::global): Likewise.
4234         (Target_arm::Relocate::relocate): Likewise.
4235         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4236         Likewise.
4237
4238 2010-01-26  Doug Kwan  <dougkwan@google.com>
4239
4240         * arm.cc (set): Include.
4241         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4242         pointer type.
4243         (Arm_output_section::Text_section_list): New type.
4244         (Arm_output_section::append_text_sections_to_list): New method.
4245         (Arm_output_section::fix_exidx_coverage): Ditto.
4246         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4247         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4248         Relobj::set_section_offset() instead of
4249         Sized_relobj::invalidate_section_offset().
4250         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4251         parameter for section headers. Ignore relocation sections for
4252         unallocated sections and EXIDX sections.
4253         (Target_arm::fix_exidx_coverage): New method.
4254         (Target_arm::output_section_address_less_than): New type.
4255         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4256         linked text section instead of the EXIDX section.
4257         (Arm_output_section::create_stub_group): Add an assertion to check
4258         that this is not an EXIDX output section.
4259         (Arm_output_section::append_text_sections_to_list): New method.
4260         (Arm_output_section::fix_exidx_coverage): Ditto.
4261         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4262         Arm_relobj::section_needs_reloc_stub_scanning.
4263         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4264         first pass.
4265         (Target_arm::fix_exidx_coverage): New method.
4266         * object.h (Relobj::set_output_section): New method.
4267         (Sized_relobj::invalidate_section_offset): Remove method.
4268         (Sized_relobj::do_invalidate_section_offset): Remove method.
4269         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4270
4271 2010-01-25  Doug Kwan  <dougkwan@google.com>
4272
4273         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4274         Fix warning due to signed and unsigned comparison on a 32-bit host.
4275
4276 2010-01-22  Doug Kwan  <dougkwan@google.com>
4277
4278         * arm.cc (Target_arm::do_relax): Record an output section for section
4279         offset adjustment it contains any stub table that has changed.
4280         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4281         offsets in an output section if necessary.
4282         * output.cc (Output_section::Output_section): Initialize
4283         section_offsets_need_adjustments_.
4284         (Output_section::add_input_section_for_script): Renamed to
4285         Output_section::add_simple_input_section.
4286         (Output_section::save_states): Add a comment.
4287         (Output_section::discard_states): New method defintion.
4288         (Output_section::adjust_section_offsets): Same.
4289         * output.h (Output_section::add_input_section_for_script): Renamed to
4290         Output_section::add_simple_input_section.
4291         (Output_section::discard_states): New method declaration.
4292         (Output_section::adjust_section_offsets): Same.
4293         (Output_section::section_offsets_need_adjustment,
4294         Output_section::set_section_offsets_need_adjustment): New method
4295         definitions.
4296         (Output_section::section_offsets_need_adjustment_): New data member.
4297         * script-sections.cc
4298         (Output_section_element_input::set_section_address): Adjust code for
4299         renaming of Output_section::add_input_section_for_script.
4300         (Orphan_output_section::set_section_address): Same.
4301
4302 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4303
4304         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4305         Fix_v4bx enum values .
4306         * gold/options.h (General_options): New option definitions.
4307         (General_options::fix_v4bx): New method.
4308         (General_options::Fix_v4bx): New enum.
4309         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4310         (General_options::parse_fix_v4bx_interworking): New method.
4311
4312 2010-01-22  Doug Kwan  <dougkwan@google.com>
4313
4314         * arm.cc (Arm_exidx_fixup): New class.
4315
4316 2010-01-21  Doug Kwan  <dougkwan@google.com>
4317
4318         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4319         classes.
4320         (Arm_exidx_section_offset_map): New type.
4321
4322 2010-01-21  Doug Kwan  <dougkwan@google.com>
4323
4324         * arm.cc (Arm_exidx_input_section): New class.
4325         (Arm_relobj::exidx_input_section_by_link,
4326         Arm_relobj::exidx_input_section_by_shndx,
4327         Arm_relobj::make_exidx_input_section): New methods.
4328         (read_arm_attributes_section): Remove.
4329         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4330         information about them.
4331         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4332         to here.
4333
4334 2010-01-20  Doug Kwan  <dougkwan@google.com>
4335
4336         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4337         Input_section_specifier to Section_id.
4338         (Target_arm::new_arm_input_section: Adjust code for change of key
4339         type.
4340         (Target_arm::find_arm_input_section): Ditto.
4341         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4342         (Section_id): Remove.
4343         (Garbage_collection::Section_id_hash): Remove.
4344         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4345         (Section_id): Remove.
4346         (Icf::Section_id_hash): Remove.
4347         * object.h (Section_id, Const_section_id, Section_id_hash,
4348         Const_section_id_hash): New type definitions.
4349         * output.cc (Output_section::add_relaxed_input_section): Change to
4350         use Const_section_id instead of Input_section_specifier as key type.
4351         (Output_section::add_merge_input_section): Ditto.
4352         (Output_section::build_relaxation_map): Change to use Section_id
4353         instead of Input_section_specifier as key type.
4354         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4355         Ditto.
4356         (Output_section::convert_input_sections_to_relaxed_sections): Change
4357         to use Const_section_id instead of Input_section_specifier as key type.
4358         (Output_section::find_merge_section): Ditto.
4359         (Output_section::find_relaxed_input_section): Ditto.
4360         * output.h (Input_section_specifier): Remove class.
4361         (Output_section::Output_section_data_by_input_section_map): Change
4362         key type to Const_section_id.
4363         (Output_section::Output_relaxed_input_section_by_input_section_map):
4364         Ditto.
4365         (Output_section::Relaxation_map): Change key type to Section_id.
4366
4367 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4368
4369         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4370         (class Arm_v4bx_stub): New class.
4371         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4372         (Stub_factory::make_arm_v4bx_stub): New method.
4373         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4374         (Stub_table::empty): Handle v4bx stubs.
4375         (Stub_table::add_arm_v4bx_stub): New method.
4376         (Stub_table::find_arm_v4bx_stub): New method.
4377         (Arm_relocate_functions::v4bx): New method.
4378         (Target_arm::fix_v4bx): New method.
4379         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4380         (Stub_table::relocate_stubs): Likewise.
4381         (Stub_table::do_write): Likewise.
4382         (Stub_table::update_data_size_and_addralign): Likewise.
4383         (Stub_table::finalize_stubs):  Likewise.
4384         (Target_arm::Scan::local): Likewise.
4385         (Target_arm::Scan::global): Likewise.
4386         (Target_arm::do_finalize_sections): Likewise.
4387         (Target_arm::Relocate::relocate): Likewise.
4388         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4389         Likewise.
4390         (Target_arm::scan_reloc_for_stub): Likewise.
4391         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4392
4393 2010-01-19  Ian Lance Taylor  <iant@google.com>
4394
4395         * output.cc (Output_section_headers::do_sized_write): Write large
4396         segment count to sh_info field.
4397         (Output_file_header::do_sized_write): For large segment count,
4398         write PN_XNUM to e_phnum field.
4399
4400 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4401
4402         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4403         (Arm_relocate_functions::thm_jump8): New function.
4404         (Arm_relocate_functions::thm_jump11): New function.
4405         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4406         R_ARM_THM_JUMP11.
4407         (Target_arm::Scan::global): Likewise.
4408         (Target_arm::Relocate::relocate): Likewise.
4409         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4410         Likewise.
4411
4412 2010-01-14  Doug Kwan  <dougkwan@google.com>
4413
4414         * arm.cc (map, utility): Include headers.
4415         (Target_arm::apply_cortex_a8_workaround): New method.
4416         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4417         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4418         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4419         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4420         the --[no-]fix-cortex-a8 command line options.
4421         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4422         (Target_arm::relocate_stub): Use addend in instruction template.
4423         * options.h (DEFINE_bool): Set the user-set flag.
4424         (General_options): Add --[no-]-fix-cortex options.
4425         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4426         : Update fast look-up map after conversion.
4427
4428 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4429
4430         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4431         in the first pass of do_layout.
4432
4433 2010-01-13  Doug Kwan  <dougkwan@google.com>
4434
4435         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4436         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4437         apparent compiler problem of not folding static constant integral
4438         data members of elfcpp::Elf_sizes<32>.
4439
4440 2010-01-13  Doug Kwan  <dougkwan@google.com>
4441
4442         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4443         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4444         Arm_relobj::scan_section_for_cortex_a8_erratum,
4445         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4446         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4447         sections to scan for relocation stubs into a new method
4448         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4449         relocation and Cortex-A8 stub scanning.
4450         (Target_arm::do_relax): Force stubs to be after stubbed sections
4451         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4452         the beginning of a new relaxation pass.  Update a comment.
4453         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4454
4455 2010-01-12  Ian Lance Taylor  <iant@google.com>
4456
4457         * target-reloc.h (visibility_error): New inline function.
4458         (relocate_section): Call visibility_error.
4459         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4460         (MOSTLYCLEANFILES): Likewise.
4461         (protected_4_pic.o, protected_3.err): New targets.
4462         * testsuite/protected_4.cc: New file.
4463
4464 2010-01-12  Doug Kwan  <dougkwan@google.com>
4465
4466         * arm.cc (Cortex_a8_reloc): New class.
4467         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4468         and cortex_a8_relocs_info_.
4469         (Target_arm::fix_cortex_a8): New method definition.
4470         (Target_arm::Cortex_a8_relocs_info): New type.
4471         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4472         New data member declarations.
4473         (Target_arm::scan_reloc_for_stub): Record information about
4474         relocations for THUMB branches that might be exempted from the
4475         Cortex-A8 workaround.
4476         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4477         at the beginning of a relaxation pass.
4478
4479 2010-01-12  Doug Kwan  <dougkwan@google.com>
4480
4481         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4482         (Arm_relobj::Mapping_symbol_position,
4483          Arm_reloj::Mapping_symbol_position_less,
4484          Arm_relobj::Mapping_symbols_info): New types.
4485         (Target_arm::is_mapping_symbol_name): New method definition.
4486         (Arm_relobj::do_count_local_symbols): Save information about mapping
4487         symbols.
4488
4489 2010-01-11  Doug Kwan  <dougkwan@google.com>
4490
4491         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4492         Arm_relocate_functions::thumb32_branch_upper,
4493         Arm_relocate_functions::thumb32_branch_lower,
4494         Arm_relocate_functions::thumb32_cond_branch_offset,
4495         Arm_relocate_functions::thumb32_cond_branch_upper,
4496         Arm_relocate_functions::thumb32_cond_branch_lower,
4497         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4498         branch offset encoding.
4499         (Arm_relocate_functions::thumb_branch_common): Use new branch
4500         offset encoding methods to avoid code duplication.
4501         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4502         (Stub_addend_reader::operator()): Use new branch encoding method
4503         to avoid code duplication.
4504
4505 2010-01-11  Doug Kwan  <dougkwan@google.com>
4506
4507         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4508         (Target_arm::do_finalize_sections): Define special EXIDX section
4509         symbols only if referenced.
4510         * gc.h (Garbage_collection::add_reference): New method.
4511         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4512         code duplication.
4513
4514 2010-01-11  Ian Lance Taylor  <iant@google.com>
4515
4516         * script.cc (Version_script_info::build_expression_list_lookup):
4517         Change complaing about duplicate wildcard match from error to
4518         warning.
4519
4520         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4521         of 2009-12-30.
4522         (Version_script_info::Version_script_info): Initialize globs_,
4523         default_version_, default_is_global_, and exact_.  Don't
4524         initialize globals_ or locals_.
4525         (Version_script_info::build_lookup_tables): Build local symbols
4526         first.
4527         (Version_script_info::unquote): New function.
4528         (Version_script_info::add_exact_match): New function.
4529         (Version_script_info::build_expression_list_lookup): Remove lookup
4530         parameter.  Add is_global parameter.  Change all callers.  Handle
4531         wildcard pattern specially.  Unquote pattern.  Call
4532         add_exact_match.
4533         (Version_script_info::get_name_to_match): New function.
4534         (Version_script_info::get_symbol_version): New function.
4535         (Version_script_info::get_symbol_version_helper): Remove.
4536         (Version_script_info::check_unmatched_names): Call unquote.
4537         * script.h (class Version_script_info): Change get_symbol_version
4538         to be non-inline and add is_global parameter; change all callers.
4539         Rewrite symbol_is_local.  Update declarations.  Define struct
4540         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4541         Remove globals_ and locals_ members.  Add exact_, globs_,
4542         default_version_, is_global_.
4543         (Version_script_info::Glob): Remove pattern, add expression and
4544         is_global.  Update constructor.  Change all callers.
4545         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4546         default version.
4547         (Versions::symbol_section_contents): If a symbol is undefined, or
4548         defined in a dynamic object, set the version index to
4549         VER_NDX_LOCAL.
4550         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4551         symbol_is_local.
4552         (Symbol_table::add_from_pluginobj): Likewise.
4553         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4554
4555 2010-01-11  Doug Kwan  <dougkwan@google.com>
4556
4557         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4558         (incremental_dump_LDADD): Add linking option for libintl.
4559         * Makefile.in: Regenerate.
4560
4561 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4562
4563         PR gold/11144
4564         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4565         instead of -Ds.
4566         * testsuite/Makefile.in: Regenerated.
4567
4568 2010-01-10  Doug Kwan  <dougkwan@google.com>
4569
4570         * options.h (DEFINE_var): Use parentheses around argument varname__
4571         in macro body to avoid any unintended subsequent substitutions.
4572
4573 2010-01-10  Ian Lance Taylor  <iant@google.com>
4574
4575         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4576         candidates before doing symbol resolution.
4577
4578         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4579         ODR candidates if only one is weak.
4580
4581 2010-01-08  Ian Lance Taylor  <iant@google.com>
4582
4583         * script.cc (Version_script_info::build_expression_list_lookup):
4584         Don't warn about ambiguous version, just record the ambiguity.
4585         (Version_script_info::get_symbol_version_helper): Give error if
4586         version is ambiguous.
4587
4588 2010-01-08  Doug Kwan  <dougkwan@google.com>
4589
4590         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4591           prev_data_size_ and prev_addralign_.  Remove initializer for
4592           deleted data member has_been_changed_.
4593           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4594           to determine if the table is empty.
4595           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4596           Remove.
4597           (Stub_table::add_reloc_stub): Define method in class definition
4598           instead of just declaring it there.
4599           (Stub_table::add_cortex_a8_stub): New method definition.
4600           (Stub_table::update_data_size_and_addralign): Ditto.
4601           (Stub_table::finalize_stubs): Ditto.
4602           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4603           (Stub_table::do_addralign_): Return address alignment in the
4604           (Stub_table::do_reset_address_and_file_offset): Define method in
4605           class definition instead of declaring it there.  Set current data
4606           size to be the data size of the previous pass.
4607           (Stub_table::set_final_data_size): Use current data size as the
4608           final data size.
4609           (Stub_table::relocate_stub): Change parameter type of stub from
4610           Reloc_stub pointer to Stub pointer.
4611           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4612           (Stub_table::Cortex_a8_stub_list): New typedef.
4613           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4614            Stub_table::prev_addralign_): New data member.
4615           (Arm_relobj::Arm_relobj): Initialize data member
4616           section_has_cortex_a8_workaround_.
4617           (Arm_relobj::section_has_cortex_a8_workaround,
4618            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4619            definitions.
4620           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4621           declarations.
4622           (Target_arm::relocate_stub): Change parameter type of stub from
4623           Reloc_stub pointer to Stub pointer.
4624           (Insn_template::size, Insn_template::alignment): Handle
4625           THUMB16_SPECIAL_TYPE.
4626           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4627            Stub_table::update_data_size_and_addralign,
4628            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4629           definitions.
4630           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4631           (Stub_table::do_write): Ditto.
4632           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4633
4634 2010-01-08  Ian Lance Taylor  <iant@google.com>
4635
4636         PR 11108
4637         * symtab.h (class Symbol): Remove fields is_target_special_ and
4638         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4639         (Symbol::is_defined_in_discarded_section): New function.
4640         (Symbol::set_is_defined_in_discarded_section): New function.
4641         (Symbol::has_plt_offset): Rewrite.
4642         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4643         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4644         Don't initialize is_target_special_ or has_plt_offset_.
4645         Initialize is_defined_in_discarded_section_.
4646         (Symbol_table::add_from_relobj): If appropriate, set
4647         is_defined_in_discarded_section.
4648         * resolve.cc (Symbol::override_base_with_special): Don't test
4649         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4650         * target-reloc.h (relocate_section): Do special handling for
4651         symbols defined in discarded sections for global symbols as well
4652         as local symbols.
4653
4654 2010-01-08  Ian Lance Taylor  <iant@google.com>
4655
4656         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4657         the SHT_SYMTAB case.
4658
4659 2010-01-08  Ian Lance Taylor  <iant@google.com>
4660
4661         * object.cc (Sized_relobj::do_layout): Don't get confused if
4662         layout_eh_frame returns NULL.
4663
4664 2010-01-08  Ian Lance Taylor  <iant@google.com>
4665
4666         PR 11084
4667         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4668         dynamic symbol table, use the normal symbol table.
4669         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4670         symbol table.
4671
4672 2010-01-08  Ian Lance Taylor  <iant@google.com>
4673
4674         PR 11072
4675         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4676         sections.
4677
4678 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4679
4680         * version.cc (print_version): Change to "Copyright 2010".
4681
4682 2010-01-08  Ian Lance Taylor  <iant@google.com>
4683
4684         PR 10287
4685         PR 11063
4686         * i386.cc (class Target_i386): Change return type of plt_section
4687         to be non-const.
4688         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4689         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4690         tls_desc_rel_ field.
4691         (Output_data_plt_i386::rel_tls_desc): New function.
4692         (Target_i386::rel_tls_desc_section): New function.
4693         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4694         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4695         R_386_TLS_DESC reloc in rel_tls_desc_section.
4696         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4697         Define struct Tlsdesc_info.
4698         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4699         (Target_x86_64::do_reloc_symbol_index): New function.
4700         (Target_x86_64::add_tlsdesc_info): New function.
4701         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4702         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4703         tlsdesc_rel_ field.
4704         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
4705         all callers.
4706         (Output_data_plt_x86_64::rela_tlsdesc): New function.
4707         (Target_x86_64::rela_tlsdesc_section): New function.
4708         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4709         handling.
4710         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4711         (Target_x86_64::do_reloc_addend): New function.
4712         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4713         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4714         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
4715         (Output_reloc::type): New function.
4716         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4717         (Output_reloc::is_target_specific): New function.
4718         (Output_reloc::target_arg): New function.
4719         (class Output_reloc) [SHT_RELA]: Add four new constructors for
4720         absolute relocs and target specific relocs.
4721         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4722         add_target_specific.
4723         (class Output_data_reloc) [SHT_RELA]: Likewise.
4724         * output.cc (Output_reloc::Output_reloc): Add four new versions
4725         for absolute relocs and target specific relocs.
4726         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4727         (Output_reloc::get_symbol_index): Likewise.
4728         (Output_reloc::local_section_offset): Check that local_sym_index_
4729         is not TARGET_CODE or 0.
4730         (Output_reloc::symbol_value): Likewise.
4731         (Output_reloc::write) [SHT_RELA]: Call target for target specific
4732         reloc.
4733         * target.h (class Target): Add reloc_symbol_index and reloc_addend
4734         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
4735         functions.
4736         * layout.cc (add_target_dynamic_tags): Use output section for
4737         DT_PLTRELSZ and DT_JMPREL.
4738
4739 2010-01-07  Ian Lance Taylor  <iant@google.com>
4740
4741         PR 11061
4742         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4743         function.
4744         (class Output_data_reloc_generic): Define.
4745         (class Output_data_reloc_base): Change base class to
4746         Output_data_reloc_generic.  Change add() method to call
4747         bump_relative_reloc_count for a relative reloc.  Remove
4748         sort_relocs_ field.
4749         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4750         to sort_relocs().
4751         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4752         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
4753         appropriate.
4754         * layout.h (class Layout): Update declaration.
4755
4756 2010-01-07  Ian Lance Taylor  <iant@google.com>
4757
4758         * output.h (class Output_data): Add const version of
4759         output_section and do_output_section.
4760         (class Output_section_data): Add const version of
4761         do_output_section.
4762         (class Output_section): Likewise.
4763         * layout.cc (Layout::add_target_dynamic_tags): New function.
4764         * layout.h (class Layout): Update declarations.
4765         * arm.cc (Target_arm::do_finalize_sections): Use
4766         add_target_dynamic_tags.
4767         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4768         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4769         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4770         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4771
4772 2010-01-07  Ian Lance Taylor  <iant@google.com>
4773
4774         PR 11042
4775         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4776         object as needed.
4777
4778 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
4779             Ian Lance Taylor  <iant@google.com>
4780
4781         PR 11019
4782         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4783         Xindex::read_symtab_xindex.
4784
4785 2010-01-07  Doug Kwan  <dougkwan@google.com>
4786
4787         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4788         (Insn_template::thumb16_bcond_insn): New method declaration.
4789         (Insn_template): Fix spelling.
4790         (Stub::thumb16_special): New method declaration.
4791         (Stub::do_write): Define virtual method which was previously pure
4792         virtual.
4793         (Stub::do_thumb16_special): New method declaration.
4794         (Stub::do_fixed_endian_write): New template member.
4795         (Reloc_stub::do_write): Remove.
4796         (Reloc_stub::do_fixed_endian_write): Remove.
4797         (Cortex_a8_stub): New class definition.
4798         (Stub_factory::make_cortex_a8_stub): New method definition.
4799         (Stub_factory::Stub_factory): Add missing static storage class
4800         qualifier for elf32_arm_stub_a8_veneer_blx.
4801
4802 2010-01-07  Ian Lance Taylor  <iant@google.com>
4803
4804         PR 10980
4805         * options.h (class General_options): Add --warn-unresolved-symbols
4806         and --error-unresolved-symbols.
4807         * errors.cc (Errors::undefined_symbol): Implement
4808         --warn-unresolved-symbols.
4809
4810         * options.h (class General_options): Add -z text and -z textoff.
4811         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4812
4813 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
4814
4815         * gc.h (Garbage_collection::Cident_section_map): New typedef.
4816         (Garbage_collection::cident_sections): New function.
4817         (Garbage_collection::add_cident_section): New function.
4818         (Garbage_collection::cident_sections_): New member.
4819         (gc_process_relocs): Add references to sections whose names are C
4820         identifiers.
4821         * gold.h (cident_section_start_prefix): New constant.
4822         (cident_section_stop_prefix): New constant.
4823         (is_cident): New function.
4824         * layout.cc (Layout::define_section_symbols): Replace string constants
4825         with the newly defined constants.
4826         * object.cc (Sized_relobj::do_layout): Track sections whose names are
4827         C identifiers.
4828         * testsuite/Makefile.am: Add gc_orphan_section_test.
4829         * testsuite/Makefile.in: Regenerate.
4830         * testsuite/gc_orphan_section_test.cc: New file.
4831         * testsuite/gc_orphan_section_test.sh: New file.
4832
4833 2010-01-06  Ian Lance Taylor  <iant@google.com>
4834
4835         PR 10980
4836         * options.h (class General_options): Add --warn-shared-textrel.
4837         * layout.cc (Layout::finish_dynamic_section): Implement
4838         --warn-shared-textrel.
4839
4840         PR 10980
4841         * options.h (class General_options): Add --warn-multiple-gp.
4842
4843 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4844
4845         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4846         $(THREADSLIB) and $(LIBDL).
4847         * Makefile.in: Rebuild.
4848
4849 2010-01-06  Ian Lance Taylor  <iant@google.com>
4850
4851         PR 10980
4852         * options.cc (General_options::parse_section_start): New function.
4853         (General_options::section_start): New function.
4854         (General_options::General_options): Initialize all members.
4855         * options.h: Include <map>
4856         (class General_options): Add --section-start.  Add section_starts_
4857         member.
4858         * layout.cc (Layout::attach_allocated_section_to_segment): If
4859         --section-start was used, set the address of the segment.  Remove
4860         local sort_sections.
4861         (Layout::relaxation_loop_body): If the address of the load segment
4862         has been set by --section-start, don't use it.
4863         * output.h (Output_segment::update_flags_for_output_section): New
4864         function.
4865         * output.cc (Output_segment::add_output_section): Call
4866         update_flags_for_output_section.
4867
4868 2010-01-05  Ian Lance Taylor  <iant@google.com>
4869
4870         PR 10980
4871         * options.h (class General_options): Add --undefined-version.
4872         * script.cc (struct Version_expression): Add was_matched_by_symbol
4873         field.
4874         (Version_script_info::matched_symbol): New function.
4875         (Version_script_info::get_symbol_version_helper): Call
4876         matched_symbol.
4877         (Version_script_info::check_unmatched_names): New function.
4878         * script.h (class Version_script_info): Update declarations.
4879         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4880
4881         * options.h (class General_options): Use DEFINE_bool_alias for
4882         allow_multiple_definition.
4883         * resolve.cc (Symbol_table::should_override): Don't test
4884         allow_multiple_definition.
4885
4886         PR 10980
4887         * options.h (class General_options): Add --cref.
4888         * main.cc (main): Print cref table if --cref.  Don't close mapfile
4889         until after printing cref table.
4890         * cref.cc: Include "symtab.h".
4891         (class Cref_inputs): Define Cref_table_compare and Cref_table.
4892         (Cref_table_compare::operator()): New function.
4893         (Cref_inputs::gather_cref): New function.
4894         (filecol): New static const.
4895         (Cref_inputs::print_cref): New function.
4896         (Cref::print_cref): New function.
4897         * cref.h: Include <cstdio>.
4898         (class Cref): Update declarations.
4899         * mapfile.h (Mapfile::file): New function.
4900         * object.h (class Object): Define Symbols.  Declare virtual
4901         do_get_global_symbols.
4902         (Object::get_global_symbols): New function.
4903         * object.cc (Input_objects::add_object): Pass object to cref_ if
4904         --cref.
4905         (Input_objects::archive_start): Likewise.
4906         (Input_objects::archive_stop): Likewise.
4907         (Input_objects::print_cref): New function.
4908         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4909         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4910         --cref.
4911         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4912         function.
4913         * plugin.h (class Sized_pluginobj): Update declarations.
4914
4915 2010-01-05  Ian Lance Taylor  <iant@google.com>
4916
4917         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4918         to is_default_version.  Rename insdef to insdefault.
4919         (Symbol_table::add_from_relobj): Rename def to is_default_version
4920         and local to is_forced_local.
4921         (Symbol_table::add_from_pluginobj): Likewise.
4922         (Symbol_table::add_from_dynobj): Likewise.
4923         (Symbol_table::define_special_symbol): Rename insdef to
4924         insdefault.
4925
4926 2010-01-04  Ian Lance Taylor  <iant@google.com>
4927
4928         PR 10980
4929         * options.h (class General_options): Add
4930         --allow-multiple-definition and -z muldefs.
4931         * resolve.cc (Symbol_table::should_override): Don't warn about a
4932         multiple symbol definition if --allow-multiple-definition or -z
4933         muldefs.
4934
4935         PR 10980
4936         * options.h (class General_options): Add --add-needed and
4937         --copy-dt-needed-entries.  Tweak --as-needed help entry.
4938         * object.cc (Input_objects::check_dynamic_dependencies): Give an
4939         error if --copy-dt-needed-entries aka --add-needed is used and
4940         would cause a change in behaviour.
4941
4942         PR 10980
4943         * options.h (class General_options): Add -G as a short version of
4944         --shared.  Add no-op options -assert, -g, and -i.
4945
4946 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
4947
4948         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4949         check for .text or .gnu.linkonce.t sections.
4950         * icf.cc (Icf::find_identical_sections): Ditto.
4951         Change the detection for mangled function name within the section
4952         name.
4953         * icf.h (is_section_foldable_candidate): New function.
4954
4955 2009-12-30  Ian Lance Taylor  <iant@google.com>
4956
4957         PR 10980
4958         * options.h (class General_options): Permit two dashes with
4959         --retain-symbols-file.
4960
4961 2009-12-30  Ian Lance Taylor  <iant@google.com>
4962
4963         PR 10979
4964         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4965         don't put the file header and segment headers in the text
4966         segment.
4967
4968         PR 10979
4969         * common.cc (Sort_commons::operator()): Stabilize sort when both
4970         entries are NULL.
4971         (Symbol_table::do_allocate_commons_list): When allocating common
4972         symbols, skip a symbol which is no longer common.
4973         * symtab.h (Symbol::is_common): Test whether the symbol comes from
4974         an object before checking its type.
4975         * testsuite/common_test_2.c: New file.
4976         * testsuite/common_test_3.c: New file.
4977         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4978         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4979         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4980         (common_test_2_pic.o, common_test_2.so): New targets.
4981         (common_test_3_pic.o, common_test_3.so): New targets.
4982         * testsuite/Makefile.in: Rebuild.
4983
4984         PR 10979
4985         * script.cc (read_input_script): If we see a new SECTIONS clause,
4986         and we have added an input section, give an error.
4987         * layout.h (class Layout): Add have_added_input_section function.
4988         Add have_added_input_section_ field.
4989         * layout.cc (Layout::Layout): Initialize
4990         have_added_input_section_.
4991         (Layout::layout): Set have_added_input_section_.
4992         (Layout::layout_eh_frame): Likewise.
4993
4994 2009-12-30  Ian Lance Taylor  <iant@google.com>
4995
4996         PR 10931
4997         * options.h (class General_options): Add --sort-common option.
4998         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4999         * common.cc (Sort_common): Add sort_order parameter to
5000         constructor.  Add sort_order_ field.
5001         (Sort_commons::operator): Check sort_order_.
5002         (Symbol_table::allocate_commons): Determine the sort order.
5003         (Symbol_table::do_allocate_commons): Add sort_order parameter.
5004         Change all callers.
5005         (Symbol_table::do_allocate_commons_list): Likewise.
5006
5007 2009-12-30  Ian Lance Taylor  <iant@google.com>
5008
5009         PR 10916
5010         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5011         symbols from this object, don't change the visibility of an
5012         undefined symbol.
5013         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5014
5015 2009-12-30  Ian Lance Taylor  <iant@google.com>
5016
5017         PR 10861
5018         * script.h (class Version_script_info): Define Language enum.
5019         Update declarations.  Define Glob, Exact, and Lookup types.  Add
5020         new fields globals_, locals_, and is_finalized_.
5021         * script.cc: Various formatting fixes.
5022         (class Parser_closure): Change language_stack_ from a vector of
5023         std::string to one of Version_script_info::Language.  Adjust all
5024         uses accordingly.
5025         (class Lazy_demangler): Remove.
5026         (struct Version_expression): Change language from std::string to
5027         Version_script_info::Language.
5028         (Version_script_info::Version_script_info): New function.
5029         (Version_script_info::~Version_script_info): Don't call clear.
5030         (Version_script_info::finalize): New function.
5031         (Version_script_info::build_lookup_tables): New function.
5032         (Version_script_info::build_expression_list_lookup): New
5033         function.
5034         (Version_script_info::get_symbol_version_helper): Rewrite to use
5035         lookup tables.
5036         (Version_script_info::print_expression_list): Adjust to use
5037         Version_script_info::Language.
5038         (script_push_lex_into_version_mode): Check that the version script
5039         has not been finalized.
5040         (version_script_push_lang): Change language string to
5041         Version_script_info::Language.
5042         * options.cc (Command_line::version_script): New function.
5043         * options.h (class General_options): Add finalize_dynamic_list
5044         function.  Change version_script from declaration to definition.
5045         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5046         * testsuite/version_script.map: Remove duplicate def of foo.
5047         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5048         version_script.map.
5049         * testsuite/Makefile.in: Rebuild.
5050
5051 2009-12-30  Ian Lance Taylor  <iant@google.com>
5052
5053         PR 10843
5054         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5055         if the input symbol index is 0, make the output symbol index 0.
5056
5057 2009-12-30  Ian Lance Taylor  <iant@google.com>
5058
5059         PR 10670
5060         * options.h (class General_options): Add -x/--discard-all.
5061         * object.cc (Sized_relobj::do_count_local_symbols): Handle
5062         --discard-all.  If the local symbol needs a dynamic entry, check
5063         that before handling --discard-locals.
5064
5065 2009-12-30  Ian Lance Taylor  <iant@google.com>
5066
5067         PR 10450
5068         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5069         flags to PF_R.
5070         (Output_segment::add_output_section): Don't change the flags if
5071         the type is PT_TLS.
5072
5073         PR 10450
5074         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5075         GNU hash table if they need a dynamic value.  Otherwise, don't add
5076         them if they are defined in a dynamic object or are forced local.
5077
5078 2009-12-29  Ian Lance Taylor  <iant@google.com>
5079
5080         PR 10450
5081         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5082         .gnu.hash table for a 32-bit target.
5083
5084         PR 10450
5085         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5086         regular and a dynamic object only needs a dynamic symbol table
5087         entry if it is externally visible.
5088
5089         PR 10450
5090         * i386.cc (class Target_i386): Initialize global_offset_table_ in
5091         constructor.  Add global_offset_table_ field.
5092         (Target_i386::got_section): Set global_offset_table_.
5093         (Target_i386::do_finalize_sections): Set global_offset_table_
5094         size.
5095         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5096         in constructor.  Add global_offset_table_ field.
5097         (Target_x86_64::got_section): Set global_offset_table_.
5098         (Target_x86_64::do_finalize_sections): Set global_offset_table_
5099         size.
5100
5101         * layout.cc (Layout::Layout): Initialize increase_relro_.
5102         (Layout::get_output_section): Add is_relro, is_last_relro, and
5103         is_first_non_relro parameters.  Change all callers.
5104         (Layout::choose_output_section): Likewise.
5105         (Layout::add_output_section_data): Likewise.
5106         (Layout::make_output_section): Likewise.
5107         (Layout::set_segment_offsets): Clear increase_relro when using a
5108         linker script.
5109         * layout.h (class Layout): Add increase_relro method.  Add
5110         increase_relro_ field.  Update declarations.
5111         * output.cc (Output_section::Output_section): Initialize
5112         is_last_relro_ and is_first_non_relro_.
5113         (Output_segment::add_output_section): Group relro sections is
5114         do_sort is true.  Handle is_last_relro and is_first_non_relro.
5115         (Output_segment::maximum_alignment): Remove relro handling.
5116         (Output_segment::set_section_addresses): Add increase_relro
5117         parameter.  Change all callers.  Add initial alignment to align
5118         relro sections on separate page.  Remove old relro handling.
5119         (Output_segment::set_section_list_addresses): Remove in_relro
5120         parameter.  Change all callers.
5121         (Output_segment::set_offset): Add increase parameter.  Change all
5122         callers.  Remove old relro handling.
5123         * output.h (class Output_section): Add new methods: is_last_relro,
5124         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5125         Add is_last_relro_ and is_first_non_relro_ fields.
5126         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5127         Create separate .got.plt section.  Call increase_relro.
5128         * x86_64.cc (Target_x86_64::got_section): Likewise.
5129         * testsuite/relro_script_test.t: Add .got.plt.
5130
5131         PR 10450
5132         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5133         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5134         (Layout::finalize): Call set_dynamic_symbol_size.
5135         (Layout::set_dynamic_symbol_size): New function.
5136         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
5137         set_dynamic_symbol_size.
5138
5139         PR 10450
5140         * output.h (class Output_section): Add is_entsize_zero_ field.
5141         * output.cc (Output_section::Output_section): Initialize
5142         is_entsize_zero_.
5143         (Output_section::set_entsize): If two different entsizes are
5144         requested, force it to zero.
5145         (Output_section::add_input_section): Set flags for .debug_str
5146         before updating section flags.  Set entsize.
5147         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5148         and SHF_STRING if all input sections have those flags.
5149
5150 2009-12-29   Rafael Espindola  <espindola@google.com>
5151
5152         * main.cc (main): Fix the sys time reporting.
5153         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5154         reporting.
5155
5156 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5157
5158         * options.cc (General_options::parse_version): Allow -v to exit
5159         without an error if there is nothing to link.
5160
5161 2009-12-29  Ian Lance Taylor  <iant@google.com>
5162
5163         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5164         using a version of gcc before 4.1.
5165         * configure: Rebuild.
5166
5167 2009-12-28  Chris Demetriou  <cgd@google.com>
5168
5169         * attributes.cc (Output_attributes_section_data::do_write): Use
5170         std::vector::front rather than std::vector::data.
5171
5172 2009-12-28  Ian Lance Taylor  <iant@google.com>
5173
5174         * symtab.h (class Symbol_table): Add enum Defined.
5175         * resolve.cc (Symbol_table::should_override): Add defined
5176         parameter.  Change all callers.  Test whether object is NULL
5177         before calling a method on it.
5178         (Symbol_table::report_resolve_problem): Add defined parameter.
5179         Change all callers.
5180         (Symbol_table::should_override_with_special): Likewise.
5181         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5182         parameter.  Change all callers.
5183         (Symbol_table::do_define_in_output_data): Likewise.
5184         (Symbol_table::define_in_output_segment): Likewise.
5185         (Symbol_table::do_define_in_output_segment): Likewise.
5186         (Symbol_table::define_as_constant): Likewise.
5187         (Symbol_table::do_define_as_constant): Likewise.
5188         * script.h (class Symbol_assignment): Add is_defsym parameter to
5189         constructor; change all callers.
5190         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5191         parameter.  Change all callers.  Add is_defsym_ field.
5192         (class Parser_closure): Add parsing_defsym parameter to
5193         constructor; change all callers.  Add parsing_defsym accessor
5194         function.  Add parsing_defsym_ field.
5195
5196 2009-12-28  Ian Lance Taylor  <iant@google.com>
5197
5198         * gold.cc (queue_middle_tasks): Fix formatting.
5199         * object.cc (Relobj::is_section_name_included): Likewise.
5200
5201 2009-12-23  Ian Lance Taylor  <iant@google.com>
5202
5203         * i386.cc (Target_i386::do_calls_non_split): Recognize
5204         -fsplit-stack prologue for a function with a static chain.
5205         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5206         -fsplit-stack prologue when using %r11.
5207
5208 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5209
5210         * options.cc (General_options::parse_version): Make -v continue and do
5211         the link like GNU ld does.
5212
5213 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5214
5215         * Makefile.am (CCFILES): Add timer.cc.
5216         (HFILES): Add timer.h.
5217         * configure.ac: Check for sysconf and times.
5218         * main.cc: include timer.h.
5219         (main): Use Timer instead of get_run_time.
5220         * timer.cc: New.
5221         * timer.h: New.
5222         * workqueue.cc: include timer.h.
5223         (Workqueue::find_and_run_task):
5224         Report user, sys and wall time.
5225         * Makefile.in: Regenerate.
5226         * config.in: Regenerate.
5227         * configure: Regenerate.
5228
5229 2009-12-16  Doug Kwan  <dougkwan@google.com>
5230
5231         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5232         sections.
5233         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5234         relaxed input sections.
5235         * output.cc (Output_section::find_relaxed_input_section): Change
5236         return type to Output_relaxed_input_section pointer.  Adjust code
5237         for new type of relaxed_input_section_map_.
5238         * output.h (Output_section::find_relaxed_input_section): Change
5239         return type to Output_relaxed_input_section pointer.
5240         (Output_section::Output_relaxed_input_section_by_input_section_map):
5241         New type.
5242         (Output_section::relaxed_input_section_map_): Change type to
5243         Output_section::Output_relaxed_input_section_by_input_section_map.
5244         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5245         input section.
5246
5247 2009-12-15  Ian Lance Taylor  <iant@google.com>
5248
5249         * layout.cc (Layout::create_shstrtab): Only write out after input
5250         sections if we are compressing debug sections.
5251
5252 2009-12-15  Ian Lance Taylor  <iant@google.com>
5253
5254         * archive.cc (Archive::add_symbols): Only look up a symbol without
5255         a version if there is, in fact, a version.
5256
5257 2009-12-14  Ian Lance Taylor  <iant@google.com>
5258
5259         Revert -Wshadow changes, all changes from:
5260         2009-12-11  Doug Kwan  <dougkwan@google.com>
5261         2009-12-11  Nick Clifton  <nickc@redhat.com>
5262         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5263
5264 2009-12-11  Doug Kwan  <dougkwan@google.com>
5265
5266         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5267         due to -Wshadow.
5268         * attributes.cc (Object_attribute::size): Ditto.
5269         (Attributes_section_data::size): Ditto.
5270         (Attributes_section_data::Attributes_section_data): Ditto.
5271         (Output_attributes_section_data::do_write): Ditto.
5272         * attributes.h (Object_attribute::set_type): Ditto.
5273         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5274
5275 2009-12-11  Nick Clifton  <nickc@redhat.com>
5276
5277         * archive.cc: Fix shadowed variable warnings.
5278         * arm.cc: Likewise.
5279         * compressed_output.cc: Likewise.
5280         * compressed_output.h: Likewise.
5281         * configure: Likewise.
5282         * dwarf_reader.cc: Likewise.
5283         * dynobj.cc: Likewise.
5284         * dynobj.h: Likewise.
5285         * ehframe.cc: Likewise.
5286         * ehframe.h: Likewise.
5287         * errors.cc: Likewise.
5288         * expression.cc: Likewise.
5289         * fileread.cc: Likewise.
5290         * fileread.h: Likewise.
5291         * freebsd.h: Likewise.
5292         * i386.cc: Likewise.
5293         * icf.cc: Likewise.
5294         * incremental.h: Likewise.
5295         * layout.cc: Likewise.
5296         * layout.h: Likewise.
5297         * mapfile.cc: Likewise.
5298         * merge.cc: Likewise.
5299         * merge.h: Likewise.
5300         * object.cc: Likewise.
5301         * object.h: Likewise.
5302         * options.h: Likewise.
5303         * output.cc: Likewise.
5304         * output.h: Likewise.
5305         * parameters.cc: Likewise.
5306         * plugin.cc: Likewise.
5307         * powerpc.cc: Likewise.
5308         * reduced_debug_output.cc: Likewise.
5309         * reduced_debug_output.h: Likewise.
5310         * reloc.cc: Likewise.
5311         * reloc.h: Likewise.
5312         * resolve.cc: Likewise.
5313         * script-sections.cc: Likewise.
5314         * script.cc: Likewise.
5315         * script.h: Likewise.
5316         * sparc.cc: Likewise.
5317         * symtab.cc: Likewise.
5318         * symtab.h: Likewise.
5319         * target-select.cc: Likewise.
5320         * target-select.h: Likewise.
5321         * token.h: Likewise.
5322         * workqueue.cc: Likewise.
5323         * workqueue.h: Likewise.
5324         * x86_64.cc: Likewise.
5325
5326 2009-12-10  Doug Kwan  <dougkwan@google.com>
5327
5328         * arm.cc (attributes.h): New include.
5329         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5330         (Arm_relobj::~Arm_relobj): Delete object pointed by
5331         attributes_section_data_.
5332         (Arm_relobj::attributes_section_data): New method definition.
5333         (Arm_relobj::attributes_section_data_): New data member declaration.
5334         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5335         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5336         attributes_section_data_.
5337         (Arm_dynobj::attributes_section_data): New method definition.
5338         (Arm_dynobj::attributes_section_data_): New data member declaration.
5339         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5340         initialization value of may_use_blx_ to false.
5341         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5342         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5343         object attributes to compute results instead of hard-coding.
5344         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5345         Target_arm::get_secondary_compatible_arch,
5346         Target_arm::set_secondary_compatible_arch
5347         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5348         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5349         New method declarations.
5350         (Target_arm::get_aeabi_object_attribute): New method definition.
5351         (Target_arm::attributes_section_data_): New data member declaration.
5352         (read_arm_attributes_section): New template definition.
5353         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5354         (Arm_dynobj::do_read_symbols): Ditto.
5355         (Target_arm::do_finalize_sections): Merge attributes sections from
5356         input.  Check for BLX use after attributes section merging.
5357         Fix __exidx_start and __exidx_end visibility.  Create an
5358         .ARM.attributes section if necessary.
5359         (Target_arm::get_secondary_compatible_arch,
5360         Target_arm::set_secondary_compatible_arch,
5361         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5362         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5363         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5364         New method definitions.
5365
5366 2009-12-09  Ian Lance Taylor  <iant@google.com>
5367
5368         * plugin.cc (Plugin::load): Don't cast from void* to a function
5369         pointer.
5370
5371 2009-12-09  Ian Lance Taylor  <iant@google.com>
5372
5373         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5374         information fields.
5375
5376 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5377
5378         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5379         Replace two_file_shared_1.so with two_file_shared_2.so.
5380         * testsuite/Makefile.in: Regenerated.
5381
5382 2009-12-08  Doug Kwan  <dougkwan@google.com>
5383
5384         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5385         (HFILES): Add attributes.h and int_encoding.h.
5386         * Makefile.in: Regenerate.
5387         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5388         function definitions to int_encoding.cc
5389         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5390         prototypes to int_encoding.h
5391         * reduced_debug_output.cc (int_encoding.h): New include.
5392         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5393         function definitions to int_encoding.cc
5394         (insert_into_vector, read_from_pointer): Move template definitions to
5395         int_encoding.h
5396         * attributes.cc: New file.
5397         * attributes.h: New file.
5398         * int_encoding.cc: New file.
5399         * int_encoding.h: New file.
5400
5401 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5402
5403         PR gold/11055
5404         * incremental-dump.cc (dump_incremental_inputs): New.
5405         (main): Use dump_incremental_inputs.
5406
5407 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5408
5409         PR gold/10893
5410         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5411         checking elfcpp::STT_FUNC.
5412         (Target_i386::Relocate::relocate): Likewise.
5413         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5414
5415         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5416         symbols from shared libraries into normal FUNC symbols.
5417
5418         * symtab.h (Symbol): Add is_func and use it.
5419
5420 2009-12-05  Doug Kwan  <dougkwan@google.com>
5421
5422         * arm.cc (Target_arm::arm_info): Initialize new fields
5423         attributes_section and attributes_vendor.
5424         * i386.cc (Target_i386::i386_info): Same.
5425         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5426         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5427         fields attributes_section and attributes_vendor.
5428         * sparc.cc (Target_sparc::sparc_info): Same.
5429         * target.h (Target::attributes_section, Target::attributes_vendor,
5430         Target::is_attributes_section, Target::attribute_arg_type,
5431         Target::attributes_order): New method definitions.
5432         (Target::Target_info::attributes_section,
5433         Target::Target_info::attributes_vendor): New fields.
5434         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5435         virtual method definitions.
5436         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5437         attributes_section and attributes_vendor.
5438         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5439
5440 2009-12-05  Doug Kwan  <dougkwan@google.com>
5441
5442         * arm.cc: Update comments about interworking and stub generation.
5443         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5444         considered as non-PIC.
5445         (Arm_relocate_functions::base_abs): Fix formatting.
5446         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5447         of function to use GOT entry address instead of offset.
5448         (Target_arm::Scan::global): Issue an error if a symbol would need a
5449         PLT does not get one because it is untyped.  Remove code to create
5450         dynamic symbols for relative branches.
5451         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5452         takes unsigned integer instead of boolean.
5453
5454 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5455
5456         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5457         (two_file_test_LDADD): Likewise.
5458         (common_test_1_LDADD): Likewise.
5459         (exception_test_LDADD) Likewise.
5460         (weak_test_LDADD): Likewise.
5461         (many_sections_test_LDADD): Likewise.
5462         (initpri1_LDADD): Likewise.
5463         (script_test_1_LDADD): Likewise.
5464         (script_test_2_LDADD): Likewise.
5465         (justsyms_LDADD): Likewise.
5466         (binary_test_LDADD): Likewise.
5467         (large_LDADD): Likewise.
5468         * testsuite/Makefile.in: Regenerated.
5469
5470 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5471
5472         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5473         (Symbol_table::override_with_special): Likewise.
5474         (Symbol_table::add_from_object): Likewise.
5475
5476 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5477
5478         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5479         Don't set the data_offset twice.
5480
5481 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5482
5483         * testsuite/Makefile.in: Regenerate.
5484
5485 2009-12-03  Doug Kwan  <dougkwan@google.com>
5486
5487         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5488         (Target_arm::do_finalize_sections): Add parameter for symbol table
5489         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5490         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5491         parameter for symbol table pointer.
5492         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5493         an additional parameter for a pointer to symbol table.
5494         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5495         parameter for a symbol table pointer.
5496         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5497         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5498         Ditto.
5499         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5500         parameter for a symbol table pointer.
5501
5502 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5503
5504         * incremental.cc (Incremental_inputs_header)
5505         (Incremental_inputs_header_write, Incremental_inputs_entry)
5506         (Incremental_inputs_entry_write): Move ...
5507         * incremental.h (Incremental_inputs_header)
5508         (Incremental_inputs_header_write, Incremental_inputs_entry)
5509         (Incremental_inputs_entry_write): here.
5510
5511 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5512
5513         * incremental.cc (make_sized_incremental_binary): Set the target.
5514         Error if it is incompatible.
5515         * output.h (Output_file): Add filename method.
5516
5517 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5518
5519         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5520         from the get_* methods.
5521
5522 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5523
5524         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5525         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5526         Write 0 for the data_offset of scripts.
5527
5528 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5529
5530         * testsuite/Makefile.am: Add the incremental_test.sh test.
5531         * testsuite/incremental_test.sh: New.
5532         * testsuite/incremental_test_1.c: New.
5533         * testsuite/incremental_test_2.c: New.
5534
5535 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5536
5537        * incremental-dump.cc (main): Fix typos.
5538
5539 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5540
5541         PR gold/11025
5542         * incremental-dump.cc (main): Use llu to print 64 bit values.
5543
5544 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5545             H.J. Lu  <hongjiu.lu@intel.com>
5546
5547         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5548         $(LIBDL).
5549         (incremental_dump_LDADD): Likewise.
5550         * Makefile.in: Regenerated.
5551
5552 2009-11-25  Doug Kwan  <dougkwan@google.com>
5553
5554         Revert:
5555
5556         2009-11-25  Doug Kwan  <dougkwan@google.com>
5557
5558                 * arm.cc (Target_arm::Target_arm): Move method definition
5559                 outside of class definition.  Add code to handle
5560                 --target1-rel, --target1-abs and --target2= options.
5561                 (Target_arm::get_reloc_reloc_type): Change method to be
5562                 non-static and const.
5563                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5564                 New data member declaration.
5565                 (Target_arm::Scan::local, Target_arm::Scan::global,
5566                 Target_arm::Relocate::relocate,
5567                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5568                 Adjust call to Target_arm::get_real_reloc_type.
5569                 (Target_arm::get_real_reloc_type): Use command line options
5570                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5571                 * options.h (--target1-rel, --target1-abs, --target2): New
5572                 ARM-only options.
5573
5574 2009-11-25  Doug Kwan  <dougkwan@google.com>
5575
5576         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5577         class definition.  Add code to handle --target1-rel, --target1-abs
5578         and --target2= options.
5579         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5580         and const.
5581         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5582         member declaration.
5583         (Target_arm::Scan::local, Target_arm::Scan::global,
5584         Target_arm::Relocate::relocate,
5585         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5586         call to Target_arm::get_real_reloc_type.
5587         (Target_arm::get_real_reloc_type): Use command line options to
5588         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5589         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5590         options.
5591
5592 2009-11-25  Doug Kwan  <dougkwan@google.com>
5593
5594         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5595         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5596         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5597         formatting.
5598         (Arm_relocate_functions::thm_call): Replace body with a call to
5599         Arm_relocate_functions::thumb_branch_common.
5600         (Arm_relocate_functions::thm_jump24,
5601         Arm_relocate_functions::thm_xpc22): New method definitions.
5602         (Arm_relocate_functions::thumb_branch_common): New method definition.
5603         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5604         operator.
5605         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5606         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5607
5608 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5609
5610         * Makefile.am: Build incremental-dump
5611         * Makefile.in: Regenerate.
5612         * incremental-dump.cc: New.
5613         * incremental.cc (Incremental_inputs_header_data,
5614         Incremental_inputs_entry_data): Move to incremental.h
5615         * incremental.h: (Incremental_inputs_header_data,
5616         Incremental_inputs_entry_data): Move from incremental.cc
5617
5618 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5619
5620         * incremental.cc (Incremental_inputs_header,
5621         Incremental_inputs_header_write, Incremental_inputs_entry,
5622         Incremental_inputs_entry_write): Add a typedef with the data type.
5623
5624 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5625
5626         * incremental.cc (Incremental_inputs_header,
5627         Incremental_inputs_header_write, Incremental_inputs_entry,
5628         Incremental_inputs_entry_write): Update comment about which
5629         type has the filed descriptions.
5630
5631 2009-11-15  Doug Kwan  <dougkwan@google.com>
5632
5633         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5634         (Arm_relocate_functions::arm_branch_common): Change method defintion
5635         in class definition to a method declaration and update list of formal
5636         parameters.
5637         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5638         Arm_relocation_functions::jump24): Adjust call to
5639         Arm_relocate_functions::arm_branch_common.  Update list of formal
5640         parameters.
5641         (Arm_relocate_functions::xpc25): New method definition.
5642         (Arm_relocate_functions::arm_branch_common): Move method defintion
5643         out from class definition.  Use stubs for mode-switching and extending
5644         branch ranges.
5645         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5646         specially.  Change code to enable use of stubs in ARM branches.
5647
5648 2009-11-10  Doug Kwan  <dougkwan@google.com>
5649
5650         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5651         in method declaration.
5652         (Target_arm::relocate_stub): New method declaration.
5653         (Target_arm::default_target): Change to return a pointer instead of
5654         a const reference.
5655         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5656         Target_arm::default_target.
5657         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5658         method definition.
5659         (Target_arm::relocate_section): Adjust view.
5660         (Target_arm::relocate_stub): New method definition.
5661
5662 2009-11-10  Doug Kwan  <dougkwan@google.com>
5663
5664         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5665         a format warning.
5666         * incremental.cc (open_incremental_binary): Initialized local
5667         variables to avoid warnings.
5668         * object.cc (make_elf_object): Ditto.
5669         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5670         a format warning.
5671
5672 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5673
5674         PR gold/10930
5675         * testsuite/plugin_test.c: Include "config.h".
5676
5677 2009-11-09  Doug Kwan  <dougkwan@google.com>
5678
5679         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5680         (arm_symbol_value): Remove.
5681         (Arm_relocate_functions::arm_branch_common,
5682         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5683         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5684         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5685         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5686         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5687         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5688         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5689         Arm_relocate_functions::thm_mobw_abs_nc,
5690         Arm_relocate_functions::thm_mov_abs,
5691         Arm_relocate_functions::movw_prel_nc,
5692         Arm_relocate_functions::thm_movt_abs,
5693         Arm_relocate_functions::movt_prel,
5694         Arm_relocate_functions::thm_movw_prel_nc,
5695         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5696         (Target_arm::Relocate::relocate): Only decompose address into two
5697         parts if relocation type uses the thumb-bit and pass the actual
5698         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5699         calls to methods in Arm_relocate_functions for this change.
5700
5701 2009-11-08  Ian Lance Taylor  <iant@google.com>
5702
5703         PR 10925
5704         * reloc.cc: Instantiate
5705         Sized_relobj::initialize_input_to_output_maps and
5706         Sized_relobj:free_input_to_output_maps.
5707
5708 2009-11-06  Ian Lance Taylor  <iant@google.com>
5709
5710         PR 10876
5711         * defstd.cc (in_segment): Set only_if_ref true for "end".
5712
5713 2009-11-06  Doug Kwan  <dougkwan@google.com>
5714
5715         * arm.cc (class Reloc_stub): Correct a comment.
5716         (Target_arm::Target_arm): Initialize arm_input_section_map_.
5717         (Target_arm::scan_section_for_stubs): New method declaration.
5718         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5719         Change methods from private to protected.
5720         (Target_arm::do_may_relax): New method definition.
5721         (Target_arm::do_relax, Target_arm::group_sections,
5722         Target_arm::scan_reloc_for_stub,
5723         Target_arm::scan_reloc_section_for_stubs): New method declarations.
5724         (Target_arm::arm_input_section_map_): New data member declaration.
5725         (Target_arm::scan_reloc_for_stub,
5726         Target_arm::scan_reloc_section_for_stubs,
5727         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5728         Target_arm::do_relax): New method definitions.
5729
5730 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
5731
5732         * configure.ac: Check for (struct stat)::st_mtim
5733         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5734         * config.in: Regenerate.
5735         * configure: Regenerate.
5736
5737 2009-11-05  Ian Lance Taylor  <iant@google.com>
5738
5739         PR 10910
5740         * output.cc (Output_segment::add_output_section): Add missing
5741         return statement.
5742
5743 2009-11-04  Ian Lance Taylor  <iant@google.com>
5744
5745         PR 10880
5746         * object.h (class Object): Add is_needed and set_is_needed
5747         methods.  Add is_needed_ field.  Make bool fields into bitfields.
5748         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5749         defined in a dynamic object and referenced by a regular object,
5750         set is_needed for the dynamic object.
5751         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5752         if the file is marked with as_needed and it is not needed.
5753
5754 2009-11-04  Ian Lance Taylor  <iant@google.com>
5755
5756         PR 10887
5757         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5758         tags if data is discarded by linker script.
5759         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5760         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5761         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5762         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5763
5764 2009-11-04  Ian Lance Taylor  <iant@google.com>
5765
5766         * layout.cc (Layout::get_output_section): Add is_interp and
5767         is_dynamic_linker_section parameters.  Change all callers.
5768         (Layout::choose_output_section): Likewise.
5769         (Layout::make_output_section): Likewise.
5770         (Layout::add_output_section_data): Add is_dynamic_linker_section
5771         parameter.  Change all callers.
5772         * layout.h (class Layout): Update declarations.
5773         * output.h (class Output_section): Add is_interp, set_is_interp,
5774         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5775         Add is_interp_, is_dynamic_linker_section_ fields.  Change
5776         generate_code_fills_at_write_ to a bitfield.
5777         * output.cc (Output_section::Output_sections): Initialize new
5778         fields.
5779         (Output_segment::add_output_section): Add do_sort parameter.
5780         Change all callers.
5781
5782 2009-11-03  Ian Lance Taylor  <iant@google.com>
5783
5784         PR 10860
5785         * options.h (class General_options): Add --warn-common.
5786         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5787         merging two common symbols.
5788         (Symbol_table::should_override): Handle --warn-common when merging
5789         a common symbol with a defined symbol.  Use report_resolve_problem
5790         for multiple definitions.
5791         (Symbol_table::report_resolve_problem): New function.
5792         * symtab.h (class Symbol_table): Declare report_resolve_problem.
5793
5794 2009-11-03  Doug Kwan  <dougkwan@google.com>
5795
5796         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5797         stub_factory_.
5798         (Target_arm::stub_factory): New method definition.
5799         (Target_arm::new_arm_input_section,
5800         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5801         Target_arm::reloc_uses_thumb_bit): New method declarations.
5802         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5803         New type definitions.
5804         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5805         member declarations.
5806         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5807         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5808         New method definitions.
5809
5810 2009-11-03  Ian Lance Taylor  <iant@google.com>
5811
5812         * options.h (class General_options): Add --warn_constructors.
5813
5814 2009-11-03  Ian Lance Taylor  <iant@google.com>
5815
5816         PR 10893
5817         * defstd.cc (in_section): Add entries for __rel_iplt_start,
5818         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5819
5820 2009-11-03  Ian Lance Taylor  <iant@google.com>
5821
5822         PR 10895
5823         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5824         --msgid-bugs-address.
5825         (install-pdf): New target.
5826         (install-data_yes): Look up one directory to find mkinstalldirs.
5827
5828 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
5829
5830         * po/Make-in (.po.gmo): Don't generate .gmo files in source
5831         tree.
5832
5833 2009-10-30  Doug Kwan  <dougkwan@google.com>
5834
5835         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5836
5837 2009-10-30  Doug Kwan  <dougkwan@google.com>
5838
5839         * arm.cc (Stub_addend_reader): New struct template definition
5840         and partial specializations.
5841         (Stub_addend_reader::operator()): New method definition for a
5842         partially specialized template.
5843
5844 2009-10-30  Doug Kwan  <dougkwan@google.com>
5845
5846         * arm.cc (Arm_relobj::processor_specific_flags): New method
5847         definition.
5848         (Arm_relobj::do_read_symbols): New method declaration.
5849         (Arm_relobj::processor_specific_flags_): New data member declaration.
5850         (Arm_dynobj): New class definition.
5851         (Target_arm::do_finalize_sections): Add input_objects parameter.
5852         (Target_arm::do_adjust_elf_header): New method declaration.
5853         (Target_arm::are_eabi_versions_compatible,
5854         (Target_arm::merge_processor_specific_flags): New method declaration.
5855         (Target_arm::do_make_elf_object): New overloaded method definitions
5856         and declaration.
5857         (Arm_relobj::do_read_symbols): New method definition.
5858         (Arm_dynobj::do_read_symbols): Ditto.
5859         (Target_arm::do_finalize_sections): Add input_objects parameters.
5860         Merge processor-specific flags from all input objects.
5861         (Target_arm::are_eabi_versions_compatible,
5862         Target_arm::merge_processor_specific_flags,
5863         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5864         New method definitions.
5865         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5866         Input_objects pointer type parameter.
5867         * layout.cc (Layout::finalize): Pass input objects to target's.
5868         finalize_sections function.
5869         * output.cc (Output_file_header::do_sized_write): Set ELF file
5870         header's processor-specific flags.
5871         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5872         Input_objects pointer type parameter.
5873         * sparc.cc (Target_sparc::do_finalize_sections): Same.
5874         * target.h (Input_objects): New forward class declaration.
5875         (Target::processor_specific_flags,
5876         Target::are_processor_specific_flags_sect): New method definitions.
5877         (Target::finalize_sections): Add input_objects parameter.
5878         (Target::Target): Initialize processor_specific_flags_ and
5879         are_processor_specific_flags_set_.
5880         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5881         parameter.
5882         (Target::set_processor_specific_flags): New method definition.
5883         (Target::processor_specific_flags_,
5884         Target::are_processor_specific_flags_set_): New data member
5885         declarations.
5886         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5887         Input_objects pointer type parameter.
5888
5889 2009-10-30  Doug Kwan  <dougkwan@google.com>
5890
5891         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5892
5893 2009-10-28  Ian Lance Taylor  <iant@google.com>
5894
5895         * object.h (class Relobj): Drop options parameter from
5896         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5897         do_scan_relocs, do_relocate.  Change all callers.
5898         (class Sized_relobj): Drop options parameters from
5899         do_gc_process_relocs, do_scan_relocs, do_relocate,
5900         do_relocate_sections, relocate_sections, emit_relocs_scan,
5901         emit_relocs_scan_reltype.  Change all callers.
5902         (struct Relocate_info): Remove options field and all references to
5903         it.
5904         * reloc.h (class Read_relocs): Remove options constructor
5905         parameter and options_ field.  Change all callers.
5906         (class Gc_process_relocs, class Scan_relocs): Likewise.
5907         (class Relocate_task): Likewise.
5908         * target-reloc.h (scan_relocs): Remove options parameter.  Change
5909         all callers.
5910         (scan_relocatable_relocs): Likewise.
5911         * target.h (class Sized_target): Remove options parameter from
5912         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
5913         all callers.
5914         * gc.h (gc_process_relocs): Remove options parameter.  Change all
5915         callers.
5916         * arm.cc: Update functions to remove options parameters.
5917         * i386.cc: Likewise.
5918         * powerpc.cc: Likewise.
5919         * sparc.cc: Likewise.
5920         * x86_64.cc: Likewise.
5921         * testsuite/testfile.cc: Likewise.
5922
5923 2009-10-28  Doug Kwan  <dougkwan@google.com>
5924
5925         * arm.cc (Arm_relobj): New class definition.
5926         (Arm_relobj::scan_sections_for_stubs,
5927         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5928         New method definitions.
5929
5930 2009-10-28  Cary Coutant  <ccoutant@google.com>
5931
5932         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5933         (Plugin::cleanup_done_): New member.
5934         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5935         (Plugin_manager::cleanup_done_): Remove.
5936         (Plugin_manager::add_input_file): Edit error message.
5937         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5938         (Plugin_manager::cleanup): Remove use of cleanup_done_.
5939
5940 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
5941
5942         * fileread.cc: (File_read::View::~View): Use the new
5943         data_ownership_ filed.
5944         (File_read::~File_read): Dispose the new whole_file_view_.
5945         (File_read::open): Mmap the whole file if needed.
5946         (File_read::open): Use whole_file_view_ instead of contents_.
5947         (File_read::find_view): Use whole_file_view_ if applicable.
5948         (File_read::do_read): Use whole_file_view_ instead of contents_.
5949         (File_read::make_view): Use whole_file_view_ instead of contents_,
5950         update File_read::View::View call.
5951         (File_read::find_or_make_view): Update File_read::View::View
5952         call.
5953         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5954         remove contents_
5955         (File_read::View::Data_ownership): New enum.
5956         (File_read::View::View): Replace bool mapped_ with Data_ownership
5957         argument.
5958         (File_read::View::mapped_): Remove (replaced by data_ownership_).
5959         (File_read::View::data_ownership_): New field.
5960         (File_read::contents_): Remove (replaced by whole_file_view_).
5961         (File_read::whole_file_view_): New field.
5962         * options.h (class General_options): Add --keep-files-mapped.
5963
5964 2009-10-27  Cary Coutant  <ccoutant@google.com>
5965
5966         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5967         * testsuite/Makefile.am (plugin_test_5): New test case.
5968         * testsuite/Makefile.in: Regenerate.
5969
5970 2009-10-25  Doug Kwan  <dougkwan@google.com>
5971
5972         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5973         from private to protected to allow access by child class.
5974         (Sized_relobj::do_relocate_sections): New method declaration.
5975         (Sized_relobj::relocate_sections): Virtualize.
5976         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5977         Sized_relobj::relocate_sections.  Instantiate template explicitly
5978         for different target sizes and endianity.
5979
5980 2009-10-24  Doug Kwan  <dougkwan@google.com>
5981
5982         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5983         (Arm_input_section::as_arm_input_section): New method.
5984         (Arm_output_section): New class definition.
5985         (Arm_output_section::create_stub_group,
5986         Arm_output_section::group_sections): New method definitions.
5987
5988 2009-10-22  Doug Kwan  <dougkwan@google.com>
5989
5990         * arm.cc (Arm_input_section): New class definition.
5991         (Arm_input_section::init, Arm_input_section:do_write,
5992         Arm_input_section::set_final_data_size,
5993         Arm_input_section::do_reset_address_and_file_offset): New method
5994         definitions.
5995
5996 2009-10-21  Doug Kwan  <dougkwan@google.com>
5997
5998         * arm.cc (Stub_table, Arm_input_section): New forward class
5999         declarations.
6000         (Stub_table): New class defintion.
6001         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6002         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6003         New method definition.
6004
6005 2009-10-21  Doug Kwan  <dougkwan@google.com>
6006
6007         * arm.cc: Update copyright comments.
6008         (Target_arm): New forward class template declaration.
6009         (Arm_address): New type.
6010         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6011         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6012         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6013         constants.
6014         (Insn_template): Same.
6015         (DEF_STUBS): New macro.
6016         (Stub_type): New enum type.
6017         (Stub_template): New class definition.
6018         (Stub): Same.
6019         (Reloc_stub): Same.
6020         (Stub_factory): Same.
6021         (Target_arm::Target_arm): Initialize may_use_blx_ and
6022         should_force_pic_veneer_.
6023         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6024         Target_arm::should_force_pic_veneer,
6025         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6026         Target_arm::using_thumb_only, Target_arm:;default_target): New
6027         method defintions.
6028         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6029         New data member declarations.
6030         (Insn_template::size, Insn_template::alignment): New method defintions.
6031         (Stub_template::Stub_template): New method definition.
6032         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6033         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6034         (Stub_factory::Stub_factory): New method definition.
6035         * gold.h (string_hash): New template.
6036         * output.h (Input_section_specifier::hash_value): Use
6037         gold::string_hash.
6038         (Input_section_specifier::string_hash): Remove.
6039         * stringpool.cc (Stringpool_template::string_hash): Use
6040         gold::string_hash.
6041
6042 2009-10-20  Doug Kwan  <dougkwan@google.com>
6043
6044         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6045         symbols of relaxed input sections.
6046         * output.h (Output_section::find_relaxed_input_section): Make
6047         method public.
6048
6049 2009-10-16  Doug Kwan  <dougkwan@google.com>
6050
6051         * dynobj.cc (Versions::Versions): Initialize version_script_.
6052         Only insert base version symbol definition for a shared object
6053         if version script defines any version versions.
6054         (Versions::define_base_version): New method definition.
6055         (Versions::add_def): Check that base version is not needed.
6056         (Versions::add_need): Define base version lazily.
6057         * dynobj.h (Versions::define_base_version): New method declaration.
6058         (Versions::needs_base_version_): New data member declaration.
6059         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6060         (check_DATA): Add no_version_test.stdout.
6061         (libno_version_test.so, no_version_test.o no_version_test.stdout):
6062         New make rules.
6063         * testsuite/Makefile.in: Regenerate.
6064         * testsuite/no_version_test.c: New file.
6065         * testsuite/no_version_test.sh: Ditto.
6066
6067 2009-10-16  Doug Kwan  <dougkwan@google.com>
6068
6069         * expression.cc (class Segment_start_expression): New class definition.
6070         (Segment_start_expression::value): New method definition.
6071         (script_exp_function_segment_start): Return a new
6072         Segment_start_expression.
6073         * gold/script-c.h (script_saw_segment_start_expression): New function
6074         prototype.
6075         * script-sections.cc (Script_sections::Script_sections): Initialize
6076         SAW_SEGMENT_START_EXPRESSION_ to false.
6077         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6078         and -Tbbs options to specify section addresses if given in
6079         command line and no SEGMENT_START expression is seen in a script.
6080         * script-sections.h (Script_sections::saw_segment_start_expression,
6081         Script_sections::set_saw_segment_start_expression): New method
6082         definition.
6083         (Script_sections::saw_segment_start_expression_): New data member
6084         declaration.
6085         * script.cc (script_saw_segment_start_expression): New function.
6086         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6087         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6088         script_test_7.sh and script_test_8.sh.
6089         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6090         script_test_8.stdout.
6091         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6092         (script_test_6, script_test_6.stdout, script_test_7,
6093         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6094         * Makefile.in: Regenerate.
6095         * testsuite/script_test_6.sh: New file.
6096         * testsuite/script_test_6.t: Same.
6097         * testsuite/script_test_7.sh: Same.
6098         * testsuite/script_test_7.t: Same.
6099         * testsuite/script_test_8.sh: Same.
6100
6101 2009-10-16  Doug Kwan  <dougkwan@google.com>
6102
6103         * output.cc (Output_segment::set_section_list_address): Cast
6104         expressions to unsigned long long type to avoid format warnings.
6105
6106 2009-10-15  Ian Lance Taylor  <iant@google.com>
6107
6108         * script.cc (Script_options::add_symbol_assignment): Always add a
6109         dot assignment to script_sections_.
6110         * script-sections.cc (Script_sections::add_dot_assignment):
6111         Initialize if necessary.
6112
6113         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6114         program headers with no load segment if there is a linker script.
6115
6116         * layout.cc (Layout::set_segment_offsets): Align the file offset
6117         to the segment aligment for -N or -n with no load segment.
6118         * output.cc (Output_segment::add_output_section): Don't crash if
6119         the first section is a TLS section.
6120         (Output_segment::set_section_list_addresses): Print an error
6121         message if the address moves backward in a linker script.
6122         * script-sections.cc
6123         (Output_section_element_input::set_section_addresses): Don't
6124         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6125         (Orphan_output_section::set_section_addresses): Likewise.
6126
6127 2009-10-15  Doug Kwan  <dougkwan@google.com>
6128
6129         * layout.cc (Layout::finish_dynamic_section): Generate tags
6130         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6131         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6132         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6133
6134 2009-10-14  Ian Lance Taylor  <iant@google.com>
6135
6136         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6137         fields.
6138         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6139         data_shdr fields of relinfo.
6140         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6141         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
6142         R_386_TLS_LDO_32, adjust based on section flags.
6143         (Target_i386::Relocate::fix_up_ldo): Remove.
6144
6145 2009-10-13  Ian Lance Taylor  <iant@google.com>
6146
6147         Add support for -pie.
6148         * options.h (class General_options): Add -pie and
6149         --pic-executable.
6150         (General_options::output_is_position_independent): Test -pie.
6151         (General_options::output_is_executable): Return true if not shared
6152         and not relocatable.
6153         (General_options::output_is_pie): Remove.
6154         * options.cc (General_options::finalize): Reject incompatible uses
6155         of -pie.
6156         * gold.cc (queue_middle_tasks): A -pie link is not static.
6157         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6158         * symtab.cc (Symbol::final_value_is_known): Return false if
6159         output_is_position_independent.
6160         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6161         output_is_position_independent.
6162         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6163         output_is_position_independent.
6164         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6165         output_is_position_independent.
6166         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6167         two_file_pie_test.
6168         (basic_pie_test.o, basic_pie_test): New targets.
6169         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6170         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6171         (two_file_pie_test): New target.
6172         * testsuite/Makefile.in: Rebuild.
6173         * README: Remove note saying that -pie is not supported.
6174
6175 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6176
6177         * options.h (class General_options): Add -init and -fini.
6178         * layout.cc (Layout::finish_dynamic_section): Emit
6179         given init and fini functions.
6180
6181 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6182
6183         * gc.h (gc_process_relocs): Check if icf is enabled using new
6184         function.
6185         * gold.cc (queue_initial_tasks): Likewise.
6186         (queue_middle_tasks): Likewise.
6187         * object.cc (do_layout): Likewise.
6188         * symtab.cc (is_section_folded): Likewise.
6189         * main.cc (main): Likewise.
6190         * reloc.cc (Read_relocs::run): Likewise.
6191         (Sized_relobj::do_scan_relocs): Likewise.
6192         * icf.cc (is_function_ctor_or_dtor): New function.
6193         (Icf::find_identical_sections): Check if function is ctor or dtor when
6194         safe icf is chosen.
6195         * options.h (General_options::icf): Change option to be an enum.
6196         (Icf_status): New enum.
6197         (icf_enabled): New method.
6198         (icf_safe_folding): New method.
6199         (set_icf_status): New method.
6200         (icf_status_): New variable.
6201         * (options.cc) (General_options::finalize): Set icf_status_.
6202         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6203         icf_test and icf_keep_unique_test to use the --icf enum flag.
6204         * testsuite/icf_safe_test.sh: New file.
6205         * testsuite/icf_safe_test.cc: New file.
6206
6207 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6208
6209         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6210         includes to gc.h and icf.h.
6211         * arm.cc: Include gc.h.
6212         * gold.cc: Likewise.
6213         * i386.cc: Likewise.
6214         * powerpc.cc: Likewise.
6215         * sparc.cc: Likewise.
6216         * x86_64.cc: Likewise.
6217         * gc.h: Include icf.h.
6218
6219 2009-10-11  Ian Lance Taylor  <iant@google.com>
6220
6221         * plugin.cc: Include "gold.h" before other header files.
6222
6223 2009-10-10  Chris Demetriou  <cgd@google.com>
6224
6225         * options.h (Input_file_argument::Input_file_type): New enum.
6226         (Input_file_argument::is_lib_): Replace with...
6227         (Input_file_argument::type_): New member.
6228         (Input_file_argument::Input_file_argument): Take Input_file_type
6229         'type' rather than boolean 'is_lib' as second argument.
6230         (Input_file_argument::is_lib): Use type_.
6231         (Input_file_argument::is_searched_file): New function.
6232         (Input_file_argument::may_need_search): Handle is_searched_file.
6233         * options.cc (General_options::parse_library): Support -l:filename.
6234         (General_options::parse_just_symbols): Update for Input_file_argument
6235         changes.
6236         (Command_line::process): Likewise.
6237         * archive.cc (Archive::get_file_and_offset): Likewise.
6238         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6239         * script.cc (read_script_file, script_add_file): Likewise.
6240         * fileread.cc (Input_file::Input_file): Likewise.
6241         (Input_file::will_search_for): Handle is_searched_file.
6242         (Input_file::open): Likewise.
6243         * readsyms.cc (Read_symbols::get_name): Likewise.
6244         * testsuite/Makefile.am (searched_file_test): New test.
6245         * testsuite/Makefile.in: Regenerate.
6246         * testsuite/searched_file_test.cc: New file.
6247         * testsuite/searched_file_test_lib.cc: New file.
6248
6249 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6250             Ian Lance Taylor  <iant@google.com>
6251
6252         * descriptor.cc: Include <cstdio> and "binary-io.h".
6253         (Descriptors::open): Open the files in binary mode always.
6254         * script.cc (Lex::get_token): Treat \r as whitespace.
6255
6256 2009-10-09  Ian Lance Taylor  <iant@google.com>
6257
6258         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6259
6260 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6261             Ian Lance Taylor  <iant@google.com>
6262
6263         * configure.ac: Check for readv function also.
6264         * fileread.cc (readv): Define if not HAVE_READV.
6265         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6266         does not exist.
6267         * config.in: Regenerate.
6268         * configure: Regenerate.
6269
6270 2009-10-09  Doug Kwan  <dougkwan@google.com>
6271
6272         * layout.cc (Layout::make_output_section): Call target hook to make
6273         ordinary output section.
6274         (Layout::finalize): Adjust parameter list of call the
6275         Target::may_relax().
6276         * layout.h (class Layout::section_list): New method.
6277         * merge.h (Output_merge_base::entsize): Change visibility to public.
6278         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6279         New methods.
6280         (Output_merge_string::do_is_string): New method.
6281         * object.cc (Sized_relobj::do_setup): renamed from
6282         Sized_relobj::set_up.
6283         * object.h (Sized_relobj::adjust_shndx,
6284         Sized_relobj::initializ_input_to_output_maps,
6285         Sized_relobj::free_input_to_output_maps): Change visibilities to
6286         protected.
6287         (Sized_relobj::setup): Virtualize.
6288         (Sized_relobj::do_setup): New method declaration.
6289         (Sized_relobj::invalidate_section_offset,
6290         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6291         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6292         * options.cc (parse_int): New function.
6293         * options.h (parse_int): New declaration.
6294         (DEFINE_int): New macro.
6295         (stub_group_size): New option.
6296         * output.cc (Output_section::Output_section): Initialize memebers
6297         merge_section_map_, merge_section_by_properties_map_,
6298         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6299         (Output_section::add_input_section): Handled deferred code-fill
6300         generation and remove an old comment.
6301         (Output_section::add_relaxed_input_section): New method definition.
6302         (Output_section::add_merge_input_section): Use merge section by
6303         properties map to speed to search.  Update merge section maps
6304         as appropriate.
6305         (Output_section::build_relaxation_map): New method definition.
6306         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6307         Same.
6308         (Output_section::relax_input_section): Renamed to
6309         Output_section::convert_input_sections_to_relaxed_sections and change
6310         interface to take a vector of pointers to relaxed sections.
6311         (Output_section::find_merge_section,
6312         Output_section::find_relaxed_input_section): New method definitions.
6313         (Output_section::is_input_address_mapped,
6314         Output_section::output_offset, Output_section::output_address):
6315         Use output section data maps to speed up searching.
6316         (Output_section::find_starting_output_address): Add comments.
6317         (Output_section::do_write,
6318         Output_section::write_to_postprocessing_buffer): Do code-fill
6319         generation as appropriate.
6320         (Output_section::get_input_sections): Invalidate relaxed input section
6321         map.
6322         (Output_section::restore_states): Adjust type of checkpoint .
6323         Invalidate relaxed input section map.
6324         * output.h (Output_merge_base): New class declaration.
6325         (Input_section_specifier): New class defintion.
6326         (class Output_relaxed_input_section) Change base class to
6327         Output_section_data_build.
6328         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6329         base class initializer.
6330         (Output_section::add_relaxed_input_section): New method declaration.
6331         (Output_section::Input_section): Change visibility to protected.
6332         (Output_section::Input_section::relobj,
6333         Output_section::Input_section::shndx): Handle relaxed input sections.
6334         Output_section::input_sections) Change visibility to protected.  Also
6335         define overload to return a non-const pointer.
6336         (Output_section::Merge_section_properties): New class defintion.
6337         (Output_section::Merge_section_by_properties_map,
6338         Output_section::Output_section_data_by_input_section_map,
6339         Output_section::Relaxation_map): New types.
6340         (Output_section::relax_input_section): Rename method to
6341         Output_section::convert_input_sections_to_relaxed_sections and change
6342         interface to take a vector of relaxed section pointers.
6343         (Output_section::find_merge_section,
6344         Output_section::find_relaxed_input_section,
6345         Output_section::build_relaxation_map,
6346         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6347         New method declarations.
6348         (Output_section::merge_section_map_
6349         Output_section::merge_section_by_properties_map_,
6350         Output_section::relaxed_input_section_map_,
6351         Output_section::is_relaxed_input_section_map_valid_,
6352         Output_section::generate_code_fills_at_write_): New data members.
6353         * script-sections.cc
6354         (Output_section_element_input::set_section_addresses): Call
6355         current_data_size and addralign methods of relaxed input sections.
6356         (Orphan_output_section::set_section_addresses): Call current_data_size
6357         and addralign methods of relaxed input sections.
6358         * symtab.cc (Symbol_table::compute_final_value): Extract template
6359         from the body of Symbol_table::sized_finalize_symbol.
6360         (Symbol_table::sized_finalized_symbol): Call
6361         Symbol_table::compute_final_value.
6362         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6363         (Symbol_table::compute_final_value): New templated method declaration.
6364         * target.cc (Target::do_make_output_section): New method defintion.
6365         * target.h (Target::make_output_section): New method declaration.
6366         (Target::relax): Add more parameters for input objects, symbol table
6367         and layout.  Adjust call to do_relax.
6368         (Target::do_make_output_section): New method declaration.
6369         (Target::do_relax): Add parameters for input objects, symbol table
6370         and layout.
6371
6372 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6373
6374         * pread.c: Include stdio.h.
6375
6376 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6377
6378         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6379         defined.
6380
6381 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6382
6383         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6384         Change read_shndx type to unsigned int.
6385         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6386         int.
6387         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6388         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6389         Change read_shndx type to unsigned int.
6390         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6391         int.
6392         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6393         * layout.cc (Layout::create_symtab_sections): Cast the result of
6394         local_symcount * symsize to off_t in the gold_assert.
6395
6396 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6397
6398         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6399         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6400         R_ARM_BASE_ABS.
6401         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6402         (Arm_relocate_functions::thm_abs5): New function.
6403         (Arm_relocate_functions::abs12): New function.
6404         (Arm_relocate_functions::abs16): New function.
6405         (Arm_relocate_functions::base_abs): New function.
6406         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6407         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6408         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6409         R_ARM_BASE_ABS.
6410         (Scan::global): Likewise.
6411         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6412         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6413         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6414         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6415         R_ARM_BASE_ABS.
6416
6417 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6418
6419         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6420         (Arm_relocate_functions::movt_prel): New function.
6421         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6422         (Arm_relocate_functions::thm_movt_prel): New function.
6423         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6424         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6425         (Scan::global, Relocate::relocate): Likewise.
6426         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6427
6428 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6429
6430         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6431         Incremental_checker.
6432         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6433         unsigned int.
6434         (class Incremental_inputs_header): New class.
6435         (Incremental_inputs_header_writer): Edit comment.
6436         (Incremental_inputs_entry): New class.
6437         (Incremental_inputs_entry_writer): Edit comment.
6438         (Sized_incremental_binary::do_find_incremental_inputs_section):
6439         Add *strtab_shndx parameter, fill it.
6440         (Sized_incremental_binary::do_check_inputs): New method.
6441         (Incremental_checker::can_incrementally_link_output_file): Use
6442         Sized_incremental_binary::check_inputs.
6443         (Incremental_inputs::report_command_line): Save command line in
6444         command_line_.
6445         * incremental.h:
6446         (Incremental_binary::find_incremental_inputs_section): New
6447         method.
6448         (Incremental_binary::do_find_incremental_inputs_section): Add
6449         strtab_shndx parameter.
6450         (Incremental_binary::do_check_inputs): New pure virtual method.
6451         (Sized_incremental_binary::do_check_inputs): Declare.
6452         (Incremental_checker::Incremental_checker): Add incremental_inputs
6453         parameter, use it to initialize incremental_inputs_.
6454         (Incremental_checker::incremental_inputs_): New field.
6455         (Incremental_checker::command_line): New method.
6456         (Incremental_checker::inputs): New method.
6457         (Incremental_checker::command_line_): New field.
6458
6459 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6460
6461         * incremental.cc: Include <cstdarg> and "target-select.h".
6462         (vexplain_no_incremental): New function.
6463         (explain_no_incremental): New function.
6464         (Incremental_binary::error): New method.
6465         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6466         method.
6467         (make_sized_incremental_binary): New function.
6468         (open_incremental_binary): New function.
6469         (can_incrementally_link_file): Add checks if output is ELF and has
6470         inputs section.
6471         * incremental.h: Include "elfcpp_file.h" and "output.h".
6472         (Incremental_binary): New class.
6473         (Sized_incremental_binary): New class.
6474         (open_incremental_binary): Declare.
6475         * object.cc (is_elf_object): Use
6476         elfcpp::Elf_recognizer::is_elf_file.
6477         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6478         * output.h (Output_file::filesize): New method.
6479
6480 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6481
6482         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6483         New function.
6484         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6485         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6486         function.
6487         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6488         function.
6489         (Arm_relocate_functions::movw_abs_nc): New function.
6490         (Arm_relocate_functions::movt_abs): New function.
6491         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6492         (Arm_relocate_functions::thm_movt_abs): New function.
6493         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6494         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6495         (Scan::global): Likewise.
6496         (Relocate::relocate): Likewise.
6497         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6498
6499 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6500
6501         * arm.cc (Arm_relocate_functions::got_prel) New function.
6502         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6503         (Relocate::relocate): Likewise.
6504         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6505
6506 2009-10-06  Ian Lance Taylor  <iant@google.com>
6507
6508         * options.h (class General_options): Define
6509         split_stack_adjust_size parameter.
6510         * object.h (class Object): Add uses_split_stack_ and
6511         has_no_split_stack_ fields.  Add uses_split_stack and
6512         has_no_split_stack accessor functions.  Declare
6513         handle_split_stack_section.
6514         (class Reloc_symbol_changes): Define.
6515         (class Sized_relobj): Define Function_offsets.  Declare
6516         split_stack_adjust, split_stack_adjust_reltype, and
6517         find_functions.
6518         * object.cc (Object::handle_split_stack_section): New function.
6519         (Sized_relobj::do_layout): Call handle_split_stack_section.
6520         * dynobj.cc (Sized_dynobj::do_layout): Call
6521         handle_split_stack_section.
6522         * reloc.cc (Sized_relobj::relocate_sections): Call
6523         split_stack_adjust for executable sections in split_stack
6524         objects.  Pass reloc_map to relocate_section.
6525         (Sized_relobj::split_stack_adjust): New function.
6526         (Sized_relobj::split_stack_adjust_reltype): New function.
6527         (Sized_relobj::find_functions): New function.
6528         * target-reloc.h: Include "object.h".
6529         (relocate_section): Add reloc_symbol_changes parameter.  Change
6530         all callers.
6531         * target.h (class Target): Add calls_non_split method.  Declare
6532         do_calls_non_split virtual method.  Declare match_view and
6533         set_view_to_nop.
6534         * target.cc: Include "elfcpp.h".
6535         (Target::do_calls_non_split): New function.
6536         (Target::match_view): New function.
6537         (Target::set_view_to_nop): New function.
6538         * gold.cc (queue_middle_tasks): Give an error if mixing
6539         split-stack and non-split-stack objects with -r.
6540         * i386.cc (Target_i386::relocate_section): Add
6541         reloc_symbol_changes parameter.
6542         (Target_i386::do_calls_non_split): New function.
6543         * x86_64.cc (Target_x86_64::relocate_section): Add
6544         reloc_symbol_changes parameter.
6545         (Target_x86_64::do_calls_non_split): New function.
6546         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6547         parameter.
6548         * powerpc.cc (Target_powerpc::relocate_section): Add
6549         reloc_symbol_changes parameter.
6550         * sparc.cc (Target_sparc::relocate_section): Add
6551         reloc_symbol_changes parameter.
6552         * configure.ac: Call AM_CONDITIONAL for the default target.
6553         * configure: Rebuild.
6554         * testsuite/Makefile.am (TEST_AS): New variable.
6555         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6556         (check_DATA): Add split_i386 and split_x86_64 files.
6557         (SPLIT_DEFSYMS): Define.
6558         (split_i386_[1234n].o): New targets.
6559         (split_i386_[124]): New targets.
6560         (split_i386_[1234r].stdout): New targets.
6561         (split_x86_64_[1234n].o): New targets.
6562         (split_x86_64_[124]): New targets.
6563         (split_x86_64_[1234r].stdout): New targets.
6564         (MOSTLYCLEANFILES): Add new executables.
6565         * testsuite/split_i386.sh: New file.
6566         * testsuite/split_x86_64.sh: New file.
6567         * testsuite/split_i386_1.s: New file.
6568         * testsuite/split_i386_2.s: New file.
6569         * testsuite/split_i386_3.s: New file.
6570         * testsuite/split_i386_4.s: New file.
6571         * testsuite/split_i386_n.s: New file.
6572         * testsuite/split_x86_64_1.s: New file.
6573         * testsuite/split_x86_64_2.s: New file.
6574         * testsuite/split_x86_64_3.s: New file.
6575         * testsuite/split_x86_64_4.s: New file.
6576         * testsuite/split_x86_64_n.s: New file.
6577         * testsuite/testfile.cc (Target_test): Update relocation_section
6578         function.
6579         * testsuite/Makefile.in: Rebuild.
6580
6581 2009-10-06  Ian Lance Taylor  <iant@google.com>
6582
6583         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6584         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6585         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6586         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6587         the address on ldo_addrs_.
6588         (Target_i386::Relocate::fix_up_ldo): New function.
6589
6590 2009-10-06   Rafael Espindola  <espindola@google.com>
6591
6592         * plugin.cc (add_input_library): New.
6593         (Plugin::load): Add add_input_library to tv.
6594         (Plugin_manager::add_input_file): Add the is_lib argument.
6595         (add_input_file): Update call to Plugin_manager::add_input_file.
6596         (add_input_library): New.
6597         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6598
6599 2009-09-30  Doug Kwan  <dougkwan@google.com>
6600
6601         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6602         symbol and call Symbol::may_need_copy_reloc to determine if
6603         a copy reloc is needed.
6604         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6605         nocopyreloc is given in command line.
6606         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6607         given in command line.
6608         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6609         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6610         of the removed Target_i386::may_need_copy_reloc.
6611         * options.h (copyreloc): New option with default value false.
6612         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6613         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6614         instead of the removed Target_powerpc::may_need_copy_reloc.
6615         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6616         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6617         instead of the removed Target_sparc::may_need_copy_reloc.
6618         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6619         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6620         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6621         instead of the removed Target_x86_64::may_need_copy_reloc.
6622
6623 2009-09-30  Ian Lance Taylor  <iant@google.com>
6624
6625         * object.h (class Object): Remove target_ field, and target,
6626         sized_target, and set_target methods.
6627         (Object::sized_target): Remove.
6628         (class Sized_relobj): Update declarations.  Remove sized_target.
6629         * object.cc (Sized_relobj::setup): Remove target parameter.
6630         Change all callers.
6631         (Input_objects::add_object): Don't do anything with the target.
6632         (make_elf_sized_object): Add punconfigured parameter.  Change all
6633         callers.  Set or test parameter target.
6634         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6635         Change all callers.
6636         * parameters.cc (Parameters::set_target): Change parameter type to
6637         be non-const.
6638         (Parameters::default_target): Remove.
6639         (set_parameters_target): Change parameter type to be non-const.
6640         (parameters_force_valid_target): New function.
6641         (parameters_clear_target): New function.
6642         * parameters.h (class Parameters): Update declarations.  Remove
6643         default_target method.  Add sized_target and clear_target
6644         methods.  Change target_ to be non-const.
6645         (set_parameters_target): Update declaration.
6646         (parameters_force_valid_target): Declare.
6647         (parameters_clear_target): Declare.
6648         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6649         as NULL if we aren't searching.
6650         (Add_symbols::run): Don't check for compatible target.
6651         * fileread.cc (Input_file::open_binary): Call
6652         parameters_force_valid_target.
6653         * gold.cc (queue_middle_tasks): Likewise.
6654         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6655         set_target on object.
6656         * dynobj.h (class Sized_dynobj): Update declarations.
6657         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6658         make_elf_object returns NULL.
6659         (Archive::include_member): Don't check whether object target is
6660         compatible.
6661         * output.cc (Output_section::add_input_section): Get target from
6662         parameters.
6663         (Output_section::relax_input_section): Likewise.
6664         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6665         parameters.
6666         (Sized_relobj::do_scan_relocs): Likewise.
6667         (Sized_relobj::relocate_sections): Likewise.
6668         * resolve.cc (Symbol_table::resolve): Likewise.
6669         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6670         parameter.  Change all callers.
6671         (Symbol_table::add_from_object): Get target from parameters.
6672         (Symbol_table::add_from_relobj): Don't check object target.
6673         (Symbol_table::add_from_dynobj): Likewise.
6674         (Symbol_table::define_special_symbol): Get target from
6675         parameters.
6676         * symtab.h (class Symbol_table): Update declaration.
6677         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6678         parameter.  Change all callers.  Clear parameter target.
6679         (Binary_test): Test target here.
6680         * testsuite/object_unittest.cc (gold_testsuite): Remove
6681         target_test_pointer parameter.  Change all callers.
6682         (Object_test): Test target here.
6683
6684 2009-09-26  Ian Lance Taylor  <iant@google.com>
6685
6686         * testsuite/initpri1.c: Don't try to use constructor priorities if
6687         compiling with gcc before 4.3.
6688
6689 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6690
6691         * testsuite/retain_symbols_file_test.sh (check_present): Change
6692         output file name to retain_symbols_file_test.stdout.
6693         (check_absent): Likewise.
6694
6695 2009-09-18  Craig Silverstein  <csilvers@google.com>
6696
6697         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6698         * options.cc: Include <cerrno> and <fstream>.
6699         (General_options::finalize): Parse -retain-symbols-file tag.
6700         * options.h: New flag.
6701         (General_options): New method should_retain_symbol, new
6702         variable symbols_to_retain.
6703         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6704         should_retain_symbol map.
6705         * testsuite/Makefile.am (retain_symbols_file_test): New test.
6706         * testsuite/Makefile.in: Regenerate.
6707         * testsuite/retain_symbols_file_test.sh: New file.
6708
6709 2009-09-18  Nick Clifton  <nickc@redhat.com>
6710
6711         * po/es.po: Updated Spanish translation.
6712
6713 2009-09-17  Doug Kwan  <dougkwan@google.com>
6714
6715         * debug.h (DEBUG_RELAXATION): New constant.
6716         (DEBUG_ALL): Add DEBUG_RELAXATION.
6717         (debug_string_to_enum): Add relaxation debug option.
6718         * layout.cc
6719         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6720         Layout::Relaxation_debug_check::read_sections,
6721         Layout::Relaxation_debug_check::read_sections): New method definitions.
6722         (Layout::Layout): Initialize data members
6723         record_output_section_data_from_scrips_,
6724         script_output_section_data_list_ and relaxation_debug_check_.
6725         (Layout::save_segments, Layout::restore_segments,
6726         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6727         Layout::relaxation_loop_body): New method definitions.
6728         (Layout::finalize): Support relaxation.  Move section layout code to
6729         Layout::relaxation_loop_body.
6730         (Layout::set_asection_address_from_script): Move code for orphan
6731         section placement out.
6732         (Layout::place_orphan_sections_in_script): New method definition.
6733         * layout.h (Output_segment_headers, Output_file_header):
6734         New forward class declarations.
6735         (Layout::~Layout): Define.
6736         (Layout::new_output_section_data_from_script): New method definition.
6737         (Layout::place_orphan_sections_in_script): New method declaration.
6738         (Layout::Segment_states): New type declaration.
6739         (Layout::save_segments, Layout::restore_segments,
6740         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6741         Layout::relaxation_loop_body): New method declarations.
6742         (Layout::Output_section_data_list): New type declaration.
6743         (Layout::Relaxation_debug_check): New class definition.
6744         (Layout::record_output_section_data_from_script_,
6745         Layout::script_output_section_data_list_, Layout::segment_states_,
6746         Layout::relaxation_debug_check_): New data members.
6747         * output.cc: (Output_section_headers::do_size): New method definition.
6748         (Output_section_headers::Output_section_headers): Move size
6749         computation to Output_section_headers::do_size.
6750         (Output_segment_headers::do_size): New method definition.
6751         (Output_file_header::Output_file_header): Move size computation to
6752         Output_file_header::do_size and call it.
6753         (Output_file_header::do_size): New method definition.
6754         (Output_data_group::Output_data_group): Adjust call to
6755         Output_section_data.
6756         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6757         (Output_symtab_xindex::do_write): Add array bound check.
6758         (Output_section::Input_section::print_to_mapfile): Handle
6759         RELAXED_INPUT_SECTION_CODE.
6760         (Output_section::Output_section): Initialize data member checkpoint_.
6761         (Output_section::~Output_section): Delete checkpoint object pointed
6762         by checkpoint_.
6763         (Output_section::add_input_section): Always add an Input_section if
6764         relaxing.
6765         (Output_section::add_merge_input_section): Add assert.
6766         (Output_section::relax_input_section): New method definition.
6767         (Output_section::set_final_data_size): Set load address to zero for
6768         an unallocated section.
6769         (Output_section::do_address_and_file_offset_have_reset_values):
6770         New method definition.
6771         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6772         Handle relaxed input section.
6773         (Output_section::sort_attached_input_sections): Checkpoint input
6774         section list lazily.
6775         (Output_section::get_input_sections): Change type of input_sections to
6776         list of Simple_input_section pointers.  Checkpoint input section list
6777         lazily.  Also handle relaxed input sections.
6778         (Output_section::add_input_section_for_script): Take a reference to
6779         a Simple_input_section object instead of Relobj pointer and section
6780         index as parameter.  Handle relaxed input sections.
6781         (Output_section::save_states, Output_section::restore_states): New
6782         method definitions.
6783         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6784         (Output_data::is_data_size_fixed): New method definition.
6785         (Output_data::reset_addresss_and_file_offset): Do not reset data size
6786         if it is fixed.
6787         (Output_data::address_and_file_offset_have_reset_values): New method
6788         definition.
6789         (Output_data::do_address_and_file_offset_have_reset_values): New method
6790         definition.
6791         (Output_data::set_data_size): Check that data size is not fixed.
6792         (Output_data::fix_data_size): New method definition.
6793         (Output_data::is_data_size_fixed_): New data member.
6794         (Output_section_headers::set_final_data_size): New method definition.
6795         (Output_section_headers::do_size): New method declaration.
6796         (Output_segment_headers::set_final_data_size): New method definition.
6797         (Output_segment_headers::do_size): New method declaration.
6798         (Output_file_header::set_final_data_size)::New method definition.
6799         (Output_file_header::do_size)::New method declaration.
6800         (Output_section_data::Output_section_data): Add new parameter
6801         is_data_size_fixed and use it to fix data size.
6802         (Output_data_const::Output_data_const): Adjust call to base class
6803         constructor and fix data size.
6804         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6805         base class constructor and fix data size.
6806         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6807         base class constructor and fix data size.
6808         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6809         class constructor and fix data size.
6810         (Output_data_group::set_final_data_size): New method definition.
6811         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6812         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6813         class constructor and fix data size.
6814         (Output_relaxed_input_section): New class definition.
6815         (Output_section::Simple_input_section): New class definition.
6816         (Output_section::get_input_sections): Adjust parameter list.
6817         (Output_section::add_input_section_for_script): Same.
6818         (Output_section::save_states, Output_section::restore_states,
6819         Output_section::do_address_and_file_offset_have_reset_values,
6820         (Output_section::Input_section::Input_section): Handle
6821         RELAXED_INPUT_SECTION_CODE.  Add new overload for
6822         Output_relaxed_input_section.
6823         (Output_section::Input_section::is_input_section,
6824         Output_section::Input_section::set_output_section): Handle relaxed
6825         input section.
6826         (Output_section::Input_section::is_relaxed_input_section,
6827         Output_section::Input_section::output_section_data,
6828         Output_section::Input_section::relaxed_input_section): New method
6829         definitions.
6830         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6831         value.
6832         (Output_section::Input_section::u1_): Update comments.
6833         (Output_section::Input_section::u2_): Add new union member poris.
6834         (Output_section::Checkpoint_output_section): New classs definition.
6835         (Output_section::relax_input_section): New method declaration.
6836         (Output_section::checkpoint_): New data member.
6837         (Output_segment): Update comments.
6838         (Output_segment::Output_segment): Un-privatize copy constructor.
6839         (Output_segment::operator=): Un-privatize.
6840         * script-sections.cc (Output_section_element::Input_section_list):
6841         Change element type to Output_section::Simple_input_section.
6842         (Output_section_element_dot_assignment::set_section_addresses):
6843         Register output section data for relaxation clean up.
6844         (Output_data_exression::Output_data_expression): Adjust call to base
6845         constructor to fix data size.
6846         (Output_section_element_data::set_section_addresses): Register
6847         Output_data_expression object for relaxation clean up.
6848         (struct Input_section_info): Replace Relobj pointer and section index
6849         pair with Output_section::Simple_input_section and Convert struct to a
6850         class.
6851         (Input_section_sorter::operator()): Adjust access to
6852         Input_section_info data member to use accessors.
6853         (Output_section_element_input::set_section_addresses): Use layout
6854         parameter.  Adjust code to use Output_section::Simple_input_section
6855         and Input_secction_info classes.  Register filler for relaxation
6856         clean up.
6857         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6858         and section index pair with Output_section::Simple_input_section
6859         class.  Adjust code accordingly.
6860         (Phdrs_element::release_segment): New method definition.
6861         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6862         segment list.
6863         (Script_sections::release_segments): New method definition.
6864         * gold/script-sections.h (Script_sections::release_segments): New
6865         method declaration.
6866         * gold/target.h (Target::may_relax, Target::relax,
6867         Target::do_may_relax, Target::do_relax): New method definitions.
6868
6869 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6870
6871         * arm.cc (has_signed_unsigned_overflow): New function.
6872         (Arm_relocate_functions::abs8): New function.
6873         (Target_arm::Scan::local): Handle R_ARM_ABS8.
6874         (Target_arm::Scan::global): Likewise.
6875         (Target_arm::relocate::relocate): Likewise.
6876         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6877         Likewise.
6878
6879 2009-09-16  Cary Coutant  <ccoutant@google.com>
6880
6881         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6882         * testsuite/Makefile.in: Regenerate.
6883
6884 2009-09-11  Nick Clifton  <nickc@redhat.com>
6885
6886         * po/gold.pot: Updated by the Translation project.
6887
6888 2009-09-08  Cary Coutant  <ccoutant@google.com>
6889
6890         * output.cc (Output_file::open): Add execute permission to empty file.
6891         * testsuite/Makefile.am (permission_test): New test.
6892         * testsuite/Makefile.in: Regenerate.
6893
6894 2009-09-02  Ian Lance Taylor  <iant@google.com>
6895
6896         * output.cc (Output_file::resize): Call map_no_anonymous rather
6897         than map.
6898
6899 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
6900
6901         * gold.cc: Include "incremental.h".
6902         (queue_initial_tasks): Call Incremental_checker methods.
6903         * incremental.cc: Include "output.h".
6904         (Incremental_checker::can_incrementally_link_output_file): New
6905         method.
6906         * incremental.h (Incremental_checker): New class.
6907
6908         * output.cc (Output_file::open_for_modification): New method.
6909         (Output_file::map_anonymous): Changed return type to bool.  Record
6910         map in base_ field.
6911         (Output_file::map_no_anonymous): New method, broken out of map.
6912         (Output_file::map): Use map_no_anonymous and map_anonymous.
6913         * output.h (class Output_file): Update declarations.
6914
6915 2009-08-24  Cary Coutant  <ccoutant@google.com>
6916
6917         * options.h (Command_line::Pre_options): New class.
6918         (Command_line::pre_options): New member.
6919         * options.cc (gold::options::ready_to_register): New variable.
6920         (One_option::register_option): Do nothing if not registering options.
6921         Assert if same short option registered twice.
6922         (General_options::General_options): Turn off option registration when
6923         done constructing.
6924         (Command_line::Pre_options::Pre_options): New constructor.
6925
6926 2009-08-24  Cary Coutant  <ccoutant@google.com>
6927
6928         * options.h (General_options::no_keep_memory): Remove incorrect
6929         short option.
6930
6931 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6932
6933         * Makefile.am (am__skiplex, am__skipyacc): New.
6934         * Makefile.in: Regenerate.
6935
6936 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6937
6938         * Makefile.am (AM_CPPFLAGS): Renamed from ...
6939         (INCLUDES): ... this.
6940         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6941         (AM_CPPFLAGS): Renamed from ...
6942         (INCLUDE): ... this.
6943         * Makefile.in, testsuite/Makefile.in: Regenerate.
6944
6945         * Makefile.in: Regenerate.
6946         * aclocal.m4: Likewise.
6947         * config.in: Likewise.
6948         * configure: Likewise.
6949         * testsuite/Makefile.in: Likewise.
6950
6951         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6952         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6953         * Makefile.in: Regenerate.
6954         * testsuite/Makefile.in: Regenerate.
6955
6956 2009-08-19  Cary Coutant  <ccoutant@google.com>
6957
6958         * resolve.cc (Symbol_table::resolve): Don't complain about defined
6959         symbols in shared libraries overridden by hidden or internal symbols
6960         in the main program.
6961
6962 2009-08-19  Chris Demetriou  <cgd@google.com>
6963
6964         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6965         checking source file names in error messages.
6966
6967 2009-08-18  Doug Kwan  <dougkwan@google.com>
6968
6969         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6970         an elcpp::Ehdr as parameter.  Adjust call to set_target.
6971         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6972         an elfcpp::Ehdr as parameter.
6973         * object.cc (Object::set_target): Remove the version that looks up
6974         a target and sets it.
6975         (Sized_relobj::setup): Take a Target object instead of
6976         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
6977         (make_elf_sized_object): Find target and ask target to
6978         make an ELF object.
6979         * object.h: (Object::set_target): Remove the version that looks up
6980         a target and sets it.
6981         (Sized_relobj::setup): Take a Target object instead of
6982         an elfcpp:Ehdr as parameter.
6983         * target.cc: Include dynobj.h.
6984         (Target::do_make_elf_object_implementation): New.
6985         (Target::do_make_elf_object): New.
6986         * target.h (Target::make_elf_object): New template declaration.
6987         (Target::do_make_elf_object): New method declarations.
6988         (Target::do_make_elf_object_implementation): New template declaration.
6989
6990 2009-08-14  Ian Lance Taylor  <iant@google.com>
6991
6992         * gold.h (FUNCTION_NAME): Define.
6993         (gold_unreachable): Use FUNCTION_NAME.
6994
6995 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
6996
6997         * icf.cc (Icf::find_identical_sections): Issue a warning when a
6998         symbol in the --keep-unique list is not found.
6999
7000 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
7001
7002         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7003         been maked as --keep-unique.
7004         (Icf::unfold_section): New function.
7005         * icf.h (Icf::unfold_section): New function.
7006         * options.h (General_options::keep_unique): New option.
7007         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7008         * testsuite/Makefile.in: Regenerate.
7009         * testsuite/icf_keep_unique_test.sh: New file.
7010         * testsuite/icf_keep_unique_test.cc: New file.
7011
7012 2009-08-12  Cary Coutant  <ccoutant@google.com>
7013
7014         PR 10471
7015         * resolve.cc (Symbol_table::resolve): Check for references from
7016         dynamic objects to hidden and internal symbols.
7017         * testsuite/Makefile.am (hidden_test.sh): New test.
7018         * testsuite/Makefile.in: Regenerate.
7019         * testsuite/hidden_test.sh: New script.
7020         * testsuite/hidden_test_1.c: New test source.
7021         * testsuite/hidden_test_main.c: New test source.
7022
7023 2009-08-11  Doug Kwan  <dougkwan@google.com>
7024
7025         * arm.cc: Update comments.
7026         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7027         segment to locate the .ARM.exidx section if present.
7028
7029 2009-08-09  Doug Kwan  <dougkwan@google.com>
7030
7031         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7032         patch.
7033
7034 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
7035         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7036         compiler warnings.
7037
7038 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
7039
7040         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7041         valid tls_segment only for non-debug-section relocations.
7042         * testsuite/Makefile.am: Add gc_tls_test.
7043         * testsuite/Makefile.in: Regenerate.
7044         * testsuite/gc_tls_test.cc: New file.
7045         * testsuite/gc_tls_test.sh: New file.
7046
7047 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
7048
7049         * icf.cc: New file.
7050         * icf.h: New file.
7051         * Makefile.am (CCFILES): Add icf.cc.
7052         (HFILES): Add icf.h
7053         * Makefile.in: Regenerate.
7054         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7055         * gc.h (gc_process_relocs): Populate lists used by icf to contain
7056         section, symbol and addend information for the relocs.
7057         * gold.cc (queue_middle_tasks): Call identical code folding.
7058         * gold.h: Add defines for multimap.
7059         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7060         to the call of finalize_local_symbols.
7061         * main.cc (main): Create object of class Icf.
7062         * object.cc (Sized_relobj::do_layout): Allow this function to be
7063         called twice during icf.
7064         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7065         to sections marked as identical by icf.
7066         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7067         when available.
7068         (Sized_relobj::do_section_entsize): New function.
7069         * object.h (Object::section_entsize): New function.
7070         (Object::do_section_entsize): New pure virtual function.
7071         (Relobj::finalize_local_symbols): Add new parameter.
7072         (Relobj::do_section_entsize): New function.
7073         * options.h (General_options::icf): New option.
7074         (General_options::icf_iterations): New option.
7075         (General_options::print_icf_sections): New option.
7076         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7077         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7078         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7079         icf.
7080         * symtab.cc (Symbol_table::is_section_folded): New function.
7081         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
7082         to sections marked as identical by icf.
7083         * symtab.h (Symbol_table::set_icf): New function.
7084         (Symbol_table::icf): New function.
7085         (Symbol_table::is_section_folded): New function.
7086         (Symbol_table::icf_): New data member.
7087         * target-reloc.h (relocate_section): Ignore sections folded by icf.
7088         * testsuite/Makefile.am: Add commands to build icf_test.
7089         * testsuite/Makefile.in: Regenerate.
7090         * testsuite/icf_test.sh: New file.
7091         * testsuite/icf_test.cc: New file.
7092
7093 2009-07-24  Chris Demetriou  <cgd@google.com>
7094
7095         * layout.cc (is_compressible_debug_section): Fix incorrect
7096         comment about compressed section names.
7097
7098 2009-07-20  Ian Lance Taylor  <ian@airs.com>
7099
7100         PR 10419
7101         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7102
7103 2009-07-16  Ian Lance Taylor  <iant@google.com>
7104
7105         PR 10400
7106         * layout.h: #include <map>.
7107         (class Kept_section): Change from struct to class.  Add accessors
7108         and setters.  Add section size to Comdat_group mapping.  Change
7109         Comdat_group to std::map.  Add is_comdat_ field.  Add
7110         linkonce_size field in union.
7111         (class Layout): Update declaration of find_or_add_kept_section.
7112         Don't declare find_kept_object.
7113         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7114         parameter.  Add object, shndx, is_comdat, and is_group_name
7115         parameters.  Change all callers.  Adjust for new Kept_section.
7116         (Layout::find_kept_object): Remove.
7117         * object.cc (Sized_relobj::include_section_group): Update use of
7118         Kept_section.  Rename secnum to shndx.  Only record
7119         Kept_comdat_section if sections are the same size.
7120         (Sized_relobj::include_linkonce_section): Update use of
7121         Kept_section.  Only record Kept_comdat_section if sections are the
7122         same size.  Set size of linkonce section.
7123         (Sized_relobj::map_to_kept_section): Update call to
7124         get_kept_comdat_section.
7125         * object.h (class Sized_relobj): Rename fields in
7126         Kept_comdat_section to drop trailing underscores; change object
7127         field to Relobj*.  Change Kept_comdat_section_table to store
7128         struct rather than pointer.
7129         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7130         Add kept_object and kept_shndx parameters.  Change all callers.
7131         (Sized_relobj::get_kept_comdat_section): Change return type to
7132         bool.  Add kept_object and kept_shndx parameters.  Change all
7133         callers.
7134         * plugin.cc (Pluginobj::include_comdat_group): Update call to
7135         Layout::find_or_add_kept_section.
7136
7137 2009-07-09  Ian Lance Taylor  <iant@google.com>
7138
7139         * merge.cc (Object_merge_map::initialize_input_to_output_map):
7140         Reserve space in the hash table.
7141
7142 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
7143
7144         * fileread.cc (File_read::get_mtime): New method.
7145         * fileread.h (Timespec): New structure.
7146         (File_read::get_mtime): New method.
7147         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7148         Renamed from timestamp_nsec.
7149         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7150         Elf_Xword.
7151         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7152         timestamp_nsec.
7153         (Incremental_inputs::report_archive): Save mtime; style fix.
7154         (Incremental_inputs::report_obejct): Save mtime; style fix.
7155         (Incremental_inputs::report_script): Save mtime; style fix.
7156         (Incremental_inputs::finalize_inputs): Style fix.
7157         (Incremental_inputs::finalize): Style fix.
7158         (Incremental_inputs::create_input_section_data): Store inputs
7159         mtime.
7160         * incremental.h (Incremental_inputs::report_script): Add mtime
7161         argument.
7162         (Incremental_inputs::Input_info::Input_info): Intialize only one
7163         union member.
7164         (Incremental_inputs::Input_info::archive): Move to nameless
7165         union.
7166         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7167         (Incremental_inputs::Input_info::script): Move to nameless union.
7168         (Incremental_inputs::mtime): New field.
7169         * script.cc (read_input_script): Pass file mtime to
7170         Incremental_input.
7171         * script.h (Script_info::inputs): Style fix.
7172
7173 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7174
7175         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7176         instead of 32.
7177
7178 2009-06-24  Ian Lance Taylor  <iant@google.com>
7179
7180         PR 10156
7181         * layout.cc (Layout::choose_output_section): If we find an
7182         existing section, update the flags.
7183         (Layout::create_notes): New function, broken out of
7184         Layout::finalize.
7185         (Layout::finalize): Don't create note sections.
7186         (Layout::create_note): Don't crash if linker script discards
7187         section.
7188         (Layout::create_gold_note): Likewise.
7189         (Layout::create_build_id): Likewise.  Don't set
7190         after_input_sections on the section.
7191         (Layout::create_executable_stack_info): Remove target parameter.
7192         Change caller.
7193         * layout.h (class Layout): Declare create_notes.  Update
7194         declaration of create_executable_stack_info.
7195         * gold.cc (queue_middle_tasks): Call create_notes.
7196         * output.cc (Output_section::update_flags_for_input_section): Move
7197         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7198         invalid.
7199         * output.h (Output_data::mark_address_invalid): New function.
7200         (class Output_section): Only declare, not define,
7201         update_flags_for_input_section.  Remove set_flags.
7202
7203 2009-06-24  Ian Lance Taylor  <iant@google.com>
7204
7205         * script-sections.cc (Output_section_definition::
7206         set_section_addresses): Rename shadowing local load_address to
7207         laddr.
7208
7209 2009-06-24  Ian Lance Taylor  <iant@google.com>
7210
7211         PR 10244
7212         * reloc.cc (relocate_sections): Skip empty relocation sections.
7213
7214 2009-06-23  Ian Lance Taylor  <iant@google.com>
7215
7216         PR 10156
7217         * layout.cc (Layout::create_note): Use choose_output_section
7218         rather than make_output_section.
7219
7220 2009-06-23  Ian Lance Taylor  <iant@google.com>
7221
7222         PR 10237
7223         * options.cc (General_options::parse_V): Set printed_version_.
7224         (General_options::General_options): Initialize printed_version_.
7225         * options.h (class General_options): Add printed_version_ field.
7226         * gold.cc (queue_initial_tasks): If there are no input files,
7227         don't give a fatal error if we printed the version information.
7228         (queue_middle_tasks): If using -r with a shared object, give a
7229         fatal error rather than an ordinary error.
7230
7231 2009-06-23  Ian Lance Taylor  <iant@google.com>
7232
7233         PR 10219
7234         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7235         (Layout::make_output_section): Set have_stabstr_section_ if we see
7236         a .stab*str section.
7237         (Layout::finalize): Call link_stabs_sections.
7238         (Layout::link_stabs_sections): New file.
7239         * layout.h (class Layout): Add have_stabstr_section_ field.
7240         Declare link_stabs_sections.
7241
7242 2009-06-23  Doug Kwan  <dougkwan@google.com>
7243
7244         * Makefile.am (libgold_a_LIBADD): New.
7245         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7246         * Makefile.in: Regenerate.
7247         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7248         * configure: Regenerate.
7249         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7250         * fileread.cc: Include sys/state.h
7251         * gold.h: Declare memmem and strndup if found missing.
7252         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7253
7254 2009-06-23  Ian Lance Taylor  <iant@google.com>
7255
7256         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7257         * configure: Rebuild.
7258
7259 2009-06-23  Ian Lance Taylor  <iant@google.com>
7260
7261         PR 10147
7262         * object.cc (Object::section_contents): Don't try to get a view if
7263         the section has length zero.
7264         (Object::handle_gnu_warning_section): If the section is empty, use
7265         the name of the section as the warning.
7266
7267 2009-06-23  Ian Lance Taylor  <iant@google.com>
7268
7269         PR 10133
7270         * stringpool.h (class Stringpool_template): Add optimize_ field.
7271         (Stringpool_template::set_optimize): New function.
7272         * stringpool.cc (Stringpool_template::Stringpool_template):
7273         Initialize optimize_ field.
7274         (Stringpool_template::set_string_offsets): Test local optimize
7275         fild rather than parameter.
7276         * layout.cc (Layout::Layout): Call set_optimize on the section
7277         name stringpool.
7278
7279 2009-06-22  Ian Lance Taylor  <iant@google.com>
7280
7281         PR 10030
7282         * yyscript.y: Parse TARGET.
7283         * script.cc (script_set_target): New function.
7284         * script-c.h (script_set_target): Declare.
7285         * options.cc (General_options::string_to_object_format): Rename
7286         from string_to_object_format in anonymous namespace.  Change
7287         callers.
7288         * options.h (class General_options): Declare
7289         string_to_object_format.
7290
7291 2009-06-22  Ian Lance Taylor  <iant@google.com>
7292
7293         * script-sections.cc (Script_sections::create_segments): Don't put
7294         program headers in a PT_LOAD segment if -n or -N.
7295
7296 2009-06-22  Ian Lance Taylor  <iant@google.com>
7297
7298         PR 10141
7299         * options.h (class General_options): Add -z lazy and -z now.  Sort
7300         -z options into alphabetical order.
7301         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7302
7303 2009-06-21  Ian Lance Taylor  <iant@google.com>
7304
7305         * layout.cc (Layout::make_output_section): Call
7306         Target::new_output_section.
7307         (Layout::attach_allocated_section_to_segment): Put large section
7308         sections in a separate load segment with the large segment flag
7309         set.
7310         (Layout::segment_precedes): Sort large data segments after other
7311         load segments.
7312         (align_file_offset): New static function.
7313         (Layout::set_segment_offsets): Use align_file_offset.
7314         * output.h (class Output_section): Add is_small_section_ and
7315         is_large_section_ fields.
7316         (Output_section::is_small_section): New function.
7317         (Output_section::set_is_small_section):  New function.
7318         (Output_section::is_large_section): New function.
7319         (Output_section::set_is_large_section): New function.
7320         (Output_section::is_large_data_section): New function.
7321         (class Output_segment): Add is_large_data_segment_ field.
7322         (Output_segment::is_large_data_segment): New function.
7323         (Output_segment::set_is_large_data_segment): New function.
7324         * output.cc (Output_section::Output_section): Initialize new
7325         fields.
7326         (Output_segment::Output_segment): Likewise.
7327         (Output_segment::add_output_section): Add assertion that large
7328         data sections always go in large data segments.  Force small data
7329         sections to the end of the list of data sections.  Force small BSS
7330         sections to the start of the list of BSS sections.  For large BSS
7331         sections to the end of the list of BSS sections.
7332         * symtab.h (class Symbol): Declare is_common_shndx.
7333         (Symbol::is_defined): Check Symbol::is_common_shndx.
7334         (Symbol::is_common): Likewise.
7335         (class Symbol_table): Define enum Commons_section_type.  Update
7336         declarations.  Add small_commons_ and large_commons_ fields.
7337         * symtab.cc (Symbol::is_common_shndx): New function.
7338         (Symbol_table::Symbol_table): Initialize new fields.
7339         (Symbol_table::add_from_object): Put small and large common
7340         symbols in the right list.
7341         (Symbol_table::sized_finalized_symbol): Check
7342         Symbol::is_common_shndx.
7343         (Symbol_table::sized_write_globals): Likewise.
7344         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7345         common symbol lists.  Don't call do_allocate_commons_list if the
7346         list is empty.
7347         (Symbol_table::do_allocate_commons_list): Remove is_tls
7348         parameter.  Add comons_section_type parameter.  Change all
7349         callers.  Handle small and large common symbols.
7350         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7351         Symbol::is_common_shndx.
7352         * resolve.cc (symbol_to_bits): Likewise.
7353         * target.h (Target::small_common_shndx): New function.
7354         (Target::small_common_section_flags): New function.
7355         (Target::large_common_shndx): New function.
7356         (Target::large_common_section_flags): New function.
7357         (Target::new_output_section): New function.
7358         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7359         small_common_section_flags, and large_common_section_flags
7360         fields.
7361         (Target::do_new_output_section): New virtual function.
7362         * arm.cc (Target_arm::arm_info): Initialize new fields.
7363         * i386.cc (Target_i386::i386_info): Likewise.
7364         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7365         Likewise.
7366         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7367         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7368         (Target_x86_64::do_new_output_section): New function.
7369         * configure.ac: Define conditional MCMODEL_MEDIUM.
7370         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7371         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7372         (large_LDFLAGS): Define.
7373         * testsuite/large.c: New file.
7374         * testsuite/testfile.cc (Target_test::test_target_info):
7375         Initialize new fields.
7376         * configure, testsuite/Makefile.in: Rebuild.
7377
7378 2009-06-05  Doug Kwan  <dougkwan@google.com>
7379
7380         * Makefile.am (CCFILES): Add target.cc.
7381         * Makefile.in: Regenerate.
7382         * i386.cc (class Target_i386): Define new virtual method to
7383         override do_is_local_label_name in parent.
7384         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7385         local symbols if --discard-locals or -X is given.
7386         * options.h (class General_options): Declare new options
7387         '--discard-locals' and '-X' for discarding locals.
7388         * target.h (class Target): Define new methods is_local_label_name.
7389         Declare new virtual method do_is_local_label_name.
7390         * target.cc: New file.
7391         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7392         (check_SCRIPTS): Add discard_locals_test.sh.
7393         (check_DATA): Add discard_local_tests.syms.
7394         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7395         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7396         * testsuite/Makefile.in: Regenerate.
7397         * testsuite/discard_locals_test.c: New file.
7398         * testsuite/discard_locals_test.sh: Same.
7399
7400 2009-06-05  Doug Kwan  <dougkwan@google.com>
7401
7402         * object.cc (Sized_relobj::Sized_relobj): Initialize
7403         discarded_eh_frame_shndx_ to -1U.
7404         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7405         section.
7406         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7407         a discarded .eh_frame section.
7408         (Sized_relobj::do_finalize_local_symbols): Ditto.
7409         * object.h (class Sized_relobj): Declare new member
7410         discarded_eh_frame_shndx_.
7411         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7412         (local_labels_test.o, local_labels_test): New rules.
7413         * testsuite/Makefile.in: Regenerate.
7414
7415 2009-06-04  Doug Kwan  <dougkwan@google.com>
7416
7417         * layout.cc (Layout::section_name_mapping): Add mapping for
7418         special ARM sections.
7419
7420 2009-06-03  Doug Kwan  <dougkwan@google.com>
7421
7422         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7423         (utils::has_overflow): Same.
7424
7425 2009-06-03  Ian Lance Taylor  <iant@google.com>
7426
7427         * layout.cc (Layout::section_name_mapping): New array, replacing
7428         Layout::linkonce_mapping.
7429         (Layout::section_name_mapping_count): New variable, replacing
7430         Layout::linkonce_mapping_count.
7431         (Layout::linkonce_output_name): Remove.
7432         (Layout::output_section_name): Rewrite.
7433         * layout.h (class Layout): Rename Linkonce_mapping to
7434         Section_name_mapping, linkonce_mapping to section_name_mapping,
7435         linkonce_mapping_count to section_name_mapping_count.  Don't
7436         declare linkonce_output_name.
7437
7438 2009-06-03  Doug Kwan  <dougkwan@google.com>
7439
7440         * gold/arm.cc (namespace utils): New.
7441         (Target_arm::reloc_is_non_pic): Define new method.
7442         (class Arm_relocate_functions): New.
7443         (Target_arm::Relocate::relocate): Handle relocation types used by
7444         Android.
7445
7446 2009-06-03  Ian Lance Taylor  <iant@google.com>
7447
7448         * arm.cc (Target_arm::scan::global): Use || instead of |.
7449
7450 2009-06-02  Doug Kwan  <dougkwan@google.com>
7451
7452         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7453         issued_non_pic_error_.
7454         (class Target_arm::Scan): Declare new method check_non_pic.
7455         Define new method symbol_needs_plt_entry.
7456         Declare new data member issued_non_pic_error_.
7457         (class Target_arm::Relocate): Declare new method
7458         should_apply_static_reloc.
7459         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7460         (Target_arm::Scan::check_non_pic): Define new method.
7461         (Target_arm::Scan::local): Handle a small subset of reloc types used
7462         by Android.
7463         (Target_arm::Scan::local): Same.
7464         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7465
7466 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7467
7468         * incremental.cc (Incremental_inputs::report_command_line): Filter
7469         out --incremental-* options.
7470
7471 2009-05-29  Doug Kwan  <dougkwan@google.com>
7472
7473         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7474         template class.
7475         (class Target_arm): Update comment.
7476         (Target_arm::Target_arm): Initialize new data members GOT_,
7477         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7478         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7479         and Target_arm::rel_dyn_section.
7480         Declare new_enum Target_arm::Got_type.
7481         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7482         and DYNBSS_.
7483         Update commments for member do_dynsym_value.
7484         (Target_arm::got_size, Target_arm::plt_section,
7485         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7486         new methods inside class defintion.
7487         (Target_arm::got_section): Define new method.
7488         (Target_arm::rel_dyn_section): Same.
7489         (Output_data_plt_arm): New template class.
7490         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7491         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7492         (Output_data_plt_arm::add_entry): Same.
7493         (Output_data_plt_arm::first_plt_entry): Define new
7494         static data member for PLT instruction template.
7495         (Output_data_plt_arm::plt_entry): Same.
7496         (Output_data_plt_arm::do_write): Define new method.
7497         (Target_arm::make_plt_entry): Same.
7498         (Target_arm::do_finalize_sections): Same.
7499         (Target_arm::do_dynsym_value): Same.
7500
7501 2009-05-28  Doug Kwan  <dougkwan@google.com>
7502
7503         * Makefile.am (TARGETSOURCES): Add arm.cc.
7504         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7505         * Makefile.in: Regenerate.
7506         * arm.cc: New file.
7507         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7508
7509 2009-05-26  Doug Kwan  <dougkwan@google.com>
7510
7511         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7512         (General_options::check_excluded_libs): Strip off directories in
7513         archive name before matching like GNU ld does.
7514         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7515         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7516         (exclude_libs_test_LDFLAGS): Add linker option
7517         -Wl,--exclude-libs,libexclude_libs_test_3
7518         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7519         an explicit archive without using -l.
7520         (alt/libexclude_libs_test_3.a): New make rule.
7521         * testsuite/Makefile.in: Regenerate.
7522         * testsuite/exclude_libs_test.c : Declare lib3_default().
7523         (main): Call it.
7524         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7525         * exclude_libs_test_3.c: New file.
7526
7527 2009-05-26  Nick Clifton  <nickc@redhat.com>
7528
7529         * po/id.po: New Indonesian translation.
7530         * po/gold.pot: Updated template file.
7531
7532 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7533
7534         * testsuite/Makefile.am: Add -ffunction-sections to compile
7535         gc_comdat_test files.  Add -Wl,--gc-sections to build
7536         gc_comdat_test.
7537         * testsuite/Makefile.in: Regenerate.
7538         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7539
7540 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7541
7542         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7543         kept comdat section was garbage collected.
7544         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7545         * testsuite/Makefile.in: Regenerate.
7546         * testsuite/gc_comdat_test.sh: New file.
7547         * testsuite/gc_comdat_test_1.cc: New file.
7548         * testsuite/gc_comdat_test_2.cc: New file.
7549
7550 2009-05-19  Doug Kwan  <dougkwan@google.com>
7551
7552         * archive.cc (Archive::Archive): Move constructor from archive.h
7553         to here.  Initialize no_export_.
7554         (Archive::get_elf_object_for_member): Set no_export flag of object.
7555         * archive.h (Archive::Archive): Move constructor body to
7556         archive.cc.
7557         (Archive::no_export): New method.
7558         (Archive::no_export_): New field.
7559         * object.h (Object::Object): Initialize no_export_ to false.
7560         (Object::no_export, Object::set_no_export): New methods.
7561         (Object::no_export_): New field.
7562         * options.cc (General_options::parse_exclude_libs): New method.
7563         (General_options::check_excluded_libs) Same.
7564         * options.h (exclude_libs): New option.
7565         (General_options::check_excluded_libs): New method declaration.
7566         (General_options::excluded_libs_): New field.
7567         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7568         default or protected visibility if an object has no-export flag set.
7569         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7570         (check_SCRIPTS): Add exclude_libs_test.sh.
7571         (check_DATA): Add exclude_libs_test.syms.
7572         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7573         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7574         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7575         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7576         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7577         libexclude_libs_test_2.a): New rules.
7578         * testsuite/Makefile.in: Regenerate.
7579         * testsuite/exclude_libs_test.c: New file.
7580         * testsuite/exclude_libs_test.sh: Ditto.
7581         * testsuite/exclude_libs_test_1.c: Ditto.
7582         * testsuite/exclude_libs_test_2.c: Ditto.
7583
7584 2009-05-15  Ian Lance Taylor  <iant@google.com>
7585
7586         * configure.ac: Check for declarations for cases where libiberty.h
7587         checks HAVE_DECL_xxx.
7588         * configure, config.in: Rebuild.
7589
7590 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7591
7592         * gold.h (Incremental_argument_list): Remove (invalid) forward
7593         declaration.
7594         * incremental.cc (Incremental_inputs::report_achive): New method.
7595         (Incremental_inputs::report_object): New method.
7596         (Incremental_inputs::report_script): New method.
7597         (Incremental_inputs::finalize_inputs): New method.
7598         (Incremental_inputs::finalize): Call finalize_inputs().
7599         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7600         Create inputs entries.
7601         * incremental.h (Incremental_input_type): New enum.
7602         (Incremental_inputs::Incremental_input): Initialize new fields.
7603         (Incremental_inputs::report_inputs): New method.
7604         (Incremental_inputs::report_achive): New method.
7605         (Incremental_inputs::report_object): New method.
7606         (Incremental_inputs::report_script): New method.
7607         (Incremental_inputs::finalize_inputs): New method.
7608         (Incremental_inputs::Input_info): New struct.
7609         (Incremental_inputs::Input_info_map): New typedef.
7610         (Incremental_inputs::lock_): New field.
7611         (Incremental_inputs::Inputs_): New field.
7612         (Incremental_inputs::Inputs_map): New field.
7613         * main.cc (main): Call Incremental_input::report_inputs.
7614         * options.h (Input_argument_list): Typedef moved from
7615         Input_arguments.
7616         (Input_file_group::Files): Remove, use ::Input_argument_list.
7617         (Input_file_group::Input_argument_list): Remove, use
7618         ::Input_argument_list.
7619         * plugin.cc (Plugin_manager::add_input_file): Add error in
7620         incremental build.
7621         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7622         functions.
7623         * script.cc (read_input_script): Call
7624         Incremental_input::report_script.
7625         * script.h (Script_info): New class.
7626
7627 2009-04-27  Ian Lance Taylor  <iant@google.com>
7628
7629         * x86_64.cc (do_adjust_output_section): Set entsize to
7630         plt_entry_size.
7631
7632 2009-04-23  Elliott Hughes  <enh@google.com>
7633
7634         * output.cc (Output_file::close): After short writes, continue
7635         writing from the correct offset in the buffer being written.
7636
7637 2009-04-23  Chris Demetriou  <cgd@google.com>
7638
7639         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7640         * configure: Regenerate.
7641         * config.in: Regenerate.
7642         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7643         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7644
7645 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7646
7647         * incremental.cc (Incremental_inputs_header_data): Renamed from
7648         Incremental_input_header_data.
7649         (Incremental_inputs_header_data::data_size): New field.
7650         (Incremental_inputs_header_data::put_input_file_count): Renamed
7651         from input_file_count.
7652         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7653         from command_line_offset.
7654         (Incremental_inputs_header_data::put_reserved): Renamed from
7655         put_reserved.
7656         (Incremental_inputs_entry_data): Renamed from
7657         Incremental_input_entry_data.
7658         (Incremental_inputs_entry_data::data_size): New field.
7659         (Incremental_inputs::report_command_line): New method.
7660         (Incremental_inputs::finalize): New method.
7661         (Incremental_inputs::create_incremental_inputs_data): New method.
7662         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7663         * incremental.h: New file.
7664         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7665        (Layout::finalize): Create incremental inputs section in
7666         incremental builds.
7667        (Layout::create_incremental_info_sections): New method.
7668         * layout.h (Layout::incremental_inputs): New method.
7669        (Layout::create_incremental_info_sections): New method.
7670        (Layout::incremental_inputs_): New field.
7671         * main.cc (main): Notify Incremental_input of the command line.
7672
7673 2009-04-01  Ian Lance Taylor  <iant@google.com>
7674             Mikolaj Zalewski  <mikolajz@google.com>
7675
7676         * gold.h (reserve_unordered_map): Define, three versions, one for
7677         each version of Unordered_map.
7678         * layout.cc (Layout::Layout): Remove options parameter.  Add
7679         number_of_input_files parameter.  Don't initialize options_.
7680         Initialize number_of_input_files_ and resized_signatures_.  Move
7681         sections_are_attached_.
7682         (Layout::layout_group): Reserve space for group_signatures_.
7683         (Layout::find_or_add_kept_section): Change name parameter to be a
7684         reference.  Resize signatures_ map when it gets large enough.
7685         (Layout::layout_eh_frame): Use parameters->options() instead of
7686         this->options_.
7687         (Layout::make_output_section): Likewise.
7688         (Layout::attach_allocated_section_to_segment): Likewise.
7689         (Layout::finalize, Layout::create_executable_stack): Likewise.
7690         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7691         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7692         * layout.h (class Layout): Update declarations.  Remove options_
7693         field.  Add number_of_input_files_ and resized_signatures_
7694         fields.  Move sections_are_attached_ field.
7695         * main.cc (main): Pass number of input files to Layout
7696         constructor.  Don't pass options.
7697
7698 2009-03-30  Ian Lance Taylor  <iant@google.com>
7699
7700         * ffsll.c (ffsll): Correct implementation.
7701
7702 2009-03-27  Ian Lance Taylor  <iant@google.com>
7703
7704         * ffsll.c: New file.
7705         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7706         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7707         * ftruncate.c (ftruncate): Declare before definition.
7708         * mremap.c (mremap): Likewise.
7709         * pread.c (pread): Likewise.
7710         * configure, Makefile.in, config.in: Rebuild.
7711
7712         * mremap.c: New file.
7713         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7714         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7715         (mremap): Declare if HAVE_MREMAP is not defined.
7716         * configure, Makefile.in, config.in: Rebuild.
7717
7718 2009-03-27  Cary Coutant  <ccoutant@google.com>
7719
7720         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7721         position independent.
7722         * sparc.cc (Target_sparc::check_non_pic): Likewise.
7723         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7724
7725 2009-03-24  Cary Coutant  <ccoutant@google.com>
7726
7727         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7728         an executable.
7729         (needs_dynamic_reloc): Likewise.
7730
7731 2009-03-24  Ian Lance Taylor  <iant@google.com>
7732
7733         * yyscript.y (file_cmd): Recognize EXTERN.
7734         (extern_name_list, extern_name_list_body): New nonterminals.
7735         * script.cc (script_add_extern): Define.
7736         * script-c.h (script_add_extern): Declare.
7737
7738 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
7739
7740         * object.cc (is_elf_object): Define.
7741         * object.h (is_elf_object): Declare.
7742         * archive.cc (Archive::get_elf_object_for_member): Call
7743         is_elf_object.
7744         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7745
7746 2009-03-24  Elliott Hughes  <enh@google.com>
7747
7748         * output.cc (Output_file::map_anonymous): Define.
7749         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
7750         try an anonymous one.  Report the size if the mmap fails.
7751         * output.h (class Output_file): Declare map_anonymous.
7752
7753 2009-03-24  Ian Lance Taylor  <iant@google.com>
7754
7755         * target-select.cc (instantiate_target): Don't acquire the lock if
7756         the instantiated_target_ field has already been set.
7757
7758 2009-03-23  Ian Lance Taylor  <iant@google.com>
7759
7760         * gold-threads.h (class Initialize_lock): Define.
7761         * gold-threads.cc (class Initialize_lock_once): Define.
7762         (initialize_lock_control): New static variable.
7763         (initialize_lock_pointer): New static variable.
7764         (initialize_lock_once): New static function.
7765         (Initialize_lock::Initialize_lock): Define.
7766         (Initialize_lock::initialize): Define.
7767         * target-select.h: Include "gold-threads.h".
7768         (class Target_selector): Add lock_ and initialize_lock_ fields.
7769         Don't define instantiate_target, just declare it.
7770         * target-select.cc (Target_selector::Target_selector): Initialize
7771         new fields.
7772         (Target_selector::instantiate_target): Define.
7773         * descriptors.h: Include "gold-threads.h".
7774         (class Descriptors): Add initialize_lock_ field.
7775         * descriptors.cc (Descriptors::Descriptors): Initialize new
7776         field.
7777         (Descriptors::open): Use initialize_lock_ field
7778         * errors.h (class Errors): Add initialize_lock_ field.
7779         * errors.cc (Errors::Errors): Initialize new field.
7780         (Errors::initialize_lock): Use initialize_lock_ field.
7781         * powerpc.cc (class Target_selector_powerpc): Remove
7782         instantiated_target_ field.  In do_recognize call
7783         instantiate_target rather than do_instantiate_target.  In
7784         do_instantiate_target just allocate a new target.
7785         * sparc.cc (class Target_selector_sparc): Likewise.
7786
7787         * freebsd.h: New file.
7788         * i386.cc: Include "freebsd.h".
7789         (Target_i386): Derive from Target_freebsd rather than
7790         Sized_target.
7791         (Target_selector_i386): Derive from Target_selector_freebsd rather
7792         than Target_selector.
7793         * x86_64.cc: Include "freebsd.h".
7794         (Target_x86_64): Derive from Target_freebsd rather than
7795         Sized_target.
7796         (Target_selector_x86_64): Derive from Target_selector_freebsd
7797         rather than Target_selector.
7798         * target.h (class Target): Add adjust_elf_header and
7799         do_adjust_elf_header.
7800         * output.cc (Output_file_header:: do_sized_write): Call target
7801         adjust_elf_header routine.
7802         * configure.tgt: Set targ_osabi.
7803         * configure.ac: Define GOLD_DEFAULT_OSABI.
7804         * parameters.cc (Parameters::default_target): Pass
7805         GOLD_DEFAULT_OSABI to select_target.
7806         * target-select.h (class Target_selector): Make instantiate_target
7807         protected rather than private.
7808         * Makefile.am (HFILES): Add freebsd.h.
7809         * configure, Makefile.in, config.in: Rebuild.
7810
7811         * merge.cc (do_add_input_section): Correct pend value.  Change
7812         message about last entry not being null terminated from error to
7813         warning.
7814
7815 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
7816
7817         * incremental.cc: New file.
7818         * Makefile.am (CCFILES): Add incremental.cc.
7819         * Makefile.in: Rebuild.
7820
7821 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
7822
7823         * layout.cc (Layout::output_section_name): Preserve names
7824         of '.note.' sections.
7825
7826 2009-03-19  Ian Lance Taylor  <iant@google.com>
7827
7828         * descriptors.cc (Descriptors::open): Check that the options are
7829         valid before using them.
7830
7831 2009-03-18  Ian Lance Taylor  <iant@google.com>
7832
7833         * script-sections.h: Include <list>.
7834         (class Script_sections): Change Sections_elements from std::vector
7835         to std::list.  Typedef public Elements_iterator.  Add
7836         orphan_section_placement_, data_segment_align_start_, and
7837         saw_data_segment_align_ fields.  Remove data_segment_align_index_
7838         field.
7839         * script-sections.cc (class Orphan_section_placement): New class.
7840         (class Sections_element): Add virtual functions is_relro and
7841         orphan_section_init.  Remove virtual function place_orphan_here.
7842         (class Output_section_definition): Add is_relro and
7843         orphan_section_init.  Remove place_orphan_here.
7844         (class Orphan_output_section): Likewise.
7845         (Script_sections::Script_sections): Update for field changes.
7846         (Script_sections::data_segment_align): Set saw_data_segment_align_
7847         and data_segment_align_start_, not data_segment_align_index.
7848         (Script_sections::data_segment_relro_end): Check
7849         saw_data_segment_align_.  Use data_segment_align_start_ rather
7850         than data_segment_align_index_.
7851         (Script_sections::place_orphan): Rewrite to use
7852         Orphan_section_placement.
7853
7854 2009-03-17  Ian Lance Taylor  <iant@google.com>
7855
7856         * archive.cc (Archive::add_symbols): Check for a version attached
7857         to the symbol name in the archive map.
7858         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7859         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7860         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7861         (ver_test_11.a): New target.
7862         * testsuite/Makefile.in: Rebuild.
7863
7864         * configure.ac: Check for chsize and posix_fallocate.  Replace
7865         ftruncate.
7866         * ftruncate.c: New file, from gnulib.
7867         * output.cc (posix_fallocate): Define dummy version if not
7868         HAVE_POSIX_FALLOCATE.
7869         (Output_file::map): Call posix_fallocate rather than lseek and
7870         write.
7871         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7872         * configure, Makefile.in, config.in: Rebuild.
7873
7874 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
7875
7876         * layout.h (Layout::create_note): Add section_name parameter.
7877         * layout.cc (Layout::create_note): Likewise.
7878         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7879
7880 2009-03-17  Ian Lance Taylor  <iant@google.com>
7881
7882         * descriptors.cc: Include "options.h".
7883         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7884         (Descriptors::open): Always use O_CLOEXEC when opening a new
7885         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
7886         then set FD_CLOEXEC.
7887
7888         * sparc.cc (class Target_sparc): Add has_got_section.
7889         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7890         make sure we have a GOT section.
7891
7892         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7893         (Target_sparc::Scan::local): Likewise.
7894         (Target_sparc::Scan::global): Likewise.
7895         (Target_sparc::Relocate::relocate): Likewise.
7896         (Target_sparc::Relocate::relocate_tls): Likewise.
7897
7898         * symtab.cc (Symbol_table::define_default_version): New function,
7899         broken out of add_from_object.
7900         (Symbol_table::add_from_object): Call define_default_version.
7901         (Symbol_table::define_special_symbol): Add resolve_oldsym
7902         parameter.  Change all callers.  If the version for a symbol comes
7903         from a version script, resolve it with the symbol with the same
7904         name with no version.  Also add the symbol without a version if
7905         appropriate.
7906         (do_define_in_output_data): If resolving with oldsym, don't delete
7907         sym.
7908         (do_define_in_output_segment): Likewise.
7909         (do_define_as_constant): Likewise.
7910         * symtab.h (class Symbol_table): Update declarations.
7911
7912 2009-03-13  Ian Lance Taylor  <iant@google.com>
7913
7914         * readsyms.cc (Read_symbols::incompatible_warning): New function.
7915         (Read_symbols::requeue): New function.
7916         (Read_symbols::do_read_symbols): If make_elf_object fails because
7917         the target type is not configured, and the file was searched for,
7918         issue a warning and retry with the next directory.
7919         (Add_symbols::run): If the file has an incompatible format, and
7920         it was searched for, requeue the Read_symbols task.  On error,
7921         release the object.
7922         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
7923         dirindex parameter to constructor.  Change all callers.  Declare
7924         incompatible_warning and requeue.
7925         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7926         input_argument_ and input_group_ fields.  Add them to
7927         constructor.  Change all callers.
7928         (class Read_script): Add dirindex_ field.  Add it to constructor.
7929         Change all callers.
7930         * archive.cc (Archive::setup): Remove input_objects parameter.
7931         Change all callers.
7932         (Archive::get_file_and_offset): Likewise.
7933         (Archive::read_all_symbols): Likewise.
7934         (Archive::read_symbols): Likewise.
7935         (Archive::get_elf_object_for_member): Remove input_objects
7936         parameter.  Add punconfigured parameter.  Change all callers.
7937         (Archive::add_symbols): Change return type to bool.  Check return
7938         value of include_member.
7939         (Archive::include_all_members): Likewise.
7940         (Archive::include_member): Change return type to bool.  Return
7941         false if first included object has incompatible target.  Set
7942         included_member_ field.
7943         (Add_archive_symbols::run): If add_symbols returns false, requeue
7944         Read_symbols task.
7945         * archive.h (class Archive): Add included_member_ field.
7946         Initialize it in constructor.  Add input_file and searched_for
7947         methods.  Update declarations.
7948         (class Add_archive_symbols): Add dirpath_, dirindex_, and
7949         input_argument_ fields.  Add them to constructor.  Change all
7950         callers.
7951         * script.cc: Include "target-select.h".
7952         (class Parser_closure): Add skip_on_incompatible_target_ and
7953         found_incompatible_target_ fields.  Add
7954         skip_on_incompatible_target parameter to constructor.  Change all
7955         callers.  Add methods skip_on_incompatible_target,
7956         clear_skip_on_incompatible_target, found_incompatible_target, and
7957         set_found_incompatible_target.
7958         (read_input_script): Add dirindex parameter.  Change all callers.
7959         If parser finds an incompatible target, requeue Read_symbols
7960         task.
7961         (script_set_symbol): Clear skip_on_incompatible_target in
7962         closure.
7963         (script_add_assertion, script_parse_option): Likewise.
7964         (script_start_sections, script_add_phdr): Likewise.
7965         (script_check_output_format): New function.
7966         * script.h (read_input_script): Update declaration.
7967         * script-c.h (script_check_output_format): Declare.
7968         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7969         (ignore_cmd): Remove OUTPUT_FORMAT.
7970         * fileread.cc (Input_file::Input_file): Add explicit this.
7971         (Input_file::will_search_for): New function.
7972         (Input_file::open): Add pindex parameter.  Change all callers.
7973         * fileread.h (class Input_file): Add input_file_argument method.
7974         Declare will_search_for.  Update declarations.
7975         * object.cc (make_elf_object): Add punconfigured parameter.
7976         Change all callers.
7977         * object.h (class Object): Make input_file public.  Add
7978         searched_for method.
7979         (make_elf_object): Update declaration.
7980         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
7981         restart search.
7982         * dirsearch.h (class Dirsearch): Update declaration.
7983         * options.h (class General_options): Add --warn-search-mismatch.
7984         * parameters.cc (Parameters::is_compatible_target): New function.
7985         * parameters.h (class Parameters): Declare is_compatible_target.
7986         * workqueue.cc (Workqueue::add_blocker): New function.
7987         * workqueue.h (class Workqueue): Declare add_blocker.
7988
7989         * fileread.cc (Input_file::open): Remove options parameter.
7990         Change all callers.
7991         (Input_file::open_binary): Likewise.
7992         * script.cc (read_input_script): Likewise.
7993         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
7994         options parameter from constructor.  Change all callers.
7995         (class Read_script): Likewise.
7996         * fileread.h (class Input_file): Update declarations.
7997         * script.h (read_input_script): Update declaration.
7998
7999 2009-03-10  Nick Clifton  <nickc@redhat.com>
8000
8001         * po/es.po: New Spanish translation.
8002
8003 2009-03-06  Cary Coutant  <ccoutant@google.com>
8004
8005         * options.cc (parse_short_option): Keep dash_z from registering itself.
8006
8007 2009-03-03  Ian Lance Taylor  <iant@google.com>
8008
8009         PR 9918
8010         * target-reloc.h (relocate_section): Pass output_section to
8011         relocate.
8012         * i386.cc (Target_i386::should_apply_static_reloc): Add
8013         output_section parameter.  Change all callers.
8014         (Target_i386::Relocate::relocate): Add output_section parameter.
8015         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8016         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8017         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8018         * testsuite/two_file_shared.sh: New script.
8019         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8020         (check_DATA): Add two_file_shared.dbg.
8021         (two_file_shared.dbg): New target.
8022         * testsuite/Makefile.in: Rebuild.
8023
8024 2009-03-01  Ian Lance Taylor  <iant@google.com>
8025
8026         * configure.ac: Check for byteswap.h.
8027         * configure: Rebuild.
8028         * config.in: Rebuild.
8029
8030 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
8031
8032         * layout.cc (Layout::find_or_add_kept_section): New function.
8033         (Layout::add_comdat): Removed.
8034         * layout.h (struct Kept_section): Move out of class Layout.
8035         Remove trailing underscores from field names.  Add group_sections
8036         field.  Rename group_ field to is_group.  Change all uses.
8037         (class Layout): Declare find_or_add_kept_section, not add_comdat.
8038         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8039         comdat_groups_ field.
8040         (Sized_relobj::include_section_group): Use
8041         find_or_add_kept_section and Kept_section::group_sections.
8042         (Sized_relobj::include_linkonce_section): Likewise.
8043         * object.cc (class Sized_relobj): Don't define Comdat_group or
8044         Comdat_group_table.  Remove find_comdat_group and
8045         add_comdat_group.  Remove comdat_groups_ field.
8046         * plugin.cc (include_comdat_group): Use
8047         Layout::find_or_add_kept_section.
8048
8049 2009-02-28  Ian Lance Taylor  <iant@google.com>
8050
8051         * README: --gc-sections and map files are now supported.  Document
8052         some build requirements.
8053
8054         PR 6992
8055         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8056         relocatable link set the value of the section symbol to zero.
8057         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8058         relocatable link don't include the section address in the local
8059         symbol value.
8060
8061 2009-02-27  Ian Lance Taylor  <iant@google.com>
8062
8063         PR 6811
8064         * options.h (class Search_directory): Add is_system_directory.
8065         (class General_options): Declare is_in_system_directory.
8066         * options.cc (get_relative_sysroot): Make static.
8067         (get_default_sysroot): Make static.
8068         (General_optoins::is_in_system_directory): New function.
8069         * fileread.cc (Input_file::is_in_system_directory): New function.
8070         * fileread.h (class Input_file): Declare is_in_system_directory.
8071         * object.h (class Object): Add is_in_system_directory.
8072         (class Input_objects): Remove system_library_directory_ field.
8073         * object.cc (Input_objects::add_object): Don't set
8074         system_library_directory_.
8075         (input_objects::found_in_system_library_directory): Remove.
8076         * symtab.cc (Symbol_table::write_globals): Remove input_objects
8077         parameter.  Change all callers.
8078         (Symbol_table::sized_write_globals): Likewise.
8079         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8080         Call Object::is_in_system_directory.
8081         * symtab.h (class Symbol_table): Update declarations.
8082
8083         PR 5990
8084         * descriptors.h (Open_descriptor): Add is_on_stack field.
8085         * descriptors.cc (Descriptors::open): If the descriptor is on the
8086         top of the stack, remove it.  Initialize is_on_stack field.
8087         (Descriptors::release): Only add pod to stack if it is not on the
8088         stack already.
8089         (Descriptors::close_some_descriptor): Clear stack_next and
8090         is_on_stack fields.
8091
8092         PR 7091
8093         * output.cc (Output_section::find_starting_output_address): Rename
8094         from starting_output_address; add PADDR parameter; change return
8095         type.
8096         * output.h (class Output_section): Declare
8097         find_starting_output_address instead of starting_output_address.
8098         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8099         section symbol for which we can't find a merge section.
8100
8101         PR 9836
8102         * symtab.cc (Symbol_table::add_from_object): If the visibility is
8103         hidden or internal, force the symbol to be local.
8104         * resolve.cc (Symbol::override_visibility): Define.
8105         (Symbol::override_base): Use override_visibility.
8106         (Symbol_table::resolve): Likewise.
8107         (Symbol::override_base_with_special): Likewise.
8108         (Symbol_table::override_with_special): If the visibility is hidden
8109         or internal, force the symbol to be local.
8110         * symtab.h (class Symbol): Add set_visibility and
8111         override_visibility.
8112         * testsuite/ver_test_1.sh: New file.
8113         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8114         (check_DATA): Add ver_test_1.syms.
8115         (ver_test_1.syms): New target.
8116         * testsuite/Makefile.in: Rebuild.
8117
8118 2009-02-25  Cary Coutant  <ccoutant@google.com>
8119
8120         * layout.cc (Layout::choose_output_section): Don't rename sections
8121         when using a linker script that has a SECTIONS clause.
8122         * Makefile.in: Regenerate.
8123
8124         * testsuite/Makefile.am (script_test_5.sh): New test case.
8125         * testsuite/Makefile.in: Regenerate.
8126         * testsuite/script_test_5.cc: New file.
8127         * testsuite/script_test_5.sh: New file.
8128         * testsuite/script_test_5.t: New file.
8129
8130 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
8131
8132         * archive.cc (Archive::include_member): Update calls to add_symbols.
8133         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8134         the Layout argument.
8135         * dynobj.h (do_add_symbols): Add the Layout argument.
8136         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8137         Layout argument.
8138         * object.h (Object::add_symbols): Add the Layout argument.
8139         (Object::do_add_symbols): Add the Layout argument.
8140         (Sized_relobj::do_add_symbols): Add the Layout argument.
8141         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8142         Unify the two versions.
8143         (Add_plugin_symbols): Remove.
8144         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8145         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8146         (Add_plugin_symbols): Remove.
8147         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8148         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8149         (Add_symbols::run): Make it work with Pulginobj.
8150
8151 2009-02-06  Ian Lance Taylor  <iant@google.com>
8152
8153         * object.cc (Sized_relobj::do_layout): Make info message start
8154         with lower case letter.
8155
8156 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8157
8158         * binary.cc: Fix file comment.
8159
8160         * options.h (enum Incremental_disposition): Define.
8161         (class General_options): Add new options: --incremental,
8162         --incremental_changed, --incremental_unchanged,
8163         --incremental_unknown.  Add incremental_disposition_ and
8164         implicit_incremental_ fields.
8165         (General_options::incremental_disposition): New function.
8166         (class Position_dependent_options): Add incremental_disposition
8167         option.
8168         (Position_dependent_options::copy_from_options): Set incremental
8169         dispositions.
8170         * options.cc (General_options::parse_incremental_changed): New
8171         function.
8172         (General_options::parse_incremental_unchanged): New function.
8173         (General_options::parse_incremental_unknown): New function.
8174         (General_options::General_options): Initialize new fields
8175         incremental_disposition_ and implicit_incremental_.
8176         (General_options::finalize): Check for uasge of --incremental-*
8177         without --incremental.
8178
8179 2009-02-06  Chris Demetriou  <cgd@google.com>
8180
8181         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8182         pointer and to report location as the file name associated with
8183         the symbol.
8184         (gold_undefined_symbol_at_location): New function to replace the
8185         old gold_undefined_symbol functionality.
8186         * target-reloc.h (relocate_section): Update to use
8187         gold_undefined_symbol_at_location.
8188         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8189         Call gold_undefined_symbol function rather than gold_error.
8190         * errors.h (Errors::undefined_symbol): Take location as a
8191         string, rather than calculating it from a relocation.
8192         * errors.cc (Errors::fatal): Print "fatal error:" before the
8193         formatted message.
8194         (Errors::error, Errors::error_at_location): Print "error: "
8195         before the formatted message.
8196         (Errors::undefined_symbol): Take location as a string, rather
8197         than calculating it from a relocation.
8198         (gold_undefined_symbol_at_location): New function akin to
8199         old gold_undefined_symbol, calculates location from relocation.
8200         (gold_undefined_symbol): Change to take only a Symbol pointer
8201         and to report location as the file name associated with the symbol.
8202         * testsuite/debug_msg.sh: Update for changed error messages.
8203         * testsuite/undef_symbol.sh: Likewise.
8204
8205 2009-02-04  Duncan Sands  <baldrick@free.fr>
8206
8207         PR 9812
8208         * reduced_debug_output.h
8209         (Output_reduced_debug_abbrev_section::failed): Use format for
8210         gold_warning.
8211         (Output_reduced_debug_info_section::faild): Likewise.
8212
8213 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8214
8215         * script.cc (Lazy_demangler): New class.
8216         (Version_script_info::get_symbol_version_helper): Demangle a
8217         symbol only once.
8218
8219 2009-01-29  Cary Coutant  <ccoutant@google.com>
8220
8221         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8222         to __tls_get_addr.
8223         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8224
8225 2009-01-28  Ian Lance Taylor  <iant@google.com>
8226
8227         * version.cc (version_string): Bump to 1.9.
8228
8229         * gold.h: Include <cstring> and <stdint.h>.
8230         * version.cc: Include <cstdio>.
8231         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8232         warning.
8233         * reduced_debug_output.cc (insert_into_vector): Rename from
8234         Insert_into_vector; change all callers.  Use Swap_unaligned to
8235         avoid aliasing issue; remove union since it is unnecessary.
8236
8237 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8238
8239         * Makefile.am (CCFILES): Add gc.cc.
8240         (HFILES): Add gc.h.
8241         * Makefile.in: Regenerate.
8242         * gold.cc (Gc_runner): New class.
8243         (queue_initial_tasks): Call garbage collection related tasks
8244         when corresponding options are invoked.
8245         (queue_middle_gc_tasks): New function.
8246         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8247         processed early before laying out sections during garbage collection.
8248         * gold.h (queue_middle_gc_tasks): New function.
8249         (is_prefix_of): Move from "layout.cc".
8250         * i386.cc (Target_i386::gc_process_relocs): New function.
8251         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8252         * main.cc (main): Create object of class "Garbage_collection".
8253         * object.cc (Relobj::copy_symbols_data): New function.
8254         (Relobj::is_section_name_included): New function.
8255         (Sized_relobj::do_layout): Allow this function to be called twice
8256         during garbage collection and defer layout of section during the
8257         first call.
8258         * object.h (Relobj::get_symbols_data): New function.
8259         (Relobj::is_section_name_included): New function.
8260         (Relobj::copy_symbols_data): New function.
8261         (Relobj::set_symbols_data): New function.
8262         (Relobj::get_relocs_data): New function.
8263         (Relobj::set_relocs_data): New function.
8264         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8265         (Relobj::gc_process_relocs): New function.
8266         (Relobj::do_gc_process_relocs): New pure virtual function.
8267         (Relobj::sd_): New data member.
8268         (Sized_relobj::is_output_section_offset_invalid): New function.
8269         (Sized_relobj::do_gc_process_relocs): New function.
8270         * options.h (General_options::gc_sections): Modify to not be a no-op.
8271         (General_options::print_gc_sections): New option.
8272         * plugin.cc (Plugin_finish::run): Remove function call to
8273         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8274         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8275         * reloc.cc (Read_relocs::run): Add task to process relocs and
8276         determine unreferenced sections when doing garbage collection.
8277         (Gc_process_relocs): New class.
8278         (Sized_relobj::do_gc_process_relocs): New function.
8279         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8280         sections that are garbage collected.
8281         * reloc.h (Gc_process_relocs): New class.
8282         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8283         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8284         symbols whose corresponding sections are garbage collected.
8285         (Symbol_table::Symbol_table): Add new parameter for the garbage
8286         collection object.
8287         (Symbol_table::gc_mark_undef_symbols): New function.
8288         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8289         (Symbol_table::gc_mark_dyn_syms): New function.
8290         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8291         as garbage.
8292         (Symbol_table::add_from_object): Likewise.
8293         (Symbol_table::add_from_relobj): When building shared objects, do not
8294         treat externally visible symbols as garbage.
8295         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8296         table information for static and relocatable links.
8297         * symtab.h (Symbol_table::set_gc): New function.
8298         (Symbol_table::gc): New function.
8299         (Symbol_table::gc_mark_undef_symbols): New function.
8300         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8301         (Symbol_table::gc_mark_dyn_syms): New function.
8302         (Symbol_table::gc_): New data member.
8303         * target.h (Sized_target::gc_process_relocs): New pure virtual
8304         function.
8305         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8306         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8307
8308 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8309
8310         * options.h (General_options::gc_sections): Define as a no-op for now.
8311         (General_options::no_keep_memory): Ditto.
8312         (General_options::Bshareable): Define.
8313         * options.cc (General_options::finalize): Honor -Bshareable.
8314
8315 2009-01-20  Andreas Schwab  <schwab@suse.de>
8316
8317         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8318         read the value in the contents, since we don't use it.  Use the
8319         template endianness when writing.
8320         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8321
8322 2009-01-19  Andreas Schwab  <schwab@suse.de>
8323
8324         * configure.tgt (powerpc64-*): Fix targ_obj.
8325
8326 2009-01-15  Ian Lance Taylor  <iant@google.com>
8327
8328         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8329         local symbols when stripping all symbols.
8330
8331 2009-01-14  Cary Coutant  <ccoutant@google.com>
8332
8333         * output.cc (Output_reloc): Add explicit instantiations.
8334
8335 2009-01-14  Cary Coutant  <ccoutant@google.com>
8336
8337         * archive.cc (Archive::get_elf_object_for_member): Remove call
8338         to File_read::claim_for_plugin.
8339         * descriptors.cc (Descriptors::open): Remove reference to
8340         is_claimed.
8341         (Descriptors::claim_for_plugin): Remove.
8342         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8343         (Descriptors::is_claimed): Remove.
8344         (claim_descriptor_for_plugin): Remove.
8345         * fileread.cc (File_read::claim_for_plugin): Remove.
8346         * fileread.h (File_read::claim_for_plugin): Remove.
8347         (File_read::descriptor): Reopen descriptor if necessary.
8348         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8349         (Plugin_manager::all_symbols_read): Add task parameter. Change
8350         all callers.
8351         (Plugin_manager::get_input_file): New function.
8352         (Plugin_manager::release_input_file): New function.
8353         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8354         corresponding data member.
8355         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8356         and pass to base constructor. Change all callers.
8357         (get_input_file, release_input_file): New functions.
8358         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8359         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8360         (Plugin_manager::all_symbols_read): Add task parameter.
8361         (Plugin_manager::get_input_file): New function.
8362         (Plugin_manager::release_input_file): New function.
8363         (Plugin_manager::task_): New data member.
8364         (Pluginobj::Pluginobj): Add filesize parameter.
8365         (Pluginobj::filename): New function.
8366         (Pluginobj::descriptor): New function.
8367         (Pluginobj::filesize): New function.
8368         (Pluginobj::filesize_): New data member.
8369         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8370         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8371         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8372
8373         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8374         with archive libraries.
8375         * testsuite/Makefile.in: Regenerate.
8376         * testsuite/plugin_test.c (struct sym_info): New type.
8377         (get_input_file, release_input_file): New static variables.
8378         (onload): Capture new transfer vector entries.
8379         (claim_file_hook): Stop reading at end of file according to filesize.
8380         Factor out parsing of readelf output into separate function.
8381         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8382         APIs and get the source file name from the symbol table.  Convert
8383         source file name to corresponding object file name.  Print info
8384         message when adding new input files.
8385         (parse_readelf_line): New function.
8386         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8387         * testsuite/plugin_test_2.sh: Likewise.
8388         * testsuite/plugin_test_3.sh: Likewise.
8389         * testsuite/plugin_test_4.sh: New test case.
8390
8391 2009-01-07  Ian Lance Taylor  <iant@google.com>
8392
8393         * version.cc (version_string): Bump to 1.8.
8394
8395 2008-12-23  Cary Coutant  <ccoutant@google.com>
8396
8397         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8398         * plugin.cc (Plugin_manager::finish): Rename as
8399         layout_deferred_objects.  Move cleanup to separate function.
8400         (Plugin_manager::cleanup): New function.
8401         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8402         separately.
8403         * plugin.h (Plugin_manager::finish): Rename as
8404         layout_deferred_objects.
8405         (Plugin_manager::cleanup): New function.
8406         (Plugin_manager::cleanup_done): New field.
8407
8408 2008-12-23  Cary Coutant  <ccoutant@google.com>
8409
8410         * plugin.cc (is_visible_from_outside): New function.
8411         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8412         so we don't return "IR only" status for exported symbols or -r links.
8413
8414         * testsuite/Makefile.am (plugin_test_3): New test case.
8415         * testsuite/Makefile.in: Regenerate.
8416         * testsuite/plugin_test_3.sh: New file.
8417
8418 2008-12-22  Cary Coutant  <ccoutant@google.com>
8419
8420         * object.cc (Sized_relobj::layout_section): New function.
8421         (Sized_relobj::do_layout): Defer layout of input sections until after
8422         plugin has provided replacement files.
8423         (Sized_relobj::do_layout_deferred_sections): New function.
8424         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8425         (Relobj::layout_deferred_sections): New function.
8426         (Relobj::do_layout_deferred_sections): New function.
8427         (Sized_relobj::do_layout_deferred_sections): New function.
8428         (Sized_relobj::layout_section): New function.
8429         (Sized_relobj::Deferred_layout): New structure.
8430         (Sized_relobj::deferred_layout_): New field.
8431         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8432         Change all callers.  Layout deferred sections.
8433         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8434         references.
8435         (Plugin_hook::run): Move code from do_plugin_hook inline.
8436         (Plugin_hook::do_plugin_hook): Remove.
8437         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8438         (Plugin_manager::finish): Renamed, was cleanup.
8439         (Plugin_manager::should_defer_layout): New function.
8440         (Plugin_manager::add_deferred_layout_object): New function.
8441         (Plugin_manager::Deferred_layout_list): New type.
8442         (Plugin_manager::deferred_layout_objects_): New field.
8443         (Plugin_hook::do_plugin_hook): Remove.
8444
8445 2008-12-17  Ian Lance Taylor  <iant@google.com>
8446
8447         * options.h (class General_options): Add --no case for
8448         --export-dynamic.
8449
8450 2008-12-16  Cary Coutant  <ccoutant@google.com>
8451
8452         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8453         vector.
8454         (Plugin_manager::claim_file): Create plugin object even if
8455         plugin did not call the add_symbols callback.
8456         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8457         asking for more symbols than were added.
8458         * testsuite/Makefile.am (plugin_test_1): Add test case with
8459         no global symbols.
8460         (empty.syms): New target.
8461         * testsuite/Makefile.in: Regenerate.
8462         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8463         message. Don't call add_symbols if no globals.
8464         (all_symbols_read_hook): Don't provide replacement for empty
8465         claimed file.
8466
8467 2008-12-12  Ian Lance Taylor  <iant@google.com>
8468
8469         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8470         r_type == 0 for a local symbol with r_sym == 0.
8471         (scan_relocatable_relocs): Pass r_sym to
8472         local_non_section_strategy.
8473         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8474         r_sym parameter.
8475
8476         * configure.ac: Update test for TLS descriptors: they are
8477         supported as of glibc 2.9.
8478         * configure: Rebuild.
8479
8480 2008-12-11  Ian Lance Taylor  <iant@google.com>
8481
8482         PR 7091
8483         * target-reloc.h (Default_scan_relocatable_relocs): For each
8484         function, map r_type == 0 to RELOC_DISCARD.
8485
8486 2008-12-10  Cary Coutant  <ccoutant@google.com>
8487
8488         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8489         object to override a kept COMDAT group from a plugin object.
8490
8491 2008-12-09  Ian Lance Taylor  <iant@google.com>
8492
8493         PR 7088
8494         * yyscript.y (file_cmd): Handle INPUT.
8495
8496         * testsuite/initpri1.c: Change all declarations to be full
8497         prototypes by adding void, to avoid compiler warnings.
8498
8499 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8500
8501         * options.cc (General_options::parse_plugin_opt): New.
8502         (General_options::add_plugin): The argument now is just the filename.
8503         (General_options::add_plugin_option): New.
8504         * options.h (plugin_opt): New.
8505         (add_plugin): Change argument name.
8506         (add_plugin_option): New.
8507         * plugin.cc (Plugin::load): Don't parse the plugin option.
8508         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8509         (Plugin::add_option): New.
8510         (Plugin::args_): Change type.
8511         (Plugin::filename_): New.
8512         (Plugin_manager::add_plugin_option): New.
8513         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8514         * testsuite/Makefile.in: Regenerate.
8515
8516 2008-12-05  Cary Coutant  <ccoutant@google.com>
8517
8518         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8519         Handle --strip-lto-sections option.
8520         * options.h (strip_lto_sections): New option.
8521
8522 2008-12-01  Cary Coutant  <ccoutant@google.com>
8523
8524         * plugin.cc (ld_plugin_message): Change format parameter to const.
8525         Fix mismatch between new[] and delete.
8526
8527 2008-11-14  Cary Coutant  <ccoutant@google.com>
8528
8529         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8530         instead of -1U.
8531
8532 2008-11-05  Craig Silverstein  <csilvers@google.com>
8533
8534         * options.cc (General_options::parse_dynamic_list): New function.
8535         * options.h (General_options): New flags dynamic_list,
8536         dynamic_list_data, dynamic_list_cpp_new, and
8537         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8538         (General_options::in_dynamic_list): New function.
8539         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8540         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8541         (Lex::can_continue_name): Likewise.
8542         (yylex): Likewise.
8543         (read_script_file): New parameter script_options.
8544         (read_dynamic_list): New function.
8545         (Script_options::define_dynamic_list): New function.
8546         (dynamic_list_keyword_parsecodes): New variable.
8547         (dynamic_list_keywords): New variable.
8548         * script.h (Script_options::define_dynamic_list): New function
8549         prototype.
8550         (read_dynamic_list): New function prototype.
8551         * symtab.cc (strprefix): New macro.
8552         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8553         dynamic_list_data, dynamic_list_cpp_new, and
8554         dynamic_list_cpp_typeinfo.
8555         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8556         (dynamic_list_expr): New rule.
8557         (dynamic_list_nodes): Likewise.
8558         (dynamic_list_node): Likewise.
8559         * testsuite/Makefile.am (dynamic_list): New test.
8560         * testsuite/Makefile.in: Regenerated.
8561         * testsuite/dynamic_list.t: New file.
8562         * testsuite/dynamic_list.sh: New file.
8563
8564 2008-11-05  Craig Silverstein  <csilvers@google.com>
8565
8566         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8567         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8568         (t11_last): Likewise.
8569         * testsuite/ver_test_6.c (main): Likewise.
8570
8571 2008-10-07  Cary Coutant  <ccoutant@google.com>
8572
8573         * options.c (General_options::finalize): Add check for -static and
8574         -shared.
8575         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8576         is not empty.
8577
8578 2008-10-02  Cary Coutant  <ccoutant@google.com>
8579
8580         * plugin.cc (make_sized_plugin_object): Fix conditional
8581         compilation to work when not all targets are enabled.
8582
8583 2008-09-29  Cary Coutant  <ccoutant@google.com>
8584
8585         * archive.cc (Archive::get_file_and_offset): Use filename instead
8586         of name to get library path.
8587         (Archive::include_member): Unlock external member of a thin archive.
8588
8589         * testsuite/Makefile.am (TEST_AR): New variable.
8590         (thin_archive_test_1): New test.
8591         (thin_archive_test_2): New test.
8592         * testsuite/Makefile.in: Regenerate.
8593         * testsuite/thin_archive_main.cc: New file.
8594         * testsuite/thin_archive_test_1.cc: New file.
8595         * testsuite/thin_archive_test_2.cc: New file.
8596         * testsuite/thin_archive_test_3.cc: New file.
8597         * testsuite/thin_archive_test_4.cc: New file.
8598
8599 2008-09-29  Cary Coutant  <ccoutant@google.com>
8600
8601         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8602         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8603         instead of -1U.
8604         (Sized_relobj::do_finalize_local_symbols): Likewise.
8605         (Sized_relobj::map_to_kept_section): Likewise.
8606         * object.h (Sized_relobj::invalid_address): New constant.
8607         (Sized_relobj::do_output_section_offset): Check for invalid_address
8608         and return -1ULL.
8609         * output.cc (Output_reloc::local_section_offset): Use constant
8610         invalid_address instead of -1U.
8611         (Output_reloc::get_address): Likewise.
8612         (Output_section::output_address): Change -1U to -1ULL.
8613         * output.h (Output_reloc::invalid_address): New constant.
8614         * reloc.cc (Sized_relobj::write_sections): Use constant
8615         invalid_address instead of -1U.
8616         (Sized_relobj::relocate_sections): Likewise.
8617         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8618         values for merge sections.
8619         * target-reloc.h (relocate_for_relocatable): Use constant
8620         invalid_address instead of -1U.
8621
8622 2008-09-19  Cary Coutant  <ccoutant@google.com>
8623
8624         Add plugin functionality for link-time optimization (LTO).
8625         * configure.ac (plugins): Add --enable-plugins option.
8626         * configure: Regenerate.
8627         * config.in: Regenerate.
8628         * Makefile.am (LIBDL): New variable.
8629         (CCFILES): Add plugin.cc.
8630         (HFILES): Add plugin.h.
8631         (ldadd_var): Add LIBDL.
8632         * Makefile.in: Regenerate.
8633
8634         * archive.cc: Include "plugin.h".
8635         (Archive::setup): Don't preread archive symbols when using a plugin.
8636         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8637         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8638         files.
8639         (Archive::include_member): Add symbols from plugin objects.
8640         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8641         * descriptors.cc (Descriptors::open): Check for file descriptors
8642         abandoned by plugins.
8643         (Descriptors::claim_for_plugin): New function.
8644         * descriptors.h (Descriptors::claim_for_plugin): New function.
8645         (Open_descriptor::is_claimed): New field.
8646         (claim_descriptor_for_plugin): New function.
8647         * fileread.cc (File_read::claim_for_plugin): New function.
8648         * fileread.h (File_read::claim_for_plugin): New function.
8649         (File_read::descriptor): New function.
8650         * gold.cc: Include "plugin.h".
8651         (queue_initial_tasks): Add task to call plugin hooks for generating
8652         new object files.
8653         * main.cc: Include "plugin.h".
8654         (main): Load plugin libraries.
8655         * object.h (Pluginobj): Declare.
8656         (Object::pluginobj): New function.
8657         (Object::do_pluginobj): New function.
8658         (Object::set_target): New function.
8659         * options.cc: Include "plugin.h".
8660         (General_options::parse_plugin): New function.
8661         (General_options::General_options): Initialize plugins_ field.
8662         (General_options::add_plugin): New function.
8663         * options.h (Plugin_manager): Declare.
8664         (General_options): Add --plugin option.
8665         (General_options::has_plugins): New function.
8666         (General_options::plugins): New function.
8667         (General_options::add_plugin): New function.
8668         (General_options::plugins_): New field.
8669         * plugin.cc: New file.
8670         * plugin.h: New file.
8671         * readsyms.cc: Include "plugin.h".
8672         (Read_symbols::do_read_symbols): Check for archive before checking
8673         for ELF file.  Call plugin hooks to claim files.
8674         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8675         from a real object file; force override when processing replacement
8676         files.
8677         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8678         (Symbol::init_base_object): Likewise.
8679         (Symbol::init_base_output_data): Likewise.
8680         (Symbol::init_base_output_segment): Likewise.
8681         (Symbol::init_base_constant): Likewise.
8682         (Symbol::init_base_undefined): Likewise.
8683         (Symbol::output_section): Assert that object is not a plugin.
8684         (Symbol_table::add_from_pluginobj): New function.
8685         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8686         undefined.
8687         (Symbol_table::sized_write_globals): Likewise.
8688         (Symbol_table::add_from_pluginobj): Instantiate template.
8689         * symtab.h (Sized_pluginobj): Declare.
8690         (Symbol::in_real_elf): New function.
8691         (Symbol::set_in_real_elf): New function.
8692         (Symbol::in_real_elf_): New field.
8693         (Symbol_table::add_from_pluginobj): New function.
8694
8695         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8696         (LIBDL): New variable.
8697         (LDADD): Add LIBDL.
8698         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8699         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8700         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8701         (MOSTLYCLEANFILES): Likewise.
8702         * testsuite/Makefile.in: Regenerate.
8703         * testsuite/plugin_test.c: New file.
8704         * testsuite/plugin_test_1.sh: New file.
8705         * testsuite/plugin_test_2.sh: New file.
8706
8707 2008-09-16  Ian Lance Taylor  <iant@google.com>
8708
8709         * target-reloc.h (relocate_section): Check whether a symbol is
8710         defined by the ABI before reporting an undefined symbol error.
8711         * target.h (Target::is_defined_by_abi): Make parameter const.
8712         (Target::do_is_defined_by_abi): Likewise.
8713         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8714         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8715         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8716         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8717         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8718         * testsuite/Makefile.in: Rebuild.
8719
8720         * fileread.cc (make_view): Add casts to avoid warning.
8721
8722 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8723
8724         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8725         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8726
8727 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8728
8729         * options.h (General_options::output_is_executable): New.
8730         (General_options::output_is_pie): New.
8731         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8732         for shared libraries.
8733         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8734
8735 2008-09-11  Chris Demetriou  <cgd@google.com>
8736
8737         * options.h (origin): New -z option.
8738         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8739         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8740         in DT_FLAGS_1.
8741
8742 2008-09-05  Cary Coutant  <ccoutant@google.com>
8743
8744         * fileread.cc (File_read::make_view): Add check for attempt to map
8745         beyond end of file.
8746
8747 2008-09-05  Cary Coutant  <ccoutant@google.com>
8748
8749         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8750         explicit instantiations.
8751
8752 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
8753
8754         PR gold/6858
8755         * options.cc (General_options::finalize): Allow undefined symbols
8756         in shlibs if linking -shared.
8757
8758         PR gold/6859
8759         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8760         symbols as not needing a dynsym entry.
8761
8762 2008-08-20  Craig Silverstein  <csilvers@google.com>
8763
8764         * fileread.cc (File_read::open): Do not lock the file unless it
8765         was successfully opened.
8766
8767 2008-08-14  Cary Coutant  <ccoutant@google.com>
8768
8769         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8770         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8771         * testsuite/tls_test.cc (struct int128): 128-bit struct
8772         for testing TLS relocs with non-zero addend.
8773         (v12): New TLS variable.
8774         (t12): New test.
8775         (t_last): Add check for v12.
8776         * testsuite/tls_test.h (t12): New function.
8777         * testsuite/tls_test_main.cc (thread_routine): Call new test.
8778
8779 2008-08-13  Ian Lance Taylor  <iant@google.com>
8780
8781         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8782         set tls_segment_ or relro_segment_.
8783         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8784         when appropriate.
8785         * output.h (Output_section::clear_is_relro): New function.
8786         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8787         sections specially even when output_data_ is empty.
8788         (Output_segment::maximum_alignment): When first section is relro,
8789         only force alignment for PT_LOAD segments.
8790         * script.cc (script_data_segment_align): New function.
8791         (script_data_segment_relro_end): New function.
8792         * script-c.h (script_data_segment_align): Declare.
8793         (script_data_segment_relro_end): Declare.
8794         * script-sections.h (class Script_sections): Declare
8795         data_segment_align and data_segment_relro_end.  Add fields
8796         segment_align_index_ and saw_relro_end_.
8797         * script-sections.cc (class Sections_element): Add set_is_relro
8798         virtual function.  Add new bool* parameter to place_orphan_here.
8799         Add get_output_section virtual function.
8800         (class Output_section_definition): Add set_is_relro.  Add new
8801         bool* parameter to place_orphan_here.  Add get_output_section.
8802         Add is_relro_ field.
8803         (Output_section_definition::Output_section_definition): Initialize
8804         evaluated_address_, evaluated_load_address, evaluated_addralign_,
8805         and is_relro_ fields.
8806         (Output_section_definition::place_orphan_here): Add is_relro
8807         parameter.
8808         (Output_section_definition::set_section_addresses): Set relro for
8809         output section.
8810         (Output_section_definition::alternate_constraint): Likewise.
8811         (class Orphan_output_section): Add new bool* parameter to
8812         place_orphan_here.  Add get_output_section.
8813         (Orphan_output_section::place_orphan_here): Add is_relro
8814         parameter.
8815         (Script_sections::Script_sections): Initialize
8816         data_segment_align_index_ and saw_relro_end_.
8817         (Script_sections::data_segment_align): New function.
8818         (Script_sections::data_segment_relro_end): New function.
8819         (Script_sections::place_orphan): Set or clear is_relro.
8820         (Script_sections::set_section_addresses): Force alignment of first
8821         TLS section.
8822         * yyscript.y (exp): Call script_data_segment_align and
8823         script_data_segment_relro_end.
8824         * testsuite/relro_script_test.t: New file.
8825         * testsuite/relro_test.cc (using_script): Declare.
8826         (t1, t2): Test using_script.
8827         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8828         (relro_script_test_SOURCES): Define.
8829         (relro_script_test_DEPENDENCIES): Define.
8830         (relro_script_test_LDFLAGS): Define.
8831         (relro_script_test_LDADD): Define.
8832         (relro_script_test.so): New target.
8833         * testsuite/Makefile.in: Rebuild.
8834
8835 2008-08-06  Cary Coutant <ccoutant@google.com>
8836
8837         * archive.cc (Archive::total_archives, Archive::total_members)
8838         (Archive::total_members_loaded): New variables.
8839         (Archive::setup): Add parameter.  Add option to preread
8840         archive symbols.
8841         (Archive::read_armap): Add counter.
8842         (Archive::get_file_and_offset): New function.
8843         (Archive::get_elf_object_for_member): New function.
8844         (Archive::read_all_symbols): New function.
8845         (Archive::read_symbols): New function.
8846         (Archive::add_symbols): Add counters.
8847         (Archive::include_all_members): Use armap to find members if it's
8848         already built.
8849         (Archive::include_member): Skip reading symbols if already read.
8850         Factored code into Archive::get_file_and_offset and
8851         Archive::get_elf_object_for_member.  Changed call to
8852         Mapfile::report_include_archive_member.
8853         (Archive::print_stats): New function.
8854         * archive.h: Declare Object and Read_symbols_data classes.
8855         (Archive::Archive): Add initializers for new members.
8856         (Archive::setup): Add parameter.
8857         (Archive::print_stats): New function.
8858         (Archive::total_archives, Archive::total_members)
8859         (Archive::total_members_loaded): New variables.
8860         (Archive::get_file_and_offset): New function.
8861         (Archive::get_elf_object_for_member): New function.
8862         (Archive::read_all_symbols): New function.
8863         (Archive::read_symbols): New function.
8864         (Archive::Archive_member): New class.
8865         (Archive::members_): New member.
8866         (Archive::num_members_): New member.
8867         * main.cc: Include archive.h.
8868         (main): Call Archive::print_stats.
8869         * mapfile.cc (Mapfile::report_include_archive_member): Delete
8870         archive parameter; member_name is now the fully-decorated name.
8871         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8872         * options.h: (General_options): Add --preread-archive-symbols option.
8873         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8874         Archive::setup.
8875
8876 2008-08-04  Ian Lance Taylor  <iant@google.com>
8877
8878         * symtab.h (Symbol::use_plt_offset): New function.
8879         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8880         * powerpc.cc (Relocate::relocate): Likewise.
8881         * sparc.cc (Relocate::relocate): Likewise.
8882         * x86_64.cc (Relocate::relocate): Likewise.
8883         * testsuite/weak_plt.sh: New test.
8884         * testsuite/weak_plt_main.cc: New test.
8885         * testsuite/weak_plt_shared.cc: New test.
8886         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8887         (check_PROGRAMS): Add weak_plt.
8888         (check_DATA): Add weak_plt_shared.so.
8889         (weak_plt_main_pic.o, weak_plt): New targets.
8890         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8891         * testsuite/Makefile.in: Rebuild.
8892
8893         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8894         gcctestdir/ld.
8895         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8896         * testsuite/Makefile.in: Rebuild.
8897
8898 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
8899
8900         * Makefile.am (POTFILES.in): Set LC_ALL=C.
8901         * Makefile.in: Regenerate.
8902         * po/POTFILES.in: Regenerate.
8903
8904 2008-07-29  Ian Lance Taylor  <iant@google.com>
8905
8906         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8907         symbols before other symbols.
8908         * testsuite/script_test_2.cc (test_addr): Declare.
8909         (test_addr_alias): Declare.
8910         (main): Check that test_addr and test_addr_alias have the right
8911         values.
8912         * testsuite/script_test_2.t: Define test_addr_alias and
8913         test_addr.
8914
8915 2008-07-24  Ian Lance Taylor  <iant@google.com>
8916
8917         PR 5990
8918         * descriptors.cc: New file.
8919         * descriptors.h: New file.
8920         * gold-threads.h (class Hold_optional_lock): New class.
8921         * fileread.cc: Include "descriptors.h".
8922         (File_read::~File_read): Release descriptor rather than closing
8923         it.
8924         (File_read::open) [file]: Call open_descriptor rather than open.
8925         Set is_descriptor_opened_.
8926         (File_read::open) [memory]: Assert that descriptor is not open.
8927         (File_read::reopen_descriptor): New function.
8928         (File_read::release): Release descriptor.
8929         (File_read::do_read): Make non-const.  Reopen descriptor.
8930         (File_read::read): Make non-const.
8931         (File_read::make_view): Reopen descriptor.
8932         (File_read::do_readv): Likewise.
8933         * fileread.h (class File_read): Add is_descriptor_opened_ field.
8934         Update declarations.
8935         * layout.cc: Include "descriptors.h".
8936         (Layout::create_build_id): Use open_descriptor rather than open.
8937         * output.cc: Include "descriptors.h".
8938         (Output_file::open): Use open_descriptor rather than open.
8939         * archive.cc (Archive::const_iterator): Change Archive to be
8940         non-const.
8941         (Archive::begin, Archive::end): Make non-const.
8942         (Archive::count_members): Likewise.
8943         * archive.h (class Archive): Update declarations.
8944         * object.h (Object::read): Make non-const.
8945         * Makefile.am (CCFILES): Add descriptors.cc.
8946         (HFILES): Add descriptors.h.
8947         * Makefile.in: Rebuild.
8948
8949         PR 6716
8950         * gold.h: Always include <clocale>.  Add Solaris workarounds
8951         following code in binutils/sysdep.h.
8952
8953         PR 6048
8954         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8955         this->eh_frame_hdr_ is NULL before using it.
8956
8957         * dynobj.cc (Versions::Versions): Update comment.
8958
8959         * dynobj.cc (Versions::Versions): If there is an soname, use it as
8960         the base version name.
8961
8962         * stringpool.cc (Stringpool_template::add_with_length): Set key to
8963         array size plus one.
8964         (Stringpool_template::set_string_offsets): Subtract one from key
8965         before using it as an array index.
8966         (Stringpool_template::get_offset_with_length): Likewise.
8967         (Stringpool_template::write_to_buffer): Likewise.
8968         * stringpool.h (Stringpool_template::get_offset_from_key):
8969         Likewise.
8970
8971 2008-07-23  Ian Lance Taylor  <iant@google.com>
8972
8973         PR 6658
8974         * object.h (Merged_symbol_value::value): Do our best to handle a
8975         negative addend.
8976
8977         PR 6647
8978         * script.cc (Version_script_info::get_versions): Don't add empty
8979         version tag to return value.
8980         (Version_script_info::get_symbol_version_helper): Change return
8981         type to bool.  Add pversion parameter.  Change all callers.
8982         (script_register_vers_node): Don't require a non-NULL tag.
8983         * script.h (class Version_script_info): Update declarations.
8984         (Version_script_info::get_symbol_version): Change return type to
8985         bool.  Add version parameter.  Change all callers.
8986         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8987         handling.  Handle an empty version from a version script.
8988         (Symbol_table::define_special_symbol): Likewise.
8989         * testsuite/ver_test_10.script: New file.
8990         * testsuite/ver_test_10.sh: New file.
8991         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8992         (check_DATA): Add ver_test_10.syms.
8993         (ver_test_10.syms, ver_test_10.so): New target.
8994         * testsuite/Makefile.in: Rebuild.
8995
8996 2008-07-23  Simon Baldwin  <simonb@google.com>
8997
8998         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8999         to zero for undefined symbols from dynamic libraries.
9000
9001 2008-07-23  Ian Lance Taylor  <iant@google.com>
9002
9003         * symtab.cc (Symbol_table::resolve): Remove version parameter.
9004         Change all callers.
9005         * symtab.h (class Symbol_table): Update declaration.
9006         * testsuite/ver_test_9.cc: New file.
9007         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9008         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9009         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9010         (ver_test_9.so, ver_test_9.o): New targets.
9011         * testsuite/Makefile.in: Rebuild.
9012
9013 2008-07-22  Ian Lance Taylor  <iant@google.com>
9014
9015         * options.h (class General_options): Define --check-sections.
9016         * layout.cc (Layout::set_segment_offsets): Handle
9017         --check-sections.
9018
9019         * options.h (class General_options): Define -n/--nmagic and
9020         -N/--omagic.
9021         * options.cc (General_options::finalize): For -n/--nmagic or
9022         -N/--omagic, set -static.
9023         * layout.cc (Layout::attach_allocated_section_to_segment): If
9024         -N/--omagic, don't put read-only and read-write sections in
9025         different segments.
9026         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9027         finding a read-only segment.
9028         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9029         don't set the minimum segment alignment to the common page size,
9030         and don't set the file offset to the address modulo the page size.
9031         * script-sections.cc (Script_sections::create_segments): If
9032         -n/--omagic, don't put read-only and read-write sections in
9033         different segments.
9034
9035         * cref.cc: New file.
9036         * cref.h: New file.
9037         * options.h (class General_options): Add --print-symbol-counts.
9038         * main.cc (main): Issue defined symbol report if requested.
9039         * archive.cc (Archive::interpret_header): Make into a const member
9040         function.
9041         (Archive::add_symbols): Call Input_objects::archive_start and
9042         archive_stop.
9043         (Archive::const_iterator): Define new class.
9044         (Archive::begin, Archive::end): New functions.
9045         (Archive::include_all_members): Rewrite to use iterator.
9046         (Archive::count_members): New function.
9047         * archive.h (class Archive): Update declarations.
9048         (Archive::filename): New function.
9049         * object.cc: Include "cref.h".
9050         (Sized_relobj::Sized_relobj): Initialize defined_count_.
9051         (Sized_relobj::do_get_global_symbol_counts): New function.
9052         (Input_objects::add_object): Add object to cross-referencer.
9053         (Input_objects::archive_start): New function.
9054         (Input_objects::archive_stop): New function.
9055         (Input_objects::print_symbol_counts): New function.
9056         * object.h: Declare Cref and Archive.
9057         (Object::get_global_symbol_counts): New function.
9058         (Object::do_get_global_symbol_counts): New pure virtual function.
9059         (class Sized_relobj): Add defined_count_ field.  Update
9060         declarations.
9061         (class Input_objects): Add cref_ field.  Update constructor.
9062         Update declarations.
9063         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9064         defined_count_.
9065         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9066         symbol counts.
9067         (Sized_dynobj::do_get_global_symbol_counts): New function.
9068         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9069         defined_count_.  Update declarations.  Define Symbols typedef.
9070         * symtab.cc (Symbol_table::add_from_relobj): Add defined
9071         parameter.  Change all callers.
9072         (Symbol_table::add_from_dynobj): Add sympointers and defined
9073         parameters.  Change all callers.
9074         * symtab.h (class Symbol_table): Update declarations.
9075         * Makefile.am (CCFILES): Add cref.cc.
9076         (HFILES): Add cref.h.
9077         * Makefile.in: Rebuild.
9078
9079 2008-07-22  Simon Baldwin  <simonb@google.com>
9080
9081         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9082         to zero when writing undefined symbols.
9083
9084 2008-07-22  Ian Lance Taylor  <iant@google.com>
9085
9086         * output.cc (Output_section::add_input_section): Don't try to
9087         merge empty merge sections.
9088
9089 2008-07-21  Craig Silverstein  <csilvers@google.com>
9090
9091         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9092         Include symbol version in error message.
9093
9094 2008-07-20  Chris Demetriou  <cgd@google.com>
9095
9096         * configure.ac (gold_cv_c_random_seed): New configured variable.
9097         (RANDOM_SEED_CFLAGS): New substituted variable.
9098         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9099         * configure: Rebuild.
9100         * Makefile.in: Likewise.
9101         * testsuite/Makefile.in: Likewise.
9102
9103 2008-07-18  Ian Lance Taylor  <iant@google.com>
9104
9105         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9106         where we see NAME/NULL and NAME/VERSION  as separate symbols.
9107         * testsuite/ver_test_main.cc (main): Call t4.
9108         (t4, t4_2a): Define.
9109         * testsuite/ver_test_2.cc (t4_2): Define.
9110         * testsuite/ver_test_2.script: Put t4_2a in VER2.
9111         * testsuite/ver_test_4.cc (t4_2a): Define.
9112         * testsuite/ver_test_4.script: Put t4_2a in VER2.
9113         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9114
9115 2008-07-17  Ian Lance Taylor  <iant@google.com>
9116
9117         * dynobj.cc (Versions::add_def): If we give an error about a
9118         missing version, go ahead and create the version anyhow.
9119
9120 2008-07-10  Ian Lance Taylor  <iant@google.com>
9121
9122         Handle output sections with more than 0x7fffffff bytes.
9123         * object.h (class Relobj): Change map_to_output_ to
9124         output_sections_, and just keep a section pointer.  Change all
9125         uses.  Move comdat group support to Sized_relobj.
9126         (Relobj::is_section_specially_mapped): Remove.
9127         (Relobj::output_section): Remove poff parameter.  Change all
9128         callers.
9129         (Relobj::output_section_offset): New function.
9130         (Relobj::set_section_offset): Rewrite.
9131         (Relobj::map_to_output): Remove.
9132         (Relobj::output_sections): New function.
9133         (Relobj::do_output_section_offset): New pure virtual function.
9134         (Relobj::do_set_section_offset): Likewise.
9135         (class Sized_relobj): Add section_offsets_ field.  Add comdat
9136         group support from Relobj.  Update declarations.
9137         (Sized_relobj::get_output_section_offset): New function.
9138         (Sized_relobj::do_output_section_offset): New function.
9139         (Sized_relobj::do_set_section_offset): New function.
9140         * object.cc (Relobj::output_section_address): Remove.
9141         (Sized_relobj::Sized_relobj): Initialize new fields.
9142         (Sized_relobj::include_section_group): Cast find_kept_object to
9143         Sized_relobj.
9144         (Sized_relobj::include_linkonce_section): Likewise.
9145         (Sized_relobj::do_layout): Use separate arrays for output section
9146         and output offset.
9147         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9148         output_sections.
9149         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9150         output_sections and section_offsets.
9151         (Sized_relobj::write_local_symbols): Likewise.
9152         (map_to_kept_section): Compute output address directly.
9153         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9154         output_sections and section_offsets.
9155         (Sized_relobj::write_sections): Likewise.
9156         (Sized_relobj::relocate_sections): Likewise.
9157         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9158         * output.h (class Output_reloc): Update declarations.  Change
9159         u2_.relobj to Sized_relobj*.
9160         (class Output_data_reloc): Change add functions to use
9161         Sized_relobj*.
9162         * output.cc (Output_reloc::Output_reloc): Change relobj to
9163         Sized_relobj*.
9164         (Output_reloc::local_section_offset): Change return type to
9165         Elf_Addr.  Use get_output_section_offset.
9166         (Output_reloc::get_address): Likewise.
9167         (Output_section::is_input_address_mapped): Don't call
9168         is_section_specially_mapped.
9169         (Output_section::output_offset): Likewise.
9170         (Output_section::output_address): Likewise.
9171         (Output_section::starting_output_address): Likewise.
9172         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9173         parameter to Sized_relobj*.
9174         (Copy_relocs::need_copy_reloc): Likewise.
9175         (Copy_relocs::save): Likewise.
9176         * copy-relocs.h (class Copy_relocs): Update declarations.
9177         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9178         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9179         * target-reloc.h (relocate_for_relocatable): Change
9180         offset_in_output_section type to Elf_Addr.  Change code that uses
9181         it as well.
9182         * layout.cc (Layout::layout): Always set *off.
9183         * mapfile.cc (Mapfile::print_input_section): Use
9184         output_section_offset.
9185         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9186         Sized_relobj*.
9187         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9188         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9189         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9190
9191 2008-07-03  Ian Lance Taylor  <iant@google.com>
9192
9193         * layout.cc (Layout::include_section): Do not discard unrecognized
9194         SHT_STRTAB sections.
9195
9196 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9197
9198         * script.cc (Lex::can_continue_name): Make '?' allowable in
9199         version-script names.
9200         * testsuite/version_script.map: Change glob pattern to use '?'
9201
9202 2008-06-30  Manish Singh  <yosh@gimp.org>
9203
9204         PR 6585
9205         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9206         Correct typo.
9207
9208 2008-06-30  Ian Lance Taylor  <iant@google.com>
9209
9210         PR 6660
9211         PR 6682
9212         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9213         versions]: Don't try to read the value in the contents, since we
9214         don't use it.  Use the template endianness when writing.
9215
9216 2008-06-25  Cary Coutant  <ccoutant@google.com>
9217
9218         * fileread.cc (File_read::make_view): Assert on zero-length view.
9219         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9220         symbol table when there are no symbols to read.
9221
9222 2008-06-23  Craig Silverstein  <csilvers@google.com>
9223
9224         * version.cc (version_string): Bump to 1.7
9225
9226 2008-06-18  Craig Silverstein  <csilvers@google.com>
9227
9228         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9229         constant 0xFFFF to type Valtype.
9230         (Powerpc_relocate_functions::rel16_ha): Likewise.
9231
9232 2008-06-17  Ian Lance Taylor  <iant@google.com>
9233
9234         * output.h (Output_section::Input_section): Initialize p2align_ to
9235         zero for Output_section_data constructors.
9236         (Output_section::Input_section::addralign): If not an input
9237         section, return the alignment of the Output_section_data.
9238         * testsuite/copy_test.cc: New file.
9239         * testsuite/copy_test_1.cc: New file.
9240         * testsuite/copy_test_2.cc: New file.
9241         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9242         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9243         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9244         (copy_test_1_pic.o, copy_test_1.so): New targets.
9245         (copy_test_2_pic.o, copy_test_2.so): New targets.
9246         * testsuite/Makefile.in: Rebuild.
9247
9248         * script-sections.cc (Script_sections::place_orphan): Initialize
9249         local variable exact.
9250
9251 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9252
9253         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9254
9255 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9256             David S. Miller  <davem@davemloft.net>
9257
9258         * powerpc.cc: New file.
9259         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9260         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9261         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9262         * Makefile.in: Rebuild.
9263
9264 2008-06-09  Ian Lance Taylor  <iant@google.com>
9265
9266         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9267         <exception>.
9268         (throwing, orig_terminate): New static variables.
9269         (terminate_handler): New static function.
9270         (t2): Set terminate handler.
9271
9272 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9273
9274         PR 6584
9275         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9276         alignment.
9277
9278 2008-05-30  Cary Coutant  <ccoutant@google.com>
9279
9280         * archive.cc (Archive::include_all_members) Correct to step
9281         over symbol table and extended name table in thin archives.
9282
9283 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9284
9285         PR 6407
9286         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9287         calculation.
9288
9289 2008-05-28  Caleb Howe  <cshowe@google.com>
9290
9291         * reduced_debug_output.cc: New file.
9292         * reduced_debug_output.h: New file.
9293         * options.h (class General_options): Add --strip-debug-non-line.
9294         * options.cc (General_options::finalize): Add strip_debug_non_line
9295         to the strip heirarchy.
9296         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9297         fields.
9298         * layout.cc: Include "reduced_debug_output.h".
9299         (Layout::Layout): Initialize new fields.
9300         (line_only_debug_sections): New static array.
9301         (is_lines_only_debug_sections): New static inline function.
9302         (Layout::include_section): Handle --strip-debug-non-line.
9303         (Layout::make_output_section): If --strip-debug-non-line, build
9304         new output sections for .debug_abbrev and .debug_info.
9305         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9306         gold.  Warn about possible overflow.
9307         (read_signed_LEB_128): Likewise.
9308         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9309         (read_signed_LEB_128): Declare.
9310         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9311         (HFILES): Add reduced_debug_output.h.
9312         * Makefile.in: Rebuild.
9313
9314 2008-05-21  Ian Lance Taylor  <iant@google.com>
9315
9316         * mapfile.cc: New file.
9317         * mapfile.h: New file.
9318         * options.h (class General_options): Add -M/--print-map and -Map.
9319         * options.cc (General_options::finalize): Make -M equivalent to
9320         -Map -.
9321         * main.cc: Include <cstdio> and "mapfile.h".
9322         (main): Open mapfile if requested.
9323         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9324         constructor.  Change caller.
9325         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9326         (queue_middle_tasks): Likewise.
9327         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9328         declarations.
9329         * archive.cc: Include "mapfile.h".
9330         (Archive::add_symbols): Add mapfile parameter.  Change all
9331         callers.  Pass mapfile, symbol, and reason to include_member.
9332         (Archive::include_all_members): Add mapfile parameter.  Change all
9333         callers.
9334         (Archive::include_member): Add mapfile, sym, and why parameters.
9335         Change all callers.  Report inclusion to map file.
9336         * archive.h: Include "fileread.h".
9337         (class Archive): Update declarations.
9338         (Archive::file): New const method.
9339         (class Add_archive_symbols): Add mapfile_ field.  Update
9340         constructor.  Change all callers.
9341         * readsyms.h (class Read_symbols): Likewise.
9342         (class Finish_group): Likewise.
9343         (class Read_script): Likewise.
9344         * common.cc: Include "mapfile.h".
9345         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9346         all callers.
9347         (Symbol_table::do_allocate_commons): Likewise.
9348         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9349         symbol allocation to mapfile.
9350         * common.h (class Allocate_commons_task): Add mapfile_ field.
9351         Update constructor.  Change all callers.
9352         * symtab.h (class Symbol_table): Update declarations.
9353         * layout.cc: Include "mapfile.h".
9354         (Layout_task_runner::run): Print information to mapfile.
9355         (Layout::create_gold_note): Change Output_data_fixed_space to
9356         Output_data_zero_fill.
9357         (Layout::create_build_id): Likewise.
9358         (Layout::print_to_mapfile): New function.
9359         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9360         constructor.  Change caller.
9361         (class Layout): Declare print_to_mapfile.
9362         * output.cc (Output_section::Input_section::print_to_mapfile): New
9363         function.
9364         (Output_section::add_input_section): If producing a map, always
9365         add to input_sections_ list.
9366         (Output_section::do_print_to_mapfile): New function.
9367         (Output_segment::print_sections_to_mapfile): New function.
9368         (Output_segment::print_section_list_to_mapfile): New function.
9369         * output.h: Include "mapfile.h".
9370         (Output_data::print_to_mapfile): New function.
9371         (Output_data::do_print_to_mapfile): New virtual function.
9372         (Output_segment_headers::do_print_to_mapfile): New function.
9373         (Output_file_header::do_print_to_mapfile): New function.
9374         (Output_data_const::do_print_to_mapfile): New function.
9375         (class Output_data_const_buffer): Add map_name_ field.  Update
9376         constructor.  Change all callers.  Add do_print_to_mapfile
9377         function.
9378         (class Output_data_fixed_space): Likewise.
9379         (class Output_data_space): Likewise.
9380         (class Output_data_zero_fill): New class.
9381         (Output_data_strtab::do_print_to_mapfile): New function.
9382         (Output_data_reloc_base::do_print_to_mapfile): New function.
9383         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9384         (Output_data_group::do_print_to_mapfile): New function.
9385         (Output_data_got::do_print_to_mapfile): New function.
9386         (Output_data_dynamic::do_print_to_mapfile): New function.
9387         (Output_symtab_xindex::do_print_to_mapfile): New function.
9388         (class Output_section): Declare do_print_to_mapflie.  Declare
9389         print_to_mapfile in Input_section.
9390         (class Output_segment): Declare new functions.
9391         * object.h (Sized_relobj::symbol_count): New function.
9392         * script-sections.cc
9393         (Output_section_element_dot_assignment::set_section_addresses):
9394         Change Output_data_fixed_space to Output_data_zero_fill.
9395         (Output_data_expression::do_print_to_mapfile): New function.
9396         * script.cc (read_input_script): Add mapfile parameter.  Change
9397         all callers.
9398         * script.h (read_input_script): Update declaration.
9399         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9400         (Eh_frame::do_print_to_mapfile): New function.
9401         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9402         (Output_merge_string::do_print_to_mapfile): New function.
9403         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9404         function.
9405         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9406         function.
9407         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9408         function.
9409         * Makefile.am (CCFILES): Add mapfile.cc.
9410         (HFILES): Add mapfile.h.
9411         * Makefile.in: Rebuild.
9412
9413 2008-05-19  Ian Lance Taylor  <iant@google.com>
9414
9415         * options.h (class General_options): Add -z relro.
9416         * layout.cc (Layout::Layout): Initialize relro_segment_.
9417         (Layout::add_output_section_data): Return the output section.
9418         (Layout::make_output_section): Rcognize relro sections and mark
9419         them appropriately.
9420         (Layout::attach_allocated_section_to_segment): Put relro sections
9421         in a PT_GNU_RELRO segment.
9422         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9423         section as relro.
9424         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9425         PT_TLS segments.
9426         (Layout::linkonce_mapping): Map d.rel.ro.local to
9427         .data.rel.ro.local.
9428         (Layout::output_section_name): Us .data.rel.ro.local for any
9429         section which begins with that.
9430         * layout.h (class Layout): Update add_output_section_data
9431         declaration.  Add relro_segment_ field.
9432         * output.cc (Output_section::Output_section): Initialize is_relro_
9433         and is_relro_local_ fields.
9434         (Output_segment::add_output_section): Group relro sections.
9435         (Output_segment::is_first_section_relro): New function.
9436         (Output_segment::maximum_alignment): If there is a relro section,
9437         align the segment to the common page size.
9438         (Output_segment::set_section_addresses): Track whether we are
9439         looking at relro sections.  If the last section is a relro
9440         section, align to the common page size.
9441         (Output_segment::set_section_list_addresses): Add in_relro
9442         parameter.  Change all callers.  Align to the page size when
9443         moving from relro to non-relro section.
9444         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9445         segment.
9446         * output.h (class Output_section): Add is_relro_ and
9447         is_relro_local_ fields.
9448         (Output_section::is_relro): New function.
9449         (Output_section::set_is_relro): New function.
9450         (Output_section::is_relro_local): New function.
9451         (Output_section::set_is_relro_local): New function.
9452         (class Output_segment): Update declarations.
9453         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9454         * sparc.cc (Target_sparc::got_section): Likewise.
9455         * x86_64.cc (Target_x86_64::got_section): Likewise.
9456         * testsuite/relro_test_main.cc: New file.
9457         * testsuite/relro_test.cc: New file.
9458         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9459         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9460         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9461         (relro_test.so, relro_test_pic.o): New targets.
9462         * testsuite/Makefile.in: Rebuild.
9463
9464 2008-05-16  Ian Lance Taylor  <iant@google.com>
9465
9466         * output.cc (Output_segment::add_output_section): Remove front
9467         parameter.
9468         * output.h (class Output_segment): Remove
9469         add_initial_output_section and overloaded add_output_section.
9470         Update declaration of remaining add_output_section.
9471         * layout.cc (Layout::create_interp): Call add_output_section
9472         rather than add_initial_output_section.
9473         (Layout::finish_dynamic_section): Likewise.
9474
9475         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9476         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9477         know the dynamic type.
9478         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9479         field.  Initialize it in constructor.
9480         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9481         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9482         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9483         reloc.
9484
9485         * output.cc (Output_reloc::get_address): Change return type to
9486         Elf_Addr.
9487         * output.h (class Output_reloc): Update get_address declaration.
9488         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9489         for section addresses.
9490
9491 2008-05-09  Ian Lance Taylor  <iant@google.com>
9492
9493         PR 6493
9494         * gold.cc (gold_nomem): Use return value of write.
9495
9496 2008-05-08  Ian Lance Taylor  <iant@google.com>
9497
9498         * symtab.c (Symbol::init_base_output_data): Add version
9499         parameter.  Change all callers.
9500         (Symbol::init_base_output_segment): Likewise.
9501         (Symbol::init_base_constant): Likewise.
9502         (Symbol::init_base_undefined): Likewise.
9503         (Sized_symbol::init_output_data): Likewise.
9504         (Sized_symbol::init_output_segment): Likewise.
9505         (Sized_symbol::init_constant): Likewise.
9506         (Sized_symbol::init_undefined): Likewise.
9507         (Symbol_table::do_define_in_output_data): If the new symbol has a
9508         version, mark it as the default.
9509         (Symbol_table::do_define_in_output_segment): Likewise.
9510         (Symbol_table::do_define_as_constant): Likewise.
9511         * symtab.h (class Symbol): Update declarations.
9512         (class Sized_symbol): Likewise.
9513         * resolve.cc (Symbol::override_version): New function.
9514         (Symbol::override_base): Call override_version.
9515         (Symbol::override_base_with_special): Likewise.
9516         * testsuite/ver_script_8.script: New file.
9517         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9518         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9519         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9520         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9521
9522 2008-05-06  Ian Lance Taylor  <iant@google.com>
9523
9524         PR 6049
9525         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9526         functions.
9527         (class General_options): Remove existing --undefined, and add
9528         --no-undefined instead.  Add new --undefined as synonym for -u.
9529         * archive.cc (Archive::add_symbols): Check whether symbol was
9530         named with -u.
9531         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9532         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9533         all uses.  Add IS_UNDEFINED.  Update declarations to split
9534         different versions of init_base.  Declare init_base_undefined.
9535         (Symbol::is_defined): Handle IS_UNDEFINED.
9536         (Symbol::is_undefined): Likewise.
9537         (Symbol::is_weak_undefined): Call is_undefined.
9538         (Symbol::is_absolute): Handle IS_CONSTANT.
9539         (class Sized_symbol): Update declarations to split different
9540         versions of init.  Declare init_undefined.
9541         (class Symbol_table): Declare new functions.
9542         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9543         Change all callers.
9544         (Symbol::init_base_output_data): Likewise.
9545         (Symbol::init_base_output_segment): Likewise.
9546         (Symbol::init_base_constant): Likewise.
9547         (Symbol::init_base_undefined): New function.
9548         (Sized_symbol::init_object): Rename from init.  Change all
9549         callers.
9550         (Sized_symbol::init_output_data): Likewise.
9551         (Sized_symbol::init_output_segment): Likewise.
9552         (Sized_symbol::init_constant): Likewise.
9553         (Sized_symbol::init_undefined): New function.
9554         (Symbol_table::add_undefined_symbols_from_command_line): New
9555         function.
9556         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9557         function.
9558         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9559         (Symbol::output_section): Likewise.
9560         (Symbol::set_output_section): Likewise.
9561         (Symbol_table::sized_finalize_symbol): Likewise.
9562         (Symbol_table::sized_write_globals): Likewise.
9563         * resolve.cc (Symbol_table::should_override): Likewise.
9564         (Symbol::override_base_with_special): Likewise.
9565
9566         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9567         symbol, change it to have default visibility.
9568         * testsuite/protected_1.cc: New file.
9569         * testsuite/protected_2.cc: New file.
9570         * testsuite/protected_3.cc: New file.
9571         * testsuite/protected_main_1.cc: New file.
9572         * testsuite/protected_main_2.cc: New file.
9573         * testsuite/protected_main_3.cc: New file.
9574         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9575         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9576         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9577         (protected_1.so): New target.
9578         (protected_1_pic.o, protected_2_pic.o): New targets.
9579         (protected_3_pic.o): New target.
9580         (check_PROGRAMS): Add protected_2.
9581         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9582         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9583         * testsuite/Makefile.in: Rebuild.
9584
9585         * options.h (DEFINE_var): Add set_user_set_##varname__.
9586         (DEFINE_bool_alias): New macro.
9587         (class General_options): Define -Bstatic using DEFINE_bool_alias
9588         rather than DEFINE_special.  Add --undefined as an alias for -z
9589         defs.
9590         * options.cc (General_options::parse_Bstatic): Remove.
9591
9592         * options.h (class General_options): Add --fatal-warnings.
9593         * main.cc (main): Implement --fatal-warnings.
9594         * errors.h (Errors::warning_count): New function.
9595
9596         * options.h (class General_options): Add -Bsymbolic-functions.
9597         * symtab.h (Symbol::is_preemptible): Check for
9598         -Bsymbolic-functions.
9599
9600 2008-05-05  Ian Lance Taylor  <iant@google.com>
9601
9602         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9603         as noVARNAME rather than no-VARNAME.
9604         (class General_options): Add option -z combreloc.
9605         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9606         get_address.
9607         (Output_reloc::sort_before) [SHT_REL]: New function.
9608         (Output_reloc::sort_before) [SHT_RELA]: New function.
9609         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9610         Sort_relocs_comparison.
9611         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9612         parameter.  Change all callers.
9613         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9614         sort_relocs parameter.  Change all callers.
9615         * output.cc (Output_reloc::get_address): New function, broken out
9616         of write_rel.
9617         (Output_reloc::write_rel): Call it.
9618         (Output_reloc::compare): New function.
9619         (Output_data_reloc_base::do_write): Optionally sort relocs.
9620
9621         * configure.ac: If targ_extra_obj is set, link it in.
9622         * configure.tgt: Initialize all variables.
9623         (x86_64*): Set targ_extra_obj and targ_extra_size.
9624         * configure: Rebuild.
9625
9626         * object.cc (Sized_relobj::include_section_group): Adjust section
9627         indexes read from group data.  Build vector to pass to
9628         layout_group.
9629         * layout.cc (Layout::layout_group): Add flags and shndxes
9630         parameters.  Remove contents parameter.  Change caller.  Update
9631         explicit instantiations.
9632         * layout.h (class Layout): Update layout_group declaration.
9633         * output.cc (Output_data_group::Output_data_group): Add flags and
9634         input_shndxes parameters.  Remove contents parameter.  Change
9635         caller.
9636         (Output_data_group::do_write): Change input_sections_ to
9637         input_shndxes_.
9638         * output.h (class Output_data_group): Update constructor
9639         declaration.  Rename input_sections_ to input_shndxes_.
9640         * testsuite/many_sections_test.cc: Add template.
9641
9642 2008-04-30  Cary Coutant  <ccoutant@google.com>
9643
9644         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9645
9646         * layout.cc (Layout::include_section): Refactored check for debug
9647         info section.
9648         (Layout::add_comdat): Add new parameters.  Change type
9649         of signature parameter.  Add object and shndx to signatures table.
9650         (Layout::find_kept_object): New function.
9651         * layout.h: Include <cstring>.
9652         (Layout::is_debug_info_section): New function.
9653         (Layout::add_comdat): Add new parameters.
9654         (Layout::find_kept_object): New function.
9655         (Layout::Kept_section): New struct.
9656         (Layout::Signatures): Change type of map range.
9657         * object.cc (Relobj::output_section_address): New function.
9658         (Sized_relobj::include_section_group): Add new parameters.  Change
9659         calls to Layout::add_comdat.  Change to build table of kept comdat
9660         groups and table mapping discarded sections to kept sections.
9661         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9662         (Sized_relobj::do_layout): Change calls to include_section_group and
9663         include_linkonce_section.
9664         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9665         value to zero when section is discarded.
9666         (Sized_relobj::map_to_kept_section): New function.
9667         * object.h (Relobj::output_section_address): New function.
9668         (Relobj::Comdat_group): New type.
9669         (Relobj::find_comdat_group): New function.
9670         (Relobj::Comdat_group_table): New type.
9671         (Relobj::Kept_comdat_section): New type.
9672         (Relobj::Kept_comdat_section_table): New type.
9673         (Relobj::add_comdat_group): New function.
9674         (Relobj::set_kept_comdat_section): New function.
9675         (Relobj::get_kept_comdat_section): New function.
9676         (Relobj::comdat_groups_): New field.
9677         (Relobj::kept_comdat_sections_): New field.
9678         (Symbol_value::input_value): Update comment.
9679         (Sized_relobj::map_to_kept_section) New function.
9680         (Sized_relobj::include_linkonce_section): Add new parameter.
9681         * target-reloc.h (Comdat_behavior): New type.
9682         (get_comdat_behavior): New function.
9683         (relocate_section): Add code to map a discarded section to the
9684         corresponding kept section when applying a relocation.
9685
9686 2008-04-30  Craig Silverstein  <csilvers@google.com>
9687
9688         * dwarf_reader.cc (next_generation_count): New static var.
9689         (Addr2line_cache_entry): New struct.
9690         (addr2line_cache): New static var.
9691         (Dwarf_line_info::one_addr2line): Added caching.
9692         (Dwarf_line_info::clear_addr2line_cache): New function.
9693         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9694         cache-size parameter.
9695         (Dwarf_line_info::one_addr2line_cache): New function.
9696         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9697         new cache-size argument to one_addr2line(), and clear cache.
9698
9699 2008-04-28  Cary Coutant  <ccoutant@google.com>
9700
9701         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9702         R_386_PC8 relocations.
9703
9704 2008-04-23  Ian Lance Taylor  <iant@google.com>
9705
9706         * object.cc (Sized_relobj::include_section_group): Check for
9707         invalid section group.
9708
9709         * object.cc (make_elf_object): Correct test for 64-bit ELF file
9710         header size.
9711
9712         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9713         than read for file header.
9714         * archive.cc (Archive::include_member): Likewise.
9715
9716 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
9717
9718         * aclocal.m4: Regenerate.
9719         * configure: Regenerate.
9720
9721 2008-04-19  Ian Lance Taylor  <iant@google.com>
9722
9723         * version.cc (version_string): Bump to 1.6.
9724
9725         * testsuite/Makefile.am (many_sections_r_test): New target.
9726         (many_sections_r_test_SOURCES): Remove.
9727         (many_sections_r_test_DEPENDENCIES): Remove.
9728         (many_sections_r_test_LDFLAGS): Remove.
9729         (many_sections_r_test_LDADD): Remove.
9730
9731         * object.cc (Sized_relobj::do_add_symbols): Always pass
9732         local_symbol_count_ to add_from_relobj.
9733
9734         * testsuite/Makefile.am (many_sections_check.h): Only check one in
9735         every thousand variables.
9736         * testsuite/Makefile.in: Rebuild.
9737
9738         * object.cc (Xindex::initialize_symtab_xindex): New function.
9739         (Xindex::read_symtab_xindex): New function.
9740         (Xindex::sym_xindex_to_shndx): New function.
9741         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9742         available.
9743         (Sized_relobj::do_initialize_xindex): New function.
9744         (Sized_relobj::do_read_symbols): Adjust section links.
9745         (Sized_relobj::symbol_section_and_value): Add is_ordinary
9746         parameter.  Change all callers.
9747         (Sized_relobj::include_section_group): Adjust section links and
9748         symbol section indexes.
9749         (Sized_relobj::do_layout): Adjust section links.
9750         (Sized_relobj::do_count_local_symbols): Adjust section links and
9751         symbol section indexes.
9752         (Sized_relobj::do_finalize_local_symbols): Distinguish between
9753         ordinary and special symbols.
9754         (Sized_relobj::write_local_symbols): Add symtab_xindex and
9755         dynsym_xindex parameters.  Change all callers.  Adjust section
9756         links.  Use SHN_XINDEX when needed.
9757         (Sized_relobj::get_symbol_location_info): Adjust section links.
9758         Don't get fooled by special symbols.
9759         * object.h (class Xindex): Define.
9760         (class Object): Add xindex_ parameter.  Declare virtual functoin
9761         do_initialize_xindex.
9762         (Object::adjust_sym_shndx): New function.
9763         (Object::set_xindex): New protected function.
9764         (class Symbol_value): Add is_ordinary_shndx_ field.
9765         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9766         (Symbol_value::value): Assert ordinary section.
9767         (Symbol_value::initialize_input_to_output_map): Likewise.
9768         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9769         Change all callers.
9770         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
9771         all callers.
9772         (class Sized_relobj): Update declarations.
9773         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9774         parameter.  Change all callers.
9775         (Sized_relobj::adjust_shndx): New function.
9776         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9777         field.
9778         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9779         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
9780         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
9781         (Sized_dynobj::read_dynsym_section): Adjust section links.
9782         (Sized_dynobj::read_dynamic): Likewise.
9783         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
9784         section links.
9785         (Sized_dynobj::do_initialize_xindex): New function.
9786         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
9787         do_initialize_xindex.
9788         (Sized_dynobj::adjust_shndx): New function.
9789         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9790         dynsym_xindex_ fields.
9791         (Layout::finalize): Add a call to set_section_indexes before
9792         creating the symtab sections.
9793         (Layout::set_section_indexes): Don't do anything if the section
9794         already has a section index.
9795         (Layout::create_symtab_sections): Add shnum parameter.  Change
9796         caller.  Create .symtab_shndx section if needed.
9797         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
9798         caller.
9799         (Layout::allocated_output_section_count): New function.
9800         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9801         needed.
9802         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9803         fields.  Update declarations.
9804         (Layout::symtab_xindex): New function.
9805         (Layout::dynsym_xindex): New function.
9806         (class Write_symbols_task): Add layout_ field.
9807         (Write_symbols_task::Write_symbols_task): Add layout parameter.
9808         Change caller.
9809         * output.cc (Output_section_headers::Output_section_headers): Add
9810         shstrtab_section parameter.  Change all callers.
9811         (Output_section_headers::do_sized_write): Store overflow values
9812         for section count and section string table section index in
9813         section header zero.
9814         (Output_file_header::do_sized_write): Check for overflow of
9815         section count and section string table section index.
9816         (Output_symtab_xindex::do_write): New function.
9817         (Output_symtab_xindex::endian_do_write): New function.
9818         * output.h (class Output_section_headers): Add shstrtab_section_.
9819         Update declarations.
9820         (class Output_symtab_xindex): Define.
9821         (Output_section::has_out_shndx): New function.
9822         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9823         field.
9824         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9825         Change all callers.
9826         (Sized_symbol::init): Likewise.
9827         (Symbol::output_section): Check for ordinary symbol.
9828         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
9829         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
9830         callers.
9831         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9832         Change all callers.  Simplify handling of symbols from sections
9833         not included in the link.
9834         (Symbol_table::add_from_dynobj): Handle ordinary symbol
9835         distinction.
9836         (Weak_alias_sorter::operator()): Assert that symbols are
9837         ordinary.
9838         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9839         distinction.
9840         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9841         parameters.  Change all callers.
9842         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
9843         symbol distinction.  Use SHN_XINDEX when needed.
9844         (Symbol_table::write_section_symbol): Add symtab_xindex
9845         parameter.  Change all callers.
9846         (Symbol_table::sized_write_section_symbol): Likewise.  Use
9847         SHN_XINDEX when needed.
9848         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
9849         declarations.
9850         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
9851         (Symbol::is_defined): Check is_ordinary.
9852         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9853         (Symbol::is_absolute, Symbol::is_common): Likewise.
9854         (class Sized_symbol): Update declarations.
9855         (class Symbol_table): Update declarations.
9856         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9857         parameters.  Change all callers.
9858         (Sized_symbol::override): Likewise.
9859         (Symbol_table::override): Likewise.
9860         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
9861         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
9862         is_ordinary, and orig_st_shndx parameters.  Change all callers.
9863         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9864         to be in an ordinary section.
9865         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9866         object and is_ordinary parameters.  Change all callers.
9867         (Sized_dwarf_line_info::read_relocs): Add object parameter.
9868         Change all callers.  Don't add undefined or non-ordinary symbols
9869         to reloc_map_.
9870         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9871         Change all callers.
9872         * dwarf_reader.h (class Sized_dwarf_line_info): Update
9873         declarations.
9874         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9875         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9876         (Sized_relobj::relocate_sections): Likewise.
9877         * target-reloc.h (scan_relocs): Adjust section symbol index.
9878         (scan_relocatable_relocs): Likewise.
9879         * i386.cc (Scan::local): Check for ordinary symbols.
9880         * sparc.cc (Scan::local): Likewise.
9881         * x86_64.cc (Scan::local): Likewise.
9882         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9883         to symbol_section_and_value.
9884         * testsuite/many_sections_test.cc: New file.
9885         * testsuite/Makefile.am (BUILT_SOURCES): Define.
9886         (check_PROGRAMS): Add many_sections_test.
9887         (many_sections_test_SOURCES): Define.
9888         (many_sections_test_DEPENDENCIES): Define.
9889         (many_sections_test_LDFLAGS): Define.
9890         (BUILT_SOURCES): Add many_sections_define.h.
9891         (many_sections_define.h): New target.
9892         (BUILT_SOURCES): Add many_sections_check.h.
9893         (many_sections_check.h): New target.
9894         (check_PROGRAMS): Add many_sections_r_test.
9895         (many_sections_r_test_SOURCES): Define.
9896         (many_sections_r_test_DEPENDENCIES): Define.
9897         (many_sections_r_test_LDFLAGS): Define.
9898         (many_sections_r_test_LDADD): Define.
9899         (many_sections_r_test.o): New target.
9900         * testsuite/Makefile.in: Rebuild.
9901
9902 2008-04-17  Cary Coutant  <ccoutant@google.com>
9903
9904         * errors.cc (Errors::info): New function.
9905         (gold_info): New function.
9906         * errors.h (Errors::info): New function.
9907         * gold.h (gold_info): New function.
9908         * object.cc (Input_objects::add_object): Print trace output.
9909         * options.cc (options::parse_set): New function.
9910         (General_options::parse_wrap): Deleted.
9911         (General_options::General_options): Deleted initializer.
9912         * options.h (options::String_set): New typedef.
9913         (options::parse_set): New function.
9914         (DEFINE_set): New macro.
9915         (General_options::wrap): Changed to use DEFINE_set. Changed
9916         callers of any_wrap_symbols and is_wrap_symbol.
9917         (General_options::trace, General_options::trace_symbol):
9918         New options.
9919         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9920         (General_options::wrap_symbols_): Deleted.
9921         * symtab.cc (Symbol_table::add_from_object): Print trace output.
9922
9923 2008-04-17  David S. Miller  <davem@davemloft.net>
9924
9925         * options.cc (General_options::parse_V): New function.
9926         * options.h: Add entries for -V and -Qy.
9927
9928 2008-04-17  Ian Lance Taylor  <iant@google.com>
9929
9930         * common.cc (Symbol_table::allocate_commons): Remove options
9931         parameter.  Change caller.
9932         (Symbol_table::do_allocate_commons): Remove options parameter.
9933         Change caller.  Just call do_allocate_commons_list twice.
9934         (Symbol_table::do_allocate_commons_list): New function, broken out
9935         of do_allocate_commons.
9936         * common.h (class Allocate_commons_task): Remove options_ field.
9937         Update constructor.
9938         * symtab.cc (Symbol_table::Symbol_table): Initialize
9939         tls_commons_.
9940         (Symbol_table::add_from_object): Put TLS common symbols on
9941         tls_commons_ list.
9942         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9943         which are IN_OUTPUT_DATA.
9944         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
9945         allocate_commons and do_allocate_commons declarations.  Declare
9946         do_allocate_commons_list.
9947         * gold.cc (queue_middle_tasks): Update creation of
9948         Allocate_commons_task to not pass options.
9949         * testsuite/Makefile.am (INCLUDES): Add -I.. .
9950         (TLS_TEST_C_FLAGS): New variable.
9951         (tls_test_c_pic.o): New target.
9952         (tls_test_shared.so): Link in tls_test_c_pic.o.
9953         (tls_test_c_pic_ie.o): New target.
9954         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9955         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9956         (tls_test_c.o): New target.
9957         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9958         (tls_pic_test_LDADD): Likewise.
9959         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9960         (tls_shared_gd_to_ie_test_LDADD): Likewise.
9961         (tls_test_c_gnu2.o): New target.
9962         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9963         tls_test_c_gnu2.o.
9964         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9965         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9966         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9967         * testsuite/tls_test.cc: Include "config.h".
9968         (t_last): Call t11_last.
9969         * testsuite/tls_test.h (t11, t11_last): Declare.
9970         * testsuite/tls_test_c.c: New file.
9971         * testsuite/tls_test_main.cc (thread_routine): Call t11.
9972         * configure.ac: Check for OpenMP support.
9973         * configure, config.in, Makefile.in: Rebuild.
9974         * testsuite/Makefile.in: Rebuild.
9975
9976 2008-04-16  Cary Coutant  <ccoutant@google.com>
9977
9978         * i386.cc (Target_i386::define_tls_base_symbol): New function.
9979         (Target_i386::tls_base_symbol_defined_): New field.
9980         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9981         (Target_i386::Scan::global): Likewise.
9982         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9983         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9984         (Target_x86_64::tls_base_symbol_defined_): New field.
9985         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9986         (Target_x86_64::Scan::global): Likewise.
9987
9988 2008-04-16  Cary Coutant  <ccoutant@google.com>
9989
9990         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9991         (Symbol::needs_plt_entry): Allow weak undefined symbols.
9992         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9993         building shared libraries.
9994         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9995         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9996         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9997         * testsuite/Makefile.in: Rebuild.
9998         * testsuite/weak_undef.h: New file.
9999         * testsuite/weak_undef_file1.cc: Add extra test cases.
10000         * testsuite/weak_undef_file2.cc: Likewise.
10001         * testsuite/weak_undef_test.cc: Likewise.
10002
10003 2008-04-16  David S. Miller  <davem@davemloft.net>
10004
10005         * sparc.cc (Target_sparc::Scan): Change from struct to class.
10006         Add issued_non_pic_error_ field.  Declare check_non_pic.
10007         (Target_sparc::Scan::check_non_pic): New function.
10008         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10009         (Target_sparc::Scan::global): Likewise.
10010
10011         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10012         * configure: Rebuild.
10013
10014         * options.h (DEFINE_enable): New macro.
10015         (new_dtags): New enable option.
10016         (initfirst, interpose, loadfltr, nodefaultlib,
10017         nodelete, nodlopen, nodump): New -z options.
10018         * layout.cc (Layout:finish_dynamic_section): If new
10019         dtags enabled, emit DT_RUNPATH.  Also, emit a
10020         DT_FLAGS_1 containing any specified -z flags.
10021
10022 2008-04-16  Ian Lance Taylor  <iant@google.com>
10023
10024         * copy-relocs.cc: New file.
10025         * copy-relocs.h: New file.
10026         * reloc.cc: Remove Copy_relocs code.
10027         * reloc.h: Likewise.
10028         * reloc-types.h (struct Reloc_types) [both versions]: Add
10029         get_reloc_addend_noerror.
10030         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10031         variants of add_global which take an addend which must be zero.
10032         * i386.cc: Include "copy-relocs.h".
10033         (class Target_i386): Change type of copy_relocs_ to variable,
10034         update initializer.
10035         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10036         Change all callers.
10037         (Target_i386::do_finalize_sections): Change handling of
10038         copy_relocs_.
10039         * sparc.cc: Include "copy-relocs.h".
10040         (class Target_sparc): Change type of copy_relocs_ to variable,
10041         update initializer.
10042         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10043         Change all callers.
10044         (Target_sparc::do_finalize_sections): Change handling of
10045         copy_relocs_.
10046         * x86_64.cc: Include "copy-relocs.h".
10047         (class Target_x86_64): Change type of copy_relocs_ to variable,
10048         update initializer.
10049         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10050         class.  Change all callers.
10051         (Target_x86_64::do_finalize_sections): Change handling of
10052         copy_relocs_.
10053         * Makefile.am (CCFILES): Add copy-relocs.cc.
10054         (HFILES): Add copy-relocs.h.
10055
10056         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10057
10058         * testsuite/script_test_4.sh: Permit leading zeroes.
10059
10060 2008-04-15  Ian Lance Taylor  <iant@google.com>
10061
10062         * script-sections.cc (Script_sections::create_segments): Use
10063         header_size_adjustment even when there is enough room for the
10064         headers.
10065         * testsuite/script_test_4.sh: New file.
10066         * testsuite/script_test_4.t: New file.
10067         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10068         (check_DATA): Add script_test_4.stdout.
10069         (MOSTLYCLEANFILES): Likewise.
10070         (script_test_4): New target.
10071         (script_test_4.stdout): New target.
10072         * testsuite/Makefile.in: Rebuild.
10073
10074         * sparc.cc: Add definitions for Output_data_plt_sparc class
10075         constants.
10076
10077 2008-04-14  David S. Miller  <davem@davemloft.net>
10078
10079         * sparc.cc: New file.
10080         * Makefile.am (TARGETSOURCES): Add sparc.cc
10081         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10082         * configure.tgt: Document targ_extra_size and
10083         targ_extra_big_endian.  Add entries for sparc-* and
10084         sparc64-*.
10085         * configure.ac: Handle targ_extra_size and
10086         targ_extra_big_endian.
10087         * Makefile.in: Rebuild.
10088         * configure: Likewise.
10089         * po/POTFILES.in: Likewise.
10090         * po/gold.pot: Likewise.
10091
10092 2008-04-14  Ian Lance Taylor  <iant@google.com>
10093
10094         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10095         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10096         in the name/type/flags to section mapping.  Don't call
10097         allocate_output_section.
10098         (Layout::choose_output_section): Change parameter from adjust_name
10099         to is_input_section.  Don't permit input sections after sections
10100         are attached to segments.  Don't call allocate_output_section.
10101         (Layout::layout_eh_frame): Call update_flags_for_input_section,
10102         not write_enable_output_section.
10103         (Layout::make_output_section): Don't push to
10104         unattached_section_list_ nor call attach_to_segment.  Call
10105         attach_section_to_segment if sections are attached.
10106         (Layout::attach_sections_to_segments): New function.
10107         (Layout::attach_section_to_segment): New function.
10108         (Layout::attach_allocated_section_to_segment): Rename from
10109         attach_to_segment.  Remove flags parameter.
10110         (Layout::allocate_output_section): Remove function.
10111         (Layout::write_enable_output_section): Remove function.
10112         * layout.h (class Layout): Update for above changes.  Add new
10113         field sections_are_attached_.
10114         * output.h (Output_section::update_flags_for_input_section): New
10115         function.
10116         * output.cc (Output_section::add_input_section): Call
10117         update_flags_for_input_section.
10118         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10119
10120 2008-04-11  Cary Coutant  <ccoutant@google.com>
10121
10122         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10123         thought unnecessary.
10124         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10125
10126 2008-04-11  Ian Lance Taylor  <iant@google.com>
10127
10128         * output.h (class Output_section_data): Remove inline definition
10129         of set_addralign.
10130         * output.cc (Output_section_data::set_addralign): New function.
10131
10132 2008-04-11  Cary Coutant  <ccoutant@google.com>
10133
10134         Add support for TLS descriptors for i386 and x86_64.
10135         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10136         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10137         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10138         GOT_TYPE_TLS_DESC.
10139         (Target_i386::got_mod_index_entry): Remove unnecessary code.
10140         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10141         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
10142         relocations.
10143         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10144         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10145         Fix problem with initial-exec relocations.
10146         (Target_i386::Relocate::relocate_tls): Likewise.
10147         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10148         relaxation.
10149         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10150         support for section-plus-offset dynamic table entries.
10151         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10152         (Output_data_dynamic::Dynamic_entry): Add support for
10153         section-plus-offset dynamic table entries.
10154         (Output_data_dynamic::Classification): Likewise.
10155         (Output_data_dynamic::classification_): Renamed offset_.
10156         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10157         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10158         (Target_x86_64::make_plt_section): New function.
10159         (Target_x86_64::reserve_tlsdesc_entries): New function.
10160         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10161         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10162         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10163         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10164         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10165         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10166         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10167         add extra PLT entry for TLS descriptors.
10168         (Output_data_plt_x86_64::got_): New field.
10169         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10170         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10171         fields.
10172         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10173         descriptors.
10174         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10175         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10176         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10177         R_386_TLS_DESC_CALL relocations.
10178         (Target_x86_64::Scan::global): Likewise.
10179         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10180         for TLS descriptors.
10181         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10182         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10183         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10184         GD-to-IE relaxation.
10185         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10186         and TLS_DESCRIPTORS.
10187         * Makefile.in: Rebuild.
10188         * configure: Rebuild.
10189         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10190         (tls_test_shared2.so): New target.
10191         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10192         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10193         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10194         (tls_shared_gd_to_ie_test_LDADD): New variable.
10195         (tls_shared_gnu2_gd_to_ie_test): New target.
10196         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10197         New targets.
10198         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10199         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10200         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10201         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10202         (tls_shared_gnu2_test): New target.
10203         (tls_test_gnu2_shared.so): New target.
10204         (tls_shared_gnu2_test_SOURCES): New variable.
10205         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10206         (tls_shared_gnu2_test_LDFLAGS): New variable.
10207         (tls_shared_gnu2_test_LDADD): New variable.
10208         * testsuite/Makefile.in: Rebuild.
10209         * testsuite/Makefile.
10210
10211 2008-04-11  Ian Lance Taylor  <iant@google.com>
10212
10213         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10214         justsyms.t.
10215         * testsuite/Makefile.in: Rebuild.
10216
10217         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10218         long.
10219         * testsuite/script_test_2.cc (main): Adjust test.
10220
10221 2008-04-11  David S. Miller  <davem@davemloft.net>
10222             Ian Lance Taylor  <iant@google.com>
10223
10224         * options.h (General_options): Add entries for '-Y' and
10225         '-relax'.
10226         * options.cc (General_options:finalize): If -Y was used, add those
10227         entries to the library path instead of the default "/lib" and
10228         "/usr/lib".
10229
10230 2008-04-11  David S. Miller  <davem@davemloft.net>
10231
10232         * testsuite/justsyms.t: Start at 0x100.
10233         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10234         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10235         long.
10236         * testsuite/script_test_2.cc: Adjust string and section length
10237         checks.
10238
10239 2008-04-09  Ian Lance Taylor  <iant@google.com>
10240
10241         PR gold/5996
10242         * script-sections.cc (Sections_element::allocate_to_segment): Add
10243         orphan parameter.
10244         (Output_section_definition::allocate_to_segment): Likewise.
10245         (Orphan_output_section::allocate_to_segment): Likewise.
10246         (Script_sections::attach_sections_using_phdrs_clause): Don't
10247         propagate non-PT_LOAD segments to orphan sections.
10248         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10249         readelf rather than objdump.
10250         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10251         .interp section and PT_INTERP segment are the same size.
10252         * testsuite/Makefile.in: Rebuild.
10253
10254         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10255         aliases for symbols defined in the same object.
10256         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10257         (weak_alias_test_SOURCES): New variable.
10258         (weak_alias_test_DEPENDENCIES): New variable.
10259         (weak_alias_test_LDFLAGS): New variable.
10260         (weak_alias_test_LDADD): New variable.
10261         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10262         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10263         (weak_alias_test_3.o): New target.
10264         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10265         * testsuite/weak_alias_test_main.cc: New file.
10266         * testsuite/weak_alias_test_1.cc: New file.
10267         * testsuite/weak_alias_test_2.cc: New file.
10268         * testsuite/weak_alias_test_3.cc: New file.
10269
10270 2008-04-08  Ian Lance Taylor  <iant@google.com>
10271
10272         * options.h (class General_options): Add --noinhibit-exec option.
10273         * main.cc (main): Check --noinhibit-exec.
10274
10275         * options.h (class General_options): Define --wrap as a special
10276         option.  Add wrap_symbols_ field.
10277         (General_options::any_wrap_symbols): New function.
10278         (General_options::is_wrap_symbol): New function.
10279         * options.cc (General_options::parse_wrap): New function.
10280         (General_options::General_options): Initialize wrap_symbols_.
10281         * symtab.cc (Symbol_table::wrap_symbol): New function.
10282         (Symbol_table::add_from_object): Handle --wrap.
10283         * symtab.h (class Symbol_table): Declare wrap_symbol.
10284         * target.h (Target::wrap_char): New function.
10285         (Target::Target_info): Add wrap_char field.
10286         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10287         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10288         * testsuite/testfile.cc (Target_test::test_target_info):
10289         Likewise.
10290
10291         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10292         there is one.
10293
10294         * layout.h (class Layout): Add added_eh_frame_data_ field.
10295         * layout.cc (Layout::Layout): Initialize new field.
10296         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10297         output section until we find a section we merged successfully.
10298         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10299         that the size be non-zero.
10300
10301         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10302         qualifier.
10303
10304 2008-04-08  Craig Silverstein  <csilvers@google.com>
10305
10306         * configure.ac: Export new conditional variable HAVE_ZLIB.
10307         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10308         on HAVE_ZLIB.
10309         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10310         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10311
10312 2008-04-07  Ian Lance Taylor  <iant@google.com>
10313
10314         * version.cc (version_string): Set to "1.5".
10315
10316         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10317         Add issued_non_pic_error_ field.  Declare check_non_pic.
10318         (Target_x86_64::Scan::check_non_pic): New function.
10319         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10320         (Target_x86_64::Scan::global): Likewise.
10321
10322         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10323         addend parameter.  Change caller.  Handle merge sections.
10324         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10325         Address to Addend.  Don't add in the result of
10326         local_section_offset, pass down the addend and use the returned
10327         value.
10328         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10329         Update declarations of local_section_offset and symbol_value.
10330         * testsuite/two_file_test_1.cc (t18): New function.
10331         * testsuite/two_file_test_2.cc (f18): New function.
10332         * testsuite/two_file_test_main.cc (main): Call t18.
10333         * testsuite/two_file_test.h (t18, f18): Declare.
10334
10335         * configure.ac: Don't test for objdump, c++filt, or readelf.
10336         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10337         conditionals.
10338         (TEST_READELF): New variable.
10339         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10340         (check_PROGRAMS): Add two_file_strip_test.
10341         (two_file_strip_test): New target.
10342         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10343         (two_file_same_shared_strip_test_SOURCES): New variable.
10344         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10345         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10346         (two_file_same_shared_strip_test_LDADD): New variable.
10347         (two_file_shared_strip.so): New target.
10348         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10349         (ver_test_5.syms, ver_test_7.syms): Likewise.
10350         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10351         (strip_test_3.stdout): Use TEST_OBJDUMP.
10352         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10353
10354 2008-04-04  Cary Coutant  <ccoutant@google.com>
10355
10356         * symtab.h (Symbol::is_weak_undefined): New function.
10357         (Symbol::is_strong_undefined): New function.
10358         (Symbol::is_absolute): New function.
10359         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10360         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10361         absolute symbols.
10362         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10363         (weak_undef_test): New target.
10364         * testsuite/Makefile.in: Rebuild.
10365         * testsuite/weak_undef_file1.cc: New file.
10366         * testsuite/weak_undef_file2.cc: New file.
10367         * testsuite/weak_undef_test.cc: New file.
10368
10369 2008-04-03  Craig Silverstein  <csilvers@google.com>
10370
10371         * compressed_output.h (class Output_compressed_section): Use
10372         unsigned buffer.
10373         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10374         add zlib header.
10375         (zlib_compressed_suffix): Removed.
10376         (Output_compressed_section::set_final_data_size): Use unsigned
10377         buffers.
10378         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10379         Fix linker invocation.
10380         (flagstest_o_specialfile_and_compress_debug_sections):
10381         Likewise.
10382         * testsuite/Makefile.in: Regenerated.
10383
10384 2008-04-02  David S. Miller  <davem@davemloft.net>
10385
10386         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10387         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10388
10389 2008-04-02  Craig Silverstein  <csilvers@google.com>
10390
10391         * TODO: New file.
10392
10393 2008-04-02  Ian Lance Taylor  <iant@google.com>
10394
10395         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10396         parameters.  Update for new key type to views_.  Change all
10397         callers.
10398         (File_read::read): Adjust for byteshift in returned view.
10399         (File_read::add_view): New function, broken out of
10400         find_and_make_view.
10401         (File_read::make_view): New function, broken out of
10402         find_and_make_view.
10403         (File_read::find_or_make_view): Add offset and aligned
10404         parameters.  Rewrite accordingly.  Change all callers.
10405         (File_read::get_view): Add offset and aligned parameters.  Adjust
10406         for byteshift in return value.
10407         (File_read::get_lasting_view): Likewise.
10408         * fileread.h (class File_read): Update declarations.
10409         (class File_read::View): Add byteshift_ field.  Add byteshift to
10410         constructor.  Add byteshift method.
10411         * archive.h (Archive::clear_uncached_views): New function.
10412         (Archive::get_view): Add aligned parameter.  Change all callers.
10413         * object.h (Object::get_view): Add aligned parameter.  Change all
10414         callers.
10415         (Object::get_lasting_view): Likewise.
10416
10417         * fileread.cc (File_read::release): Don't call clear_views if
10418         there are multiple objects.
10419         * fileread.h (File_read::clear_uncached_views): New function.
10420         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10421         on the archive.
10422
10423 2008-03-31  Cary Coutant  <ccoutant@google.com>
10424
10425         Add thin archive support.
10426         * archive.cc (Archive::armagt): New const.
10427         (Archive::setup): Remove task parameter and calls to unlock.
10428         (Archive::unlock_nested_archives): New function.
10429         (Archive::read_header): Add nested_off parameter. Change
10430         all callers.
10431         (Archive::interpret_header): Likewise.
10432         (Archive::include_all_members): Change to handle thin
10433         archives.
10434         (Archive::include_member): Likewise.
10435         * archive.h (Archive::Archive): Add new parameters and
10436         initializers.
10437         (Archive::armagt): New const.
10438         (Archive::setup): Remove task parameter.
10439         (Archive::unlock_nested_archives): New function.
10440         (Archive::read_header): Add nested_off parameter.
10441         (Archive::interpret_header): Likewise.
10442         (Archive::Nested_archive_table): New typedef.
10443         (Archive::is_thin_archive_): New field.
10444         (Archive::nested_archives_): New field.
10445         (Archive::options_): New field.
10446         (Archive::dirpath_): New field.
10447         (Archive::task_): New field.
10448         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10449         for thin archives.  Pass additional parameters to
10450         Archive::Archive.  Unlock the archive file after calling
10451         Archive::setup.
10452
10453 2008-03-29  Ian Lance Taylor  <iant@google.com>
10454
10455         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10456         version symbol to be local.
10457         * testsuite/ver_test_4.sh: New file.
10458         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10459         (check_DATA): Add ver_test_4.syms.
10460         (ver_test_4.syms): New target.
10461         * testsuite/Makefile.in: Rebuild.
10462
10463         * output.cc
10464         (Output_section::Input_section_sort_entry::has_priority): New
10465         function.
10466         (Output_section::Input_section_sort_entry::match_file_name): New
10467         function.
10468         (Output_section::Input_section_sort_entry::match_section_name):
10469         Remove.
10470         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10471         Remove.
10472         (Output_section::Input_section_sort_entry::match_section_file):
10473         Remove.
10474         (Output_section::Input_section_sort_compare::operator()): Rewrite
10475         using new Input_section_sort_entry functions.  Sort crtbegin and
10476         crtend first.  Sort sections with no priority before sections with
10477         a priority.
10478         * testsuite/initpri1.c (d3): Check j != 4.
10479         (cd5): New constructor/destructor function.
10480         (main): Check j != 2.
10481
10482         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10483         new symbol when resolving, don't call set_is_default.
10484         * testsuite/ver_test_7.cc: New file.
10485         * testsuite/ver_test_7.sh: New file.
10486         * testsuite/Makefile.am (ver_test_7.so): New target.
10487         (ver_test_7.o): New target.
10488         (check_SCRIPTS): Add ver_test_7.sh.
10489         (check_DATA): Add ver_test_7.syms.
10490         (ver_test_7.syms): New target.
10491
10492 2008-03-28  Ian Lance Taylor  <iant@google.com>
10493
10494         * layout.cc (Layout::layout): If we see an input section with a
10495         name that needs sorting, set the must_sort flag for the output
10496         section.
10497         (Layout::make_output_section): If the name of the output section
10498         indicates that it might require sorting, set the may_sort flag.
10499         * output.h (Output_section::may_sort_attached_input_sections): New
10500         function.
10501         (Output_section::set_may_sort_attached_input_sections): New
10502         function.
10503         (Output_section::must_sort_attached_input_sections): New
10504         function.
10505         (Output_section::set_must_sort_attached_input_sections): New
10506         function.
10507         (class Output_section): Declare Input_section_sort_entry.  Define
10508         Input_section_sort_compare.  Declare
10509         sort_attached_input_sections.  Add new fields:
10510         may_sort_attached_input_sections_,
10511         must_sort_attached_input_sections_,
10512         attached_input_sections_are_sorted_.
10513         * output.cc (Output_section::Output_section): Initialize new
10514         fields.
10515         (Output_section::add_input_section): Add an entry to
10516         input_sections_ if may_sort or must_sort are true.
10517         (Output_section::set_final_data_size): Call
10518         sort_attached_input_sections if necessary.
10519         (Output_section::Input_section_sort_entry): Define new class.
10520         (Output_section::Input_section_sort_compare::operator()): New
10521         function.
10522         (Output_section::sort_attached_input_sections): New function.
10523         * configure.ac: Check whether the compiler supports constructor
10524         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10525         * testsuite/initpri1.c: New file.
10526         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10527         CONSTRUCTOR_PRIORITY.
10528         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10529         (initpri1_LDFLAGS): New variable.
10530         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10531
10532 2008-03-27  Ian Lance Taylor  <iant@google.com>
10533
10534         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10535         * testsuite/common_test_1.c: New file.
10536         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10537         (common_test_1_SOURCES): New variable.
10538         (common_test_1_DEPENDENCIES): New variable.
10539         (common_test_1_LDFLAGS): New variable.
10540
10541         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10542         and commons_ correctly when NAME/VERSION does not override
10543         NAME/NULL.
10544         * testsuite/ver_test_6.c: New file.
10545         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10546         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10547         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10548
10549 2008-03-26  Ian Lance Taylor  <iant@google.com>
10550
10551         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10552         of an undefined symbol from a version script.
10553         * testsuite/Makefile.am (ver_test_5.so): New target.
10554         (ver_test_5.o): New target.
10555         (check_SCRIPTS): Add ver_test_5.sh.
10556         (check_DATA): Add ver_test_5.syms.
10557         (ver_test_5.syms): New target.
10558         * testsuite/ver_test_5.cc: New file.
10559         * testsuite/ver_test_5.script: New file.
10560         * testsuite/ver_test_5.sh: New file.
10561         * Makefile.in, testsuite/Makefile.in: Rebuild.
10562
10563         PR gold/5986
10564         Fix problems building gold with gcc 4.3.0.
10565         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10566         (gold_error_at_location, gold_warning_at_location): Use it.
10567         * configure.ac: Check whether we can compile and use a template
10568         function with a printf attribute.
10569         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10570         when jumping over bytes.
10571         * object.cc: Instantiate Object::read_section_data.
10572         * debug.h: Include <cstring>
10573         * dwarf_reader.cc: Include <algorithm>
10574         * main.cc: Include <cstring>.
10575         * options.cc: Include <cstring>.
10576         * output.cc: Include <cstring>.
10577         * script.cc: Include <cstring>.
10578         * script.h: Include <string>.
10579         * symtab.cc: Include <cstring> and <algorithm>.
10580         * target-select.cc: Include <cstring>.
10581         * version.cc: Include <string>.
10582         * testsuite/testmain.cc: Include <cstdlib>.
10583         * configure, config.in: Rebuild.
10584
10585 2008-03-25  Ian Lance Taylor  <iant@google.com>
10586
10587         * options.cc: Include "../bfd/bfdver.h".
10588         (options::help): Print bug reporting address.
10589
10590         * version.cc (print_version): Adjust output for current value of
10591         BFD_VERSION_STRING.
10592
10593         * NEWS: New file.
10594
10595         * options.cc (options::help): Print list of supported targets.
10596         * target-select.h: Include <vector>.
10597         (class Target_selector): Make machine_, size_, and is_big_endian_
10598         fields const.  Add bfd_name_ and instantiated_target_ fields.
10599         (Target_selector::Target_selector): Add bfd_name parameter.
10600         (Target_selector::recognize): Make non-virtual, call
10601         do_recognize.
10602         (Target_selector::recognize_by_name): Make non-virtual, call
10603         do_recognize_by_name.
10604         (Target_selector::supported_names): New function.
10605         (Target_selector::bfd_name): New function.
10606         (Target_selector::do_instantiate_target): New pure virtual
10607         function.
10608         (Target_selector::do_recognize): New virtual function.
10609         (Target_selector::do_recognize_by_name): New virtual function.
10610         (Target_selector::instantiate_target): New private function.
10611         (supported_target_names): Declare.
10612         * target-select.cc (Target_selector::Target_selector): Update for
10613         new parameter and fields.
10614         (select_target_by_name): Check that the name matches before
10615         calling recognize_by_name.
10616         (supported_target_names): New function.
10617         * i386.cc (class Target_selector_i386): Update Target_selector
10618         constructor call.  Remove recognize and recognize_by_name.  Add
10619         do_instantiate_target.
10620         * x86_64.cc (class Target_selector_x86_64): Likewise.
10621         * testsuite/testfile.cc (class Target_selector_test): Update for
10622         changes to Target_selector.
10623
10624         * README: Rewrite, with some notes on unsupported features.
10625
10626 2008-03-24  Cary Coutant  <ccoutant@google.com>
10627
10628         * i386.cc (Target_i386::Got_type): New enum declaration.
10629         (Target_i386::Scan::local): Updated callers of Output_data_got
10630         member functions.
10631         (Target_i386::Scan::global): Likewise.
10632         (Target_i386::Relocate::relocate): Likewise.
10633         (Target_i386::Relocate::relocate_tls): Likewise.
10634         * object.h (Got_offset_list): New class.
10635         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10636         (Sized_relobj::local_got_offset): Likewise.
10637         (Sized_relobj::set_local_got_offset): Likewise.
10638         (Sized_relobj::local_has_tls_got_offset): Removed.
10639         (Sized_relobj::local_tls_got_offset): Removed.
10640         (Sized_relobj::set_local_tls_got_offset): Removed.
10641         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10642         * output.cc (Output_data_got::add_global): Added got_type parameter.
10643         (Output_data_got::add_global_with_rel): Likewise.
10644         (Output_data_got::add_global_with_rela): Likewise.
10645         (Output_data_got::add_global_pair_with_rel): New function.
10646         (Output_data_got::add_global_pair_with_rela): New function.
10647         (Output_data_got::add_local): Added got_type parameter.
10648         (Output_data_got::add_local_with_rel): Likewise.
10649         (Output_data_got::add_local_with_rela): Likewise.
10650         (Output_data_got::add_local_pair_with_rel): New function.
10651         (Output_data_got::add_local_pair_with_rela): New function.
10652         (Output_data_got::add_global_tls): Removed.
10653         (Output_data_got::add_global_tls_with_rel): Removed.
10654         (Output_data_got::add_global_tls_with_rela): Removed.
10655         (Output_data_got::add_local_tls): Removed.
10656         (Output_data_got::add_local_tls_with_rel): Removed.
10657         (Output_data_got::add_local_tls_with_rela): Removed.
10658         * output.h (Output_data_got::add_global): Added got_type parameter.
10659         (Output_data_got::add_global_with_rel): Likewise.
10660         (Output_data_got::add_global_with_rela): Likewise.
10661         (Output_data_got::add_global_pair_with_rel): New function.
10662         (Output_data_got::add_global_pair_with_rela): New function.
10663         (Output_data_got::add_local): Added got_type parameter.
10664         (Output_data_got::add_local_with_rel): Likewise.
10665         (Output_data_got::add_local_with_rela): Likewise.
10666         (Output_data_got::add_local_pair_with_rel): New function.
10667         (Output_data_got::add_local_pair_with_rela): New function.
10668         (Output_data_got::add_global_tls): Removed.
10669         (Output_data_got::add_global_tls_with_rel): Removed.
10670         (Output_data_got::add_global_tls_with_rela): Removed.
10671         (Output_data_got::add_local_tls): Removed.
10672         (Output_data_got::add_local_tls_with_rel): Removed.
10673         (Output_data_got::add_local_tls_with_rela): Removed.
10674         * resolve.cc (Symbol::override_base_with_special): Removed
10675         reference to has_got_offset_ field.
10676         * symtab.cc (Symbol::init_fields): Replaced initialization
10677         of got_offset_ with got_offsets_.  Removed initialization
10678         of has_got_offset_
10679         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10680         (Symbol::got_offset): Likewise.
10681         (Symbol::set_got_offset): Likewise.
10682         (Symbol::has_tls_got_offset): Removed.
10683         (Symbol::tls_got_offset): Removed.
10684         (Symbol::set_tls_got_offset): Removed.
10685         (Symbol::got_offset_): Removed.
10686         (Symbol::tls_mod_got_offset_): Removed.
10687         (Symbol::tls_pair_got_offset_): Removed.
10688         (Symbol::got_offsets_): New field.
10689         (Symbol::has_got_offset): Removed.
10690         (Symbol::has_tls_mod_got_offset): Removed.
10691         (Symbol::has_tls_pair_got_offset): Removed.
10692         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10693         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10694         member functions.
10695         (Target_x86_64::Scan::global): Likewise.
10696         (Target_x86_64::Relocate::relocate): Likewise.
10697         (Target_x86_64::Relocate::relocate_tls): Likewise.
10698
10699 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10700
10701         * yyscript.y: Fix spelling error in comment.
10702
10703 2008-03-24  Ian Lance Taylor  <iant@google.com>
10704
10705         * options.h (class General_options): Define build_id option.
10706         * layout.h (class Layout): Declare write_build_id, create_note,
10707         create_build_id.  Add build_id_note_ member.
10708         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10709         "libiberty.h", "md5.h", "sha1.h".
10710         (Layout::Layout): Initialize eh_frame_data_,
10711         eh_frame_hdr_section_, and build_id_note_.
10712         (Layout::finalize): Call create_build_id.
10713         (Layout::create_note): New function, broken out of
10714         Layout::create_gold_note.
10715         (Layout::create_gold_note): Call create_note.
10716         (Layout::create_build_id): New function.
10717         (Layout::write_build_id): New function.
10718         (Close_task_runner::run): Call write_build_id.
10719
10720         * x86_64.cc: Correct license to GPLv3.
10721
10722 2008-03-23  Ian Lance Taylor  <iant@google.com>
10723
10724         * options.cc: Include "demangle.h".
10725         (parse_optional_string): New function.
10726         (parse_long_option): Handle takes_optional_argument.
10727         (parse_short_option): Update dash_z initializer.  Handle
10728         takes_optional_argument.
10729         (General_options::General_options): Initialize do_demangle_.
10730         (General_options::finalize): Set do_demangle_.  Handle demangling
10731         style.
10732         * options.h (parse_optional_string): Declare.
10733         (struct One_option): Add optional_arg field.  Update constructor.
10734         Update call constructor calls.  Add takes_optional_argument
10735         function.
10736         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
10737         (DEFINE_optional_string): Define.
10738         (General_options::demangle): Change from DEFINE_bool to
10739         DEFINE_optional_string.
10740         (General_options::no_demangle): New function.
10741         (General_options::do_demangle): New function.
10742         (General_options::set_do_demangle): New function.
10743         (General_options::execstack_status_): Move definition to end of
10744         class definition.
10745         (General_options::static_): Likewise.
10746         (General_options::do_demangle_): New field.
10747         * object.cc (big_endian>::get_symbol_location_info): Call
10748         Options::do_demangle, not Options::demangle.
10749         * symtab.cc (demangle): Likewise.
10750
10751 2008-03-22  Ian Lance Taylor  <iant@google.com>
10752
10753         * gold.h: Include <cstddef> and <sys/types.h>
10754         * options.h: Include <cstring>.
10755
10756 2008-03-21  Ian Lance Taylor  <iant@google.com>
10757
10758         * Added source code to GNU binutils.