* gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
[external/binutils.git] / gold / ChangeLog
1 2011-05-23 Cary Coutant  <ccoutant@google.com>
2
3         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5         bit when checking got_type.
6         * incremental.cc (Sized_incremental_binary::setup_readers):
7         Store symbol table and string table locations; initialize bit vector
8         of file status flags.
9         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
10         unchanged files.
11         (Sized_incremental_binary::do_process_got_plt): New function.
12         (Sized_incremental_binary::get_symtab_view): Use stored locations.
13         (Output_section_incremental_inputs::set_final_data_size): Record
14         file index for each input file.
15         (Output_section_incremental_inputs::write_got_plt): Store file index
16         instead of input entry offset for each GOT entry.
17         * incremental.h
18         (Incremental_input_entry::Incremental_input_entry): Initialize new
19         data member.
20         (Incremental_input_entry::set_offset): Store file index.
21         (Incremental_input_entry::get_file_index): New function.
22         (Incremental_input_entry::file_index_): New data member.
23         (Incremental_binary::process_got_plt): New function.
24         (Incremental_binary::do_process_got_plt): New function.
25         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
26         data members.
27         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
28         (Sized_incremental_binary::set_file_is_unchanged): New function.
29         (Sized_incremental_binary::file_is_unchanged): New function.
30         (Sized_incremental_binary::do_process_got_plt): New function.
31         (Sized_incremental_binary::file_status_): New data member.
32         (Sized_incremental_binary::main_symtab_loc_): New data member.
33         (Sized_incremental_binary::main_strtab_loc_): New data member.
34         * output.cc (Output_data_got::Got_entry::write): Add case
35         RESERVED_CODE.
36         (Output_data_got::add_global): Call add_got_entry.
37         (Output_data_got::add_global_plt): Likewise.
38         (Output_data_got::add_global_with_rel): Likewise.
39         (Output_data_got::add_global_with_rela): Likewise.
40         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
41         (Output_data_got::add_global_pair_with_rela): Likewise.
42         (Output_data_got::add_local): Call add_got_entry.
43         (Output_data_got::add_local_plt): Likewise.
44         (Output_data_got::add_local_with_rel): Likewise.
45         (Output_data_got::add_local_with_rela): Likewise.
46         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
47         (Output_data_got::add_local_pair_with_rela): Likewise.
48         (Output_data_got::reserve_slot): New function.
49         (Output_data_got::reserve_slot_for_global): New function.
50         (Output_data_got::add_got_entry): New function.
51         (Output_data_got::add_got_entry_pair): New function.
52         (Output_section::add_output_section_data): Edit FIXME.
53         * output.h
54         (Output_section_data_build::Output_section_data_build): New
55         constructor with size parameter.
56         (Output_data_space::Output_data_space): Likewise.
57         (Output_data_got::Output_data_got): Initialize new data member; new
58         constructor with size parameter.
59         (Output_data_got::add_constant): Call add_got_entry.
60         (Output_data_got::reserve_slot): New function.
61         (Output_data_got::reserve_slot_for_global): New function.
62         (class Output_data_got::Got_entry): Add RESERVED_CODE.
63         (Output_data_got::add_got_entry): New function.
64         (Output_data_got::add_got_entry_pair): New function.
65         (Output_data_got::free_list_): New data member.
66         * target.h (Sized_target::init_got_plt_for_update): New function.
67         (Sized_target::register_global_plt_entry): New function.
68         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
69         Initialize new data member; call init; add constructor with PLT count.
70         (Output_data_plt_x86_64::init): New function.
71         (Output_data_plt_x86_64::add_relocation): New function.
72         (Output_data_plt_x86_64::reserve_slot): New function.
73         (Output_data_plt_x86_64::free_list_): New data member.
74         (Target_x86_64::init_got_plt_for_update): New function.
75         (Target_x86_64::register_global_plt_entry): New function.
76         (Output_data_plt_x86_64::add_entry): Allocate from free list for
77         incremental updates.
78         (Output_data_plt_x86_64::add_relocation): New function.
79         * testsuite/object_unittest.cc (Object_test): Set default options.
80
81 2011-05-16  Ian Lance Taylor  <iant@google.com>
82
83         * options.h (class General_options): Make -i a synonym for -r.
84
85 2011-05-16  Ian Lance Taylor  <iant@google.com>
86
87         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
88
89 2011-05-10 Cary Coutant  <ccoutant@google.com>
90
91         * object.cc (Sized_relobj::do_count_local_symbols): Check for
92         strip_all (-s).
93
94 2011-05-06  Ian Lance Taylor  <iant@google.com>
95
96         * layout.cc (Layout::layout): If the output section flags change,
97         update the ordering.
98
99 2011-04-25 Cary Coutant  <ccoutant@google.com>
100
101         * incremental-dump.cc (dump_incremental_inputs): Print local
102         symbol info for each input file.
103         * incremental.cc
104         (Output_section_incremental_inputs::set_final_data_size): Add local
105         symbol info to input file entries in incremental info.
106         (Output_section_incremental_inputs::write_info_blocks): Likewise.
107         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
108         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
109         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
110         implementation.
111         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
112         (Sized_incr_relobj::do_relocate): Write the local symbols.
113         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
114         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
115         Adjust size of input file header.
116         (Incremental_inputs_reader::get_local_symbol_offset): New function.
117         (Incremental_inputs_reader::get_local_symbol_count): New function.
118         (Incremental_inputs_reader::get_input_section): Adjust size of input
119         file header.
120         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
121         (Sized_incr_relobj::This): New typedef.
122         (Sized_incr_relobj::sym_size): New const data member.
123         (Sized_incr_relobj::Local_symbol): New struct.
124         (Sized_incr_relobj::do_output_local_symbol_count): New function.
125         (Sized_incr_relobj::do_local_symbol_offset): New function.
126         (Sized_incr_relobj::local_symbol_count_): New data member.
127         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
128         (Sized_incr_relobj::local_symbol_index_): New data member.
129         (Sized_incr_relobj::local_symbol_offset_): New data member.
130         (Sized_incr_relobj::local_dynsym_offset_): New data member.
131         (Sized_incr_relobj::local_symbols_): New data member.
132         * object.h (Relobj::output_local_symbol_count): New function.
133         (Relobj::local_symbol_offset): New function.
134         (Relobj::do_output_local_symbol_count): New function.
135         (Relobj::do_local_symbol_offset): New function.
136         (Sized_relobj::do_output_local_symbol_count): New function.
137         (Sized_relobj::do_local_symbol_offset): New function.
138
139 2011-04-22  Vladimir Simonov  <sv@sw.ru>
140
141         * descriptors.cc (set_close_on_exec): New function.
142         (Descriptors::open): Use set_close_on_exec.
143         * output.cc (S_ISLNK): Define if not defined.
144
145 2011-04-22 Cary Coutant  <ccoutant@google.com>
146
147         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
148         global symbol map.
149         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
150         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
151         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
152         relocations.
153         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
154         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
155         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
156         * incremental.h
157         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
158         function.
159         (Incremental_binary::apply_incremental_relocs): New function.
160         (Incremental_binary::do_apply_incremental_relocs): New function.
161         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
162         data member.
163         (Sized_incremental_binary::add_global_symbol): New function.
164         (Sized_incremental_binary::global_symbol): New function.
165         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
166         (Sized_incremental_binary::symbol_map_): New data member.
167         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
168         * target.h (Sized_target::apply_relocation): New function.
169         * target-reloc.h (apply_relocation): New function.
170         * x86_64.cc (Target_x86_64::apply_relocation): New function.
171
172 2011-04-22  Doug Kwan  <dougkwan@google.com>
173
174         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
175         flag of a SHT_ARM_EXIDX section.
176         * testsuite/Makefile.am (arm_exidx_test): New test rules.
177         * testsuite/Makefile.in: Regenerate.
178         * testsuite/arm_exidx_test.s: New file.
179         * testsuite/arm_exidx_test.sh: Same.
180
181 2011-04-20 Cary Coutant  <ccoutant@google.com>
182
183         PR gold/12689
184         * archive.h (Incremental_archive_entry::Archive_member):
185         Initialize arg_serial_ (second constructor).
186
187 2011-04-17  Ian Lance Taylor  <iant@google.com>
188
189         * object.cc (Relocate_info::location): Simplify location string.
190         * errors.cc (Errors::error_at_location): Don't print program
191         name.
192         (Errors::warning_at_location): Likewise.
193         (Errors::undefined_symbol): Likewise.
194         * testsuite/debug_msg.sh: Update accordingly.
195
196 2011-04-14 Cary Coutant  <ccoutant@google.com>
197
198         * gold/layout.cc (Layout::symtab_section_offset): New function.
199         * gold/layout.h (Layout::symtab_section_offset): New function.
200         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
201
202 2011-04-12  Ian Lance Taylor  <iant@google.com>
203
204         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
205         with MREMAP_MAYMOVE.
206         * output.h (class Output_file): Add map_is_allocated_ field.
207         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
208         not available, provide stubs.  If mremap is not available, #define
209         it to gold_mremap.
210         (MREMAP_MAYMOVE): Define if not defined.
211         (Output_file::Output_file): Initialize map_is_allocated_.
212         (Output_file::resize): Check map_is_allocated_.
213         (Output_file::map_anonymous): If mmap fails, use malloc.
214         (Output_file::unmap): Don't do anything for an anonymous map.
215         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
216         is not available, provide stubs.
217         (File_read::View::~View): Use free rather than delete[].
218         (File_read::make_view): Use malloc rather than new[].  If mmap
219         fails, use malloc.
220         (File_read::find_or_make_view): Use malloc rather than new[].
221         * gold.h: Remove HAVE_REMAP code.
222         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
223         exists.  Rename mremap to gold_mremap.  If mmap is not available
224         don't do anything.
225         * configure, config.in: Rebuild.
226
227 2011-04-11  Ian Lance Taylor  <iant@google.com>
228
229         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
230         initialize local variable v.
231
232 2011-04-11  Cary Coutant  <ccoutant@google.com>
233
234         * archive.cc (Archive::include_member): Adjust call to
235         report_object.
236         (Add_archive_symbols::run): Track argument serial numbers.
237         (Lib_group::include_member): Likewise.
238         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
239         * archive.h (Incremental_archive_entry::Archive_member):
240         Initialize arg_serial_.
241         (Archive_member::arg_serial_): New data member.
242         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
243         (Sized_dynobj::do_add_symbols): Track symbols when doing an
244         incremental link.
245         (Sized_dynobj::do_for_all_local_got_entries): New function.
246         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
247         function.
248         * fileread.cc (get_mtime): New function.
249         * fileread.h (get_mtime): New function.
250         * gold.cc (queue_initial_tasks): Check for incremental update.
251         (process_incremental_input): New function.
252         (queue_middle_tasks): Don't force valid target for incremental
253         update.
254         * incremental-dump.cc (find_input_containing_global): Adjust
255         size of symbol info entry.
256         (dump_incremental_inputs): Dump argument serial number and
257         in_system_directory flag; bias shndx by 1; print symbol names
258         when dumping per-file symbol lists; use new symbol info readers.
259         * incremental.cc
260         (Output_section_incremental_inputs:update_data_size): New function.
261         (Sized_incremental_binary::setup_readers): Setup input readers
262         for each input file; build maps for files added from libraries
263         and scripts.
264         (Sized_incremental_binary::check_input_args): New function.
265         (Sized_incremental_binary::do_check_inputs): Build map of argument
266         serial numbers to input arguments.
267         (Sized_incremental_binary::do_file_has_changed): Rename
268         do_file_is_unchanged to this; compare file modification times.
269         (Sized_incremental_binary::do_init_layout): New function.
270         (Sized_incremental_binary::do_reserve_layout): New function.
271         (Sized_incremental_binary::do_get_input_reader): Remove.
272         (Sized_incremental_binary::get_symtab_view): New function.
273         (Incremental_checker::can_incrementally_link_output_file): Remove.
274         (Incremental_inputs::report_command_line): Exclude --debug options.
275         (Incremental_inputs::report_archive_begin): Add parameter; track
276         argument serial numbers; don't put input file entry for archive
277         before archive members.
278         (Incremental_inputs::report_archive_end): Put input file entry
279         for archive after archive members.
280         (Incremental_inputs::report_object): Add parameter; track argument
281         serial numbers and in_system_directory flag.
282         (Incremental_inputs::report_script): Add parameter; track argument
283         serial numbers.
284         (Output_section_incremental_inputs::set_final_data_size): Adjust
285         size of symbol info entry; check for forwarding symbols.
286         (Output_section_incremental_inputs::write_input_files): Write
287         in_system_directory flag and argument serial number.
288         (Output_section_incremental_inputs::write_info_blocks): Map section
289         indices between incremental info and original input file; store
290         input section index for each symbol.
291         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
292         change operator() to visit().
293         (class Global_got_offset_visitor): Likewise.
294         (class Global_symbol_visitor_got_plt):
295         (Output_section_incremental_inputs::write_got_plt): Use new visitor
296         classes.
297         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
298         (Sized_incr_relobj::do_read_symbols): New function.
299         (Sized_incr_relobj::do_layout): New function.
300         (Sized_incr_relobj::do_layout_deferred_sections): New function.
301         (Sized_incr_relobj::do_add_symbols): New function.
302         (Sized_incr_relobj::do_should_include_member): New function.
303         (Sized_incr_relobj::do_for_all_global_symbols): New function.
304         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
305         (Sized_incr_relobj::do_section_size): New function.
306         (Sized_incr_relobj::do_section_name): New function.
307         (Sized_incr_relobj::do_section_contents): New function.
308         (Sized_incr_relobj::do_section_flags): New function.
309         (Sized_incr_relobj::do_section_entsize): New function.
310         (Sized_incr_relobj::do_section_address): New function.
311         (Sized_incr_relobj::do_section_type): New function.
312         (Sized_incr_relobj::do_section_link): New function.
313         (Sized_incr_relobj::do_section_info): New function.
314         (Sized_incr_relobj::do_section_addralign): New function.
315         (Sized_incr_relobj::do_initialize_xindex): New function.
316         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
317         (Sized_incr_relobj::do_read_relocs): New function.
318         (Sized_incr_relobj::do_gc_process_relocs): New function.
319         (Sized_incr_relobj::do_scan_relocs): New function.
320         (Sized_incr_relobj::do_count_local_symbols): New function.
321         (Sized_incr_relobj::do_finalize_local_symbols): New function.
322         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
323         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
324         (Sized_incr_relobj::do_relocate): New function.
325         (Sized_incr_relobj::do_set_section_offset): New function.
326         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
327         (Sized_incr_dynobj::do_read_symbols): New function.
328         (Sized_incr_dynobj::do_layout): New function.
329         (Sized_incr_dynobj::do_add_symbols): New function.
330         (Sized_incr_dynobj::do_should_include_member): New function.
331         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
332         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
333         (Sized_incr_dynobj::do_section_size): New function.
334         (Sized_incr_dynobj::do_section_name): New function.
335         (Sized_incr_dynobj::do_section_contents): New function.
336         (Sized_incr_dynobj::do_section_flags): New function.
337         (Sized_incr_dynobj::do_section_entsize): New function.
338         (Sized_incr_dynobj::do_section_address): New function.
339         (Sized_incr_dynobj::do_section_type): New function.
340         (Sized_incr_dynobj::do_section_link): New function.
341         (Sized_incr_dynobj::do_section_info): New function.
342         (Sized_incr_dynobj::do_section_addralign): New function.
343         (Sized_incr_dynobj::do_initialize_xindex): New function.
344         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
345         (make_sized_incremental_object): New function.
346         (Incremental_library::copy_unused_symbols): New function.
347         (Incremental_library::do_for_all_unused_symbols): New function.
348         * incremental.h (enum Incremental_input_flags): New type.
349         (class Incremental_checker): Remove.
350         (Incremental_input_entry::Incremental_input_entry): Add argument
351         serial number.
352         (Incremental_input_entry::arg_serial): New function.
353         (Incremental_input_entry::set_is_in_system_directory): New function.
354         (Incremental_input_entry::is_in_system_directory): New function.
355         (Incremental_input_entry::arg_serial_): New data member.
356         (Incremental_input_entry::is_in_system_directory_): New data member.
357         (class Script_info): Move here from script.h.
358         (Script_info::Script_info): Add filename parameter.
359         (Script_info::filename): New function.
360         (Script_info::filename_): New data member.
361         (Incremental_script_entry::Incremental_script_entry): Add argument
362         serial number.
363         (Incremental_object_entry::Incremental_object_entry): Likewise.
364         (Incremental_object_entry::add_input_section): Build list of input
365         sections with map to original shndx.
366         (Incremental_object_entry::get_input_section_index): New function.
367         (Incremental_object_entry::shndx_): New data member.
368         (Incremental_object_entry::name_key_): Rename; adjust all refs.
369         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
370         (Incremental_archive_entry::Incremental_archive_entry): Add argument
371         serial number.
372         (Incremental_inputs::report_archive_begin): Likewise.
373         (Incremental_inputs::report_object): Likewise.
374         (Incremental_inputs::report_script): Likewise.
375         (class Incremental_global_symbol_reader): New class.
376         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
377         and store flags and input file type.
378         (Incremental_input_entry_reader::arg_serial): New function.
379         (Incremental_input_entry_reader::type): Extract type from flags.
380         (Incremental_input_entry_reader::is_in_system_directory): New function.
381         (Incremental_input_entry_reader::get_input_section_count): Call
382         accessor function for type.
383         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
384         function for type; adjust size of global symbol entry.
385         (Incremental_input_entry_reader::get_global_symbol_count): Call
386         accessor function for type.
387         (Incremental_input_entry_reader::get_object_count): Likewise.
388         (Incremental_input_entry_reader::get_object_offset): Likewise.
389         (Incremental_input_entry_reader::get_member_count): Likewise.
390         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
391         (Incremental_input_entry_reader::get_member_offset): Likewise.
392         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
393         (Incremental_input_entry_reader::Global_symbol_info): Remove.
394         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
395         (Incremental_input_entry_reader::get_global_symbol_reader): New
396         function.
397         (Incremental_input_entry_reader::get_output_symbol_index): New
398         function.
399         (Incremental_input_entry_reader::type_): Remove.
400         (Incremental_input_entry_reader::flags_): New data member.
401         (Incremental_inputs_reader::input_file_offset): New function.
402         (Incremental_inputs_reader::input_file_index): New function.
403         (Incremental_inputs_reader::input_file): Call input_file_offset.
404         (Incremental_inputs_reader::input_file_at_offset): New function.
405         (Incremental_relocs_reader::get_r_type): Reformat.
406         (Incremental_relocs_reader::get_r_shndx): Reformat.
407         (Incremental_relocs_reader::get_r_offset): Reformat.
408         (Incremental_relocs_reader::data): New function.
409         (Incremental_binary::Incremental_binary): Initialize new data members.
410         (Incremental_binary::check_inputs): Add cmdline parameter.
411         (Incremental_binary::file_is_unchanged): Remove.
412         (Input_reader::arg_serial): New function.
413         (Input_reader::get_unused_symbol_count): New function.
414         (Input_reader::get_unused_symbol): New function.
415         (Input_reader::do_arg_serial): New function.
416         (Input_reader::do_get_unused_symbol_count): New function.
417         (Input_reader::do_get_unused_symbol): New function.
418         (Incremental_binary::input_file_count): New function.
419         (Incremental_binary::get_input_reader): Change signature to use
420         index instead of filename.
421         (Incremental_binary::file_has_changed): New function.
422         (Incremental_binary::get_input_argument): New function.
423         (Incremental_binary::get_library): New function.
424         (Incremental_binary::get_script_info): New function.
425         (Incremental_binary::init_layout): New function.
426         (Incremental_binary::reserve_layout): New function.
427         (Incremental_binary::output_file): New function.
428         (Incremental_binary::do_check_inputs): New function.
429         (Incremental_binary::do_file_is_unchanged): Remove.
430         (Incremental_binary::do_file_has_changed): New function.
431         (Incremental_binary::do_init_layout): New function.
432         (Incremental_binary::do_reserve_layout): New function.
433         (Incremental_binary::do_input_file_count): New function.
434         (Incremental_binary::do_get_input_reader): Change signature.
435         (Incremental_binary::input_args_map_): New data member.
436         (Incremental_binary::library_map_): New data member.
437         (Incremental_binary::script_map_): New data member.
438         (Sized_incremental_binary::Sized_incremental_binary): Initialize
439         new data members.
440         (Sized_incremental_binary::output_section): New function.
441         (Sized_incremental_binary::inputs_reader): Add const.
442         (Sized_incremental_binary::symtab_reader): Add const.
443         (Sized_incremental_binary::relocs_reader): Add const.
444         (Sized_incremental_binary::got_plt_reader): Add const.
445         (Sized_incremental_binary::get_symtab_view): New function.
446         (Sized_incremental_binary::Inputs_reader): New typedef.
447         (Sized_incremental_binary::Input_entry_reader): New typedef.
448         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
449         (Sized_incremental_binary::do_file_is_unchanged): Remove.
450         (Sized_incremental_binary::do_file_has_changed): New function.
451         (Sized_incremental_binary::do_init_layout): New function.
452         (Sized_incremental_binary::do_reserve_layout): New function.
453         (Sized_input_reader::Inputs_reader): Remove.
454         (Sized_input_reader::Input_entry_reader): Remove.
455         (Sized_input_reader::do_arg_serial): New function.
456         (Sized_input_reader::do_get_unused_symbol_count): New function.
457         (Sized_input_reader::do_get_unused_symbol): New function.
458         (Sized_incremental_binary::do_input_file_count): New function.
459         (Sized_incremental_binary::do_get_input_reader): Change signature;
460         use index instead of filename.
461         (Sized_incremental_binary::section_map_): New data member.
462         (Sized_incremental_binary::input_entry_readers_): New data member.
463         (class Sized_incr_relobj): New class.
464         (class Sized_incr_dynobj): New class.
465         (make_sized_incremental_object): New function.
466         (class Incremental_library): New class.
467         * layout.cc (Free_list::num_lists): New static data member.
468         (Free_list::num_nodes): New static data member.
469         (Free_list::num_removes): New static data member.
470         (Free_list::num_remove_visits): New static data member.
471         (Free_list::num_allocates): New static data member.
472         (Free_list::num_allocate_visits): New static data member.
473         (Free_list::init): New function.
474         (Free_list::remove): New function.
475         (Free_list::allocate): New function.
476         (Free_list::dump): New function.
477         (Free_list::print_stats): New function.
478         (Layout_task_runner::run): Resize output file for incremental updates.
479         (Layout::Layout): Initialize new data members.
480         (Layout::set_incremental_base): New function.
481         (Layout::init_fixed_output_section): New function.
482         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
483         incremental updates.
484         (Layout::create_gold_note): Do not create gold note section for
485         incremental updates.
486         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
487         for incremental updates.
488         (Layout::set_section_offsets): For incremental updates, allocate space
489         from free list.
490         (Layout::create_symtab_sections): Layout with offsets relative to
491         start of section; for incremental updates, allocate space from free
492         list.
493         (Layout::create_shdrs): For incremental updates, allocate space from
494         free list.
495         (Layout::finish_dynamic_section): For incremental updates, do not
496         check --as-needed (fixed in subsequent patch).
497         * layout.h (class Free_list): New class.
498         (Layout::set_incremental_base): New function.
499         (Layout::incremental_base): New function.
500         (Layout::init_fixed_output_section): New function.
501         (Layout::allocate): New function.
502         (Layout::incremental_base_): New data member.
503         (Layout::free_list_): New data member.
504         * main.cc (main): Print Free_list statistics.
505         * object.cc (Relobj::finalize_incremental_relocs): Add
506         clear_counts parameter; clear counts only when clear_counts is set.
507         (Sized_relobj::Sized_relobj): Initialize new base class.
508         (Sized_relobj::do_layout): Don't report special sections.
509         (Sized_relobj::do_for_all_local_got_entries): New function.
510         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
511         symtab_off to all symbol table offsets.
512         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
513         * object.h (class Got_offset_list): Move to top of file.
514         (Object::Object): Allow case where input_file == NULL.
515         (Object::~Object): Likewise.
516         (Object::input_file): Assert that input_file != NULL.
517         (Object::lock): Allow case where input_file == NULL.
518         (Object::unlock): Likewise.
519         (Object::is_locked): Likewise.
520         (Object::token): Likewise.
521         (Object::release): Likewise.
522         (Object::is_incremental): New function.
523         (Object::get_mtime): New function.
524         (Object::for_all_local_got_entries): New function.
525         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
526         (Object::set_is_in_system_directory): New function.
527         (Object::is_in_system_directory): New function.
528         (Object::do_is_incremental): New function.
529         (Object::do_get_mtime): New function.
530         (Object::do_for_all_local_got_entries): New function.
531         (Object::is_in_system_directory_): New data member.
532         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
533         (class Sized_relobj_base): New class.
534         (class Sized_relobj): Derive from Sized_relobj_base.
535         (class Sized_relobj::Symbols): Redeclare from base class.
536         (class Sized_relobj::local_got_offset_list): Remove.
537         (class Sized_relobj::Output_sections): Redeclare from base class.
538         (class Sized_relobj::do_for_all_local_got_entries): New function.
539         (class Sized_relobj::write_local_symbols): Add offset parameter.
540         (class Sized_relobj::local_symbol_offset_): Update comment.
541         (class Sized_relobj::local_dynsym_offset_): Update comment.
542         * options.cc (Input_arguments::add_file): Remove const.
543         * options.h (Input_file_argument::Input_file_argument):
544         Initialize arg_serial_ (all constructors).
545         (Input_file_argument::set_arg_serial): New function.
546         (Input_file_argument::arg_serial): New function.
547         (Input_file_argument::arg_serial_): New data member.
548         (Input_arguments::Input_arguments): Initialize file_count_.
549         (Input_arguments::add_file): Remove const.
550         (Input_arguments::number_of_input_files): New function.
551         (Input_arguments::file_count_): New data member.
552         (Command_line::number_of_input_files): Call
553         Input_arguments::number_of_input_files.
554         * output.cc (Output_segment_headers::Output_segment_headers):
555         Set current size.
556         (Output_section::Input_section::current_data_size): New function.
557         (Output_section::Output_section): Initialize new data members.
558         (Output_section::add_input_section): Don't do merge sections for
559         an incremental link; allocate space from free list for an
560         incremental update.
561         (Output_section::add_output_section_data): Allocate space from
562         free list for an incremental update.
563         (Output_section::update_data_size): New function.
564         (Output_section::set_fixed_layout): New function.
565         (Output_section::reserve): New function.
566         (Output_segment::set_section_addresses): Remove const.
567         (Output_segment::set_section_list_addresses): Remove const; allocate
568         space from free list for an incremental update.
569         (Output_segment::set_offset): Adjust size of RELRO segment for an
570         incremental update.
571         * output.h (Output_data::current_data_size): Move here from
572         child classes.
573         (Output_data::pre_finalize_data_size): New function.
574         (Output_data::update_data_size): New function.
575         (Output_section_headers::update_data_size): new function.
576         (Output_section_data_build::current_data_size): Move to Output_data.
577         (Output_data_strtab::update_data_size): New function.
578         (Output_section::current_data_size): Move to Output_data.
579         (Output_section::set_fixed_layout): New function.
580         (Output_section::has_fixed_layout): New function.
581         (Output_section::reserve): New function.
582         (Output_section::update_data_size): New function.
583         (Output_section::has_fixed_layout_): New data member.
584         (Output_section::free_list_): New data member.
585         (Output_segment::set_section_addresses): Remove const.
586         (Output_segment::set_section_list_addresses): Remove const.
587         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
588         New function.
589         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
590         New function.
591         * readsyms.cc (Read_symbols::do_read_symbols): Add library
592         parameter when calling Add_symbols constructor; store argument
593         serial number for members of a lib group.
594         (Add_symbols::locks): Allow case where token == NULL.
595         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
596         (Read_member::~Read_member): New function.
597         (Read_member::is_runnable): New function.
598         (Read_member::locks): New function.
599         (Read_member::run): New function.
600         (Check_script::~Check_script): New function.
601         (Check_script::is_runnable): New function.
602         (Check_script::locks): New function.
603         (Check_script::run): New function.
604         (Check_library::~Check_library): New function.
605         (Check_library::is_runnable): New function.
606         (Check_library::locks): New function.
607         (Check_library::run): New function.
608         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
609         (Add_symbols::library_): New data member.
610         (class Read_member): New class.
611         (class Check_script): New class.
612         (class Check_library): New class.
613         * reloc.cc (Read_relocs::is_runnable): Allow case where
614         token == NULL.
615         (Read_relocs::locks): Likewise.
616         (Scan_relocs::locks): Likewise.
617         (Relocate_task::locks): Likewise.
618         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
619         to clear counters.
620         (Sized_relobj::incremental_relocs_scan): Fix comment.
621         (Sized_relobj::do_relocate): Pass output file offset to
622         write_local_symbols.
623         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
624         from class declaration.
625         * script.cc (read_input_script): Allocate Script_info; pass
626         argument serial number to report_script.
627         * script.h (class Script_info): Move to incremental.h.
628         * symtab.cc (Symbol_table::add_from_incrobj): New function.
629         * symtab.h (Symbol_table::add_from_incrobj): New function.
630         (Symbol_table::set_file_offset): New function.
631
632 2011-04-05  Cary Coutant  <ccoutant@google.com>
633
634         * incremental-dump.cc (dump_incremental_inputs): Change signature
635         to take a Sized_incremental_binary; change caller.  Use readers
636         in Sized_incremental_binary.
637         * incremental.cc
638         (Sized_incremental_binary::find_incremental_inputs_sections):
639         Rename do_find_incremental_inputs_sections to this.
640         (Sized_incremental_binary::setup_readers): New function.
641         (Sized_incremental_binary::do_check_inputs): Check
642         has_incremental_info_ flag; move setup code to setup_readers;
643         use input readers.
644         (Sized_incremental_binary::do_file_is_unchanged): New function.
645         (Sized_incremental_binary::do_get_input_reader): New function.
646         * incremental.h (class Incremental_binary): Move to end of file.
647         (Incremental_binary::file_is_unchanged): New function.
648         (Incremental_binary::do_file_is_unchanged): New function.
649         (Incremental_binary::Input_reader): New class.
650         (Incremental_binary::get_input_reader): New function.
651         (class Sized_incremental_binary): Move to end of file.
652         (Sized_incremental_binary::Sized_incremental_binary): Setup the
653         input section reader classes.
654         (Sized_incremental_binary::has_incremental_info): New function.
655         (Sized_incremental_binary::inputs_reader): New function.
656         (Sized_incremental_binary::symtab_reader): New function.
657         (Sized_incremental_binary::relocs_reader): New function.
658         (Sized_incremental_binary::got_plt_reader): New function.
659         (Sized_incremental_binary::do_file_is_unchanged): New function.
660         (Sized_incremental_binary::Sized_input_reader): New class.
661         (Sized_incremental_binary::get_input_reader): New function.
662         (Sized_incremental_binary::find_incremental_inputs_sections):
663         Rename do_find_incremental_inputs_sections to this.
664         (Sized_incremental_binary::setup_readers): New function.
665         (Sized_incremental_binary::has_incremental_info_): New data member.
666         (Sized_incremental_binary::inputs_reader_): New data member.
667         (Sized_incremental_binary::symtab_reader_): New data member.
668         (Sized_incremental_binary::relocs_reader_): New data member.
669         (Sized_incremental_binary::got_plt_reader_): New data member.
670         (Sized_incremental_binary::current_input_file_): New data member.
671
672 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
673
674         PR gold/12640
675         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
676         violation.
677
678 2011-03-30  Cary Coutant  <ccoutant@google.com>
679
680         * archive.cc (Archive::include_member): Adjust call to report_object.
681         (Add_archive_symbols::run): Add script_info to call to
682         report_archive_begin.
683         (Lib_group::include_member): Adjust call to report_object.
684         (Add_lib_group_symbols::run): Adjust call to report_object.
685         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
686         blocks.  Add object count for script input files.
687         * incremental.cc (Incremental_inputs::report_archive_begin): Add
688         script_info parameter; change all callers.
689         (Incremental_inputs::report_object): Add script_info parameter;
690         change all callers.
691         (Incremental_inputs::report_script): Store backpointer to
692         incremental info entry.
693         (Output_section_incremental_inputs::set_final_data_size): Record
694         additional information for scripts.
695         (Output_section_incremental_inputs::write_info_blocks): Likewise.
696         * incremental.h (Incremental_script_entry::add_object): New function.
697         (Incremental_script_entry::get_object_count): New function.
698         (Incremental_script_entry::get_object): New function.
699         (Incremental_script_entry::objects_): New data member; adjust
700         constructor.
701         (Incremental_inputs::report_archive_begin): Add script_info parameter.
702         (Incremental_inputs::report_object): Add script_info parameter.
703         (Incremental_inputs_reader::get_object_count): New function.
704         (Incremental_inputs_reader::get_object_offset): New function.
705         * options.cc (Input_arguments::add_file): Return reference to
706         new input argument.
707         * options.h (Input_argument::set_script_info): New function.
708         (Input_argument::script_info): New function.
709         (Input_argument::script_info_): New data member; adjust all
710         constructors.
711         (Input_file_group::add_file): Return reference to new input argument.
712         (Input_file_lib::add_file): Likewise.
713         (Input_arguments::add_file): Likewise.
714         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
715         * script.cc (Parser_closure::Parser_closure): Add script_info
716         parameter; adjust all callers.
717         (Parser_closure::script_info): New function.
718         (Parser_closure::script_info_): New data member.
719         (read_input_script): Report scripts earlier to incremental info.
720         (script_add_file): Set script_info in Input_argument.
721         (script_add_library): Likewise.
722         * script.h (Script_options::Script_info): Rewrite class.
723
724 2011-03-29  Cary Coutant  <ccoutant@google.com>
725
726         * archive.cc (Library_base::should_include_member): Move
727         method here from class Archive.
728         (Archive::Archive): Initialize base class.
729         (Archive::should_include_member): Move to base class.
730         (Archive::do_for_all_unused_symbols): New function.
731         (Add_archive_symbols::run): Remove redundant access to
732         incremental_inputs.
733         (Lib_group::Lib_group): Initialize base class.
734         (Lib_group::do_filename): New function.
735         (Lib_group::include_member): Pass pointer to Lib_group to
736         report_object.
737         (Lib_group::do_for_all_unused_symbols): New function.
738         (Add_lib_group_symbols::run): Report archive information for
739         incremental links.
740         * archive.h (class Library_base): New base class.
741         (class Archive): Derive from Library_base.
742         (Archive::filename): Move to base class.
743         (Archive::set_incremental_info): Likewise.
744         (Archive::incremental_info): Likewise.
745         (Archive::Should_include): Likewise.
746         (Archive::should_include_member): Likewise.
747         (Archive::Armap_entry): Remove.
748         (Archive::Unused_symbol_iterator): Remove.
749         (Archive::unused_symbols_begin): Remove.
750         (Archive::unused_symbols_end): Remove.
751         (Archive::do_filename): New function.
752         (Archive::do_get_mtime): New function.
753         (Archive::do_for_all_unused_symbols): New function.
754         (Archive::task_): Move to base class.
755         (Archive::incremental_info_): Likewise.
756         (class Lib_group): Derive from Library_base.
757         (Lib_group::do_filename): New function.
758         (Lib_group::do_get_mtime): New function.
759         (Lib_group::do_for_all_unused_symbols): New function.
760         (Lib_group::task_): Move to base class.
761         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
762         function.
763         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
764         function.
765         * incremental.cc (Incremental_inputs::report_archive_begin):
766         Use Library_base; call library's get_mtime; add incremental inputs
767         entry before members.
768         (class Unused_symbol_visitor): New class.
769         (Incremental_inputs::report_archive_end): Use Library_base; use
770         visitor class to record unused symbols; don't add incremental inputs
771         entry after members.
772         (Incremental_inputs::report_object): Use Library_base.
773         * incremental.h
774         (Incremental_archive_entry::Incremental_archive_entry): Remove
775         unused Archive parameter.
776         (Incremental_inputs::report_archive_begin): Use Library_base.
777         (Incremental_inputs::report_archive_end): Likewise.
778         (Incremental_inputs::report_object): Likewise.
779         * object.cc (Sized_relobj::do_for_all_global_symbols): New
780         function.
781         * object.h (Object::for_all_global_symbols): New function.
782         (Object::do_for_all_global_symbols): New function.
783         (Sized_relobj::do_for_all_global_symbols): New function.
784         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
785         function.
786         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
787         function.
788
789 2011-03-27  Ian Lance Taylor  <iant@google.com>
790
791         * archive.cc (Archive::interpret_header): Return -1 if something
792         goes wrong.  Change callers accordingly.
793
794 2011-03-25  Cary Coutant  <ccoutant@google.com>
795
796         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
797         * testsuite/Makefile.in: Regenerate.
798
799 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
800
801         * plugin.cc (get_view): New.
802         (Plugin::load): Pass get_view to the plugin.
803         (Plugin_manager::get_view): New.
804
805 2011-03-21  Ian Lance Taylor  <iant@google.com>
806
807         * testsuite/final_layout.sh: Rewrite to not use dc.
808         * testsuite/relro_test.sh: Fail if dc is not present.
809
810 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
811
812         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
813         Change == to -eq.
814         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
815         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
816         Change == to -eq.
817         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
818         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
819
820 2011-03-14  Ian Lance Taylor  <iant@google.com>
821
822         * script-sections.cc (Sort_output_sections::script_compare):
823         Rename from is_before, change return type.
824         (Sort_output_sections::operator()): Adjust accordingly.
825
826 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
827
828         PR gold/12572
829         * testsuite/odr_violation2.cc: Add comment to make all error line
830         numbers double digits.
831         * testsuite/debug_msg.sh: Adjust expected errors.
832
833 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
834
835         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
836         but mark earlier ones as non-canonical
837         (offset_to_iterator): Update search target and example
838         (do_addr2line): Return extra lines in a vector*
839         (format_file_lineno): Extract from do_addr2line
840         (one_addr2line): Add vector* out-param
841         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
842         when a lineno entry appeared last for its instruction
843         (Dwarf_line_info): Add vector* out-param
844         * object.cc (Relocate_info): Pass NULL for the vector* out-param
845         * symtab.cc (Odr_violation_compare): Include the lineno in the
846         comparison again.
847         (linenos_from_loc): New. Combine the canonical line for an
848         address with its other lines.
849         (True_if_intersect): New. Helper functor to make
850         std::set_intersection a query.
851         (detect_odr_violations): Compare sets of lines instead of just
852         one line for each function. This became less deterministic, but
853         has fewer false positives.
854         * symtab.h: Declarations.
855         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
856         mix an optimized and non-optimized object in the same binary
857         (odr_violation2.so): Same.
858         * testsuite/Makefile.in: Regenerate from Makefile.am.
859         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
860         * testsuite/debug_msg.sh: Update line numbers and add
861         assertions.
862         * testsuite/odr_violation1.cc: Use OdrDerived, in a
863         non-optimized context.
864         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
865         isn't inlined, and use OdrDerived in an optimized context.
866         * testsuite/odr_header1.h: Defines OdrDerived, where
867         optimization will change the
868         first-instruction-in-the-destructor's file and line number.
869         * testsuite/odr_header2.h: Defines OdrBase.
870
871 2011-03-09  Ian Lance Taylor  <iant@google.com>
872
873         * fileread.cc (File_read::clear_views): Don't delete the whole
874         file view.
875
876 2011-03-08  Ian Lance Taylor  <iant@google.com>
877
878         PR gold/12525
879         * fileread.cc: #include <climits>.
880         (GOLD_IOV_MAX): Define.
881         (File_read::read_multiple): Limit number of entries by iov_max.
882         * fileread.h (class File_read): Always set max_readv_entries to
883         128.
884
885 2011-03-07  Ian Lance Taylor  <iant@google.com>
886
887         PR gold/12525
888         * options.h (class General_options): Add -dy and -dn.
889
890 2011-03-02  Cary Coutant  <ccoutant@google.com>
891
892         * testsuite/script_test_9.t: Add TLS segment.
893
894 2011-03-02  Simon Baldwin  <simonb@google.com>
895
896         * configure.ac: Add check for gnu_indirect_function support in
897         the toolchain building binutils.
898         * configure: Rebuild.
899
900 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
901
902         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
903         plugin only symbols.
904         (Symbol_table::sized_finalize_symbol) Mark symbol only present
905         in plugin files as not needed in the symbol table.
906
907 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
908
909         * output.cc (Output_section::add_input_section): Delay fill
910         generation for section ordering.
911
912 2011-02-09  Ian Lance Taylor  <iant@google.com>
913
914         PR gold/12316
915         * object.h (class Sized_relobj): Remove clear_local_symbols.
916         * reloc.cc (Sized_relobj::do_relocate): Don't call
917         clear_local_symbols.
918
919 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
920
921         * plugin.cc (is_visible_from_outside): Return true for symbols
922         in the -u option.
923
924 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
925
926         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
927         filename.
928
929 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
930
931         * icf.h (is_section_foldable_candidate): Change type of parameter
932         to std::string.
933         * icf.cc (Icf::find_identical_sections): Change type of local variable
934         section_name to be std::string.
935         (is_function_ctor_or_dtor): Change type of parameter to std::string.
936
937 2011-01-25  Ian Lance Taylor  <iant@google.com>
938
939         * script.cc (script_add_extern): Rewrite to use
940         add_symbol_reference.
941
942 2011-01-25  Doug Kwan  <dougkwan@google.com>
943
944         * icf.cc (get_section_contents): Always lock section's object.
945
946 2011-01-24  Ian Lance Taylor  <iant@google.com>
947
948         * options.h (class General_options): Accept
949         --no-detect-odr-violations.
950
951 2011-01-24  Ian Lance Taylor  <iant@google.com>
952
953         * version.cc (version_string): Bump to 1.11.
954
955 2011-01-24  Ian Lance Taylor  <iant@google.com>
956
957         * plugin.cc (class Plugin_rescan): Define new class.
958         (Plugin_manager::claim_file): Set any_claimed_.
959         (Plugin_manager::save_archive): New function.
960         (Plugin_manager::save_input_group): New function.
961         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
962         necessary.
963         (Plugin_manager::new_undefined_symbol): New function.
964         (Plugin_manager::rescan): New function.
965         (Plugin_manager::rescannable_defines): New function.
966         (Plugin_manager::add_input_file): Set any_added_.
967         * plugin.h (class Plugin_manager): define new fields rescannable_,
968         undefined_symbols_, any_claimed_, and any_added_.  Declare
969         Plugin_rescan as friend.  Declare new functions.
970         (Plugin_manager::Rescannable): Define type.
971         (Plugin_manager::Rescannable_list): Define type.
972         (Plugin_manager::Undefined_symbol_list): Define type.
973         (Plugin_manager::Plugin_manager): Initialize new fields.
974         * archive.cc (Archive::defines_symbol): New function.
975         (Add_archive_symbols::run): Pass archive to plugins if any.
976         * archive.h (class Archive): Declare defines_symbol.
977         * readsyms.cc (Input_group::~Input_group): New function.
978         (Finish_group::run): Pass input_group to plugins if any.
979         * readsyms.h (class Input_group): Declare destructor.
980         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
981         any.
982
983 2011-01-10  Ian Lance Taylor  <iant@google.com>
984
985         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
986         section as relro.
987         (Layout::set_segment_offsets): Reset increase_relro before calling
988         set_section_addresses a second time.
989
990 2011-01-04  Cary Coutant  <ccoutant@google.com>
991
992         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
993         sections before NOBITS sections.
994
995 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
996
997         * version.cc (print_version): Update copyright to 2011.
998
999 2010-12-23  Cary Coutant  <ccoutant@google.com>
1000
1001         * output.h (Output_data_reloc::add_output_section): Pass OD instead
1002         of OS to this->add.  Add OD parameter to second form of the function.
1003
1004 2010-12-20  Ian Lance Taylor  <iant@google.com>
1005
1006         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1007         second of two consecutive entries with same offset.
1008
1009 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1010
1011         * testsuite/Makefile.am (ifuncmain2static_LDADD)
1012         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1013         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1014         to avoid unneeded links against $(LDADD).
1015         * testsuite/Makefile.in: Regenerate.
1016
1017 2010-12-15  Ian Lance Taylor  <iant@google.com>
1018
1019         PR gold/12324
1020         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1021         for R_X86_64_32 and R_X86_64_PC32.
1022         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1023         ver_matching_def_pic.o.
1024         (ver_matching_def_pic.o): New target.
1025
1026 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1027
1028         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1029         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1030         Move definition before File_read::View member definitions.
1031         (File_read::View::~View): Initialize and hold lock before
1032         updating current_mapped_bytes.
1033
1034 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1035
1036         * dwarf_reader.cc: Remove outdated comment.
1037         * gold-threads.cc: Fix typo in error message.
1038         * archive.cc: Fix typos in comments.
1039         * archive.h: Likewise.
1040         * arm-reloc-property.cc: Likewise.
1041         * arm-reloc-property.h: Likewise.
1042         * arm-reloc.def: Likewise.
1043         * arm.cc: Likewise.
1044         * attributes.h: Likewise.
1045         * cref.cc: Likewise.
1046         * ehframe.cc: Likewise.
1047         * fileread.h: Likewise.
1048         * gold.h: Likewise.
1049         * i386.cc: Likewise.
1050         * icf.cc: Likewise.
1051         * incremental.h: Likewise.
1052         * int_encoding.cc: Likewise.
1053         * layout.h: Likewise.
1054         * main.cc: Likewise.
1055         * merge.h: Likewise.
1056         * object.cc: Likewise.
1057         * object.h: Likewise.
1058         * options.cc: Likewise.
1059         * readsyms.cc: Likewise.
1060         * reduced_debug_output.cc: Likewise.
1061         * reloc.cc: Likewise.
1062         * script-sections.cc: Likewise.
1063         * sparc.cc: Likewise.
1064         * symtab.h: Likewise.
1065         * target-reloc.h: Likewise.
1066         * target.cc: Likewise.
1067         * target.h: Likewise.
1068         * timer.cc: Likewise.
1069         * timer.h: Likewise.
1070         * x86_64.cc: Likewise.
1071
1072 2010-12-09  Cary Coutant  <ccoutant@google.com>
1073
1074         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1075         stack.
1076         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1077         parameter; change all callers.
1078         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1079         * options.h (warn_execstack): New option.
1080
1081 2010-12-07  Doug Kwan  <dougkwan@google.com>
1082
1083         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1084         like function call relocations.
1085
1086 2010-12-07  Ian Lance Taylor  <iant@google.com>
1087
1088         * archive.cc (Archive::get_elf_object_for_member): Permit
1089         punconfigured to be NULL.
1090         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1091         (Archive::include_member): Pass NULL to get_elf_object_for_member
1092         if we searched for the archive and this is the first included
1093         object.
1094
1095 2010-12-01  Ian Lance Taylor  <iant@google.com>
1096
1097         * dwarf_reader.h (class Sized_dwarf_line_info): Add
1098         track_relocs_type_ field.
1099         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1100         Set track_relocs_type_.
1101         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1102         contents when using RELA relocs.
1103         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1104         reloc_map_.
1105         * reloc.cc (Track_relocs::next_addend): New function.
1106         * reloc.h (class Track_relocs): Declare next_addend.
1107
1108 2010-12-01  Ian Lance Taylor  <iant@google.com>
1109
1110         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1111         virtual destructor.
1112
1113 2010-12-01  Ian Lance Taylor  <iant@google.com>
1114
1115         * README: Update compilers known to work and fail.
1116
1117 2010-11-23  Matthias Klose  <doko@ubuntu.com>
1118
1119         * configure.in: For --enable-gold, handle value `default' instead of
1120         `both*'.  Always install ld as ld.bfd, install as ld if gold is
1121         not the default.
1122         * configure: Regenerate.
1123
1124 2010-11-18  Doug Kwan  <dougkwan@google.com>
1125
1126         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1127         and right_alignment to be zero.  Store result alignment only if it is
1128         greater than existing alignment.
1129
1130 2010-11-16  Cary Coutant  <ccoutant@google.com>
1131
1132         PR gold/12220
1133         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1134         Check for ".zdebug_line".
1135
1136 2010-11-16  Doug Kwan  <dougkwan@google.com>
1137             Cary Coutant  <ccoutant@google.com>
1138
1139         * output.h (Output_segment::set_section_addresses): Pass increase_relro
1140         by reference; adjust all callers.
1141         * output.cc (Output_segment::set_section_addresses): Adjust references
1142         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1143         list is empty.
1144         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1145         end at page boundary.
1146
1147 2010-11-16  Cary Coutant  <ccoutant@google.com>
1148
1149         PR gold/12220
1150         * layout.cc (Layout::choose_output_section): Transform names of
1151         compressed sections even when using a script with a SECTIONS clause.
1152         (Layout::output_section_name): Remove code to transform
1153         compressed debug section names.
1154         * output.cc (Output_section::add_input_section): Use uncompressed
1155         section size when tracking input sections.
1156
1157 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
1158
1159         * symtab.h (Symbol::NON_PIC_REF): Remove.
1160         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1161         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
1162         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1163         (Symbol::use_plt_offset): Take a flags argument and pass it
1164         directly to needs_dynamic_reloc.  Restrict check for undefined
1165         weak symbols to function calls.
1166         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1167         (Target_arm::Scan::global): Use it.
1168         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1169         (Target_arm::Relocate::relocate): Likewise.
1170         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1171         parameter with an r_type parameter.  Use get_reference_flags
1172         to get the flags.
1173         (Target_arm::Relocate::relocate): Update accordingly.
1174         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1175         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1176         (Target_i386::Scan::global): Likewise.
1177         (Target_i386::Relocate::relocate): Likewise.
1178         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1179         parameter with an r_type parameter.  Use get_reference_flags
1180         to get the flags.
1181         (Target_i386::Relocate::relocate): Update accordingly.
1182         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1183         (Target_powerpc::Scan::global): Use it.
1184         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1185         (Target_powerpc::Relocate::relocate): Likewise.
1186         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1187         (Target_sparc::Scan::global): Use it.
1188         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1189         (Target_sparc::Relocate::relocate): Likewise.
1190         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1191         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1192         (Target_x86_64::Scan::global): Likewise.
1193         (Target_x86_64::Relocate::relocate): Likewise.
1194
1195 2010-11-08  Doug Kwan  <dougkwan@google.com>
1196             Cary Coutant  <ccoutant@google.com>
1197
1198         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1199         (Arm_exidx_merge_section::section_contents_): New data member.
1200         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1201         (Arm_input_section::~Arm_input_section): De-allocate memory.
1202         (Arm_input_section::original_contents_): New data member.       
1203         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1204         in parameters instead of calling Object::section_contents without
1205         locking.
1206         (Arm_output_section::group_section): New parameter TASK.  Pass it
1207         to callees that need locking objects.
1208         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1209         to lock EXIDX input sections.  Fix a formatting issue.  Call
1210         Arm_exidx_merged_section::build_contents to create merged section
1211         contents.
1212         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1213         to lock object of stub table owner.
1214         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1215         TEXT_SIZE to initialize data member TEXT_SIZE_.
1216         (Arm_exidx_input_section::addralign): Fix typo in comment.
1217         (Arm_exidx_input_section::text_size): New method.
1218         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1219         that require locking objects.  Lock objects before scanning for stubs
1220         and updating local symbols.
1221         (Arm_input_section<big_endian>::init): Copy contents of original
1222         input section.
1223         (Arm_input_section<big_endian>::do_write): Use saved contents of
1224         original input section instead of calling Object::section_contents
1225         without locking.
1226         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1227         size without calling Object::section_size().
1228         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1229         for size.  Allocate a buffer for merged EXIDX entries.
1230         (Arm_exidx_merged_section::build_contents): New method.
1231         (Arm_exidx_merged_section::do_write): Move merge section contents
1232         building code to Arm_exidx_merged_section::build_contetns.  Write
1233         out contetns in buffer instead of building it on the fly.
1234         (Arm_relobj::make_exidx_input_section): Also pass text section size
1235         to Arm_exidx_input_section constructor.
1236         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1237         (Arm_dynobj::do_read_symbols): Fix memory leak.
1238         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1239         * target.h: (class Task): Add forward declaration.
1240         (Target::relax): Add new parameter TASK and pass it to
1241         Target::do_relax().
1242         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1243
1244 2010-11-05  Cary Coutant  <ccoutant@google.com>
1245
1246         PR gold/10708
1247         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1248         object when reading from the file.
1249         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1250         second layout pass.
1251         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1252         when reading section contents.
1253         (get_section_contents): Likewise.
1254         (icf::find_identical_sections): Likewise.
1255         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1256         object when reading from the file.
1257         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1258         the object when doing deferred section layout.
1259
1260 2010-11-03  Nick Clifton  <nickc@redhat.com>
1261
1262         PR gold/12001
1263         * script.h (class Symbol_assignment: name): New member.  Returns
1264         the name of the symbol.
1265         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1266         Returns true if the given symbol name is on the list of
1267         assignments wating to be processed.
1268         * archive.cc (should_incldue_member): If the symbol is undefined,
1269         check to see if it is on the list of symbols pending assignment.
1270
1271 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1272
1273         * script-sections.cc (Script_sections::find_memory_region): Check
1274         for a NULL output section pointer.
1275
1276 2010-10-29  Doug Kwan  <dougkwan@google.com>
1277
1278         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1279         Output_section::add_relaxed_input_section.
1280         * output.cc (Output_section::add_relaxed_input_section): Add new
1281         arguments LAYOUT and NAME.  Set section order index.
1282         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1283         Copy section order index.
1284         * output.h (Output_section::add_relaxed_input_section): Add new
1285         arguments LAYOUT and NAME.
1286
1287 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1288
1289         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1290         NATIVE_OR_CROSS_LINKER.
1291         * testsuite/Makefile.in: Regenerate.
1292
1293 2010-10-20  Doug Kwan  <dougkwan@google.com>
1294
1295         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1296         without SHF_LINK_ORDER flags.
1297         * layout.cc (Layout::choose_output_section): Do not filter
1298         SHF_LINK_ORDER flag in a relocatable link.
1299
1300 2010-10-17  Cary Coutant  <ccoutant@google.com>
1301
1302         * output.h (Output_segment::set_section_addresses): Change function
1303         signature.  Update all callers.
1304         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1305         sections.
1306         (Output_segment::set_section_addresses): Align after last TLS
1307         section.  Add padding before last relro section instead of after.
1308
1309 2010-10-17  Doug Kwan  <dougkwan@google.com>
1310
1311         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1312         GOT output section to be writable.
1313
1314 2010-10-14  Cary Coutant  <ccoutant@google.com>
1315
1316         * debug.h (DEBUG_INCREMENTAL): New flag.
1317         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1318         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1319         mode.
1320         * incremental.cc (report_command_line): Ignore all forms of
1321         --incremental.
1322         * layout.cc (Layout::Layout): Check parameters for incremental link
1323         mode.
1324         * options.cc (General_options::parse_incremental): New function.
1325         (General_options::parse_no_incremental): New function.
1326         (General_options::parse_incremental_full): New function.
1327         (General_options::parse_incremental_update): New function.
1328         (General_options::incremental_mode_): New data member.
1329         (General_options::finalize): Check incremental_mode_.
1330         * options.h (General_options): Update help text for --incremental.
1331         Add --no-incremental, --incremental-full, --incremental-update.
1332         (General_options::Incremental_mode): New enum type.
1333         (General_options::incremental_mode): New function.
1334         (General_options::incremental_mode_): New data member.
1335         * parameters.cc (Parameters::incremental_mode_): New data member.
1336         (Parameters::set_options): Set incremental_mode_.
1337         (Parameters::set_incremental_full): New function.
1338         (Parameters::incremental): New function.
1339         (Parameters::incremental_update): New function.
1340         (set_parameters_incremental_full): New function.
1341         * parameters.h (Parameters::set_incremental_full): New function.
1342         (Parameters::incremental): New function.
1343         (Parameters::incremental_update): New function.
1344         (Parameters::incremental_mode_): New data member.
1345         (set_parameters_incremental_full): New function.
1346         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1347         incremental link mode.
1348         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1349         (Sized_relobj::do_relocate_sections): Likewise.
1350         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1351         option.
1352         * testsuite/Makefile.in: Regenerate.
1353         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1354
1355 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1356
1357         * script-sections.h (class Script_sections): Make
1358         Sections_elements typedef public.
1359         * script-sections.cc (class Sort_output_sections): Add elements_
1360         field.  Add constructor which sets it; change all callers.
1361         (Sort_output_sections::is_before): New function.
1362         (Sort_output_sections::operator()): Call is_before.
1363         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1364         conditional.
1365         * testsuite/script_test_10.sh: New test. Test script section
1366         order.
1367         * testsuite/script_test_10.t: Likewise.
1368         * testsuite/script_test_10.s: Likewise.
1369         * testsuite/Makefile.am: Wrap the cross linker tests and the
1370         common tests into NATIVE_OR_CROSS_LINKER.
1371         (check_SCRIPTS): Add script_test_10.sh.
1372         (check_DATA): Add script_test_10.stdout.
1373         (script_test_10.o, script_test_10): New targets.
1374         (script_test_10.stdout): New target.
1375         * configure, testsuite/Makefile.in: Regenerate.
1376
1377 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1378
1379         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1380         error for the deprecated relocations.
1381         (Target_arm::Scan::global): Likewise.
1382         (Target_arm::Relocate::relocate): Likewise.
1383
1384 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1385
1386         * fileread.cc (Input_file::find_file): Initialize *found_name
1387         and *namep when using the fallback search for case 4.
1388
1389 2010-10-11  Cary Coutant  <ccoutant@google.com>
1390
1391         * options.h (class General_options): Redefine -z lazy as an alias for
1392         the negation of -z now.
1393
1394 2010-10-11  Ian Lance Taylor  <iant@google.com>
1395
1396         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1397         binding.
1398
1399 2010-10-06  Nick Clifton  <nickc@redhat.com>
1400
1401         * script-sections.cc(class Memory_region): Remove
1402         current_lma_offset_ field.  Rename current_vma_offset_ to
1403         current_offset_.  Add last_section_ field.
1404         (Memory_region::get_current_vma_address): Rename to
1405         get_current_address.
1406         (Memory_region::get_current_lma_address): Delete.
1407         (Memory_region::increment_vma_offset): Rename to
1408         increment_offset.
1409         (Memory_region::increment_lma_offset): Delete.
1410         (Memory_region::attributes_compatible): New method.  Returns
1411         true if the provided section is compatible with the region.
1412         (Memory_region::get_last_section): New method.  Returns the last
1413         section to use the region.
1414         (Memory_region::set_last_section): New method.  Stores the last
1415         section to use the region.
1416         (Script_sections::block_in_region): New method.  Returns true if
1417         a block of memory is contained within a region.
1418         (Script_sections::find_memory_region): New method.  Locates a
1419         memory region to be used to set a VMA or LMA address.
1420         (Output_section_definition::set_section_addresses): Add code to
1421         check for addresses set by memory regions.
1422         (Output_segment::set_section_addresses): Remove memory region
1423         walking code.
1424         (Script_sections::create_segment): Add a warning if a header
1425         segment is created outside of any region.
1426         * script-sections.h (class Script_sections): Add prototypes for
1427         find_memory_region and block_in_region methods.
1428         * testsuite/memory_test.s: Use .long instead of .word.
1429         * testsuite/memory_test.t: Add some more output sections.
1430         * testsuite/memory_test.sh: Update expected output.
1431
1432 2010-10-02  Doug Kwan  <dougkwan@google.com>
1433
1434         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1435         defintion to symtab.h
1436         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1437         declaration to defintion.
1438
1439 2010-10-01  Nick Clifton  <nickc@redhat.com>
1440
1441         * expression.cc (eval): Replace dummy argument with NULL.
1442         (eval_maybe_dot): Check for a NULL result section pointer.
1443         (Symbol_expression::value): Likewise.
1444         (Dot_expression::value): Likewise.
1445         (BINARY_EXPRESSION): Likewise.
1446         (Max_expression::value): Likewise.
1447         (Min_expression::value): Likewise.
1448         (Absolute_expression::value): Likewise.
1449         (Addr_expression::value_from_output_section): Likewise.
1450         (Loaddddr_expression::value_from_output_section): Likewise.
1451         (Segment_start_expression::value): Likewise.
1452         * script-sections.cc
1453         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1454         argument with NULL.
1455         (Sections_elememt_dot_assignment::set_section_addresses):
1456         Likewise.
1457         (Output_data_expression::do_write_to_buffer): Likewise.
1458         (Output_section_definition::finalize_symbols): Likewise.
1459         (Output_section_definition::set_section_addresses): Likewise.
1460
1461 2010-09-30  Doug Kwan  <dougkwan@google.com>
1462
1463         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1464
1465 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1466
1467         * target.h (Target::can_icf_inline_merge_sections): New virtual
1468         function.
1469         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1470         virtual function.
1471         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1472         virtual function.
1473         * icf.cc (get_section_contents): Inline merge sections only when
1474         target allows it.
1475
1476 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1477
1478         * configure: Regenerate.
1479
1480 2010-09-17  Ian Lance Taylor  <iant@google.com>
1481
1482         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1483         * testsuite/Makefile.am (memory_test.o): New target.
1484         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1485         memory_test.t.
1486         * testsuite/Makefile.in: Rebuild.
1487
1488 2010-09-17  Doug Kwan  <dougkwan@google.com>
1489
1490         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1491         defintion if relocation uses GOT entries of the symbol.
1492         * testsuite/icf_safe_test.sh: Fix test.
1493         * testsuite/icf_safe_so_test.sh: Fix test.
1494
1495 2010-09-16  Cary Coutant  <ccoutant@google.com>
1496
1497         * script_sections.cc (class Memory_region): Remove "NULL" from
1498         vector initializations.
1499
1500 2010-09-15  Cary Coutant  <ccoutant@google.com>
1501
1502         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1503         Resolve forwarding symbols.
1504
1505 2010-09-15  Doug Kwan  <dougkwan@google.com>
1506
1507         * gold/testsuite/script_test_3.t: Add ARM special sections.
1508         * gold/testsuite/script_test_4.t: Same.
1509         * gold/testsuite/script_test_5.t: Same.
1510         * gold/testsuite/script_test_6.t: Same.
1511         * gold/testsuite/script_test_7.t: Same.
1512         * gold/testsuite/script_test_7.t: Same.
1513         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1514
1515 2010-09-14  Cary Coutant  <ccoutant@google.com>
1516
1517         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1518         (Target_x86_64::Relocate::relocate_tls): Replace check for
1519         saw_tls_block_reloc_ with test for executable section.
1520
1521 2010-09-12  Cary Coutant  <ccoutant@google.com>
1522
1523         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1524         position-independent executables to shared libraries need dynamic
1525         relocations.
1526         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1527         position-independent executables.
1528         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1529         * testsuite/Makefile.in: Regenerate.
1530
1531 2010-09-10  Nick Clifton  <nickc@redhat.com>
1532
1533         PR gold/11997
1534         * testsuite/memory_test.t: Discard any sections that are not
1535         needed.
1536
1537 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1538
1539         PR gold/11996
1540         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1541         "This::" to work around a bug in gcc 4.2.
1542
1543         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1544
1545 2010-09-09  Rafael Espindola  <espindola@google.com>
1546
1547         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1548         sections with different PF_X flags in the same segment.
1549         (Layout::find_first_load_seg): Search all segments to find the first
1550         one.
1551         * options.h (rosegment): New.
1552
1553 2010-09-08  Rafael Espindola  <espindola@google.com>
1554
1555         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1556
1557 2010-09-08  Doug Kwan  <dougkwan@google.com>
1558
1559         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1560         (Arm_relobj::do_relocate_sections): Add new parameter for output
1561         file to match the parent.
1562         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1563         of local symbols instead of input values.  Update code to track
1564         changes in gold::relocate_section.
1565         * object.cc (Sized_relobj::compute_final_local_value): New methods.
1566         (Sized_relobj::compute_final_local_value_internal): New methods.
1567         (Sized_relobj::do_finalize_local_symbols): Move code from loop
1568         body into private version of Sized_relobj::compute_final_local_value.
1569         Call the inline method.
1570         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
1571         merged symbol value if there is one.
1572         (Symbol_value::has_output_value): New method defintiion.
1573         (Sized_relobj::Compute_final_local_value_status): New enum type.
1574         (Sized_relobj::compute_final_local_value): New methods.
1575         (Sized_relobj::compute_final_local_value_internal): New methods.
1576         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1577         and arm_cortex_a8.sh.
1578         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1579         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1580         New tests.
1581         * Makefile.in: Regenerate.
1582         * testsuite/arm_bl_out_of_range.s: Update test.
1583         * testsuite/thumb_bl_out_of_range.s: Ditto.
1584         * testsuite/thumb_blx_out_of_range.s: Ditto.
1585         * testsuite/arm_branch_out_of_range.sh: New file.
1586         * testsuite/arm_cortex_a8.sh: Ditto.
1587         * testsuite/arm_cortex_a8_b.s: Ditto.
1588         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1589         * testsuite/arm_cortex_a8_b_local.s: Ditto.
1590         * testsuite/arm_cortex_a8_bl.s: Ditto.
1591         * testsuite/arm_cortex_a8_blx.s: Ditto.
1592         * testsuite/arm_cortex_a8_local.s: Ditto.
1593         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1594         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1595
1596 2010-09-08  Rafael Espindola  <espindola@google.com>
1597
1598         * Makefile.am (memory_test.stdout): Run readelf with -W.
1599         * Makefile.in: Regenerate.
1600         * testsuite/memory_test.sh: Make the regexps accept both 32 and
1601         64 bit output.
1602
1603 2010-09-08  Rafael Espindola  <espindola@google.com>
1604
1605         * script-sections.cc (Script_sections::add_memory_region): Convert
1606         field precision to int.
1607         * script.cc (script_set_section_region, script_set_section_region):
1608         Convert field precision to int.
1609
1610 2010-09-08  Rafael Espindola  <espindola@google.com>
1611
1612         * arm.cc (do_finalize_sections): Create the __exidx_start and
1613         __exdix_end symbols even when the section is missing.
1614
1615 2010-09-08  Nick Clifton  <nickc@redhat.com>
1616
1617         * README: Remove claim that MEMORY is not supported.
1618         * expression.cc (script_exp_function_origin)
1619         (script_exp_function_length): Move from here to ...
1620         * script.cc: ... here.
1621         (script_set_section_region, script_add_memory)
1622         (script_parse_memory_attr, script_include_directive): New
1623         functions.
1624         * script-sections.cc
1625         (class Memory_region): New class.
1626         (class Output_section_definition): Add set_memory_region,
1627         set_section_vma, set_section_lma and get_section_name methods.
1628         (class Script_Sections): Add add_memory_region,
1629         find_memory_region, find_memory_region_origin,
1630         find_memory_region_length and set_memory_region methods.
1631         Have set_section_addresses method walk the list of set memory
1632         regions.
1633         Extend the print methos to display memory regions.
1634         * script-sections.h: Add prototypes for new methods.
1635         Add enum for MEMORY region attributes.
1636         * yyscript.y: Add support for parsing MEMORY regions.
1637         * script-c.h: Add prototypes for new functions.
1638         * testsuite/Makefile.am: Add test of MEMORY region functionality.
1639         * testsuite/Makefile.in: Regenerate.
1640         * testsuite/memory_test.sh: New script.
1641         * testsuite/memory_test.s: New assembler source file.
1642         * testsuite/memory_test.t: New linker script.
1643
1644 2010-08-27  Doug Kwan  <dougkwan@google.com>
1645
1646         * gold/resolve.cc (Symbol_table::should_override): Let a weak
1647         reference override an existing dynamic weak reference.
1648         * testsuite/Makefile.am: Add new test dyn_weak_ref.
1649         * testsuite/Makefile.in: Regenerate.
1650         * testsuite/dyn_weak_ref.sh: New file.
1651         * testsuite/dyn_weak_ref_1.c: Ditto.
1652         * testsuite/dyn_weak_ref_2.c: Ditto.
1653
1654 2010-08-27  Ian Lance Taylor  <iant@google.com>
1655
1656         * incremental.h (class Incremental_input_entry): Add virtual
1657         destructor.
1658
1659 2010-08-27  Ian Lance Taylor  <iant@google.com>
1660
1661         * testsuite/start_lib_test_3.c: Mark t3 as used.
1662
1663 2010-08-27  Nick Clifton  <nickc@redhat.com>
1664
1665         * options.cc (version_script): Fix small typo in previous
1666         whitespace tidyup.
1667
1668 2010-08-25  Nick Clifton  <nickc@redhat.com>
1669
1670         * archive.cc: Formatting fixes: Remove whitespace between
1671         typename and following asterisk.  Remove whitespace between
1672         function name and opening parenthesis.
1673         * archive.h: Likewise.
1674         * arm.cc: Likewise.
1675         * attributes.cc: Likewise.
1676         * attributes.h: Likewise.
1677         * common.cc: Likewise.
1678         * copy-relocs.cc: Likewise.
1679         * dirsearch.h: Likewise.
1680         * dynobj.cc: Likewise.
1681         * ehframe.cc: Likewise.
1682         * ehframe.h: Likewise.
1683         * expression.cc: Likewise.
1684         * fileread.cc: Likewise.
1685         * fileread.h: Likewise.
1686         * gc.h: Likewise.
1687         * gold-threads.cc: Likewise.
1688         * gold.cc: Likewise.
1689         * i386.cc: Likewise.
1690         * icf.h: Likewise.
1691         * incremental-dump.cc: Likewise.
1692         * incremental.cc: Likewise.
1693         * layout.cc: Likewise.
1694         * layout.h: Likewise.
1695         * main.cc: Likewise.
1696         * merge.cc: Likewise.
1697         * merge.h: Likewise.
1698         * object.cc: Likewise.
1699         * object.h: Likewise.
1700         * options.cc: Likewise.
1701         * options.h: Likewise.
1702         * output.cc: Likewise.
1703         * output.h: Likewise.
1704         * plugin.cc: Likewise.
1705         * plugin.h: Likewise.
1706         * powerpc.cc: Likewise.
1707         * reloc.cc: Likewise.
1708         * script-c.h: Likewise.
1709         * script-sections.cc: Likewise.
1710         * script.cc: Likewise.
1711         * stringpool.cc: Likewise.
1712         * symtab.cc: Likewise.
1713         * symtab.h: Likewise.
1714         * target.cc: Likewise.
1715         * timer.cc: Likewise.
1716         * timer.h: Likewise.
1717         * version.cc: Likewise.
1718         * x86_64.cc: Likewise.
1719
1720 2010-08-24  Nick Clifton  <nickc@redhat.com>
1721
1722         PR 11899
1723         * layout.cc (segment_precedes): Sort segments by their physical
1724         addresses, if they have been set.
1725
1726 2010-08-23  Cary Coutant  <ccoutant@google.com>
1727
1728         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1729         symbols data.
1730         (Lib_group::include_member): Unlock object after deleting its
1731         symbols data.
1732         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1733         the bug fixed here.
1734
1735 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
1736             Cary Coutant  <ccoutant@google.com>
1737
1738         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1739         constructor, and set_blocker.
1740         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1741         readsyms_blocker_.
1742         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1743         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1744         * testsuite/Makefile.am (start_lib_test): New test case.
1745         * testsuite/Makefile.in: Regenerate.
1746         * testsuite/start_lib_test_main.c: New file.
1747         * testsuite/start_lib_test_1.c: New file.
1748         * testsuite/start_lib_test_2.c: New file.
1749         * testsuite/start_lib_test_3.c: New file.
1750
1751 2010-08-19  Ian Lance Taylor  <iant@google.com>
1752
1753         * Makefile.in: Rebuild with automake 1.11.1.
1754         * aclocal.m4: Likewise.
1755         * testsuite/Makefile.in: Likewise.
1756
1757 2010-08-19  Ian Lance Taylor  <iant@google.com>
1758
1759         PR 10893
1760         * i386.cc (class Output_data_plt_i386): Update declarations.
1761         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
1762         local_ifuncs_ fields.
1763         (Target_i386::do_plt_section_for_global): New function.
1764         (Target_i386::do_plt_section_for_local): New function.
1765         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1766         parameter; change all callers.  Initialize global_ifuncs_ and
1767         local_ifuncs_.  If doing a static link define __rel_iplt_start and
1768         __rel_iplt_end.
1769         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1770         (Output_data_plt_i386::add_local_ifunc_entry): New function.
1771         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1772         symbols.
1773         (Target_i386::make_plt_section): New function, broken out of
1774         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
1775         (Target_i386::make_plt_entry): Call make_plt_section.
1776         (Target_i386::make_local_ifunc_plt_entry): New function.
1777         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1778         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
1779         R_386_IRELATIVE to switch.
1780         (Target_i386::Scan::global): Likewise.
1781         (Target_i386::Relocate::relocate): Likewise.
1782         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1783         switch.
1784         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1785         (Target_x86_64::do_plt_section_for_global): New function.
1786         (Target_x86_64::do_plt_section_for_local): New function.
1787         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1788         parameter; change all callers.  If doing a static link define
1789         __rela_iplt_start and __rela_iplt_end.
1790         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1791         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1792         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1793         to point to .plt.
1794         (Target_x86_64::make_local_ifunc_plt_entry): New function.
1795         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1796         switch.
1797         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1798         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
1799         R_X86_64_IRELATIVE to switch.
1800         (Target_x86_64::Scan::global): Likewise.
1801         (Target_x86_64::Relocate::relocate): Likewise.
1802         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1803         switch.
1804         * target.h (class Target): Add plt_section_for_global and
1805         plt_section_for_local functions.  Add do_plt_section_for_global
1806         and do_plt_section_for_local virtual functions.
1807         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
1808         clarifying comments.
1809         (Symbol::use_plt_offset): Handle IFUNC symbol.
1810         * object.cc (Sized_relobj::Sized_relobj): Initialize
1811         local_plt_offsets_.
1812         (Sized_relobj::local_has_plt_offset): New function.
1813         (Sized_relobj::local_plt_offset): New function.
1814         (Sized_relobj::set_local_plt_offset): New function.
1815         (Sized_relobj::do_count): Handle IFUNC symbol.
1816         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
1817         a bit away from input_shndx_ field.  Add set_is_func_symbol and
1818         is_ifunc_symbol functions.
1819         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
1820         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
1821         local_plt_offsets_ field.
1822         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1823         * output.h (class Output_section_data): Add non-const
1824         output_section function.
1825         (class Output_data_got): Update declarations.
1826         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1827         Add use_plt_offset parameter to global and local constructors.
1828         Change all callers.  Change local_sym_index_ field to 31 bits.
1829         Change GSYM_CODE and CONSTANT_CODE accordingly.
1830         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1831         doing a static link don't set sh_link field.
1832         (Output_data_got::Got_entry::write): Use PLT offset if
1833         appropriate.
1834         (Output_data_got::add_global_plt): New function.
1835         (Output_data_got::add_local_plt): New function.
1836         * target-reloc.h (relocate_section): Handle IFUNC symbol.
1837         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1838         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1839         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1840         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1841         IFUNC conditional.
1842         * testsuite/ifunc-sel.h: New file.
1843         * testsuite/ifuncmain1.c: New file.
1844         * testsuite/ifuncmain1vis.c: New file.
1845         * testsuite/ifuncmod1.c: New file.
1846         * testsuite/ifuncdep2.c: New file.
1847         * testsuite/ifuncmain2.c: New file.
1848         * testsuite/ifuncmain3.c: New file.
1849         * testsuite/ifuncmod3.c: New file.
1850         * testsuite/ifuncmain4.c: New file.
1851         * testsuite/ifuncmain5.c: New file.
1852         * testsuite/ifuncmod5.c: New file.
1853         * testsuite/ifuncmain6pie.c: New file.
1854         * testsuite/ifuncmod6.c: New file.
1855         * testsuite/ifuncmain7.c: New file.
1856         * configure, testsuite/Makefile.in: Rebuild.
1857
1858 2010-08-18  Ian Lance Taylor  <iant@google.com>
1859
1860         * incremental.cc
1861         (Output_section_incremental_inputs::write_input_files): Add cast
1862         to avoid signed/unsigned comparison warning.
1863         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1864
1865 2010-08-12  Cary Coutant  <ccoutant@google.com>
1866
1867         * common.cc (Sort_commons::operator()): Remove unnecessary code.
1868
1869 2010-08-13  Ian Lance Taylor  <iant@google.com>
1870
1871         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1872
1873 2010-08-12  Cary Coutant  <ccoutant@google.com>
1874             Doug Kwan  <dougkwan@google.com>
1875
1876         * resolve.cc (Symbol_table::should_override): When a weak dynamic
1877         defintion overrides non-weak undef, remember that the original undef
1878         is not weak.
1879         * symtab.cc (Symbol_table::sized_write_global): For undef without
1880         an original weak binding, set binding to global in output.
1881         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1882         * testsuite/Makefile.in: Regenerate.
1883         * testsuite/strong_ref_weak_def.sh: New file.
1884         * testsuite/strong_ref_weak_def_1.c: Ditto.
1885         * testsuite/strong_ref_weak_def_2.c: Ditto.
1886
1887 2010-08-12  Cary Coutant  <ccoutant@google.com>
1888
1889         * testsuite/incremental_test.sh: Rewrite.
1890         * testsuite/incremental_test_1.c: Rewrite.
1891         * testsuite/incremental_test_2.c: Rewrite.
1892
1893 2010-08-12  Cary Coutant  <ccoutant@google.com>
1894
1895         * arm.cc (Target_arm::got_size): Add const.
1896         (Target_arm::got_entry_count): New function.
1897         (Target_arm::plt_entry_count): New function.
1898         (Target_arm::first_plt_entry_offset): New function.
1899         (Target_arm::plt_entry_size): New function.
1900         (Output_data_plt_arm::entry_count): New function.
1901         (Output_data_plt_arm::first_plt_entry_offset): New function.
1902         (Output_data_plt_arm::get_plt_entry_size): New function.
1903         * i386.cc (Target_i386::got_size): Add const.
1904         (Target_i386::got_entry_count): New function.
1905         (Target_i386::plt_entry_count): New function.
1906         (Target_i386::first_plt_entry_offset): New function.
1907         (Target_i386::plt_entry_size): New function.
1908         (Output_data_plt_i386::entry_count): New function.
1909         (Output_data_plt_i386::first_plt_entry_offset): New function.
1910         (Output_data_plt_i386::get_plt_entry_size): New function.
1911         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1912         find_incremental_inputs_sections.  Dump incremental_got_plt section.
1913         * incremental.cc: Include target.h.
1914         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1915         parameter.  Adjust all callers.  Find incremental_got_plt section.
1916         (Incremental_inputs::create_data_sections): Create incremental_got_plt
1917         section.
1918         (Output_section_incremental_inputs::set_final_data_size): Calculate
1919         size of incremental_got_plt section.
1920         (Output_section_incremental_inputs::do_write): Write the
1921         incremental_got_plt section.
1922         (Got_plt_view_info): New struct.
1923         (Local_got_offset_visitor): New class.
1924         (Global_got_offset_visitor): New class.
1925         (Global_symbol_visitor_got_plt): New class.
1926         (Output_section_incremental_inputs::write_got_plt): New function.
1927         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1928         Add parameter.  Adjust all callers.
1929         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1930         (Incremental_inputs::got_plt_section): New function.
1931         (Incremental_inputs::got_plt_section_): New data member.
1932         (Incremental_got_plt_reader): New class.
1933         * layout.cc (Layout::create_incremental_info_sections): Add the
1934         incremental_got_plt section.
1935         * object.h (Got_offset_list::get_list): New function.
1936         (Got offset_list::for_all_got_offsets): New function.
1937         (Sized_relobj::local_got_offset_list): New function.
1938         * powerpc.cc (Target_powerpc::got_size): Add const.
1939         (Target_powerpc::got_entry_count): New function.
1940         (Target_powerpc::plt_entry_count): New function.
1941         (Target_powerpc::first_plt_entry_offset): New function.
1942         (Target_powerpc::plt_entry_size): New function.
1943         (Output_data_plt_powerpc::entry_count): New function.
1944         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1945         (Output_data_plt_powerpc::get_plt_entry_size): New function.
1946         * sparc.cc (Target_sparc::got_size): Add const.
1947         (Target_sparc::got_entry_count): New function.
1948         (Target_sparc::plt_entry_count): New function.
1949         (Target_sparc::first_plt_entry_offset): New function.
1950         (Target_sparc::plt_entry_size): New function.
1951         (Output_data_plt_sparc::entry_count): New function.
1952         (Output_data_plt_sparc::first_plt_entry_offset): New function.
1953         (Output_data_plt_sparc::get_plt_entry_size): New function.
1954         * symtab.h (Symbol::got_offset_list): New function.
1955         (Symbol_table::for_all_symbols): New function.
1956         * target.h (Sized_target::got_entry_count): New function.
1957         (Sized_target::plt_entry_count): New function.
1958         (Sized_target::plt_entry_size): New function.
1959         * x86_64.cc (Target_x86_64::got_size): Add const.
1960         (Target_x86_64::got_entry_count): New function.
1961         (Target_x86_64::plt_entry_count): New function.
1962         (Target_x86_64::first_plt_entry_offset): New function.
1963         (Target_x86_64::plt_entry_size): New function.
1964         (Output_data_plt_x86_64::entry_count): New function.
1965         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1966         (Output_data_plt_x86_64::get_plt_entry_size): New function.
1967
1968 2010-08-12  Cary Coutant  <ccoutant@google.com>
1969
1970         * archive.cc: Include incremental.h.
1971         (Archive::Archive): Initialize incremental_info_.
1972         (Archive::include_member): Record archive members in incremental info.
1973         (Add_archive_symbols::run): Record begin and end of an archive in
1974         incremental info.
1975         (Lib_group::include_member): Record objects in incremental info.
1976         * archive.h (Incremental_archive_entry): Forward declaration.
1977         (Archive::set_incremental_info): New member function.
1978         (Archive::incremental_info): New member function.
1979         (Archive::Unused_symbol_iterator): New class.
1980         (Archive::unused_symbols_begin): New member function.
1981         (Archive::unused_symbols_end): New member function.
1982         (Archive::incremental_info_): New data member.
1983         * incremental-dump.cc (find_input_containing_global): New function.
1984         (dump_incremental_inputs): Dump new incremental info sections.
1985         * incremental.cc: Include symtab.h.
1986         (Output_section_incremental_inputs): New class.
1987         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1988         new incremental info sections.
1989         (Sized_incremental_binary::do_check_inputs): Likewise.
1990         (Incremental_inputs::report_archive): Remove.
1991         (Incremental_inputs::report_archive_begin): New function.
1992         (Incremental_inputs::report_archive_end): New function.
1993         (Incremental_inputs::report_object): New function.
1994         (Incremental_inputs::finalize_inputs): Remove.
1995         (Incremental_inputs::report_input_section): New function.
1996         (Incremental_inputs::report_script): Rewrite.
1997         (Incremental_inputs::finalize): Do nothing but finalize string table.
1998         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1999         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2000         (Incremental_inputs::create_data_sections): New function.
2001         (Incremental_inputs::relocs_entsize): New function.
2002         (Output_section_incremental_inputs::set_final_data_size): New function.
2003         (Output_section_incremental_inputs::do_write): New function.
2004         (Output_section_incremental_inputs::write_header): New function.
2005         (Output_section_incremental_inputs::write_input_files): New function.
2006         (Output_section_incremental_inputs::write_info_blocks): New function.
2007         (Output_section_incremental_inputs::write_symtab): New function.
2008         * incremental.h (Incremental_script_entry): Forward declaration.
2009         (Incremental_object_entry): Forward declaration.
2010         (Incremental_archive_entry): Forward declaration.
2011         (Incremental_inputs): Forward declaration.
2012         (Incremental_inputs_header_data): Remove.
2013         (Incremental_inputs_header): Remove.
2014         (Incremental_inputs_header_write): Remove.
2015         (Incremental_inputs_entry_data): Remove.
2016         (Incremental_inputs_entry): Remove.
2017         (Incremental_inputs_entry_write): Remove.
2018         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2019         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2020         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2021         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2022         Likewise.
2023         (Incremental_input_entry): New class.
2024         (Incremental_script_entry): New class.
2025         (Incremental_object_entry): New class.
2026         (Incremental_archive_entry): New class.
2027         (Incremental_inputs::Incremental_inputs): Initialize new data members.
2028         (Incremental_inputs::report_inputs): Remove.
2029         (Incremental_inputs::report_archive): Remove.
2030         (Incremental_inputs::report_archive_begin): New function.
2031         (Incremental_inputs::report_archive_end): New function.
2032         (Incremental_inputs::report_object): Change prototype.
2033         (Incremental_inputs::report_input_section): New function.
2034         (Incremental_inputs::report_script): Change prototype.
2035         (Incremental_inputs::get_reloc_count): New function.
2036         (Incremental_inputs::set_reloc_count): New function.
2037         (Incremental_inputs::create_data_sections): New function.
2038         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2039         (Incremental_inputs::inputs_section): New function.
2040         (Incremental_inputs::symtab_section): New function.
2041         (Incremental_inputs::relocs_section): New function.
2042         (Incremental_inputs::get_stringpool): Add const.
2043         (Incremental_inputs::command_line): Add const.
2044         (Incremental_inputs::inputs): Remove.
2045         (Incremental_inputs::command_line_key): New function.
2046         (Incremental_inputs::input_file_count): New function.
2047         (Incremental_inputs::input_files): New function.
2048         (Incremental_inputs::relocs_entsize): New function.
2049         (Incremental_inputs::sized_create_inputs_section_data): Remove.
2050         (Incremental_inputs::finalize_inputs): Remove.
2051         (Incremental_inputs::Input_info): Remove.
2052         (Incremental_inputs::lock_): Remove.
2053         (Incremental_inputs::inputs_): Change type.
2054         (Incremental_inputs::inputs_map_): Remove.
2055         (Incremental_inputs::current_object_entry_): New data member.
2056         (Incremental_inputs::inputs_section_): New data member.
2057         (Incremental_inputs::symtab_section_): New data member.
2058         (Incremental_inputs::relocs_section_): New data member.
2059         (Incremental_inputs::reloc_count_): New data member.
2060         (Incremental_inputs_reader): New class.
2061         (Incremental_symtab_reader): New class.
2062         (Incremental_relocs_reader): New class.
2063         * layout.cc (Layout::finalize): Move finalization of incremental info
2064         and creation of incremental info sections to follow finalization of
2065         symbol table.  Set offsets for postprocessing sections.
2066         (Layout::create_incremental_info_sections): Call
2067         Incremental_inputs::create_data_sections.  Add incremental symtab
2068         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
2069         sections to layout after input sections.
2070         * layout.h (struct Timespec): Forward declaration.
2071         (Layout::incremental_inputs): Add const.
2072         (Layout::create_incremental_info_sections): Add parameter.
2073         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2074         * object.cc: Include incremental.h.
2075         (Relobj::finalize_incremental_relocs): New function.
2076         (Sized_relobj::do_layout): Record input sections in incremental info.
2077         * object.h (Object::output_section): New function.
2078         (Object::output_section_offset): Moved from Relobj.
2079         (Object::get_incremental_reloc_base): New function.
2080         (Object::get_incremental_reloc_count): New function.
2081         (Object::do_output_section): New function.
2082         (Object::do_output_section_offset): Moved from Relobj.
2083         (Object::do_get_incremental_reloc_base): New function.
2084         (Object::do_get_incremental_reloc_count): New function.
2085         (Object::Object): Initialize new data members.
2086         (Relobj::output_section): Renamed do_output_section and moved to
2087         protected.
2088         (Relobj::output_section_offset): Moved to Object.
2089         (Relobj::do_get_incremental_reloc_base): New function.
2090         (Relobj::do_get_incremental_reloc_count): New function.
2091         (Relobj::allocate_incremental_reloc_counts): New function.
2092         (Relobj::count_incremental_reloc): New function.
2093         (Relobj::finalize_incremental_relocs): New function.
2094         (Relobj::next_incremental_reloc_index): New function.
2095         (Relobj::reloc_counts_): New data member.
2096         (Relobj::reloc_bases_): New data member.
2097         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
2098         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
2099         (Sized_relobj::incremental_relocs_scan): New function.
2100         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2101         (Sized_relobj::incremental_relocs_write): New function.
2102         (Sized_relobj::incremental_relocs_write_reltype): New function.
2103         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2104         incremental link.
2105         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2106         archives and object files elsewhere.
2107         (Add_symbols::run): Report object files here.
2108         (Finish_group::run): Report end of archive at end of group.
2109         * reloc.cc: Include layout.h, incremental.h.
2110         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2111         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2112         (Sized_relobj::incremental_relocs_scan): New function.
2113         (Sized_relobj::incremental_relocs_scan_reltype): New function.
2114         (Sized_relobj::do_relocate_sections): Write incremental relocations.
2115         (Sized_relobj::incremental_relocs_write): New function.
2116         (Sized_relobj::incremental_relocs_write_reltype): New function.
2117         * script.cc (read_input_script): Rewrite test for incremental link.
2118         Change call to Incremental_inputs::report_script.
2119         * symtab.h (Symbol_table::first_global_index): New function.
2120         (Symbol_table::output_count): New function.
2121
2122 2010-08-12  Doug Kwan  <dougkwan@google.com>
2123
2124         * arm.cc (Target_arm::merge_object_attributes): Check command line
2125         options --no-wchar-size-warning and --no-enum-size-warning.
2126         * options.h (General_options): Add ld-compatible options
2127         --no-enum-size-warning and --no-wchar-size-warning.
2128
2129 2010-08-04  Ian Lance Taylor  <iant@google.com>
2130
2131         * x86_64.cc (Target_x86_64::Scan::local): Use
2132         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2133         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2134         (Target_x86_64::Scan::global): Likewise.
2135         (Target_x86_64::Relocate::relocate): Likewise.
2136         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2137         Likewise.
2138
2139 2010-08-03  Cary Coutant  <ccoutant@google.com>
2140
2141         * merge.cc (Output_merge_string::do_add_input_section): Count strings
2142         to reserve space in merged_strings vector. Keep total input size
2143         for stats.
2144         (Output_merge_string::do_print_merge_stats): Print total input size.
2145         * merge.h (Output_merge_string): Add input_size_ field.
2146         * stringpool.cc (Stringpool_template::string_length): Move
2147         implementations out of Stringpool_template class and place in
2148         stringpool.h.
2149         * stringpool.h (string_length): Move out of Stringpool_template.
2150
2151 2010-08-03  Ian Lance Taylor  <iant@google.com>
2152
2153         PR 11712
2154         * layout.cc (relaxation_loop_body): If address of load segment is
2155         set, adjust address to include headers if possible.
2156
2157 2010-08-03  Ian Lance Taylor  <iant@google.com>
2158
2159         * version.cc (version_string): Bump to 1.10.
2160
2161 2010-08-03  Ian Lance Taylor  <iant@google.com>
2162
2163         PR 11805
2164         * layout.h (enum Output_section_order): Define.
2165         (class Layout): Update declarations.
2166         * layout.cc (Layout::get_output_section): Add order parameter.
2167         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2168         is_first_non_relro parameters.  Change all callers.
2169         (Layout::choose_output_section): Likewise.
2170         (Layout::add_output_section_data): Likewise.
2171         (Layout::make_output_section): Likewise.  Set order.
2172         (Layout::default_section_order): New function.
2173         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2174         * output.cc (Output_section::Output_section): Initialize order_.
2175         Don't initialize deleted fields.
2176         (Output_segment::Output_segment): Don't initialize deleted
2177         fields.
2178         (Output_segment::add_output_section_to_load): New function
2179         replacing add_output_section.  Change all callers to call this or
2180         add_output_section_to_nonload.
2181         (Output_segment::add_output_section_to_nonload): New function.
2182         (Output_segment::remove_output_section): Rewrite.
2183         (Output_segment::add_initial_output_data): Likewise.
2184         (Output_segment::has_any_data_sections): Likewise.
2185         (Output_segment::is_first_section_relro): Likewise.
2186         (Output_segment::maximum_alignment): Likewise.
2187         (Output_segment::has_dynamic_reloc): New function replacing
2188         dynamic_reloc_count.  Change all callers.
2189         (Output_segment::has_dynamic_reloc_list): New function replacing
2190         dynamic_reloc_count_list.  Change all callers.
2191         (Output_segment::set_section_addresses): Rewrite.
2192         (Output_segment::set_offset): Rewrite.
2193         (Output_segment::find_first_and_last_list): Remove.
2194         (Output_segment::set_tls_offsets): Rewrite.
2195         (Output_segment::first_section_load_address): Likewise.
2196         (Output_segment::output_section_count): Likewise.
2197         (Output_segment::section_with_lowest_load_address): Likewise.
2198         (Output_segment::write_section_headers): Likewise.
2199         (Output_segment::print_sections_to_map): Likewise.
2200         * output.h (class Output_data): Remove dynamic_reloc_count_
2201         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2202         (Output_data::add_dynamic_reloc): Rewrite.
2203         (Output_data::has_dynamic_reloc): New function.
2204         (Output_data::dynamic_reloc_count): Remove.
2205         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2206         is_last_relro_, is_first_non_relro_, is_interp_,
2207         is_dynamic_linker_section_ fields.  Add order and set_order
2208         functions.  Remove is_relro_local, set_is_relro_local,
2209         is_last_relro, set_is_last_relro, is_first_non_relro,
2210         set_is_first_non_relro functions, is_interp, set_is_interp,
2211         is_dynamic_linker_section, and set_is_dynamic_linker_section
2212         functions.
2213         (class Output_segment): Change Output_data_list from std::list to
2214         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2215         output_bss_ fields.  Update declarations.
2216
2217 2010-08-02  Ian Lance Taylor  <iant@google.com>
2218
2219         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2220         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2221         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2222
2223 2010-08-02  Ian Lance Taylor  <iant@google.com>
2224
2225         PR 11855
2226         * script.cc (Script_options::Script_options): Initialize
2227         symbol_definitions_ and symbol_references_.
2228         (Script_options::add_symbol_assignment): Update
2229         symbol_definitions_ and symbol_references_.
2230         (Script_options::add_symbol_reference): New function.
2231         (script_symbol): New function.
2232         * script.h (class Script_options): Add symbol_definitions_ and
2233         symbol_references_ fields.
2234         (Script_options::referenced_const_iterator): New type.
2235         (Script_options::referenced_begin): New function.
2236         (Script_options::referenced_end): New function.
2237         (Script_options::is_referenced): New function.
2238         (Script_options::any_unreferenced): New function.
2239         * script-c.h (script_symbol): Declare.
2240         * yyscript.y (exp): Call script_symbol.
2241         * symtab.cc: Include "script.h".
2242         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2243         Change all callers.  Check symbols referenced by scripts.
2244         (Symbol_table::add_undefined_symbols_from_command_line): Add
2245         layout parameter.  Change all callers.
2246         (Symbol_table::do_add_undefined_symbols_from_command_line):
2247         Likewise.  Break out loop body.  Check symbols referenced by
2248         scripts.
2249         (Symbol_table::add_undefined_symbol_from_command_line): New
2250         function broken out of
2251         do_add_undefined_symbols_from_command_line.
2252         * symtab.h (class Symbol_table): Update declarations.
2253         * archive.cc: Include "layout.h".
2254         (Archive::should_include_member): Add layout parameter.  Change
2255         all callers.  Check for symbol mentioned in expression.
2256         * archive.h (class Archive): Update declaration.
2257         * object.cc (Sized_relobj::do_should_include_member): Add layout
2258         parameter.
2259         * object.h (Object::should_include_member): Add layout parameter.
2260         Change all callers.
2261         (Object::do_should_include_member): Add layout parameter.
2262         (class Sized_relobj): Update declaration.
2263         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2264         parameter.
2265         * dynobj.h (class Sized_dynobj): Update declaration.
2266         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2267         layout parameter.
2268         * plugin.h (class Sized_pluginobj): Update declaration.
2269
2270 2010-08-02  Ian Lance Taylor  <iant@google.com>
2271
2272         PR 11866
2273         * output.cc (Output_segment::set_offset): Search for the first and
2274         last sections rather than assuming that the list is in order.
2275         (Output_segment::find_first_and_last_list): New function.
2276         * output.h (class Output_segment): Update declarations.
2277         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2278         (relro_strip_test_SOURCES): New variable.
2279         (relro_strip_test_DEPENDENCIES): New variable.
2280         (relro_strip_test_LDFLAGS): New variable.
2281         (relro_strip_test_LDADD): New variable.
2282         (relro_strip_test.so): New target.
2283
2284 2010-08-02  Ian Lance Taylor  <iant@google.com>
2285
2286         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2287         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2288         (Target_i386::got_tlsdesc_section): New function.
2289         (Target_i386::got_section): Create space for GOT entries for
2290         TLSDESC relocations.
2291         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2292         R_386_TLS_GOTDESC.
2293         (Target_i386::Scan::global): Likewise.
2294         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2295         using TLSDESC GOT.
2296         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2297         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2298         (Target_x86_64::got_tlsdesc_section): New function.
2299         (Target_x86_64::got_section): Create space for GOT entries for
2300         TLSDESC relocations.
2301         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2302         R_386_TLS_GOTDESC.
2303         (Target_x86_64::Scan::global): Likewise.
2304         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2305         using TLSDESC GOT.
2306
2307 2010-08-02  Ian Lance Taylor  <iant@google.com>
2308
2309         * testsuite/final_layout.sh: Use dc to convert from hex to
2310         decimal.
2311
2312 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2313
2314         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2315         paramter to the call to gold::gc_process_relocs.
2316         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2317         paramter to the call to gold::gc_process_relocs.
2318         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2319         parameter to the call to gold::gc_process_relocs.
2320         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2321         template parameter to the call to gold::gc_process_relocs.
2322         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2323         paramter to the call to gold::gc_process_relocs.
2324         * gc.h (get_embedded_addend_size): New function.
2325         (gc_process_relocs): Save the size of the reloc for use by ICF.
2326         * icf.cc (get_section_contents): Get the addend from the text section
2327         for SHT_REL relocation sections.
2328         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2329         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2330         * int_encoding.h (read_from_pointer): New overloaded function.
2331         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2332         * testsuite/icf_sht_rel_addend_test.sh: New file.
2333         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2334         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2335
2336 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2337
2338         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2339         * Makefile.in: Regenerate.
2340         * testsuite/Makefile.in: Regenerate.
2341
2342 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2343
2344         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2345         * gold/testsuite/debug_msg.cc: Likewise.
2346         * gold/testsuite/odr_violation1.cc
2347         * gold/testsuite/odr_violation2.cc
2348
2349 2010-07-21  Cary Coutant  <ccoutant@google.com>
2350
2351         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2352         string, and length fields.
2353         (Output_merge_string::Merged_strings_list): New type.
2354         (Output_merge_string::Merged_strings_lists): New typedef.
2355         (Output_merge_string): Replace merged_strings_ with
2356         merged_strings_lists_.
2357         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2358         Merged_strings_list per input object and section.  Don't store pointer
2359         to the string.  Don't store length with each merged string entry.
2360         (Output_merge_string::finalize_merged_data): Loop over list of merged
2361         strings lists.  Recompute length of each merged string.
2362
2363 2010-07-15  Cary Coutant  <ccoutant@google.com>
2364
2365         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2366         here.
2367
2368 2010-07-14  Ian Lance Taylor  <iant@google.com>
2369
2370         * descriptors.cc (Descriptors::open): Report correct name in error
2371         message.
2372
2373 2010-07-13  Doug Kwan  <dougkwan@google.com>
2374
2375         * arm.cc (Arm_input_section::Arm_input_section): For a
2376         SHT_ARM_EXIDX section, always keeps the input sections.
2377         (Arm_input_section::set_exidx_section_link): New method.
2378         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2379         has_errors_ to false.
2380         (Arm_exidx_input_section::has_errors,
2381         Arm_exidx_input_section::set_has_errors): New methods.
2382         (Arm_exidx_input_section::has_errors_): New data member.
2383         (Arm_relobj::get_exidx_shndx_list): New method.
2384         (Arm_output_section::append_text_sections_to_list): Do not skip
2385         section without SHF_EXECINSTR.
2386         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2387         errors.
2388         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2389         section header.  Make error messages more verbose.  Check for
2390         a non-executable section linked to an EXIDX section.
2391         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2392         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2393         check that there is no deferred EXIDX section if we exit early.
2394         Instead of not making an EXIDX section in case of an error, make one
2395         and set the has_errors flag of it.
2396         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2397         in a relocatable link.
2398         (Target_arm::do_relax): Look for the EXIDX output section instead of
2399         assuming that it is called .ARM.exidx.
2400         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2401         section list.  Do not check for SHF_EXECINSTR section flags but
2402         skip any input section with errors.
2403         * output.cc (Output_section::Output_section): Initialize
2404         always_keeps_input_sections_ to false.
2405         (Output_section::add_input_section): Check for
2406         always_keeps_input_sections_.
2407         *  output.h (Output_section::always_keeps_input_sections,
2408         Output_section::set_always_keeps_input_sections): New methods.
2409         (Output_section::always_keeps_input_sections): New data member.
2410
2411 2010-07-13  Rafael Espindola  <espindola@google.com>
2412
2413         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2414         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2415
2416 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2417             Ian Lance Taylor  <iant@google.com>
2418
2419         * output.h (Output_section_lookup_maps::add_merge_section):
2420         Correct check of whether value was inserted.
2421         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2422         (Output_section_lookup_maps::add_relaxed_input_section):
2423         Likewise.
2424         * arm.cc (Target_arm::got_section): Remove used local os.
2425         * i386.cc (Target_i386::got_section): Likewise.
2426         * x86_64.cc (Target_x86_64::got_section): Likewise.
2427         * sparc.cc (Target_sparc::got_section): Likewise.
2428         (Target_sparc::relocate): Remove unused local have_got_offset.
2429         * powerpc.cc (Target_powerpc::relocate): Likewise.
2430
2431 2010-07-13  Ian Lance Taylor  <iant@google.com>
2432
2433         * compressed_output.cc (zlib_decompress): Fix signature in
2434         !HAVE_ZLIB_H case.
2435
2436         * archive.cc (Archive::include_member): Unlock an external member
2437         of a thin archive.  Don't bother to delete an object we know is
2438         NULL.
2439
2440 2010-07-12  Cary Coutant  <ccoutant@google.com>
2441
2442         * compressed_output.cc (zlib_decompress): New function.
2443         (get_uncompressed_size): New function.
2444         (decompress_input_section): New function.
2445         * compressed_output.h (get_uncompressed_size): New function.
2446         (decompress_input_section): New function.
2447         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2448         Handle compressed debug sections.
2449         * layout.cc (is_compressed_debug_section): New function.
2450         (Layout::output_section_name): Map compressed section names to
2451         canonical names.
2452         * layout.h (is_compressed_debug_section): New function.
2453         (is_debug_info_section): Recognize compressed debug sections.
2454         * merge.cc: Include compressed_output.h.
2455         (Output_merge_data::do_add_input_section): Handle compressed
2456         debug sections.
2457         (Output_merge_string::do_add_input_section): Handle compressed
2458         debug sections.
2459         * object.cc: Include compressed_output.h.
2460         (Sized_relobj::Sized_relobj): Initialize new data members.
2461         (build_compressed_section_map): New function.
2462         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2463         * object.h (Object::section_is_compressed): New method.
2464         (Object::do_section_is_compressed): New method.
2465         (Sized_relobj::Compressed_section_map): New type.
2466         (Sized_relobj::do_section_is_compressed): New method.
2467         (Sized_relobj::compressed_sections_): New data member.
2468         * output.cc (Output_section::add_input_section): Handle compressed
2469         debug sections.
2470         * reloc.cc: Include compressed_output.h.
2471         (Sized_relobj::write_sections): Handle compressed debug sections.
2472
2473 2010-07-08  Cary Coutant  <ccoutant@google.com>
2474
2475         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2476         weak when resolving to a dynamic def.
2477         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2478         for weak undef/dynamic def cases. Adjust callers.
2479         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2480         undef_binding_weak_.
2481         (Symbol_table::sized_write_globals): Adjust symbol binding.
2482         (Symbol_table::sized_write_symbol): Add binding parameter.
2483         * symtab.h (Symbol::set_undef_binding): New method.
2484         (Symbol::is_undef_binding_weak): New method.
2485         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2486         (Symbol_table::should_override): Add new parameter.
2487         (Symbol_table::sized_write_symbol): Add new parameter.
2488
2489         * testsuite/weak_undef_file1.cc: Add new test case.
2490         * testsuite/weak_undef_file2.cc: Fix header comment.
2491         * testsuite/weak_undef_test.cc: Add new test case.
2492
2493 2010-06-29  Doug Kwan  <dougkwan@google.com>
2494
2495         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2496         Initialize USE_SYMBOL_.
2497         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2498         definition.
2499         (Arm_reloc_property::uses_symbol_): New data member declaration.
2500         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2501         uses symbol value and symbol is undefined but not weakly undefined.
2502
2503 2010-06-28  Rafael Espindola  <espindola@google.com>
2504
2505         * plugin.cc (Plugin::load): Use dlerror.
2506
2507 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2508
2509         * symtab.cc (detect_odr_violations): When reporting an ODR
2510         violation, report an object where the symbol is defined.
2511
2512 2010-06-25  Doug Kwan  <dougkwan@google.com>
2513
2514         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2515         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2516         definition.
2517         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2518         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2519         target hook to detect function points.
2520         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2521         * icf.h (Icf::check_section_for_function_pointers): Change type of
2522         parameter SECTION_NAME to const reference to std::string.  Use
2523         target hook to determine if section may have unsafe pointers.
2524         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2525         method definition.
2526
2527 2010-06-21  Rafael Espindola  <espindola@google.com>
2528
2529         * fileread.cc (Input_file::find_fie): New
2530         (Input_file::open): Use Input_file::find_fie.
2531         * fileread.h (Input_file::find_fie): New
2532         * plugin.cc (set_extra_library_path): New.
2533         (Plugin::load): Add set_extra_library_path to the transfer vector.
2534         (Plugin_manager::set_extra_library_path): New.
2535         (Plugin_manager::add_input_file): Use the extra search path if set.
2536         (set_extra_library_path(): New.
2537         * plugin.h (Plugin_manager): Add set_extra_library_path and
2538         extra_search_path_.
2539
2540 2010-06-19  Cary Coutant  <ccoutant@google.com>
2541
2542         * layout.cc (gdb_sections): Add .debug_types.
2543         (lines_only_debug_sections): Likewise.
2544
2545 2010-06-18  Rafael Espindola  <espindola@google.com>
2546
2547         * plugin.cc (add_input_file,add_input_library)
2548         (Plugin_manager::add_input_file): Make filename arguments const.
2549         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2550         const.
2551
2552 2010-06-16  Doug Kwan  <dougkwan@google.com>
2553
2554         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2555         .ARM.attributes section if we have not merged any input
2556         attributes sections.
2557
2558 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2559
2560         * arm.cc: Allow combining objects with no EABI version
2561         information.
2562
2563 2010-06-15  Rafael Espindola  <espindola@google.com>
2564
2565         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2566
2567 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2568
2569         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2570         (struct iovec): Correct !HAVE_READV definition.
2571
2572 2010-06-10  Cary Coutant  <ccoutant@google.com>
2573
2574         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2575         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2576         reloc sections.
2577         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2578
2579         PR 11683
2580         * symtab.h (Symbol::is_placeholder): New member function.
2581         * target-reloc.h (relocate_section): Check for placeholder symbols.
2582
2583         * testsuite/Makefile.am (plugin_test_8): New test.
2584         (plugin_test_9): New test.
2585         * testsuite/Makefile.in: Regenerate.
2586
2587 2010-06-09  Nick Clifton  <nickc@redhat.com>
2588
2589         * yyscript.y (input_list_element): Allow strings prefixed with
2590         the '-' character.  Treat these as libraries.
2591         * script.cc (script_add_library): New function.  Adds a library
2592         specified by "-l<name>" found in an input script.
2593         * script-c.h: Add prototype for script_add_library.
2594
2595 2010-06-07  Doug Kwan  <dougkwan@google.com>
2596
2597         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2598         Restrict stub-group size to be within long conditional branch
2599         range when working around cortex-A8 erratum.
2600
2601 2010-06-07  Damien Diederen  <dd@crosstwine.com>
2602
2603         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2604         #ifdef typo.
2605
2606 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
2607
2608         PR gold/11658
2609         * output.cc
2610         (Output_section::Input_section_sort_entry::compare_section_ordering):
2611         Change to return non-zero correctly.
2612         (Output_section::Input_section_sort_section_order_index_compare
2613         ::operator()): Change to fix ambiguity in comparisons.
2614
2615 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
2616
2617         * gold.h (is_wildcard_string): New function.
2618         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2619         (Layout::layout_eh_frame): Ditto.
2620         (Layout::find_section_order_index): New method.
2621         (Layout::read_layout_from_file): New method.
2622         * layout.h (Layout::find_section_order_index): New method.
2623         (Layout::read_layout_from_file): New method.
2624         (Layout::input_section_position_): New private member.
2625         (Layout::input_section_glob_): New private member.
2626         * main.cc (main): Call read_layout_from_file here.
2627         * options.h (--section-ordering-file): New option.
2628         * output.cc (Output_section::input_section_order_specified_): New
2629         member.
2630         (Output_section::Output_section): Initialize new member.
2631         (Output_section::add_input_section): Add new parameter.
2632         Keep input sections when --section-ordering-file is used.
2633         (Output_section::set_final_data_size): Sort input sections when
2634         section ordering file is specified.
2635         (Output_section::Input_section_sort_entry): Add new parameter.
2636         Check sorting type.
2637         (Output_section::Input_section_sort_entry::compare_section_ordering):
2638         New method.
2639         (Output_section::Input_section_sort_compare::operator()): Change to
2640         consider section_order_index.
2641         (Output_section::Input_section_sort_init_fini_compare::operator()):
2642         Change to consider section_order_index.
2643         (Output_section::Input_section_sort_section_order_index_compare
2644         ::operator()): New method.
2645         (Output_section::sort_attached_input_sections): Change to sort
2646         according to section order when specified.
2647         (Output_section::add_input_section<32, true>): Add new parameter.
2648         (Output_section::add_input_section<64, true>): Add new parameter.
2649         (Output_section::add_input_section<32, false>): Add new parameter.
2650         (Output_section::add_input_section<64, false>): Add new parameter.
2651         * output.h (Output_section::add_input_section): Add new parameter.
2652         (Output_section::input_section_order_specified): New
2653         method.
2654         (Output_section::set_input_section_order_specified): New method.
2655         (Input_section::Input_section): Initialize section_order_index_.
2656         (Input_section::section_order_index): New method.
2657         (Input_section::set_section_order_index): New method.
2658         (Input_section::section_order_index_): New member.
2659         (Input_section::Input_section_sort_section_order_index_compare): New
2660         struct.
2661         (Output_section::input_section_order_specified_): New member.
2662         * script-sections.cc (is_wildcard_string): Delete and move modified
2663         method to gold.h.
2664         (Output_section_element_input::Output_section_element_input): Modify
2665         call to is_wildcard_string.
2666         (Output_section_element_input::Input_section_pattern
2667         ::Input_section_pattern): Ditto.
2668         (Output_section_element_input::Output_section_element_input): Ditto.
2669         * testsuite/Makefile.am (final_layout): New test case.
2670         * testsuite/Makefile.in: Regenerate.
2671         * testsuite/final_layout.cc: New file.
2672         * testsuite/final_layout.sh: New file.
2673
2674 2010-06-01  Rafael Espindola  <espindola@google.com>
2675
2676         * plugin.cc (Plugin::load): Pass the output name to the plugin.
2677
2678 2010-06-01  Rafael Espindola  <espindola@google.com>
2679
2680         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2681         visibility of symbols.
2682
2683 2010-05-27  Doug Kwan  <dougkwan@google.com>
2684
2685         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2686         from start of output section instead of address for a local symbol
2687         in a merged or relaxed section when doing a relocatable link.
2688
2689 2010-05-26  Rafael Espindola  <espindola@google.com>
2690
2691        PR 11604
2692         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2693         adding sections the garbage collector removed.
2694         * gold/testsuite/Makefile.am: Add test.
2695         * gold/testsuite/Makefile.in: Regenerate.
2696         * gold/testsuite/plugin_test_7.sh: New.
2697         * gold/testsuite/plugin_test_7_1.c: New.
2698         * gold/testsuite/plugin_test_7_2.c: New.
2699
2700 2010-05-26  Rafael Espindola  <espindola@google.com>
2701
2702         * script-sections.cc (Output_section_definition::set_section_addresses):
2703         Check for --section-start.
2704
2705 2010-05-26  Doug Kwan  <dougkwan@google.com>
2706
2707         * arm.cc (Arm_scan_relocatable_relocs): New class.
2708         (Target_arm::relocate_special_relocatable): New method.
2709         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2710         (Arm_relocate_functions::thumb_branch_common): Same.
2711         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2712         instead of Default_scan_relocatable_relocs.
2713         * target-reloc.h (relocate_for_relocatable): Let target handle
2714         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2715         * target.h (Sized_target::relocate_special_relocatable): New method.
2716
2717 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2718
2719         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2720
2721 2010-05-23  Doug Kwan  <dougkwan@google.com>
2722
2723         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2724         instead of a cast.
2725         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2726         with a direct branch, not a conditional branch, to a stub.
2727         * merge.cc (Output_merge_base::record_input_section): New method
2728         defintion.
2729         (Output_merge_data::do_add_input_section): Record input section if
2730         keeps-input-sections flag is set.
2731         (Output_merge_string::do_add_input_section): Ditto.
2732         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2733         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2734         INPUT_SECTIONS_.
2735         (Output_merge_base::keeps_input_sections,
2736         Output_merge_base::set_keeps_input_sections,
2737         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2738         method definitions.
2739         (Output_merge_base::Input_sections): New type declaration.
2740         (Output_merge_base::input_sections_begin,
2741         Output_merge_base::input_sections_end,
2742         Output_merge_base::do_set_keeps_input_sections): New method definitions.
2743         (Output_merge_base::bool keeps_input_sections_,
2744         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2745         Output_merge_base::input_sections_): New data members.
2746         (Output_merge_data::do_set_keeps_input_sections): New method
2747         defintion.
2748         (Output_merge_string::do_set_keeps_input_sections): Ditto.
2749         * output.cc (Output_section::Input_section::relobj): Move method
2750         defintion from class declaration to here and handle merge sections.
2751         (Output_section::Input_section::shndx): Ditto.
2752         (Output_section::Output_section): Remove initializations of removed
2753         data members and initialize new data member LOOKUP_MAPS_.
2754         (Output_section::add_input_section): Set keeps-input-sections flag
2755         for a newly created merge output section as appropriate.  Adjust code
2756         to use Output_section_lookup_maps class.
2757         (Output_section::add_relaxed_input_section): Adjst code for lookup
2758         maps code refactoring.
2759         (Output_section::add_merge_input_section): Add a new parameter
2760         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
2761         class.  If adding input section to a newly created merge output
2762         section fails, remove the new merge section.
2763         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2764         Adjust code for use of the Output_section_lookup_maps class.
2765         (Output_section::find_merge_section): Ditto.
2766         (Output_section::build_lookup_maps): New method defintion.
2767         (Output_section::find_relaxed_input_section): Adjust code to use
2768         Output_section_lookup_maps class.
2769         (Output_section::get_input_sections): Export merge sections.  Adjust
2770         code to use Output_section_lookup_maps class.
2771         (Output_section:::add_script_input_section): Adjust code to use
2772         Output_section_lookup_maps class.  Update lookup maps for merge
2773         sections also.
2774         (Output_section::discard_states): Use Output_section_lookup_maps.
2775         (Output_section::restore_states): Same.
2776         * output.h (Merge_section_properties): Move class defintion out of
2777         Output_section.
2778         (Output_section_lookup_maps): New class.
2779         (Output_section::Input_section::is_merge_section): New method
2780         defintion.
2781         (Output_section::Input_section::relobj): Move defintion out of class
2782         defintion.  Declare method only.
2783         (Output_section::Input_section::shndx): Ditto.
2784         (Output_section::Input_section::output_merge_base): New method defintion.
2785         (Output_section::Input_section::u2_.pomb): New union field.
2786         (Output_section::Merge_section_by_properties_map,
2787         Output_section::Output_section_data_by_input_section_map,
2788         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2789         Remove types.
2790         (Output_section::add_merge_input_section): Add new parameter
2791         KEEPS_INPUT_SECTIONS.
2792         (Output_section::build_lookup_maps): New method declaration.
2793         (Output_section::merge_section_map_,
2794         Output_section::merge_section_by_properties_map_,
2795         Output_section::relaxed_input_section_map_,
2796         Output_section::is_relaxed_input_section_map_valid_): Remove data
2797         members.
2798         (Output_section::lookup_maps_): New data member.
2799
2800 2010-05-21  Doug Kwan  <dougkwan@google.com>
2801
2802         PR gold/11619
2803         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2804         avoid a compilation error.
2805
2806 2010-05-19  Rafael Espindola  <espindola@google.com>
2807
2808         * script-sections.cc (Output_section_definition::allocate_to_segment):
2809         Update the phdrs_list even when the output section is NULL.
2810         * testsuite/Makefile.am: Add test.
2811         * testsuite/Makefile.in: Regenerate.
2812         * testsuite/script_test_9.cc: New.
2813         * testsuite/script_test_9.sh: New.
2814         * testsuite/script_test_9.t: New.
2815
2816 2010-05-19  Doug Kwan  <dougkwan@google.com>
2817
2818         * arm.cc (Arm_input_section::original_size): New method.
2819         (Arm_input_section::do_addralign): Add a cast.
2820         (Arm_input_section::do_output_offset): Remove static cast.
2821         (Arm_input_section::original_addralign,
2822          Arm_input_section::original_size_): Change type to uint32_t.
2823         (Arm_input_section::init): Add safe casts for section alignment
2824         and size.
2825         (Arm_input_section::set_final_data_size): Do not set address and
2826         offset of stub table.
2827         (Arm_output_section::fix_exidx_coverage): Change use of of
2828         Output_section::Simple_input_section to that of
2829         Output_section::Input_section.
2830         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2831         except for the first pass.
2832         * output.cc (Output_section::get_input_sections): Change type of
2833         input_sections to std::list<Input_section>.
2834         (Output_section::add_script_input_section): Rename from
2835         Output_section::add_simple_input_section.  Change type of SIS
2836         parameter from Simple_input_section to Input_section.
2837         * output.h (Output_section::Simple_input_section): Remove class.
2838         (Output_section::Input_section): Change class visibility to public.
2839         (Output_section::Input_section::addralign): Use stored alignments
2840         for special input sections if set.
2841         (Output_section::Input_section::set_addralign): New method.
2842         (Output_section::get_input_sections): Change parameter type from
2843         list of Simple_input_section to list of Input_section.
2844         (Output_section::add_script_input_section): Rename from
2845         Output_section::add_simple_input_section. Change first parameter's
2846         type from Simple_input_section to Input_section and remove the
2847         second and third parameters.
2848         * script-sections.cc (Input_section::Input_section_list): Change
2849         type to list of Output_section::Input_section/
2850         (Input_section_info::Input_section_info): Change parameter type of
2851         INPUT_SECTION to Output_section::Input_section.
2852         (Input_section_info::input_section): Change return type.
2853         (Input_section_info::input_section_): Change type to
2854         Output_section::Input_section.
2855         (Output_section_element_input::set_section_addresses): Adjust code
2856         to use Output_section::Input_section instead of
2857         Output_section::Simple_input_section.  Adjust code for renaming
2858         of Output_section::add_simple_input_section.
2859         (Orphan_output_section::set_section_addresses): Ditto.
2860
2861 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2862
2863         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2864         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2865
2866 2010-05-18  Rafael Espindola  <espindola@google.com>
2867
2868         * options.cc (General_options::finalize): Handle -nostdlib.
2869         * options.h (nostdlib): New option.
2870         * script.cc (script_add_search_dir): Handle -nostdlib.
2871
2872 2010-05-12  Doug Kwan  <dougkwan@google.com>
2873
2874         * arm.cc (Target_arm::do_finalize_sections): Create an empty
2875         attributes section only if there no attributes section after merging.
2876         (Target_arm::merge_object_attributes): Move value of
2877         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2878         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2879         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2880         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2881         and arm_attr_merge_7.stdout.
2882         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2883         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2884         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2885         arm_attr_merge_7b.o): New rules.
2886         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2887         arm_attr_merge_7
2888         * testsuite/Makefile.in: Regenerate.
2889         * testsuite/arm_attr_merge.sh: New file.
2890         * testsuite/arm_attr_merge_[67][ab].s: Same.
2891
2892 2010-05-05  Nick Clifton  <nickc@redhat.com>
2893
2894         * po/es.po: Updated Spanish translation.
2895
2896 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2897
2898         * Makefile.am (install-exec-local): Properly install gold as
2899         default cross linker.
2900         * Makefile.in: Regenerated.
2901
2902 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2903             Nick Clifton  <nickc@redhat.com>
2904
2905         * configure.ac (install_as_default): Define and set to false
2906         unless --enable-gold or --enable-gold=both/gold has been
2907         specified.
2908         * configure: Regenerate.
2909
2910         * Makefile.am (install-exec-local): Install the executable as
2911         'ld.gold'.  If install_as_default is true then also install it as
2912         'ld'.
2913         * Makefile.in: Regenerated.
2914
2915 2010-04-24  Ian Lance Taylor  <iant@google.com>
2916
2917         * layout.cc (Layout::layout_reloc): In relocatable link don't
2918         combine reloc sections for grouped sections.
2919
2920 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
2921
2922         * gc.h (gc_process_relocs): Pass information on relocs pointing to
2923         sections that are not ordinary to icf.
2924         * icf.cc (get_section_contents): Handle relocation pointing to section
2925         with no object or shndx information.
2926         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2927         * testsuite/Makefile.in: Regenerate.
2928         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2929         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2930
2931 2010-04-22  Ian Lance Taylor  <iant@google.com>
2932
2933         * expression.cc (Expression::Expression_eval_info): Add
2934         result_alignment_pointer field.
2935         (Expression::eval_with_dot): Add result_alignment_pointer
2936         parameter.  Change all callers.
2937         (Expression::eval_maybe_dot): Likewise.
2938         (class Binary_expression): Add alignment_pointer parameter to
2939         left_value and right_value.  Change all callers.
2940         (BINARY_EXPRESSION): Set result alignment.
2941         (class Trinary_expression): Add alignment_pointer parameter to
2942         arg2_value and arg3_value.  Change all callers.
2943         (Trinary_cond::value): Set result alignment.
2944         (Max_expression::value, Min_expression::value): Likewise.
2945         (Align_expression::value): Likewise.
2946         * script-sections.cc (class Sections_element): Add dot_alignment
2947         parameter to set_section_addresses virtual function.  Update
2948         instantiations.
2949         (class Output_section_element): Likewise.
2950         (Script_sections::create_segments): Add dot_alignment parameter.
2951         Change all callers.
2952         (Script_sections::create_segments_from_phdrs_clause): Likewise.
2953         (Script_sections::set_phdrs_clause_addresses): Likewise.
2954         * script-sections.h: Update declarations.
2955         * script.h: Update declarations.
2956         * output.h (Output_segment::set_minimum_p_align): Don't decrease
2957         min_p_align.
2958         * testsuite/script_test_3.t: Set large alignment.
2959         * testsuite/script_test_3.sh: Make sure that at least one LOAD
2960         segment has expected alignment.
2961
2962 2010-04-22  Nick Clifton  <nickc@redhat.com>
2963
2964         * po/gold.pot: Updated by the Translation project.
2965         * po/vi.po: Updated Vietnamese translation.
2966
2967 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
2968
2969         * testsuite/Makefile.am (check_PROGRAMS): Add
2970         icf_virtual_function_folding_test.
2971         * testsuite/Makefile.in: Regenerated.
2972
2973 2010-04-15  Andrew Haley  <aph@redhat.com>
2974
2975         * options.h (merge_exidx_entries): New option.
2976         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2977         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2978         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2979         (Target_arm::merge_exidx_entries): New function.
2980         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2981         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2982         to Arm_exidx_fixup constructor.
2983         Add new arg, merge_exidx_entries.
2984         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2985         Arm_output_section::fix_exidx_coverage.
2986
2987 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
2988
2989         * icf.cc (get_section_contents): Check for preemptible functions.
2990         Ignore addend when appropriate.
2991         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
2992         section folded.
2993         (add_from_relobj): Check for section folded.
2994         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2995         * symtab.h (should_add_dynsym_entry): Add new parameter.
2996         * target-reloc.h (scan_relocs): Check for section folded.
2997         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2998         Check reloc types for function pointers in shared objects.
2999         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3000         case.
3001         (icf_preemptible_functions_test): New test case.
3002         (icf_string_merge_test): New test case.
3003         * testsuite.Makefile.in: Regenerate.
3004         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3005         bar_glob.  Refactor code.
3006         * testsuite/icf_preemptible_functions_test.cc: New file.
3007         * testsuite/icf_preemptible_functions_test.sh: New file.
3008         * testsuite/icf_string_merge_test.cc: New file.
3009         * testsuite/icf_string_merge_test.sh: New file.
3010         * testsuite/icf_virtual_function_folding_test.cc: New file.
3011         * testsuite/icf_virtual_function_folding_test.sh: New file.
3012
3013 2010-04-14  Doug Kwan  <dougkwan@google.com>
3014
3015         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3016         for local symbol recounting if we remove a section due to ICF.
3017         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3018         there are no regular objects in input.
3019
3020 2010-04-13  Doug Kwan  <dougkwan@google.com>
3021
3022         * arm.cc (Arm_input_section::set_final_data_size): Compute
3023         accurate final data size instead of using current data size.
3024
3025 2010-04-09  Doug Kwan  <dougkwan@google.com>
3026
3027         * layout.cc (Layout::choose_output_section): Handle script section
3028         types.
3029         (Layout::make_output_section_for_script): Add section type parameter.
3030         Handle script section types.
3031         * layout.h (Layout::make_output_section_for_script): Add section
3032         type parameter.
3033         * output.cc (Output_section::Output_section): Initialize data member
3034         is_noload_.
3035         (Output_section::do_reset_address_and_file_offset): Do not set address
3036         to 0 if section is a NOLOAD section.
3037         * output.h (Output_section::is_noload): New method.
3038         (Output_section::set_is_noload): Ditto.
3039         (Output_section::is_noload_): New data member.
3040         * script-c.h (Script_section_type): New enum type.
3041         (struct Parser_output_section_header): Add new file section_type.
3042         * script-sections.cc (Sections_element::output_section_name): Add
3043         parameter for returning script section type.
3044         (Output_section_definition::output_section_name): Ditto.
3045         (Output_section_definition::section_type)P; New method.
3046         (Output_section_definiton::script_section_type_name): Ditto.
3047         (Output_section_definition::script_section_type_): New data member.
3048         (Output_section_definition::Output_section_definition): Initialize
3049         data member Output_section_definition::script_section_type_.
3050         (Output_section_definition::create_sections): Pass script section type
3051         to Layout::make_output_section_for_script.
3052         (Output_section_definition::output_section_name): Return script
3053         section type to caller.
3054         (Output_section_definition::set_section_address): Do not advance
3055         dot value and load address if section type is NOLOAD.  Set address
3056         of NOLOAD sections regardless of section flags.
3057         (Output_section_definition::print): Print section type if it is
3058         not SCRIPT_SECTION_TYPE_NONE.
3059         (Output_section_definition::section_type): New method.
3060         (Output_section_definition::script_section_type_name): Ditto.
3061         (Script_sections::output_section_name): Add new parameter
3062         PSECTION_TYPE for returning script section type.  Pass it to
3063         section elements.  Handle discard sections.
3064         (Sort_output_sections::operator()): Handle NOLOAD sections.
3065         * script-sections.h (Script_sections::Section_type): New enum type.
3066         (Script_sections::output_section_name): Add a new parameter for
3067         returning script section type.
3068         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3069         INFO and NOLOAD.
3070         * yyscript.y (union): Add new field SECTION_TYPE.
3071         (COPY, DSECT, INFO, NOLOAD): New tokens.
3072         (opt_address_and_section_type): Change type to output_section_header.
3073         (section_type): New non-terminal
3074         (section_header): Handle section type.
3075         (opt_address_and_section_type): Return section type value.
3076
3077 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
3078
3079         * testsuite/plugin_common_test_1.c (foo): Add prototype.
3080         * testsuite/plugin_common_test_2.c (foo): Likewise.
3081
3082 2010-04-08  Doug Kwan  <dougkwan@google.com>
3083
3084         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3085         Output_merge_data.
3086         * output.cc (Output_section::add_merge_input_section): Simplify
3087         code and return status of Output_merge_base::add_input_section.
3088         Update merge section map only if Output_merge_base::add_input_section
3089         returns true.
3090
3091 2010-04-07  Doug Kwan  <dougkwan@google.com>
3092
3093         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3094         if section is marked as containing instructions but has no mapping
3095         symbols.
3096         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3097         correct section index.
3098         (Arm_relobj::find_linked_text_section): Ditto.
3099
3100 2010-04-07  Cary Coutant  <ccoutant@google.com>
3101
3102         * archive.cc (include_member): Destroy Read_symbols_data object before
3103         releasing file.
3104         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3105         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3106         (Read_symbols_data::~Read_symbols_data) New destructor.
3107         (Section_relocs::Section_relocs) New constructor.
3108         (Section_relocs::~Section_relocs) New destructor.
3109         (Read_relocs_data::Read_relocs_data) New constructor.
3110         (Read_relocs_data::~Read_relocs_data) New destructor.
3111         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3112         pointers to NULL after deleting.
3113
3114 2010-04-07  Doug Kwan  <dougkwan@google.com>
3115
3116         * arm.cc: Replace "endianity" with "endianness" in comments.
3117         (Arm_exidx_cantunwind): Ditto.
3118         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3119         (Arm_relobj::merge_flags_and_attributes): New method.
3120         (Arm_relobj::merge_flags_and_attributes_): New data member.
3121         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3122         (Arm_relobj::scan_sections_for_stubs): Ditto.
3123         (Arm_relobj::do_read_symbols): Check to see if we really want to
3124         merge processor-specific flags and attributes.  Exit early if
3125         an object is empty except for section names and the undefined symbol.
3126         (Target_arm::do_finalize_sections): Move check for ELF format to
3127         Arm_relobj::do_read_symbols.  Merge processor specific flags and
3128         attributes from a regular object only when we have determined that
3129         it is aapropriate.  Do not create an .ARM.attributes section in
3130         output if there is no regular input object.
3131         (Target_arm::merge_processor_specific_flags): Check
3132         --warn-mismatch before printing any error.
3133         (Target_arm::merge_object_attributes): Ditto.
3134         * gold.cc (queue_middle_tasks): Handle the case in which there is
3135         no regular object in input.
3136         * options.cc (General_options::parse_EB): New method.
3137         (General_options::parse_EL): Same.
3138         (General_options::General_options): Initialize endianness_.
3139         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3140         New options.
3141         (General_options::Endianness): New enum.
3142         (General_options::endianness): New method.
3143         (General_options::endianness_): New data member.
3144         * parameters.cc (Parameters::set_options): Check target endianness.
3145         (Parameters::set_target_once): Ditto.
3146         (Parameters::check_target_endianness): New method.
3147         (parameters_force_valid_target): If either -EL or -EB is specified,
3148         use it to define endianness of default target.
3149         * parameters.h (Parameters::check_target_endianness): New method
3150         declaration.
3151         * target.h (class Target): Change "endianity" to "endianness"
3152         in comments.
3153
3154 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3155
3156         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3157         * configure: Regenerate.
3158         * Makefile.in: Regenerate.
3159         * testsuite/Makefile.in: Regenerate.
3160
3161 2010-04-06  Cary Coutant  <ccoutant@google.com>
3162
3163         gcc PR lto/42757
3164         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3165         prevailing definitions of common symbols.
3166         * testsuite/plugin_test_6.sh: New test case.
3167         * testsuite/plugin_common_test_1.c: New test case.
3168         * testsuite/plugin_common_test_2.c: New test case.
3169         * testsuite/Makefile.am (plugin_test_6): New test case.
3170         * testsuite/Makefile.in: Regenerate.
3171
3172 2010-04-06  Nick Clifton  <nickc@redhat.com>
3173
3174         * po/vi.po: New Vietnamese translation.
3175
3176 2010-03-30  Doug Kwan  <dougkwan@google.com>
3177
3178         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3179
3180 2010-03-25  Doug Kwan  <dougkwan@google.com>
3181
3182         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3183         to avoid a conversion warning on a 32-bit host.
3184
3185 2010-03-24  Ian Lance Taylor  <iant@google.com>
3186
3187         * testsuite/script_test_3.t: Add a TLS segment.
3188         * testsuite/Makefile.am (check_PROGRAMS): Add
3189         tls_phdrs_script_test.
3190         (tls_phdrs_script_test_SOURCES): Define.
3191         (tls_phdrs_script_test_DEPENDENCIES): Define.
3192         (tls_phdrs_script_test_LDFLAGS): Define.
3193         (tls_phdrs_script_test_LDADD): Define.
3194         * testsuite/Makefile.in: Rebuild.
3195
3196 2010-03-23  Cary Coutant  <ccoutant@google.com>
3197
3198         * fileread.cc (find_or_make_view): Fix comment.
3199
3200 2010-03-23  Ian Lance Taylor  <iant@google.com>
3201
3202         * script-sections.cc (class Orphan_section_placement): Define
3203         PLACE_TLS and PLACE_TLS_BSS.
3204         (Orphan_section_placement::Orphan_section_placement): Initialize
3205         new places.
3206         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3207         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3208         (tls_script_test_SOURCES): Define.
3209         (tls_script_test_DEPENDENCIES): Define.
3210         (tls_script_test_LDFLAGS): Define.
3211         (tls_script_test_LDADD): Define.
3212         * testsuite/Makefile.in: Rebuild.
3213
3214 2010-03-22  Doug Kwan  <dougkwan@google.com>
3215
3216         * arm.cc (Arm_relocate_functions::abs8,
3217         Arm_relocate_functions::abs16): Use correct check for overflow
3218         specified in the ARM ELF specs.
3219         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3220         target of a BLX instruction specially.
3221         (Reloc_stub::stub_type_for_reloc): Ditto.
3222         (Relocate::relocate): Use symbolic names instead of numeric relocation
3223         codes to report error.
3224         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3225         workaround.
3226         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3227         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3228         thumb2_blx_out_of_range.stdout
3229         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3230         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3231         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3232         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3233         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3234         thumb2_blx_in_range, thumb2_blx_in_range.o,
3235         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3236         thumb2_blx_out_of_range.o): New rules.
3237         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3238         thumb2_blx_in_range and thumb2_blx_out_of_range.
3239         * testsuite/Makefile.in: Regenerate.
3240         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3241         * testsuite/thumb_blx_in_range.s: New file.
3242         * testsuite/thumb_blx_out_of_range.s: New file.
3243
3244 2010-03-22  Rafael Espindola  <espindola@google.com>
3245
3246         * archive.cc (Should_include): Move to archive.h.
3247         (should_include_member): Make it a member of Archive.
3248         (Lib_group): New.
3249         (Add_lib_group_symbols): New.
3250         * archive.h: Include options.h.
3251         (Archive_member): Moved from Archive.
3252         (Should_include): Moved from archive.cc.
3253         (Lib_group): New.
3254         (Add_lib_group_symbols): New.
3255         * dynobj.cc (do_should_include_member): New.
3256         * dynobj.h (do_should_include_member): New.
3257         * gold.cc (queue_initial_tasks): Update call to queue.
3258         * main.cc (main): Print lib group stats.
3259         * object.cc (do_should_include_member): New.
3260         * object.h: Include archive.h.
3261         (Object::should_include_member): New.
3262         (Object::do_should_include_member): New.
3263         (Sized_relobj::do_should_include_member): New.
3264         * options.cc (General_options::parse_start_lib): New.
3265         (General_options::parse_end_lib): New.
3266         (Input_arguments::add_file): Handle lib groups.
3267         (Input_arguments::start_group): Check we are not in a lib.
3268         (Input_arguments::start_lib): New.
3269         (Input_arguments::end_lib): New.
3270         * options.h (General_options): Add start_lib and end_lib.
3271         (Input_argument::lib_): New.
3272         (Input_argument::lib): New.
3273         (Input_argument::is_lib): New.
3274         (Input_file_lib): New.
3275         (Input_arguments::in_lib_): New.
3276         (Input_arguments::in_lib): New.
3277         (Input_arguments::start_lib): New.
3278         (Input_arguments::end_lib_): New.
3279         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3280         in unused members as preempted.
3281         (Sized_pluginobj::do_should_include_member): New.
3282         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3283         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3284         return the blocker.
3285         (Read_symbols::do_whole_lib_group): New.
3286         (Read_symbols::do_lib_group): New.
3287         (Read_symbols::do_read_symbols): Handle lib groups.
3288         (Read_symbols::get_name): Handle lib groups.
3289         * readsyms.h (Read_symbols): Add an archive member pointer.
3290         (Read_symbols::do_whole_lib_group): New.
3291         (Read_symbols::do_lib_group): New.
3292         (Read_symbols::member_): New.
3293         * script.cc (read_input_script): Update call to queue_soon.
3294
3295 2010-03-19  Doug Kwan  <dougkwan@google.com>
3296
3297         * arm.cc (Stub_table::Stub_table): Initialize new data members
3298         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3299         (Stub_table::add_reloc_stub): Assign stub offset and update
3300         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3301         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3302         New data members.
3303         (Stub_table::update_data_size_and_addralign): Use
3304         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3305         instead of going over all reloc stubs.
3306         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3307         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3308         Stringpool_template::offset_ to size of Stringpool_char.
3309         (Stringpool_template::new_key_offset): Remove code to initialize
3310         Stringpool_template::offset_.
3311         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3312         Stringpool_template::offset_ to zero.
3313
3314 2010-03-15  Doug Kwan  <dougkwan@google.com>
3315
3316         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3317         offset_.
3318         (Stringpool_template::new_key_offset): New method.
3319         (Stringpool_template::add_string): Assign offsets when adding new
3320         strings.
3321         (Stringpool_template::set_string_offsets): Do not set string offsets
3322         when not optimizing.
3323         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3324         member size_.
3325         (Chunked_vector::clear): Clear size_.
3326         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3327         (Chunked_vector::size): Return size_.
3328         (Chunked_vector::push_back): Use size_ to find insert position.
3329         (Chunked_vector::size_): New data member.
3330         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3331         (Stringpool_template::new_key_offset): New method declaration.
3332         (Stringpool_template::offset_): New data member.
3333
3334 2010-03-15   Rafael Espindola  <espindola@google.com>
3335
3336         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3337         Add_symbols' constructor.
3338         * readsyms.h (Add_symbols): Remove the input_group member.
3339
3340 2010-03-10  Ian Lance Taylor  <iant@google.com>
3341
3342         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3343         target to ask whether a reference to a symbol requires a stack
3344         split.
3345         * target.h (Target::is_call_to_non_split): New function.
3346         (Target::do_is_call_to_non_split): Declare virtual function.
3347         * target.cc: Include "symtab.h".
3348         (Target::do_is_call_to_non_split): New function.
3349         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3350
3351 2010-03-10  Cary Coutant  <ccoutant@google.com>
3352
3353         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3354         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3355         (File_read::open[2]): Add whole_file_view_ to list of views.
3356         (File_read::make_view): Remove test of whole_file_view_.
3357         (File_read::find_or_make_view): Create whole_file_view_ if
3358         necessary.
3359         (File_read::clear_views): Replace bool parameter with enum;
3360         adjust all callers.  Don't delete views with permanent data;
3361         do delete cached views and views from archives if
3362         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3363         if clearing the corresponding view.
3364         * fileread.h (File_read::Clear_views_mode): New enum.
3365         (File_read::View::is_permanent_view): New method.
3366         (File_read::clear_views): Replace bool parameter
3367         with enum; adjust all callers.
3368         * options.h (General_options): Change keep_files_mapped option;
3369         add map_whole_files.
3370         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3371         releasing the file.
3372         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3373         the file.
3374
3375 2010-03-10  David S. Miller  <davem@davemloft.net>
3376
3377         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3378
3379 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3380
3381         * icf.cc (get_section_contents): Add '@' marker after processing the
3382         merge reloc.
3383
3384 2010-03-08  Doug Kwan  <dougkwan@google.com>
3385
3386         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3387         due to a conversion warning.
3388         (Arm_relobj::update_output_local_symbol_count): Check for local
3389         symbol with unset output index.
3390
3391 2010-03-05  Ian Lance Taylor  <iant@google.com>
3392
3393         * options.h (class General_options): Add --spare-dynamic-tags.
3394         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3395         --spare-dynamic-tags.
3396
3397 2010-03-05  Ian Lance Taylor  <iant@google.com>
3398
3399         * incremental.cc: Include "libiberty.h".
3400
3401 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3402
3403         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3404         function, is_info_ member.
3405         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3406         (Versions::Versions): Update caller.
3407         (Versions::define_base_version): Likewise.
3408         (Versions::add_def): Likewise.
3409
3410 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3411
3412         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3413         (Scan::possible_function_pointer_reloc): New function.
3414         (Scan::local_reloc_may_be_function_pointer): Change to call
3415         possible_function_pointer_reloc.
3416         (Scan::global_reloc_may_be_function_pointer): Ditto.
3417         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3418         relocations in ".data.rel.ro._ZTV" section.
3419         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3420         * testsuite/icf_safe_so_test.cc: Ditto.
3421         * testsuite/icf_safe_test.cc: Ditto.
3422         * testsuite/icf_safe_test.sh: Ditto.
3423
3424 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3425             Ian Lance Taylor  <iant@google.com>
3426
3427         * target-reloc.h (relocate_section): Check the symbol table index
3428         for -1U before setting the local symbol index.
3429         (scan_relocatable_relocs): If copying the relocation, record that
3430         the local symbol is required.
3431         * object.h (Symbol_value::is_output_symtab_index_set): New
3432         function.
3433         (Symbol_value::may_be_discarded_from_output_symtab): New
3434         function.
3435         (Symbol_value::has_output_symtab_entry): New function.
3436         (Symbol_value::needs_output_symtab_entry): Remove.
3437         (Symbol_value::output_symtab_index): Make sure the symbol index is
3438         set.
3439         (Symbol_value::set_output_symtab_index): Make sure the symbol
3440         index is not set.  Make sure the new index is valid.
3441         (Symbol_value::set_must_have_output_symtab_entry): New function.
3442         (Symbol_value::has_output_dynsym_entry): New function.
3443         (Symbol_value::set_output_dynsym_index): Make sure the new index
3444         is valid.
3445         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3446         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3447         local symbol if permitted.
3448         (Sized_relobj::do_finalize_local_symbols): Call
3449         is_output_symtab_index_set rather than needs_output_symtab_entry.
3450         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3451         rather than needs_output_symtab_entry.  Call
3452         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3453         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3454         is_output_symtab_index_set rather than needs_output_symtab_entry.
3455         * testsuite/discard_locals_relocatable_test.c: New file.
3456         * testsuite/discard_locals_test.sh: Test -r.
3457         * testsuite/Makefile.am (check_DATA): Add
3458         discard_locals_relocatable_test1.syms,
3459         discard_local_relocatable_test2.syms.
3460         (MOSTLYCLEANFILES): Likewise.  Also add
3461         discard_locals_relocatable_test1.lout and
3462         discard_locals_relocatable_test2.out.
3463         (discard_locals_relocatable_test1.syms): New target.
3464         (discard_locals_relocatable_test.o): New target.
3465         (discard_locals_relocatable_test1.out): New target.
3466         (discard_locals_relocatable_test2.syms): New target.
3467         (discard_locals_relocatable_test2.out): New target.
3468         (various): Add missing ../ld-new dependencies.
3469         * testsuite/Makefile.in: Rebuild.
3470
3471 2010-03-03  Nick Clifton  <nickc@redhat.com>
3472
3473         * po/fi.po: New Finnish translation.
3474
3475 2010-03-01  Doug Kwan  <dougkwan@google.com>
3476
3477         * layout.cc (Layout::Layout): Force section types of .init_array*,
3478         .preinit_array* and .fini_array* sections.
3479         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3480         Fix check of return value of std::string::find.().
3481         (Output_section::Input_section_sort_compare::operator()): Remove
3482         comment about .init_array.
3483         (Output_section::Input_section_sort_init_fini_compare::operator()):
3484         New method.
3485         (Output_section::sort_attached_input_sections): Handle .init_array
3486         and .fini_array specially.
3487         * output.h (Output_section::Inut_section_sort_compare): Update
3488         comment.
3489         (Output_section::Input_section_sort_init_fini_compare): New struct.
3490
3491 2010-02-26  Doug Kwan  <dougkwan@google.com>
3492
3493         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3494         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3495         * testsuite/debug_msg.sh: Avoid matching source line number for
3496         use of global variable undef_int.
3497
3498 2010-02-26  Doug Kwan  <dougkwan@google.com>
3499
3500         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3501         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3502         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3503         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3504         * options.cc (General_options::General_options): Initialize member
3505         fix_v4bx_.
3506         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3507         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3508         and rm_no_fix_v4bx.stdout
3509         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3510         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3511         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3512         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3513         and arm_no_fix_v4bx.
3514         * Makefile.in: Regenerate.
3515         * testsuite/arm_fix_v4bx.s: New file.
3516         * testsuite/arm_fix_v4bx.sh: Ditto.
3517
3518 2010-02-24  Doug Kwan  <dougkwan@google.com>
3519
3520         * arm.cc (Target_arm::got_section): Make the .got section the first
3521         non RELRO section in the data segment.
3522         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3523         suffixes of section names.
3524
3525 2010-02-24  Doug Kwan  <dougkwan@google.com>
3526
3527         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3528         flags and attributes merging if an input file is a binary file.
3529         * fileread.cc (Input_file::open): Record format of original file.
3530         * fileread.h (Input_file::Format): New enum type.
3531         (Input_file::Input_file): Initialize data member format_.
3532         (Input_file::format): New method definition.
3533         (Input_file::format_):: New data member.
3534
3535 2010-02-24  Doug Kwan  <dougkwan@google.com>
3536
3537         * arm.cc (Arm_output_data_got): New class.
3538         (ARM_TCB_SIZE): New constant
3539         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3540         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3541         If user uses a script with a SECTIONS clause, issue only a warning
3542         for a misplaced EXIDX input section.  Otherwise, issue an error.
3543         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3544         garbage collection.
3545         (Target_arm::got_mode_index_entry): Handle static linking.
3546         (Target_arm::Scan::local): Ditto.
3547         (Target_arm::Scan::global): Ditto.
3548         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3549         all incorrectly implemented relocations.
3550         (Target_arm::fix_exidx_coverage): Pass layout to
3551         Arm_output_section::fix_exidx_coverage.
3552         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3553         from ".ARM.exidx." and ".ARM.extab.".
3554
3555 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3556
3557         * arm.cc (Target_arm::do_finalize_sections): Create attribute
3558         section if it does not already exist.
3559         * attributes.cc (Attributes_section_data::Attributes_section_data):
3560         Don't crash if size is zero.
3561
3562 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3563             Ian Lance Taylor  <iant@google.com>
3564
3565         * gold.cc (queue_middle_tasks): If no input files were opened,
3566         exit.
3567         * workqueue.h (Task_function::Task_function): Assert that there is
3568         a blocker.
3569
3570 2010-02-22  Doug Kwan  <dougkwan@google.com>
3571
3572         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3573         * icf.cc (get_section_contents): Cast snprintf arguments to long long
3574         types to avoid warnings due to different uint64_t implementations
3575         on different hosts.
3576
3577 2010-02-21  Doug Kwan  <dougkwan@google.com>
3578
3579         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3580         handling of the maximum backward branch offset.
3581         (Arm_relocate_functions::thumb_branch_common): Ditto.
3582         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3583         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3584         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3585         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3586         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3587         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3588         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3589         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3590         thumb_bl_out_of_range thumb_bl_out_of_range.o,
3591         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3592         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3593         thumb2_bl_out_of_range.o): New rules.
3594         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3595         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3596         thumb2_bl_out_of_range
3597         * testsuite/Makefile.in: Regenerate.
3598         * testsuite/arm_bl_in_range.s: New file.
3599         * testsuite/arm_bl_out_of_range.s: Ditto.
3600         * testsuite/arm_branch_in_range.sh: Ditto.
3601         * testsuite/arm_branch_range.t: Ditto.
3602         * testsuite/thumb2_branch_range.t: Ditto.
3603         * testsuite/thumb_bl_in_range.s: Ditto.
3604         * testsuite/thumb_bl_out_of_range.s: Ditto.
3605         * testsuite/thumb_branch_range.t: Ditto.
3606
3607 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
3608
3609         * gc.h (gc_process_relocs): Change vectors to point to the new list.
3610         Add reloc offset information.
3611         * icf.cc (get_section_contents): Change iterators to point to the new
3612         vectors. Add reloc offset information to the contents.
3613         * icf.h (Icf::Sections_reachable_info): New typedef.
3614         (Icf::Sections_reachable_list): New typedef.
3615         (Icf::Offset_info): New typedef.
3616         (Icf::Reloc_info): New struct typedef.
3617         (Icf::Reloc_info_list): New typedef.
3618         (Icf::symbol_reloc_list): Delete method.
3619         (Icf::addend_reloc_list): Delete method.
3620         (Icf::section_reloc_list): Delete method.
3621         (Icf::reloc_info_list): New method.
3622         (Icf::reloc_info_list_): New member.
3623
3624 2010-02-19  Doug Kwan  <dougkwan@google.com>
3625
3626         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3627         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3628         * arm.cc (Arm_relocation_functions): New forward declaration.
3629         (Target_arm::Target_arm): Initialize new data members
3630         got_mod_index_offset_ and tls_base_symbol_defined_.
3631         (Target_arm::Relocate::relocate_tls): New method.
3632         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3633          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3634         New methods.
3635         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3636         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3637         (Target_arm::got_mod_index_offset_,
3638         Target_arm::tls_base_symbol_defined_): New data members.
3639         (Target_arm::Scan::local, Target::Scan::global,
3640         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3641         relocations.
3642
3643 2010-02-18  Doug Kwan  <dougkwan@google.com>
3644
3645         * arm.cc (Arm_relobj::find_linked_text_section): New method.
3646         (Arm_relobj::make_exidx_input_section): Pass section index of linked
3647         text section as a parameter becuase some broken tools may not set
3648         the link in section header.
3649         (Target_arm::has_got_section): New method.
3650         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3651         without any mapping symbol as data only.  Remove warning.
3652         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3653         link in its section header, try to discover the link by inspecting the
3654         REL31 relocation at the beginning of the section.
3655         (Target_arm::Scan::check_non_pic): Report name of offending relocation
3656         in error message.
3657         (Target_arm::Scan::global): Treat any reference to the symbol
3658         _GLOBAL_OFFSET_TABLE_ as a GOT access.
3659
3660 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
3661
3662         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3663         (Scan::global_reloc_may_be_function_pointer): New function.
3664         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3665         (Scan::global_reloc_may_be_function_pointer): New function.
3666         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3667         (Scan::global_reloc_may_be_function_pointer): New function.
3668         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3669         (Scan::global_reloc_may_be_function_pointer): New function.
3670         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3671         (Scan::global_reloc_may_be_function_pointer): New function.
3672         (Scan::possible_function_pointer_reloc): New function.
3673         (Target_x86_64::can_check_for_function_pointers): New function.
3674         * gc.h (gc_process_relocs): Scan relocation types to determine if
3675         function pointers were taken for targets that support it.
3676         * icf.cc (Icf::find_identical_sections): Include functions for
3677         folding in safe ICF whose pointer is not taken.
3678         * icf.h (Secn_fptr_taken_set): New typedef.
3679         (fptr_section_id_): New member.
3680         (section_has_function_pointers): New function.
3681         (set_section_has_function_pointers): New function.
3682         (check_section_for_function_pointers): New function.
3683         * options.h: Fix comment for safe ICF option.
3684         * target.h (can_check_for_function_pointers): New function.
3685         * testsuite/Makefile.am: Add icf_safe_so_test test case.
3686         Modify icf_safe_test for X86-64.
3687         * testsuite/Makefile.in: Regenerate.
3688         * testsuite/icf_safe_so_test.cc: New file.
3689         * testsuite/icf_safe_so_test.sh: New file.
3690         * testsuite/icf_safe_test.cc (kept_func_3): New function.
3691         (main): Change to take pointer to function kept_func_3.
3692         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3693         folding is done correctly for X86-64.
3694
3695 2010-02-12  David S. Miller  <davem@davemloft.net>
3696
3697         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3698         is_symbolless parameter.
3699         (Output_reloc<SHT_REL>::is_symbolless): New.
3700         (Output_reloc<SHT_REL>::is_symbolless_): New.
3701         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3702         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3703         (Output_reloc<SHT_RELA>::is_symbolless): New.
3704         (Output_data_reloc::add_global): Handle is_symbolless.
3705         (Output_data_reloc::add_global_relative): Likewise.
3706         (Output_data_reloc::add_local): Likewise.
3707         (Output_data_reloc::add_local_relative): Likewise.
3708         (Output_data_reloc::add_symbolless_global_addend): New.
3709         (Output_data_reloc::add_symbolless_local_addend): New.
3710         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3711         is_symbolless.
3712         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3713         instead of ->is_relative_
3714         (Output_reloc::write): Likewise.
3715         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3716         (Output_reloc::write_rel): Simplify.
3717
3718         * sparc.cc (Target_sparc::Scan::local): Use
3719         ->add_symbolless_local_addend as needed.
3720         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3721         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
3722         based upon relocation offset.
3723
3724 2010-02-11  Doug Kwan  <dougkwan@google.com>
3725
3726         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3727         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
3728         beginning of function.
3729         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3730         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
3731         parameter is_32bit in calls to should_apply_static_reloc.
3732         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3733         (check_DATA): Add arm_abs_global.stdout.
3734         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3735         arm_abs_global.stdout): New rules.
3736         (MOSTLLYCLEANFILES): Add arm_abs_global
3737         * Makefile.in: Regenerate.
3738         * testsuite/arm_abs_global.s: New file.
3739         * testsuite/arm_abs_global.sh: Ditto.
3740         * testsuite/arm_abs_lib.s: Ditto.
3741
3742 2010-02-11  Ian Lance Taylor  <iant@google.com>
3743
3744         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3745         Read_relocs task.
3746         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
3747         Allocate_commons_task first.
3748         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3749         task, rather than symtab_lock_.
3750         (Gc_process_relocs::~Gc_process_relocs): New function.
3751         (Gc_process_relocs::is_runnable): Check this_blocker_.
3752         (Gc_process_relocs::locks): Use next_blocker_ rather than
3753         blocker_.
3754         (Scan_relocs::~Scan_relocs): New function.
3755         (Scan_relocs::is_runnable): Check this_blocker_ rather than
3756         symtab_lock_.
3757         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
3758         next_blocker_.
3759         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3760         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
3761         constructor accordingly.
3762         (class Gc_process_relocs): Likewise.
3763         (class Scan_relocs): Likewise.
3764         * common.h (class Allocate_commons_task): Remove symtab_lock_
3765         field, and corresponding constructor parameter.
3766         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3767         symtab_lock_.
3768         (Allocate_commons_task::locks): Likewise.
3769
3770 2010-02-11  Ian Lance Taylor  <iant@google.com>
3771
3772         * gold-threads.h (class Once): Define.
3773         (class Initialize_lock): Rewrite as child of Once.
3774         * gold-threads.cc (class Once_initialize): Define.
3775         (once_pointer_control): New static variable.
3776         (once_pointer, once_arg): New static variables.
3777         (c_run_once): New static function.
3778         (Once::Once, Once::run_once, Once::internal_run): New functions.
3779         (class Initialize_lock_once): Remove.
3780         (initialize_lock_control): Remove.
3781         (initialize_lock_pointer): Remove.
3782         (initialize_lock_once): Remove.
3783         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3784         (Initialize_lock::initialize): Rewrite.
3785         (Initialize_lock::do_run_once): New function.
3786         * archive.cc (Archive::interpret_header): Only clear name if it is
3787         not already empty.
3788         * fileread.cc: Include "gold-threads.h"
3789         (file_counts_lock): New static variable.
3790         (file_counts_initialize_lock): Likewise.
3791         (File_read::release): Only increment counts when using --stats.
3792         Use a lock around the increment.
3793         * parameters.cc (class Set_parameters_target_once): Define.
3794         (set_parameters_target_once): New static variable.
3795         (Parameters::Parameters): Move here from parameters.h.
3796         (Parameters::set_target): Rewrite.
3797         (Parameters::set_target_once): New function.
3798         (Parameters::clear_target): Move here and rewrite.
3799         * parameters.h (class Parameters): Update declarations.  Add
3800         set_parameters_target_once_ field.
3801         (Parameters::Parameters): Move to parameters.cc.
3802         (Parameters::clear_target): Likewise.
3803         * readsyms.cc (Read_symbols::do_group): Create a Start_group
3804         task.
3805         (Start_group::~Start_group): New function.
3806         (Start_group::is_runnable): New function.
3807         (Start_group::locks, Start_group::run): New functions.
3808         (Finish_group::run): Change saw_undefined to size_t.
3809         * readsyms.h (class Start_group): Define.
3810         (class Finish_group): Change saw_undefined_ field to size_t.
3811         (Finish_group::Finish_group): Remove saw_undefined and
3812         this_blocker parameters.  Change all callers.
3813         (Finish_group::set_saw_undefined): New function.
3814         (Finish_group::set_blocker): New function.
3815         * symtab.h (class Symbol_table): Change saw_undefined to return
3816         size_t.  Change saw_undefined_ field to size_t.
3817         * target-select.cc (Set_target_once::do_run_once): New function.
3818         (Target_selector::Target_selector): Initialize set_target_once_
3819         field.  Don't initialize lock_ and initialize_lock_ fields.
3820         (Target_selector::instantiate_target): Rewrite.
3821         (Target_selector::set_target): New function.
3822         * target-select.h (class Set_target_once): Define.
3823         (class Target_selector): Update declarations.  Make
3824         Set_target_once a friend.  Remove lock_ and initialize_lock_
3825         fields.  Add set_target_once_ field.
3826
3827 2010-02-10  Ian Lance Taylor  <iant@google.com>
3828
3829         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3830         queueing any tasks.
3831         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
3832         (queue_middle_tasks): Add all blockers before queueing any tasks.
3833         (queue_final_tasks): Likewise.
3834         * token.h (Task_token::add_blockers): New function.
3835         * object.h (Input_objects::number_of_relobjs): New function.
3836
3837 2010-02-10  Ian Lance Taylor  <iant@google.com>
3838
3839         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3840         shared, not if not position independent.
3841         * x86_64.cc (Relocate::relocate_tls): Likewise.
3842         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3843         (tls_pie_pic_test): New target.
3844         * testsuite/Makefile.in: Rebuild.
3845
3846         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3847         (tls_test_main_pie.o, tls_test_pie.o): New targets.
3848         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3849         * testsuite/Makefile.in: Rebuild.
3850
3851 2010-02-09  David S. Miller  <davem@davemloft.net>
3852
3853         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3854         R_SPARC_RELATIVE using ->add_local_relative().
3855         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3856
3857         * output.h (Output_data_dynamic::add_section_size): New method
3858         that takes two Output_data objects.
3859         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3860         entry param.  Handle it in initializers.
3861         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3862         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3863         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3864         arg.
3865         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3866         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3867         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3868         for dynrel_includes_plt.
3869         * i386.cc (Target_i386::do_finalize_sections): Likewise.
3870         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3871         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3872         before .rela.plt
3873         (Target_sparc::do_finalize_sections): Update to pass true for
3874         dynrel_includes_plt.
3875         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3876         output before .rela.plt
3877         (Target_powerpc::do_finalize_sections): Update to pass true for
3878         dynrel_includes_plt when 32-bit.
3879
3880 2010-02-08  Doug Kwan  <dougkwan@google.com>
3881
3882         * arm.cc (Arm_relobj::simple_input_section_output_address): New
3883         method.
3884         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3885         Arm_relobj::scan_section_for_cortex_a8_stubs,
3886         Arm_relobj::do_relocation_section): Instead of calling
3887         Output_section::output_address, use faster
3888         Arm_relobj::simple_input_section_output_address.
3889
3890 2010-02-08  David S. Miller  <davem@davemloft.net>
3891
3892         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3893         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3894         relocation helper function.
3895
3896         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3897         just like R_SPARC_GOT{10,13,22}.
3898         (Target_sparc::Scan::local): Likewise.
3899         (Target_sparc::Relocate:relocate): Likewise.
3900
3901 2010-02-06  Ian Lance Taylor  <iant@google.com>
3902
3903         * configure.ac: Rewrite targetobjs duplicate removal code to use
3904         only shell constructs.
3905         * configure: Rebuild.
3906
3907 2010-02-05  Doug Kwan  <dougkwan@google.com>
3908
3909         PR 11247
3910         * arm.cc (Arm_relobj::section_is_scannable): New method.
3911         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3912         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3913
3914 2010-02-04  Doug Kwan  <dougkwan@google.com>
3915
3916         PR 11247
3917         * arm-reloc-property.cc (cstdio): Include.
3918         * configure.ac (targetobjs): Remove duplicates.
3919         * configure: Regenerate.
3920         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3921         big and little endian version for a given address size.
3922
3923 2010-02-03  Doug Kwan  <dougkwan@google.com>
3924
3925         * arm-reloc-property.cc
3926         (Arm_reloc_property_table::reloc_name_in_error_message): New method
3927         definition.
3928         * arm-reloc-property.h
3929         (Arm_reloc_property_table::get_implemented_static_reloc_property):
3930         New method definition.
3931         (Arm_reloc_property_table::reloc_name_in_error_message): New method
3932         declaration.
3933         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3934         overflow to N.
3935         (GOT_PREL): Change implemented to Y.
3936         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3937         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3938         (Arm_relocate_functions::movw_abs_nc): Remove method.
3939         (Arm_relocate_functions::movt_abs): Ditto.
3940         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3941         (Arm_relocate_functions::thm_movt_abs): Ditto.
3942         (Arm_relocate_functions::movw_rel_nc): Ditto.
3943         (Arm_relocate_functions::movw_rel): Ditto.
3944         (Arm_relocate_functions::movt_rel): Ditto.
3945         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3946         (Arm_relocate_functions:thm_movw_rel): Ditto.
3947         (Arm_relocate_functions:thm_movt_rel): Ditto.
3948         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3949         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3950         New method definitions.
3951         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3952         (Arm_relocation_functions::arm_grp_ldr): Ditto.
3953         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3954         (Arm_relocation_functions::arm_grp_ldc): Ditto.
3955         (Target_arm::Relocate::relocate): Check for non-static or
3956         unimplemented relocation code and exit early.  Change calls to
3957         Target_arm::reloc_uses_thumb_bit and
3958         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3959         instead.  Refactor code to handle similar relocations to increase
3960         code sharing.  Remove check for unsupported relocation code in switch
3961         statement.
3962         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3963         relocation property table to find out size.  Change error message to
3964         print out the name of a relocation code instead of the numeric value.
3965         (Target_arm::scan_reloc_for_stub): Use relocation property table
3966         instead of calling Target_arm::reloc_uses_thumb_bit().
3967
3968 2010-02-02  Doug Kwan  <dougkwan@google.com>
3969
3970         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3971         types of relaxed input section.
3972
3973 2010-02-02  Doug Kwan  <dougkwan@google.com>
3974
3975         * Makefile.am (HFILES): Add arm-reloc-property.h.
3976         (DEFFILES): New.
3977         (TARGETSOURCES): Add arm-reloc-property.cc
3978         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3979         (libgold_a_SOURCES): $(DEFFILES)
3980         * Makefile.in: Regenerate.
3981         * arm-reloc-property.cc: New file.
3982         * arm-reloc-property.h: New file.
3983         * arm-reloc.def: New file.
3984         * arm.cc: Update comments.
3985         (arm-reloc-property.h): New included header.
3986         (arm_reloc_property_table): New global variable.
3987         (Target_arm::do_select_as_default_target): New method definition.
3988         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3989         arm-reloc-property to targ_extra_obj.
3990         * parameters.cc (set_parameters_target): Call
3991         Target::select_as_default_target().
3992         * target.h (Target::select_as_default_target): New method definition.
3993         (Target::do_select_as_default_target): Same.
3994
3995 2010-02-01  Doug Kwan  <dougkwan@google.com>
3996
3997         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3998         first_output_text_section_.
3999         (Arm_exidx_fixup::first_output_text_section): New method definition.
4000         (Arm_exidx_fixup::first_output_text_section_): New data member.
4001         (Arm_exidx_fixup::process_exidx_section): Record the first text
4002         output section seen.
4003         (Arm_output_section::fix_exidx_coverage): Set correct linked section
4004         and entsize in output section header.
4005
4006 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4007
4008         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4009         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4010         (Arm_relocate_functions::thm_alu11): New Method.
4011         (Arm_relocate_functions::thm_pc8): New Method.
4012         (Arm_relocate_functions::thm_pc12): New Method.
4013         (Target_arm::Scan::local): Handle the relocations.
4014         (Target_arm::Scan::global): Likewise.
4015         (Target_arm::Relocate::relocate): Likewise.
4016         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4017
4018 2010-01-29  Doug Kwan  <dougkwan@google.com>
4019
4020         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4021         of relocation types as ld.
4022
4023 2010-01-29  Doug Kwan  <dougkwan@google.com>
4024
4025         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4026         to public.
4027         (Arm_relocate_functions::thumb_branch_common): Ditto.
4028         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4029         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4030         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4031         Arm_relocate_functions::jump24): Remove.
4032         (Target_arm::Relocate::relocate): Adjust code to call
4033         Arm_relocation_functions::arm_branch_common and
4034         Arm_relocation_functions::thumb_branch_common instead of their removed
4035         wrappers.  Merge switch-cases together to reduce source code size.
4036
4037 2010-01-29  Doug Kwan  <dougkwan@google.com>
4038
4039         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4040         output_local_symbol_count_needs_update_.
4041         (Arm_relobj::output_local_symbol_count_needs_update,
4042          Arm_relobj::set_output_local_symbol_count_needs_update,
4043          Arm_relobj::update_output_local_symbol_count): New methods.
4044         (Arm_relobj::output_local_symbol_count_needs_update_): New data
4045         member.
4046         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4047         of pointed function as in a R_ARM_PREL31 relocation.
4048         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4049         for output local symbol count updating.
4050         (Target_arm::do_relax): Update output local symbol counts in objects
4051         if necessary.
4052         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4053
4054 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4055
4056         * arm.cc: Added support for the ARM relocations:
4057         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4058         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4059         (Arm_relocate_functions::movw_rel_nc): Renamed (was
4060         movw_prel_nc).
4061         (Arm_relocate_functions::movw_rel): New method.
4062         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4063         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4064         thm_movw_prel_nc).
4065         (Arm_relocate_functions::thm_movw_rel): New method.
4066         (Arm_relocate_functions::thm_movt_rel): Renamed (was
4067         thm_movt_prel).
4068         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4069         relocations.
4070         (Target_arm::Scan::global): Likewise.
4071         (Target_arm::Relocate::relocate): Likewise.
4072         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4073         Likewise.
4074
4075 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4076
4077         * arm.cc: Added support for ARM group relocations.
4078         (Target_arm::reloc_needs_sym_origin): New method.
4079         (Arm_relocate_functions::calc_grp_kn): New method.
4080         (Arm_relocate_functions::calc_grp_residual): New method.
4081         (Arm_relocate_functions::calc_grp_gn): New method.
4082         (Arm_relocate_functions::arm_grp_alu): New Method.
4083         (Arm_relocate_functions::arm_grp_ldr): New Method.
4084         (Arm_relocate_functions::arm_grp_ldrs): New Method.
4085         (Arm_relocate_functions::arm_grp_ldc): New Method.
4086         (Target_arm::Scan::local): Handle the ARM group relocations.
4087         (Target_arm::Scan::global): Likewise.
4088         (Target_arm::Relocate::relocate): Likewise.
4089         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4090         Likewise.
4091
4092 2010-01-26  Doug Kwan  <dougkwan@google.com>
4093
4094         * arm.cc (set): Include.
4095         (class Arm_exidx_fixup): Change type of last_input_section_ to const
4096         pointer type.
4097         (Arm_output_section::Text_section_list): New type.
4098         (Arm_output_section::append_text_sections_to_list): New method.
4099         (Arm_output_section::fix_exidx_coverage): Ditto.
4100         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4101         (Arm_relobj::convert_input_section_to_relaxed_section): Use
4102         Relobj::set_section_offset() instead of
4103         Sized_relobj::invalidate_section_offset().
4104         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4105         parameter for section headers. Ignore relocation sections for
4106         unallocated sections and EXIDX sections.
4107         (Target_arm::fix_exidx_coverage): New method.
4108         (Target_arm::output_section_address_less_than): New type.
4109         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4110         linked text section instead of the EXIDX section.
4111         (Arm_output_section::create_stub_group): Add an assertion to check
4112         that this is not an EXIDX output section.
4113         (Arm_output_section::append_text_sections_to_list): New method.
4114         (Arm_output_section::fix_exidx_coverage): Ditto.
4115         (Arm_relobj::scan_sections_for_stubs): Adjust call to
4116         Arm_relobj::section_needs_reloc_stub_scanning.
4117         (Target_arm::do_relax): Fix EXIDX output section coverage in the
4118         first pass.
4119         (Target_arm::fix_exidx_coverage): New method.
4120         * object.h (Relobj::set_output_section): New method.
4121         (Sized_relobj::invalidate_section_offset): Remove method.
4122         (Sized_relobj::do_invalidate_section_offset): Remove method.
4123         (Sized_relobj::do_set_section_offset): Handle offset value -1.
4124
4125 2010-01-25  Doug Kwan  <dougkwan@google.com>
4126
4127         * arm.cc (Arm_exidx_merged_section::do_output_offset):
4128         Fix warning due to signed and unsigned comparison on a 32-bit host.
4129
4130 2010-01-22  Doug Kwan  <dougkwan@google.com>
4131
4132         * arm.cc (Target_arm::do_relax): Record an output section for section
4133         offset adjustment it contains any stub table that has changed.
4134         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4135         offsets in an output section if necessary.
4136         * output.cc (Output_section::Output_section): Initialize
4137         section_offsets_need_adjustments_.
4138         (Output_section::add_input_section_for_script): Renamed to
4139         Output_section::add_simple_input_section.
4140         (Output_section::save_states): Add a comment.
4141         (Output_section::discard_states): New method defintion.
4142         (Output_section::adjust_section_offsets): Same.
4143         * output.h (Output_section::add_input_section_for_script): Renamed to
4144         Output_section::add_simple_input_section.
4145         (Output_section::discard_states): New method declaration.
4146         (Output_section::adjust_section_offsets): Same.
4147         (Output_section::section_offsets_need_adjustment,
4148         Output_section::set_section_offsets_need_adjustment): New method
4149         definitions.
4150         (Output_section::section_offsets_need_adjustment_): New data member.
4151         * script-sections.cc
4152         (Output_section_element_input::set_section_address): Adjust code for
4153         renaming of Output_section::add_input_section_for_script.
4154         (Orphan_output_section::set_section_address): Same.
4155
4156 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4157
4158         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4159         Fix_v4bx enum values .
4160         * gold/options.h (General_options): New option definitions.
4161         (General_options::fix_v4bx): New method.
4162         (General_options::Fix_v4bx): New enum.
4163         * gold/options.cc (General_options::parse_fix_v4bx): New method.
4164         (General_options::parse_fix_v4bx_interworking): New method.
4165
4166 2010-01-22  Doug Kwan  <dougkwan@google.com>
4167
4168         * arm.cc (Arm_exidx_fixup): New class.
4169
4170 2010-01-21  Doug Kwan  <dougkwan@google.com>
4171
4172         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4173         classes.
4174         (Arm_exidx_section_offset_map): New type.
4175
4176 2010-01-21  Doug Kwan  <dougkwan@google.com>
4177
4178         * arm.cc (Arm_exidx_input_section): New class.
4179         (Arm_relobj::exidx_input_section_by_link,
4180         Arm_relobj::exidx_input_section_by_shndx,
4181         Arm_relobj::make_exidx_input_section): New methods.
4182         (read_arm_attributes_section): Remove.
4183         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4184         information about them.
4185         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4186         to here.
4187
4188 2010-01-20  Doug Kwan  <dougkwan@google.com>
4189
4190         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4191         Input_section_specifier to Section_id.
4192         (Target_arm::new_arm_input_section: Adjust code for change of key
4193         type.
4194         (Target_arm::find_arm_input_section): Ditto.
4195         * gc.h (object.h): Include for Section_id nand Section_id_hash.
4196         (Section_id): Remove.
4197         (Garbage_collection::Section_id_hash): Remove.
4198         * icf.h (object.h): Include for Section_id nand Section_id_hash.
4199         (Section_id): Remove.
4200         (Icf::Section_id_hash): Remove.
4201         * object.h (Section_id, Const_section_id, Section_id_hash,
4202         Const_section_id_hash): New type definitions.
4203         * output.cc (Output_section::add_relaxed_input_section): Change to
4204         use Const_section_id instead of Input_section_specifier as key type.
4205         (Output_section::add_merge_input_section): Ditto.
4206         (Output_section::build_relaxation_map): Change to use Section_id
4207         instead of Input_section_specifier as key type.
4208         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4209         Ditto.
4210         (Output_section::convert_input_sections_to_relaxed_sections): Change
4211         to use Const_section_id instead of Input_section_specifier as key type.
4212         (Output_section::find_merge_section): Ditto.
4213         (Output_section::find_relaxed_input_section): Ditto.
4214         * output.h (Input_section_specifier): Remove class.
4215         (Output_section::Output_section_data_by_input_section_map): Change
4216         key type to Const_section_id.
4217         (Output_section::Output_relaxed_input_section_by_input_section_map):
4218         Ditto.
4219         (Output_section::Relaxation_map): Change key type to Section_id.
4220
4221 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4222
4223         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4224         (class Arm_v4bx_stub): New class.
4225         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4226         (Stub_factory::make_arm_v4bx_stub): New method.
4227         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4228         (Stub_table::empty): Handle v4bx stubs.
4229         (Stub_table::add_arm_v4bx_stub): New method.
4230         (Stub_table::find_arm_v4bx_stub): New method.
4231         (Arm_relocate_functions::v4bx): New method.
4232         (Target_arm::fix_v4bx): New method.
4233         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4234         (Stub_table::relocate_stubs): Likewise.
4235         (Stub_table::do_write): Likewise.
4236         (Stub_table::update_data_size_and_addralign): Likewise.
4237         (Stub_table::finalize_stubs):  Likewise.
4238         (Target_arm::Scan::local): Likewise.
4239         (Target_arm::Scan::global): Likewise.
4240         (Target_arm::do_finalize_sections): Likewise.
4241         (Target_arm::Relocate::relocate): Likewise.
4242         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4243         Likewise.
4244         (Target_arm::scan_reloc_for_stub): Likewise.
4245         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4246
4247 2010-01-19  Ian Lance Taylor  <iant@google.com>
4248
4249         * output.cc (Output_section_headers::do_sized_write): Write large
4250         segment count to sh_info field.
4251         (Output_file_header::do_sized_write): For large segment count,
4252         write PN_XNUM to e_phnum field.
4253
4254 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4255
4256         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4257         (Arm_relocate_functions::thm_jump8): New function.
4258         (Arm_relocate_functions::thm_jump11): New function.
4259         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4260         R_ARM_THM_JUMP11.
4261         (Target_arm::Scan::global): Likewise.
4262         (Target_arm::Relocate::relocate): Likewise.
4263         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4264         Likewise.
4265
4266 2010-01-14  Doug Kwan  <dougkwan@google.com>
4267
4268         * arm.cc (map, utility): Include headers.
4269         (Target_arm::apply_cortex_a8_workaround): New method.
4270         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4271         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4272         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4273         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4274         the --[no-]fix-cortex-a8 command line options.
4275         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4276         (Target_arm::relocate_stub): Use addend in instruction template.
4277         * options.h (DEFINE_bool): Set the user-set flag.
4278         (General_options): Add --[no-]-fix-cortex options.
4279         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4280         : Update fast look-up map after conversion.
4281
4282 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4283
4284         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4285         in the first pass of do_layout.
4286
4287 2010-01-13  Doug Kwan  <dougkwan@google.com>
4288
4289         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4290         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4291         apparent compiler problem of not folding static constant integral
4292         data members of elfcpp::Elf_sizes<32>.
4293
4294 2010-01-13  Doug Kwan  <dougkwan@google.com>
4295
4296         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4297         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4298         Arm_relobj::scan_section_for_cortex_a8_erratum,
4299         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4300         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4301         sections to scan for relocation stubs into a new method
4302         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4303         relocation and Cortex-A8 stub scanning.
4304         (Target_arm::do_relax): Force stubs to be after stubbed sections
4305         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4306         the beginning of a new relaxation pass.  Update a comment.
4307         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4308
4309 2010-01-12  Ian Lance Taylor  <iant@google.com>
4310
4311         * target-reloc.h (visibility_error): New inline function.
4312         (relocate_section): Call visibility_error.
4313         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4314         (MOSTLYCLEANFILES): Likewise.
4315         (protected_4_pic.o, protected_3.err): New targets.
4316         * testsuite/protected_4.cc: New file.
4317
4318 2010-01-12  Doug Kwan  <dougkwan@google.com>
4319
4320         * arm.cc (Cortex_a8_reloc): New class.
4321         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4322         and cortex_a8_relocs_info_.
4323         (Target_arm::fix_cortex_a8): New method definition.
4324         (Target_arm::Cortex_a8_relocs_info): New type.
4325         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4326         New data member declarations.
4327         (Target_arm::scan_reloc_for_stub): Record information about
4328         relocations for THUMB branches that might be exempted from the
4329         Cortex-A8 workaround.
4330         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4331         at the beginning of a relaxation pass.
4332
4333 2010-01-12  Doug Kwan  <dougkwan@google.com>
4334
4335         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4336         (Arm_relobj::Mapping_symbol_position,
4337          Arm_reloj::Mapping_symbol_position_less,
4338          Arm_relobj::Mapping_symbols_info): New types.
4339         (Target_arm::is_mapping_symbol_name): New method definition.
4340         (Arm_relobj::do_count_local_symbols): Save information about mapping
4341         symbols.
4342
4343 2010-01-11  Doug Kwan  <dougkwan@google.com>
4344
4345         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4346         Arm_relocate_functions::thumb32_branch_upper,
4347         Arm_relocate_functions::thumb32_branch_lower,
4348         Arm_relocate_functions::thumb32_cond_branch_offset,
4349         Arm_relocate_functions::thumb32_cond_branch_upper,
4350         Arm_relocate_functions::thumb32_cond_branch_lower,
4351         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4352         branch offset encoding.
4353         (Arm_relocate_functions::thumb_branch_common): Use new branch
4354         offset encoding methods to avoid code duplication.
4355         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4356         (Stub_addend_reader::operator()): Use new branch encoding method
4357         to avoid code duplication.
4358
4359 2010-01-11  Doug Kwan  <dougkwan@google.com>
4360
4361         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4362         (Target_arm::do_finalize_sections): Define special EXIDX section
4363         symbols only if referenced.
4364         * gc.h (Garbage_collection::add_reference): New method.
4365         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4366         code duplication.
4367
4368 2010-01-11  Ian Lance Taylor  <iant@google.com>
4369
4370         * script.cc (Version_script_info::build_expression_list_lookup):
4371         Change complaing about duplicate wildcard match from error to
4372         warning.
4373
4374         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4375         of 2009-12-30.
4376         (Version_script_info::Version_script_info): Initialize globs_,
4377         default_version_, default_is_global_, and exact_.  Don't
4378         initialize globals_ or locals_.
4379         (Version_script_info::build_lookup_tables): Build local symbols
4380         first.
4381         (Version_script_info::unquote): New function.
4382         (Version_script_info::add_exact_match): New function.
4383         (Version_script_info::build_expression_list_lookup): Remove lookup
4384         parameter.  Add is_global parameter.  Change all callers.  Handle
4385         wildcard pattern specially.  Unquote pattern.  Call
4386         add_exact_match.
4387         (Version_script_info::get_name_to_match): New function.
4388         (Version_script_info::get_symbol_version): New function.
4389         (Version_script_info::get_symbol_version_helper): Remove.
4390         (Version_script_info::check_unmatched_names): Call unquote.
4391         * script.h (class Version_script_info): Change get_symbol_version
4392         to be non-inline and add is_global parameter; change all callers.
4393         Rewrite symbol_is_local.  Update declarations.  Define struct
4394         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4395         Remove globals_ and locals_ members.  Add exact_, globs_,
4396         default_version_, is_global_.
4397         (Version_script_info::Glob): Remove pattern, add expression and
4398         is_global.  Update constructor.  Change all callers.
4399         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4400         default version.
4401         (Versions::symbol_section_contents): If a symbol is undefined, or
4402         defined in a dynamic object, set the version index to
4403         VER_NDX_LOCAL.
4404         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4405         symbol_is_local.
4406         (Symbol_table::add_from_pluginobj): Likewise.
4407         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4408
4409 2010-01-11  Doug Kwan  <dougkwan@google.com>
4410
4411         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4412         (incremental_dump_LDADD): Add linking option for libintl.
4413         * Makefile.in: Regenerate.
4414
4415 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4416
4417         PR gold/11144
4418         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4419         instead of -Ds.
4420         * testsuite/Makefile.in: Regenerated.
4421
4422 2010-01-10  Doug Kwan  <dougkwan@google.com>
4423
4424         * options.h (DEFINE_var): Use parentheses around argument varname__
4425         in macro body to avoid any unintended subsequent substitutions.
4426
4427 2010-01-10  Ian Lance Taylor  <iant@google.com>
4428
4429         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4430         candidates before doing symbol resolution.
4431
4432         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4433         ODR candidates if only one is weak.
4434
4435 2010-01-08  Ian Lance Taylor  <iant@google.com>
4436
4437         * script.cc (Version_script_info::build_expression_list_lookup):
4438         Don't warn about ambiguous version, just record the ambiguity.
4439         (Version_script_info::get_symbol_version_helper): Give error if
4440         version is ambiguous.
4441
4442 2010-01-08  Doug Kwan  <dougkwan@google.com>
4443
4444         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4445           prev_data_size_ and prev_addralign_.  Remove initializer for
4446           deleted data member has_been_changed_.
4447           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4448           to determine if the table is empty.
4449           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4450           Remove.
4451           (Stub_table::add_reloc_stub): Define method in class definition
4452           instead of just declaring it there.
4453           (Stub_table::add_cortex_a8_stub): New method definition.
4454           (Stub_table::update_data_size_and_addralign): Ditto.
4455           (Stub_table::finalize_stubs): Ditto.
4456           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4457           (Stub_table::do_addralign_): Return address alignment in the
4458           (Stub_table::do_reset_address_and_file_offset): Define method in
4459           class definition instead of declaring it there.  Set current data
4460           size to be the data size of the previous pass.
4461           (Stub_table::set_final_data_size): Use current data size as the
4462           final data size.
4463           (Stub_table::relocate_stub): Change parameter type of stub from
4464           Reloc_stub pointer to Stub pointer.
4465           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4466           (Stub_table::Cortex_a8_stub_list): New typedef.
4467           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4468            Stub_table::prev_addralign_): New data member.
4469           (Arm_relobj::Arm_relobj): Initialize data member
4470           section_has_cortex_a8_workaround_.
4471           (Arm_relobj::section_has_cortex_a8_workaround,
4472            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4473            definitions.
4474           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4475           declarations.
4476           (Target_arm::relocate_stub): Change parameter type of stub from
4477           Reloc_stub pointer to Stub pointer.
4478           (Insn_template::size, Insn_template::alignment): Handle
4479           THUMB16_SPECIAL_TYPE.
4480           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4481            Stub_table::update_data_size_and_addralign,
4482            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4483           definitions.
4484           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4485           (Stub_table::do_write): Ditto.
4486           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4487
4488 2010-01-08  Ian Lance Taylor  <iant@google.com>
4489
4490         PR 11108
4491         * symtab.h (class Symbol): Remove fields is_target_special_ and
4492         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4493         (Symbol::is_defined_in_discarded_section): New function.
4494         (Symbol::set_is_defined_in_discarded_section): New function.
4495         (Symbol::has_plt_offset): Rewrite.
4496         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4497         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4498         Don't initialize is_target_special_ or has_plt_offset_.
4499         Initialize is_defined_in_discarded_section_.
4500         (Symbol_table::add_from_relobj): If appropriate, set
4501         is_defined_in_discarded_section.
4502         * resolve.cc (Symbol::override_base_with_special): Don't test
4503         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4504         * target-reloc.h (relocate_section): Do special handling for
4505         symbols defined in discarded sections for global symbols as well
4506         as local symbols.
4507
4508 2010-01-08  Ian Lance Taylor  <iant@google.com>
4509
4510         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4511         the SHT_SYMTAB case.
4512
4513 2010-01-08  Ian Lance Taylor  <iant@google.com>
4514
4515         * object.cc (Sized_relobj::do_layout): Don't get confused if
4516         layout_eh_frame returns NULL.
4517
4518 2010-01-08  Ian Lance Taylor  <iant@google.com>
4519
4520         PR 11084
4521         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4522         dynamic symbol table, use the normal symbol table.
4523         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4524         symbol table.
4525
4526 2010-01-08  Ian Lance Taylor  <iant@google.com>
4527
4528         PR 11072
4529         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4530         sections.
4531
4532 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4533
4534         * version.cc (print_version): Change to "Copyright 2010".
4535
4536 2010-01-08  Ian Lance Taylor  <iant@google.com>
4537
4538         PR 10287
4539         PR 11063
4540         * i386.cc (class Target_i386): Change return type of plt_section
4541         to be non-const.
4542         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4543         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4544         tls_desc_rel_ field.
4545         (Output_data_plt_i386::rel_tls_desc): New function.
4546         (Target_i386::rel_tls_desc_section): New function.
4547         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4548         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4549         R_386_TLS_DESC reloc in rel_tls_desc_section.
4550         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4551         Define struct Tlsdesc_info.
4552         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4553         (Target_x86_64::do_reloc_symbol_index): New function.
4554         (Target_x86_64::add_tlsdesc_info): New function.
4555         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4556         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4557         tlsdesc_rel_ field.
4558         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
4559         all callers.
4560         (Output_data_plt_x86_64::rela_tlsdesc): New function.
4561         (Target_x86_64::rela_tlsdesc_section): New function.
4562         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4563         handling.
4564         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4565         (Target_x86_64::do_reloc_addend): New function.
4566         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4567         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4568         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
4569         (Output_reloc::type): New function.
4570         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4571         (Output_reloc::is_target_specific): New function.
4572         (Output_reloc::target_arg): New function.
4573         (class Output_reloc) [SHT_RELA]: Add four new constructors for
4574         absolute relocs and target specific relocs.
4575         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4576         add_target_specific.
4577         (class Output_data_reloc) [SHT_RELA]: Likewise.
4578         * output.cc (Output_reloc::Output_reloc): Add four new versions
4579         for absolute relocs and target specific relocs.
4580         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4581         (Output_reloc::get_symbol_index): Likewise.
4582         (Output_reloc::local_section_offset): Check that local_sym_index_
4583         is not TARGET_CODE or 0.
4584         (Output_reloc::symbol_value): Likewise.
4585         (Output_reloc::write) [SHT_RELA]: Call target for target specific
4586         reloc.
4587         * target.h (class Target): Add reloc_symbol_index and reloc_addend
4588         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
4589         functions.
4590         * layout.cc (add_target_dynamic_tags): Use output section for
4591         DT_PLTRELSZ and DT_JMPREL.
4592
4593 2010-01-07  Ian Lance Taylor  <iant@google.com>
4594
4595         PR 11061
4596         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4597         function.
4598         (class Output_data_reloc_generic): Define.
4599         (class Output_data_reloc_base): Change base class to
4600         Output_data_reloc_generic.  Change add() method to call
4601         bump_relative_reloc_count for a relative reloc.  Remove
4602         sort_relocs_ field.
4603         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4604         to sort_relocs().
4605         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4606         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
4607         appropriate.
4608         * layout.h (class Layout): Update declaration.
4609
4610 2010-01-07  Ian Lance Taylor  <iant@google.com>
4611
4612         * output.h (class Output_data): Add const version of
4613         output_section and do_output_section.
4614         (class Output_section_data): Add const version of
4615         do_output_section.
4616         (class Output_section): Likewise.
4617         * layout.cc (Layout::add_target_dynamic_tags): New function.
4618         * layout.h (class Layout): Update declarations.
4619         * arm.cc (Target_arm::do_finalize_sections): Use
4620         add_target_dynamic_tags.
4621         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4622         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4623         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4624         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4625
4626 2010-01-07  Ian Lance Taylor  <iant@google.com>
4627
4628         PR 11042
4629         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4630         object as needed.
4631
4632 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
4633             Ian Lance Taylor  <iant@google.com>
4634
4635         PR 11019
4636         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4637         Xindex::read_symtab_xindex.
4638
4639 2010-01-07  Doug Kwan  <dougkwan@google.com>
4640
4641         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4642         (Insn_template::thumb16_bcond_insn): New method declaration.
4643         (Insn_template): Fix spelling.
4644         (Stub::thumb16_special): New method declaration.
4645         (Stub::do_write): Define virtual method which was previously pure
4646         virtual.
4647         (Stub::do_thumb16_special): New method declaration.
4648         (Stub::do_fixed_endian_write): New template member.
4649         (Reloc_stub::do_write): Remove.
4650         (Reloc_stub::do_fixed_endian_write): Remove.
4651         (Cortex_a8_stub): New class definition.
4652         (Stub_factory::make_cortex_a8_stub): New method definition.
4653         (Stub_factory::Stub_factory): Add missing static storage class
4654         qualifier for elf32_arm_stub_a8_veneer_blx.
4655
4656 2010-01-07  Ian Lance Taylor  <iant@google.com>
4657
4658         PR 10980
4659         * options.h (class General_options): Add --warn-unresolved-symbols
4660         and --error-unresolved-symbols.
4661         * errors.cc (Errors::undefined_symbol): Implement
4662         --warn-unresolved-symbols.
4663
4664         * options.h (class General_options): Add -z text and -z textoff.
4665         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4666
4667 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
4668
4669         * gc.h (Garbage_collection::Cident_section_map): New typedef.
4670         (Garbage_collection::cident_sections): New function.
4671         (Garbage_collection::add_cident_section): New function.
4672         (Garbage_collection::cident_sections_): New member.
4673         (gc_process_relocs): Add references to sections whose names are C
4674         identifiers.
4675         * gold.h (cident_section_start_prefix): New constant.
4676         (cident_section_stop_prefix): New constant.
4677         (is_cident): New function.
4678         * layout.cc (Layout::define_section_symbols): Replace string constants
4679         with the newly defined constants.
4680         * object.cc (Sized_relobj::do_layout): Track sections whose names are
4681         C identifiers.
4682         * testsuite/Makefile.am: Add gc_orphan_section_test.
4683         * testsuite/Makefile.in: Regenerate.
4684         * testsuite/gc_orphan_section_test.cc: New file.
4685         * testsuite/gc_orphan_section_test.sh: New file.
4686
4687 2010-01-06  Ian Lance Taylor  <iant@google.com>
4688
4689         PR 10980
4690         * options.h (class General_options): Add --warn-shared-textrel.
4691         * layout.cc (Layout::finish_dynamic_section): Implement
4692         --warn-shared-textrel.
4693
4694         PR 10980
4695         * options.h (class General_options): Add --warn-multiple-gp.
4696
4697 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4698
4699         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4700         $(THREADSLIB) and $(LIBDL).
4701         * Makefile.in: Rebuild.
4702
4703 2010-01-06  Ian Lance Taylor  <iant@google.com>
4704
4705         PR 10980
4706         * options.cc (General_options::parse_section_start): New function.
4707         (General_options::section_start): New function.
4708         (General_options::General_options): Initialize all members.
4709         * options.h: Include <map>
4710         (class General_options): Add --section-start.  Add section_starts_
4711         member.
4712         * layout.cc (Layout::attach_allocated_section_to_segment): If
4713         --section-start was used, set the address of the segment.  Remove
4714         local sort_sections.
4715         (Layout::relaxation_loop_body): If the address of the load segment
4716         has been set by --section-start, don't use it.
4717         * output.h (Output_segment::update_flags_for_output_section): New
4718         function.
4719         * output.cc (Output_segment::add_output_section): Call
4720         update_flags_for_output_section.
4721
4722 2010-01-05  Ian Lance Taylor  <iant@google.com>
4723
4724         PR 10980
4725         * options.h (class General_options): Add --undefined-version.
4726         * script.cc (struct Version_expression): Add was_matched_by_symbol
4727         field.
4728         (Version_script_info::matched_symbol): New function.
4729         (Version_script_info::get_symbol_version_helper): Call
4730         matched_symbol.
4731         (Version_script_info::check_unmatched_names): New function.
4732         * script.h (class Version_script_info): Update declarations.
4733         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4734
4735         * options.h (class General_options): Use DEFINE_bool_alias for
4736         allow_multiple_definition.
4737         * resolve.cc (Symbol_table::should_override): Don't test
4738         allow_multiple_definition.
4739
4740         PR 10980
4741         * options.h (class General_options): Add --cref.
4742         * main.cc (main): Print cref table if --cref.  Don't close mapfile
4743         until after printing cref table.
4744         * cref.cc: Include "symtab.h".
4745         (class Cref_inputs): Define Cref_table_compare and Cref_table.
4746         (Cref_table_compare::operator()): New function.
4747         (Cref_inputs::gather_cref): New function.
4748         (filecol): New static const.
4749         (Cref_inputs::print_cref): New function.
4750         (Cref::print_cref): New function.
4751         * cref.h: Include <cstdio>.
4752         (class Cref): Update declarations.
4753         * mapfile.h (Mapfile::file): New function.
4754         * object.h (class Object): Define Symbols.  Declare virtual
4755         do_get_global_symbols.
4756         (Object::get_global_symbols): New function.
4757         * object.cc (Input_objects::add_object): Pass object to cref_ if
4758         --cref.
4759         (Input_objects::archive_start): Likewise.
4760         (Input_objects::archive_stop): Likewise.
4761         (Input_objects::print_cref): New function.
4762         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4763         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4764         --cref.
4765         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4766         function.
4767         * plugin.h (class Sized_pluginobj): Update declarations.
4768
4769 2010-01-05  Ian Lance Taylor  <iant@google.com>
4770
4771         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4772         to is_default_version.  Rename insdef to insdefault.
4773         (Symbol_table::add_from_relobj): Rename def to is_default_version
4774         and local to is_forced_local.
4775         (Symbol_table::add_from_pluginobj): Likewise.
4776         (Symbol_table::add_from_dynobj): Likewise.
4777         (Symbol_table::define_special_symbol): Rename insdef to
4778         insdefault.
4779
4780 2010-01-04  Ian Lance Taylor  <iant@google.com>
4781
4782         PR 10980
4783         * options.h (class General_options): Add
4784         --allow-multiple-definition and -z muldefs.
4785         * resolve.cc (Symbol_table::should_override): Don't warn about a
4786         multiple symbol definition if --allow-multiple-definition or -z
4787         muldefs.
4788
4789         PR 10980
4790         * options.h (class General_options): Add --add-needed and
4791         --copy-dt-needed-entries.  Tweak --as-needed help entry.
4792         * object.cc (Input_objects::check_dynamic_dependencies): Give an
4793         error if --copy-dt-needed-entries aka --add-needed is used and
4794         would cause a change in behaviour.
4795
4796         PR 10980
4797         * options.h (class General_options): Add -G as a short version of
4798         --shared.  Add no-op options -assert, -g, and -i.
4799
4800 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
4801
4802         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4803         check for .text or .gnu.linkonce.t sections.
4804         * icf.cc (Icf::find_identical_sections): Ditto.
4805         Change the detection for mangled function name within the section
4806         name.
4807         * icf.h (is_section_foldable_candidate): New function.
4808
4809 2009-12-30  Ian Lance Taylor  <iant@google.com>
4810
4811         PR 10980
4812         * options.h (class General_options): Permit two dashes with
4813         --retain-symbols-file.
4814
4815 2009-12-30  Ian Lance Taylor  <iant@google.com>
4816
4817         PR 10979
4818         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4819         don't put the file header and segment headers in the text
4820         segment.
4821
4822         PR 10979
4823         * common.cc (Sort_commons::operator()): Stabilize sort when both
4824         entries are NULL.
4825         (Symbol_table::do_allocate_commons_list): When allocating common
4826         symbols, skip a symbol which is no longer common.
4827         * symtab.h (Symbol::is_common): Test whether the symbol comes from
4828         an object before checking its type.
4829         * testsuite/common_test_2.c: New file.
4830         * testsuite/common_test_3.c: New file.
4831         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4832         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4833         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4834         (common_test_2_pic.o, common_test_2.so): New targets.
4835         (common_test_3_pic.o, common_test_3.so): New targets.
4836         * testsuite/Makefile.in: Rebuild.
4837
4838         PR 10979
4839         * script.cc (read_input_script): If we see a new SECTIONS clause,
4840         and we have added an input section, give an error.
4841         * layout.h (class Layout): Add have_added_input_section function.
4842         Add have_added_input_section_ field.
4843         * layout.cc (Layout::Layout): Initialize
4844         have_added_input_section_.
4845         (Layout::layout): Set have_added_input_section_.
4846         (Layout::layout_eh_frame): Likewise.
4847
4848 2009-12-30  Ian Lance Taylor  <iant@google.com>
4849
4850         PR 10931
4851         * options.h (class General_options): Add --sort-common option.
4852         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4853         * common.cc (Sort_common): Add sort_order parameter to
4854         constructor.  Add sort_order_ field.
4855         (Sort_commons::operator): Check sort_order_.
4856         (Symbol_table::allocate_commons): Determine the sort order.
4857         (Symbol_table::do_allocate_commons): Add sort_order parameter.
4858         Change all callers.
4859         (Symbol_table::do_allocate_commons_list): Likewise.
4860
4861 2009-12-30  Ian Lance Taylor  <iant@google.com>
4862
4863         PR 10916
4864         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4865         symbols from this object, don't change the visibility of an
4866         undefined symbol.
4867         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4868
4869 2009-12-30  Ian Lance Taylor  <iant@google.com>
4870
4871         PR 10861
4872         * script.h (class Version_script_info): Define Language enum.
4873         Update declarations.  Define Glob, Exact, and Lookup types.  Add
4874         new fields globals_, locals_, and is_finalized_.
4875         * script.cc: Various formatting fixes.
4876         (class Parser_closure): Change language_stack_ from a vector of
4877         std::string to one of Version_script_info::Language.  Adjust all
4878         uses accordingly.
4879         (class Lazy_demangler): Remove.
4880         (struct Version_expression): Change language from std::string to
4881         Version_script_info::Language.
4882         (Version_script_info::Version_script_info): New function.
4883         (Version_script_info::~Version_script_info): Don't call clear.
4884         (Version_script_info::finalize): New function.
4885         (Version_script_info::build_lookup_tables): New function.
4886         (Version_script_info::build_expression_list_lookup): New
4887         function.
4888         (Version_script_info::get_symbol_version_helper): Rewrite to use
4889         lookup tables.
4890         (Version_script_info::print_expression_list): Adjust to use
4891         Version_script_info::Language.
4892         (script_push_lex_into_version_mode): Check that the version script
4893         has not been finalized.
4894         (version_script_push_lang): Change language string to
4895         Version_script_info::Language.
4896         * options.cc (Command_line::version_script): New function.
4897         * options.h (class General_options): Add finalize_dynamic_list
4898         function.  Change version_script from declaration to definition.
4899         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4900         * testsuite/version_script.map: Remove duplicate def of foo.
4901         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4902         version_script.map.
4903         * testsuite/Makefile.in: Rebuild.
4904
4905 2009-12-30  Ian Lance Taylor  <iant@google.com>
4906
4907         PR 10843
4908         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4909         if the input symbol index is 0, make the output symbol index 0.
4910
4911 2009-12-30  Ian Lance Taylor  <iant@google.com>
4912
4913         PR 10670
4914         * options.h (class General_options): Add -x/--discard-all.
4915         * object.cc (Sized_relobj::do_count_local_symbols): Handle
4916         --discard-all.  If the local symbol needs a dynamic entry, check
4917         that before handling --discard-locals.
4918
4919 2009-12-30  Ian Lance Taylor  <iant@google.com>
4920
4921         PR 10450
4922         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4923         flags to PF_R.
4924         (Output_segment::add_output_section): Don't change the flags if
4925         the type is PT_TLS.
4926
4927         PR 10450
4928         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4929         GNU hash table if they need a dynamic value.  Otherwise, don't add
4930         them if they are defined in a dynamic object or are forced local.
4931
4932 2009-12-29  Ian Lance Taylor  <iant@google.com>
4933
4934         PR 10450
4935         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4936         .gnu.hash table for a 32-bit target.
4937
4938         PR 10450
4939         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4940         regular and a dynamic object only needs a dynamic symbol table
4941         entry if it is externally visible.
4942
4943         PR 10450
4944         * i386.cc (class Target_i386): Initialize global_offset_table_ in
4945         constructor.  Add global_offset_table_ field.
4946         (Target_i386::got_section): Set global_offset_table_.
4947         (Target_i386::do_finalize_sections): Set global_offset_table_
4948         size.
4949         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4950         in constructor.  Add global_offset_table_ field.
4951         (Target_x86_64::got_section): Set global_offset_table_.
4952         (Target_x86_64::do_finalize_sections): Set global_offset_table_
4953         size.
4954
4955         * layout.cc (Layout::Layout): Initialize increase_relro_.
4956         (Layout::get_output_section): Add is_relro, is_last_relro, and
4957         is_first_non_relro parameters.  Change all callers.
4958         (Layout::choose_output_section): Likewise.
4959         (Layout::add_output_section_data): Likewise.
4960         (Layout::make_output_section): Likewise.
4961         (Layout::set_segment_offsets): Clear increase_relro when using a
4962         linker script.
4963         * layout.h (class Layout): Add increase_relro method.  Add
4964         increase_relro_ field.  Update declarations.
4965         * output.cc (Output_section::Output_section): Initialize
4966         is_last_relro_ and is_first_non_relro_.
4967         (Output_segment::add_output_section): Group relro sections is
4968         do_sort is true.  Handle is_last_relro and is_first_non_relro.
4969         (Output_segment::maximum_alignment): Remove relro handling.
4970         (Output_segment::set_section_addresses): Add increase_relro
4971         parameter.  Change all callers.  Add initial alignment to align
4972         relro sections on separate page.  Remove old relro handling.
4973         (Output_segment::set_section_list_addresses): Remove in_relro
4974         parameter.  Change all callers.
4975         (Output_segment::set_offset): Add increase parameter.  Change all
4976         callers.  Remove old relro handling.
4977         * output.h (class Output_section): Add new methods: is_last_relro,
4978         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4979         Add is_last_relro_ and is_first_non_relro_ fields.
4980         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4981         Create separate .got.plt section.  Call increase_relro.
4982         * x86_64.cc (Target_x86_64::got_section): Likewise.
4983         * testsuite/relro_script_test.t: Add .got.plt.
4984
4985         PR 10450
4986         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4987         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4988         (Layout::finalize): Call set_dynamic_symbol_size.
4989         (Layout::set_dynamic_symbol_size): New function.
4990         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
4991         set_dynamic_symbol_size.
4992
4993         PR 10450
4994         * output.h (class Output_section): Add is_entsize_zero_ field.
4995         * output.cc (Output_section::Output_section): Initialize
4996         is_entsize_zero_.
4997         (Output_section::set_entsize): If two different entsizes are
4998         requested, force it to zero.
4999         (Output_section::add_input_section): Set flags for .debug_str
5000         before updating section flags.  Set entsize.
5001         (Output_section::update_flags_for_input_section): Set SHF_MERGE
5002         and SHF_STRING if all input sections have those flags.
5003
5004 2009-12-29   Rafael Espindola  <espindola@google.com>
5005
5006         * main.cc (main): Fix the sys time reporting.
5007         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5008         reporting.
5009
5010 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
5011
5012         * options.cc (General_options::parse_version): Allow -v to exit
5013         without an error if there is nothing to link.
5014
5015 2009-12-29  Ian Lance Taylor  <iant@google.com>
5016
5017         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5018         using a version of gcc before 4.1.
5019         * configure: Rebuild.
5020
5021 2009-12-28  Chris Demetriou  <cgd@google.com>
5022
5023         * attributes.cc (Output_attributes_section_data::do_write): Use
5024         std::vector::front rather than std::vector::data.
5025
5026 2009-12-28  Ian Lance Taylor  <iant@google.com>
5027
5028         * symtab.h (class Symbol_table): Add enum Defined.
5029         * resolve.cc (Symbol_table::should_override): Add defined
5030         parameter.  Change all callers.  Test whether object is NULL
5031         before calling a method on it.
5032         (Symbol_table::report_resolve_problem): Add defined parameter.
5033         Change all callers.
5034         (Symbol_table::should_override_with_special): Likewise.
5035         * symtab.cc (Symbol_table::define_in_output_data): Add defined
5036         parameter.  Change all callers.
5037         (Symbol_table::do_define_in_output_data): Likewise.
5038         (Symbol_table::define_in_output_segment): Likewise.
5039         (Symbol_table::do_define_in_output_segment): Likewise.
5040         (Symbol_table::define_as_constant): Likewise.
5041         (Symbol_table::do_define_as_constant): Likewise.
5042         * script.h (class Symbol_assignment): Add is_defsym parameter to
5043         constructor; change all callers.
5044         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5045         parameter.  Change all callers.  Add is_defsym_ field.
5046         (class Parser_closure): Add parsing_defsym parameter to
5047         constructor; change all callers.  Add parsing_defsym accessor
5048         function.  Add parsing_defsym_ field.
5049
5050 2009-12-28  Ian Lance Taylor  <iant@google.com>
5051
5052         * gold.cc (queue_middle_tasks): Fix formatting.
5053         * object.cc (Relobj::is_section_name_included): Likewise.
5054
5055 2009-12-23  Ian Lance Taylor  <iant@google.com>
5056
5057         * i386.cc (Target_i386::do_calls_non_split): Recognize
5058         -fsplit-stack prologue for a function with a static chain.
5059         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5060         -fsplit-stack prologue when using %r11.
5061
5062 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
5063
5064         * options.cc (General_options::parse_version): Make -v continue and do
5065         the link like GNU ld does.
5066
5067 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
5068
5069         * Makefile.am (CCFILES): Add timer.cc.
5070         (HFILES): Add timer.h.
5071         * configure.ac: Check for sysconf and times.
5072         * main.cc: include timer.h.
5073         (main): Use Timer instead of get_run_time.
5074         * timer.cc: New.
5075         * timer.h: New.
5076         * workqueue.cc: include timer.h.
5077         (Workqueue::find_and_run_task):
5078         Report user, sys and wall time.
5079         * Makefile.in: Regenerate.
5080         * config.in: Regenerate.
5081         * configure: Regenerate.
5082
5083 2009-12-16  Doug Kwan  <dougkwan@google.com>
5084
5085         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5086         sections.
5087         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5088         relaxed input sections.
5089         * output.cc (Output_section::find_relaxed_input_section): Change
5090         return type to Output_relaxed_input_section pointer.  Adjust code
5091         for new type of relaxed_input_section_map_.
5092         * output.h (Output_section::find_relaxed_input_section): Change
5093         return type to Output_relaxed_input_section pointer.
5094         (Output_section::Output_relaxed_input_section_by_input_section_map):
5095         New type.
5096         (Output_section::relaxed_input_section_map_): Change type to
5097         Output_section::Output_relaxed_input_section_by_input_section_map.
5098         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5099         input section.
5100
5101 2009-12-15  Ian Lance Taylor  <iant@google.com>
5102
5103         * layout.cc (Layout::create_shstrtab): Only write out after input
5104         sections if we are compressing debug sections.
5105
5106 2009-12-15  Ian Lance Taylor  <iant@google.com>
5107
5108         * archive.cc (Archive::add_symbols): Only look up a symbol without
5109         a version if there is, in fact, a version.
5110
5111 2009-12-14  Ian Lance Taylor  <iant@google.com>
5112
5113         Revert -Wshadow changes, all changes from:
5114         2009-12-11  Doug Kwan  <dougkwan@google.com>
5115         2009-12-11  Nick Clifton  <nickc@redhat.com>
5116         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5117
5118 2009-12-11  Doug Kwan  <dougkwan@google.com>
5119
5120         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5121         due to -Wshadow.
5122         * attributes.cc (Object_attribute::size): Ditto.
5123         (Attributes_section_data::size): Ditto.
5124         (Attributes_section_data::Attributes_section_data): Ditto.
5125         (Output_attributes_section_data::do_write): Ditto.
5126         * attributes.h (Object_attribute::set_type): Ditto.
5127         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5128
5129 2009-12-11  Nick Clifton  <nickc@redhat.com>
5130
5131         * archive.cc: Fix shadowed variable warnings.
5132         * arm.cc: Likewise.
5133         * compressed_output.cc: Likewise.
5134         * compressed_output.h: Likewise.
5135         * configure: Likewise.
5136         * dwarf_reader.cc: Likewise.
5137         * dynobj.cc: Likewise.
5138         * dynobj.h: Likewise.
5139         * ehframe.cc: Likewise.
5140         * ehframe.h: Likewise.
5141         * errors.cc: Likewise.
5142         * expression.cc: Likewise.
5143         * fileread.cc: Likewise.
5144         * fileread.h: Likewise.
5145         * freebsd.h: Likewise.
5146         * i386.cc: Likewise.
5147         * icf.cc: Likewise.
5148         * incremental.h: Likewise.
5149         * layout.cc: Likewise.
5150         * layout.h: Likewise.
5151         * mapfile.cc: Likewise.
5152         * merge.cc: Likewise.
5153         * merge.h: Likewise.
5154         * object.cc: Likewise.
5155         * object.h: Likewise.
5156         * options.h: Likewise.
5157         * output.cc: Likewise.
5158         * output.h: Likewise.
5159         * parameters.cc: Likewise.
5160         * plugin.cc: Likewise.
5161         * powerpc.cc: Likewise.
5162         * reduced_debug_output.cc: Likewise.
5163         * reduced_debug_output.h: Likewise.
5164         * reloc.cc: Likewise.
5165         * reloc.h: Likewise.
5166         * resolve.cc: Likewise.
5167         * script-sections.cc: Likewise.
5168         * script.cc: Likewise.
5169         * script.h: Likewise.
5170         * sparc.cc: Likewise.
5171         * symtab.cc: Likewise.
5172         * symtab.h: Likewise.
5173         * target-select.cc: Likewise.
5174         * target-select.h: Likewise.
5175         * token.h: Likewise.
5176         * workqueue.cc: Likewise.
5177         * workqueue.h: Likewise.
5178         * x86_64.cc: Likewise.
5179
5180 2009-12-10  Doug Kwan  <dougkwan@google.com>
5181
5182         * arm.cc (attributes.h): New include.
5183         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5184         (Arm_relobj::~Arm_relobj): Delete object pointed by
5185         attributes_section_data_.
5186         (Arm_relobj::attributes_section_data): New method definition.
5187         (Arm_relobj::attributes_section_data_): New data member declaration.
5188         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5189         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5190         attributes_section_data_.
5191         (Arm_dynobj::attributes_section_data): New method definition.
5192         (Arm_dynobj::attributes_section_data_): New data member declaration.
5193         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
5194         initialization value of may_use_blx_ to false.
5195         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5196         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5197         object attributes to compute results instead of hard-coding.
5198         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5199         Target_arm::get_secondary_compatible_arch,
5200         Target_arm::set_secondary_compatible_arch
5201         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5202         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5203         New method declarations.
5204         (Target_arm::get_aeabi_object_attribute): New method definition.
5205         (Target_arm::attributes_section_data_): New data member declaration.
5206         (read_arm_attributes_section): New template definition.
5207         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5208         (Arm_dynobj::do_read_symbols): Ditto.
5209         (Target_arm::do_finalize_sections): Merge attributes sections from
5210         input.  Check for BLX use after attributes section merging.
5211         Fix __exidx_start and __exidx_end visibility.  Create an
5212         .ARM.attributes section if necessary.
5213         (Target_arm::get_secondary_compatible_arch,
5214         Target_arm::set_secondary_compatible_arch,
5215         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5216         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5217         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5218         New method definitions.
5219
5220 2009-12-09  Ian Lance Taylor  <iant@google.com>
5221
5222         * plugin.cc (Plugin::load): Don't cast from void* to a function
5223         pointer.
5224
5225 2009-12-09  Ian Lance Taylor  <iant@google.com>
5226
5227         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5228         information fields.
5229
5230 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5231
5232         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5233         Replace two_file_shared_1.so with two_file_shared_2.so.
5234         * testsuite/Makefile.in: Regenerated.
5235
5236 2009-12-08  Doug Kwan  <dougkwan@google.com>
5237
5238         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5239         (HFILES): Add attributes.h and int_encoding.h.
5240         * Makefile.in: Regenerate.
5241         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5242         function definitions to int_encoding.cc
5243         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5244         prototypes to int_encoding.h
5245         * reduced_debug_output.cc (int_encoding.h): New include.
5246         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5247         function definitions to int_encoding.cc
5248         (insert_into_vector, read_from_pointer): Move template definitions to
5249         int_encoding.h
5250         * attributes.cc: New file.
5251         * attributes.h: New file.
5252         * int_encoding.cc: New file.
5253         * int_encoding.h: New file.
5254
5255 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5256
5257         PR gold/11055
5258         * incremental-dump.cc (dump_incremental_inputs): New.
5259         (main): Use dump_incremental_inputs.
5260
5261 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5262
5263         PR gold/10893
5264         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5265         checking elfcpp::STT_FUNC.
5266         (Target_i386::Relocate::relocate): Likewise.
5267         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5268
5269         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5270         symbols from shared libraries into normal FUNC symbols.
5271
5272         * symtab.h (Symbol): Add is_func and use it.
5273
5274 2009-12-05  Doug Kwan  <dougkwan@google.com>
5275
5276         * arm.cc (Target_arm::arm_info): Initialize new fields
5277         attributes_section and attributes_vendor.
5278         * i386.cc (Target_i386::i386_info): Same.
5279         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5280         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5281         fields attributes_section and attributes_vendor.
5282         * sparc.cc (Target_sparc::sparc_info): Same.
5283         * target.h (Target::attributes_section, Target::attributes_vendor,
5284         Target::is_attributes_section, Target::attribute_arg_type,
5285         Target::attributes_order): New method definitions.
5286         (Target::Target_info::attributes_section,
5287         Target::Target_info::attributes_vendor): New fields.
5288         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5289         virtual method definitions.
5290         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5291         attributes_section and attributes_vendor.
5292         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5293
5294 2009-12-05  Doug Kwan  <dougkwan@google.com>
5295
5296         * arm.cc: Update comments about interworking and stub generation.
5297         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5298         considered as non-PIC.
5299         (Arm_relocate_functions::base_abs): Fix formatting.
5300         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5301         of function to use GOT entry address instead of offset.
5302         (Target_arm::Scan::global): Issue an error if a symbol would need a
5303         PLT does not get one because it is untyped.  Remove code to create
5304         dynamic symbols for relative branches.
5305         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5306         takes unsigned integer instead of boolean.
5307
5308 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5309
5310         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5311         (two_file_test_LDADD): Likewise.
5312         (common_test_1_LDADD): Likewise.
5313         (exception_test_LDADD) Likewise.
5314         (weak_test_LDADD): Likewise.
5315         (many_sections_test_LDADD): Likewise.
5316         (initpri1_LDADD): Likewise.
5317         (script_test_1_LDADD): Likewise.
5318         (script_test_2_LDADD): Likewise.
5319         (justsyms_LDADD): Likewise.
5320         (binary_test_LDADD): Likewise.
5321         (large_LDADD): Likewise.
5322         * testsuite/Makefile.in: Regenerated.
5323
5324 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5325
5326         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5327         (Symbol_table::override_with_special): Likewise.
5328         (Symbol_table::add_from_object): Likewise.
5329
5330 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5331
5332         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5333         Don't set the data_offset twice.
5334
5335 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5336
5337         * testsuite/Makefile.in: Regenerate.
5338
5339 2009-12-03  Doug Kwan  <dougkwan@google.com>
5340
5341         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5342         (Target_arm::do_finalize_sections): Add parameter for symbol table
5343         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5344         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5345         parameter for symbol table pointer.
5346         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5347         an additional parameter for a pointer to symbol table.
5348         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5349         parameter for a symbol table pointer.
5350         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5351         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5352         Ditto.
5353         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5354         parameter for a symbol table pointer.
5355
5356 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5357
5358         * incremental.cc (Incremental_inputs_header)
5359         (Incremental_inputs_header_write, Incremental_inputs_entry)
5360         (Incremental_inputs_entry_write): Move ...
5361         * incremental.h (Incremental_inputs_header)
5362         (Incremental_inputs_header_write, Incremental_inputs_entry)
5363         (Incremental_inputs_entry_write): here.
5364
5365 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5366
5367         * incremental.cc (make_sized_incremental_binary): Set the target.
5368         Error if it is incompatible.
5369         * output.h (Output_file): Add filename method.
5370
5371 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5372
5373         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5374         from the get_* methods.
5375
5376 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5377
5378         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5379         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5380         Write 0 for the data_offset of scripts.
5381
5382 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5383
5384         * testsuite/Makefile.am: Add the incremental_test.sh test.
5385         * testsuite/incremental_test.sh: New.
5386         * testsuite/incremental_test_1.c: New.
5387         * testsuite/incremental_test_2.c: New.
5388
5389 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5390
5391        * incremental-dump.cc (main): Fix typos.
5392
5393 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5394
5395         PR gold/11025
5396         * incremental-dump.cc (main): Use llu to print 64 bit values.
5397
5398 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5399             H.J. Lu  <hongjiu.lu@intel.com>
5400
5401         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5402         $(LIBDL).
5403         (incremental_dump_LDADD): Likewise.
5404         * Makefile.in: Regenerated.
5405
5406 2009-11-25  Doug Kwan  <dougkwan@google.com>
5407
5408         Revert:
5409
5410         2009-11-25  Doug Kwan  <dougkwan@google.com>
5411
5412                 * arm.cc (Target_arm::Target_arm): Move method definition
5413                 outside of class definition.  Add code to handle
5414                 --target1-rel, --target1-abs and --target2= options.
5415                 (Target_arm::get_reloc_reloc_type): Change method to be
5416                 non-static and const.
5417                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5418                 New data member declaration.
5419                 (Target_arm::Scan::local, Target_arm::Scan::global,
5420                 Target_arm::Relocate::relocate,
5421                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5422                 Adjust call to Target_arm::get_real_reloc_type.
5423                 (Target_arm::get_real_reloc_type): Use command line options
5424                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5425                 * options.h (--target1-rel, --target1-abs, --target2): New
5426                 ARM-only options.
5427
5428 2009-11-25  Doug Kwan  <dougkwan@google.com>
5429
5430         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5431         class definition.  Add code to handle --target1-rel, --target1-abs
5432         and --target2= options.
5433         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5434         and const.
5435         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5436         member declaration.
5437         (Target_arm::Scan::local, Target_arm::Scan::global,
5438         Target_arm::Relocate::relocate,
5439         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5440         call to Target_arm::get_real_reloc_type.
5441         (Target_arm::get_real_reloc_type): Use command line options to
5442         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5443         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5444         options.
5445
5446 2009-11-25  Doug Kwan  <dougkwan@google.com>
5447
5448         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5449         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5450         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5451         formatting.
5452         (Arm_relocate_functions::thm_call): Replace body with a call to
5453         Arm_relocate_functions::thumb_branch_common.
5454         (Arm_relocate_functions::thm_jump24,
5455         Arm_relocate_functions::thm_xpc22): New method definitions.
5456         (Arm_relocate_functions::thumb_branch_common): New method definition.
5457         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5458         operator.
5459         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5460         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5461
5462 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5463
5464         * Makefile.am: Build incremental-dump
5465         * Makefile.in: Regenerate.
5466         * incremental-dump.cc: New.
5467         * incremental.cc (Incremental_inputs_header_data,
5468         Incremental_inputs_entry_data): Move to incremental.h
5469         * incremental.h: (Incremental_inputs_header_data,
5470         Incremental_inputs_entry_data): Move from incremental.cc
5471
5472 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5473
5474         * incremental.cc (Incremental_inputs_header,
5475         Incremental_inputs_header_write, Incremental_inputs_entry,
5476         Incremental_inputs_entry_write): Add a typedef with the data type.
5477
5478 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5479
5480         * incremental.cc (Incremental_inputs_header,
5481         Incremental_inputs_header_write, Incremental_inputs_entry,
5482         Incremental_inputs_entry_write): Update comment about which
5483         type has the filed descriptions.
5484
5485 2009-11-15  Doug Kwan  <dougkwan@google.com>
5486
5487         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5488         (Arm_relocate_functions::arm_branch_common): Change method defintion
5489         in class definition to a method declaration and update list of formal
5490         parameters.
5491         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5492         Arm_relocation_functions::jump24): Adjust call to
5493         Arm_relocate_functions::arm_branch_common.  Update list of formal
5494         parameters.
5495         (Arm_relocate_functions::xpc25): New method definition.
5496         (Arm_relocate_functions::arm_branch_common): Move method defintion
5497         out from class definition.  Use stubs for mode-switching and extending
5498         branch ranges.
5499         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5500         specially.  Change code to enable use of stubs in ARM branches.
5501
5502 2009-11-10  Doug Kwan  <dougkwan@google.com>
5503
5504         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5505         in method declaration.
5506         (Target_arm::relocate_stub): New method declaration.
5507         (Target_arm::default_target): Change to return a pointer instead of
5508         a const reference.
5509         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5510         Target_arm::default_target.
5511         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5512         method definition.
5513         (Target_arm::relocate_section): Adjust view.
5514         (Target_arm::relocate_stub): New method definition.
5515
5516 2009-11-10  Doug Kwan  <dougkwan@google.com>
5517
5518         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5519         a format warning.
5520         * incremental.cc (open_incremental_binary): Initialized local
5521         variables to avoid warnings.
5522         * object.cc (make_elf_object): Ditto.
5523         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5524         a format warning.
5525
5526 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5527
5528         PR gold/10930
5529         * testsuite/plugin_test.c: Include "config.h".
5530
5531 2009-11-09  Doug Kwan  <dougkwan@google.com>
5532
5533         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5534         (arm_symbol_value): Remove.
5535         (Arm_relocate_functions::arm_branch_common,
5536         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5537         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5538         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5539         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5540         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5541         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5542         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5543         Arm_relocate_functions::thm_mobw_abs_nc,
5544         Arm_relocate_functions::thm_mov_abs,
5545         Arm_relocate_functions::movw_prel_nc,
5546         Arm_relocate_functions::thm_movt_abs,
5547         Arm_relocate_functions::movt_prel,
5548         Arm_relocate_functions::thm_movw_prel_nc,
5549         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5550         (Target_arm::Relocate::relocate): Only decompose address into two
5551         parts if relocation type uses the thumb-bit and pass the actual
5552         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5553         calls to methods in Arm_relocate_functions for this change.
5554
5555 2009-11-08  Ian Lance Taylor  <iant@google.com>
5556
5557         PR 10925
5558         * reloc.cc: Instantiate
5559         Sized_relobj::initialize_input_to_output_maps and
5560         Sized_relobj:free_input_to_output_maps.
5561
5562 2009-11-06  Ian Lance Taylor  <iant@google.com>
5563
5564         PR 10876
5565         * defstd.cc (in_segment): Set only_if_ref true for "end".
5566
5567 2009-11-06  Doug Kwan  <dougkwan@google.com>
5568
5569         * arm.cc (class Reloc_stub): Correct a comment.
5570         (Target_arm::Target_arm): Initialize arm_input_section_map_.
5571         (Target_arm::scan_section_for_stubs): New method declaration.
5572         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5573         Change methods from private to protected.
5574         (Target_arm::do_may_relax): New method definition.
5575         (Target_arm::do_relax, Target_arm::group_sections,
5576         Target_arm::scan_reloc_for_stub,
5577         Target_arm::scan_reloc_section_for_stubs): New method declarations.
5578         (Target_arm::arm_input_section_map_): New data member declaration.
5579         (Target_arm::scan_reloc_for_stub,
5580         Target_arm::scan_reloc_section_for_stubs,
5581         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5582         Target_arm::do_relax): New method definitions.
5583
5584 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
5585
5586         * configure.ac: Check for (struct stat)::st_mtim
5587         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5588         * config.in: Regenerate.
5589         * configure: Regenerate.
5590
5591 2009-11-05  Ian Lance Taylor  <iant@google.com>
5592
5593         PR 10910
5594         * output.cc (Output_segment::add_output_section): Add missing
5595         return statement.
5596
5597 2009-11-04  Ian Lance Taylor  <iant@google.com>
5598
5599         PR 10880
5600         * object.h (class Object): Add is_needed and set_is_needed
5601         methods.  Add is_needed_ field.  Make bool fields into bitfields.
5602         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5603         defined in a dynamic object and referenced by a regular object,
5604         set is_needed for the dynamic object.
5605         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5606         if the file is marked with as_needed and it is not needed.
5607
5608 2009-11-04  Ian Lance Taylor  <iant@google.com>
5609
5610         PR 10887
5611         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5612         tags if data is discarded by linker script.
5613         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5614         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5615         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5616         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5617
5618 2009-11-04  Ian Lance Taylor  <iant@google.com>
5619
5620         * layout.cc (Layout::get_output_section): Add is_interp and
5621         is_dynamic_linker_section parameters.  Change all callers.
5622         (Layout::choose_output_section): Likewise.
5623         (Layout::make_output_section): Likewise.
5624         (Layout::add_output_section_data): Add is_dynamic_linker_section
5625         parameter.  Change all callers.
5626         * layout.h (class Layout): Update declarations.
5627         * output.h (class Output_section): Add is_interp, set_is_interp,
5628         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5629         Add is_interp_, is_dynamic_linker_section_ fields.  Change
5630         generate_code_fills_at_write_ to a bitfield.
5631         * output.cc (Output_section::Output_sections): Initialize new
5632         fields.
5633         (Output_segment::add_output_section): Add do_sort parameter.
5634         Change all callers.
5635
5636 2009-11-03  Ian Lance Taylor  <iant@google.com>
5637
5638         PR 10860
5639         * options.h (class General_options): Add --warn-common.
5640         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5641         merging two common symbols.
5642         (Symbol_table::should_override): Handle --warn-common when merging
5643         a common symbol with a defined symbol.  Use report_resolve_problem
5644         for multiple definitions.
5645         (Symbol_table::report_resolve_problem): New function.
5646         * symtab.h (class Symbol_table): Declare report_resolve_problem.
5647
5648 2009-11-03  Doug Kwan  <dougkwan@google.com>
5649
5650         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5651         stub_factory_.
5652         (Target_arm::stub_factory): New method definition.
5653         (Target_arm::new_arm_input_section,
5654         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5655         Target_arm::reloc_uses_thumb_bit): New method declarations.
5656         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5657         New type definitions.
5658         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5659         member declarations.
5660         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5661         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5662         New method definitions.
5663
5664 2009-11-03  Ian Lance Taylor  <iant@google.com>
5665
5666         * options.h (class General_options): Add --warn_constructors.
5667
5668 2009-11-03  Ian Lance Taylor  <iant@google.com>
5669
5670         PR 10893
5671         * defstd.cc (in_section): Add entries for __rel_iplt_start,
5672         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5673
5674 2009-11-03  Ian Lance Taylor  <iant@google.com>
5675
5676         PR 10895
5677         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5678         --msgid-bugs-address.
5679         (install-pdf): New target.
5680         (install-data_yes): Look up one directory to find mkinstalldirs.
5681
5682 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
5683
5684         * po/Make-in (.po.gmo): Don't generate .gmo files in source
5685         tree.
5686
5687 2009-10-30  Doug Kwan  <dougkwan@google.com>
5688
5689         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5690
5691 2009-10-30  Doug Kwan  <dougkwan@google.com>
5692
5693         * arm.cc (Stub_addend_reader): New struct template definition
5694         and partial specializations.
5695         (Stub_addend_reader::operator()): New method definition for a
5696         partially specialized template.
5697
5698 2009-10-30  Doug Kwan  <dougkwan@google.com>
5699
5700         * arm.cc (Arm_relobj::processor_specific_flags): New method
5701         definition.
5702         (Arm_relobj::do_read_symbols): New method declaration.
5703         (Arm_relobj::processor_specific_flags_): New data member declaration.
5704         (Arm_dynobj): New class definition.
5705         (Target_arm::do_finalize_sections): Add input_objects parameter.
5706         (Target_arm::do_adjust_elf_header): New method declaration.
5707         (Target_arm::are_eabi_versions_compatible,
5708         (Target_arm::merge_processor_specific_flags): New method declaration.
5709         (Target_arm::do_make_elf_object): New overloaded method definitions
5710         and declaration.
5711         (Arm_relobj::do_read_symbols): New method definition.
5712         (Arm_dynobj::do_read_symbols): Ditto.
5713         (Target_arm::do_finalize_sections): Add input_objects parameters.
5714         Merge processor-specific flags from all input objects.
5715         (Target_arm::are_eabi_versions_compatible,
5716         Target_arm::merge_processor_specific_flags,
5717         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5718         New method definitions.
5719         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5720         Input_objects pointer type parameter.
5721         * layout.cc (Layout::finalize): Pass input objects to target's.
5722         finalize_sections function.
5723         * output.cc (Output_file_header::do_sized_write): Set ELF file
5724         header's processor-specific flags.
5725         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5726         Input_objects pointer type parameter.
5727         * sparc.cc (Target_sparc::do_finalize_sections): Same.
5728         * target.h (Input_objects): New forward class declaration.
5729         (Target::processor_specific_flags,
5730         Target::are_processor_specific_flags_sect): New method definitions.
5731         (Target::finalize_sections): Add input_objects parameter.
5732         (Target::Target): Initialize processor_specific_flags_ and
5733         are_processor_specific_flags_set_.
5734         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5735         parameter.
5736         (Target::set_processor_specific_flags): New method definition.
5737         (Target::processor_specific_flags_,
5738         Target::are_processor_specific_flags_set_): New data member
5739         declarations.
5740         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5741         Input_objects pointer type parameter.
5742
5743 2009-10-30  Doug Kwan  <dougkwan@google.com>
5744
5745         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5746
5747 2009-10-28  Ian Lance Taylor  <iant@google.com>
5748
5749         * object.h (class Relobj): Drop options parameter from
5750         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5751         do_scan_relocs, do_relocate.  Change all callers.
5752         (class Sized_relobj): Drop options parameters from
5753         do_gc_process_relocs, do_scan_relocs, do_relocate,
5754         do_relocate_sections, relocate_sections, emit_relocs_scan,
5755         emit_relocs_scan_reltype.  Change all callers.
5756         (struct Relocate_info): Remove options field and all references to
5757         it.
5758         * reloc.h (class Read_relocs): Remove options constructor
5759         parameter and options_ field.  Change all callers.
5760         (class Gc_process_relocs, class Scan_relocs): Likewise.
5761         (class Relocate_task): Likewise.
5762         * target-reloc.h (scan_relocs): Remove options parameter.  Change
5763         all callers.
5764         (scan_relocatable_relocs): Likewise.
5765         * target.h (class Sized_target): Remove options parameter from
5766         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
5767         all callers.
5768         * gc.h (gc_process_relocs): Remove options parameter.  Change all
5769         callers.
5770         * arm.cc: Update functions to remove options parameters.
5771         * i386.cc: Likewise.
5772         * powerpc.cc: Likewise.
5773         * sparc.cc: Likewise.
5774         * x86_64.cc: Likewise.
5775         * testsuite/testfile.cc: Likewise.
5776
5777 2009-10-28  Doug Kwan  <dougkwan@google.com>
5778
5779         * arm.cc (Arm_relobj): New class definition.
5780         (Arm_relobj::scan_sections_for_stubs,
5781         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5782         New method definitions.
5783
5784 2009-10-28  Cary Coutant  <ccoutant@google.com>
5785
5786         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5787         (Plugin::cleanup_done_): New member.
5788         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5789         (Plugin_manager::cleanup_done_): Remove.
5790         (Plugin_manager::add_input_file): Edit error message.
5791         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5792         (Plugin_manager::cleanup): Remove use of cleanup_done_.
5793
5794 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
5795
5796         * fileread.cc: (File_read::View::~View): Use the new
5797         data_ownership_ filed.
5798         (File_read::~File_read): Dispose the new whole_file_view_.
5799         (File_read::open): Mmap the whole file if needed.
5800         (File_read::open): Use whole_file_view_ instead of contents_.
5801         (File_read::find_view): Use whole_file_view_ if applicable.
5802         (File_read::do_read): Use whole_file_view_ instead of contents_.
5803         (File_read::make_view): Use whole_file_view_ instead of contents_,
5804         update File_read::View::View call.
5805         (File_read::find_or_make_view): Update File_read::View::View
5806         call.
5807         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5808         remove contents_
5809         (File_read::View::Data_ownership): New enum.
5810         (File_read::View::View): Replace bool mapped_ with Data_ownership
5811         argument.
5812         (File_read::View::mapped_): Remove (replaced by data_ownership_).
5813         (File_read::View::data_ownership_): New field.
5814         (File_read::contents_): Remove (replaced by whole_file_view_).
5815         (File_read::whole_file_view_): New field.
5816         * options.h (class General_options): Add --keep-files-mapped.
5817
5818 2009-10-27  Cary Coutant  <ccoutant@google.com>
5819
5820         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5821         * testsuite/Makefile.am (plugin_test_5): New test case.
5822         * testsuite/Makefile.in: Regenerate.
5823
5824 2009-10-25  Doug Kwan  <dougkwan@google.com>
5825
5826         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5827         from private to protected to allow access by child class.
5828         (Sized_relobj::do_relocate_sections): New method declaration.
5829         (Sized_relobj::relocate_sections): Virtualize.
5830         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5831         Sized_relobj::relocate_sections.  Instantiate template explicitly
5832         for different target sizes and endianity.
5833
5834 2009-10-24  Doug Kwan  <dougkwan@google.com>
5835
5836         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5837         (Arm_input_section::as_arm_input_section): New method.
5838         (Arm_output_section): New class definition.
5839         (Arm_output_section::create_stub_group,
5840         Arm_output_section::group_sections): New method definitions.
5841
5842 2009-10-22  Doug Kwan  <dougkwan@google.com>
5843
5844         * arm.cc (Arm_input_section): New class definition.
5845         (Arm_input_section::init, Arm_input_section:do_write,
5846         Arm_input_section::set_final_data_size,
5847         Arm_input_section::do_reset_address_and_file_offset): New method
5848         definitions.
5849
5850 2009-10-21  Doug Kwan  <dougkwan@google.com>
5851
5852         * arm.cc (Stub_table, Arm_input_section): New forward class
5853         declarations.
5854         (Stub_table): New class defintion.
5855         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5856         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5857         New method definition.
5858
5859 2009-10-21  Doug Kwan  <dougkwan@google.com>
5860
5861         * arm.cc: Update copyright comments.
5862         (Target_arm): New forward class template declaration.
5863         (Arm_address): New type.
5864         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5865         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5866         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5867         constants.
5868         (Insn_template): Same.
5869         (DEF_STUBS): New macro.
5870         (Stub_type): New enum type.
5871         (Stub_template): New class definition.
5872         (Stub): Same.
5873         (Reloc_stub): Same.
5874         (Stub_factory): Same.
5875         (Target_arm::Target_arm): Initialize may_use_blx_ and
5876         should_force_pic_veneer_.
5877         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5878         Target_arm::should_force_pic_veneer,
5879         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5880         Target_arm::using_thumb_only, Target_arm:;default_target): New
5881         method defintions.
5882         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5883         New data member declarations.
5884         (Insn_template::size, Insn_template::alignment): New method defintions.
5885         (Stub_template::Stub_template): New method definition.
5886         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5887         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5888         (Stub_factory::Stub_factory): New method definition.
5889         * gold.h (string_hash): New template.
5890         * output.h (Input_section_specifier::hash_value): Use
5891         gold::string_hash.
5892         (Input_section_specifier::string_hash): Remove.
5893         * stringpool.cc (Stringpool_template::string_hash): Use
5894         gold::string_hash.
5895
5896 2009-10-20  Doug Kwan  <dougkwan@google.com>
5897
5898         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5899         symbols of relaxed input sections.
5900         * output.h (Output_section::find_relaxed_input_section): Make
5901         method public.
5902
5903 2009-10-16  Doug Kwan  <dougkwan@google.com>
5904
5905         * dynobj.cc (Versions::Versions): Initialize version_script_.
5906         Only insert base version symbol definition for a shared object
5907         if version script defines any version versions.
5908         (Versions::define_base_version): New method definition.
5909         (Versions::add_def): Check that base version is not needed.
5910         (Versions::add_need): Define base version lazily.
5911         * dynobj.h (Versions::define_base_version): New method declaration.
5912         (Versions::needs_base_version_): New data member declaration.
5913         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5914         (check_DATA): Add no_version_test.stdout.
5915         (libno_version_test.so, no_version_test.o no_version_test.stdout):
5916         New make rules.
5917         * testsuite/Makefile.in: Regenerate.
5918         * testsuite/no_version_test.c: New file.
5919         * testsuite/no_version_test.sh: Ditto.
5920
5921 2009-10-16  Doug Kwan  <dougkwan@google.com>
5922
5923         * expression.cc (class Segment_start_expression): New class definition.
5924         (Segment_start_expression::value): New method definition.
5925         (script_exp_function_segment_start): Return a new
5926         Segment_start_expression.
5927         * gold/script-c.h (script_saw_segment_start_expression): New function
5928         prototype.
5929         * script-sections.cc (Script_sections::Script_sections): Initialize
5930         SAW_SEGMENT_START_EXPRESSION_ to false.
5931         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5932         and -Tbbs options to specify section addresses if given in
5933         command line and no SEGMENT_START expression is seen in a script.
5934         * script-sections.h (Script_sections::saw_segment_start_expression,
5935         Script_sections::set_saw_segment_start_expression): New method
5936         definition.
5937         (Script_sections::saw_segment_start_expression_): New data member
5938         declaration.
5939         * script.cc (script_saw_segment_start_expression): New function.
5940         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5941         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5942         script_test_7.sh and script_test_8.sh.
5943         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5944         script_test_8.stdout.
5945         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5946         (script_test_6, script_test_6.stdout, script_test_7,
5947         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5948         * Makefile.in: Regenerate.
5949         * testsuite/script_test_6.sh: New file.
5950         * testsuite/script_test_6.t: Same.
5951         * testsuite/script_test_7.sh: Same.
5952         * testsuite/script_test_7.t: Same.
5953         * testsuite/script_test_8.sh: Same.
5954
5955 2009-10-16  Doug Kwan  <dougkwan@google.com>
5956
5957         * output.cc (Output_segment::set_section_list_address): Cast
5958         expressions to unsigned long long type to avoid format warnings.
5959
5960 2009-10-15  Ian Lance Taylor  <iant@google.com>
5961
5962         * script.cc (Script_options::add_symbol_assignment): Always add a
5963         dot assignment to script_sections_.
5964         * script-sections.cc (Script_sections::add_dot_assignment):
5965         Initialize if necessary.
5966
5967         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5968         program headers with no load segment if there is a linker script.
5969
5970         * layout.cc (Layout::set_segment_offsets): Align the file offset
5971         to the segment aligment for -N or -n with no load segment.
5972         * output.cc (Output_segment::add_output_section): Don't crash if
5973         the first section is a TLS section.
5974         (Output_segment::set_section_list_addresses): Print an error
5975         message if the address moves backward in a linker script.
5976         * script-sections.cc
5977         (Output_section_element_input::set_section_addresses): Don't
5978         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5979         (Orphan_output_section::set_section_addresses): Likewise.
5980
5981 2009-10-15  Doug Kwan  <dougkwan@google.com>
5982
5983         * layout.cc (Layout::finish_dynamic_section): Generate tags
5984         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5985         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5986         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5987
5988 2009-10-14  Ian Lance Taylor  <iant@google.com>
5989
5990         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5991         fields.
5992         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5993         data_shdr fields of relinfo.
5994         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5995         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
5996         R_386_TLS_LDO_32, adjust based on section flags.
5997         (Target_i386::Relocate::fix_up_ldo): Remove.
5998
5999 2009-10-13  Ian Lance Taylor  <iant@google.com>
6000
6001         Add support for -pie.
6002         * options.h (class General_options): Add -pie and
6003         --pic-executable.
6004         (General_options::output_is_position_independent): Test -pie.
6005         (General_options::output_is_executable): Return true if not shared
6006         and not relocatable.
6007         (General_options::output_is_pie): Remove.
6008         * options.cc (General_options::finalize): Reject incompatible uses
6009         of -pie.
6010         * gold.cc (queue_middle_tasks): A -pie link is not static.
6011         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6012         * symtab.cc (Symbol::final_value_is_known): Return false if
6013         output_is_position_independent.
6014         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6015         output_is_position_independent.
6016         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6017         output_is_position_independent.
6018         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6019         output_is_position_independent.
6020         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6021         two_file_pie_test.
6022         (basic_pie_test.o, basic_pie_test): New targets.
6023         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6024         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6025         (two_file_pie_test): New target.
6026         * testsuite/Makefile.in: Rebuild.
6027         * README: Remove note saying that -pie is not supported.
6028
6029 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
6030
6031         * options.h (class General_options): Add -init and -fini.
6032         * layout.cc (Layout::finish_dynamic_section): Emit
6033         given init and fini functions.
6034
6035 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
6036
6037         * gc.h (gc_process_relocs): Check if icf is enabled using new
6038         function.
6039         * gold.cc (queue_initial_tasks): Likewise.
6040         (queue_middle_tasks): Likewise.
6041         * object.cc (do_layout): Likewise.
6042         * symtab.cc (is_section_folded): Likewise.
6043         * main.cc (main): Likewise.
6044         * reloc.cc (Read_relocs::run): Likewise.
6045         (Sized_relobj::do_scan_relocs): Likewise.
6046         * icf.cc (is_function_ctor_or_dtor): New function.
6047         (Icf::find_identical_sections): Check if function is ctor or dtor when
6048         safe icf is chosen.
6049         * options.h (General_options::icf): Change option to be an enum.
6050         (Icf_status): New enum.
6051         (icf_enabled): New method.
6052         (icf_safe_folding): New method.
6053         (set_icf_status): New method.
6054         (icf_status_): New variable.
6055         * (options.cc) (General_options::finalize): Set icf_status_.
6056         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6057         icf_test and icf_keep_unique_test to use the --icf enum flag.
6058         * testsuite/icf_safe_test.sh: New file.
6059         * testsuite/icf_safe_test.cc: New file.
6060
6061 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
6062
6063         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6064         includes to gc.h and icf.h.
6065         * arm.cc: Include gc.h.
6066         * gold.cc: Likewise.
6067         * i386.cc: Likewise.
6068         * powerpc.cc: Likewise.
6069         * sparc.cc: Likewise.
6070         * x86_64.cc: Likewise.
6071         * gc.h: Include icf.h.
6072
6073 2009-10-11  Ian Lance Taylor  <iant@google.com>
6074
6075         * plugin.cc: Include "gold.h" before other header files.
6076
6077 2009-10-10  Chris Demetriou  <cgd@google.com>
6078
6079         * options.h (Input_file_argument::Input_file_type): New enum.
6080         (Input_file_argument::is_lib_): Replace with...
6081         (Input_file_argument::type_): New member.
6082         (Input_file_argument::Input_file_argument): Take Input_file_type
6083         'type' rather than boolean 'is_lib' as second argument.
6084         (Input_file_argument::is_lib): Use type_.
6085         (Input_file_argument::is_searched_file): New function.
6086         (Input_file_argument::may_need_search): Handle is_searched_file.
6087         * options.cc (General_options::parse_library): Support -l:filename.
6088         (General_options::parse_just_symbols): Update for Input_file_argument
6089         changes.
6090         (Command_line::process): Likewise.
6091         * archive.cc (Archive::get_file_and_offset): Likewise.
6092         * plugin.cc (Plugin_manager::release_input_file): Likewise.
6093         * script.cc (read_script_file, script_add_file): Likewise.
6094         * fileread.cc (Input_file::Input_file): Likewise.
6095         (Input_file::will_search_for): Handle is_searched_file.
6096         (Input_file::open): Likewise.
6097         * readsyms.cc (Read_symbols::get_name): Likewise.
6098         * testsuite/Makefile.am (searched_file_test): New test.
6099         * testsuite/Makefile.in: Regenerate.
6100         * testsuite/searched_file_test.cc: New file.
6101         * testsuite/searched_file_test_lib.cc: New file.
6102
6103 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6104             Ian Lance Taylor  <iant@google.com>
6105
6106         * descriptor.cc: Include <cstdio> and "binary-io.h".
6107         (Descriptors::open): Open the files in binary mode always.
6108         * script.cc (Lex::get_token): Treat \r as whitespace.
6109
6110 2009-10-09  Ian Lance Taylor  <iant@google.com>
6111
6112         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6113
6114 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6115             Ian Lance Taylor  <iant@google.com>
6116
6117         * configure.ac: Check for readv function also.
6118         * fileread.cc (readv): Define if not HAVE_READV.
6119         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6120         does not exist.
6121         * config.in: Regenerate.
6122         * configure: Regenerate.
6123
6124 2009-10-09  Doug Kwan  <dougkwan@google.com>
6125
6126         * layout.cc (Layout::make_output_section): Call target hook to make
6127         ordinary output section.
6128         (Layout::finalize): Adjust parameter list of call the
6129         Target::may_relax().
6130         * layout.h (class Layout::section_list): New method.
6131         * merge.h (Output_merge_base::entsize): Change visibility to public.
6132         (Output_merge_base::is_string, Output_merge_base::do_is_string):
6133         New methods.
6134         (Output_merge_string::do_is_string): New method.
6135         * object.cc (Sized_relobj::do_setup): renamed from
6136         Sized_relobj::set_up.
6137         * object.h (Sized_relobj::adjust_shndx,
6138         Sized_relobj::initializ_input_to_output_maps,
6139         Sized_relobj::free_input_to_output_maps): Change visibilities to
6140         protected.
6141         (Sized_relobj::setup): Virtualize.
6142         (Sized_relobj::do_setup): New method declaration.
6143         (Sized_relobj::invalidate_section_offset,
6144         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6145         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6146         * options.cc (parse_int): New function.
6147         * options.h (parse_int): New declaration.
6148         (DEFINE_int): New macro.
6149         (stub_group_size): New option.
6150         * output.cc (Output_section::Output_section): Initialize memebers
6151         merge_section_map_, merge_section_by_properties_map_,
6152         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6153         (Output_section::add_input_section): Handled deferred code-fill
6154         generation and remove an old comment.
6155         (Output_section::add_relaxed_input_section): New method definition.
6156         (Output_section::add_merge_input_section): Use merge section by
6157         properties map to speed to search.  Update merge section maps
6158         as appropriate.
6159         (Output_section::build_relaxation_map): New method definition.
6160         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6161         Same.
6162         (Output_section::relax_input_section): Renamed to
6163         Output_section::convert_input_sections_to_relaxed_sections and change
6164         interface to take a vector of pointers to relaxed sections.
6165         (Output_section::find_merge_section,
6166         Output_section::find_relaxed_input_section): New method definitions.
6167         (Output_section::is_input_address_mapped,
6168         Output_section::output_offset, Output_section::output_address):
6169         Use output section data maps to speed up searching.
6170         (Output_section::find_starting_output_address): Add comments.
6171         (Output_section::do_write,
6172         Output_section::write_to_postprocessing_buffer): Do code-fill
6173         generation as appropriate.
6174         (Output_section::get_input_sections): Invalidate relaxed input section
6175         map.
6176         (Output_section::restore_states): Adjust type of checkpoint .
6177         Invalidate relaxed input section map.
6178         * output.h (Output_merge_base): New class declaration.
6179         (Input_section_specifier): New class defintion.
6180         (class Output_relaxed_input_section) Change base class to
6181         Output_section_data_build.
6182         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6183         base class initializer.
6184         (Output_section::add_relaxed_input_section): New method declaration.
6185         (Output_section::Input_section): Change visibility to protected.
6186         (Output_section::Input_section::relobj,
6187         Output_section::Input_section::shndx): Handle relaxed input sections.
6188         Output_section::input_sections) Change visibility to protected.  Also
6189         define overload to return a non-const pointer.
6190         (Output_section::Merge_section_properties): New class defintion.
6191         (Output_section::Merge_section_by_properties_map,
6192         Output_section::Output_section_data_by_input_section_map,
6193         Output_section::Relaxation_map): New types.
6194         (Output_section::relax_input_section): Rename method to
6195         Output_section::convert_input_sections_to_relaxed_sections and change
6196         interface to take a vector of relaxed section pointers.
6197         (Output_section::find_merge_section,
6198         Output_section::find_relaxed_input_section,
6199         Output_section::build_relaxation_map,
6200         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6201         New method declarations.
6202         (Output_section::merge_section_map_
6203         Output_section::merge_section_by_properties_map_,
6204         Output_section::relaxed_input_section_map_,
6205         Output_section::is_relaxed_input_section_map_valid_,
6206         Output_section::generate_code_fills_at_write_): New data members.
6207         * script-sections.cc
6208         (Output_section_element_input::set_section_addresses): Call
6209         current_data_size and addralign methods of relaxed input sections.
6210         (Orphan_output_section::set_section_addresses): Call current_data_size
6211         and addralign methods of relaxed input sections.
6212         * symtab.cc (Symbol_table::compute_final_value): Extract template
6213         from the body of Symbol_table::sized_finalize_symbol.
6214         (Symbol_table::sized_finalized_symbol): Call
6215         Symbol_table::compute_final_value.
6216         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6217         (Symbol_table::compute_final_value): New templated method declaration.
6218         * target.cc (Target::do_make_output_section): New method defintion.
6219         * target.h (Target::make_output_section): New method declaration.
6220         (Target::relax): Add more parameters for input objects, symbol table
6221         and layout.  Adjust call to do_relax.
6222         (Target::do_make_output_section): New method declaration.
6223         (Target::do_relax): Add parameters for input objects, symbol table
6224         and layout.
6225
6226 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6227
6228         * pread.c: Include stdio.h.
6229
6230 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6231
6232         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6233         defined.
6234
6235 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6236
6237         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6238         Change read_shndx type to unsigned int.
6239         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6240         int.
6241         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6242         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6243         Change read_shndx type to unsigned int.
6244         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6245         int.
6246         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6247         * layout.cc (Layout::create_symtab_sections): Cast the result of
6248         local_symcount * symsize to off_t in the gold_assert.
6249
6250 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6251
6252         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6253         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6254         R_ARM_BASE_ABS.
6255         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6256         (Arm_relocate_functions::thm_abs5): New function.
6257         (Arm_relocate_functions::abs12): New function.
6258         (Arm_relocate_functions::abs16): New function.
6259         (Arm_relocate_functions::base_abs): New function.
6260         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6261         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6262         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6263         R_ARM_BASE_ABS.
6264         (Scan::global): Likewise.
6265         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6266         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6267         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6268         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6269         R_ARM_BASE_ABS.
6270
6271 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6272
6273         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6274         (Arm_relocate_functions::movt_prel): New function.
6275         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6276         (Arm_relocate_functions::thm_movt_prel): New function.
6277         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6278         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6279         (Scan::global, Relocate::relocate): Likewise.
6280         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6281
6282 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6283
6284         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6285         Incremental_checker.
6286         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6287         unsigned int.
6288         (class Incremental_inputs_header): New class.
6289         (Incremental_inputs_header_writer): Edit comment.
6290         (Incremental_inputs_entry): New class.
6291         (Incremental_inputs_entry_writer): Edit comment.
6292         (Sized_incremental_binary::do_find_incremental_inputs_section):
6293         Add *strtab_shndx parameter, fill it.
6294         (Sized_incremental_binary::do_check_inputs): New method.
6295         (Incremental_checker::can_incrementally_link_output_file): Use
6296         Sized_incremental_binary::check_inputs.
6297         (Incremental_inputs::report_command_line): Save command line in
6298         command_line_.
6299         * incremental.h:
6300         (Incremental_binary::find_incremental_inputs_section): New
6301         method.
6302         (Incremental_binary::do_find_incremental_inputs_section): Add
6303         strtab_shndx parameter.
6304         (Incremental_binary::do_check_inputs): New pure virtual method.
6305         (Sized_incremental_binary::do_check_inputs): Declare.
6306         (Incremental_checker::Incremental_checker): Add incremental_inputs
6307         parameter, use it to initialize incremental_inputs_.
6308         (Incremental_checker::incremental_inputs_): New field.
6309         (Incremental_checker::command_line): New method.
6310         (Incremental_checker::inputs): New method.
6311         (Incremental_checker::command_line_): New field.
6312
6313 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6314
6315         * incremental.cc: Include <cstdarg> and "target-select.h".
6316         (vexplain_no_incremental): New function.
6317         (explain_no_incremental): New function.
6318         (Incremental_binary::error): New method.
6319         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6320         method.
6321         (make_sized_incremental_binary): New function.
6322         (open_incremental_binary): New function.
6323         (can_incrementally_link_file): Add checks if output is ELF and has
6324         inputs section.
6325         * incremental.h: Include "elfcpp_file.h" and "output.h".
6326         (Incremental_binary): New class.
6327         (Sized_incremental_binary): New class.
6328         (open_incremental_binary): Declare.
6329         * object.cc (is_elf_object): Use
6330         elfcpp::Elf_recognizer::is_elf_file.
6331         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6332         * output.h (Output_file::filesize): New method.
6333
6334 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6335
6336         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6337         New function.
6338         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6339         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6340         function.
6341         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6342         function.
6343         (Arm_relocate_functions::movw_abs_nc): New function.
6344         (Arm_relocate_functions::movt_abs): New function.
6345         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6346         (Arm_relocate_functions::thm_movt_abs): New function.
6347         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6348         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6349         (Scan::global): Likewise.
6350         (Relocate::relocate): Likewise.
6351         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6352
6353 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6354
6355         * arm.cc (Arm_relocate_functions::got_prel) New function.
6356         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6357         (Relocate::relocate): Likewise.
6358         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6359
6360 2009-10-06  Ian Lance Taylor  <iant@google.com>
6361
6362         * options.h (class General_options): Define
6363         split_stack_adjust_size parameter.
6364         * object.h (class Object): Add uses_split_stack_ and
6365         has_no_split_stack_ fields.  Add uses_split_stack and
6366         has_no_split_stack accessor functions.  Declare
6367         handle_split_stack_section.
6368         (class Reloc_symbol_changes): Define.
6369         (class Sized_relobj): Define Function_offsets.  Declare
6370         split_stack_adjust, split_stack_adjust_reltype, and
6371         find_functions.
6372         * object.cc (Object::handle_split_stack_section): New function.
6373         (Sized_relobj::do_layout): Call handle_split_stack_section.
6374         * dynobj.cc (Sized_dynobj::do_layout): Call
6375         handle_split_stack_section.
6376         * reloc.cc (Sized_relobj::relocate_sections): Call
6377         split_stack_adjust for executable sections in split_stack
6378         objects.  Pass reloc_map to relocate_section.
6379         (Sized_relobj::split_stack_adjust): New function.
6380         (Sized_relobj::split_stack_adjust_reltype): New function.
6381         (Sized_relobj::find_functions): New function.
6382         * target-reloc.h: Include "object.h".
6383         (relocate_section): Add reloc_symbol_changes parameter.  Change
6384         all callers.
6385         * target.h (class Target): Add calls_non_split method.  Declare
6386         do_calls_non_split virtual method.  Declare match_view and
6387         set_view_to_nop.
6388         * target.cc: Include "elfcpp.h".
6389         (Target::do_calls_non_split): New function.
6390         (Target::match_view): New function.
6391         (Target::set_view_to_nop): New function.
6392         * gold.cc (queue_middle_tasks): Give an error if mixing
6393         split-stack and non-split-stack objects with -r.
6394         * i386.cc (Target_i386::relocate_section): Add
6395         reloc_symbol_changes parameter.
6396         (Target_i386::do_calls_non_split): New function.
6397         * x86_64.cc (Target_x86_64::relocate_section): Add
6398         reloc_symbol_changes parameter.
6399         (Target_x86_64::do_calls_non_split): New function.
6400         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6401         parameter.
6402         * powerpc.cc (Target_powerpc::relocate_section): Add
6403         reloc_symbol_changes parameter.
6404         * sparc.cc (Target_sparc::relocate_section): Add
6405         reloc_symbol_changes parameter.
6406         * configure.ac: Call AM_CONDITIONAL for the default target.
6407         * configure: Rebuild.
6408         * testsuite/Makefile.am (TEST_AS): New variable.
6409         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6410         (check_DATA): Add split_i386 and split_x86_64 files.
6411         (SPLIT_DEFSYMS): Define.
6412         (split_i386_[1234n].o): New targets.
6413         (split_i386_[124]): New targets.
6414         (split_i386_[1234r].stdout): New targets.
6415         (split_x86_64_[1234n].o): New targets.
6416         (split_x86_64_[124]): New targets.
6417         (split_x86_64_[1234r].stdout): New targets.
6418         (MOSTLYCLEANFILES): Add new executables.
6419         * testsuite/split_i386.sh: New file.
6420         * testsuite/split_x86_64.sh: New file.
6421         * testsuite/split_i386_1.s: New file.
6422         * testsuite/split_i386_2.s: New file.
6423         * testsuite/split_i386_3.s: New file.
6424         * testsuite/split_i386_4.s: New file.
6425         * testsuite/split_i386_n.s: New file.
6426         * testsuite/split_x86_64_1.s: New file.
6427         * testsuite/split_x86_64_2.s: New file.
6428         * testsuite/split_x86_64_3.s: New file.
6429         * testsuite/split_x86_64_4.s: New file.
6430         * testsuite/split_x86_64_n.s: New file.
6431         * testsuite/testfile.cc (Target_test): Update relocation_section
6432         function.
6433         * testsuite/Makefile.in: Rebuild.
6434
6435 2009-10-06  Ian Lance Taylor  <iant@google.com>
6436
6437         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6438         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6439         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6440         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6441         the address on ldo_addrs_.
6442         (Target_i386::Relocate::fix_up_ldo): New function.
6443
6444 2009-10-06   Rafael Espindola  <espindola@google.com>
6445
6446         * plugin.cc (add_input_library): New.
6447         (Plugin::load): Add add_input_library to tv.
6448         (Plugin_manager::add_input_file): Add the is_lib argument.
6449         (add_input_file): Update call to Plugin_manager::add_input_file.
6450         (add_input_library): New.
6451         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6452
6453 2009-09-30  Doug Kwan  <dougkwan@google.com>
6454
6455         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6456         symbol and call Symbol::may_need_copy_reloc to determine if
6457         a copy reloc is needed.
6458         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6459         nocopyreloc is given in command line.
6460         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6461         given in command line.
6462         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6463         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6464         of the removed Target_i386::may_need_copy_reloc.
6465         * options.h (copyreloc): New option with default value false.
6466         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6467         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6468         instead of the removed Target_powerpc::may_need_copy_reloc.
6469         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6470         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6471         instead of the removed Target_sparc::may_need_copy_reloc.
6472         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6473         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6474         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6475         instead of the removed Target_x86_64::may_need_copy_reloc.
6476
6477 2009-09-30  Ian Lance Taylor  <iant@google.com>
6478
6479         * object.h (class Object): Remove target_ field, and target,
6480         sized_target, and set_target methods.
6481         (Object::sized_target): Remove.
6482         (class Sized_relobj): Update declarations.  Remove sized_target.
6483         * object.cc (Sized_relobj::setup): Remove target parameter.
6484         Change all callers.
6485         (Input_objects::add_object): Don't do anything with the target.
6486         (make_elf_sized_object): Add punconfigured parameter.  Change all
6487         callers.  Set or test parameter target.
6488         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6489         Change all callers.
6490         * parameters.cc (Parameters::set_target): Change parameter type to
6491         be non-const.
6492         (Parameters::default_target): Remove.
6493         (set_parameters_target): Change parameter type to be non-const.
6494         (parameters_force_valid_target): New function.
6495         (parameters_clear_target): New function.
6496         * parameters.h (class Parameters): Update declarations.  Remove
6497         default_target method.  Add sized_target and clear_target
6498         methods.  Change target_ to be non-const.
6499         (set_parameters_target): Update declaration.
6500         (parameters_force_valid_target): Declare.
6501         (parameters_clear_target): Declare.
6502         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6503         as NULL if we aren't searching.
6504         (Add_symbols::run): Don't check for compatible target.
6505         * fileread.cc (Input_file::open_binary): Call
6506         parameters_force_valid_target.
6507         * gold.cc (queue_middle_tasks): Likewise.
6508         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6509         set_target on object.
6510         * dynobj.h (class Sized_dynobj): Update declarations.
6511         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6512         make_elf_object returns NULL.
6513         (Archive::include_member): Don't check whether object target is
6514         compatible.
6515         * output.cc (Output_section::add_input_section): Get target from
6516         parameters.
6517         (Output_section::relax_input_section): Likewise.
6518         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6519         parameters.
6520         (Sized_relobj::do_scan_relocs): Likewise.
6521         (Sized_relobj::relocate_sections): Likewise.
6522         * resolve.cc (Symbol_table::resolve): Likewise.
6523         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6524         parameter.  Change all callers.
6525         (Symbol_table::add_from_object): Get target from parameters.
6526         (Symbol_table::add_from_relobj): Don't check object target.
6527         (Symbol_table::add_from_dynobj): Likewise.
6528         (Symbol_table::define_special_symbol): Get target from
6529         parameters.
6530         * symtab.h (class Symbol_table): Update declaration.
6531         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6532         parameter.  Change all callers.  Clear parameter target.
6533         (Binary_test): Test target here.
6534         * testsuite/object_unittest.cc (gold_testsuite): Remove
6535         target_test_pointer parameter.  Change all callers.
6536         (Object_test): Test target here.
6537
6538 2009-09-26  Ian Lance Taylor  <iant@google.com>
6539
6540         * testsuite/initpri1.c: Don't try to use constructor priorities if
6541         compiling with gcc before 4.3.
6542
6543 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6544
6545         * testsuite/retain_symbols_file_test.sh (check_present): Change
6546         output file name to retain_symbols_file_test.stdout.
6547         (check_absent): Likewise.
6548
6549 2009-09-18  Craig Silverstein  <csilvers@google.com>
6550
6551         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6552         * options.cc: Include <cerrno> and <fstream>.
6553         (General_options::finalize): Parse -retain-symbols-file tag.
6554         * options.h: New flag.
6555         (General_options): New method should_retain_symbol, new
6556         variable symbols_to_retain.
6557         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6558         should_retain_symbol map.
6559         * testsuite/Makefile.am (retain_symbols_file_test): New test.
6560         * testsuite/Makefile.in: Regenerate.
6561         * testsuite/retain_symbols_file_test.sh: New file.
6562
6563 2009-09-18  Nick Clifton  <nickc@redhat.com>
6564
6565         * po/es.po: Updated Spanish translation.
6566
6567 2009-09-17  Doug Kwan  <dougkwan@google.com>
6568
6569         * debug.h (DEBUG_RELAXATION): New constant.
6570         (DEBUG_ALL): Add DEBUG_RELAXATION.
6571         (debug_string_to_enum): Add relaxation debug option.
6572         * layout.cc
6573         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6574         Layout::Relaxation_debug_check::read_sections,
6575         Layout::Relaxation_debug_check::read_sections): New method definitions.
6576         (Layout::Layout): Initialize data members
6577         record_output_section_data_from_scrips_,
6578         script_output_section_data_list_ and relaxation_debug_check_.
6579         (Layout::save_segments, Layout::restore_segments,
6580         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6581         Layout::relaxation_loop_body): New method definitions.
6582         (Layout::finalize): Support relaxation.  Move section layout code to
6583         Layout::relaxation_loop_body.
6584         (Layout::set_asection_address_from_script): Move code for orphan
6585         section placement out.
6586         (Layout::place_orphan_sections_in_script): New method definition.
6587         * layout.h (Output_segment_headers, Output_file_header):
6588         New forward class declarations.
6589         (Layout::~Layout): Define.
6590         (Layout::new_output_section_data_from_script): New method definition.
6591         (Layout::place_orphan_sections_in_script): New method declaration.
6592         (Layout::Segment_states): New type declaration.
6593         (Layout::save_segments, Layout::restore_segments,
6594         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6595         Layout::relaxation_loop_body): New method declarations.
6596         (Layout::Output_section_data_list): New type declaration.
6597         (Layout::Relaxation_debug_check): New class definition.
6598         (Layout::record_output_section_data_from_script_,
6599         Layout::script_output_section_data_list_, Layout::segment_states_,
6600         Layout::relaxation_debug_check_): New data members.
6601         * output.cc: (Output_section_headers::do_size): New method definition.
6602         (Output_section_headers::Output_section_headers): Move size
6603         computation to Output_section_headers::do_size.
6604         (Output_segment_headers::do_size): New method definition.
6605         (Output_file_header::Output_file_header): Move size computation to
6606         Output_file_header::do_size and call it.
6607         (Output_file_header::do_size): New method definition.
6608         (Output_data_group::Output_data_group): Adjust call to
6609         Output_section_data.
6610         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6611         (Output_symtab_xindex::do_write): Add array bound check.
6612         (Output_section::Input_section::print_to_mapfile): Handle
6613         RELAXED_INPUT_SECTION_CODE.
6614         (Output_section::Output_section): Initialize data member checkpoint_.
6615         (Output_section::~Output_section): Delete checkpoint object pointed
6616         by checkpoint_.
6617         (Output_section::add_input_section): Always add an Input_section if
6618         relaxing.
6619         (Output_section::add_merge_input_section): Add assert.
6620         (Output_section::relax_input_section): New method definition.
6621         (Output_section::set_final_data_size): Set load address to zero for
6622         an unallocated section.
6623         (Output_section::do_address_and_file_offset_have_reset_values):
6624         New method definition.
6625         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6626         Handle relaxed input section.
6627         (Output_section::sort_attached_input_sections): Checkpoint input
6628         section list lazily.
6629         (Output_section::get_input_sections): Change type of input_sections to
6630         list of Simple_input_section pointers.  Checkpoint input section list
6631         lazily.  Also handle relaxed input sections.
6632         (Output_section::add_input_section_for_script): Take a reference to
6633         a Simple_input_section object instead of Relobj pointer and section
6634         index as parameter.  Handle relaxed input sections.
6635         (Output_section::save_states, Output_section::restore_states): New
6636         method definitions.
6637         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6638         (Output_data::is_data_size_fixed): New method definition.
6639         (Output_data::reset_addresss_and_file_offset): Do not reset data size
6640         if it is fixed.
6641         (Output_data::address_and_file_offset_have_reset_values): New method
6642         definition.
6643         (Output_data::do_address_and_file_offset_have_reset_values): New method
6644         definition.
6645         (Output_data::set_data_size): Check that data size is not fixed.
6646         (Output_data::fix_data_size): New method definition.
6647         (Output_data::is_data_size_fixed_): New data member.
6648         (Output_section_headers::set_final_data_size): New method definition.
6649         (Output_section_headers::do_size): New method declaration.
6650         (Output_segment_headers::set_final_data_size): New method definition.
6651         (Output_segment_headers::do_size): New method declaration.
6652         (Output_file_header::set_final_data_size)::New method definition.
6653         (Output_file_header::do_size)::New method declaration.
6654         (Output_section_data::Output_section_data): Add new parameter
6655         is_data_size_fixed and use it to fix data size.
6656         (Output_data_const::Output_data_const): Adjust call to base class
6657         constructor and fix data size.
6658         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6659         base class constructor and fix data size.
6660         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6661         base class constructor and fix data size.
6662         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6663         class constructor and fix data size.
6664         (Output_data_group::set_final_data_size): New method definition.
6665         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6666         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6667         class constructor and fix data size.
6668         (Output_relaxed_input_section): New class definition.
6669         (Output_section::Simple_input_section): New class definition.
6670         (Output_section::get_input_sections): Adjust parameter list.
6671         (Output_section::add_input_section_for_script): Same.
6672         (Output_section::save_states, Output_section::restore_states,
6673         Output_section::do_address_and_file_offset_have_reset_values,
6674         (Output_section::Input_section::Input_section): Handle
6675         RELAXED_INPUT_SECTION_CODE.  Add new overload for
6676         Output_relaxed_input_section.
6677         (Output_section::Input_section::is_input_section,
6678         Output_section::Input_section::set_output_section): Handle relaxed
6679         input section.
6680         (Output_section::Input_section::is_relaxed_input_section,
6681         Output_section::Input_section::output_section_data,
6682         Output_section::Input_section::relaxed_input_section): New method
6683         definitions.
6684         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6685         value.
6686         (Output_section::Input_section::u1_): Update comments.
6687         (Output_section::Input_section::u2_): Add new union member poris.
6688         (Output_section::Checkpoint_output_section): New classs definition.
6689         (Output_section::relax_input_section): New method declaration.
6690         (Output_section::checkpoint_): New data member.
6691         (Output_segment): Update comments.
6692         (Output_segment::Output_segment): Un-privatize copy constructor.
6693         (Output_segment::operator=): Un-privatize.
6694         * script-sections.cc (Output_section_element::Input_section_list):
6695         Change element type to Output_section::Simple_input_section.
6696         (Output_section_element_dot_assignment::set_section_addresses):
6697         Register output section data for relaxation clean up.
6698         (Output_data_exression::Output_data_expression): Adjust call to base
6699         constructor to fix data size.
6700         (Output_section_element_data::set_section_addresses): Register
6701         Output_data_expression object for relaxation clean up.
6702         (struct Input_section_info): Replace Relobj pointer and section index
6703         pair with Output_section::Simple_input_section and Convert struct to a
6704         class.
6705         (Input_section_sorter::operator()): Adjust access to
6706         Input_section_info data member to use accessors.
6707         (Output_section_element_input::set_section_addresses): Use layout
6708         parameter.  Adjust code to use Output_section::Simple_input_section
6709         and Input_secction_info classes.  Register filler for relaxation
6710         clean up.
6711         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6712         and section index pair with Output_section::Simple_input_section
6713         class.  Adjust code accordingly.
6714         (Phdrs_element::release_segment): New method definition.
6715         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6716         segment list.
6717         (Script_sections::release_segments): New method definition.
6718         * gold/script-sections.h (Script_sections::release_segments): New
6719         method declaration.
6720         * gold/target.h (Target::may_relax, Target::relax,
6721         Target::do_may_relax, Target::do_relax): New method definitions.
6722
6723 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6724
6725         * arm.cc (has_signed_unsigned_overflow): New function.
6726         (Arm_relocate_functions::abs8): New function.
6727         (Target_arm::Scan::local): Handle R_ARM_ABS8.
6728         (Target_arm::Scan::global): Likewise.
6729         (Target_arm::relocate::relocate): Likewise.
6730         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6731         Likewise.
6732
6733 2009-09-16  Cary Coutant  <ccoutant@google.com>
6734
6735         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6736         * testsuite/Makefile.in: Regenerate.
6737
6738 2009-09-11  Nick Clifton  <nickc@redhat.com>
6739
6740         * po/gold.pot: Updated by the Translation project.
6741
6742 2009-09-08  Cary Coutant  <ccoutant@google.com>
6743
6744         * output.cc (Output_file::open): Add execute permission to empty file.
6745         * testsuite/Makefile.am (permission_test): New test.
6746         * testsuite/Makefile.in: Regenerate.
6747
6748 2009-09-02  Ian Lance Taylor  <iant@google.com>
6749
6750         * output.cc (Output_file::resize): Call map_no_anonymous rather
6751         than map.
6752
6753 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
6754
6755         * gold.cc: Include "incremental.h".
6756         (queue_initial_tasks): Call Incremental_checker methods.
6757         * incremental.cc: Include "output.h".
6758         (Incremental_checker::can_incrementally_link_output_file): New
6759         method.
6760         * incremental.h (Incremental_checker): New class.
6761
6762         * output.cc (Output_file::open_for_modification): New method.
6763         (Output_file::map_anonymous): Changed return type to bool.  Record
6764         map in base_ field.
6765         (Output_file::map_no_anonymous): New method, broken out of map.
6766         (Output_file::map): Use map_no_anonymous and map_anonymous.
6767         * output.h (class Output_file): Update declarations.
6768
6769 2009-08-24  Cary Coutant  <ccoutant@google.com>
6770
6771         * options.h (Command_line::Pre_options): New class.
6772         (Command_line::pre_options): New member.
6773         * options.cc (gold::options::ready_to_register): New variable.
6774         (One_option::register_option): Do nothing if not registering options.
6775         Assert if same short option registered twice.
6776         (General_options::General_options): Turn off option registration when
6777         done constructing.
6778         (Command_line::Pre_options::Pre_options): New constructor.
6779
6780 2009-08-24  Cary Coutant  <ccoutant@google.com>
6781
6782         * options.h (General_options::no_keep_memory): Remove incorrect
6783         short option.
6784
6785 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6786
6787         * Makefile.am (am__skiplex, am__skipyacc): New.
6788         * Makefile.in: Regenerate.
6789
6790 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6791
6792         * Makefile.am (AM_CPPFLAGS): Renamed from ...
6793         (INCLUDES): ... this.
6794         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6795         (AM_CPPFLAGS): Renamed from ...
6796         (INCLUDE): ... this.
6797         * Makefile.in, testsuite/Makefile.in: Regenerate.
6798
6799         * Makefile.in: Regenerate.
6800         * aclocal.m4: Likewise.
6801         * config.in: Likewise.
6802         * configure: Likewise.
6803         * testsuite/Makefile.in: Likewise.
6804
6805         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6806         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6807         * Makefile.in: Regenerate.
6808         * testsuite/Makefile.in: Regenerate.
6809
6810 2009-08-19  Cary Coutant  <ccoutant@google.com>
6811
6812         * resolve.cc (Symbol_table::resolve): Don't complain about defined
6813         symbols in shared libraries overridden by hidden or internal symbols
6814         in the main program.
6815
6816 2009-08-19  Chris Demetriou  <cgd@google.com>
6817
6818         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6819         checking source file names in error messages.
6820
6821 2009-08-18  Doug Kwan  <dougkwan@google.com>
6822
6823         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6824         an elcpp::Ehdr as parameter.  Adjust call to set_target.
6825         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6826         an elfcpp::Ehdr as parameter.
6827         * object.cc (Object::set_target): Remove the version that looks up
6828         a target and sets it.
6829         (Sized_relobj::setup): Take a Target object instead of
6830         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
6831         (make_elf_sized_object): Find target and ask target to
6832         make an ELF object.
6833         * object.h: (Object::set_target): Remove the version that looks up
6834         a target and sets it.
6835         (Sized_relobj::setup): Take a Target object instead of
6836         an elfcpp:Ehdr as parameter.
6837         * target.cc: Include dynobj.h.
6838         (Target::do_make_elf_object_implementation): New.
6839         (Target::do_make_elf_object): New.
6840         * target.h (Target::make_elf_object): New template declaration.
6841         (Target::do_make_elf_object): New method declarations.
6842         (Target::do_make_elf_object_implementation): New template declaration.
6843
6844 2009-08-14  Ian Lance Taylor  <iant@google.com>
6845
6846         * gold.h (FUNCTION_NAME): Define.
6847         (gold_unreachable): Use FUNCTION_NAME.
6848
6849 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
6850
6851         * icf.cc (Icf::find_identical_sections): Issue a warning when a
6852         symbol in the --keep-unique list is not found.
6853
6854 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
6855
6856         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6857         been maked as --keep-unique.
6858         (Icf::unfold_section): New function.
6859         * icf.h (Icf::unfold_section): New function.
6860         * options.h (General_options::keep_unique): New option.
6861         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6862         * testsuite/Makefile.in: Regenerate.
6863         * testsuite/icf_keep_unique_test.sh: New file.
6864         * testsuite/icf_keep_unique_test.cc: New file.
6865
6866 2009-08-12  Cary Coutant  <ccoutant@google.com>
6867
6868         PR 10471
6869         * resolve.cc (Symbol_table::resolve): Check for references from
6870         dynamic objects to hidden and internal symbols.
6871         * testsuite/Makefile.am (hidden_test.sh): New test.
6872         * testsuite/Makefile.in: Regenerate.
6873         * testsuite/hidden_test.sh: New script.
6874         * testsuite/hidden_test_1.c: New test source.
6875         * testsuite/hidden_test_main.c: New test source.
6876
6877 2009-08-11  Doug Kwan  <dougkwan@google.com>
6878
6879         * arm.cc: Update comments.
6880         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6881         segment to locate the .ARM.exidx section if present.
6882
6883 2009-08-09  Doug Kwan  <dougkwan@google.com>
6884
6885         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6886         patch.
6887
6888 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
6889         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6890         compiler warnings.
6891
6892 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
6893
6894         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6895         valid tls_segment only for non-debug-section relocations.
6896         * testsuite/Makefile.am: Add gc_tls_test.
6897         * testsuite/Makefile.in: Regenerate.
6898         * testsuite/gc_tls_test.cc: New file.
6899         * testsuite/gc_tls_test.sh: New file.
6900
6901 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
6902
6903         * icf.cc: New file.
6904         * icf.h: New file.
6905         * Makefile.am (CCFILES): Add icf.cc.
6906         (HFILES): Add icf.h
6907         * Makefile.in: Regenerate.
6908         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6909         * gc.h (gc_process_relocs): Populate lists used by icf to contain
6910         section, symbol and addend information for the relocs.
6911         * gold.cc (queue_middle_tasks): Call identical code folding.
6912         * gold.h: Add defines for multimap.
6913         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6914         to the call of finalize_local_symbols.
6915         * main.cc (main): Create object of class Icf.
6916         * object.cc (Sized_relobj::do_layout): Allow this function to be
6917         called twice during icf.
6918         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6919         to sections marked as identical by icf.
6920         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6921         when available.
6922         (Sized_relobj::do_section_entsize): New function.
6923         * object.h (Object::section_entsize): New function.
6924         (Object::do_section_entsize): New pure virtual function.
6925         (Relobj::finalize_local_symbols): Add new parameter.
6926         (Relobj::do_section_entsize): New function.
6927         * options.h (General_options::icf): New option.
6928         (General_options::icf_iterations): New option.
6929         (General_options::print_icf_sections): New option.
6930         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6931         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6932         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6933         icf.
6934         * symtab.cc (Symbol_table::is_section_folded): New function.
6935         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
6936         to sections marked as identical by icf.
6937         * symtab.h (Symbol_table::set_icf): New function.
6938         (Symbol_table::icf): New function.
6939         (Symbol_table::is_section_folded): New function.
6940         (Symbol_table::icf_): New data member.
6941         * target-reloc.h (relocate_section): Ignore sections folded by icf.
6942         * testsuite/Makefile.am: Add commands to build icf_test.
6943         * testsuite/Makefile.in: Regenerate.
6944         * testsuite/icf_test.sh: New file.
6945         * testsuite/icf_test.cc: New file.
6946
6947 2009-07-24  Chris Demetriou  <cgd@google.com>
6948
6949         * layout.cc (is_compressible_debug_section): Fix incorrect
6950         comment about compressed section names.
6951
6952 2009-07-20  Ian Lance Taylor  <ian@airs.com>
6953
6954         PR 10419
6955         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6956
6957 2009-07-16  Ian Lance Taylor  <iant@google.com>
6958
6959         PR 10400
6960         * layout.h: #include <map>.
6961         (class Kept_section): Change from struct to class.  Add accessors
6962         and setters.  Add section size to Comdat_group mapping.  Change
6963         Comdat_group to std::map.  Add is_comdat_ field.  Add
6964         linkonce_size field in union.
6965         (class Layout): Update declaration of find_or_add_kept_section.
6966         Don't declare find_kept_object.
6967         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6968         parameter.  Add object, shndx, is_comdat, and is_group_name
6969         parameters.  Change all callers.  Adjust for new Kept_section.
6970         (Layout::find_kept_object): Remove.
6971         * object.cc (Sized_relobj::include_section_group): Update use of
6972         Kept_section.  Rename secnum to shndx.  Only record
6973         Kept_comdat_section if sections are the same size.
6974         (Sized_relobj::include_linkonce_section): Update use of
6975         Kept_section.  Only record Kept_comdat_section if sections are the
6976         same size.  Set size of linkonce section.
6977         (Sized_relobj::map_to_kept_section): Update call to
6978         get_kept_comdat_section.
6979         * object.h (class Sized_relobj): Rename fields in
6980         Kept_comdat_section to drop trailing underscores; change object
6981         field to Relobj*.  Change Kept_comdat_section_table to store
6982         struct rather than pointer.
6983         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6984         Add kept_object and kept_shndx parameters.  Change all callers.
6985         (Sized_relobj::get_kept_comdat_section): Change return type to
6986         bool.  Add kept_object and kept_shndx parameters.  Change all
6987         callers.
6988         * plugin.cc (Pluginobj::include_comdat_group): Update call to
6989         Layout::find_or_add_kept_section.
6990
6991 2009-07-09  Ian Lance Taylor  <iant@google.com>
6992
6993         * merge.cc (Object_merge_map::initialize_input_to_output_map):
6994         Reserve space in the hash table.
6995
6996 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
6997
6998         * fileread.cc (File_read::get_mtime): New method.
6999         * fileread.h (Timespec): New structure.
7000         (File_read::get_mtime): New method.
7001         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7002         Renamed from timestamp_nsec.
7003         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7004         Elf_Xword.
7005         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7006         timestamp_nsec.
7007         (Incremental_inputs::report_archive): Save mtime; style fix.
7008         (Incremental_inputs::report_obejct): Save mtime; style fix.
7009         (Incremental_inputs::report_script): Save mtime; style fix.
7010         (Incremental_inputs::finalize_inputs): Style fix.
7011         (Incremental_inputs::finalize): Style fix.
7012         (Incremental_inputs::create_input_section_data): Store inputs
7013         mtime.
7014         * incremental.h (Incremental_inputs::report_script): Add mtime
7015         argument.
7016         (Incremental_inputs::Input_info::Input_info): Intialize only one
7017         union member.
7018         (Incremental_inputs::Input_info::archive): Move to nameless
7019         union.
7020         (Incremental_inputs::Input_info::obejct): Move to nameless union.
7021         (Incremental_inputs::Input_info::script): Move to nameless union.
7022         (Incremental_inputs::mtime): New field.
7023         * script.cc (read_input_script): Pass file mtime to
7024         Incremental_input.
7025         * script.h (Script_info::inputs): Style fix.
7026
7027 2009-07-01  Ian Lance Taylor  <ian@airs.com>
7028
7029         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7030         instead of 32.
7031
7032 2009-06-24  Ian Lance Taylor  <iant@google.com>
7033
7034         PR 10156
7035         * layout.cc (Layout::choose_output_section): If we find an
7036         existing section, update the flags.
7037         (Layout::create_notes): New function, broken out of
7038         Layout::finalize.
7039         (Layout::finalize): Don't create note sections.
7040         (Layout::create_note): Don't crash if linker script discards
7041         section.
7042         (Layout::create_gold_note): Likewise.
7043         (Layout::create_build_id): Likewise.  Don't set
7044         after_input_sections on the section.
7045         (Layout::create_executable_stack_info): Remove target parameter.
7046         Change caller.
7047         * layout.h (class Layout): Declare create_notes.  Update
7048         declaration of create_executable_stack_info.
7049         * gold.cc (queue_middle_tasks): Call create_notes.
7050         * output.cc (Output_section::update_flags_for_input_section): Move
7051         here from output.h.  If SHF_ALLOC flag is newly set, mark address
7052         invalid.
7053         * output.h (Output_data::mark_address_invalid): New function.
7054         (class Output_section): Only declare, not define,
7055         update_flags_for_input_section.  Remove set_flags.
7056
7057 2009-06-24  Ian Lance Taylor  <iant@google.com>
7058
7059         * script-sections.cc (Output_section_definition::
7060         set_section_addresses): Rename shadowing local load_address to
7061         laddr.
7062
7063 2009-06-24  Ian Lance Taylor  <iant@google.com>
7064
7065         PR 10244
7066         * reloc.cc (relocate_sections): Skip empty relocation sections.
7067
7068 2009-06-23  Ian Lance Taylor  <iant@google.com>
7069
7070         PR 10156
7071         * layout.cc (Layout::create_note): Use choose_output_section
7072         rather than make_output_section.
7073
7074 2009-06-23  Ian Lance Taylor  <iant@google.com>
7075
7076         PR 10237
7077         * options.cc (General_options::parse_V): Set printed_version_.
7078         (General_options::General_options): Initialize printed_version_.
7079         * options.h (class General_options): Add printed_version_ field.
7080         * gold.cc (queue_initial_tasks): If there are no input files,
7081         don't give a fatal error if we printed the version information.
7082         (queue_middle_tasks): If using -r with a shared object, give a
7083         fatal error rather than an ordinary error.
7084
7085 2009-06-23  Ian Lance Taylor  <iant@google.com>
7086
7087         PR 10219
7088         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7089         (Layout::make_output_section): Set have_stabstr_section_ if we see
7090         a .stab*str section.
7091         (Layout::finalize): Call link_stabs_sections.
7092         (Layout::link_stabs_sections): New file.
7093         * layout.h (class Layout): Add have_stabstr_section_ field.
7094         Declare link_stabs_sections.
7095
7096 2009-06-23  Doug Kwan  <dougkwan@google.com>
7097
7098         * Makefile.am (libgold_a_LIBADD): New.
7099         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7100         * Makefile.in: Regenerate.
7101         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7102         * configure: Regenerate.
7103         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7104         * fileread.cc: Include sys/state.h
7105         * gold.h: Declare memmem and strndup if found missing.
7106         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7107
7108 2009-06-23  Ian Lance Taylor  <iant@google.com>
7109
7110         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7111         * configure: Rebuild.
7112
7113 2009-06-23  Ian Lance Taylor  <iant@google.com>
7114
7115         PR 10147
7116         * object.cc (Object::section_contents): Don't try to get a view if
7117         the section has length zero.
7118         (Object::handle_gnu_warning_section): If the section is empty, use
7119         the name of the section as the warning.
7120
7121 2009-06-23  Ian Lance Taylor  <iant@google.com>
7122
7123         PR 10133
7124         * stringpool.h (class Stringpool_template): Add optimize_ field.
7125         (Stringpool_template::set_optimize): New function.
7126         * stringpool.cc (Stringpool_template::Stringpool_template):
7127         Initialize optimize_ field.
7128         (Stringpool_template::set_string_offsets): Test local optimize
7129         fild rather than parameter.
7130         * layout.cc (Layout::Layout): Call set_optimize on the section
7131         name stringpool.
7132
7133 2009-06-22  Ian Lance Taylor  <iant@google.com>
7134
7135         PR 10030
7136         * yyscript.y: Parse TARGET.
7137         * script.cc (script_set_target): New function.
7138         * script-c.h (script_set_target): Declare.
7139         * options.cc (General_options::string_to_object_format): Rename
7140         from string_to_object_format in anonymous namespace.  Change
7141         callers.
7142         * options.h (class General_options): Declare
7143         string_to_object_format.
7144
7145 2009-06-22  Ian Lance Taylor  <iant@google.com>
7146
7147         * script-sections.cc (Script_sections::create_segments): Don't put
7148         program headers in a PT_LOAD segment if -n or -N.
7149
7150 2009-06-22  Ian Lance Taylor  <iant@google.com>
7151
7152         PR 10141
7153         * options.h (class General_options): Add -z lazy and -z now.  Sort
7154         -z options into alphabetical order.
7155         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7156
7157 2009-06-21  Ian Lance Taylor  <iant@google.com>
7158
7159         * layout.cc (Layout::make_output_section): Call
7160         Target::new_output_section.
7161         (Layout::attach_allocated_section_to_segment): Put large section
7162         sections in a separate load segment with the large segment flag
7163         set.
7164         (Layout::segment_precedes): Sort large data segments after other
7165         load segments.
7166         (align_file_offset): New static function.
7167         (Layout::set_segment_offsets): Use align_file_offset.
7168         * output.h (class Output_section): Add is_small_section_ and
7169         is_large_section_ fields.
7170         (Output_section::is_small_section): New function.
7171         (Output_section::set_is_small_section):  New function.
7172         (Output_section::is_large_section): New function.
7173         (Output_section::set_is_large_section): New function.
7174         (Output_section::is_large_data_section): New function.
7175         (class Output_segment): Add is_large_data_segment_ field.
7176         (Output_segment::is_large_data_segment): New function.
7177         (Output_segment::set_is_large_data_segment): New function.
7178         * output.cc (Output_section::Output_section): Initialize new
7179         fields.
7180         (Output_segment::Output_segment): Likewise.
7181         (Output_segment::add_output_section): Add assertion that large
7182         data sections always go in large data segments.  Force small data
7183         sections to the end of the list of data sections.  Force small BSS
7184         sections to the start of the list of BSS sections.  For large BSS
7185         sections to the end of the list of BSS sections.
7186         * symtab.h (class Symbol): Declare is_common_shndx.
7187         (Symbol::is_defined): Check Symbol::is_common_shndx.
7188         (Symbol::is_common): Likewise.
7189         (class Symbol_table): Define enum Commons_section_type.  Update
7190         declarations.  Add small_commons_ and large_commons_ fields.
7191         * symtab.cc (Symbol::is_common_shndx): New function.
7192         (Symbol_table::Symbol_table): Initialize new fields.
7193         (Symbol_table::add_from_object): Put small and large common
7194         symbols in the right list.
7195         (Symbol_table::sized_finalized_symbol): Check
7196         Symbol::is_common_shndx.
7197         (Symbol_table::sized_write_globals): Likewise.
7198         * common.cc (Symbol_table::do_allocate_commons): Allocate new
7199         common symbol lists.  Don't call do_allocate_commons_list if the
7200         list is empty.
7201         (Symbol_table::do_allocate_commons_list): Remove is_tls
7202         parameter.  Add comons_section_type parameter.  Change all
7203         callers.  Handle small and large common symbols.
7204         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7205         Symbol::is_common_shndx.
7206         * resolve.cc (symbol_to_bits): Likewise.
7207         * target.h (Target::small_common_shndx): New function.
7208         (Target::small_common_section_flags): New function.
7209         (Target::large_common_shndx): New function.
7210         (Target::large_common_section_flags): New function.
7211         (Target::new_output_section): New function.
7212         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7213         small_common_section_flags, and large_common_section_flags
7214         fields.
7215         (Target::do_new_output_section): New virtual function.
7216         * arm.cc (Target_arm::arm_info): Initialize new fields.
7217         * i386.cc (Target_i386::i386_info): Likewise.
7218         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7219         Likewise.
7220         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7221         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7222         (Target_x86_64::do_new_output_section): New function.
7223         * configure.ac: Define conditional MCMODEL_MEDIUM.
7224         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7225         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7226         (large_LDFLAGS): Define.
7227         * testsuite/large.c: New file.
7228         * testsuite/testfile.cc (Target_test::test_target_info):
7229         Initialize new fields.
7230         * configure, testsuite/Makefile.in: Rebuild.
7231
7232 2009-06-05  Doug Kwan  <dougkwan@google.com>
7233
7234         * Makefile.am (CCFILES): Add target.cc.
7235         * Makefile.in: Regenerate.
7236         * i386.cc (class Target_i386): Define new virtual method to
7237         override do_is_local_label_name in parent.
7238         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7239         local symbols if --discard-locals or -X is given.
7240         * options.h (class General_options): Declare new options
7241         '--discard-locals' and '-X' for discarding locals.
7242         * target.h (class Target): Define new methods is_local_label_name.
7243         Declare new virtual method do_is_local_label_name.
7244         * target.cc: New file.
7245         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7246         (check_SCRIPTS): Add discard_locals_test.sh.
7247         (check_DATA): Add discard_local_tests.syms.
7248         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7249         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7250         * testsuite/Makefile.in: Regenerate.
7251         * testsuite/discard_locals_test.c: New file.
7252         * testsuite/discard_locals_test.sh: Same.
7253
7254 2009-06-05  Doug Kwan  <dougkwan@google.com>
7255
7256         * object.cc (Sized_relobj::Sized_relobj): Initialize
7257         discarded_eh_frame_shndx_ to -1U.
7258         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7259         section.
7260         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7261         a discarded .eh_frame section.
7262         (Sized_relobj::do_finalize_local_symbols): Ditto.
7263         * object.h (class Sized_relobj): Declare new member
7264         discarded_eh_frame_shndx_.
7265         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7266         (local_labels_test.o, local_labels_test): New rules.
7267         * testsuite/Makefile.in: Regenerate.
7268
7269 2009-06-04  Doug Kwan  <dougkwan@google.com>
7270
7271         * layout.cc (Layout::section_name_mapping): Add mapping for
7272         special ARM sections.
7273
7274 2009-06-03  Doug Kwan  <dougkwan@google.com>
7275
7276         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7277         (utils::has_overflow): Same.
7278
7279 2009-06-03  Ian Lance Taylor  <iant@google.com>
7280
7281         * layout.cc (Layout::section_name_mapping): New array, replacing
7282         Layout::linkonce_mapping.
7283         (Layout::section_name_mapping_count): New variable, replacing
7284         Layout::linkonce_mapping_count.
7285         (Layout::linkonce_output_name): Remove.
7286         (Layout::output_section_name): Rewrite.
7287         * layout.h (class Layout): Rename Linkonce_mapping to
7288         Section_name_mapping, linkonce_mapping to section_name_mapping,
7289         linkonce_mapping_count to section_name_mapping_count.  Don't
7290         declare linkonce_output_name.
7291
7292 2009-06-03  Doug Kwan  <dougkwan@google.com>
7293
7294         * gold/arm.cc (namespace utils): New.
7295         (Target_arm::reloc_is_non_pic): Define new method.
7296         (class Arm_relocate_functions): New.
7297         (Target_arm::Relocate::relocate): Handle relocation types used by
7298         Android.
7299
7300 2009-06-03  Ian Lance Taylor  <iant@google.com>
7301
7302         * arm.cc (Target_arm::scan::global): Use || instead of |.
7303
7304 2009-06-02  Doug Kwan  <dougkwan@google.com>
7305
7306         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7307         issued_non_pic_error_.
7308         (class Target_arm::Scan): Declare new method check_non_pic.
7309         Define new method symbol_needs_plt_entry.
7310         Declare new data member issued_non_pic_error_.
7311         (class Target_arm::Relocate): Declare new method
7312         should_apply_static_reloc.
7313         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7314         (Target_arm::Scan::check_non_pic): Define new method.
7315         (Target_arm::Scan::local): Handle a small subset of reloc types used
7316         by Android.
7317         (Target_arm::Scan::local): Same.
7318         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7319
7320 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7321
7322         * incremental.cc (Incremental_inputs::report_command_line): Filter
7323         out --incremental-* options.
7324
7325 2009-05-29  Doug Kwan  <dougkwan@google.com>
7326
7327         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7328         template class.
7329         (class Target_arm): Update comment.
7330         (Target_arm::Target_arm): Initialize new data members GOT_,
7331         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7332         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7333         and Target_arm::rel_dyn_section.
7334         Declare new_enum Target_arm::Got_type.
7335         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7336         and DYNBSS_.
7337         Update commments for member do_dynsym_value.
7338         (Target_arm::got_size, Target_arm::plt_section,
7339         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7340         new methods inside class defintion.
7341         (Target_arm::got_section): Define new method.
7342         (Target_arm::rel_dyn_section): Same.
7343         (Output_data_plt_arm): New template class.
7344         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7345         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7346         (Output_data_plt_arm::add_entry): Same.
7347         (Output_data_plt_arm::first_plt_entry): Define new
7348         static data member for PLT instruction template.
7349         (Output_data_plt_arm::plt_entry): Same.
7350         (Output_data_plt_arm::do_write): Define new method.
7351         (Target_arm::make_plt_entry): Same.
7352         (Target_arm::do_finalize_sections): Same.
7353         (Target_arm::do_dynsym_value): Same.
7354
7355 2009-05-28  Doug Kwan  <dougkwan@google.com>
7356
7357         * Makefile.am (TARGETSOURCES): Add arm.cc.
7358         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7359         * Makefile.in: Regenerate.
7360         * arm.cc: New file.
7361         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7362
7363 2009-05-26  Doug Kwan  <dougkwan@google.com>
7364
7365         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7366         (General_options::check_excluded_libs): Strip off directories in
7367         archive name before matching like GNU ld does.
7368         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7369         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7370         (exclude_libs_test_LDFLAGS): Add linker option
7371         -Wl,--exclude-libs,libexclude_libs_test_3
7372         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7373         an explicit archive without using -l.
7374         (alt/libexclude_libs_test_3.a): New make rule.
7375         * testsuite/Makefile.in: Regenerate.
7376         * testsuite/exclude_libs_test.c : Declare lib3_default().
7377         (main): Call it.
7378         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7379         * exclude_libs_test_3.c: New file.
7380
7381 2009-05-26  Nick Clifton  <nickc@redhat.com>
7382
7383         * po/id.po: New Indonesian translation.
7384         * po/gold.pot: Updated template file.
7385
7386 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7387
7388         * testsuite/Makefile.am: Add -ffunction-sections to compile
7389         gc_comdat_test files.  Add -Wl,--gc-sections to build
7390         gc_comdat_test.
7391         * testsuite/Makefile.in: Regenerate.
7392         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7393
7394 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7395
7396         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7397         kept comdat section was garbage collected.
7398         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7399         * testsuite/Makefile.in: Regenerate.
7400         * testsuite/gc_comdat_test.sh: New file.
7401         * testsuite/gc_comdat_test_1.cc: New file.
7402         * testsuite/gc_comdat_test_2.cc: New file.
7403
7404 2009-05-19  Doug Kwan  <dougkwan@google.com>
7405
7406         * archive.cc (Archive::Archive): Move constructor from archive.h
7407         to here.  Initialize no_export_.
7408         (Archive::get_elf_object_for_member): Set no_export flag of object.
7409         * archive.h (Archive::Archive): Move constructor body to
7410         archive.cc.
7411         (Archive::no_export): New method.
7412         (Archive::no_export_): New field.
7413         * object.h (Object::Object): Initialize no_export_ to false.
7414         (Object::no_export, Object::set_no_export): New methods.
7415         (Object::no_export_): New field.
7416         * options.cc (General_options::parse_exclude_libs): New method.
7417         (General_options::check_excluded_libs) Same.
7418         * options.h (exclude_libs): New option.
7419         (General_options::check_excluded_libs): New method declaration.
7420         (General_options::excluded_libs_): New field.
7421         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7422         default or protected visibility if an object has no-export flag set.
7423         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7424         (check_SCRIPTS): Add exclude_libs_test.sh.
7425         (check_DATA): Add exclude_libs_test.syms.
7426         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7427         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7428         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7429         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7430         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7431         libexclude_libs_test_2.a): New rules.
7432         * testsuite/Makefile.in: Regenerate.
7433         * testsuite/exclude_libs_test.c: New file.
7434         * testsuite/exclude_libs_test.sh: Ditto.
7435         * testsuite/exclude_libs_test_1.c: Ditto.
7436         * testsuite/exclude_libs_test_2.c: Ditto.
7437
7438 2009-05-15  Ian Lance Taylor  <iant@google.com>
7439
7440         * configure.ac: Check for declarations for cases where libiberty.h
7441         checks HAVE_DECL_xxx.
7442         * configure, config.in: Rebuild.
7443
7444 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7445
7446         * gold.h (Incremental_argument_list): Remove (invalid) forward
7447         declaration.
7448         * incremental.cc (Incremental_inputs::report_achive): New method.
7449         (Incremental_inputs::report_object): New method.
7450         (Incremental_inputs::report_script): New method.
7451         (Incremental_inputs::finalize_inputs): New method.
7452         (Incremental_inputs::finalize): Call finalize_inputs().
7453         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7454         Create inputs entries.
7455         * incremental.h (Incremental_input_type): New enum.
7456         (Incremental_inputs::Incremental_input): Initialize new fields.
7457         (Incremental_inputs::report_inputs): New method.
7458         (Incremental_inputs::report_achive): New method.
7459         (Incremental_inputs::report_object): New method.
7460         (Incremental_inputs::report_script): New method.
7461         (Incremental_inputs::finalize_inputs): New method.
7462         (Incremental_inputs::Input_info): New struct.
7463         (Incremental_inputs::Input_info_map): New typedef.
7464         (Incremental_inputs::lock_): New field.
7465         (Incremental_inputs::Inputs_): New field.
7466         (Incremental_inputs::Inputs_map): New field.
7467         * main.cc (main): Call Incremental_input::report_inputs.
7468         * options.h (Input_argument_list): Typedef moved from
7469         Input_arguments.
7470         (Input_file_group::Files): Remove, use ::Input_argument_list.
7471         (Input_file_group::Input_argument_list): Remove, use
7472         ::Input_argument_list.
7473         * plugin.cc (Plugin_manager::add_input_file): Add error in
7474         incremental build.
7475         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7476         functions.
7477         * script.cc (read_input_script): Call
7478         Incremental_input::report_script.
7479         * script.h (Script_info): New class.
7480
7481 2009-04-27  Ian Lance Taylor  <iant@google.com>
7482
7483         * x86_64.cc (do_adjust_output_section): Set entsize to
7484         plt_entry_size.
7485
7486 2009-04-23  Elliott Hughes  <enh@google.com>
7487
7488         * output.cc (Output_file::close): After short writes, continue
7489         writing from the correct offset in the buffer being written.
7490
7491 2009-04-23  Chris Demetriou  <cgd@google.com>
7492
7493         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7494         * configure: Regenerate.
7495         * config.in: Regenerate.
7496         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7497         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7498
7499 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7500
7501         * incremental.cc (Incremental_inputs_header_data): Renamed from
7502         Incremental_input_header_data.
7503         (Incremental_inputs_header_data::data_size): New field.
7504         (Incremental_inputs_header_data::put_input_file_count): Renamed
7505         from input_file_count.
7506         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7507         from command_line_offset.
7508         (Incremental_inputs_header_data::put_reserved): Renamed from
7509         put_reserved.
7510         (Incremental_inputs_entry_data): Renamed from
7511         Incremental_input_entry_data.
7512         (Incremental_inputs_entry_data::data_size): New field.
7513         (Incremental_inputs::report_command_line): New method.
7514         (Incremental_inputs::finalize): New method.
7515         (Incremental_inputs::create_incremental_inputs_data): New method.
7516         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7517         * incremental.h: New file.
7518         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7519        (Layout::finalize): Create incremental inputs section in
7520         incremental builds.
7521        (Layout::create_incremental_info_sections): New method.
7522         * layout.h (Layout::incremental_inputs): New method.
7523        (Layout::create_incremental_info_sections): New method.
7524        (Layout::incremental_inputs_): New field.
7525         * main.cc (main): Notify Incremental_input of the command line.
7526
7527 2009-04-01  Ian Lance Taylor  <iant@google.com>
7528             Mikolaj Zalewski  <mikolajz@google.com>
7529
7530         * gold.h (reserve_unordered_map): Define, three versions, one for
7531         each version of Unordered_map.
7532         * layout.cc (Layout::Layout): Remove options parameter.  Add
7533         number_of_input_files parameter.  Don't initialize options_.
7534         Initialize number_of_input_files_ and resized_signatures_.  Move
7535         sections_are_attached_.
7536         (Layout::layout_group): Reserve space for group_signatures_.
7537         (Layout::find_or_add_kept_section): Change name parameter to be a
7538         reference.  Resize signatures_ map when it gets large enough.
7539         (Layout::layout_eh_frame): Use parameters->options() instead of
7540         this->options_.
7541         (Layout::make_output_section): Likewise.
7542         (Layout::attach_allocated_section_to_segment): Likewise.
7543         (Layout::finalize, Layout::create_executable_stack): Likewise.
7544         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7545         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7546         * layout.h (class Layout): Update declarations.  Remove options_
7547         field.  Add number_of_input_files_ and resized_signatures_
7548         fields.  Move sections_are_attached_ field.
7549         * main.cc (main): Pass number of input files to Layout
7550         constructor.  Don't pass options.
7551
7552 2009-03-30  Ian Lance Taylor  <iant@google.com>
7553
7554         * ffsll.c (ffsll): Correct implementation.
7555
7556 2009-03-27  Ian Lance Taylor  <iant@google.com>
7557
7558         * ffsll.c: New file.
7559         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7560         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7561         * ftruncate.c (ftruncate): Declare before definition.
7562         * mremap.c (mremap): Likewise.
7563         * pread.c (pread): Likewise.
7564         * configure, Makefile.in, config.in: Rebuild.
7565
7566         * mremap.c: New file.
7567         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7568         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7569         (mremap): Declare if HAVE_MREMAP is not defined.
7570         * configure, Makefile.in, config.in: Rebuild.
7571
7572 2009-03-27  Cary Coutant  <ccoutant@google.com>
7573
7574         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7575         position independent.
7576         * sparc.cc (Target_sparc::check_non_pic): Likewise.
7577         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7578
7579 2009-03-24  Cary Coutant  <ccoutant@google.com>
7580
7581         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7582         an executable.
7583         (needs_dynamic_reloc): Likewise.
7584
7585 2009-03-24  Ian Lance Taylor  <iant@google.com>
7586
7587         * yyscript.y (file_cmd): Recognize EXTERN.
7588         (extern_name_list, extern_name_list_body): New nonterminals.
7589         * script.cc (script_add_extern): Define.
7590         * script-c.h (script_add_extern): Declare.
7591
7592 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
7593
7594         * object.cc (is_elf_object): Define.
7595         * object.h (is_elf_object): Declare.
7596         * archive.cc (Archive::get_elf_object_for_member): Call
7597         is_elf_object.
7598         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7599
7600 2009-03-24  Elliott Hughes  <enh@google.com>
7601
7602         * output.cc (Output_file::map_anonymous): Define.
7603         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
7604         try an anonymous one.  Report the size if the mmap fails.
7605         * output.h (class Output_file): Declare map_anonymous.
7606
7607 2009-03-24  Ian Lance Taylor  <iant@google.com>
7608
7609         * target-select.cc (instantiate_target): Don't acquire the lock if
7610         the instantiated_target_ field has already been set.
7611
7612 2009-03-23  Ian Lance Taylor  <iant@google.com>
7613
7614         * gold-threads.h (class Initialize_lock): Define.
7615         * gold-threads.cc (class Initialize_lock_once): Define.
7616         (initialize_lock_control): New static variable.
7617         (initialize_lock_pointer): New static variable.
7618         (initialize_lock_once): New static function.
7619         (Initialize_lock::Initialize_lock): Define.
7620         (Initialize_lock::initialize): Define.
7621         * target-select.h: Include "gold-threads.h".
7622         (class Target_selector): Add lock_ and initialize_lock_ fields.
7623         Don't define instantiate_target, just declare it.
7624         * target-select.cc (Target_selector::Target_selector): Initialize
7625         new fields.
7626         (Target_selector::instantiate_target): Define.
7627         * descriptors.h: Include "gold-threads.h".
7628         (class Descriptors): Add initialize_lock_ field.
7629         * descriptors.cc (Descriptors::Descriptors): Initialize new
7630         field.
7631         (Descriptors::open): Use initialize_lock_ field
7632         * errors.h (class Errors): Add initialize_lock_ field.
7633         * errors.cc (Errors::Errors): Initialize new field.
7634         (Errors::initialize_lock): Use initialize_lock_ field.
7635         * powerpc.cc (class Target_selector_powerpc): Remove
7636         instantiated_target_ field.  In do_recognize call
7637         instantiate_target rather than do_instantiate_target.  In
7638         do_instantiate_target just allocate a new target.
7639         * sparc.cc (class Target_selector_sparc): Likewise.
7640
7641         * freebsd.h: New file.
7642         * i386.cc: Include "freebsd.h".
7643         (Target_i386): Derive from Target_freebsd rather than
7644         Sized_target.
7645         (Target_selector_i386): Derive from Target_selector_freebsd rather
7646         than Target_selector.
7647         * x86_64.cc: Include "freebsd.h".
7648         (Target_x86_64): Derive from Target_freebsd rather than
7649         Sized_target.
7650         (Target_selector_x86_64): Derive from Target_selector_freebsd
7651         rather than Target_selector.
7652         * target.h (class Target): Add adjust_elf_header and
7653         do_adjust_elf_header.
7654         * output.cc (Output_file_header:: do_sized_write): Call target
7655         adjust_elf_header routine.
7656         * configure.tgt: Set targ_osabi.
7657         * configure.ac: Define GOLD_DEFAULT_OSABI.
7658         * parameters.cc (Parameters::default_target): Pass
7659         GOLD_DEFAULT_OSABI to select_target.
7660         * target-select.h (class Target_selector): Make instantiate_target
7661         protected rather than private.
7662         * Makefile.am (HFILES): Add freebsd.h.
7663         * configure, Makefile.in, config.in: Rebuild.
7664
7665         * merge.cc (do_add_input_section): Correct pend value.  Change
7666         message about last entry not being null terminated from error to
7667         warning.
7668
7669 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
7670
7671         * incremental.cc: New file.
7672         * Makefile.am (CCFILES): Add incremental.cc.
7673         * Makefile.in: Rebuild.
7674
7675 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
7676
7677         * layout.cc (Layout::output_section_name): Preserve names
7678         of '.note.' sections.
7679
7680 2009-03-19  Ian Lance Taylor  <iant@google.com>
7681
7682         * descriptors.cc (Descriptors::open): Check that the options are
7683         valid before using them.
7684
7685 2009-03-18  Ian Lance Taylor  <iant@google.com>
7686
7687         * script-sections.h: Include <list>.
7688         (class Script_sections): Change Sections_elements from std::vector
7689         to std::list.  Typedef public Elements_iterator.  Add
7690         orphan_section_placement_, data_segment_align_start_, and
7691         saw_data_segment_align_ fields.  Remove data_segment_align_index_
7692         field.
7693         * script-sections.cc (class Orphan_section_placement): New class.
7694         (class Sections_element): Add virtual functions is_relro and
7695         orphan_section_init.  Remove virtual function place_orphan_here.
7696         (class Output_section_definition): Add is_relro and
7697         orphan_section_init.  Remove place_orphan_here.
7698         (class Orphan_output_section): Likewise.
7699         (Script_sections::Script_sections): Update for field changes.
7700         (Script_sections::data_segment_align): Set saw_data_segment_align_
7701         and data_segment_align_start_, not data_segment_align_index.
7702         (Script_sections::data_segment_relro_end): Check
7703         saw_data_segment_align_.  Use data_segment_align_start_ rather
7704         than data_segment_align_index_.
7705         (Script_sections::place_orphan): Rewrite to use
7706         Orphan_section_placement.
7707
7708 2009-03-17  Ian Lance Taylor  <iant@google.com>
7709
7710         * archive.cc (Archive::add_symbols): Check for a version attached
7711         to the symbol name in the archive map.
7712         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7713         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7714         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7715         (ver_test_11.a): New target.
7716         * testsuite/Makefile.in: Rebuild.
7717
7718         * configure.ac: Check for chsize and posix_fallocate.  Replace
7719         ftruncate.
7720         * ftruncate.c: New file, from gnulib.
7721         * output.cc (posix_fallocate): Define dummy version if not
7722         HAVE_POSIX_FALLOCATE.
7723         (Output_file::map): Call posix_fallocate rather than lseek and
7724         write.
7725         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7726         * configure, Makefile.in, config.in: Rebuild.
7727
7728 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
7729
7730         * layout.h (Layout::create_note): Add section_name parameter.
7731         * layout.cc (Layout::create_note): Likewise.
7732         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7733
7734 2009-03-17  Ian Lance Taylor  <iant@google.com>
7735
7736         * descriptors.cc: Include "options.h".
7737         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7738         (Descriptors::open): Always use O_CLOEXEC when opening a new
7739         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
7740         then set FD_CLOEXEC.
7741
7742         * sparc.cc (class Target_sparc): Add has_got_section.
7743         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7744         make sure we have a GOT section.
7745
7746         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7747         (Target_sparc::Scan::local): Likewise.
7748         (Target_sparc::Scan::global): Likewise.
7749         (Target_sparc::Relocate::relocate): Likewise.
7750         (Target_sparc::Relocate::relocate_tls): Likewise.
7751
7752         * symtab.cc (Symbol_table::define_default_version): New function,
7753         broken out of add_from_object.
7754         (Symbol_table::add_from_object): Call define_default_version.
7755         (Symbol_table::define_special_symbol): Add resolve_oldsym
7756         parameter.  Change all callers.  If the version for a symbol comes
7757         from a version script, resolve it with the symbol with the same
7758         name with no version.  Also add the symbol without a version if
7759         appropriate.
7760         (do_define_in_output_data): If resolving with oldsym, don't delete
7761         sym.
7762         (do_define_in_output_segment): Likewise.
7763         (do_define_as_constant): Likewise.
7764         * symtab.h (class Symbol_table): Update declarations.
7765
7766 2009-03-13  Ian Lance Taylor  <iant@google.com>
7767
7768         * readsyms.cc (Read_symbols::incompatible_warning): New function.
7769         (Read_symbols::requeue): New function.
7770         (Read_symbols::do_read_symbols): If make_elf_object fails because
7771         the target type is not configured, and the file was searched for,
7772         issue a warning and retry with the next directory.
7773         (Add_symbols::run): If the file has an incompatible format, and
7774         it was searched for, requeue the Read_symbols task.  On error,
7775         release the object.
7776         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
7777         dirindex parameter to constructor.  Change all callers.  Declare
7778         incompatible_warning and requeue.
7779         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7780         input_argument_ and input_group_ fields.  Add them to
7781         constructor.  Change all callers.
7782         (class Read_script): Add dirindex_ field.  Add it to constructor.
7783         Change all callers.
7784         * archive.cc (Archive::setup): Remove input_objects parameter.
7785         Change all callers.
7786         (Archive::get_file_and_offset): Likewise.
7787         (Archive::read_all_symbols): Likewise.
7788         (Archive::read_symbols): Likewise.
7789         (Archive::get_elf_object_for_member): Remove input_objects
7790         parameter.  Add punconfigured parameter.  Change all callers.
7791         (Archive::add_symbols): Change return type to bool.  Check return
7792         value of include_member.
7793         (Archive::include_all_members): Likewise.
7794         (Archive::include_member): Change return type to bool.  Return
7795         false if first included object has incompatible target.  Set
7796         included_member_ field.
7797         (Add_archive_symbols::run): If add_symbols returns false, requeue
7798         Read_symbols task.
7799         * archive.h (class Archive): Add included_member_ field.
7800         Initialize it in constructor.  Add input_file and searched_for
7801         methods.  Update declarations.
7802         (class Add_archive_symbols): Add dirpath_, dirindex_, and
7803         input_argument_ fields.  Add them to constructor.  Change all
7804         callers.
7805         * script.cc: Include "target-select.h".
7806         (class Parser_closure): Add skip_on_incompatible_target_ and
7807         found_incompatible_target_ fields.  Add
7808         skip_on_incompatible_target parameter to constructor.  Change all
7809         callers.  Add methods skip_on_incompatible_target,
7810         clear_skip_on_incompatible_target, found_incompatible_target, and
7811         set_found_incompatible_target.
7812         (read_input_script): Add dirindex parameter.  Change all callers.
7813         If parser finds an incompatible target, requeue Read_symbols
7814         task.
7815         (script_set_symbol): Clear skip_on_incompatible_target in
7816         closure.
7817         (script_add_assertion, script_parse_option): Likewise.
7818         (script_start_sections, script_add_phdr): Likewise.
7819         (script_check_output_format): New function.
7820         * script.h (read_input_script): Update declaration.
7821         * script-c.h (script_check_output_format): Declare.
7822         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7823         (ignore_cmd): Remove OUTPUT_FORMAT.
7824         * fileread.cc (Input_file::Input_file): Add explicit this.
7825         (Input_file::will_search_for): New function.
7826         (Input_file::open): Add pindex parameter.  Change all callers.
7827         * fileread.h (class Input_file): Add input_file_argument method.
7828         Declare will_search_for.  Update declarations.
7829         * object.cc (make_elf_object): Add punconfigured parameter.
7830         Change all callers.
7831         * object.h (class Object): Make input_file public.  Add
7832         searched_for method.
7833         (make_elf_object): Update declaration.
7834         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
7835         restart search.
7836         * dirsearch.h (class Dirsearch): Update declaration.
7837         * options.h (class General_options): Add --warn-search-mismatch.
7838         * parameters.cc (Parameters::is_compatible_target): New function.
7839         * parameters.h (class Parameters): Declare is_compatible_target.
7840         * workqueue.cc (Workqueue::add_blocker): New function.
7841         * workqueue.h (class Workqueue): Declare add_blocker.
7842
7843         * fileread.cc (Input_file::open): Remove options parameter.
7844         Change all callers.
7845         (Input_file::open_binary): Likewise.
7846         * script.cc (read_input_script): Likewise.
7847         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
7848         options parameter from constructor.  Change all callers.
7849         (class Read_script): Likewise.
7850         * fileread.h (class Input_file): Update declarations.
7851         * script.h (read_input_script): Update declaration.
7852
7853 2009-03-10  Nick Clifton  <nickc@redhat.com>
7854
7855         * po/es.po: New Spanish translation.
7856
7857 2009-03-06  Cary Coutant  <ccoutant@google.com>
7858
7859         * options.cc (parse_short_option): Keep dash_z from registering itself.
7860
7861 2009-03-03  Ian Lance Taylor  <iant@google.com>
7862
7863         PR 9918
7864         * target-reloc.h (relocate_section): Pass output_section to
7865         relocate.
7866         * i386.cc (Target_i386::should_apply_static_reloc): Add
7867         output_section parameter.  Change all callers.
7868         (Target_i386::Relocate::relocate): Add output_section parameter.
7869         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7870         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7871         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7872         * testsuite/two_file_shared.sh: New script.
7873         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7874         (check_DATA): Add two_file_shared.dbg.
7875         (two_file_shared.dbg): New target.
7876         * testsuite/Makefile.in: Rebuild.
7877
7878 2009-03-01  Ian Lance Taylor  <iant@google.com>
7879
7880         * configure.ac: Check for byteswap.h.
7881         * configure: Rebuild.
7882         * config.in: Rebuild.
7883
7884 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
7885
7886         * layout.cc (Layout::find_or_add_kept_section): New function.
7887         (Layout::add_comdat): Removed.
7888         * layout.h (struct Kept_section): Move out of class Layout.
7889         Remove trailing underscores from field names.  Add group_sections
7890         field.  Rename group_ field to is_group.  Change all uses.
7891         (class Layout): Declare find_or_add_kept_section, not add_comdat.
7892         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7893         comdat_groups_ field.
7894         (Sized_relobj::include_section_group): Use
7895         find_or_add_kept_section and Kept_section::group_sections.
7896         (Sized_relobj::include_linkonce_section): Likewise.
7897         * object.cc (class Sized_relobj): Don't define Comdat_group or
7898         Comdat_group_table.  Remove find_comdat_group and
7899         add_comdat_group.  Remove comdat_groups_ field.
7900         * plugin.cc (include_comdat_group): Use
7901         Layout::find_or_add_kept_section.
7902
7903 2009-02-28  Ian Lance Taylor  <iant@google.com>
7904
7905         * README: --gc-sections and map files are now supported.  Document
7906         some build requirements.
7907
7908         PR 6992
7909         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7910         relocatable link set the value of the section symbol to zero.
7911         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7912         relocatable link don't include the section address in the local
7913         symbol value.
7914
7915 2009-02-27  Ian Lance Taylor  <iant@google.com>
7916
7917         PR 6811
7918         * options.h (class Search_directory): Add is_system_directory.
7919         (class General_options): Declare is_in_system_directory.
7920         * options.cc (get_relative_sysroot): Make static.
7921         (get_default_sysroot): Make static.
7922         (General_optoins::is_in_system_directory): New function.
7923         * fileread.cc (Input_file::is_in_system_directory): New function.
7924         * fileread.h (class Input_file): Declare is_in_system_directory.
7925         * object.h (class Object): Add is_in_system_directory.
7926         (class Input_objects): Remove system_library_directory_ field.
7927         * object.cc (Input_objects::add_object): Don't set
7928         system_library_directory_.
7929         (input_objects::found_in_system_library_directory): Remove.
7930         * symtab.cc (Symbol_table::write_globals): Remove input_objects
7931         parameter.  Change all callers.
7932         (Symbol_table::sized_write_globals): Likewise.
7933         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7934         Call Object::is_in_system_directory.
7935         * symtab.h (class Symbol_table): Update declarations.
7936
7937         PR 5990
7938         * descriptors.h (Open_descriptor): Add is_on_stack field.
7939         * descriptors.cc (Descriptors::open): If the descriptor is on the
7940         top of the stack, remove it.  Initialize is_on_stack field.
7941         (Descriptors::release): Only add pod to stack if it is not on the
7942         stack already.
7943         (Descriptors::close_some_descriptor): Clear stack_next and
7944         is_on_stack fields.
7945
7946         PR 7091
7947         * output.cc (Output_section::find_starting_output_address): Rename
7948         from starting_output_address; add PADDR parameter; change return
7949         type.
7950         * output.h (class Output_section): Declare
7951         find_starting_output_address instead of starting_output_address.
7952         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7953         section symbol for which we can't find a merge section.
7954
7955         PR 9836
7956         * symtab.cc (Symbol_table::add_from_object): If the visibility is
7957         hidden or internal, force the symbol to be local.
7958         * resolve.cc (Symbol::override_visibility): Define.
7959         (Symbol::override_base): Use override_visibility.
7960         (Symbol_table::resolve): Likewise.
7961         (Symbol::override_base_with_special): Likewise.
7962         (Symbol_table::override_with_special): If the visibility is hidden
7963         or internal, force the symbol to be local.
7964         * symtab.h (class Symbol): Add set_visibility and
7965         override_visibility.
7966         * testsuite/ver_test_1.sh: New file.
7967         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7968         (check_DATA): Add ver_test_1.syms.
7969         (ver_test_1.syms): New target.
7970         * testsuite/Makefile.in: Rebuild.
7971
7972 2009-02-25  Cary Coutant  <ccoutant@google.com>
7973
7974         * layout.cc (Layout::choose_output_section): Don't rename sections
7975         when using a linker script that has a SECTIONS clause.
7976         * Makefile.in: Regenerate.
7977
7978         * testsuite/Makefile.am (script_test_5.sh): New test case.
7979         * testsuite/Makefile.in: Regenerate.
7980         * testsuite/script_test_5.cc: New file.
7981         * testsuite/script_test_5.sh: New file.
7982         * testsuite/script_test_5.t: New file.
7983
7984 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
7985
7986         * archive.cc (Archive::include_member): Update calls to add_symbols.
7987         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7988         the Layout argument.
7989         * dynobj.h (do_add_symbols): Add the Layout argument.
7990         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7991         Layout argument.
7992         * object.h (Object::add_symbols): Add the Layout argument.
7993         (Object::do_add_symbols): Add the Layout argument.
7994         (Sized_relobj::do_add_symbols): Add the Layout argument.
7995         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7996         Unify the two versions.
7997         (Add_plugin_symbols): Remove.
7998         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7999         (Sized_pluginobj::do_add_symbols): Unify the two versions.
8000         (Add_plugin_symbols): Remove.
8001         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8002         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8003         (Add_symbols::run): Make it work with Pulginobj.
8004
8005 2009-02-06  Ian Lance Taylor  <iant@google.com>
8006
8007         * object.cc (Sized_relobj::do_layout): Make info message start
8008         with lower case letter.
8009
8010 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
8011
8012         * binary.cc: Fix file comment.
8013
8014         * options.h (enum Incremental_disposition): Define.
8015         (class General_options): Add new options: --incremental,
8016         --incremental_changed, --incremental_unchanged,
8017         --incremental_unknown.  Add incremental_disposition_ and
8018         implicit_incremental_ fields.
8019         (General_options::incremental_disposition): New function.
8020         (class Position_dependent_options): Add incremental_disposition
8021         option.
8022         (Position_dependent_options::copy_from_options): Set incremental
8023         dispositions.
8024         * options.cc (General_options::parse_incremental_changed): New
8025         function.
8026         (General_options::parse_incremental_unchanged): New function.
8027         (General_options::parse_incremental_unknown): New function.
8028         (General_options::General_options): Initialize new fields
8029         incremental_disposition_ and implicit_incremental_.
8030         (General_options::finalize): Check for uasge of --incremental-*
8031         without --incremental.
8032
8033 2009-02-06  Chris Demetriou  <cgd@google.com>
8034
8035         * gold.h (gold_undefined_symbol): Change to take only a Symbol
8036         pointer and to report location as the file name associated with
8037         the symbol.
8038         (gold_undefined_symbol_at_location): New function to replace the
8039         old gold_undefined_symbol functionality.
8040         * target-reloc.h (relocate_section): Update to use
8041         gold_undefined_symbol_at_location.
8042         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8043         Call gold_undefined_symbol function rather than gold_error.
8044         * errors.h (Errors::undefined_symbol): Take location as a
8045         string, rather than calculating it from a relocation.
8046         * errors.cc (Errors::fatal): Print "fatal error:" before the
8047         formatted message.
8048         (Errors::error, Errors::error_at_location): Print "error: "
8049         before the formatted message.
8050         (Errors::undefined_symbol): Take location as a string, rather
8051         than calculating it from a relocation.
8052         (gold_undefined_symbol_at_location): New function akin to
8053         old gold_undefined_symbol, calculates location from relocation.
8054         (gold_undefined_symbol): Change to take only a Symbol pointer
8055         and to report location as the file name associated with the symbol.
8056         * testsuite/debug_msg.sh: Update for changed error messages.
8057         * testsuite/undef_symbol.sh: Likewise.
8058
8059 2009-02-04  Duncan Sands  <baldrick@free.fr>
8060
8061         PR 9812
8062         * reduced_debug_output.h
8063         (Output_reduced_debug_abbrev_section::failed): Use format for
8064         gold_warning.
8065         (Output_reduced_debug_info_section::faild): Likewise.
8066
8067 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
8068
8069         * script.cc (Lazy_demangler): New class.
8070         (Version_script_info::get_symbol_version_helper): Demangle a
8071         symbol only once.
8072
8073 2009-01-29  Cary Coutant  <ccoutant@google.com>
8074
8075         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8076         to __tls_get_addr.
8077         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8078
8079 2009-01-28  Ian Lance Taylor  <iant@google.com>
8080
8081         * version.cc (version_string): Bump to 1.9.
8082
8083         * gold.h: Include <cstring> and <stdint.h>.
8084         * version.cc: Include <cstdio>.
8085         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8086         warning.
8087         * reduced_debug_output.cc (insert_into_vector): Rename from
8088         Insert_into_vector; change all callers.  Use Swap_unaligned to
8089         avoid aliasing issue; remove union since it is unnecessary.
8090
8091 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
8092
8093         * Makefile.am (CCFILES): Add gc.cc.
8094         (HFILES): Add gc.h.
8095         * Makefile.in: Regenerate.
8096         * gold.cc (Gc_runner): New class.
8097         (queue_initial_tasks): Call garbage collection related tasks
8098         when corresponding options are invoked.
8099         (queue_middle_gc_tasks): New function.
8100         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8101         processed early before laying out sections during garbage collection.
8102         * gold.h (queue_middle_gc_tasks): New function.
8103         (is_prefix_of): Move from "layout.cc".
8104         * i386.cc (Target_i386::gc_process_relocs): New function.
8105         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8106         * main.cc (main): Create object of class "Garbage_collection".
8107         * object.cc (Relobj::copy_symbols_data): New function.
8108         (Relobj::is_section_name_included): New function.
8109         (Sized_relobj::do_layout): Allow this function to be called twice
8110         during garbage collection and defer layout of section during the
8111         first call.
8112         * object.h (Relobj::get_symbols_data): New function.
8113         (Relobj::is_section_name_included): New function.
8114         (Relobj::copy_symbols_data): New function.
8115         (Relobj::set_symbols_data): New function.
8116         (Relobj::get_relocs_data): New function.
8117         (Relobj::set_relocs_data): New function.
8118         (Relobj::is_output_section_offset_invalid): New pure virtual function.
8119         (Relobj::gc_process_relocs): New function.
8120         (Relobj::do_gc_process_relocs): New pure virtual function.
8121         (Relobj::sd_): New data member.
8122         (Sized_relobj::is_output_section_offset_invalid): New function.
8123         (Sized_relobj::do_gc_process_relocs): New function.
8124         * options.h (General_options::gc_sections): Modify to not be a no-op.
8125         (General_options::print_gc_sections): New option.
8126         * plugin.cc (Plugin_finish::run): Remove function call to
8127         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
8128         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8129         * reloc.cc (Read_relocs::run): Add task to process relocs and
8130         determine unreferenced sections when doing garbage collection.
8131         (Gc_process_relocs): New class.
8132         (Sized_relobj::do_gc_process_relocs): New function.
8133         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8134         sections that are garbage collected.
8135         * reloc.h (Gc_process_relocs): New class.
8136         * sparc.cc (Target_sparc::gc_process_relocs): New function.
8137         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8138         symbols whose corresponding sections are garbage collected.
8139         (Symbol_table::Symbol_table): Add new parameter for the garbage
8140         collection object.
8141         (Symbol_table::gc_mark_undef_symbols): New function.
8142         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8143         (Symbol_table::gc_mark_dyn_syms): New function.
8144         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8145         as garbage.
8146         (Symbol_table::add_from_object): Likewise.
8147         (Symbol_table::add_from_relobj): When building shared objects, do not
8148         treat externally visible symbols as garbage.
8149         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8150         table information for static and relocatable links.
8151         * symtab.h (Symbol_table::set_gc): New function.
8152         (Symbol_table::gc): New function.
8153         (Symbol_table::gc_mark_undef_symbols): New function.
8154         (Symbol_table::gc_mark_symbol_for_shlib): New function.
8155         (Symbol_table::gc_mark_dyn_syms): New function.
8156         (Symbol_table::gc_): New data member.
8157         * target.h (Sized_target::gc_process_relocs): New pure virtual
8158         function.
8159         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8160         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8161
8162 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
8163
8164         * options.h (General_options::gc_sections): Define as a no-op for now.
8165         (General_options::no_keep_memory): Ditto.
8166         (General_options::Bshareable): Define.
8167         * options.cc (General_options::finalize): Honor -Bshareable.
8168
8169 2009-01-20  Andreas Schwab  <schwab@suse.de>
8170
8171         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8172         read the value in the contents, since we don't use it.  Use the
8173         template endianness when writing.
8174         (Relocate::relocate): Use it for R_PPC_REL16_HA.
8175
8176 2009-01-19  Andreas Schwab  <schwab@suse.de>
8177
8178         * configure.tgt (powerpc64-*): Fix targ_obj.
8179
8180 2009-01-15  Ian Lance Taylor  <iant@google.com>
8181
8182         * object.cc (Sized_relobj::write_local_symbols): Don't write out
8183         local symbols when stripping all symbols.
8184
8185 2009-01-14  Cary Coutant  <ccoutant@google.com>
8186
8187         * output.cc (Output_reloc): Add explicit instantiations.
8188
8189 2009-01-14  Cary Coutant  <ccoutant@google.com>
8190
8191         * archive.cc (Archive::get_elf_object_for_member): Remove call
8192         to File_read::claim_for_plugin.
8193         * descriptors.cc (Descriptors::open): Remove reference to
8194         is_claimed.
8195         (Descriptors::claim_for_plugin): Remove.
8196         * descriptors.h (Descriptors::claim_for_plugin): Remove.
8197         (Descriptors::is_claimed): Remove.
8198         (claim_descriptor_for_plugin): Remove.
8199         * fileread.cc (File_read::claim_for_plugin): Remove.
8200         * fileread.h (File_read::claim_for_plugin): Remove.
8201         (File_read::descriptor): Reopen descriptor if necessary.
8202         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8203         (Plugin_manager::all_symbols_read): Add task parameter. Change
8204         all callers.
8205         (Plugin_manager::get_input_file): New function.
8206         (Plugin_manager::release_input_file): New function.
8207         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8208         corresponding data member.
8209         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8210         and pass to base constructor. Change all callers.
8211         (get_input_file, release_input_file): New functions.
8212         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8213         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8214         (Plugin_manager::all_symbols_read): Add task parameter.
8215         (Plugin_manager::get_input_file): New function.
8216         (Plugin_manager::release_input_file): New function.
8217         (Plugin_manager::task_): New data member.
8218         (Pluginobj::Pluginobj): Add filesize parameter.
8219         (Pluginobj::filename): New function.
8220         (Pluginobj::descriptor): New function.
8221         (Pluginobj::filesize): New function.
8222         (Pluginobj::filesize_): New data member.
8223         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8224         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8225         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8226
8227         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8228         with archive libraries.
8229         * testsuite/Makefile.in: Regenerate.
8230         * testsuite/plugin_test.c (struct sym_info): New type.
8231         (get_input_file, release_input_file): New static variables.
8232         (onload): Capture new transfer vector entries.
8233         (claim_file_hook): Stop reading at end of file according to filesize.
8234         Factor out parsing of readelf output into separate function.
8235         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8236         APIs and get the source file name from the symbol table.  Convert
8237         source file name to corresponding object file name.  Print info
8238         message when adding new input files.
8239         (parse_readelf_line): New function.
8240         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8241         * testsuite/plugin_test_2.sh: Likewise.
8242         * testsuite/plugin_test_3.sh: Likewise.
8243         * testsuite/plugin_test_4.sh: New test case.
8244
8245 2009-01-07  Ian Lance Taylor  <iant@google.com>
8246
8247         * version.cc (version_string): Bump to 1.8.
8248
8249 2008-12-23  Cary Coutant  <ccoutant@google.com>
8250
8251         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8252         * plugin.cc (Plugin_manager::finish): Rename as
8253         layout_deferred_objects.  Move cleanup to separate function.
8254         (Plugin_manager::cleanup): New function.
8255         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8256         separately.
8257         * plugin.h (Plugin_manager::finish): Rename as
8258         layout_deferred_objects.
8259         (Plugin_manager::cleanup): New function.
8260         (Plugin_manager::cleanup_done): New field.
8261
8262 2008-12-23  Cary Coutant  <ccoutant@google.com>
8263
8264         * plugin.cc (is_visible_from_outside): New function.
8265         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8266         so we don't return "IR only" status for exported symbols or -r links.
8267
8268         * testsuite/Makefile.am (plugin_test_3): New test case.
8269         * testsuite/Makefile.in: Regenerate.
8270         * testsuite/plugin_test_3.sh: New file.
8271
8272 2008-12-22  Cary Coutant  <ccoutant@google.com>
8273
8274         * object.cc (Sized_relobj::layout_section): New function.
8275         (Sized_relobj::do_layout): Defer layout of input sections until after
8276         plugin has provided replacement files.
8277         (Sized_relobj::do_layout_deferred_sections): New function.
8278         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8279         (Relobj::layout_deferred_sections): New function.
8280         (Relobj::do_layout_deferred_sections): New function.
8281         (Sized_relobj::do_layout_deferred_sections): New function.
8282         (Sized_relobj::layout_section): New function.
8283         (Sized_relobj::Deferred_layout): New structure.
8284         (Sized_relobj::deferred_layout_): New field.
8285         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8286         Change all callers.  Layout deferred sections.
8287         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8288         references.
8289         (Plugin_hook::run): Move code from do_plugin_hook inline.
8290         (Plugin_hook::do_plugin_hook): Remove.
8291         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8292         (Plugin_manager::finish): Renamed, was cleanup.
8293         (Plugin_manager::should_defer_layout): New function.
8294         (Plugin_manager::add_deferred_layout_object): New function.
8295         (Plugin_manager::Deferred_layout_list): New type.
8296         (Plugin_manager::deferred_layout_objects_): New field.
8297         (Plugin_hook::do_plugin_hook): Remove.
8298
8299 2008-12-17  Ian Lance Taylor  <iant@google.com>
8300
8301         * options.h (class General_options): Add --no case for
8302         --export-dynamic.
8303
8304 2008-12-16  Cary Coutant  <ccoutant@google.com>
8305
8306         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8307         vector.
8308         (Plugin_manager::claim_file): Create plugin object even if
8309         plugin did not call the add_symbols callback.
8310         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8311         asking for more symbols than were added.
8312         * testsuite/Makefile.am (plugin_test_1): Add test case with
8313         no global symbols.
8314         (empty.syms): New target.
8315         * testsuite/Makefile.in: Regenerate.
8316         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8317         message. Don't call add_symbols if no globals.
8318         (all_symbols_read_hook): Don't provide replacement for empty
8319         claimed file.
8320
8321 2008-12-12  Ian Lance Taylor  <iant@google.com>
8322
8323         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8324         r_type == 0 for a local symbol with r_sym == 0.
8325         (scan_relocatable_relocs): Pass r_sym to
8326         local_non_section_strategy.
8327         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8328         r_sym parameter.
8329
8330         * configure.ac: Update test for TLS descriptors: they are
8331         supported as of glibc 2.9.
8332         * configure: Rebuild.
8333
8334 2008-12-11  Ian Lance Taylor  <iant@google.com>
8335
8336         PR 7091
8337         * target-reloc.h (Default_scan_relocatable_relocs): For each
8338         function, map r_type == 0 to RELOC_DISCARD.
8339
8340 2008-12-10  Cary Coutant  <ccoutant@google.com>
8341
8342         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8343         object to override a kept COMDAT group from a plugin object.
8344
8345 2008-12-09  Ian Lance Taylor  <iant@google.com>
8346
8347         PR 7088
8348         * yyscript.y (file_cmd): Handle INPUT.
8349
8350         * testsuite/initpri1.c: Change all declarations to be full
8351         prototypes by adding void, to avoid compiler warnings.
8352
8353 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8354
8355         * options.cc (General_options::parse_plugin_opt): New.
8356         (General_options::add_plugin): The argument now is just the filename.
8357         (General_options::add_plugin_option): New.
8358         * options.h (plugin_opt): New.
8359         (add_plugin): Change argument name.
8360         (add_plugin_option): New.
8361         * plugin.cc (Plugin::load): Don't parse the plugin option.
8362         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8363         (Plugin::add_option): New.
8364         (Plugin::args_): Change type.
8365         (Plugin::filename_): New.
8366         (Plugin_manager::add_plugin_option): New.
8367         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8368         * testsuite/Makefile.in: Regenerate.
8369
8370 2008-12-05  Cary Coutant  <ccoutant@google.com>
8371
8372         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8373         Handle --strip-lto-sections option.
8374         * options.h (strip_lto_sections): New option.
8375
8376 2008-12-01  Cary Coutant  <ccoutant@google.com>
8377
8378         * plugin.cc (ld_plugin_message): Change format parameter to const.
8379         Fix mismatch between new[] and delete.
8380
8381 2008-11-14  Cary Coutant  <ccoutant@google.com>
8382
8383         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8384         instead of -1U.
8385
8386 2008-11-05  Craig Silverstein  <csilvers@google.com>
8387
8388         * options.cc (General_options::parse_dynamic_list): New function.
8389         * options.h (General_options): New flags dynamic_list,
8390         dynamic_list_data, dynamic_list_cpp_new, and
8391         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8392         (General_options::in_dynamic_list): New function.
8393         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8394         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8395         (Lex::can_continue_name): Likewise.
8396         (yylex): Likewise.
8397         (read_script_file): New parameter script_options.
8398         (read_dynamic_list): New function.
8399         (Script_options::define_dynamic_list): New function.
8400         (dynamic_list_keyword_parsecodes): New variable.
8401         (dynamic_list_keywords): New variable.
8402         * script.h (Script_options::define_dynamic_list): New function
8403         prototype.
8404         (read_dynamic_list): New function prototype.
8405         * symtab.cc (strprefix): New macro.
8406         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8407         dynamic_list_data, dynamic_list_cpp_new, and
8408         dynamic_list_cpp_typeinfo.
8409         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8410         (dynamic_list_expr): New rule.
8411         (dynamic_list_nodes): Likewise.
8412         (dynamic_list_node): Likewise.
8413         * testsuite/Makefile.am (dynamic_list): New test.
8414         * testsuite/Makefile.in: Regenerated.
8415         * testsuite/dynamic_list.t: New file.
8416         * testsuite/dynamic_list.sh: New file.
8417
8418 2008-11-05  Craig Silverstein  <csilvers@google.com>
8419
8420         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8421         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8422         (t11_last): Likewise.
8423         * testsuite/ver_test_6.c (main): Likewise.
8424
8425 2008-10-07  Cary Coutant  <ccoutant@google.com>
8426
8427         * options.c (General_options::finalize): Add check for -static and
8428         -shared.
8429         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8430         is not empty.
8431
8432 2008-10-02  Cary Coutant  <ccoutant@google.com>
8433
8434         * plugin.cc (make_sized_plugin_object): Fix conditional
8435         compilation to work when not all targets are enabled.
8436
8437 2008-09-29  Cary Coutant  <ccoutant@google.com>
8438
8439         * archive.cc (Archive::get_file_and_offset): Use filename instead
8440         of name to get library path.
8441         (Archive::include_member): Unlock external member of a thin archive.
8442
8443         * testsuite/Makefile.am (TEST_AR): New variable.
8444         (thin_archive_test_1): New test.
8445         (thin_archive_test_2): New test.
8446         * testsuite/Makefile.in: Regenerate.
8447         * testsuite/thin_archive_main.cc: New file.
8448         * testsuite/thin_archive_test_1.cc: New file.
8449         * testsuite/thin_archive_test_2.cc: New file.
8450         * testsuite/thin_archive_test_3.cc: New file.
8451         * testsuite/thin_archive_test_4.cc: New file.
8452
8453 2008-09-29  Cary Coutant  <ccoutant@google.com>
8454
8455         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8456         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8457         instead of -1U.
8458         (Sized_relobj::do_finalize_local_symbols): Likewise.
8459         (Sized_relobj::map_to_kept_section): Likewise.
8460         * object.h (Sized_relobj::invalid_address): New constant.
8461         (Sized_relobj::do_output_section_offset): Check for invalid_address
8462         and return -1ULL.
8463         * output.cc (Output_reloc::local_section_offset): Use constant
8464         invalid_address instead of -1U.
8465         (Output_reloc::get_address): Likewise.
8466         (Output_section::output_address): Change -1U to -1ULL.
8467         * output.h (Output_reloc::invalid_address): New constant.
8468         * reloc.cc (Sized_relobj::write_sections): Use constant
8469         invalid_address instead of -1U.
8470         (Sized_relobj::relocate_sections): Likewise.
8471         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8472         values for merge sections.
8473         * target-reloc.h (relocate_for_relocatable): Use constant
8474         invalid_address instead of -1U.
8475
8476 2008-09-19  Cary Coutant  <ccoutant@google.com>
8477
8478         Add plugin functionality for link-time optimization (LTO).
8479         * configure.ac (plugins): Add --enable-plugins option.
8480         * configure: Regenerate.
8481         * config.in: Regenerate.
8482         * Makefile.am (LIBDL): New variable.
8483         (CCFILES): Add plugin.cc.
8484         (HFILES): Add plugin.h.
8485         (ldadd_var): Add LIBDL.
8486         * Makefile.in: Regenerate.
8487
8488         * archive.cc: Include "plugin.h".
8489         (Archive::setup): Don't preread archive symbols when using a plugin.
8490         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8491         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8492         files.
8493         (Archive::include_member): Add symbols from plugin objects.
8494         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8495         * descriptors.cc (Descriptors::open): Check for file descriptors
8496         abandoned by plugins.
8497         (Descriptors::claim_for_plugin): New function.
8498         * descriptors.h (Descriptors::claim_for_plugin): New function.
8499         (Open_descriptor::is_claimed): New field.
8500         (claim_descriptor_for_plugin): New function.
8501         * fileread.cc (File_read::claim_for_plugin): New function.
8502         * fileread.h (File_read::claim_for_plugin): New function.
8503         (File_read::descriptor): New function.
8504         * gold.cc: Include "plugin.h".
8505         (queue_initial_tasks): Add task to call plugin hooks for generating
8506         new object files.
8507         * main.cc: Include "plugin.h".
8508         (main): Load plugin libraries.
8509         * object.h (Pluginobj): Declare.
8510         (Object::pluginobj): New function.
8511         (Object::do_pluginobj): New function.
8512         (Object::set_target): New function.
8513         * options.cc: Include "plugin.h".
8514         (General_options::parse_plugin): New function.
8515         (General_options::General_options): Initialize plugins_ field.
8516         (General_options::add_plugin): New function.
8517         * options.h (Plugin_manager): Declare.
8518         (General_options): Add --plugin option.
8519         (General_options::has_plugins): New function.
8520         (General_options::plugins): New function.
8521         (General_options::add_plugin): New function.
8522         (General_options::plugins_): New field.
8523         * plugin.cc: New file.
8524         * plugin.h: New file.
8525         * readsyms.cc: Include "plugin.h".
8526         (Read_symbols::do_read_symbols): Check for archive before checking
8527         for ELF file.  Call plugin hooks to claim files.
8528         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8529         from a real object file; force override when processing replacement
8530         files.
8531         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8532         (Symbol::init_base_object): Likewise.
8533         (Symbol::init_base_output_data): Likewise.
8534         (Symbol::init_base_output_segment): Likewise.
8535         (Symbol::init_base_constant): Likewise.
8536         (Symbol::init_base_undefined): Likewise.
8537         (Symbol::output_section): Assert that object is not a plugin.
8538         (Symbol_table::add_from_pluginobj): New function.
8539         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8540         undefined.
8541         (Symbol_table::sized_write_globals): Likewise.
8542         (Symbol_table::add_from_pluginobj): Instantiate template.
8543         * symtab.h (Sized_pluginobj): Declare.
8544         (Symbol::in_real_elf): New function.
8545         (Symbol::set_in_real_elf): New function.
8546         (Symbol::in_real_elf_): New field.
8547         (Symbol_table::add_from_pluginobj): New function.
8548
8549         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8550         (LIBDL): New variable.
8551         (LDADD): Add LIBDL.
8552         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8553         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8554         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8555         (MOSTLYCLEANFILES): Likewise.
8556         * testsuite/Makefile.in: Regenerate.
8557         * testsuite/plugin_test.c: New file.
8558         * testsuite/plugin_test_1.sh: New file.
8559         * testsuite/plugin_test_2.sh: New file.
8560
8561 2008-09-16  Ian Lance Taylor  <iant@google.com>
8562
8563         * target-reloc.h (relocate_section): Check whether a symbol is
8564         defined by the ABI before reporting an undefined symbol error.
8565         * target.h (Target::is_defined_by_abi): Make parameter const.
8566         (Target::do_is_defined_by_abi): Likewise.
8567         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8568         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8569         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8570         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8571         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8572         * testsuite/Makefile.in: Rebuild.
8573
8574         * fileread.cc (make_view): Add casts to avoid warning.
8575
8576 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8577
8578         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8579         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8580
8581 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8582
8583         * options.h (General_options::output_is_executable): New.
8584         (General_options::output_is_pie): New.
8585         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8586         for shared libraries.
8587         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8588
8589 2008-09-11  Chris Demetriou  <cgd@google.com>
8590
8591         * options.h (origin): New -z option.
8592         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8593         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8594         in DT_FLAGS_1.
8595
8596 2008-09-05  Cary Coutant  <ccoutant@google.com>
8597
8598         * fileread.cc (File_read::make_view): Add check for attempt to map
8599         beyond end of file.
8600
8601 2008-09-05  Cary Coutant  <ccoutant@google.com>
8602
8603         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8604         explicit instantiations.
8605
8606 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
8607
8608         PR gold/6858
8609         * options.cc (General_options::finalize): Allow undefined symbols
8610         in shlibs if linking -shared.
8611
8612         PR gold/6859
8613         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8614         symbols as not needing a dynsym entry.
8615
8616 2008-08-20  Craig Silverstein  <csilvers@google.com>
8617
8618         * fileread.cc (File_read::open): Do not lock the file unless it
8619         was successfully opened.
8620
8621 2008-08-14  Cary Coutant  <ccoutant@google.com>
8622
8623         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8624         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8625         * testsuite/tls_test.cc (struct int128): 128-bit struct
8626         for testing TLS relocs with non-zero addend.
8627         (v12): New TLS variable.
8628         (t12): New test.
8629         (t_last): Add check for v12.
8630         * testsuite/tls_test.h (t12): New function.
8631         * testsuite/tls_test_main.cc (thread_routine): Call new test.
8632
8633 2008-08-13  Ian Lance Taylor  <iant@google.com>
8634
8635         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8636         set tls_segment_ or relro_segment_.
8637         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8638         when appropriate.
8639         * output.h (Output_section::clear_is_relro): New function.
8640         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8641         sections specially even when output_data_ is empty.
8642         (Output_segment::maximum_alignment): When first section is relro,
8643         only force alignment for PT_LOAD segments.
8644         * script.cc (script_data_segment_align): New function.
8645         (script_data_segment_relro_end): New function.
8646         * script-c.h (script_data_segment_align): Declare.
8647         (script_data_segment_relro_end): Declare.
8648         * script-sections.h (class Script_sections): Declare
8649         data_segment_align and data_segment_relro_end.  Add fields
8650         segment_align_index_ and saw_relro_end_.
8651         * script-sections.cc (class Sections_element): Add set_is_relro
8652         virtual function.  Add new bool* parameter to place_orphan_here.
8653         Add get_output_section virtual function.
8654         (class Output_section_definition): Add set_is_relro.  Add new
8655         bool* parameter to place_orphan_here.  Add get_output_section.
8656         Add is_relro_ field.
8657         (Output_section_definition::Output_section_definition): Initialize
8658         evaluated_address_, evaluated_load_address, evaluated_addralign_,
8659         and is_relro_ fields.
8660         (Output_section_definition::place_orphan_here): Add is_relro
8661         parameter.
8662         (Output_section_definition::set_section_addresses): Set relro for
8663         output section.
8664         (Output_section_definition::alternate_constraint): Likewise.
8665         (class Orphan_output_section): Add new bool* parameter to
8666         place_orphan_here.  Add get_output_section.
8667         (Orphan_output_section::place_orphan_here): Add is_relro
8668         parameter.
8669         (Script_sections::Script_sections): Initialize
8670         data_segment_align_index_ and saw_relro_end_.
8671         (Script_sections::data_segment_align): New function.
8672         (Script_sections::data_segment_relro_end): New function.
8673         (Script_sections::place_orphan): Set or clear is_relro.
8674         (Script_sections::set_section_addresses): Force alignment of first
8675         TLS section.
8676         * yyscript.y (exp): Call script_data_segment_align and
8677         script_data_segment_relro_end.
8678         * testsuite/relro_script_test.t: New file.
8679         * testsuite/relro_test.cc (using_script): Declare.
8680         (t1, t2): Test using_script.
8681         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8682         (relro_script_test_SOURCES): Define.
8683         (relro_script_test_DEPENDENCIES): Define.
8684         (relro_script_test_LDFLAGS): Define.
8685         (relro_script_test_LDADD): Define.
8686         (relro_script_test.so): New target.
8687         * testsuite/Makefile.in: Rebuild.
8688
8689 2008-08-06  Cary Coutant <ccoutant@google.com>
8690
8691         * archive.cc (Archive::total_archives, Archive::total_members)
8692         (Archive::total_members_loaded): New variables.
8693         (Archive::setup): Add parameter.  Add option to preread
8694         archive symbols.
8695         (Archive::read_armap): Add counter.
8696         (Archive::get_file_and_offset): New function.
8697         (Archive::get_elf_object_for_member): New function.
8698         (Archive::read_all_symbols): New function.
8699         (Archive::read_symbols): New function.
8700         (Archive::add_symbols): Add counters.
8701         (Archive::include_all_members): Use armap to find members if it's
8702         already built.
8703         (Archive::include_member): Skip reading symbols if already read.
8704         Factored code into Archive::get_file_and_offset and
8705         Archive::get_elf_object_for_member.  Changed call to
8706         Mapfile::report_include_archive_member.
8707         (Archive::print_stats): New function.
8708         * archive.h: Declare Object and Read_symbols_data classes.
8709         (Archive::Archive): Add initializers for new members.
8710         (Archive::setup): Add parameter.
8711         (Archive::print_stats): New function.
8712         (Archive::total_archives, Archive::total_members)
8713         (Archive::total_members_loaded): New variables.
8714         (Archive::get_file_and_offset): New function.
8715         (Archive::get_elf_object_for_member): New function.
8716         (Archive::read_all_symbols): New function.
8717         (Archive::read_symbols): New function.
8718         (Archive::Archive_member): New class.
8719         (Archive::members_): New member.
8720         (Archive::num_members_): New member.
8721         * main.cc: Include archive.h.
8722         (main): Call Archive::print_stats.
8723         * mapfile.cc (Mapfile::report_include_archive_member): Delete
8724         archive parameter; member_name is now the fully-decorated name.
8725         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8726         * options.h: (General_options): Add --preread-archive-symbols option.
8727         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8728         Archive::setup.
8729
8730 2008-08-04  Ian Lance Taylor  <iant@google.com>
8731
8732         * symtab.h (Symbol::use_plt_offset): New function.
8733         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8734         * powerpc.cc (Relocate::relocate): Likewise.
8735         * sparc.cc (Relocate::relocate): Likewise.
8736         * x86_64.cc (Relocate::relocate): Likewise.
8737         * testsuite/weak_plt.sh: New test.
8738         * testsuite/weak_plt_main.cc: New test.
8739         * testsuite/weak_plt_shared.cc: New test.
8740         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8741         (check_PROGRAMS): Add weak_plt.
8742         (check_DATA): Add weak_plt_shared.so.
8743         (weak_plt_main_pic.o, weak_plt): New targets.
8744         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8745         * testsuite/Makefile.in: Rebuild.
8746
8747         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8748         gcctestdir/ld.
8749         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8750         * testsuite/Makefile.in: Rebuild.
8751
8752 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
8753
8754         * Makefile.am (POTFILES.in): Set LC_ALL=C.
8755         * Makefile.in: Regenerate.
8756         * po/POTFILES.in: Regenerate.
8757
8758 2008-07-29  Ian Lance Taylor  <iant@google.com>
8759
8760         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8761         symbols before other symbols.
8762         * testsuite/script_test_2.cc (test_addr): Declare.
8763         (test_addr_alias): Declare.
8764         (main): Check that test_addr and test_addr_alias have the right
8765         values.
8766         * testsuite/script_test_2.t: Define test_addr_alias and
8767         test_addr.
8768
8769 2008-07-24  Ian Lance Taylor  <iant@google.com>
8770
8771         PR 5990
8772         * descriptors.cc: New file.
8773         * descriptors.h: New file.
8774         * gold-threads.h (class Hold_optional_lock): New class.
8775         * fileread.cc: Include "descriptors.h".
8776         (File_read::~File_read): Release descriptor rather than closing
8777         it.
8778         (File_read::open) [file]: Call open_descriptor rather than open.
8779         Set is_descriptor_opened_.
8780         (File_read::open) [memory]: Assert that descriptor is not open.
8781         (File_read::reopen_descriptor): New function.
8782         (File_read::release): Release descriptor.
8783         (File_read::do_read): Make non-const.  Reopen descriptor.
8784         (File_read::read): Make non-const.
8785         (File_read::make_view): Reopen descriptor.
8786         (File_read::do_readv): Likewise.
8787         * fileread.h (class File_read): Add is_descriptor_opened_ field.
8788         Update declarations.
8789         * layout.cc: Include "descriptors.h".
8790         (Layout::create_build_id): Use open_descriptor rather than open.
8791         * output.cc: Include "descriptors.h".
8792         (Output_file::open): Use open_descriptor rather than open.
8793         * archive.cc (Archive::const_iterator): Change Archive to be
8794         non-const.
8795         (Archive::begin, Archive::end): Make non-const.
8796         (Archive::count_members): Likewise.
8797         * archive.h (class Archive): Update declarations.
8798         * object.h (Object::read): Make non-const.
8799         * Makefile.am (CCFILES): Add descriptors.cc.
8800         (HFILES): Add descriptors.h.
8801         * Makefile.in: Rebuild.
8802
8803         PR 6716
8804         * gold.h: Always include <clocale>.  Add Solaris workarounds
8805         following code in binutils/sysdep.h.
8806
8807         PR 6048
8808         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8809         this->eh_frame_hdr_ is NULL before using it.
8810
8811         * dynobj.cc (Versions::Versions): Update comment.
8812
8813         * dynobj.cc (Versions::Versions): If there is an soname, use it as
8814         the base version name.
8815
8816         * stringpool.cc (Stringpool_template::add_with_length): Set key to
8817         array size plus one.
8818         (Stringpool_template::set_string_offsets): Subtract one from key
8819         before using it as an array index.
8820         (Stringpool_template::get_offset_with_length): Likewise.
8821         (Stringpool_template::write_to_buffer): Likewise.
8822         * stringpool.h (Stringpool_template::get_offset_from_key):
8823         Likewise.
8824
8825 2008-07-23  Ian Lance Taylor  <iant@google.com>
8826
8827         PR 6658
8828         * object.h (Merged_symbol_value::value): Do our best to handle a
8829         negative addend.
8830
8831         PR 6647
8832         * script.cc (Version_script_info::get_versions): Don't add empty
8833         version tag to return value.
8834         (Version_script_info::get_symbol_version_helper): Change return
8835         type to bool.  Add pversion parameter.  Change all callers.
8836         (script_register_vers_node): Don't require a non-NULL tag.
8837         * script.h (class Version_script_info): Update declarations.
8838         (Version_script_info::get_symbol_version): Change return type to
8839         bool.  Add version parameter.  Change all callers.
8840         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8841         handling.  Handle an empty version from a version script.
8842         (Symbol_table::define_special_symbol): Likewise.
8843         * testsuite/ver_test_10.script: New file.
8844         * testsuite/ver_test_10.sh: New file.
8845         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8846         (check_DATA): Add ver_test_10.syms.
8847         (ver_test_10.syms, ver_test_10.so): New target.
8848         * testsuite/Makefile.in: Rebuild.
8849
8850 2008-07-23  Simon Baldwin  <simonb@google.com>
8851
8852         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8853         to zero for undefined symbols from dynamic libraries.
8854
8855 2008-07-23  Ian Lance Taylor  <iant@google.com>
8856
8857         * symtab.cc (Symbol_table::resolve): Remove version parameter.
8858         Change all callers.
8859         * symtab.h (class Symbol_table): Update declaration.
8860         * testsuite/ver_test_9.cc: New file.
8861         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8862         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8863         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8864         (ver_test_9.so, ver_test_9.o): New targets.
8865         * testsuite/Makefile.in: Rebuild.
8866
8867 2008-07-22  Ian Lance Taylor  <iant@google.com>
8868
8869         * options.h (class General_options): Define --check-sections.
8870         * layout.cc (Layout::set_segment_offsets): Handle
8871         --check-sections.
8872
8873         * options.h (class General_options): Define -n/--nmagic and
8874         -N/--omagic.
8875         * options.cc (General_options::finalize): For -n/--nmagic or
8876         -N/--omagic, set -static.
8877         * layout.cc (Layout::attach_allocated_section_to_segment): If
8878         -N/--omagic, don't put read-only and read-write sections in
8879         different segments.
8880         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8881         finding a read-only segment.
8882         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8883         don't set the minimum segment alignment to the common page size,
8884         and don't set the file offset to the address modulo the page size.
8885         * script-sections.cc (Script_sections::create_segments): If
8886         -n/--omagic, don't put read-only and read-write sections in
8887         different segments.
8888
8889         * cref.cc: New file.
8890         * cref.h: New file.
8891         * options.h (class General_options): Add --print-symbol-counts.
8892         * main.cc (main): Issue defined symbol report if requested.
8893         * archive.cc (Archive::interpret_header): Make into a const member
8894         function.
8895         (Archive::add_symbols): Call Input_objects::archive_start and
8896         archive_stop.
8897         (Archive::const_iterator): Define new class.
8898         (Archive::begin, Archive::end): New functions.
8899         (Archive::include_all_members): Rewrite to use iterator.
8900         (Archive::count_members): New function.
8901         * archive.h (class Archive): Update declarations.
8902         (Archive::filename): New function.
8903         * object.cc: Include "cref.h".
8904         (Sized_relobj::Sized_relobj): Initialize defined_count_.
8905         (Sized_relobj::do_get_global_symbol_counts): New function.
8906         (Input_objects::add_object): Add object to cross-referencer.
8907         (Input_objects::archive_start): New function.
8908         (Input_objects::archive_stop): New function.
8909         (Input_objects::print_symbol_counts): New function.
8910         * object.h: Declare Cref and Archive.
8911         (Object::get_global_symbol_counts): New function.
8912         (Object::do_get_global_symbol_counts): New pure virtual function.
8913         (class Sized_relobj): Add defined_count_ field.  Update
8914         declarations.
8915         (class Input_objects): Add cref_ field.  Update constructor.
8916         Update declarations.
8917         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8918         defined_count_.
8919         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8920         symbol counts.
8921         (Sized_dynobj::do_get_global_symbol_counts): New function.
8922         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8923         defined_count_.  Update declarations.  Define Symbols typedef.
8924         * symtab.cc (Symbol_table::add_from_relobj): Add defined
8925         parameter.  Change all callers.
8926         (Symbol_table::add_from_dynobj): Add sympointers and defined
8927         parameters.  Change all callers.
8928         * symtab.h (class Symbol_table): Update declarations.
8929         * Makefile.am (CCFILES): Add cref.cc.
8930         (HFILES): Add cref.h.
8931         * Makefile.in: Rebuild.
8932
8933 2008-07-22  Simon Baldwin  <simonb@google.com>
8934
8935         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8936         to zero when writing undefined symbols.
8937
8938 2008-07-22  Ian Lance Taylor  <iant@google.com>
8939
8940         * output.cc (Output_section::add_input_section): Don't try to
8941         merge empty merge sections.
8942
8943 2008-07-21  Craig Silverstein  <csilvers@google.com>
8944
8945         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8946         Include symbol version in error message.
8947
8948 2008-07-20  Chris Demetriou  <cgd@google.com>
8949
8950         * configure.ac (gold_cv_c_random_seed): New configured variable.
8951         (RANDOM_SEED_CFLAGS): New substituted variable.
8952         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8953         * configure: Rebuild.
8954         * Makefile.in: Likewise.
8955         * testsuite/Makefile.in: Likewise.
8956
8957 2008-07-18  Ian Lance Taylor  <iant@google.com>
8958
8959         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8960         where we see NAME/NULL and NAME/VERSION  as separate symbols.
8961         * testsuite/ver_test_main.cc (main): Call t4.
8962         (t4, t4_2a): Define.
8963         * testsuite/ver_test_2.cc (t4_2): Define.
8964         * testsuite/ver_test_2.script: Put t4_2a in VER2.
8965         * testsuite/ver_test_4.cc (t4_2a): Define.
8966         * testsuite/ver_test_4.script: Put t4_2a in VER2.
8967         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8968
8969 2008-07-17  Ian Lance Taylor  <iant@google.com>
8970
8971         * dynobj.cc (Versions::add_def): If we give an error about a
8972         missing version, go ahead and create the version anyhow.
8973
8974 2008-07-10  Ian Lance Taylor  <iant@google.com>
8975
8976         Handle output sections with more than 0x7fffffff bytes.
8977         * object.h (class Relobj): Change map_to_output_ to
8978         output_sections_, and just keep a section pointer.  Change all
8979         uses.  Move comdat group support to Sized_relobj.
8980         (Relobj::is_section_specially_mapped): Remove.
8981         (Relobj::output_section): Remove poff parameter.  Change all
8982         callers.
8983         (Relobj::output_section_offset): New function.
8984         (Relobj::set_section_offset): Rewrite.
8985         (Relobj::map_to_output): Remove.
8986         (Relobj::output_sections): New function.
8987         (Relobj::do_output_section_offset): New pure virtual function.
8988         (Relobj::do_set_section_offset): Likewise.
8989         (class Sized_relobj): Add section_offsets_ field.  Add comdat
8990         group support from Relobj.  Update declarations.
8991         (Sized_relobj::get_output_section_offset): New function.
8992         (Sized_relobj::do_output_section_offset): New function.
8993         (Sized_relobj::do_set_section_offset): New function.
8994         * object.cc (Relobj::output_section_address): Remove.
8995         (Sized_relobj::Sized_relobj): Initialize new fields.
8996         (Sized_relobj::include_section_group): Cast find_kept_object to
8997         Sized_relobj.
8998         (Sized_relobj::include_linkonce_section): Likewise.
8999         (Sized_relobj::do_layout): Use separate arrays for output section
9000         and output offset.
9001         (Sized_relobj::do_count_local_symbols): Change map_to_output to
9002         output_sections.
9003         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9004         output_sections and section_offsets.
9005         (Sized_relobj::write_local_symbols): Likewise.
9006         (map_to_kept_section): Compute output address directly.
9007         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9008         output_sections and section_offsets.
9009         (Sized_relobj::write_sections): Likewise.
9010         (Sized_relobj::relocate_sections): Likewise.
9011         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9012         * output.h (class Output_reloc): Update declarations.  Change
9013         u2_.relobj to Sized_relobj*.
9014         (class Output_data_reloc): Change add functions to use
9015         Sized_relobj*.
9016         * output.cc (Output_reloc::Output_reloc): Change relobj to
9017         Sized_relobj*.
9018         (Output_reloc::local_section_offset): Change return type to
9019         Elf_Addr.  Use get_output_section_offset.
9020         (Output_reloc::get_address): Likewise.
9021         (Output_section::is_input_address_mapped): Don't call
9022         is_section_specially_mapped.
9023         (Output_section::output_offset): Likewise.
9024         (Output_section::output_address): Likewise.
9025         (Output_section::starting_output_address): Likewise.
9026         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9027         parameter to Sized_relobj*.
9028         (Copy_relocs::need_copy_reloc): Likewise.
9029         (Copy_relocs::save): Likewise.
9030         * copy-relocs.h (class Copy_relocs): Update declarations.
9031         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9032         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
9033         * target-reloc.h (relocate_for_relocatable): Change
9034         offset_in_output_section type to Elf_Addr.  Change code that uses
9035         it as well.
9036         * layout.cc (Layout::layout): Always set *off.
9037         * mapfile.cc (Mapfile::print_input_section): Use
9038         output_section_offset.
9039         * i386.cc (Target_i386::copy_reloc): Change object parameter to
9040         Sized_relobj*.
9041         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9042         * sparc.cc (Target_sparc::copy_reloc): Likewise.
9043         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9044
9045 2008-07-03  Ian Lance Taylor  <iant@google.com>
9046
9047         * layout.cc (Layout::include_section): Do not discard unrecognized
9048         SHT_STRTAB sections.
9049
9050 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
9051
9052         * script.cc (Lex::can_continue_name): Make '?' allowable in
9053         version-script names.
9054         * testsuite/version_script.map: Change glob pattern to use '?'
9055
9056 2008-06-30  Manish Singh  <yosh@gimp.org>
9057
9058         PR 6585
9059         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9060         Correct typo.
9061
9062 2008-06-30  Ian Lance Taylor  <iant@google.com>
9063
9064         PR 6660
9065         PR 6682
9066         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9067         versions]: Don't try to read the value in the contents, since we
9068         don't use it.  Use the template endianness when writing.
9069
9070 2008-06-25  Cary Coutant  <ccoutant@google.com>
9071
9072         * fileread.cc (File_read::make_view): Assert on zero-length view.
9073         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9074         symbol table when there are no symbols to read.
9075
9076 2008-06-23  Craig Silverstein  <csilvers@google.com>
9077
9078         * version.cc (version_string): Bump to 1.7
9079
9080 2008-06-18  Craig Silverstein  <csilvers@google.com>
9081
9082         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9083         constant 0xFFFF to type Valtype.
9084         (Powerpc_relocate_functions::rel16_ha): Likewise.
9085
9086 2008-06-17  Ian Lance Taylor  <iant@google.com>
9087
9088         * output.h (Output_section::Input_section): Initialize p2align_ to
9089         zero for Output_section_data constructors.
9090         (Output_section::Input_section::addralign): If not an input
9091         section, return the alignment of the Output_section_data.
9092         * testsuite/copy_test.cc: New file.
9093         * testsuite/copy_test_1.cc: New file.
9094         * testsuite/copy_test_2.cc: New file.
9095         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9096         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9097         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9098         (copy_test_1_pic.o, copy_test_1.so): New targets.
9099         (copy_test_2_pic.o, copy_test_2.so): New targets.
9100         * testsuite/Makefile.in: Rebuild.
9101
9102         * script-sections.cc (Script_sections::place_orphan): Initialize
9103         local variable exact.
9104
9105 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
9106
9107         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9108
9109 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
9110             David S. Miller  <davem@davemloft.net>
9111
9112         * powerpc.cc: New file.
9113         * Makefile.am (TARGETSOURCES): Add powerpc.cc
9114         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9115         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9116         * Makefile.in: Rebuild.
9117
9118 2008-06-09  Ian Lance Taylor  <iant@google.com>
9119
9120         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9121         <exception>.
9122         (throwing, orig_terminate): New static variables.
9123         (terminate_handler): New static function.
9124         (t2): Set terminate handler.
9125
9126 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
9127
9128         PR 6584
9129         * binary.cc (Binary_to_elf::sized_convert): Fix .data
9130         alignment.
9131
9132 2008-05-30  Cary Coutant  <ccoutant@google.com>
9133
9134         * archive.cc (Archive::include_all_members) Correct to step
9135         over symbol table and extended name table in thin archives.
9136
9137 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
9138
9139         PR 6407
9140         * target-reloc.h (relocate_for_relocatable): Fix new_offset
9141         calculation.
9142
9143 2008-05-28  Caleb Howe  <cshowe@google.com>
9144
9145         * reduced_debug_output.cc: New file.
9146         * reduced_debug_output.h: New file.
9147         * options.h (class General_options): Add --strip-debug-non-line.
9148         * options.cc (General_options::finalize): Add strip_debug_non_line
9149         to the strip heirarchy.
9150         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9151         fields.
9152         * layout.cc: Include "reduced_debug_output.h".
9153         (Layout::Layout): Initialize new fields.
9154         (line_only_debug_sections): New static array.
9155         (is_lines_only_debug_sections): New static inline function.
9156         (Layout::include_section): Handle --strip-debug-non-line.
9157         (Layout::make_output_section): If --strip-debug-non-line, build
9158         new output sections for .debug_abbrev and .debug_info.
9159         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9160         gold.  Warn about possible overflow.
9161         (read_signed_LEB_128): Likewise.
9162         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9163         (read_signed_LEB_128): Declare.
9164         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9165         (HFILES): Add reduced_debug_output.h.
9166         * Makefile.in: Rebuild.
9167
9168 2008-05-21  Ian Lance Taylor  <iant@google.com>
9169
9170         * mapfile.cc: New file.
9171         * mapfile.h: New file.
9172         * options.h (class General_options): Add -M/--print-map and -Map.
9173         * options.cc (General_options::finalize): Make -M equivalent to
9174         -Map -.
9175         * main.cc: Include <cstdio> and "mapfile.h".
9176         (main): Open mapfile if requested.
9177         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
9178         constructor.  Change caller.
9179         (queue_initial_tasks): Add mapfile parameter.  Change caller.
9180         (queue_middle_tasks): Likewise.
9181         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9182         declarations.
9183         * archive.cc: Include "mapfile.h".
9184         (Archive::add_symbols): Add mapfile parameter.  Change all
9185         callers.  Pass mapfile, symbol, and reason to include_member.
9186         (Archive::include_all_members): Add mapfile parameter.  Change all
9187         callers.
9188         (Archive::include_member): Add mapfile, sym, and why parameters.
9189         Change all callers.  Report inclusion to map file.
9190         * archive.h: Include "fileread.h".
9191         (class Archive): Update declarations.
9192         (Archive::file): New const method.
9193         (class Add_archive_symbols): Add mapfile_ field.  Update
9194         constructor.  Change all callers.
9195         * readsyms.h (class Read_symbols): Likewise.
9196         (class Finish_group): Likewise.
9197         (class Read_script): Likewise.
9198         * common.cc: Include "mapfile.h".
9199         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
9200         all callers.
9201         (Symbol_table::do_allocate_commons): Likewise.
9202         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9203         symbol allocation to mapfile.
9204         * common.h (class Allocate_commons_task): Add mapfile_ field.
9205         Update constructor.  Change all callers.
9206         * symtab.h (class Symbol_table): Update declarations.
9207         * layout.cc: Include "mapfile.h".
9208         (Layout_task_runner::run): Print information to mapfile.
9209         (Layout::create_gold_note): Change Output_data_fixed_space to
9210         Output_data_zero_fill.
9211         (Layout::create_build_id): Likewise.
9212         (Layout::print_to_mapfile): New function.
9213         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9214         constructor.  Change caller.
9215         (class Layout): Declare print_to_mapfile.
9216         * output.cc (Output_section::Input_section::print_to_mapfile): New
9217         function.
9218         (Output_section::add_input_section): If producing a map, always
9219         add to input_sections_ list.
9220         (Output_section::do_print_to_mapfile): New function.
9221         (Output_segment::print_sections_to_mapfile): New function.
9222         (Output_segment::print_section_list_to_mapfile): New function.
9223         * output.h: Include "mapfile.h".
9224         (Output_data::print_to_mapfile): New function.
9225         (Output_data::do_print_to_mapfile): New virtual function.
9226         (Output_segment_headers::do_print_to_mapfile): New function.
9227         (Output_file_header::do_print_to_mapfile): New function.
9228         (Output_data_const::do_print_to_mapfile): New function.
9229         (class Output_data_const_buffer): Add map_name_ field.  Update
9230         constructor.  Change all callers.  Add do_print_to_mapfile
9231         function.
9232         (class Output_data_fixed_space): Likewise.
9233         (class Output_data_space): Likewise.
9234         (class Output_data_zero_fill): New class.
9235         (Output_data_strtab::do_print_to_mapfile): New function.
9236         (Output_data_reloc_base::do_print_to_mapfile): New function.
9237         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9238         (Output_data_group::do_print_to_mapfile): New function.
9239         (Output_data_got::do_print_to_mapfile): New function.
9240         (Output_data_dynamic::do_print_to_mapfile): New function.
9241         (Output_symtab_xindex::do_print_to_mapfile): New function.
9242         (class Output_section): Declare do_print_to_mapflie.  Declare
9243         print_to_mapfile in Input_section.
9244         (class Output_segment): Declare new functions.
9245         * object.h (Sized_relobj::symbol_count): New function.
9246         * script-sections.cc
9247         (Output_section_element_dot_assignment::set_section_addresses):
9248         Change Output_data_fixed_space to Output_data_zero_fill.
9249         (Output_data_expression::do_print_to_mapfile): New function.
9250         * script.cc (read_input_script): Add mapfile parameter.  Change
9251         all callers.
9252         * script.h (read_input_script): Update declaration.
9253         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9254         (Eh_frame::do_print_to_mapfile): New function.
9255         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9256         (Output_merge_string::do_print_to_mapfile): New function.
9257         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9258         function.
9259         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9260         function.
9261         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9262         function.
9263         * Makefile.am (CCFILES): Add mapfile.cc.
9264         (HFILES): Add mapfile.h.
9265         * Makefile.in: Rebuild.
9266
9267 2008-05-19  Ian Lance Taylor  <iant@google.com>
9268
9269         * options.h (class General_options): Add -z relro.
9270         * layout.cc (Layout::Layout): Initialize relro_segment_.
9271         (Layout::add_output_section_data): Return the output section.
9272         (Layout::make_output_section): Rcognize relro sections and mark
9273         them appropriately.
9274         (Layout::attach_allocated_section_to_segment): Put relro sections
9275         in a PT_GNU_RELRO segment.
9276         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9277         section as relro.
9278         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9279         PT_TLS segments.
9280         (Layout::linkonce_mapping): Map d.rel.ro.local to
9281         .data.rel.ro.local.
9282         (Layout::output_section_name): Us .data.rel.ro.local for any
9283         section which begins with that.
9284         * layout.h (class Layout): Update add_output_section_data
9285         declaration.  Add relro_segment_ field.
9286         * output.cc (Output_section::Output_section): Initialize is_relro_
9287         and is_relro_local_ fields.
9288         (Output_segment::add_output_section): Group relro sections.
9289         (Output_segment::is_first_section_relro): New function.
9290         (Output_segment::maximum_alignment): If there is a relro section,
9291         align the segment to the common page size.
9292         (Output_segment::set_section_addresses): Track whether we are
9293         looking at relro sections.  If the last section is a relro
9294         section, align to the common page size.
9295         (Output_segment::set_section_list_addresses): Add in_relro
9296         parameter.  Change all callers.  Align to the page size when
9297         moving from relro to non-relro section.
9298         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9299         segment.
9300         * output.h (class Output_section): Add is_relro_ and
9301         is_relro_local_ fields.
9302         (Output_section::is_relro): New function.
9303         (Output_section::set_is_relro): New function.
9304         (Output_section::is_relro_local): New function.
9305         (Output_section::set_is_relro_local): New function.
9306         (class Output_segment): Update declarations.
9307         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9308         * sparc.cc (Target_sparc::got_section): Likewise.
9309         * x86_64.cc (Target_x86_64::got_section): Likewise.
9310         * testsuite/relro_test_main.cc: New file.
9311         * testsuite/relro_test.cc: New file.
9312         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9313         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9314         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9315         (relro_test.so, relro_test_pic.o): New targets.
9316         * testsuite/Makefile.in: Rebuild.
9317
9318 2008-05-16  Ian Lance Taylor  <iant@google.com>
9319
9320         * output.cc (Output_segment::add_output_section): Remove front
9321         parameter.
9322         * output.h (class Output_segment): Remove
9323         add_initial_output_section and overloaded add_output_section.
9324         Update declaration of remaining add_output_section.
9325         * layout.cc (Layout::create_interp): Call add_output_section
9326         rather than add_initial_output_section.
9327         (Layout::finish_dynamic_section): Likewise.
9328
9329         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9330         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9331         know the dynamic type.
9332         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9333         field.  Initialize it in constructor.
9334         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9335         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9336         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9337         reloc.
9338
9339         * output.cc (Output_reloc::get_address): Change return type to
9340         Elf_Addr.
9341         * output.h (class Output_reloc): Update get_address declaration.
9342         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9343         for section addresses.
9344
9345 2008-05-09  Ian Lance Taylor  <iant@google.com>
9346
9347         PR 6493
9348         * gold.cc (gold_nomem): Use return value of write.
9349
9350 2008-05-08  Ian Lance Taylor  <iant@google.com>
9351
9352         * symtab.c (Symbol::init_base_output_data): Add version
9353         parameter.  Change all callers.
9354         (Symbol::init_base_output_segment): Likewise.
9355         (Symbol::init_base_constant): Likewise.
9356         (Symbol::init_base_undefined): Likewise.
9357         (Sized_symbol::init_output_data): Likewise.
9358         (Sized_symbol::init_output_segment): Likewise.
9359         (Sized_symbol::init_constant): Likewise.
9360         (Sized_symbol::init_undefined): Likewise.
9361         (Symbol_table::do_define_in_output_data): If the new symbol has a
9362         version, mark it as the default.
9363         (Symbol_table::do_define_in_output_segment): Likewise.
9364         (Symbol_table::do_define_as_constant): Likewise.
9365         * symtab.h (class Symbol): Update declarations.
9366         (class Sized_symbol): Likewise.
9367         * resolve.cc (Symbol::override_version): New function.
9368         (Symbol::override_base): Call override_version.
9369         (Symbol::override_base_with_special): Likewise.
9370         * testsuite/ver_script_8.script: New file.
9371         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9372         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9373         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9374         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9375
9376 2008-05-06  Ian Lance Taylor  <iant@google.com>
9377
9378         PR 6049
9379         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9380         functions.
9381         (class General_options): Remove existing --undefined, and add
9382         --no-undefined instead.  Add new --undefined as synonym for -u.
9383         * archive.cc (Archive::add_symbols): Check whether symbol was
9384         named with -u.
9385         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9386         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9387         all uses.  Add IS_UNDEFINED.  Update declarations to split
9388         different versions of init_base.  Declare init_base_undefined.
9389         (Symbol::is_defined): Handle IS_UNDEFINED.
9390         (Symbol::is_undefined): Likewise.
9391         (Symbol::is_weak_undefined): Call is_undefined.
9392         (Symbol::is_absolute): Handle IS_CONSTANT.
9393         (class Sized_symbol): Update declarations to split different
9394         versions of init.  Declare init_undefined.
9395         (class Symbol_table): Declare new functions.
9396         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9397         Change all callers.
9398         (Symbol::init_base_output_data): Likewise.
9399         (Symbol::init_base_output_segment): Likewise.
9400         (Symbol::init_base_constant): Likewise.
9401         (Symbol::init_base_undefined): New function.
9402         (Sized_symbol::init_object): Rename from init.  Change all
9403         callers.
9404         (Sized_symbol::init_output_data): Likewise.
9405         (Sized_symbol::init_output_segment): Likewise.
9406         (Sized_symbol::init_constant): Likewise.
9407         (Sized_symbol::init_undefined): New function.
9408         (Symbol_table::add_undefined_symbols_from_command_line): New
9409         function.
9410         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9411         function.
9412         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9413         (Symbol::output_section): Likewise.
9414         (Symbol::set_output_section): Likewise.
9415         (Symbol_table::sized_finalize_symbol): Likewise.
9416         (Symbol_table::sized_write_globals): Likewise.
9417         * resolve.cc (Symbol_table::should_override): Likewise.
9418         (Symbol::override_base_with_special): Likewise.
9419
9420         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9421         symbol, change it to have default visibility.
9422         * testsuite/protected_1.cc: New file.
9423         * testsuite/protected_2.cc: New file.
9424         * testsuite/protected_3.cc: New file.
9425         * testsuite/protected_main_1.cc: New file.
9426         * testsuite/protected_main_2.cc: New file.
9427         * testsuite/protected_main_3.cc: New file.
9428         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9429         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9430         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9431         (protected_1.so): New target.
9432         (protected_1_pic.o, protected_2_pic.o): New targets.
9433         (protected_3_pic.o): New target.
9434         (check_PROGRAMS): Add protected_2.
9435         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9436         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9437         * testsuite/Makefile.in: Rebuild.
9438
9439         * options.h (DEFINE_var): Add set_user_set_##varname__.
9440         (DEFINE_bool_alias): New macro.
9441         (class General_options): Define -Bstatic using DEFINE_bool_alias
9442         rather than DEFINE_special.  Add --undefined as an alias for -z
9443         defs.
9444         * options.cc (General_options::parse_Bstatic): Remove.
9445
9446         * options.h (class General_options): Add --fatal-warnings.
9447         * main.cc (main): Implement --fatal-warnings.
9448         * errors.h (Errors::warning_count): New function.
9449
9450         * options.h (class General_options): Add -Bsymbolic-functions.
9451         * symtab.h (Symbol::is_preemptible): Check for
9452         -Bsymbolic-functions.
9453
9454 2008-05-05  Ian Lance Taylor  <iant@google.com>
9455
9456         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9457         as noVARNAME rather than no-VARNAME.
9458         (class General_options): Add option -z combreloc.
9459         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9460         get_address.
9461         (Output_reloc::sort_before) [SHT_REL]: New function.
9462         (Output_reloc::sort_before) [SHT_RELA]: New function.
9463         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9464         Sort_relocs_comparison.
9465         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9466         parameter.  Change all callers.
9467         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9468         sort_relocs parameter.  Change all callers.
9469         * output.cc (Output_reloc::get_address): New function, broken out
9470         of write_rel.
9471         (Output_reloc::write_rel): Call it.
9472         (Output_reloc::compare): New function.
9473         (Output_data_reloc_base::do_write): Optionally sort relocs.
9474
9475         * configure.ac: If targ_extra_obj is set, link it in.
9476         * configure.tgt: Initialize all variables.
9477         (x86_64*): Set targ_extra_obj and targ_extra_size.
9478         * configure: Rebuild.
9479
9480         * object.cc (Sized_relobj::include_section_group): Adjust section
9481         indexes read from group data.  Build vector to pass to
9482         layout_group.
9483         * layout.cc (Layout::layout_group): Add flags and shndxes
9484         parameters.  Remove contents parameter.  Change caller.  Update
9485         explicit instantiations.
9486         * layout.h (class Layout): Update layout_group declaration.
9487         * output.cc (Output_data_group::Output_data_group): Add flags and
9488         input_shndxes parameters.  Remove contents parameter.  Change
9489         caller.
9490         (Output_data_group::do_write): Change input_sections_ to
9491         input_shndxes_.
9492         * output.h (class Output_data_group): Update constructor
9493         declaration.  Rename input_sections_ to input_shndxes_.
9494         * testsuite/many_sections_test.cc: Add template.
9495
9496 2008-04-30  Cary Coutant  <ccoutant@google.com>
9497
9498         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9499
9500         * layout.cc (Layout::include_section): Refactored check for debug
9501         info section.
9502         (Layout::add_comdat): Add new parameters.  Change type
9503         of signature parameter.  Add object and shndx to signatures table.
9504         (Layout::find_kept_object): New function.
9505         * layout.h: Include <cstring>.
9506         (Layout::is_debug_info_section): New function.
9507         (Layout::add_comdat): Add new parameters.
9508         (Layout::find_kept_object): New function.
9509         (Layout::Kept_section): New struct.
9510         (Layout::Signatures): Change type of map range.
9511         * object.cc (Relobj::output_section_address): New function.
9512         (Sized_relobj::include_section_group): Add new parameters.  Change
9513         calls to Layout::add_comdat.  Change to build table of kept comdat
9514         groups and table mapping discarded sections to kept sections.
9515         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9516         (Sized_relobj::do_layout): Change calls to include_section_group and
9517         include_linkonce_section.
9518         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9519         value to zero when section is discarded.
9520         (Sized_relobj::map_to_kept_section): New function.
9521         * object.h (Relobj::output_section_address): New function.
9522         (Relobj::Comdat_group): New type.
9523         (Relobj::find_comdat_group): New function.
9524         (Relobj::Comdat_group_table): New type.
9525         (Relobj::Kept_comdat_section): New type.
9526         (Relobj::Kept_comdat_section_table): New type.
9527         (Relobj::add_comdat_group): New function.
9528         (Relobj::set_kept_comdat_section): New function.
9529         (Relobj::get_kept_comdat_section): New function.
9530         (Relobj::comdat_groups_): New field.
9531         (Relobj::kept_comdat_sections_): New field.
9532         (Symbol_value::input_value): Update comment.
9533         (Sized_relobj::map_to_kept_section) New function.
9534         (Sized_relobj::include_linkonce_section): Add new parameter.
9535         * target-reloc.h (Comdat_behavior): New type.
9536         (get_comdat_behavior): New function.
9537         (relocate_section): Add code to map a discarded section to the
9538         corresponding kept section when applying a relocation.
9539
9540 2008-04-30  Craig Silverstein  <csilvers@google.com>
9541
9542         * dwarf_reader.cc (next_generation_count): New static var.
9543         (Addr2line_cache_entry): New struct.
9544         (addr2line_cache): New static var.
9545         (Dwarf_line_info::one_addr2line): Added caching.
9546         (Dwarf_line_info::clear_addr2line_cache): New function.
9547         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9548         cache-size parameter.
9549         (Dwarf_line_info::one_addr2line_cache): New function.
9550         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9551         new cache-size argument to one_addr2line(), and clear cache.
9552
9553 2008-04-28  Cary Coutant  <ccoutant@google.com>
9554
9555         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9556         R_386_PC8 relocations.
9557
9558 2008-04-23  Ian Lance Taylor  <iant@google.com>
9559
9560         * object.cc (Sized_relobj::include_section_group): Check for
9561         invalid section group.
9562
9563         * object.cc (make_elf_object): Correct test for 64-bit ELF file
9564         header size.
9565
9566         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9567         than read for file header.
9568         * archive.cc (Archive::include_member): Likewise.
9569
9570 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
9571
9572         * aclocal.m4: Regenerate.
9573         * configure: Regenerate.
9574
9575 2008-04-19  Ian Lance Taylor  <iant@google.com>
9576
9577         * version.cc (version_string): Bump to 1.6.
9578
9579         * testsuite/Makefile.am (many_sections_r_test): New target.
9580         (many_sections_r_test_SOURCES): Remove.
9581         (many_sections_r_test_DEPENDENCIES): Remove.
9582         (many_sections_r_test_LDFLAGS): Remove.
9583         (many_sections_r_test_LDADD): Remove.
9584
9585         * object.cc (Sized_relobj::do_add_symbols): Always pass
9586         local_symbol_count_ to add_from_relobj.
9587
9588         * testsuite/Makefile.am (many_sections_check.h): Only check one in
9589         every thousand variables.
9590         * testsuite/Makefile.in: Rebuild.
9591
9592         * object.cc (Xindex::initialize_symtab_xindex): New function.
9593         (Xindex::read_symtab_xindex): New function.
9594         (Xindex::sym_xindex_to_shndx): New function.
9595         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9596         available.
9597         (Sized_relobj::do_initialize_xindex): New function.
9598         (Sized_relobj::do_read_symbols): Adjust section links.
9599         (Sized_relobj::symbol_section_and_value): Add is_ordinary
9600         parameter.  Change all callers.
9601         (Sized_relobj::include_section_group): Adjust section links and
9602         symbol section indexes.
9603         (Sized_relobj::do_layout): Adjust section links.
9604         (Sized_relobj::do_count_local_symbols): Adjust section links and
9605         symbol section indexes.
9606         (Sized_relobj::do_finalize_local_symbols): Distinguish between
9607         ordinary and special symbols.
9608         (Sized_relobj::write_local_symbols): Add symtab_xindex and
9609         dynsym_xindex parameters.  Change all callers.  Adjust section
9610         links.  Use SHN_XINDEX when needed.
9611         (Sized_relobj::get_symbol_location_info): Adjust section links.
9612         Don't get fooled by special symbols.
9613         * object.h (class Xindex): Define.
9614         (class Object): Add xindex_ parameter.  Declare virtual functoin
9615         do_initialize_xindex.
9616         (Object::adjust_sym_shndx): New function.
9617         (Object::set_xindex): New protected function.
9618         (class Symbol_value): Add is_ordinary_shndx_ field.
9619         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9620         (Symbol_value::value): Assert ordinary section.
9621         (Symbol_value::initialize_input_to_output_map): Likewise.
9622         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9623         Change all callers.
9624         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
9625         all callers.
9626         (class Sized_relobj): Update declarations.
9627         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9628         parameter.  Change all callers.
9629         (Sized_relobj::adjust_shndx): New function.
9630         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9631         field.
9632         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9633         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
9634         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
9635         (Sized_dynobj::read_dynsym_section): Adjust section links.
9636         (Sized_dynobj::read_dynamic): Likewise.
9637         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
9638         section links.
9639         (Sized_dynobj::do_initialize_xindex): New function.
9640         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
9641         do_initialize_xindex.
9642         (Sized_dynobj::adjust_shndx): New function.
9643         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9644         dynsym_xindex_ fields.
9645         (Layout::finalize): Add a call to set_section_indexes before
9646         creating the symtab sections.
9647         (Layout::set_section_indexes): Don't do anything if the section
9648         already has a section index.
9649         (Layout::create_symtab_sections): Add shnum parameter.  Change
9650         caller.  Create .symtab_shndx section if needed.
9651         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
9652         caller.
9653         (Layout::allocated_output_section_count): New function.
9654         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9655         needed.
9656         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9657         fields.  Update declarations.
9658         (Layout::symtab_xindex): New function.
9659         (Layout::dynsym_xindex): New function.
9660         (class Write_symbols_task): Add layout_ field.
9661         (Write_symbols_task::Write_symbols_task): Add layout parameter.
9662         Change caller.
9663         * output.cc (Output_section_headers::Output_section_headers): Add
9664         shstrtab_section parameter.  Change all callers.
9665         (Output_section_headers::do_sized_write): Store overflow values
9666         for section count and section string table section index in
9667         section header zero.
9668         (Output_file_header::do_sized_write): Check for overflow of
9669         section count and section string table section index.
9670         (Output_symtab_xindex::do_write): New function.
9671         (Output_symtab_xindex::endian_do_write): New function.
9672         * output.h (class Output_section_headers): Add shstrtab_section_.
9673         Update declarations.
9674         (class Output_symtab_xindex): Define.
9675         (Output_section::has_out_shndx): New function.
9676         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9677         field.
9678         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9679         Change all callers.
9680         (Sized_symbol::init): Likewise.
9681         (Symbol::output_section): Check for ordinary symbol.
9682         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
9683         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
9684         callers.
9685         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9686         Change all callers.  Simplify handling of symbols from sections
9687         not included in the link.
9688         (Symbol_table::add_from_dynobj): Handle ordinary symbol
9689         distinction.
9690         (Weak_alias_sorter::operator()): Assert that symbols are
9691         ordinary.
9692         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9693         distinction.
9694         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9695         parameters.  Change all callers.
9696         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
9697         symbol distinction.  Use SHN_XINDEX when needed.
9698         (Symbol_table::write_section_symbol): Add symtab_xindex
9699         parameter.  Change all callers.
9700         (Symbol_table::sized_write_section_symbol): Likewise.  Use
9701         SHN_XINDEX when needed.
9702         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
9703         declarations.
9704         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
9705         (Symbol::is_defined): Check is_ordinary.
9706         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9707         (Symbol::is_absolute, Symbol::is_common): Likewise.
9708         (class Sized_symbol): Update declarations.
9709         (class Symbol_table): Update declarations.
9710         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9711         parameters.  Change all callers.
9712         (Sized_symbol::override): Likewise.
9713         (Symbol_table::override): Likewise.
9714         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
9715         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
9716         is_ordinary, and orig_st_shndx parameters.  Change all callers.
9717         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9718         to be in an ordinary section.
9719         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9720         object and is_ordinary parameters.  Change all callers.
9721         (Sized_dwarf_line_info::read_relocs): Add object parameter.
9722         Change all callers.  Don't add undefined or non-ordinary symbols
9723         to reloc_map_.
9724         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9725         Change all callers.
9726         * dwarf_reader.h (class Sized_dwarf_line_info): Update
9727         declarations.
9728         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9729         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9730         (Sized_relobj::relocate_sections): Likewise.
9731         * target-reloc.h (scan_relocs): Adjust section symbol index.
9732         (scan_relocatable_relocs): Likewise.
9733         * i386.cc (Scan::local): Check for ordinary symbols.
9734         * sparc.cc (Scan::local): Likewise.
9735         * x86_64.cc (Scan::local): Likewise.
9736         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9737         to symbol_section_and_value.
9738         * testsuite/many_sections_test.cc: New file.
9739         * testsuite/Makefile.am (BUILT_SOURCES): Define.
9740         (check_PROGRAMS): Add many_sections_test.
9741         (many_sections_test_SOURCES): Define.
9742         (many_sections_test_DEPENDENCIES): Define.
9743         (many_sections_test_LDFLAGS): Define.
9744         (BUILT_SOURCES): Add many_sections_define.h.
9745         (many_sections_define.h): New target.
9746         (BUILT_SOURCES): Add many_sections_check.h.
9747         (many_sections_check.h): New target.
9748         (check_PROGRAMS): Add many_sections_r_test.
9749         (many_sections_r_test_SOURCES): Define.
9750         (many_sections_r_test_DEPENDENCIES): Define.
9751         (many_sections_r_test_LDFLAGS): Define.
9752         (many_sections_r_test_LDADD): Define.
9753         (many_sections_r_test.o): New target.
9754         * testsuite/Makefile.in: Rebuild.
9755
9756 2008-04-17  Cary Coutant  <ccoutant@google.com>
9757
9758         * errors.cc (Errors::info): New function.
9759         (gold_info): New function.
9760         * errors.h (Errors::info): New function.
9761         * gold.h (gold_info): New function.
9762         * object.cc (Input_objects::add_object): Print trace output.
9763         * options.cc (options::parse_set): New function.
9764         (General_options::parse_wrap): Deleted.
9765         (General_options::General_options): Deleted initializer.
9766         * options.h (options::String_set): New typedef.
9767         (options::parse_set): New function.
9768         (DEFINE_set): New macro.
9769         (General_options::wrap): Changed to use DEFINE_set. Changed
9770         callers of any_wrap_symbols and is_wrap_symbol.
9771         (General_options::trace, General_options::trace_symbol):
9772         New options.
9773         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9774         (General_options::wrap_symbols_): Deleted.
9775         * symtab.cc (Symbol_table::add_from_object): Print trace output.
9776
9777 2008-04-17  David S. Miller  <davem@davemloft.net>
9778
9779         * options.cc (General_options::parse_V): New function.
9780         * options.h: Add entries for -V and -Qy.
9781
9782 2008-04-17  Ian Lance Taylor  <iant@google.com>
9783
9784         * common.cc (Symbol_table::allocate_commons): Remove options
9785         parameter.  Change caller.
9786         (Symbol_table::do_allocate_commons): Remove options parameter.
9787         Change caller.  Just call do_allocate_commons_list twice.
9788         (Symbol_table::do_allocate_commons_list): New function, broken out
9789         of do_allocate_commons.
9790         * common.h (class Allocate_commons_task): Remove options_ field.
9791         Update constructor.
9792         * symtab.cc (Symbol_table::Symbol_table): Initialize
9793         tls_commons_.
9794         (Symbol_table::add_from_object): Put TLS common symbols on
9795         tls_commons_ list.
9796         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9797         which are IN_OUTPUT_DATA.
9798         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
9799         allocate_commons and do_allocate_commons declarations.  Declare
9800         do_allocate_commons_list.
9801         * gold.cc (queue_middle_tasks): Update creation of
9802         Allocate_commons_task to not pass options.
9803         * testsuite/Makefile.am (INCLUDES): Add -I.. .
9804         (TLS_TEST_C_FLAGS): New variable.
9805         (tls_test_c_pic.o): New target.
9806         (tls_test_shared.so): Link in tls_test_c_pic.o.
9807         (tls_test_c_pic_ie.o): New target.
9808         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9809         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9810         (tls_test_c.o): New target.
9811         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9812         (tls_pic_test_LDADD): Likewise.
9813         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9814         (tls_shared_gd_to_ie_test_LDADD): Likewise.
9815         (tls_test_c_gnu2.o): New target.
9816         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9817         tls_test_c_gnu2.o.
9818         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9819         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9820         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9821         * testsuite/tls_test.cc: Include "config.h".
9822         (t_last): Call t11_last.
9823         * testsuite/tls_test.h (t11, t11_last): Declare.
9824         * testsuite/tls_test_c.c: New file.
9825         * testsuite/tls_test_main.cc (thread_routine): Call t11.
9826         * configure.ac: Check for OpenMP support.
9827         * configure, config.in, Makefile.in: Rebuild.
9828         * testsuite/Makefile.in: Rebuild.
9829
9830 2008-04-16  Cary Coutant  <ccoutant@google.com>
9831
9832         * i386.cc (Target_i386::define_tls_base_symbol): New function.
9833         (Target_i386::tls_base_symbol_defined_): New field.
9834         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9835         (Target_i386::Scan::global): Likewise.
9836         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9837         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9838         (Target_x86_64::tls_base_symbol_defined_): New field.
9839         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9840         (Target_x86_64::Scan::global): Likewise.
9841
9842 2008-04-16  Cary Coutant  <ccoutant@google.com>
9843
9844         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9845         (Symbol::needs_plt_entry): Allow weak undefined symbols.
9846         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9847         building shared libraries.
9848         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9849         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9850         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9851         * testsuite/Makefile.in: Rebuild.
9852         * testsuite/weak_undef.h: New file.
9853         * testsuite/weak_undef_file1.cc: Add extra test cases.
9854         * testsuite/weak_undef_file2.cc: Likewise.
9855         * testsuite/weak_undef_test.cc: Likewise.
9856
9857 2008-04-16  David S. Miller  <davem@davemloft.net>
9858
9859         * sparc.cc (Target_sparc::Scan): Change from struct to class.
9860         Add issued_non_pic_error_ field.  Declare check_non_pic.
9861         (Target_sparc::Scan::check_non_pic): New function.
9862         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9863         (Target_sparc::Scan::global): Likewise.
9864
9865         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9866         * configure: Rebuild.
9867
9868         * options.h (DEFINE_enable): New macro.
9869         (new_dtags): New enable option.
9870         (initfirst, interpose, loadfltr, nodefaultlib,
9871         nodelete, nodlopen, nodump): New -z options.
9872         * layout.cc (Layout:finish_dynamic_section): If new
9873         dtags enabled, emit DT_RUNPATH.  Also, emit a
9874         DT_FLAGS_1 containing any specified -z flags.
9875
9876 2008-04-16  Ian Lance Taylor  <iant@google.com>
9877
9878         * copy-relocs.cc: New file.
9879         * copy-relocs.h: New file.
9880         * reloc.cc: Remove Copy_relocs code.
9881         * reloc.h: Likewise.
9882         * reloc-types.h (struct Reloc_types) [both versions]: Add
9883         get_reloc_addend_noerror.
9884         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9885         variants of add_global which take an addend which must be zero.
9886         * i386.cc: Include "copy-relocs.h".
9887         (class Target_i386): Change type of copy_relocs_ to variable,
9888         update initializer.
9889         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9890         Change all callers.
9891         (Target_i386::do_finalize_sections): Change handling of
9892         copy_relocs_.
9893         * sparc.cc: Include "copy-relocs.h".
9894         (class Target_sparc): Change type of copy_relocs_ to variable,
9895         update initializer.
9896         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9897         Change all callers.
9898         (Target_sparc::do_finalize_sections): Change handling of
9899         copy_relocs_.
9900         * x86_64.cc: Include "copy-relocs.h".
9901         (class Target_x86_64): Change type of copy_relocs_ to variable,
9902         update initializer.
9903         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9904         class.  Change all callers.
9905         (Target_x86_64::do_finalize_sections): Change handling of
9906         copy_relocs_.
9907         * Makefile.am (CCFILES): Add copy-relocs.cc.
9908         (HFILES): Add copy-relocs.h.
9909
9910         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9911
9912         * testsuite/script_test_4.sh: Permit leading zeroes.
9913
9914 2008-04-15  Ian Lance Taylor  <iant@google.com>
9915
9916         * script-sections.cc (Script_sections::create_segments): Use
9917         header_size_adjustment even when there is enough room for the
9918         headers.
9919         * testsuite/script_test_4.sh: New file.
9920         * testsuite/script_test_4.t: New file.
9921         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9922         (check_DATA): Add script_test_4.stdout.
9923         (MOSTLYCLEANFILES): Likewise.
9924         (script_test_4): New target.
9925         (script_test_4.stdout): New target.
9926         * testsuite/Makefile.in: Rebuild.
9927
9928         * sparc.cc: Add definitions for Output_data_plt_sparc class
9929         constants.
9930
9931 2008-04-14  David S. Miller  <davem@davemloft.net>
9932
9933         * sparc.cc: New file.
9934         * Makefile.am (TARGETSOURCES): Add sparc.cc
9935         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9936         * configure.tgt: Document targ_extra_size and
9937         targ_extra_big_endian.  Add entries for sparc-* and
9938         sparc64-*.
9939         * configure.ac: Handle targ_extra_size and
9940         targ_extra_big_endian.
9941         * Makefile.in: Rebuild.
9942         * configure: Likewise.
9943         * po/POTFILES.in: Likewise.
9944         * po/gold.pot: Likewise.
9945
9946 2008-04-14  Ian Lance Taylor  <iant@google.com>
9947
9948         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9949         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9950         in the name/type/flags to section mapping.  Don't call
9951         allocate_output_section.
9952         (Layout::choose_output_section): Change parameter from adjust_name
9953         to is_input_section.  Don't permit input sections after sections
9954         are attached to segments.  Don't call allocate_output_section.
9955         (Layout::layout_eh_frame): Call update_flags_for_input_section,
9956         not write_enable_output_section.
9957         (Layout::make_output_section): Don't push to
9958         unattached_section_list_ nor call attach_to_segment.  Call
9959         attach_section_to_segment if sections are attached.
9960         (Layout::attach_sections_to_segments): New function.
9961         (Layout::attach_section_to_segment): New function.
9962         (Layout::attach_allocated_section_to_segment): Rename from
9963         attach_to_segment.  Remove flags parameter.
9964         (Layout::allocate_output_section): Remove function.
9965         (Layout::write_enable_output_section): Remove function.
9966         * layout.h (class Layout): Update for above changes.  Add new
9967         field sections_are_attached_.
9968         * output.h (Output_section::update_flags_for_input_section): New
9969         function.
9970         * output.cc (Output_section::add_input_section): Call
9971         update_flags_for_input_section.
9972         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9973
9974 2008-04-11  Cary Coutant  <ccoutant@google.com>
9975
9976         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9977         thought unnecessary.
9978         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9979
9980 2008-04-11  Ian Lance Taylor  <iant@google.com>
9981
9982         * output.h (class Output_section_data): Remove inline definition
9983         of set_addralign.
9984         * output.cc (Output_section_data::set_addralign): New function.
9985
9986 2008-04-11  Cary Coutant  <ccoutant@google.com>
9987
9988         Add support for TLS descriptors for i386 and x86_64.
9989         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9990         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9991         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9992         GOT_TYPE_TLS_DESC.
9993         (Target_i386::got_mod_index_entry): Remove unnecessary code.
9994         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9995         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
9996         relocations.
9997         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9998         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9999         Fix problem with initial-exec relocations.
10000         (Target_i386::Relocate::relocate_tls): Likewise.
10001         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10002         relaxation.
10003         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10004         support for section-plus-offset dynamic table entries.
10005         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10006         (Output_data_dynamic::Dynamic_entry): Add support for
10007         section-plus-offset dynamic table entries.
10008         (Output_data_dynamic::Classification): Likewise.
10009         (Output_data_dynamic::classification_): Renamed offset_.
10010         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10011         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10012         (Target_x86_64::make_plt_section): New function.
10013         (Target_x86_64::reserve_tlsdesc_entries): New function.
10014         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10015         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10016         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10017         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10018         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10019         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10020         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10021         add extra PLT entry for TLS descriptors.
10022         (Output_data_plt_x86_64::got_): New field.
10023         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10024         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10025         fields.
10026         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10027         descriptors.
10028         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10029         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10030         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10031         R_386_TLS_DESC_CALL relocations.
10032         (Target_x86_64::Scan::global): Likewise.
10033         (Target_x86_64::do_finalize_sections): Add dynamic table entries
10034         for TLS descriptors.
10035         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10036         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10037         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10038         GD-to-IE relaxation.
10039         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10040         and TLS_DESCRIPTORS.
10041         * Makefile.in: Rebuild.
10042         * configure: Rebuild.
10043         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10044         (tls_test_shared2.so): New target.
10045         (tls_shared_gd_to_ie_test_SOURCES): New variable.
10046         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10047         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10048         (tls_shared_gd_to_ie_test_LDADD): New variable.
10049         (tls_shared_gnu2_gd_to_ie_test): New target.
10050         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10051         New targets.
10052         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10053         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10054         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10055         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10056         (tls_shared_gnu2_test): New target.
10057         (tls_test_gnu2_shared.so): New target.
10058         (tls_shared_gnu2_test_SOURCES): New variable.
10059         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10060         (tls_shared_gnu2_test_LDFLAGS): New variable.
10061         (tls_shared_gnu2_test_LDADD): New variable.
10062         * testsuite/Makefile.in: Rebuild.
10063         * testsuite/Makefile.
10064
10065 2008-04-11  Ian Lance Taylor  <iant@google.com>
10066
10067         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10068         justsyms.t.
10069         * testsuite/Makefile.in: Rebuild.
10070
10071         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10072         long.
10073         * testsuite/script_test_2.cc (main): Adjust test.
10074
10075 2008-04-11  David S. Miller  <davem@davemloft.net>
10076             Ian Lance Taylor  <iant@google.com>
10077
10078         * options.h (General_options): Add entries for '-Y' and
10079         '-relax'.
10080         * options.cc (General_options:finalize): If -Y was used, add those
10081         entries to the library path instead of the default "/lib" and
10082         "/usr/lib".
10083
10084 2008-04-11  David S. Miller  <davem@davemloft.net>
10085
10086         * testsuite/justsyms.t: Start at 0x100.
10087         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10088         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10089         long.
10090         * testsuite/script_test_2.cc: Adjust string and section length
10091         checks.
10092
10093 2008-04-09  Ian Lance Taylor  <iant@google.com>
10094
10095         PR gold/5996
10096         * script-sections.cc (Sections_element::allocate_to_segment): Add
10097         orphan parameter.
10098         (Output_section_definition::allocate_to_segment): Likewise.
10099         (Orphan_output_section::allocate_to_segment): Likewise.
10100         (Script_sections::attach_sections_using_phdrs_clause): Don't
10101         propagate non-PT_LOAD segments to orphan sections.
10102         * testsuite/Makefile.am (script_test_3.stdout): Generate using
10103         readelf rather than objdump.
10104         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
10105         .interp section and PT_INTERP segment are the same size.
10106         * testsuite/Makefile.in: Rebuild.
10107
10108         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10109         aliases for symbols defined in the same object.
10110         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10111         (weak_alias_test_SOURCES): New variable.
10112         (weak_alias_test_DEPENDENCIES): New variable.
10113         (weak_alias_test_LDFLAGS): New variable.
10114         (weak_alias_test_LDADD): New variable.
10115         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10116         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10117         (weak_alias_test_3.o): New target.
10118         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10119         * testsuite/weak_alias_test_main.cc: New file.
10120         * testsuite/weak_alias_test_1.cc: New file.
10121         * testsuite/weak_alias_test_2.cc: New file.
10122         * testsuite/weak_alias_test_3.cc: New file.
10123
10124 2008-04-08  Ian Lance Taylor  <iant@google.com>
10125
10126         * options.h (class General_options): Add --noinhibit-exec option.
10127         * main.cc (main): Check --noinhibit-exec.
10128
10129         * options.h (class General_options): Define --wrap as a special
10130         option.  Add wrap_symbols_ field.
10131         (General_options::any_wrap_symbols): New function.
10132         (General_options::is_wrap_symbol): New function.
10133         * options.cc (General_options::parse_wrap): New function.
10134         (General_options::General_options): Initialize wrap_symbols_.
10135         * symtab.cc (Symbol_table::wrap_symbol): New function.
10136         (Symbol_table::add_from_object): Handle --wrap.
10137         * symtab.h (class Symbol_table): Declare wrap_symbol.
10138         * target.h (Target::wrap_char): New function.
10139         (Target::Target_info): Add wrap_char field.
10140         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10141         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10142         * testsuite/testfile.cc (Target_test::test_target_info):
10143         Likewise.
10144
10145         * errors.cc (Errors::undefined_symbol): Mention symbol version if
10146         there is one.
10147
10148         * layout.h (class Layout): Add added_eh_frame_data_ field.
10149         * layout.cc (Layout::Layout): Initialize new field.
10150         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10151         output section until we find a section we merged successfully.
10152         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10153         that the size be non-zero.
10154
10155         * merge.cc (Object_merge_map::get_output_offset): Remove inline
10156         qualifier.
10157
10158 2008-04-08  Craig Silverstein  <csilvers@google.com>
10159
10160         * configure.ac: Export new conditional variable HAVE_ZLIB.
10161         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10162         on HAVE_ZLIB.
10163         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10164         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10165
10166 2008-04-07  Ian Lance Taylor  <iant@google.com>
10167
10168         * version.cc (version_string): Set to "1.5".
10169
10170         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10171         Add issued_non_pic_error_ field.  Declare check_non_pic.
10172         (Target_x86_64::Scan::check_non_pic): New function.
10173         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10174         (Target_x86_64::Scan::global): Likewise.
10175
10176         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10177         addend parameter.  Change caller.  Handle merge sections.
10178         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10179         Address to Addend.  Don't add in the result of
10180         local_section_offset, pass down the addend and use the returned
10181         value.
10182         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10183         Update declarations of local_section_offset and symbol_value.
10184         * testsuite/two_file_test_1.cc (t18): New function.
10185         * testsuite/two_file_test_2.cc (f18): New function.
10186         * testsuite/two_file_test_main.cc (main): Call t18.
10187         * testsuite/two_file_test.h (t18, f18): Declare.
10188
10189         * configure.ac: Don't test for objdump, c++filt, or readelf.
10190         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10191         conditionals.
10192         (TEST_READELF): New variable.
10193         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10194         (check_PROGRAMS): Add two_file_strip_test.
10195         (two_file_strip_test): New target.
10196         (check_PROGRAMS): Add two_file_same_shared_strip_test.
10197         (two_file_same_shared_strip_test_SOURCES): New variable.
10198         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10199         (two_file_same_shared_strip_test_LDFLAGS): New variable.
10200         (two_file_same_shared_strip_test_LDADD): New variable.
10201         (two_file_shared_strip.so): New target.
10202         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10203         (ver_test_5.syms, ver_test_7.syms): Likewise.
10204         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10205         (strip_test_3.stdout): Use TEST_OBJDUMP.
10206         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10207
10208 2008-04-04  Cary Coutant  <ccoutant@google.com>
10209
10210         * symtab.h (Symbol::is_weak_undefined): New function.
10211         (Symbol::is_strong_undefined): New function.
10212         (Symbol::is_absolute): New function.
10213         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10214         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10215         absolute symbols.
10216         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10217         (weak_undef_test): New target.
10218         * testsuite/Makefile.in: Rebuild.
10219         * testsuite/weak_undef_file1.cc: New file.
10220         * testsuite/weak_undef_file2.cc: New file.
10221         * testsuite/weak_undef_test.cc: New file.
10222
10223 2008-04-03  Craig Silverstein  <csilvers@google.com>
10224
10225         * compressed_output.h (class Output_compressed_section): Use
10226         unsigned buffer.
10227         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10228         add zlib header.
10229         (zlib_compressed_suffix): Removed.
10230         (Output_compressed_section::set_final_data_size): Use unsigned
10231         buffers.
10232         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10233         Fix linker invocation.
10234         (flagstest_o_specialfile_and_compress_debug_sections):
10235         Likewise.
10236         * testsuite/Makefile.in: Regenerated.
10237
10238 2008-04-02  David S. Miller  <davem@davemloft.net>
10239
10240         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10241         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10242
10243 2008-04-02  Craig Silverstein  <csilvers@google.com>
10244
10245         * TODO: New file.
10246
10247 2008-04-02  Ian Lance Taylor  <iant@google.com>
10248
10249         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10250         parameters.  Update for new key type to views_.  Change all
10251         callers.
10252         (File_read::read): Adjust for byteshift in returned view.
10253         (File_read::add_view): New function, broken out of
10254         find_and_make_view.
10255         (File_read::make_view): New function, broken out of
10256         find_and_make_view.
10257         (File_read::find_or_make_view): Add offset and aligned
10258         parameters.  Rewrite accordingly.  Change all callers.
10259         (File_read::get_view): Add offset and aligned parameters.  Adjust
10260         for byteshift in return value.
10261         (File_read::get_lasting_view): Likewise.
10262         * fileread.h (class File_read): Update declarations.
10263         (class File_read::View): Add byteshift_ field.  Add byteshift to
10264         constructor.  Add byteshift method.
10265         * archive.h (Archive::clear_uncached_views): New function.
10266         (Archive::get_view): Add aligned parameter.  Change all callers.
10267         * object.h (Object::get_view): Add aligned parameter.  Change all
10268         callers.
10269         (Object::get_lasting_view): Likewise.
10270
10271         * fileread.cc (File_read::release): Don't call clear_views if
10272         there are multiple objects.
10273         * fileread.h (File_read::clear_uncached_views): New function.
10274         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10275         on the archive.
10276
10277 2008-03-31  Cary Coutant  <ccoutant@google.com>
10278
10279         Add thin archive support.
10280         * archive.cc (Archive::armagt): New const.
10281         (Archive::setup): Remove task parameter and calls to unlock.
10282         (Archive::unlock_nested_archives): New function.
10283         (Archive::read_header): Add nested_off parameter. Change
10284         all callers.
10285         (Archive::interpret_header): Likewise.
10286         (Archive::include_all_members): Change to handle thin
10287         archives.
10288         (Archive::include_member): Likewise.
10289         * archive.h (Archive::Archive): Add new parameters and
10290         initializers.
10291         (Archive::armagt): New const.
10292         (Archive::setup): Remove task parameter.
10293         (Archive::unlock_nested_archives): New function.
10294         (Archive::read_header): Add nested_off parameter.
10295         (Archive::interpret_header): Likewise.
10296         (Archive::Nested_archive_table): New typedef.
10297         (Archive::is_thin_archive_): New field.
10298         (Archive::nested_archives_): New field.
10299         (Archive::options_): New field.
10300         (Archive::dirpath_): New field.
10301         (Archive::task_): New field.
10302         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10303         for thin archives.  Pass additional parameters to
10304         Archive::Archive.  Unlock the archive file after calling
10305         Archive::setup.
10306
10307 2008-03-29  Ian Lance Taylor  <iant@google.com>
10308
10309         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10310         version symbol to be local.
10311         * testsuite/ver_test_4.sh: New file.
10312         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10313         (check_DATA): Add ver_test_4.syms.
10314         (ver_test_4.syms): New target.
10315         * testsuite/Makefile.in: Rebuild.
10316
10317         * output.cc
10318         (Output_section::Input_section_sort_entry::has_priority): New
10319         function.
10320         (Output_section::Input_section_sort_entry::match_file_name): New
10321         function.
10322         (Output_section::Input_section_sort_entry::match_section_name):
10323         Remove.
10324         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10325         Remove.
10326         (Output_section::Input_section_sort_entry::match_section_file):
10327         Remove.
10328         (Output_section::Input_section_sort_compare::operator()): Rewrite
10329         using new Input_section_sort_entry functions.  Sort crtbegin and
10330         crtend first.  Sort sections with no priority before sections with
10331         a priority.
10332         * testsuite/initpri1.c (d3): Check j != 4.
10333         (cd5): New constructor/destructor function.
10334         (main): Check j != 2.
10335
10336         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10337         new symbol when resolving, don't call set_is_default.
10338         * testsuite/ver_test_7.cc: New file.
10339         * testsuite/ver_test_7.sh: New file.
10340         * testsuite/Makefile.am (ver_test_7.so): New target.
10341         (ver_test_7.o): New target.
10342         (check_SCRIPTS): Add ver_test_7.sh.
10343         (check_DATA): Add ver_test_7.syms.
10344         (ver_test_7.syms): New target.
10345
10346 2008-03-28  Ian Lance Taylor  <iant@google.com>
10347
10348         * layout.cc (Layout::layout): If we see an input section with a
10349         name that needs sorting, set the must_sort flag for the output
10350         section.
10351         (Layout::make_output_section): If the name of the output section
10352         indicates that it might require sorting, set the may_sort flag.
10353         * output.h (Output_section::may_sort_attached_input_sections): New
10354         function.
10355         (Output_section::set_may_sort_attached_input_sections): New
10356         function.
10357         (Output_section::must_sort_attached_input_sections): New
10358         function.
10359         (Output_section::set_must_sort_attached_input_sections): New
10360         function.
10361         (class Output_section): Declare Input_section_sort_entry.  Define
10362         Input_section_sort_compare.  Declare
10363         sort_attached_input_sections.  Add new fields:
10364         may_sort_attached_input_sections_,
10365         must_sort_attached_input_sections_,
10366         attached_input_sections_are_sorted_.
10367         * output.cc (Output_section::Output_section): Initialize new
10368         fields.
10369         (Output_section::add_input_section): Add an entry to
10370         input_sections_ if may_sort or must_sort are true.
10371         (Output_section::set_final_data_size): Call
10372         sort_attached_input_sections if necessary.
10373         (Output_section::Input_section_sort_entry): Define new class.
10374         (Output_section::Input_section_sort_compare::operator()): New
10375         function.
10376         (Output_section::sort_attached_input_sections): New function.
10377         * configure.ac: Check whether the compiler supports constructor
10378         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10379         * testsuite/initpri1.c: New file.
10380         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10381         CONSTRUCTOR_PRIORITY.
10382         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10383         (initpri1_LDFLAGS): New variable.
10384         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10385
10386 2008-03-27  Ian Lance Taylor  <iant@google.com>
10387
10388         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10389         * testsuite/common_test_1.c: New file.
10390         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10391         (common_test_1_SOURCES): New variable.
10392         (common_test_1_DEPENDENCIES): New variable.
10393         (common_test_1_LDFLAGS): New variable.
10394
10395         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10396         and commons_ correctly when NAME/VERSION does not override
10397         NAME/NULL.
10398         * testsuite/ver_test_6.c: New file.
10399         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10400         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10401         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10402
10403 2008-03-26  Ian Lance Taylor  <iant@google.com>
10404
10405         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10406         of an undefined symbol from a version script.
10407         * testsuite/Makefile.am (ver_test_5.so): New target.
10408         (ver_test_5.o): New target.
10409         (check_SCRIPTS): Add ver_test_5.sh.
10410         (check_DATA): Add ver_test_5.syms.
10411         (ver_test_5.syms): New target.
10412         * testsuite/ver_test_5.cc: New file.
10413         * testsuite/ver_test_5.script: New file.
10414         * testsuite/ver_test_5.sh: New file.
10415         * Makefile.in, testsuite/Makefile.in: Rebuild.
10416
10417         PR gold/5986
10418         Fix problems building gold with gcc 4.3.0.
10419         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10420         (gold_error_at_location, gold_warning_at_location): Use it.
10421         * configure.ac: Check whether we can compile and use a template
10422         function with a printf attribute.
10423         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10424         when jumping over bytes.
10425         * object.cc: Instantiate Object::read_section_data.
10426         * debug.h: Include <cstring>
10427         * dwarf_reader.cc: Include <algorithm>
10428         * main.cc: Include <cstring>.
10429         * options.cc: Include <cstring>.
10430         * output.cc: Include <cstring>.
10431         * script.cc: Include <cstring>.
10432         * script.h: Include <string>.
10433         * symtab.cc: Include <cstring> and <algorithm>.
10434         * target-select.cc: Include <cstring>.
10435         * version.cc: Include <string>.
10436         * testsuite/testmain.cc: Include <cstdlib>.
10437         * configure, config.in: Rebuild.
10438
10439 2008-03-25  Ian Lance Taylor  <iant@google.com>
10440
10441         * options.cc: Include "../bfd/bfdver.h".
10442         (options::help): Print bug reporting address.
10443
10444         * version.cc (print_version): Adjust output for current value of
10445         BFD_VERSION_STRING.
10446
10447         * NEWS: New file.
10448
10449         * options.cc (options::help): Print list of supported targets.
10450         * target-select.h: Include <vector>.
10451         (class Target_selector): Make machine_, size_, and is_big_endian_
10452         fields const.  Add bfd_name_ and instantiated_target_ fields.
10453         (Target_selector::Target_selector): Add bfd_name parameter.
10454         (Target_selector::recognize): Make non-virtual, call
10455         do_recognize.
10456         (Target_selector::recognize_by_name): Make non-virtual, call
10457         do_recognize_by_name.
10458         (Target_selector::supported_names): New function.
10459         (Target_selector::bfd_name): New function.
10460         (Target_selector::do_instantiate_target): New pure virtual
10461         function.
10462         (Target_selector::do_recognize): New virtual function.
10463         (Target_selector::do_recognize_by_name): New virtual function.
10464         (Target_selector::instantiate_target): New private function.
10465         (supported_target_names): Declare.
10466         * target-select.cc (Target_selector::Target_selector): Update for
10467         new parameter and fields.
10468         (select_target_by_name): Check that the name matches before
10469         calling recognize_by_name.
10470         (supported_target_names): New function.
10471         * i386.cc (class Target_selector_i386): Update Target_selector
10472         constructor call.  Remove recognize and recognize_by_name.  Add
10473         do_instantiate_target.
10474         * x86_64.cc (class Target_selector_x86_64): Likewise.
10475         * testsuite/testfile.cc (class Target_selector_test): Update for
10476         changes to Target_selector.
10477
10478         * README: Rewrite, with some notes on unsupported features.
10479
10480 2008-03-24  Cary Coutant  <ccoutant@google.com>
10481
10482         * i386.cc (Target_i386::Got_type): New enum declaration.
10483         (Target_i386::Scan::local): Updated callers of Output_data_got
10484         member functions.
10485         (Target_i386::Scan::global): Likewise.
10486         (Target_i386::Relocate::relocate): Likewise.
10487         (Target_i386::Relocate::relocate_tls): Likewise.
10488         * object.h (Got_offset_list): New class.
10489         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10490         (Sized_relobj::local_got_offset): Likewise.
10491         (Sized_relobj::set_local_got_offset): Likewise.
10492         (Sized_relobj::local_has_tls_got_offset): Removed.
10493         (Sized_relobj::local_tls_got_offset): Removed.
10494         (Sized_relobj::set_local_tls_got_offset): Removed.
10495         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10496         * output.cc (Output_data_got::add_global): Added got_type parameter.
10497         (Output_data_got::add_global_with_rel): Likewise.
10498         (Output_data_got::add_global_with_rela): Likewise.
10499         (Output_data_got::add_global_pair_with_rel): New function.
10500         (Output_data_got::add_global_pair_with_rela): New function.
10501         (Output_data_got::add_local): Added got_type parameter.
10502         (Output_data_got::add_local_with_rel): Likewise.
10503         (Output_data_got::add_local_with_rela): Likewise.
10504         (Output_data_got::add_local_pair_with_rel): New function.
10505         (Output_data_got::add_local_pair_with_rela): New function.
10506         (Output_data_got::add_global_tls): Removed.
10507         (Output_data_got::add_global_tls_with_rel): Removed.
10508         (Output_data_got::add_global_tls_with_rela): Removed.
10509         (Output_data_got::add_local_tls): Removed.
10510         (Output_data_got::add_local_tls_with_rel): Removed.
10511         (Output_data_got::add_local_tls_with_rela): Removed.
10512         * output.h (Output_data_got::add_global): Added got_type parameter.
10513         (Output_data_got::add_global_with_rel): Likewise.
10514         (Output_data_got::add_global_with_rela): Likewise.
10515         (Output_data_got::add_global_pair_with_rel): New function.
10516         (Output_data_got::add_global_pair_with_rela): New function.
10517         (Output_data_got::add_local): Added got_type parameter.
10518         (Output_data_got::add_local_with_rel): Likewise.
10519         (Output_data_got::add_local_with_rela): Likewise.
10520         (Output_data_got::add_local_pair_with_rel): New function.
10521         (Output_data_got::add_local_pair_with_rela): New function.
10522         (Output_data_got::add_global_tls): Removed.
10523         (Output_data_got::add_global_tls_with_rel): Removed.
10524         (Output_data_got::add_global_tls_with_rela): Removed.
10525         (Output_data_got::add_local_tls): Removed.
10526         (Output_data_got::add_local_tls_with_rel): Removed.
10527         (Output_data_got::add_local_tls_with_rela): Removed.
10528         * resolve.cc (Symbol::override_base_with_special): Removed
10529         reference to has_got_offset_ field.
10530         * symtab.cc (Symbol::init_fields): Replaced initialization
10531         of got_offset_ with got_offsets_.  Removed initialization
10532         of has_got_offset_
10533         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10534         (Symbol::got_offset): Likewise.
10535         (Symbol::set_got_offset): Likewise.
10536         (Symbol::has_tls_got_offset): Removed.
10537         (Symbol::tls_got_offset): Removed.
10538         (Symbol::set_tls_got_offset): Removed.
10539         (Symbol::got_offset_): Removed.
10540         (Symbol::tls_mod_got_offset_): Removed.
10541         (Symbol::tls_pair_got_offset_): Removed.
10542         (Symbol::got_offsets_): New field.
10543         (Symbol::has_got_offset): Removed.
10544         (Symbol::has_tls_mod_got_offset): Removed.
10545         (Symbol::has_tls_pair_got_offset): Removed.
10546         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10547         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10548         member functions.
10549         (Target_x86_64::Scan::global): Likewise.
10550         (Target_x86_64::Relocate::relocate): Likewise.
10551         (Target_x86_64::Relocate::relocate_tls): Likewise.
10552
10553 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10554
10555         * yyscript.y: Fix spelling error in comment.
10556
10557 2008-03-24  Ian Lance Taylor  <iant@google.com>
10558
10559         * options.h (class General_options): Define build_id option.
10560         * layout.h (class Layout): Declare write_build_id, create_note,
10561         create_build_id.  Add build_id_note_ member.
10562         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10563         "libiberty.h", "md5.h", "sha1.h".
10564         (Layout::Layout): Initialize eh_frame_data_,
10565         eh_frame_hdr_section_, and build_id_note_.
10566         (Layout::finalize): Call create_build_id.
10567         (Layout::create_note): New function, broken out of
10568         Layout::create_gold_note.
10569         (Layout::create_gold_note): Call create_note.
10570         (Layout::create_build_id): New function.
10571         (Layout::write_build_id): New function.
10572         (Close_task_runner::run): Call write_build_id.
10573
10574         * x86_64.cc: Correct license to GPLv3.
10575
10576 2008-03-23  Ian Lance Taylor  <iant@google.com>
10577
10578         * options.cc: Include "demangle.h".
10579         (parse_optional_string): New function.
10580         (parse_long_option): Handle takes_optional_argument.
10581         (parse_short_option): Update dash_z initializer.  Handle
10582         takes_optional_argument.
10583         (General_options::General_options): Initialize do_demangle_.
10584         (General_options::finalize): Set do_demangle_.  Handle demangling
10585         style.
10586         * options.h (parse_optional_string): Declare.
10587         (struct One_option): Add optional_arg field.  Update constructor.
10588         Update call constructor calls.  Add takes_optional_argument
10589         function.
10590         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
10591         (DEFINE_optional_string): Define.
10592         (General_options::demangle): Change from DEFINE_bool to
10593         DEFINE_optional_string.
10594         (General_options::no_demangle): New function.
10595         (General_options::do_demangle): New function.
10596         (General_options::set_do_demangle): New function.
10597         (General_options::execstack_status_): Move definition to end of
10598         class definition.
10599         (General_options::static_): Likewise.
10600         (General_options::do_demangle_): New field.
10601         * object.cc (big_endian>::get_symbol_location_info): Call
10602         Options::do_demangle, not Options::demangle.
10603         * symtab.cc (demangle): Likewise.
10604
10605 2008-03-22  Ian Lance Taylor  <iant@google.com>
10606
10607         * gold.h: Include <cstddef> and <sys/types.h>
10608         * options.h: Include <cstring>.
10609
10610 2008-03-21  Ian Lance Taylor  <iant@google.com>
10611
10612         * Added source code to GNU binutils.