bb29127f9e3a8563fb9de63bdecf15d14cdcf6c2
[external/binutils.git] / gold / ChangeLog
1 2011-04-12  Ian Lance Taylor  <iant@google.com>
2
3         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4         with MREMAP_MAYMOVE.
5         * output.h (class Output_file): Add map_is_allocated_ field.
6         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7         not available, provide stubs.  If mremap is not available, #define
8         it to gold_mremap.
9         (MREMAP_MAYMOVE): Define if not defined.
10         (Output_file::Output_file): Initialize map_is_allocated_.
11         (Output_file::resize): Check map_is_allocated_.
12         (Output_file::map_anonymous): If mmap fails, use malloc.
13         (Output_file::unmap): Don't do anything for an anonymous map.
14         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
15         is not available, provide stubs.
16         (File_read::View::~View): Use free rather than delete[].
17         (File_read::make_view): Use malloc rather than new[].  If mmap
18         fails, use malloc.
19         (File_read::find_or_make_view): Use malloc rather than new[].
20         * gold.h: Remove HAVE_REMAP code.
21         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
22         exists.  Rename mremap to gold_mremap.  If mmap is not available
23         don't do anything.
24         * configure, config.in: Rebuild.
25
26 2011-04-11  Ian Lance Taylor  <iant@google.com>
27
28         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
29         initialize local variable v.
30
31 2011-04-11  Cary Coutant  <ccoutant@google.com>
32
33         * archive.cc (Archive::include_member): Adjust call to
34         report_object.
35         (Add_archive_symbols::run): Track argument serial numbers.
36         (Lib_group::include_member): Likewise.
37         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
38         * archive.h (Incremental_archive_entry::Archive_member):
39         Initialize arg_serial_.
40         (Archive_member::arg_serial_): New data member.
41         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
42         (Sized_dynobj::do_add_symbols): Track symbols when doing an
43         incremental link.
44         (Sized_dynobj::do_for_all_local_got_entries): New function.
45         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
46         function.
47         * fileread.cc (get_mtime): New function.
48         * fileread.h (get_mtime): New function.
49         * gold.cc (queue_initial_tasks): Check for incremental update.
50         (process_incremental_input): New function.
51         (queue_middle_tasks): Don't force valid target for incremental
52         update.
53         * incremental-dump.cc (find_input_containing_global): Adjust
54         size of symbol info entry.
55         (dump_incremental_inputs): Dump argument serial number and
56         in_system_directory flag; bias shndx by 1; print symbol names
57         when dumping per-file symbol lists; use new symbol info readers.
58         * incremental.cc
59         (Output_section_incremental_inputs:update_data_size): New function.
60         (Sized_incremental_binary::setup_readers): Setup input readers
61         for each input file; build maps for files added from libraries
62         and scripts.
63         (Sized_incremental_binary::check_input_args): New function.
64         (Sized_incremental_binary::do_check_inputs): Build map of argument
65         serial numbers to input arguments.
66         (Sized_incremental_binary::do_file_has_changed): Rename
67         do_file_is_unchanged to this; compare file modification times.
68         (Sized_incremental_binary::do_init_layout): New function.
69         (Sized_incremental_binary::do_reserve_layout): New function.
70         (Sized_incremental_binary::do_get_input_reader): Remove.
71         (Sized_incremental_binary::get_symtab_view): New function.
72         (Incremental_checker::can_incrementally_link_output_file): Remove.
73         (Incremental_inputs::report_command_line): Exclude --debug options.
74         (Incremental_inputs::report_archive_begin): Add parameter; track
75         argument serial numbers; don't put input file entry for archive
76         before archive members.
77         (Incremental_inputs::report_archive_end): Put input file entry
78         for archive after archive members.
79         (Incremental_inputs::report_object): Add parameter; track argument
80         serial numbers and in_system_directory flag.
81         (Incremental_inputs::report_script): Add parameter; track argument
82         serial numbers.
83         (Output_section_incremental_inputs::set_final_data_size): Adjust
84         size of symbol info entry; check for forwarding symbols.
85         (Output_section_incremental_inputs::write_input_files): Write
86         in_system_directory flag and argument serial number.
87         (Output_section_incremental_inputs::write_info_blocks): Map section
88         indices between incremental info and original input file; store
89         input section index for each symbol.
90         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
91         change operator() to visit().
92         (class Global_got_offset_visitor): Likewise.
93         (class Global_symbol_visitor_got_plt):
94         (Output_section_incremental_inputs::write_got_plt): Use new visitor
95         classes.
96         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
97         (Sized_incr_relobj::do_read_symbols): New function.
98         (Sized_incr_relobj::do_layout): New function.
99         (Sized_incr_relobj::do_layout_deferred_sections): New function.
100         (Sized_incr_relobj::do_add_symbols): New function.
101         (Sized_incr_relobj::do_should_include_member): New function.
102         (Sized_incr_relobj::do_for_all_global_symbols): New function.
103         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
104         (Sized_incr_relobj::do_section_size): New function.
105         (Sized_incr_relobj::do_section_name): New function.
106         (Sized_incr_relobj::do_section_contents): New function.
107         (Sized_incr_relobj::do_section_flags): New function.
108         (Sized_incr_relobj::do_section_entsize): New function.
109         (Sized_incr_relobj::do_section_address): New function.
110         (Sized_incr_relobj::do_section_type): New function.
111         (Sized_incr_relobj::do_section_link): New function.
112         (Sized_incr_relobj::do_section_info): New function.
113         (Sized_incr_relobj::do_section_addralign): New function.
114         (Sized_incr_relobj::do_initialize_xindex): New function.
115         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
116         (Sized_incr_relobj::do_read_relocs): New function.
117         (Sized_incr_relobj::do_gc_process_relocs): New function.
118         (Sized_incr_relobj::do_scan_relocs): New function.
119         (Sized_incr_relobj::do_count_local_symbols): New function.
120         (Sized_incr_relobj::do_finalize_local_symbols): New function.
121         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
122         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
123         (Sized_incr_relobj::do_relocate): New function.
124         (Sized_incr_relobj::do_set_section_offset): New function.
125         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
126         (Sized_incr_dynobj::do_read_symbols): New function.
127         (Sized_incr_dynobj::do_layout): New function.
128         (Sized_incr_dynobj::do_add_symbols): New function.
129         (Sized_incr_dynobj::do_should_include_member): New function.
130         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
131         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
132         (Sized_incr_dynobj::do_section_size): New function.
133         (Sized_incr_dynobj::do_section_name): New function.
134         (Sized_incr_dynobj::do_section_contents): New function.
135         (Sized_incr_dynobj::do_section_flags): New function.
136         (Sized_incr_dynobj::do_section_entsize): New function.
137         (Sized_incr_dynobj::do_section_address): New function.
138         (Sized_incr_dynobj::do_section_type): New function.
139         (Sized_incr_dynobj::do_section_link): New function.
140         (Sized_incr_dynobj::do_section_info): New function.
141         (Sized_incr_dynobj::do_section_addralign): New function.
142         (Sized_incr_dynobj::do_initialize_xindex): New function.
143         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
144         (make_sized_incremental_object): New function.
145         (Incremental_library::copy_unused_symbols): New function.
146         (Incremental_library::do_for_all_unused_symbols): New function.
147         * incremental.h (enum Incremental_input_flags): New type.
148         (class Incremental_checker): Remove.
149         (Incremental_input_entry::Incremental_input_entry): Add argument
150         serial number.
151         (Incremental_input_entry::arg_serial): New function.
152         (Incremental_input_entry::set_is_in_system_directory): New function.
153         (Incremental_input_entry::is_in_system_directory): New function.
154         (Incremental_input_entry::arg_serial_): New data member.
155         (Incremental_input_entry::is_in_system_directory_): New data member.
156         (class Script_info): Move here from script.h.
157         (Script_info::Script_info): Add filename parameter.
158         (Script_info::filename): New function.
159         (Script_info::filename_): New data member.
160         (Incremental_script_entry::Incremental_script_entry): Add argument
161         serial number.
162         (Incremental_object_entry::Incremental_object_entry): Likewise.
163         (Incremental_object_entry::add_input_section): Build list of input
164         sections with map to original shndx.
165         (Incremental_object_entry::get_input_section_index): New function.
166         (Incremental_object_entry::shndx_): New data member.
167         (Incremental_object_entry::name_key_): Rename; adjust all refs.
168         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
169         (Incremental_archive_entry::Incremental_archive_entry): Add argument
170         serial number.
171         (Incremental_inputs::report_archive_begin): Likewise.
172         (Incremental_inputs::report_object): Likewise.
173         (Incremental_inputs::report_script): Likewise.
174         (class Incremental_global_symbol_reader): New class.
175         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
176         and store flags and input file type.
177         (Incremental_input_entry_reader::arg_serial): New function.
178         (Incremental_input_entry_reader::type): Extract type from flags.
179         (Incremental_input_entry_reader::is_in_system_directory): New function.
180         (Incremental_input_entry_reader::get_input_section_count): Call
181         accessor function for type.
182         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
183         function for type; adjust size of global symbol entry.
184         (Incremental_input_entry_reader::get_global_symbol_count): Call
185         accessor function for type.
186         (Incremental_input_entry_reader::get_object_count): Likewise.
187         (Incremental_input_entry_reader::get_object_offset): Likewise.
188         (Incremental_input_entry_reader::get_member_count): Likewise.
189         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
190         (Incremental_input_entry_reader::get_member_offset): Likewise.
191         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
192         (Incremental_input_entry_reader::Global_symbol_info): Remove.
193         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
194         (Incremental_input_entry_reader::get_global_symbol_reader): New
195         function.
196         (Incremental_input_entry_reader::get_output_symbol_index): New
197         function.
198         (Incremental_input_entry_reader::type_): Remove.
199         (Incremental_input_entry_reader::flags_): New data member.
200         (Incremental_inputs_reader::input_file_offset): New function.
201         (Incremental_inputs_reader::input_file_index): New function.
202         (Incremental_inputs_reader::input_file): Call input_file_offset.
203         (Incremental_inputs_reader::input_file_at_offset): New function.
204         (Incremental_relocs_reader::get_r_type): Reformat.
205         (Incremental_relocs_reader::get_r_shndx): Reformat.
206         (Incremental_relocs_reader::get_r_offset): Reformat.
207         (Incremental_relocs_reader::data): New function.
208         (Incremental_binary::Incremental_binary): Initialize new data members.
209         (Incremental_binary::check_inputs): Add cmdline parameter.
210         (Incremental_binary::file_is_unchanged): Remove.
211         (Input_reader::arg_serial): New function.
212         (Input_reader::get_unused_symbol_count): New function.
213         (Input_reader::get_unused_symbol): New function.
214         (Input_reader::do_arg_serial): New function.
215         (Input_reader::do_get_unused_symbol_count): New function.
216         (Input_reader::do_get_unused_symbol): New function.
217         (Incremental_binary::input_file_count): New function.
218         (Incremental_binary::get_input_reader): Change signature to use
219         index instead of filename.
220         (Incremental_binary::file_has_changed): New function.
221         (Incremental_binary::get_input_argument): New function.
222         (Incremental_binary::get_library): New function.
223         (Incremental_binary::get_script_info): New function.
224         (Incremental_binary::init_layout): New function.
225         (Incremental_binary::reserve_layout): New function.
226         (Incremental_binary::output_file): New function.
227         (Incremental_binary::do_check_inputs): New function.
228         (Incremental_binary::do_file_is_unchanged): Remove.
229         (Incremental_binary::do_file_has_changed): New function.
230         (Incremental_binary::do_init_layout): New function.
231         (Incremental_binary::do_reserve_layout): New function.
232         (Incremental_binary::do_input_file_count): New function.
233         (Incremental_binary::do_get_input_reader): Change signature.
234         (Incremental_binary::input_args_map_): New data member.
235         (Incremental_binary::library_map_): New data member.
236         (Incremental_binary::script_map_): New data member.
237         (Sized_incremental_binary::Sized_incremental_binary): Initialize
238         new data members.
239         (Sized_incremental_binary::output_section): New function.
240         (Sized_incremental_binary::inputs_reader): Add const.
241         (Sized_incremental_binary::symtab_reader): Add const.
242         (Sized_incremental_binary::relocs_reader): Add const.
243         (Sized_incremental_binary::got_plt_reader): Add const.
244         (Sized_incremental_binary::get_symtab_view): New function.
245         (Sized_incremental_binary::Inputs_reader): New typedef.
246         (Sized_incremental_binary::Input_entry_reader): New typedef.
247         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
248         (Sized_incremental_binary::do_file_is_unchanged): Remove.
249         (Sized_incremental_binary::do_file_has_changed): New function.
250         (Sized_incremental_binary::do_init_layout): New function.
251         (Sized_incremental_binary::do_reserve_layout): New function.
252         (Sized_input_reader::Inputs_reader): Remove.
253         (Sized_input_reader::Input_entry_reader): Remove.
254         (Sized_input_reader::do_arg_serial): New function.
255         (Sized_input_reader::do_get_unused_symbol_count): New function.
256         (Sized_input_reader::do_get_unused_symbol): New function.
257         (Sized_incremental_binary::do_input_file_count): New function.
258         (Sized_incremental_binary::do_get_input_reader): Change signature;
259         use index instead of filename.
260         (Sized_incremental_binary::section_map_): New data member.
261         (Sized_incremental_binary::input_entry_readers_): New data member.
262         (class Sized_incr_relobj): New class.
263         (class Sized_incr_dynobj): New class.
264         (make_sized_incremental_object): New function.
265         (class Incremental_library): New class.
266         * layout.cc (Free_list::num_lists): New static data member.
267         (Free_list::num_nodes): New static data member.
268         (Free_list::num_removes): New static data member.
269         (Free_list::num_remove_visits): New static data member.
270         (Free_list::num_allocates): New static data member.
271         (Free_list::num_allocate_visits): New static data member.
272         (Free_list::init): New function.
273         (Free_list::remove): New function.
274         (Free_list::allocate): New function.
275         (Free_list::dump): New function.
276         (Free_list::print_stats): New function.
277         (Layout_task_runner::run): Resize output file for incremental updates.
278         (Layout::Layout): Initialize new data members.
279         (Layout::set_incremental_base): New function.
280         (Layout::init_fixed_output_section): New function.
281         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
282         incremental updates.
283         (Layout::create_gold_note): Do not create gold note section for
284         incremental updates.
285         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
286         for incremental updates.
287         (Layout::set_section_offsets): For incremental updates, allocate space
288         from free list.
289         (Layout::create_symtab_sections): Layout with offsets relative to
290         start of section; for incremental updates, allocate space from free
291         list.
292         (Layout::create_shdrs): For incremental updates, allocate space from
293         free list.
294         (Layout::finish_dynamic_section): For incremental updates, do not
295         check --as-needed (fixed in subsequent patch).
296         * layout.h (class Free_list): New class.
297         (Layout::set_incremental_base): New function.
298         (Layout::incremental_base): New function.
299         (Layout::init_fixed_output_section): New function.
300         (Layout::allocate): New function.
301         (Layout::incremental_base_): New data member.
302         (Layout::free_list_): New data member.
303         * main.cc (main): Print Free_list statistics.
304         * object.cc (Relobj::finalize_incremental_relocs): Add
305         clear_counts parameter; clear counts only when clear_counts is set.
306         (Sized_relobj::Sized_relobj): Initialize new base class.
307         (Sized_relobj::do_layout): Don't report special sections.
308         (Sized_relobj::do_for_all_local_got_entries): New function.
309         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
310         symtab_off to all symbol table offsets.
311         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
312         * object.h (class Got_offset_list): Move to top of file.
313         (Object::Object): Allow case where input_file == NULL.
314         (Object::~Object): Likewise.
315         (Object::input_file): Assert that input_file != NULL.
316         (Object::lock): Allow case where input_file == NULL.
317         (Object::unlock): Likewise.
318         (Object::is_locked): Likewise.
319         (Object::token): Likewise.
320         (Object::release): Likewise.
321         (Object::is_incremental): New function.
322         (Object::get_mtime): New function.
323         (Object::for_all_local_got_entries): New function.
324         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
325         (Object::set_is_in_system_directory): New function.
326         (Object::is_in_system_directory): New function.
327         (Object::do_is_incremental): New function.
328         (Object::do_get_mtime): New function.
329         (Object::do_for_all_local_got_entries): New function.
330         (Object::is_in_system_directory_): New data member.
331         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
332         (class Sized_relobj_base): New class.
333         (class Sized_relobj): Derive from Sized_relobj_base.
334         (class Sized_relobj::Symbols): Redeclare from base class.
335         (class Sized_relobj::local_got_offset_list): Remove.
336         (class Sized_relobj::Output_sections): Redeclare from base class.
337         (class Sized_relobj::do_for_all_local_got_entries): New function.
338         (class Sized_relobj::write_local_symbols): Add offset parameter.
339         (class Sized_relobj::local_symbol_offset_): Update comment.
340         (class Sized_relobj::local_dynsym_offset_): Update comment.
341         * options.cc (Input_arguments::add_file): Remove const.
342         * options.h (Input_file_argument::Input_file_argument):
343         Initialize arg_serial_ (all constructors).
344         (Input_file_argument::set_arg_serial): New function.
345         (Input_file_argument::arg_serial): New function.
346         (Input_file_argument::arg_serial_): New data member.
347         (Input_arguments::Input_arguments): Initialize file_count_.
348         (Input_arguments::add_file): Remove const.
349         (Input_arguments::number_of_input_files): New function.
350         (Input_arguments::file_count_): New data member.
351         (Command_line::number_of_input_files): Call
352         Input_arguments::number_of_input_files.
353         * output.cc (Output_segment_headers::Output_segment_headers):
354         Set current size.
355         (Output_section::Input_section::current_data_size): New function.
356         (Output_section::Output_section): Initialize new data members.
357         (Output_section::add_input_section): Don't do merge sections for
358         an incremental link; allocate space from free list for an
359         incremental update.
360         (Output_section::add_output_section_data): Allocate space from
361         free list for an incremental update.
362         (Output_section::update_data_size): New function.
363         (Output_section::set_fixed_layout): New function.
364         (Output_section::reserve): New function.
365         (Output_segment::set_section_addresses): Remove const.
366         (Output_segment::set_section_list_addresses): Remove const; allocate
367         space from free list for an incremental update.
368         (Output_segment::set_offset): Adjust size of RELRO segment for an
369         incremental update.
370         * output.h (Output_data::current_data_size): Move here from
371         child classes.
372         (Output_data::pre_finalize_data_size): New function.
373         (Output_data::update_data_size): New function.
374         (Output_section_headers::update_data_size): new function.
375         (Output_section_data_build::current_data_size): Move to Output_data.
376         (Output_data_strtab::update_data_size): New function.
377         (Output_section::current_data_size): Move to Output_data.
378         (Output_section::set_fixed_layout): New function.
379         (Output_section::has_fixed_layout): New function.
380         (Output_section::reserve): New function.
381         (Output_section::update_data_size): New function.
382         (Output_section::has_fixed_layout_): New data member.
383         (Output_section::free_list_): New data member.
384         (Output_segment::set_section_addresses): Remove const.
385         (Output_segment::set_section_list_addresses): Remove const.
386         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
387         New function.
388         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
389         New function.
390         * readsyms.cc (Read_symbols::do_read_symbols): Add library
391         parameter when calling Add_symbols constructor; store argument
392         serial number for members of a lib group.
393         (Add_symbols::locks): Allow case where token == NULL.
394         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
395         (Read_member::~Read_member): New function.
396         (Read_member::is_runnable): New function.
397         (Read_member::locks): New function.
398         (Read_member::run): New function.
399         (Check_script::~Check_script): New function.
400         (Check_script::is_runnable): New function.
401         (Check_script::locks): New function.
402         (Check_script::run): New function.
403         (Check_library::~Check_library): New function.
404         (Check_library::is_runnable): New function.
405         (Check_library::locks): New function.
406         (Check_library::run): New function.
407         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
408         (Add_symbols::library_): New data member.
409         (class Read_member): New class.
410         (class Check_script): New class.
411         (class Check_library): New class.
412         * reloc.cc (Read_relocs::is_runnable): Allow case where
413         token == NULL.
414         (Read_relocs::locks): Likewise.
415         (Scan_relocs::locks): Likewise.
416         (Relocate_task::locks): Likewise.
417         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
418         to clear counters.
419         (Sized_relobj::incremental_relocs_scan): Fix comment.
420         (Sized_relobj::do_relocate): Pass output file offset to
421         write_local_symbols.
422         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
423         from class declaration.
424         * script.cc (read_input_script): Allocate Script_info; pass
425         argument serial number to report_script.
426         * script.h (class Script_info): Move to incremental.h.
427         * symtab.cc (Symbol_table::add_from_incrobj): New function.
428         * symtab.h (Symbol_table::add_from_incrobj): New function.
429         (Symbol_table::set_file_offset): New function.
430
431 2011-04-05  Cary Coutant  <ccoutant@google.com>
432
433         * incremental-dump.cc (dump_incremental_inputs): Change signature
434         to take a Sized_incremental_binary; change caller.  Use readers
435         in Sized_incremental_binary.
436         * incremental.cc
437         (Sized_incremental_binary::find_incremental_inputs_sections):
438         Rename do_find_incremental_inputs_sections to this.
439         (Sized_incremental_binary::setup_readers): New function.
440         (Sized_incremental_binary::do_check_inputs): Check
441         has_incremental_info_ flag; move setup code to setup_readers;
442         use input readers.
443         (Sized_incremental_binary::do_file_is_unchanged): New function.
444         (Sized_incremental_binary::do_get_input_reader): New function.
445         * incremental.h (class Incremental_binary): Move to end of file.
446         (Incremental_binary::file_is_unchanged): New function.
447         (Incremental_binary::do_file_is_unchanged): New function.
448         (Incremental_binary::Input_reader): New class.
449         (Incremental_binary::get_input_reader): New function.
450         (class Sized_incremental_binary): Move to end of file.
451         (Sized_incremental_binary::Sized_incremental_binary): Setup the
452         input section reader classes.
453         (Sized_incremental_binary::has_incremental_info): New function.
454         (Sized_incremental_binary::inputs_reader): New function.
455         (Sized_incremental_binary::symtab_reader): New function.
456         (Sized_incremental_binary::relocs_reader): New function.
457         (Sized_incremental_binary::got_plt_reader): New function.
458         (Sized_incremental_binary::do_file_is_unchanged): New function.
459         (Sized_incremental_binary::Sized_input_reader): New class.
460         (Sized_incremental_binary::get_input_reader): New function.
461         (Sized_incremental_binary::find_incremental_inputs_sections):
462         Rename do_find_incremental_inputs_sections to this.
463         (Sized_incremental_binary::setup_readers): New function.
464         (Sized_incremental_binary::has_incremental_info_): New data member.
465         (Sized_incremental_binary::inputs_reader_): New data member.
466         (Sized_incremental_binary::symtab_reader_): New data member.
467         (Sized_incremental_binary::relocs_reader_): New data member.
468         (Sized_incremental_binary::got_plt_reader_): New data member.
469         (Sized_incremental_binary::current_input_file_): New data member.
470
471 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
472
473         PR gold/12640
474         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
475         violation.
476
477 2011-03-30  Cary Coutant  <ccoutant@google.com>
478
479         * archive.cc (Archive::include_member): Adjust call to report_object.
480         (Add_archive_symbols::run): Add script_info to call to
481         report_archive_begin.
482         (Lib_group::include_member): Adjust call to report_object.
483         (Add_lib_group_symbols::run): Adjust call to report_object.
484         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
485         blocks.  Add object count for script input files.
486         * incremental.cc (Incremental_inputs::report_archive_begin): Add
487         script_info parameter; change all callers.
488         (Incremental_inputs::report_object): Add script_info parameter;
489         change all callers.
490         (Incremental_inputs::report_script): Store backpointer to
491         incremental info entry.
492         (Output_section_incremental_inputs::set_final_data_size): Record
493         additional information for scripts.
494         (Output_section_incremental_inputs::write_info_blocks): Likewise.
495         * incremental.h (Incremental_script_entry::add_object): New function.
496         (Incremental_script_entry::get_object_count): New function.
497         (Incremental_script_entry::get_object): New function.
498         (Incremental_script_entry::objects_): New data member; adjust
499         constructor.
500         (Incremental_inputs::report_archive_begin): Add script_info parameter.
501         (Incremental_inputs::report_object): Add script_info parameter.
502         (Incremental_inputs_reader::get_object_count): New function.
503         (Incremental_inputs_reader::get_object_offset): New function.
504         * options.cc (Input_arguments::add_file): Return reference to
505         new input argument.
506         * options.h (Input_argument::set_script_info): New function.
507         (Input_argument::script_info): New function.
508         (Input_argument::script_info_): New data member; adjust all
509         constructors.
510         (Input_file_group::add_file): Return reference to new input argument.
511         (Input_file_lib::add_file): Likewise.
512         (Input_arguments::add_file): Likewise.
513         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
514         * script.cc (Parser_closure::Parser_closure): Add script_info
515         parameter; adjust all callers.
516         (Parser_closure::script_info): New function.
517         (Parser_closure::script_info_): New data member.
518         (read_input_script): Report scripts earlier to incremental info.
519         (script_add_file): Set script_info in Input_argument.
520         (script_add_library): Likewise.
521         * script.h (Script_options::Script_info): Rewrite class.
522
523 2011-03-29  Cary Coutant  <ccoutant@google.com>
524
525         * archive.cc (Library_base::should_include_member): Move
526         method here from class Archive.
527         (Archive::Archive): Initialize base class.
528         (Archive::should_include_member): Move to base class.
529         (Archive::do_for_all_unused_symbols): New function.
530         (Add_archive_symbols::run): Remove redundant access to
531         incremental_inputs.
532         (Lib_group::Lib_group): Initialize base class.
533         (Lib_group::do_filename): New function.
534         (Lib_group::include_member): Pass pointer to Lib_group to
535         report_object.
536         (Lib_group::do_for_all_unused_symbols): New function.
537         (Add_lib_group_symbols::run): Report archive information for
538         incremental links.
539         * archive.h (class Library_base): New base class.
540         (class Archive): Derive from Library_base.
541         (Archive::filename): Move to base class.
542         (Archive::set_incremental_info): Likewise.
543         (Archive::incremental_info): Likewise.
544         (Archive::Should_include): Likewise.
545         (Archive::should_include_member): Likewise.
546         (Archive::Armap_entry): Remove.
547         (Archive::Unused_symbol_iterator): Remove.
548         (Archive::unused_symbols_begin): Remove.
549         (Archive::unused_symbols_end): Remove.
550         (Archive::do_filename): New function.
551         (Archive::do_get_mtime): New function.
552         (Archive::do_for_all_unused_symbols): New function.
553         (Archive::task_): Move to base class.
554         (Archive::incremental_info_): Likewise.
555         (class Lib_group): Derive from Library_base.
556         (Lib_group::do_filename): New function.
557         (Lib_group::do_get_mtime): New function.
558         (Lib_group::do_for_all_unused_symbols): New function.
559         (Lib_group::task_): Move to base class.
560         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
561         function.
562         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
563         function.
564         * incremental.cc (Incremental_inputs::report_archive_begin):
565         Use Library_base; call library's get_mtime; add incremental inputs
566         entry before members.
567         (class Unused_symbol_visitor): New class.
568         (Incremental_inputs::report_archive_end): Use Library_base; use
569         visitor class to record unused symbols; don't add incremental inputs
570         entry after members.
571         (Incremental_inputs::report_object): Use Library_base.
572         * incremental.h
573         (Incremental_archive_entry::Incremental_archive_entry): Remove
574         unused Archive parameter.
575         (Incremental_inputs::report_archive_begin): Use Library_base.
576         (Incremental_inputs::report_archive_end): Likewise.
577         (Incremental_inputs::report_object): Likewise.
578         * object.cc (Sized_relobj::do_for_all_global_symbols): New
579         function.
580         * object.h (Object::for_all_global_symbols): New function.
581         (Object::do_for_all_global_symbols): New function.
582         (Sized_relobj::do_for_all_global_symbols): New function.
583         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
584         function.
585         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
586         function.
587
588 2011-03-27  Ian Lance Taylor  <iant@google.com>
589
590         * archive.cc (Archive::interpret_header): Return -1 if something
591         goes wrong.  Change callers accordingly.
592
593 2011-03-25  Cary Coutant  <ccoutant@google.com>
594
595         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
596         * testsuite/Makefile.in: Regenerate.
597
598 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
599
600         * plugin.cc (get_view): New.
601         (Plugin::load): Pass get_view to the plugin.
602         (Plugin_manager::get_view): New.
603
604 2011-03-21  Ian Lance Taylor  <iant@google.com>
605
606         * testsuite/final_layout.sh: Rewrite to not use dc.
607         * testsuite/relro_test.sh: Fail if dc is not present.
608
609 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
610
611         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
612         Change == to -eq.
613         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
614         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
615         Change == to -eq.
616         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
617         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
618
619 2011-03-14  Ian Lance Taylor  <iant@google.com>
620
621         * script-sections.cc (Sort_output_sections::script_compare):
622         Rename from is_before, change return type.
623         (Sort_output_sections::operator()): Adjust accordingly.
624
625 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
626
627         PR gold/12572
628         * testsuite/odr_violation2.cc: Add comment to make all error line
629         numbers double digits.
630         * testsuite/debug_msg.sh: Adjust expected errors.
631
632 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
633
634         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
635         but mark earlier ones as non-canonical
636         (offset_to_iterator): Update search target and example
637         (do_addr2line): Return extra lines in a vector*
638         (format_file_lineno): Extract from do_addr2line
639         (one_addr2line): Add vector* out-param
640         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
641         when a lineno entry appeared last for its instruction
642         (Dwarf_line_info): Add vector* out-param
643         * object.cc (Relocate_info): Pass NULL for the vector* out-param
644         * symtab.cc (Odr_violation_compare): Include the lineno in the
645         comparison again.
646         (linenos_from_loc): New. Combine the canonical line for an
647         address with its other lines.
648         (True_if_intersect): New. Helper functor to make
649         std::set_intersection a query.
650         (detect_odr_violations): Compare sets of lines instead of just
651         one line for each function. This became less deterministic, but
652         has fewer false positives.
653         * symtab.h: Declarations.
654         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
655         mix an optimized and non-optimized object in the same binary
656         (odr_violation2.so): Same.
657         * testsuite/Makefile.in: Regenerate from Makefile.am.
658         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
659         * testsuite/debug_msg.sh: Update line numbers and add
660         assertions.
661         * testsuite/odr_violation1.cc: Use OdrDerived, in a
662         non-optimized context.
663         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
664         isn't inlined, and use OdrDerived in an optimized context.
665         * testsuite/odr_header1.h: Defines OdrDerived, where
666         optimization will change the
667         first-instruction-in-the-destructor's file and line number.
668         * testsuite/odr_header2.h: Defines OdrBase.
669
670 2011-03-09  Ian Lance Taylor  <iant@google.com>
671
672         * fileread.cc (File_read::clear_views): Don't delete the whole
673         file view.
674
675 2011-03-08  Ian Lance Taylor  <iant@google.com>
676
677         PR gold/12525
678         * fileread.cc: #include <climits>.
679         (GOLD_IOV_MAX): Define.
680         (File_read::read_multiple): Limit number of entries by iov_max.
681         * fileread.h (class File_read): Always set max_readv_entries to
682         128.
683
684 2011-03-07  Ian Lance Taylor  <iant@google.com>
685
686         PR gold/12525
687         * options.h (class General_options): Add -dy and -dn.
688
689 2011-03-02  Cary Coutant  <ccoutant@google.com>
690
691         * testsuite/script_test_9.t: Add TLS segment.
692
693 2011-03-02  Simon Baldwin  <simonb@google.com>
694
695         * configure.ac: Add check for gnu_indirect_function support in
696         the toolchain building binutils.
697         * configure: Rebuild.
698
699 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
700
701         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
702         plugin only symbols.
703         (Symbol_table::sized_finalize_symbol) Mark symbol only present
704         in plugin files as not needed in the symbol table.
705
706 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
707
708         * output.cc (Output_section::add_input_section): Delay fill
709         generation for section ordering.
710
711 2011-02-09  Ian Lance Taylor  <iant@google.com>
712
713         PR gold/12316
714         * object.h (class Sized_relobj): Remove clear_local_symbols.
715         * reloc.cc (Sized_relobj::do_relocate): Don't call
716         clear_local_symbols.
717
718 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
719
720         * plugin.cc (is_visible_from_outside): Return true for symbols
721         in the -u option.
722
723 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
724
725         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
726         filename.
727
728 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
729
730         * icf.h (is_section_foldable_candidate): Change type of parameter
731         to std::string.
732         * icf.cc (Icf::find_identical_sections): Change type of local variable
733         section_name to be std::string.
734         (is_function_ctor_or_dtor): Change type of parameter to std::string.
735
736 2011-01-25  Ian Lance Taylor  <iant@google.com>
737
738         * script.cc (script_add_extern): Rewrite to use
739         add_symbol_reference.
740
741 2011-01-25  Doug Kwan  <dougkwan@google.com>
742
743         * icf.cc (get_section_contents): Always lock section's object.
744
745 2011-01-24  Ian Lance Taylor  <iant@google.com>
746
747         * options.h (class General_options): Accept
748         --no-detect-odr-violations.
749
750 2011-01-24  Ian Lance Taylor  <iant@google.com>
751
752         * version.cc (version_string): Bump to 1.11.
753
754 2011-01-24  Ian Lance Taylor  <iant@google.com>
755
756         * plugin.cc (class Plugin_rescan): Define new class.
757         (Plugin_manager::claim_file): Set any_claimed_.
758         (Plugin_manager::save_archive): New function.
759         (Plugin_manager::save_input_group): New function.
760         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
761         necessary.
762         (Plugin_manager::new_undefined_symbol): New function.
763         (Plugin_manager::rescan): New function.
764         (Plugin_manager::rescannable_defines): New function.
765         (Plugin_manager::add_input_file): Set any_added_.
766         * plugin.h (class Plugin_manager): define new fields rescannable_,
767         undefined_symbols_, any_claimed_, and any_added_.  Declare
768         Plugin_rescan as friend.  Declare new functions.
769         (Plugin_manager::Rescannable): Define type.
770         (Plugin_manager::Rescannable_list): Define type.
771         (Plugin_manager::Undefined_symbol_list): Define type.
772         (Plugin_manager::Plugin_manager): Initialize new fields.
773         * archive.cc (Archive::defines_symbol): New function.
774         (Add_archive_symbols::run): Pass archive to plugins if any.
775         * archive.h (class Archive): Declare defines_symbol.
776         * readsyms.cc (Input_group::~Input_group): New function.
777         (Finish_group::run): Pass input_group to plugins if any.
778         * readsyms.h (class Input_group): Declare destructor.
779         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
780         any.
781
782 2011-01-10  Ian Lance Taylor  <iant@google.com>
783
784         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
785         section as relro.
786         (Layout::set_segment_offsets): Reset increase_relro before calling
787         set_section_addresses a second time.
788
789 2011-01-04  Cary Coutant  <ccoutant@google.com>
790
791         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
792         sections before NOBITS sections.
793
794 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
795
796         * version.cc (print_version): Update copyright to 2011.
797
798 2010-12-23  Cary Coutant  <ccoutant@google.com>
799
800         * output.h (Output_data_reloc::add_output_section): Pass OD instead
801         of OS to this->add.  Add OD parameter to second form of the function.
802
803 2010-12-20  Ian Lance Taylor  <iant@google.com>
804
805         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
806         second of two consecutive entries with same offset.
807
808 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
809
810         * testsuite/Makefile.am (ifuncmain2static_LDADD)
811         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
812         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
813         to avoid unneeded links against $(LDADD).
814         * testsuite/Makefile.in: Regenerate.
815
816 2010-12-15  Ian Lance Taylor  <iant@google.com>
817
818         PR gold/12324
819         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
820         for R_X86_64_32 and R_X86_64_PC32.
821         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
822         ver_matching_def_pic.o.
823         (ver_matching_def_pic.o): New target.
824
825 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
826
827         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
828         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
829         Move definition before File_read::View member definitions.
830         (File_read::View::~View): Initialize and hold lock before
831         updating current_mapped_bytes.
832
833 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
834
835         * dwarf_reader.cc: Remove outdated comment.
836         * gold-threads.cc: Fix typo in error message.
837         * archive.cc: Fix typos in comments.
838         * archive.h: Likewise.
839         * arm-reloc-property.cc: Likewise.
840         * arm-reloc-property.h: Likewise.
841         * arm-reloc.def: Likewise.
842         * arm.cc: Likewise.
843         * attributes.h: Likewise.
844         * cref.cc: Likewise.
845         * ehframe.cc: Likewise.
846         * fileread.h: Likewise.
847         * gold.h: Likewise.
848         * i386.cc: Likewise.
849         * icf.cc: Likewise.
850         * incremental.h: Likewise.
851         * int_encoding.cc: Likewise.
852         * layout.h: Likewise.
853         * main.cc: Likewise.
854         * merge.h: Likewise.
855         * object.cc: Likewise.
856         * object.h: Likewise.
857         * options.cc: Likewise.
858         * readsyms.cc: Likewise.
859         * reduced_debug_output.cc: Likewise.
860         * reloc.cc: Likewise.
861         * script-sections.cc: Likewise.
862         * sparc.cc: Likewise.
863         * symtab.h: Likewise.
864         * target-reloc.h: Likewise.
865         * target.cc: Likewise.
866         * target.h: Likewise.
867         * timer.cc: Likewise.
868         * timer.h: Likewise.
869         * x86_64.cc: Likewise.
870
871 2010-12-09  Cary Coutant  <ccoutant@google.com>
872
873         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
874         stack.
875         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
876         parameter; change all callers.
877         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
878         * options.h (warn_execstack): New option.
879
880 2010-12-07  Doug Kwan  <dougkwan@google.com>
881
882         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
883         like function call relocations.
884
885 2010-12-07  Ian Lance Taylor  <iant@google.com>
886
887         * archive.cc (Archive::get_elf_object_for_member): Permit
888         punconfigured to be NULL.
889         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
890         (Archive::include_member): Pass NULL to get_elf_object_for_member
891         if we searched for the archive and this is the first included
892         object.
893
894 2010-12-01  Ian Lance Taylor  <iant@google.com>
895
896         * dwarf_reader.h (class Sized_dwarf_line_info): Add
897         track_relocs_type_ field.
898         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
899         Set track_relocs_type_.
900         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
901         contents when using RELA relocs.
902         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
903         reloc_map_.
904         * reloc.cc (Track_relocs::next_addend): New function.
905         * reloc.h (class Track_relocs): Declare next_addend.
906
907 2010-12-01  Ian Lance Taylor  <iant@google.com>
908
909         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
910         virtual destructor.
911
912 2010-12-01  Ian Lance Taylor  <iant@google.com>
913
914         * README: Update compilers known to work and fail.
915
916 2010-11-23  Matthias Klose  <doko@ubuntu.com>
917
918         * configure.in: For --enable-gold, handle value `default' instead of
919         `both*'.  Always install ld as ld.bfd, install as ld if gold is
920         not the default.
921         * configure: Regenerate.
922
923 2010-11-18  Doug Kwan  <dougkwan@google.com>
924
925         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
926         and right_alignment to be zero.  Store result alignment only if it is
927         greater than existing alignment.
928
929 2010-11-16  Cary Coutant  <ccoutant@google.com>
930
931         PR gold/12220
932         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
933         Check for ".zdebug_line".
934
935 2010-11-16  Doug Kwan  <dougkwan@google.com>
936             Cary Coutant  <ccoutant@google.com>
937
938         * output.h (Output_segment::set_section_addresses): Pass increase_relro
939         by reference; adjust all callers.
940         * output.cc (Output_segment::set_section_addresses): Adjust references
941         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
942         list is empty.
943         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
944         end at page boundary.
945
946 2010-11-16  Cary Coutant  <ccoutant@google.com>
947
948         PR gold/12220
949         * layout.cc (Layout::choose_output_section): Transform names of
950         compressed sections even when using a script with a SECTIONS clause.
951         (Layout::output_section_name): Remove code to transform
952         compressed debug section names.
953         * output.cc (Output_section::add_input_section): Use uncompressed
954         section size when tracking input sections.
955
956 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
957
958         * symtab.h (Symbol::NON_PIC_REF): Remove.
959         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
960         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
961         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
962         (Symbol::use_plt_offset): Take a flags argument and pass it
963         directly to needs_dynamic_reloc.  Restrict check for undefined
964         weak symbols to function calls.
965         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
966         (Target_arm::Scan::global): Use it.
967         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
968         (Target_arm::Relocate::relocate): Likewise.
969         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
970         parameter with an r_type parameter.  Use get_reference_flags
971         to get the flags.
972         (Target_arm::Relocate::relocate): Update accordingly.
973         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
974         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
975         (Target_i386::Scan::global): Likewise.
976         (Target_i386::Relocate::relocate): Likewise.
977         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
978         parameter with an r_type parameter.  Use get_reference_flags
979         to get the flags.
980         (Target_i386::Relocate::relocate): Update accordingly.
981         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
982         (Target_powerpc::Scan::global): Use it.
983         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
984         (Target_powerpc::Relocate::relocate): Likewise.
985         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
986         (Target_sparc::Scan::global): Use it.
987         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
988         (Target_sparc::Relocate::relocate): Likewise.
989         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
990         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
991         (Target_x86_64::Scan::global): Likewise.
992         (Target_x86_64::Relocate::relocate): Likewise.
993
994 2010-11-08  Doug Kwan  <dougkwan@google.com>
995             Cary Coutant  <ccoutant@google.com>
996
997         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
998         (Arm_exidx_merge_section::section_contents_): New data member.
999         (Arm_input_section::Arm_input_section): Initialize original_contents_.
1000         (Arm_input_section::~Arm_input_section): De-allocate memory.
1001         (Arm_input_section::original_contents_): New data member.       
1002         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1003         in parameters instead of calling Object::section_contents without
1004         locking.
1005         (Arm_output_section::group_section): New parameter TASK.  Pass it
1006         to callees that need locking objects.
1007         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
1008         to lock EXIDX input sections.  Fix a formatting issue.  Call
1009         Arm_exidx_merged_section::build_contents to create merged section
1010         contents.
1011         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
1012         to lock object of stub table owner.
1013         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1014         TEXT_SIZE to initialize data member TEXT_SIZE_.
1015         (Arm_exidx_input_section::addralign): Fix typo in comment.
1016         (Arm_exidx_input_section::text_size): New method.
1017         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
1018         that require locking objects.  Lock objects before scanning for stubs
1019         and updating local symbols.
1020         (Arm_input_section<big_endian>::init): Copy contents of original
1021         input section.
1022         (Arm_input_section<big_endian>::do_write): Use saved contents of
1023         original input section instead of calling Object::section_contents
1024         without locking.
1025         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1026         size without calling Object::section_size().
1027         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1028         for size.  Allocate a buffer for merged EXIDX entries.
1029         (Arm_exidx_merged_section::build_contents): New method.
1030         (Arm_exidx_merged_section::do_write): Move merge section contents
1031         building code to Arm_exidx_merged_section::build_contetns.  Write
1032         out contetns in buffer instead of building it on the fly.
1033         (Arm_relobj::make_exidx_input_section): Also pass text section size
1034         to Arm_exidx_input_section constructor.
1035         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1036         (Arm_dynobj::do_read_symbols): Fix memory leak.
1037         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1038         * target.h: (class Task): Add forward declaration.
1039         (Target::relax): Add new parameter TASK and pass it to
1040         Target::do_relax().
1041         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1042
1043 2010-11-05  Cary Coutant  <ccoutant@google.com>
1044
1045         PR gold/10708
1046         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1047         object when reading from the file.
1048         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1049         second layout pass.
1050         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1051         when reading section contents.
1052         (get_section_contents): Likewise.
1053         (icf::find_identical_sections): Likewise.
1054         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1055         object when reading from the file.
1056         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1057         the object when doing deferred section layout.
1058
1059 2010-11-03  Nick Clifton  <nickc@redhat.com>
1060
1061         PR gold/12001
1062         * script.h (class Symbol_assignment: name): New member.  Returns
1063         the name of the symbol.
1064         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1065         Returns true if the given symbol name is on the list of
1066         assignments wating to be processed.
1067         * archive.cc (should_incldue_member): If the symbol is undefined,
1068         check to see if it is on the list of symbols pending assignment.
1069
1070 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1071
1072         * script-sections.cc (Script_sections::find_memory_region): Check
1073         for a NULL output section pointer.
1074
1075 2010-10-29  Doug Kwan  <dougkwan@google.com>
1076
1077         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1078         Output_section::add_relaxed_input_section.
1079         * output.cc (Output_section::add_relaxed_input_section): Add new
1080         arguments LAYOUT and NAME.  Set section order index.
1081         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1082         Copy section order index.
1083         * output.h (Output_section::add_relaxed_input_section): Add new
1084         arguments LAYOUT and NAME.
1085
1086 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1087
1088         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1089         NATIVE_OR_CROSS_LINKER.
1090         * testsuite/Makefile.in: Regenerate.
1091
1092 2010-10-20  Doug Kwan  <dougkwan@google.com>
1093
1094         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1095         without SHF_LINK_ORDER flags.
1096         * layout.cc (Layout::choose_output_section): Do not filter
1097         SHF_LINK_ORDER flag in a relocatable link.
1098
1099 2010-10-17  Cary Coutant  <ccoutant@google.com>
1100
1101         * output.h (Output_segment::set_section_addresses): Change function
1102         signature.  Update all callers.
1103         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1104         sections.
1105         (Output_segment::set_section_addresses): Align after last TLS
1106         section.  Add padding before last relro section instead of after.
1107
1108 2010-10-17  Doug Kwan  <dougkwan@google.com>
1109
1110         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1111         GOT output section to be writable.
1112
1113 2010-10-14  Cary Coutant  <ccoutant@google.com>
1114
1115         * debug.h (DEBUG_INCREMENTAL): New flag.
1116         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1117         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1118         mode.
1119         * incremental.cc (report_command_line): Ignore all forms of
1120         --incremental.
1121         * layout.cc (Layout::Layout): Check parameters for incremental link
1122         mode.
1123         * options.cc (General_options::parse_incremental): New function.
1124         (General_options::parse_no_incremental): New function.
1125         (General_options::parse_incremental_full): New function.
1126         (General_options::parse_incremental_update): New function.
1127         (General_options::incremental_mode_): New data member.
1128         (General_options::finalize): Check incremental_mode_.
1129         * options.h (General_options): Update help text for --incremental.
1130         Add --no-incremental, --incremental-full, --incremental-update.
1131         (General_options::Incremental_mode): New enum type.
1132         (General_options::incremental_mode): New function.
1133         (General_options::incremental_mode_): New data member.
1134         * parameters.cc (Parameters::incremental_mode_): New data member.
1135         (Parameters::set_options): Set incremental_mode_.
1136         (Parameters::set_incremental_full): New function.
1137         (Parameters::incremental): New function.
1138         (Parameters::incremental_update): New function.
1139         (set_parameters_incremental_full): New function.
1140         * parameters.h (Parameters::set_incremental_full): New function.
1141         (Parameters::incremental): New function.
1142         (Parameters::incremental_update): New function.
1143         (Parameters::incremental_mode_): New data member.
1144         (set_parameters_incremental_full): New function.
1145         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1146         incremental link mode.
1147         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1148         (Sized_relobj::do_relocate_sections): Likewise.
1149         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1150         option.
1151         * testsuite/Makefile.in: Regenerate.
1152         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1153
1154 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1155
1156         * script-sections.h (class Script_sections): Make
1157         Sections_elements typedef public.
1158         * script-sections.cc (class Sort_output_sections): Add elements_
1159         field.  Add constructor which sets it; change all callers.
1160         (Sort_output_sections::is_before): New function.
1161         (Sort_output_sections::operator()): Call is_before.
1162         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1163         conditional.
1164         * testsuite/script_test_10.sh: New test. Test script section
1165         order.
1166         * testsuite/script_test_10.t: Likewise.
1167         * testsuite/script_test_10.s: Likewise.
1168         * testsuite/Makefile.am: Wrap the cross linker tests and the
1169         common tests into NATIVE_OR_CROSS_LINKER.
1170         (check_SCRIPTS): Add script_test_10.sh.
1171         (check_DATA): Add script_test_10.stdout.
1172         (script_test_10.o, script_test_10): New targets.
1173         (script_test_10.stdout): New target.
1174         * configure, testsuite/Makefile.in: Regenerate.
1175
1176 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1177
1178         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1179         error for the deprecated relocations.
1180         (Target_arm::Scan::global): Likewise.
1181         (Target_arm::Relocate::relocate): Likewise.
1182
1183 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1184
1185         * fileread.cc (Input_file::find_file): Initialize *found_name
1186         and *namep when using the fallback search for case 4.
1187
1188 2010-10-11  Cary Coutant  <ccoutant@google.com>
1189
1190         * options.h (class General_options): Redefine -z lazy as an alias for
1191         the negation of -z now.
1192
1193 2010-10-11  Ian Lance Taylor  <iant@google.com>
1194
1195         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1196         binding.
1197
1198 2010-10-06  Nick Clifton  <nickc@redhat.com>
1199
1200         * script-sections.cc(class Memory_region): Remove
1201         current_lma_offset_ field.  Rename current_vma_offset_ to
1202         current_offset_.  Add last_section_ field.
1203         (Memory_region::get_current_vma_address): Rename to
1204         get_current_address.
1205         (Memory_region::get_current_lma_address): Delete.
1206         (Memory_region::increment_vma_offset): Rename to
1207         increment_offset.
1208         (Memory_region::increment_lma_offset): Delete.
1209         (Memory_region::attributes_compatible): New method.  Returns
1210         true if the provided section is compatible with the region.
1211         (Memory_region::get_last_section): New method.  Returns the last
1212         section to use the region.
1213         (Memory_region::set_last_section): New method.  Stores the last
1214         section to use the region.
1215         (Script_sections::block_in_region): New method.  Returns true if
1216         a block of memory is contained within a region.
1217         (Script_sections::find_memory_region): New method.  Locates a
1218         memory region to be used to set a VMA or LMA address.
1219         (Output_section_definition::set_section_addresses): Add code to
1220         check for addresses set by memory regions.
1221         (Output_segment::set_section_addresses): Remove memory region
1222         walking code.
1223         (Script_sections::create_segment): Add a warning if a header
1224         segment is created outside of any region.
1225         * script-sections.h (class Script_sections): Add prototypes for
1226         find_memory_region and block_in_region methods.
1227         * testsuite/memory_test.s: Use .long instead of .word.
1228         * testsuite/memory_test.t: Add some more output sections.
1229         * testsuite/memory_test.sh: Update expected output.
1230
1231 2010-10-02  Doug Kwan  <dougkwan@google.com>
1232
1233         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1234         defintion to symtab.h
1235         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1236         declaration to defintion.
1237
1238 2010-10-01  Nick Clifton  <nickc@redhat.com>
1239
1240         * expression.cc (eval): Replace dummy argument with NULL.
1241         (eval_maybe_dot): Check for a NULL result section pointer.
1242         (Symbol_expression::value): Likewise.
1243         (Dot_expression::value): Likewise.
1244         (BINARY_EXPRESSION): Likewise.
1245         (Max_expression::value): Likewise.
1246         (Min_expression::value): Likewise.
1247         (Absolute_expression::value): Likewise.
1248         (Addr_expression::value_from_output_section): Likewise.
1249         (Loaddddr_expression::value_from_output_section): Likewise.
1250         (Segment_start_expression::value): Likewise.
1251         * script-sections.cc
1252         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1253         argument with NULL.
1254         (Sections_elememt_dot_assignment::set_section_addresses):
1255         Likewise.
1256         (Output_data_expression::do_write_to_buffer): Likewise.
1257         (Output_section_definition::finalize_symbols): Likewise.
1258         (Output_section_definition::set_section_addresses): Likewise.
1259
1260 2010-09-30  Doug Kwan  <dougkwan@google.com>
1261
1262         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1263
1264 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1265
1266         * target.h (Target::can_icf_inline_merge_sections): New virtual
1267         function.
1268         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1269         virtual function.
1270         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1271         virtual function.
1272         * icf.cc (get_section_contents): Inline merge sections only when
1273         target allows it.
1274
1275 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1276
1277         * configure: Regenerate.
1278
1279 2010-09-17  Ian Lance Taylor  <iant@google.com>
1280
1281         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1282         * testsuite/Makefile.am (memory_test.o): New target.
1283         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1284         memory_test.t.
1285         * testsuite/Makefile.in: Rebuild.
1286
1287 2010-09-17  Doug Kwan  <dougkwan@google.com>
1288
1289         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1290         defintion if relocation uses GOT entries of the symbol.
1291         * testsuite/icf_safe_test.sh: Fix test.
1292         * testsuite/icf_safe_so_test.sh: Fix test.
1293
1294 2010-09-16  Cary Coutant  <ccoutant@google.com>
1295
1296         * script_sections.cc (class Memory_region): Remove "NULL" from
1297         vector initializations.
1298
1299 2010-09-15  Cary Coutant  <ccoutant@google.com>
1300
1301         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1302         Resolve forwarding symbols.
1303
1304 2010-09-15  Doug Kwan  <dougkwan@google.com>
1305
1306         * gold/testsuite/script_test_3.t: Add ARM special sections.
1307         * gold/testsuite/script_test_4.t: Same.
1308         * gold/testsuite/script_test_5.t: Same.
1309         * gold/testsuite/script_test_6.t: Same.
1310         * gold/testsuite/script_test_7.t: Same.
1311         * gold/testsuite/script_test_7.t: Same.
1312         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1313
1314 2010-09-14  Cary Coutant  <ccoutant@google.com>
1315
1316         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1317         (Target_x86_64::Relocate::relocate_tls): Replace check for
1318         saw_tls_block_reloc_ with test for executable section.
1319
1320 2010-09-12  Cary Coutant  <ccoutant@google.com>
1321
1322         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1323         position-independent executables to shared libraries need dynamic
1324         relocations.
1325         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1326         position-independent executables.
1327         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1328         * testsuite/Makefile.in: Regenerate.
1329
1330 2010-09-10  Nick Clifton  <nickc@redhat.com>
1331
1332         PR gold/11997
1333         * testsuite/memory_test.t: Discard any sections that are not
1334         needed.
1335
1336 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1337
1338         PR gold/11996
1339         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1340         "This::" to work around a bug in gcc 4.2.
1341
1342         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1343
1344 2010-09-09  Rafael Espindola  <espindola@google.com>
1345
1346         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1347         sections with different PF_X flags in the same segment.
1348         (Layout::find_first_load_seg): Search all segments to find the first
1349         one.
1350         * options.h (rosegment): New.
1351
1352 2010-09-08  Rafael Espindola  <espindola@google.com>
1353
1354         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1355
1356 2010-09-08  Doug Kwan  <dougkwan@google.com>
1357
1358         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1359         (Arm_relobj::do_relocate_sections): Add new parameter for output
1360         file to match the parent.
1361         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1362         of local symbols instead of input values.  Update code to track
1363         changes in gold::relocate_section.
1364         * object.cc (Sized_relobj::compute_final_local_value): New methods.
1365         (Sized_relobj::compute_final_local_value_internal): New methods.
1366         (Sized_relobj::do_finalize_local_symbols): Move code from loop
1367         body into private version of Sized_relobj::compute_final_local_value.
1368         Call the inline method.
1369         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
1370         merged symbol value if there is one.
1371         (Symbol_value::has_output_value): New method defintiion.
1372         (Sized_relobj::Compute_final_local_value_status): New enum type.
1373         (Sized_relobj::compute_final_local_value): New methods.
1374         (Sized_relobj::compute_final_local_value_internal): New methods.
1375         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1376         and arm_cortex_a8.sh.
1377         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1378         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1379         New tests.
1380         * Makefile.in: Regenerate.
1381         * testsuite/arm_bl_out_of_range.s: Update test.
1382         * testsuite/thumb_bl_out_of_range.s: Ditto.
1383         * testsuite/thumb_blx_out_of_range.s: Ditto.
1384         * testsuite/arm_branch_out_of_range.sh: New file.
1385         * testsuite/arm_cortex_a8.sh: Ditto.
1386         * testsuite/arm_cortex_a8_b.s: Ditto.
1387         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1388         * testsuite/arm_cortex_a8_b_local.s: Ditto.
1389         * testsuite/arm_cortex_a8_bl.s: Ditto.
1390         * testsuite/arm_cortex_a8_blx.s: Ditto.
1391         * testsuite/arm_cortex_a8_local.s: Ditto.
1392         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1393         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1394
1395 2010-09-08  Rafael Espindola  <espindola@google.com>
1396
1397         * Makefile.am (memory_test.stdout): Run readelf with -W.
1398         * Makefile.in: Regenerate.
1399         * testsuite/memory_test.sh: Make the regexps accept both 32 and
1400         64 bit output.
1401
1402 2010-09-08  Rafael Espindola  <espindola@google.com>
1403
1404         * script-sections.cc (Script_sections::add_memory_region): Convert
1405         field precision to int.
1406         * script.cc (script_set_section_region, script_set_section_region):
1407         Convert field precision to int.
1408
1409 2010-09-08  Rafael Espindola  <espindola@google.com>
1410
1411         * arm.cc (do_finalize_sections): Create the __exidx_start and
1412         __exdix_end symbols even when the section is missing.
1413
1414 2010-09-08  Nick Clifton  <nickc@redhat.com>
1415
1416         * README: Remove claim that MEMORY is not supported.
1417         * expression.cc (script_exp_function_origin)
1418         (script_exp_function_length): Move from here to ...
1419         * script.cc: ... here.
1420         (script_set_section_region, script_add_memory)
1421         (script_parse_memory_attr, script_include_directive): New
1422         functions.
1423         * script-sections.cc
1424         (class Memory_region): New class.
1425         (class Output_section_definition): Add set_memory_region,
1426         set_section_vma, set_section_lma and get_section_name methods.
1427         (class Script_Sections): Add add_memory_region,
1428         find_memory_region, find_memory_region_origin,
1429         find_memory_region_length and set_memory_region methods.
1430         Have set_section_addresses method walk the list of set memory
1431         regions.
1432         Extend the print methos to display memory regions.
1433         * script-sections.h: Add prototypes for new methods.
1434         Add enum for MEMORY region attributes.
1435         * yyscript.y: Add support for parsing MEMORY regions.
1436         * script-c.h: Add prototypes for new functions.
1437         * testsuite/Makefile.am: Add test of MEMORY region functionality.
1438         * testsuite/Makefile.in: Regenerate.
1439         * testsuite/memory_test.sh: New script.
1440         * testsuite/memory_test.s: New assembler source file.
1441         * testsuite/memory_test.t: New linker script.
1442
1443 2010-08-27  Doug Kwan  <dougkwan@google.com>
1444
1445         * gold/resolve.cc (Symbol_table::should_override): Let a weak
1446         reference override an existing dynamic weak reference.
1447         * testsuite/Makefile.am: Add new test dyn_weak_ref.
1448         * testsuite/Makefile.in: Regenerate.
1449         * testsuite/dyn_weak_ref.sh: New file.
1450         * testsuite/dyn_weak_ref_1.c: Ditto.
1451         * testsuite/dyn_weak_ref_2.c: Ditto.
1452
1453 2010-08-27  Ian Lance Taylor  <iant@google.com>
1454
1455         * incremental.h (class Incremental_input_entry): Add virtual
1456         destructor.
1457
1458 2010-08-27  Ian Lance Taylor  <iant@google.com>
1459
1460         * testsuite/start_lib_test_3.c: Mark t3 as used.
1461
1462 2010-08-27  Nick Clifton  <nickc@redhat.com>
1463
1464         * options.cc (version_script): Fix small typo in previous
1465         whitespace tidyup.
1466
1467 2010-08-25  Nick Clifton  <nickc@redhat.com>
1468
1469         * archive.cc: Formatting fixes: Remove whitespace between
1470         typename and following asterisk.  Remove whitespace between
1471         function name and opening parenthesis.
1472         * archive.h: Likewise.
1473         * arm.cc: Likewise.
1474         * attributes.cc: Likewise.
1475         * attributes.h: Likewise.
1476         * common.cc: Likewise.
1477         * copy-relocs.cc: Likewise.
1478         * dirsearch.h: Likewise.
1479         * dynobj.cc: Likewise.
1480         * ehframe.cc: Likewise.
1481         * ehframe.h: Likewise.
1482         * expression.cc: Likewise.
1483         * fileread.cc: Likewise.
1484         * fileread.h: Likewise.
1485         * gc.h: Likewise.
1486         * gold-threads.cc: Likewise.
1487         * gold.cc: Likewise.
1488         * i386.cc: Likewise.
1489         * icf.h: Likewise.
1490         * incremental-dump.cc: Likewise.
1491         * incremental.cc: Likewise.
1492         * layout.cc: Likewise.
1493         * layout.h: Likewise.
1494         * main.cc: Likewise.
1495         * merge.cc: Likewise.
1496         * merge.h: Likewise.
1497         * object.cc: Likewise.
1498         * object.h: Likewise.
1499         * options.cc: Likewise.
1500         * options.h: Likewise.
1501         * output.cc: Likewise.
1502         * output.h: Likewise.
1503         * plugin.cc: Likewise.
1504         * plugin.h: Likewise.
1505         * powerpc.cc: Likewise.
1506         * reloc.cc: Likewise.
1507         * script-c.h: Likewise.
1508         * script-sections.cc: Likewise.
1509         * script.cc: Likewise.
1510         * stringpool.cc: Likewise.
1511         * symtab.cc: Likewise.
1512         * symtab.h: Likewise.
1513         * target.cc: Likewise.
1514         * timer.cc: Likewise.
1515         * timer.h: Likewise.
1516         * version.cc: Likewise.
1517         * x86_64.cc: Likewise.
1518
1519 2010-08-24  Nick Clifton  <nickc@redhat.com>
1520
1521         PR 11899
1522         * layout.cc (segment_precedes): Sort segments by their physical
1523         addresses, if they have been set.
1524
1525 2010-08-23  Cary Coutant  <ccoutant@google.com>
1526
1527         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1528         symbols data.
1529         (Lib_group::include_member): Unlock object after deleting its
1530         symbols data.
1531         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1532         the bug fixed here.
1533
1534 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
1535             Cary Coutant  <ccoutant@google.com>
1536
1537         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1538         constructor, and set_blocker.
1539         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1540         readsyms_blocker_.
1541         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1542         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1543         * testsuite/Makefile.am (start_lib_test): New test case.
1544         * testsuite/Makefile.in: Regenerate.
1545         * testsuite/start_lib_test_main.c: New file.
1546         * testsuite/start_lib_test_1.c: New file.
1547         * testsuite/start_lib_test_2.c: New file.
1548         * testsuite/start_lib_test_3.c: New file.
1549
1550 2010-08-19  Ian Lance Taylor  <iant@google.com>
1551
1552         * Makefile.in: Rebuild with automake 1.11.1.
1553         * aclocal.m4: Likewise.
1554         * testsuite/Makefile.in: Likewise.
1555
1556 2010-08-19  Ian Lance Taylor  <iant@google.com>
1557
1558         PR 10893
1559         * i386.cc (class Output_data_plt_i386): Update declarations.
1560         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
1561         local_ifuncs_ fields.
1562         (Target_i386::do_plt_section_for_global): New function.
1563         (Target_i386::do_plt_section_for_local): New function.
1564         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1565         parameter; change all callers.  Initialize global_ifuncs_ and
1566         local_ifuncs_.  If doing a static link define __rel_iplt_start and
1567         __rel_iplt_end.
1568         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1569         (Output_data_plt_i386::add_local_ifunc_entry): New function.
1570         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1571         symbols.
1572         (Target_i386::make_plt_section): New function, broken out of
1573         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
1574         (Target_i386::make_plt_entry): Call make_plt_section.
1575         (Target_i386::make_local_ifunc_plt_entry): New function.
1576         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1577         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
1578         R_386_IRELATIVE to switch.
1579         (Target_i386::Scan::global): Likewise.
1580         (Target_i386::Relocate::relocate): Likewise.
1581         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1582         switch.
1583         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1584         (Target_x86_64::do_plt_section_for_global): New function.
1585         (Target_x86_64::do_plt_section_for_local): New function.
1586         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1587         parameter; change all callers.  If doing a static link define
1588         __rela_iplt_start and __rela_iplt_end.
1589         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1590         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1591         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1592         to point to .plt.
1593         (Target_x86_64::make_local_ifunc_plt_entry): New function.
1594         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1595         switch.
1596         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1597         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
1598         R_X86_64_IRELATIVE to switch.
1599         (Target_x86_64::Scan::global): Likewise.
1600         (Target_x86_64::Relocate::relocate): Likewise.
1601         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1602         switch.
1603         * target.h (class Target): Add plt_section_for_global and
1604         plt_section_for_local functions.  Add do_plt_section_for_global
1605         and do_plt_section_for_local virtual functions.
1606         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
1607         clarifying comments.
1608         (Symbol::use_plt_offset): Handle IFUNC symbol.
1609         * object.cc (Sized_relobj::Sized_relobj): Initialize
1610         local_plt_offsets_.
1611         (Sized_relobj::local_has_plt_offset): New function.
1612         (Sized_relobj::local_plt_offset): New function.
1613         (Sized_relobj::set_local_plt_offset): New function.
1614         (Sized_relobj::do_count): Handle IFUNC symbol.
1615         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
1616         a bit away from input_shndx_ field.  Add set_is_func_symbol and
1617         is_ifunc_symbol functions.
1618         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
1619         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
1620         local_plt_offsets_ field.
1621         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1622         * output.h (class Output_section_data): Add non-const
1623         output_section function.
1624         (class Output_data_got): Update declarations.
1625         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1626         Add use_plt_offset parameter to global and local constructors.
1627         Change all callers.  Change local_sym_index_ field to 31 bits.
1628         Change GSYM_CODE and CONSTANT_CODE accordingly.
1629         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1630         doing a static link don't set sh_link field.
1631         (Output_data_got::Got_entry::write): Use PLT offset if
1632         appropriate.
1633         (Output_data_got::add_global_plt): New function.
1634         (Output_data_got::add_local_plt): New function.
1635         * target-reloc.h (relocate_section): Handle IFUNC symbol.
1636         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1637         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1638         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1639         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1640         IFUNC conditional.
1641         * testsuite/ifunc-sel.h: New file.
1642         * testsuite/ifuncmain1.c: New file.
1643         * testsuite/ifuncmain1vis.c: New file.
1644         * testsuite/ifuncmod1.c: New file.
1645         * testsuite/ifuncdep2.c: New file.
1646         * testsuite/ifuncmain2.c: New file.
1647         * testsuite/ifuncmain3.c: New file.
1648         * testsuite/ifuncmod3.c: New file.
1649         * testsuite/ifuncmain4.c: New file.
1650         * testsuite/ifuncmain5.c: New file.
1651         * testsuite/ifuncmod5.c: New file.
1652         * testsuite/ifuncmain6pie.c: New file.
1653         * testsuite/ifuncmod6.c: New file.
1654         * testsuite/ifuncmain7.c: New file.
1655         * configure, testsuite/Makefile.in: Rebuild.
1656
1657 2010-08-18  Ian Lance Taylor  <iant@google.com>
1658
1659         * incremental.cc
1660         (Output_section_incremental_inputs::write_input_files): Add cast
1661         to avoid signed/unsigned comparison warning.
1662         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1663
1664 2010-08-12  Cary Coutant  <ccoutant@google.com>
1665
1666         * common.cc (Sort_commons::operator()): Remove unnecessary code.
1667
1668 2010-08-13  Ian Lance Taylor  <iant@google.com>
1669
1670         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1671
1672 2010-08-12  Cary Coutant  <ccoutant@google.com>
1673             Doug Kwan  <dougkwan@google.com>
1674
1675         * resolve.cc (Symbol_table::should_override): When a weak dynamic
1676         defintion overrides non-weak undef, remember that the original undef
1677         is not weak.
1678         * symtab.cc (Symbol_table::sized_write_global): For undef without
1679         an original weak binding, set binding to global in output.
1680         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1681         * testsuite/Makefile.in: Regenerate.
1682         * testsuite/strong_ref_weak_def.sh: New file.
1683         * testsuite/strong_ref_weak_def_1.c: Ditto.
1684         * testsuite/strong_ref_weak_def_2.c: Ditto.
1685
1686 2010-08-12  Cary Coutant  <ccoutant@google.com>
1687
1688         * testsuite/incremental_test.sh: Rewrite.
1689         * testsuite/incremental_test_1.c: Rewrite.
1690         * testsuite/incremental_test_2.c: Rewrite.
1691
1692 2010-08-12  Cary Coutant  <ccoutant@google.com>
1693
1694         * arm.cc (Target_arm::got_size): Add const.
1695         (Target_arm::got_entry_count): New function.
1696         (Target_arm::plt_entry_count): New function.
1697         (Target_arm::first_plt_entry_offset): New function.
1698         (Target_arm::plt_entry_size): New function.
1699         (Output_data_plt_arm::entry_count): New function.
1700         (Output_data_plt_arm::first_plt_entry_offset): New function.
1701         (Output_data_plt_arm::get_plt_entry_size): New function.
1702         * i386.cc (Target_i386::got_size): Add const.
1703         (Target_i386::got_entry_count): New function.
1704         (Target_i386::plt_entry_count): New function.
1705         (Target_i386::first_plt_entry_offset): New function.
1706         (Target_i386::plt_entry_size): New function.
1707         (Output_data_plt_i386::entry_count): New function.
1708         (Output_data_plt_i386::first_plt_entry_offset): New function.
1709         (Output_data_plt_i386::get_plt_entry_size): New function.
1710         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1711         find_incremental_inputs_sections.  Dump incremental_got_plt section.
1712         * incremental.cc: Include target.h.
1713         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1714         parameter.  Adjust all callers.  Find incremental_got_plt section.
1715         (Incremental_inputs::create_data_sections): Create incremental_got_plt
1716         section.
1717         (Output_section_incremental_inputs::set_final_data_size): Calculate
1718         size of incremental_got_plt section.
1719         (Output_section_incremental_inputs::do_write): Write the
1720         incremental_got_plt section.
1721         (Got_plt_view_info): New struct.
1722         (Local_got_offset_visitor): New class.
1723         (Global_got_offset_visitor): New class.
1724         (Global_symbol_visitor_got_plt): New class.
1725         (Output_section_incremental_inputs::write_got_plt): New function.
1726         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1727         Add parameter.  Adjust all callers.
1728         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1729         (Incremental_inputs::got_plt_section): New function.
1730         (Incremental_inputs::got_plt_section_): New data member.
1731         (Incremental_got_plt_reader): New class.
1732         * layout.cc (Layout::create_incremental_info_sections): Add the
1733         incremental_got_plt section.
1734         * object.h (Got_offset_list::get_list): New function.
1735         (Got offset_list::for_all_got_offsets): New function.
1736         (Sized_relobj::local_got_offset_list): New function.
1737         * powerpc.cc (Target_powerpc::got_size): Add const.
1738         (Target_powerpc::got_entry_count): New function.
1739         (Target_powerpc::plt_entry_count): New function.
1740         (Target_powerpc::first_plt_entry_offset): New function.
1741         (Target_powerpc::plt_entry_size): New function.
1742         (Output_data_plt_powerpc::entry_count): New function.
1743         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1744         (Output_data_plt_powerpc::get_plt_entry_size): New function.
1745         * sparc.cc (Target_sparc::got_size): Add const.
1746         (Target_sparc::got_entry_count): New function.
1747         (Target_sparc::plt_entry_count): New function.
1748         (Target_sparc::first_plt_entry_offset): New function.
1749         (Target_sparc::plt_entry_size): New function.
1750         (Output_data_plt_sparc::entry_count): New function.
1751         (Output_data_plt_sparc::first_plt_entry_offset): New function.
1752         (Output_data_plt_sparc::get_plt_entry_size): New function.
1753         * symtab.h (Symbol::got_offset_list): New function.
1754         (Symbol_table::for_all_symbols): New function.
1755         * target.h (Sized_target::got_entry_count): New function.
1756         (Sized_target::plt_entry_count): New function.
1757         (Sized_target::plt_entry_size): New function.
1758         * x86_64.cc (Target_x86_64::got_size): Add const.
1759         (Target_x86_64::got_entry_count): New function.
1760         (Target_x86_64::plt_entry_count): New function.
1761         (Target_x86_64::first_plt_entry_offset): New function.
1762         (Target_x86_64::plt_entry_size): New function.
1763         (Output_data_plt_x86_64::entry_count): New function.
1764         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1765         (Output_data_plt_x86_64::get_plt_entry_size): New function.
1766
1767 2010-08-12  Cary Coutant  <ccoutant@google.com>
1768
1769         * archive.cc: Include incremental.h.
1770         (Archive::Archive): Initialize incremental_info_.
1771         (Archive::include_member): Record archive members in incremental info.
1772         (Add_archive_symbols::run): Record begin and end of an archive in
1773         incremental info.
1774         (Lib_group::include_member): Record objects in incremental info.
1775         * archive.h (Incremental_archive_entry): Forward declaration.
1776         (Archive::set_incremental_info): New member function.
1777         (Archive::incremental_info): New member function.
1778         (Archive::Unused_symbol_iterator): New class.
1779         (Archive::unused_symbols_begin): New member function.
1780         (Archive::unused_symbols_end): New member function.
1781         (Archive::incremental_info_): New data member.
1782         * incremental-dump.cc (find_input_containing_global): New function.
1783         (dump_incremental_inputs): Dump new incremental info sections.
1784         * incremental.cc: Include symtab.h.
1785         (Output_section_incremental_inputs): New class.
1786         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1787         new incremental info sections.
1788         (Sized_incremental_binary::do_check_inputs): Likewise.
1789         (Incremental_inputs::report_archive): Remove.
1790         (Incremental_inputs::report_archive_begin): New function.
1791         (Incremental_inputs::report_archive_end): New function.
1792         (Incremental_inputs::report_object): New function.
1793         (Incremental_inputs::finalize_inputs): Remove.
1794         (Incremental_inputs::report_input_section): New function.
1795         (Incremental_inputs::report_script): Rewrite.
1796         (Incremental_inputs::finalize): Do nothing but finalize string table.
1797         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1798         (Incremental_inputs::sized_create_inputs_section_data): Remove.
1799         (Incremental_inputs::create_data_sections): New function.
1800         (Incremental_inputs::relocs_entsize): New function.
1801         (Output_section_incremental_inputs::set_final_data_size): New function.
1802         (Output_section_incremental_inputs::do_write): New function.
1803         (Output_section_incremental_inputs::write_header): New function.
1804         (Output_section_incremental_inputs::write_input_files): New function.
1805         (Output_section_incremental_inputs::write_info_blocks): New function.
1806         (Output_section_incremental_inputs::write_symtab): New function.
1807         * incremental.h (Incremental_script_entry): Forward declaration.
1808         (Incremental_object_entry): Forward declaration.
1809         (Incremental_archive_entry): Forward declaration.
1810         (Incremental_inputs): Forward declaration.
1811         (Incremental_inputs_header_data): Remove.
1812         (Incremental_inputs_header): Remove.
1813         (Incremental_inputs_header_write): Remove.
1814         (Incremental_inputs_entry_data): Remove.
1815         (Incremental_inputs_entry): Remove.
1816         (Incremental_inputs_entry_write): Remove.
1817         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1818         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1819         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1820         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1821         Likewise.
1822         (Incremental_input_entry): New class.
1823         (Incremental_script_entry): New class.
1824         (Incremental_object_entry): New class.
1825         (Incremental_archive_entry): New class.
1826         (Incremental_inputs::Incremental_inputs): Initialize new data members.
1827         (Incremental_inputs::report_inputs): Remove.
1828         (Incremental_inputs::report_archive): Remove.
1829         (Incremental_inputs::report_archive_begin): New function.
1830         (Incremental_inputs::report_archive_end): New function.
1831         (Incremental_inputs::report_object): Change prototype.
1832         (Incremental_inputs::report_input_section): New function.
1833         (Incremental_inputs::report_script): Change prototype.
1834         (Incremental_inputs::get_reloc_count): New function.
1835         (Incremental_inputs::set_reloc_count): New function.
1836         (Incremental_inputs::create_data_sections): New function.
1837         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1838         (Incremental_inputs::inputs_section): New function.
1839         (Incremental_inputs::symtab_section): New function.
1840         (Incremental_inputs::relocs_section): New function.
1841         (Incremental_inputs::get_stringpool): Add const.
1842         (Incremental_inputs::command_line): Add const.
1843         (Incremental_inputs::inputs): Remove.
1844         (Incremental_inputs::command_line_key): New function.
1845         (Incremental_inputs::input_file_count): New function.
1846         (Incremental_inputs::input_files): New function.
1847         (Incremental_inputs::relocs_entsize): New function.
1848         (Incremental_inputs::sized_create_inputs_section_data): Remove.
1849         (Incremental_inputs::finalize_inputs): Remove.
1850         (Incremental_inputs::Input_info): Remove.
1851         (Incremental_inputs::lock_): Remove.
1852         (Incremental_inputs::inputs_): Change type.
1853         (Incremental_inputs::inputs_map_): Remove.
1854         (Incremental_inputs::current_object_entry_): New data member.
1855         (Incremental_inputs::inputs_section_): New data member.
1856         (Incremental_inputs::symtab_section_): New data member.
1857         (Incremental_inputs::relocs_section_): New data member.
1858         (Incremental_inputs::reloc_count_): New data member.
1859         (Incremental_inputs_reader): New class.
1860         (Incremental_symtab_reader): New class.
1861         (Incremental_relocs_reader): New class.
1862         * layout.cc (Layout::finalize): Move finalization of incremental info
1863         and creation of incremental info sections to follow finalization of
1864         symbol table.  Set offsets for postprocessing sections.
1865         (Layout::create_incremental_info_sections): Call
1866         Incremental_inputs::create_data_sections.  Add incremental symtab
1867         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
1868         sections to layout after input sections.
1869         * layout.h (struct Timespec): Forward declaration.
1870         (Layout::incremental_inputs): Add const.
1871         (Layout::create_incremental_info_sections): Add parameter.
1872         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1873         * object.cc: Include incremental.h.
1874         (Relobj::finalize_incremental_relocs): New function.
1875         (Sized_relobj::do_layout): Record input sections in incremental info.
1876         * object.h (Object::output_section): New function.
1877         (Object::output_section_offset): Moved from Relobj.
1878         (Object::get_incremental_reloc_base): New function.
1879         (Object::get_incremental_reloc_count): New function.
1880         (Object::do_output_section): New function.
1881         (Object::do_output_section_offset): Moved from Relobj.
1882         (Object::do_get_incremental_reloc_base): New function.
1883         (Object::do_get_incremental_reloc_count): New function.
1884         (Object::Object): Initialize new data members.
1885         (Relobj::output_section): Renamed do_output_section and moved to
1886         protected.
1887         (Relobj::output_section_offset): Moved to Object.
1888         (Relobj::do_get_incremental_reloc_base): New function.
1889         (Relobj::do_get_incremental_reloc_count): New function.
1890         (Relobj::allocate_incremental_reloc_counts): New function.
1891         (Relobj::count_incremental_reloc): New function.
1892         (Relobj::finalize_incremental_relocs): New function.
1893         (Relobj::next_incremental_reloc_index): New function.
1894         (Relobj::reloc_counts_): New data member.
1895         (Relobj::reloc_bases_): New data member.
1896         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
1897         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
1898         (Sized_relobj::incremental_relocs_scan): New function.
1899         (Sized_relobj::incremental_relocs_scan_reltype): New function.
1900         (Sized_relobj::incremental_relocs_write): New function.
1901         (Sized_relobj::incremental_relocs_write_reltype): New function.
1902         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1903         incremental link.
1904         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1905         archives and object files elsewhere.
1906         (Add_symbols::run): Report object files here.
1907         (Finish_group::run): Report end of archive at end of group.
1908         * reloc.cc: Include layout.h, incremental.h.
1909         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1910         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1911         (Sized_relobj::incremental_relocs_scan): New function.
1912         (Sized_relobj::incremental_relocs_scan_reltype): New function.
1913         (Sized_relobj::do_relocate_sections): Write incremental relocations.
1914         (Sized_relobj::incremental_relocs_write): New function.
1915         (Sized_relobj::incremental_relocs_write_reltype): New function.
1916         * script.cc (read_input_script): Rewrite test for incremental link.
1917         Change call to Incremental_inputs::report_script.
1918         * symtab.h (Symbol_table::first_global_index): New function.
1919         (Symbol_table::output_count): New function.
1920
1921 2010-08-12  Doug Kwan  <dougkwan@google.com>
1922
1923         * arm.cc (Target_arm::merge_object_attributes): Check command line
1924         options --no-wchar-size-warning and --no-enum-size-warning.
1925         * options.h (General_options): Add ld-compatible options
1926         --no-enum-size-warning and --no-wchar-size-warning.
1927
1928 2010-08-04  Ian Lance Taylor  <iant@google.com>
1929
1930         * x86_64.cc (Target_x86_64::Scan::local): Use
1931         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1932         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1933         (Target_x86_64::Scan::global): Likewise.
1934         (Target_x86_64::Relocate::relocate): Likewise.
1935         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1936         Likewise.
1937
1938 2010-08-03  Cary Coutant  <ccoutant@google.com>
1939
1940         * merge.cc (Output_merge_string::do_add_input_section): Count strings
1941         to reserve space in merged_strings vector. Keep total input size
1942         for stats.
1943         (Output_merge_string::do_print_merge_stats): Print total input size.
1944         * merge.h (Output_merge_string): Add input_size_ field.
1945         * stringpool.cc (Stringpool_template::string_length): Move
1946         implementations out of Stringpool_template class and place in
1947         stringpool.h.
1948         * stringpool.h (string_length): Move out of Stringpool_template.
1949
1950 2010-08-03  Ian Lance Taylor  <iant@google.com>
1951
1952         PR 11712
1953         * layout.cc (relaxation_loop_body): If address of load segment is
1954         set, adjust address to include headers if possible.
1955
1956 2010-08-03  Ian Lance Taylor  <iant@google.com>
1957
1958         * version.cc (version_string): Bump to 1.10.
1959
1960 2010-08-03  Ian Lance Taylor  <iant@google.com>
1961
1962         PR 11805
1963         * layout.h (enum Output_section_order): Define.
1964         (class Layout): Update declarations.
1965         * layout.cc (Layout::get_output_section): Add order parameter.
1966         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1967         is_first_non_relro parameters.  Change all callers.
1968         (Layout::choose_output_section): Likewise.
1969         (Layout::add_output_section_data): Likewise.
1970         (Layout::make_output_section): Likewise.  Set order.
1971         (Layout::default_section_order): New function.
1972         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1973         * output.cc (Output_section::Output_section): Initialize order_.
1974         Don't initialize deleted fields.
1975         (Output_segment::Output_segment): Don't initialize deleted
1976         fields.
1977         (Output_segment::add_output_section_to_load): New function
1978         replacing add_output_section.  Change all callers to call this or
1979         add_output_section_to_nonload.
1980         (Output_segment::add_output_section_to_nonload): New function.
1981         (Output_segment::remove_output_section): Rewrite.
1982         (Output_segment::add_initial_output_data): Likewise.
1983         (Output_segment::has_any_data_sections): Likewise.
1984         (Output_segment::is_first_section_relro): Likewise.
1985         (Output_segment::maximum_alignment): Likewise.
1986         (Output_segment::has_dynamic_reloc): New function replacing
1987         dynamic_reloc_count.  Change all callers.
1988         (Output_segment::has_dynamic_reloc_list): New function replacing
1989         dynamic_reloc_count_list.  Change all callers.
1990         (Output_segment::set_section_addresses): Rewrite.
1991         (Output_segment::set_offset): Rewrite.
1992         (Output_segment::find_first_and_last_list): Remove.
1993         (Output_segment::set_tls_offsets): Rewrite.
1994         (Output_segment::first_section_load_address): Likewise.
1995         (Output_segment::output_section_count): Likewise.
1996         (Output_segment::section_with_lowest_load_address): Likewise.
1997         (Output_segment::write_section_headers): Likewise.
1998         (Output_segment::print_sections_to_map): Likewise.
1999         * output.h (class Output_data): Remove dynamic_reloc_count_
2000         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
2001         (Output_data::add_dynamic_reloc): Rewrite.
2002         (Output_data::has_dynamic_reloc): New function.
2003         (Output_data::dynamic_reloc_count): Remove.
2004         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
2005         is_last_relro_, is_first_non_relro_, is_interp_,
2006         is_dynamic_linker_section_ fields.  Add order and set_order
2007         functions.  Remove is_relro_local, set_is_relro_local,
2008         is_last_relro, set_is_last_relro, is_first_non_relro,
2009         set_is_first_non_relro functions, is_interp, set_is_interp,
2010         is_dynamic_linker_section, and set_is_dynamic_linker_section
2011         functions.
2012         (class Output_segment): Change Output_data_list from std::list to
2013         std:;vector.  Add output_lists_ field.  Remove output_data_ and
2014         output_bss_ fields.  Update declarations.
2015
2016 2010-08-02  Ian Lance Taylor  <iant@google.com>
2017
2018         * arm.cc (Target_arm::gc_process_relocs): Use typename.
2019         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2020         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2021
2022 2010-08-02  Ian Lance Taylor  <iant@google.com>
2023
2024         PR 11855
2025         * script.cc (Script_options::Script_options): Initialize
2026         symbol_definitions_ and symbol_references_.
2027         (Script_options::add_symbol_assignment): Update
2028         symbol_definitions_ and symbol_references_.
2029         (Script_options::add_symbol_reference): New function.
2030         (script_symbol): New function.
2031         * script.h (class Script_options): Add symbol_definitions_ and
2032         symbol_references_ fields.
2033         (Script_options::referenced_const_iterator): New type.
2034         (Script_options::referenced_begin): New function.
2035         (Script_options::referenced_end): New function.
2036         (Script_options::is_referenced): New function.
2037         (Script_options::any_unreferenced): New function.
2038         * script-c.h (script_symbol): Declare.
2039         * yyscript.y (exp): Call script_symbol.
2040         * symtab.cc: Include "script.h".
2041         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2042         Change all callers.  Check symbols referenced by scripts.
2043         (Symbol_table::add_undefined_symbols_from_command_line): Add
2044         layout parameter.  Change all callers.
2045         (Symbol_table::do_add_undefined_symbols_from_command_line):
2046         Likewise.  Break out loop body.  Check symbols referenced by
2047         scripts.
2048         (Symbol_table::add_undefined_symbol_from_command_line): New
2049         function broken out of
2050         do_add_undefined_symbols_from_command_line.
2051         * symtab.h (class Symbol_table): Update declarations.
2052         * archive.cc: Include "layout.h".
2053         (Archive::should_include_member): Add layout parameter.  Change
2054         all callers.  Check for symbol mentioned in expression.
2055         * archive.h (class Archive): Update declaration.
2056         * object.cc (Sized_relobj::do_should_include_member): Add layout
2057         parameter.
2058         * object.h (Object::should_include_member): Add layout parameter.
2059         Change all callers.
2060         (Object::do_should_include_member): Add layout parameter.
2061         (class Sized_relobj): Update declaration.
2062         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2063         parameter.
2064         * dynobj.h (class Sized_dynobj): Update declaration.
2065         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2066         layout parameter.
2067         * plugin.h (class Sized_pluginobj): Update declaration.
2068
2069 2010-08-02  Ian Lance Taylor  <iant@google.com>
2070
2071         PR 11866
2072         * output.cc (Output_segment::set_offset): Search for the first and
2073         last sections rather than assuming that the list is in order.
2074         (Output_segment::find_first_and_last_list): New function.
2075         * output.h (class Output_segment): Update declarations.
2076         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2077         (relro_strip_test_SOURCES): New variable.
2078         (relro_strip_test_DEPENDENCIES): New variable.
2079         (relro_strip_test_LDFLAGS): New variable.
2080         (relro_strip_test_LDADD): New variable.
2081         (relro_strip_test.so): New target.
2082
2083 2010-08-02  Ian Lance Taylor  <iant@google.com>
2084
2085         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2086         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2087         (Target_i386::got_tlsdesc_section): New function.
2088         (Target_i386::got_section): Create space for GOT entries for
2089         TLSDESC relocations.
2090         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2091         R_386_TLS_GOTDESC.
2092         (Target_i386::Scan::global): Likewise.
2093         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2094         using TLSDESC GOT.
2095         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2096         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2097         (Target_x86_64::got_tlsdesc_section): New function.
2098         (Target_x86_64::got_section): Create space for GOT entries for
2099         TLSDESC relocations.
2100         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2101         R_386_TLS_GOTDESC.
2102         (Target_x86_64::Scan::global): Likewise.
2103         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2104         using TLSDESC GOT.
2105
2106 2010-08-02  Ian Lance Taylor  <iant@google.com>
2107
2108         * testsuite/final_layout.sh: Use dc to convert from hex to
2109         decimal.
2110
2111 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2112
2113         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2114         paramter to the call to gold::gc_process_relocs.
2115         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2116         paramter to the call to gold::gc_process_relocs.
2117         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2118         parameter to the call to gold::gc_process_relocs.
2119         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2120         template parameter to the call to gold::gc_process_relocs.
2121         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2122         paramter to the call to gold::gc_process_relocs.
2123         * gc.h (get_embedded_addend_size): New function.
2124         (gc_process_relocs): Save the size of the reloc for use by ICF.
2125         * icf.cc (get_section_contents): Get the addend from the text section
2126         for SHT_REL relocation sections.
2127         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2128         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2129         * int_encoding.h (read_from_pointer): New overloaded function.
2130         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2131         * testsuite/icf_sht_rel_addend_test.sh: New file.
2132         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2133         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2134
2135 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2136
2137         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2138         * Makefile.in: Regenerate.
2139         * testsuite/Makefile.in: Regenerate.
2140
2141 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2142
2143         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2144         * gold/testsuite/debug_msg.cc: Likewise.
2145         * gold/testsuite/odr_violation1.cc
2146         * gold/testsuite/odr_violation2.cc
2147
2148 2010-07-21  Cary Coutant  <ccoutant@google.com>
2149
2150         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2151         string, and length fields.
2152         (Output_merge_string::Merged_strings_list): New type.
2153         (Output_merge_string::Merged_strings_lists): New typedef.
2154         (Output_merge_string): Replace merged_strings_ with
2155         merged_strings_lists_.
2156         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2157         Merged_strings_list per input object and section.  Don't store pointer
2158         to the string.  Don't store length with each merged string entry.
2159         (Output_merge_string::finalize_merged_data): Loop over list of merged
2160         strings lists.  Recompute length of each merged string.
2161
2162 2010-07-15  Cary Coutant  <ccoutant@google.com>
2163
2164         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2165         here.
2166
2167 2010-07-14  Ian Lance Taylor  <iant@google.com>
2168
2169         * descriptors.cc (Descriptors::open): Report correct name in error
2170         message.
2171
2172 2010-07-13  Doug Kwan  <dougkwan@google.com>
2173
2174         * arm.cc (Arm_input_section::Arm_input_section): For a
2175         SHT_ARM_EXIDX section, always keeps the input sections.
2176         (Arm_input_section::set_exidx_section_link): New method.
2177         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2178         has_errors_ to false.
2179         (Arm_exidx_input_section::has_errors,
2180         Arm_exidx_input_section::set_has_errors): New methods.
2181         (Arm_exidx_input_section::has_errors_): New data member.
2182         (Arm_relobj::get_exidx_shndx_list): New method.
2183         (Arm_output_section::append_text_sections_to_list): Do not skip
2184         section without SHF_EXECINSTR.
2185         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2186         errors.
2187         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2188         section header.  Make error messages more verbose.  Check for
2189         a non-executable section linked to an EXIDX section.
2190         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2191         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2192         check that there is no deferred EXIDX section if we exit early.
2193         Instead of not making an EXIDX section in case of an error, make one
2194         and set the has_errors flag of it.
2195         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2196         in a relocatable link.
2197         (Target_arm::do_relax): Look for the EXIDX output section instead of
2198         assuming that it is called .ARM.exidx.
2199         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2200         section list.  Do not check for SHF_EXECINSTR section flags but
2201         skip any input section with errors.
2202         * output.cc (Output_section::Output_section): Initialize
2203         always_keeps_input_sections_ to false.
2204         (Output_section::add_input_section): Check for
2205         always_keeps_input_sections_.
2206         *  output.h (Output_section::always_keeps_input_sections,
2207         Output_section::set_always_keeps_input_sections): New methods.
2208         (Output_section::always_keeps_input_sections): New data member.
2209
2210 2010-07-13  Rafael Espindola  <espindola@google.com>
2211
2212         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2213         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2214
2215 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2216             Ian Lance Taylor  <iant@google.com>
2217
2218         * output.h (Output_section_lookup_maps::add_merge_section):
2219         Correct check of whether value was inserted.
2220         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2221         (Output_section_lookup_maps::add_relaxed_input_section):
2222         Likewise.
2223         * arm.cc (Target_arm::got_section): Remove used local os.
2224         * i386.cc (Target_i386::got_section): Likewise.
2225         * x86_64.cc (Target_x86_64::got_section): Likewise.
2226         * sparc.cc (Target_sparc::got_section): Likewise.
2227         (Target_sparc::relocate): Remove unused local have_got_offset.
2228         * powerpc.cc (Target_powerpc::relocate): Likewise.
2229
2230 2010-07-13  Ian Lance Taylor  <iant@google.com>
2231
2232         * compressed_output.cc (zlib_decompress): Fix signature in
2233         !HAVE_ZLIB_H case.
2234
2235         * archive.cc (Archive::include_member): Unlock an external member
2236         of a thin archive.  Don't bother to delete an object we know is
2237         NULL.
2238
2239 2010-07-12  Cary Coutant  <ccoutant@google.com>
2240
2241         * compressed_output.cc (zlib_decompress): New function.
2242         (get_uncompressed_size): New function.
2243         (decompress_input_section): New function.
2244         * compressed_output.h (get_uncompressed_size): New function.
2245         (decompress_input_section): New function.
2246         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2247         Handle compressed debug sections.
2248         * layout.cc (is_compressed_debug_section): New function.
2249         (Layout::output_section_name): Map compressed section names to
2250         canonical names.
2251         * layout.h (is_compressed_debug_section): New function.
2252         (is_debug_info_section): Recognize compressed debug sections.
2253         * merge.cc: Include compressed_output.h.
2254         (Output_merge_data::do_add_input_section): Handle compressed
2255         debug sections.
2256         (Output_merge_string::do_add_input_section): Handle compressed
2257         debug sections.
2258         * object.cc: Include compressed_output.h.
2259         (Sized_relobj::Sized_relobj): Initialize new data members.
2260         (build_compressed_section_map): New function.
2261         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2262         * object.h (Object::section_is_compressed): New method.
2263         (Object::do_section_is_compressed): New method.
2264         (Sized_relobj::Compressed_section_map): New type.
2265         (Sized_relobj::do_section_is_compressed): New method.
2266         (Sized_relobj::compressed_sections_): New data member.
2267         * output.cc (Output_section::add_input_section): Handle compressed
2268         debug sections.
2269         * reloc.cc: Include compressed_output.h.
2270         (Sized_relobj::write_sections): Handle compressed debug sections.
2271
2272 2010-07-08  Cary Coutant  <ccoutant@google.com>
2273
2274         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2275         weak when resolving to a dynamic def.
2276         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2277         for weak undef/dynamic def cases. Adjust callers.
2278         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2279         undef_binding_weak_.
2280         (Symbol_table::sized_write_globals): Adjust symbol binding.
2281         (Symbol_table::sized_write_symbol): Add binding parameter.
2282         * symtab.h (Symbol::set_undef_binding): New method.
2283         (Symbol::is_undef_binding_weak): New method.
2284         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2285         (Symbol_table::should_override): Add new parameter.
2286         (Symbol_table::sized_write_symbol): Add new parameter.
2287
2288         * testsuite/weak_undef_file1.cc: Add new test case.
2289         * testsuite/weak_undef_file2.cc: Fix header comment.
2290         * testsuite/weak_undef_test.cc: Add new test case.
2291
2292 2010-06-29  Doug Kwan  <dougkwan@google.com>
2293
2294         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2295         Initialize USE_SYMBOL_.
2296         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2297         definition.
2298         (Arm_reloc_property::uses_symbol_): New data member declaration.
2299         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2300         uses symbol value and symbol is undefined but not weakly undefined.
2301
2302 2010-06-28  Rafael Espindola  <espindola@google.com>
2303
2304         * plugin.cc (Plugin::load): Use dlerror.
2305
2306 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2307
2308         * symtab.cc (detect_odr_violations): When reporting an ODR
2309         violation, report an object where the symbol is defined.
2310
2311 2010-06-25  Doug Kwan  <dougkwan@google.com>
2312
2313         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2314         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2315         definition.
2316         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2317         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2318         target hook to detect function points.
2319         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2320         * icf.h (Icf::check_section_for_function_pointers): Change type of
2321         parameter SECTION_NAME to const reference to std::string.  Use
2322         target hook to determine if section may have unsafe pointers.
2323         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2324         method definition.
2325
2326 2010-06-21  Rafael Espindola  <espindola@google.com>
2327
2328         * fileread.cc (Input_file::find_fie): New
2329         (Input_file::open): Use Input_file::find_fie.
2330         * fileread.h (Input_file::find_fie): New
2331         * plugin.cc (set_extra_library_path): New.
2332         (Plugin::load): Add set_extra_library_path to the transfer vector.
2333         (Plugin_manager::set_extra_library_path): New.
2334         (Plugin_manager::add_input_file): Use the extra search path if set.
2335         (set_extra_library_path(): New.
2336         * plugin.h (Plugin_manager): Add set_extra_library_path and
2337         extra_search_path_.
2338
2339 2010-06-19  Cary Coutant  <ccoutant@google.com>
2340
2341         * layout.cc (gdb_sections): Add .debug_types.
2342         (lines_only_debug_sections): Likewise.
2343
2344 2010-06-18  Rafael Espindola  <espindola@google.com>
2345
2346         * plugin.cc (add_input_file,add_input_library)
2347         (Plugin_manager::add_input_file): Make filename arguments const.
2348         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2349         const.
2350
2351 2010-06-16  Doug Kwan  <dougkwan@google.com>
2352
2353         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2354         .ARM.attributes section if we have not merged any input
2355         attributes sections.
2356
2357 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2358
2359         * arm.cc: Allow combining objects with no EABI version
2360         information.
2361
2362 2010-06-15  Rafael Espindola  <espindola@google.com>
2363
2364         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2365
2366 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2367
2368         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2369         (struct iovec): Correct !HAVE_READV definition.
2370
2371 2010-06-10  Cary Coutant  <ccoutant@google.com>
2372
2373         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2374         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2375         reloc sections.
2376         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2377
2378         PR 11683
2379         * symtab.h (Symbol::is_placeholder): New member function.
2380         * target-reloc.h (relocate_section): Check for placeholder symbols.
2381
2382         * testsuite/Makefile.am (plugin_test_8): New test.
2383         (plugin_test_9): New test.
2384         * testsuite/Makefile.in: Regenerate.
2385
2386 2010-06-09  Nick Clifton  <nickc@redhat.com>
2387
2388         * yyscript.y (input_list_element): Allow strings prefixed with
2389         the '-' character.  Treat these as libraries.
2390         * script.cc (script_add_library): New function.  Adds a library
2391         specified by "-l<name>" found in an input script.
2392         * script-c.h: Add prototype for script_add_library.
2393
2394 2010-06-07  Doug Kwan  <dougkwan@google.com>
2395
2396         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2397         Restrict stub-group size to be within long conditional branch
2398         range when working around cortex-A8 erratum.
2399
2400 2010-06-07  Damien Diederen  <dd@crosstwine.com>
2401
2402         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2403         #ifdef typo.
2404
2405 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
2406
2407         PR gold/11658
2408         * output.cc
2409         (Output_section::Input_section_sort_entry::compare_section_ordering):
2410         Change to return non-zero correctly.
2411         (Output_section::Input_section_sort_section_order_index_compare
2412         ::operator()): Change to fix ambiguity in comparisons.
2413
2414 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
2415
2416         * gold.h (is_wildcard_string): New function.
2417         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2418         (Layout::layout_eh_frame): Ditto.
2419         (Layout::find_section_order_index): New method.
2420         (Layout::read_layout_from_file): New method.
2421         * layout.h (Layout::find_section_order_index): New method.
2422         (Layout::read_layout_from_file): New method.
2423         (Layout::input_section_position_): New private member.
2424         (Layout::input_section_glob_): New private member.
2425         * main.cc (main): Call read_layout_from_file here.
2426         * options.h (--section-ordering-file): New option.
2427         * output.cc (Output_section::input_section_order_specified_): New
2428         member.
2429         (Output_section::Output_section): Initialize new member.
2430         (Output_section::add_input_section): Add new parameter.
2431         Keep input sections when --section-ordering-file is used.
2432         (Output_section::set_final_data_size): Sort input sections when
2433         section ordering file is specified.
2434         (Output_section::Input_section_sort_entry): Add new parameter.
2435         Check sorting type.
2436         (Output_section::Input_section_sort_entry::compare_section_ordering):
2437         New method.
2438         (Output_section::Input_section_sort_compare::operator()): Change to
2439         consider section_order_index.
2440         (Output_section::Input_section_sort_init_fini_compare::operator()):
2441         Change to consider section_order_index.
2442         (Output_section::Input_section_sort_section_order_index_compare
2443         ::operator()): New method.
2444         (Output_section::sort_attached_input_sections): Change to sort
2445         according to section order when specified.
2446         (Output_section::add_input_section<32, true>): Add new parameter.
2447         (Output_section::add_input_section<64, true>): Add new parameter.
2448         (Output_section::add_input_section<32, false>): Add new parameter.
2449         (Output_section::add_input_section<64, false>): Add new parameter.
2450         * output.h (Output_section::add_input_section): Add new parameter.
2451         (Output_section::input_section_order_specified): New
2452         method.
2453         (Output_section::set_input_section_order_specified): New method.
2454         (Input_section::Input_section): Initialize section_order_index_.
2455         (Input_section::section_order_index): New method.
2456         (Input_section::set_section_order_index): New method.
2457         (Input_section::section_order_index_): New member.
2458         (Input_section::Input_section_sort_section_order_index_compare): New
2459         struct.
2460         (Output_section::input_section_order_specified_): New member.
2461         * script-sections.cc (is_wildcard_string): Delete and move modified
2462         method to gold.h.
2463         (Output_section_element_input::Output_section_element_input): Modify
2464         call to is_wildcard_string.
2465         (Output_section_element_input::Input_section_pattern
2466         ::Input_section_pattern): Ditto.
2467         (Output_section_element_input::Output_section_element_input): Ditto.
2468         * testsuite/Makefile.am (final_layout): New test case.
2469         * testsuite/Makefile.in: Regenerate.
2470         * testsuite/final_layout.cc: New file.
2471         * testsuite/final_layout.sh: New file.
2472
2473 2010-06-01  Rafael Espindola  <espindola@google.com>
2474
2475         * plugin.cc (Plugin::load): Pass the output name to the plugin.
2476
2477 2010-06-01  Rafael Espindola  <espindola@google.com>
2478
2479         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2480         visibility of symbols.
2481
2482 2010-05-27  Doug Kwan  <dougkwan@google.com>
2483
2484         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2485         from start of output section instead of address for a local symbol
2486         in a merged or relaxed section when doing a relocatable link.
2487
2488 2010-05-26  Rafael Espindola  <espindola@google.com>
2489
2490        PR 11604
2491         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2492         adding sections the garbage collector removed.
2493         * gold/testsuite/Makefile.am: Add test.
2494         * gold/testsuite/Makefile.in: Regenerate.
2495         * gold/testsuite/plugin_test_7.sh: New.
2496         * gold/testsuite/plugin_test_7_1.c: New.
2497         * gold/testsuite/plugin_test_7_2.c: New.
2498
2499 2010-05-26  Rafael Espindola  <espindola@google.com>
2500
2501         * script-sections.cc (Output_section_definition::set_section_addresses):
2502         Check for --section-start.
2503
2504 2010-05-26  Doug Kwan  <dougkwan@google.com>
2505
2506         * arm.cc (Arm_scan_relocatable_relocs): New class.
2507         (Target_arm::relocate_special_relocatable): New method.
2508         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2509         (Arm_relocate_functions::thumb_branch_common): Same.
2510         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2511         instead of Default_scan_relocatable_relocs.
2512         * target-reloc.h (relocate_for_relocatable): Let target handle
2513         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2514         * target.h (Sized_target::relocate_special_relocatable): New method.
2515
2516 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2517
2518         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2519
2520 2010-05-23  Doug Kwan  <dougkwan@google.com>
2521
2522         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2523         instead of a cast.
2524         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2525         with a direct branch, not a conditional branch, to a stub.
2526         * merge.cc (Output_merge_base::record_input_section): New method
2527         defintion.
2528         (Output_merge_data::do_add_input_section): Record input section if
2529         keeps-input-sections flag is set.
2530         (Output_merge_string::do_add_input_section): Ditto.
2531         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2532         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2533         INPUT_SECTIONS_.
2534         (Output_merge_base::keeps_input_sections,
2535         Output_merge_base::set_keeps_input_sections,
2536         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2537         method definitions.
2538         (Output_merge_base::Input_sections): New type declaration.
2539         (Output_merge_base::input_sections_begin,
2540         Output_merge_base::input_sections_end,
2541         Output_merge_base::do_set_keeps_input_sections): New method definitions.
2542         (Output_merge_base::bool keeps_input_sections_,
2543         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2544         Output_merge_base::input_sections_): New data members.
2545         (Output_merge_data::do_set_keeps_input_sections): New method
2546         defintion.
2547         (Output_merge_string::do_set_keeps_input_sections): Ditto.
2548         * output.cc (Output_section::Input_section::relobj): Move method
2549         defintion from class declaration to here and handle merge sections.
2550         (Output_section::Input_section::shndx): Ditto.
2551         (Output_section::Output_section): Remove initializations of removed
2552         data members and initialize new data member LOOKUP_MAPS_.
2553         (Output_section::add_input_section): Set keeps-input-sections flag
2554         for a newly created merge output section as appropriate.  Adjust code
2555         to use Output_section_lookup_maps class.
2556         (Output_section::add_relaxed_input_section): Adjst code for lookup
2557         maps code refactoring.
2558         (Output_section::add_merge_input_section): Add a new parameter
2559         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
2560         class.  If adding input section to a newly created merge output
2561         section fails, remove the new merge section.
2562         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2563         Adjust code for use of the Output_section_lookup_maps class.
2564         (Output_section::find_merge_section): Ditto.
2565         (Output_section::build_lookup_maps): New method defintion.
2566         (Output_section::find_relaxed_input_section): Adjust code to use
2567         Output_section_lookup_maps class.
2568         (Output_section::get_input_sections): Export merge sections.  Adjust
2569         code to use Output_section_lookup_maps class.
2570         (Output_section:::add_script_input_section): Adjust code to use
2571         Output_section_lookup_maps class.  Update lookup maps for merge
2572         sections also.
2573         (Output_section::discard_states): Use Output_section_lookup_maps.
2574         (Output_section::restore_states): Same.
2575         * output.h (Merge_section_properties): Move class defintion out of
2576         Output_section.
2577         (Output_section_lookup_maps): New class.
2578         (Output_section::Input_section::is_merge_section): New method
2579         defintion.
2580         (Output_section::Input_section::relobj): Move defintion out of class
2581         defintion.  Declare method only.
2582         (Output_section::Input_section::shndx): Ditto.
2583         (Output_section::Input_section::output_merge_base): New method defintion.
2584         (Output_section::Input_section::u2_.pomb): New union field.
2585         (Output_section::Merge_section_by_properties_map,
2586         Output_section::Output_section_data_by_input_section_map,
2587         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2588         Remove types.
2589         (Output_section::add_merge_input_section): Add new parameter
2590         KEEPS_INPUT_SECTIONS.
2591         (Output_section::build_lookup_maps): New method declaration.
2592         (Output_section::merge_section_map_,
2593         Output_section::merge_section_by_properties_map_,
2594         Output_section::relaxed_input_section_map_,
2595         Output_section::is_relaxed_input_section_map_valid_): Remove data
2596         members.
2597         (Output_section::lookup_maps_): New data member.
2598
2599 2010-05-21  Doug Kwan  <dougkwan@google.com>
2600
2601         PR gold/11619
2602         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2603         avoid a compilation error.
2604
2605 2010-05-19  Rafael Espindola  <espindola@google.com>
2606
2607         * script-sections.cc (Output_section_definition::allocate_to_segment):
2608         Update the phdrs_list even when the output section is NULL.
2609         * testsuite/Makefile.am: Add test.
2610         * testsuite/Makefile.in: Regenerate.
2611         * testsuite/script_test_9.cc: New.
2612         * testsuite/script_test_9.sh: New.
2613         * testsuite/script_test_9.t: New.
2614
2615 2010-05-19  Doug Kwan  <dougkwan@google.com>
2616
2617         * arm.cc (Arm_input_section::original_size): New method.
2618         (Arm_input_section::do_addralign): Add a cast.
2619         (Arm_input_section::do_output_offset): Remove static cast.
2620         (Arm_input_section::original_addralign,
2621          Arm_input_section::original_size_): Change type to uint32_t.
2622         (Arm_input_section::init): Add safe casts for section alignment
2623         and size.
2624         (Arm_input_section::set_final_data_size): Do not set address and
2625         offset of stub table.
2626         (Arm_output_section::fix_exidx_coverage): Change use of of
2627         Output_section::Simple_input_section to that of
2628         Output_section::Input_section.
2629         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2630         except for the first pass.
2631         * output.cc (Output_section::get_input_sections): Change type of
2632         input_sections to std::list<Input_section>.
2633         (Output_section::add_script_input_section): Rename from
2634         Output_section::add_simple_input_section.  Change type of SIS
2635         parameter from Simple_input_section to Input_section.
2636         * output.h (Output_section::Simple_input_section): Remove class.
2637         (Output_section::Input_section): Change class visibility to public.
2638         (Output_section::Input_section::addralign): Use stored alignments
2639         for special input sections if set.
2640         (Output_section::Input_section::set_addralign): New method.
2641         (Output_section::get_input_sections): Change parameter type from
2642         list of Simple_input_section to list of Input_section.
2643         (Output_section::add_script_input_section): Rename from
2644         Output_section::add_simple_input_section. Change first parameter's
2645         type from Simple_input_section to Input_section and remove the
2646         second and third parameters.
2647         * script-sections.cc (Input_section::Input_section_list): Change
2648         type to list of Output_section::Input_section/
2649         (Input_section_info::Input_section_info): Change parameter type of
2650         INPUT_SECTION to Output_section::Input_section.
2651         (Input_section_info::input_section): Change return type.
2652         (Input_section_info::input_section_): Change type to
2653         Output_section::Input_section.
2654         (Output_section_element_input::set_section_addresses): Adjust code
2655         to use Output_section::Input_section instead of
2656         Output_section::Simple_input_section.  Adjust code for renaming
2657         of Output_section::add_simple_input_section.
2658         (Orphan_output_section::set_section_addresses): Ditto.
2659
2660 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2661
2662         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2663         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2664
2665 2010-05-18  Rafael Espindola  <espindola@google.com>
2666
2667         * options.cc (General_options::finalize): Handle -nostdlib.
2668         * options.h (nostdlib): New option.
2669         * script.cc (script_add_search_dir): Handle -nostdlib.
2670
2671 2010-05-12  Doug Kwan  <dougkwan@google.com>
2672
2673         * arm.cc (Target_arm::do_finalize_sections): Create an empty
2674         attributes section only if there no attributes section after merging.
2675         (Target_arm::merge_object_attributes): Move value of
2676         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2677         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2678         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2679         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2680         and arm_attr_merge_7.stdout.
2681         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2682         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2683         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2684         arm_attr_merge_7b.o): New rules.
2685         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2686         arm_attr_merge_7
2687         * testsuite/Makefile.in: Regenerate.
2688         * testsuite/arm_attr_merge.sh: New file.
2689         * testsuite/arm_attr_merge_[67][ab].s: Same.
2690
2691 2010-05-05  Nick Clifton  <nickc@redhat.com>
2692
2693         * po/es.po: Updated Spanish translation.
2694
2695 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2696
2697         * Makefile.am (install-exec-local): Properly install gold as
2698         default cross linker.
2699         * Makefile.in: Regenerated.
2700
2701 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2702             Nick Clifton  <nickc@redhat.com>
2703
2704         * configure.ac (install_as_default): Define and set to false
2705         unless --enable-gold or --enable-gold=both/gold has been
2706         specified.
2707         * configure: Regenerate.
2708
2709         * Makefile.am (install-exec-local): Install the executable as
2710         'ld.gold'.  If install_as_default is true then also install it as
2711         'ld'.
2712         * Makefile.in: Regenerated.
2713
2714 2010-04-24  Ian Lance Taylor  <iant@google.com>
2715
2716         * layout.cc (Layout::layout_reloc): In relocatable link don't
2717         combine reloc sections for grouped sections.
2718
2719 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
2720
2721         * gc.h (gc_process_relocs): Pass information on relocs pointing to
2722         sections that are not ordinary to icf.
2723         * icf.cc (get_section_contents): Handle relocation pointing to section
2724         with no object or shndx information.
2725         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2726         * testsuite/Makefile.in: Regenerate.
2727         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2728         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2729
2730 2010-04-22  Ian Lance Taylor  <iant@google.com>
2731
2732         * expression.cc (Expression::Expression_eval_info): Add
2733         result_alignment_pointer field.
2734         (Expression::eval_with_dot): Add result_alignment_pointer
2735         parameter.  Change all callers.
2736         (Expression::eval_maybe_dot): Likewise.
2737         (class Binary_expression): Add alignment_pointer parameter to
2738         left_value and right_value.  Change all callers.
2739         (BINARY_EXPRESSION): Set result alignment.
2740         (class Trinary_expression): Add alignment_pointer parameter to
2741         arg2_value and arg3_value.  Change all callers.
2742         (Trinary_cond::value): Set result alignment.
2743         (Max_expression::value, Min_expression::value): Likewise.
2744         (Align_expression::value): Likewise.
2745         * script-sections.cc (class Sections_element): Add dot_alignment
2746         parameter to set_section_addresses virtual function.  Update
2747         instantiations.
2748         (class Output_section_element): Likewise.
2749         (Script_sections::create_segments): Add dot_alignment parameter.
2750         Change all callers.
2751         (Script_sections::create_segments_from_phdrs_clause): Likewise.
2752         (Script_sections::set_phdrs_clause_addresses): Likewise.
2753         * script-sections.h: Update declarations.
2754         * script.h: Update declarations.
2755         * output.h (Output_segment::set_minimum_p_align): Don't decrease
2756         min_p_align.
2757         * testsuite/script_test_3.t: Set large alignment.
2758         * testsuite/script_test_3.sh: Make sure that at least one LOAD
2759         segment has expected alignment.
2760
2761 2010-04-22  Nick Clifton  <nickc@redhat.com>
2762
2763         * po/gold.pot: Updated by the Translation project.
2764         * po/vi.po: Updated Vietnamese translation.
2765
2766 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
2767
2768         * testsuite/Makefile.am (check_PROGRAMS): Add
2769         icf_virtual_function_folding_test.
2770         * testsuite/Makefile.in: Regenerated.
2771
2772 2010-04-15  Andrew Haley  <aph@redhat.com>
2773
2774         * options.h (merge_exidx_entries): New option.
2775         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2776         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2777         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2778         (Target_arm::merge_exidx_entries): New function.
2779         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2780         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2781         to Arm_exidx_fixup constructor.
2782         Add new arg, merge_exidx_entries.
2783         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2784         Arm_output_section::fix_exidx_coverage.
2785
2786 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
2787
2788         * icf.cc (get_section_contents): Check for preemptible functions.
2789         Ignore addend when appropriate.
2790         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
2791         section folded.
2792         (add_from_relobj): Check for section folded.
2793         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2794         * symtab.h (should_add_dynsym_entry): Add new parameter.
2795         * target-reloc.h (scan_relocs): Check for section folded.
2796         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2797         Check reloc types for function pointers in shared objects.
2798         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2799         case.
2800         (icf_preemptible_functions_test): New test case.
2801         (icf_string_merge_test): New test case.
2802         * testsuite.Makefile.in: Regenerate.
2803         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2804         bar_glob.  Refactor code.
2805         * testsuite/icf_preemptible_functions_test.cc: New file.
2806         * testsuite/icf_preemptible_functions_test.sh: New file.
2807         * testsuite/icf_string_merge_test.cc: New file.
2808         * testsuite/icf_string_merge_test.sh: New file.
2809         * testsuite/icf_virtual_function_folding_test.cc: New file.
2810         * testsuite/icf_virtual_function_folding_test.sh: New file.
2811
2812 2010-04-14  Doug Kwan  <dougkwan@google.com>
2813
2814         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2815         for local symbol recounting if we remove a section due to ICF.
2816         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2817         there are no regular objects in input.
2818
2819 2010-04-13  Doug Kwan  <dougkwan@google.com>
2820
2821         * arm.cc (Arm_input_section::set_final_data_size): Compute
2822         accurate final data size instead of using current data size.
2823
2824 2010-04-09  Doug Kwan  <dougkwan@google.com>
2825
2826         * layout.cc (Layout::choose_output_section): Handle script section
2827         types.
2828         (Layout::make_output_section_for_script): Add section type parameter.
2829         Handle script section types.
2830         * layout.h (Layout::make_output_section_for_script): Add section
2831         type parameter.
2832         * output.cc (Output_section::Output_section): Initialize data member
2833         is_noload_.
2834         (Output_section::do_reset_address_and_file_offset): Do not set address
2835         to 0 if section is a NOLOAD section.
2836         * output.h (Output_section::is_noload): New method.
2837         (Output_section::set_is_noload): Ditto.
2838         (Output_section::is_noload_): New data member.
2839         * script-c.h (Script_section_type): New enum type.
2840         (struct Parser_output_section_header): Add new file section_type.
2841         * script-sections.cc (Sections_element::output_section_name): Add
2842         parameter for returning script section type.
2843         (Output_section_definition::output_section_name): Ditto.
2844         (Output_section_definition::section_type)P; New method.
2845         (Output_section_definiton::script_section_type_name): Ditto.
2846         (Output_section_definition::script_section_type_): New data member.
2847         (Output_section_definition::Output_section_definition): Initialize
2848         data member Output_section_definition::script_section_type_.
2849         (Output_section_definition::create_sections): Pass script section type
2850         to Layout::make_output_section_for_script.
2851         (Output_section_definition::output_section_name): Return script
2852         section type to caller.
2853         (Output_section_definition::set_section_address): Do not advance
2854         dot value and load address if section type is NOLOAD.  Set address
2855         of NOLOAD sections regardless of section flags.
2856         (Output_section_definition::print): Print section type if it is
2857         not SCRIPT_SECTION_TYPE_NONE.
2858         (Output_section_definition::section_type): New method.
2859         (Output_section_definition::script_section_type_name): Ditto.
2860         (Script_sections::output_section_name): Add new parameter
2861         PSECTION_TYPE for returning script section type.  Pass it to
2862         section elements.  Handle discard sections.
2863         (Sort_output_sections::operator()): Handle NOLOAD sections.
2864         * script-sections.h (Script_sections::Section_type): New enum type.
2865         (Script_sections::output_section_name): Add a new parameter for
2866         returning script section type.
2867         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2868         INFO and NOLOAD.
2869         * yyscript.y (union): Add new field SECTION_TYPE.
2870         (COPY, DSECT, INFO, NOLOAD): New tokens.
2871         (opt_address_and_section_type): Change type to output_section_header.
2872         (section_type): New non-terminal
2873         (section_header): Handle section type.
2874         (opt_address_and_section_type): Return section type value.
2875
2876 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
2877
2878         * testsuite/plugin_common_test_1.c (foo): Add prototype.
2879         * testsuite/plugin_common_test_2.c (foo): Likewise.
2880
2881 2010-04-08  Doug Kwan  <dougkwan@google.com>
2882
2883         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2884         Output_merge_data.
2885         * output.cc (Output_section::add_merge_input_section): Simplify
2886         code and return status of Output_merge_base::add_input_section.
2887         Update merge section map only if Output_merge_base::add_input_section
2888         returns true.
2889
2890 2010-04-07  Doug Kwan  <dougkwan@google.com>
2891
2892         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2893         if section is marked as containing instructions but has no mapping
2894         symbols.
2895         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2896         correct section index.
2897         (Arm_relobj::find_linked_text_section): Ditto.
2898
2899 2010-04-07  Cary Coutant  <ccoutant@google.com>
2900
2901         * archive.cc (include_member): Destroy Read_symbols_data object before
2902         releasing file.
2903         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2904         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2905         (Read_symbols_data::~Read_symbols_data) New destructor.
2906         (Section_relocs::Section_relocs) New constructor.
2907         (Section_relocs::~Section_relocs) New destructor.
2908         (Read_relocs_data::Read_relocs_data) New constructor.
2909         (Read_relocs_data::~Read_relocs_data) New destructor.
2910         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2911         pointers to NULL after deleting.
2912
2913 2010-04-07  Doug Kwan  <dougkwan@google.com>
2914
2915         * arm.cc: Replace "endianity" with "endianness" in comments.
2916         (Arm_exidx_cantunwind): Ditto.
2917         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2918         (Arm_relobj::merge_flags_and_attributes): New method.
2919         (Arm_relobj::merge_flags_and_attributes_): New data member.
2920         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2921         (Arm_relobj::scan_sections_for_stubs): Ditto.
2922         (Arm_relobj::do_read_symbols): Check to see if we really want to
2923         merge processor-specific flags and attributes.  Exit early if
2924         an object is empty except for section names and the undefined symbol.
2925         (Target_arm::do_finalize_sections): Move check for ELF format to
2926         Arm_relobj::do_read_symbols.  Merge processor specific flags and
2927         attributes from a regular object only when we have determined that
2928         it is aapropriate.  Do not create an .ARM.attributes section in
2929         output if there is no regular input object.
2930         (Target_arm::merge_processor_specific_flags): Check
2931         --warn-mismatch before printing any error.
2932         (Target_arm::merge_object_attributes): Ditto.
2933         * gold.cc (queue_middle_tasks): Handle the case in which there is
2934         no regular object in input.
2935         * options.cc (General_options::parse_EB): New method.
2936         (General_options::parse_EL): Same.
2937         (General_options::General_options): Initialize endianness_.
2938         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2939         New options.
2940         (General_options::Endianness): New enum.
2941         (General_options::endianness): New method.
2942         (General_options::endianness_): New data member.
2943         * parameters.cc (Parameters::set_options): Check target endianness.
2944         (Parameters::set_target_once): Ditto.
2945         (Parameters::check_target_endianness): New method.
2946         (parameters_force_valid_target): If either -EL or -EB is specified,
2947         use it to define endianness of default target.
2948         * parameters.h (Parameters::check_target_endianness): New method
2949         declaration.
2950         * target.h (class Target): Change "endianity" to "endianness"
2951         in comments.
2952
2953 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2954
2955         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2956         * configure: Regenerate.
2957         * Makefile.in: Regenerate.
2958         * testsuite/Makefile.in: Regenerate.
2959
2960 2010-04-06  Cary Coutant  <ccoutant@google.com>
2961
2962         gcc PR lto/42757
2963         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2964         prevailing definitions of common symbols.
2965         * testsuite/plugin_test_6.sh: New test case.
2966         * testsuite/plugin_common_test_1.c: New test case.
2967         * testsuite/plugin_common_test_2.c: New test case.
2968         * testsuite/Makefile.am (plugin_test_6): New test case.
2969         * testsuite/Makefile.in: Regenerate.
2970
2971 2010-04-06  Nick Clifton  <nickc@redhat.com>
2972
2973         * po/vi.po: New Vietnamese translation.
2974
2975 2010-03-30  Doug Kwan  <dougkwan@google.com>
2976
2977         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2978
2979 2010-03-25  Doug Kwan  <dougkwan@google.com>
2980
2981         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2982         to avoid a conversion warning on a 32-bit host.
2983
2984 2010-03-24  Ian Lance Taylor  <iant@google.com>
2985
2986         * testsuite/script_test_3.t: Add a TLS segment.
2987         * testsuite/Makefile.am (check_PROGRAMS): Add
2988         tls_phdrs_script_test.
2989         (tls_phdrs_script_test_SOURCES): Define.
2990         (tls_phdrs_script_test_DEPENDENCIES): Define.
2991         (tls_phdrs_script_test_LDFLAGS): Define.
2992         (tls_phdrs_script_test_LDADD): Define.
2993         * testsuite/Makefile.in: Rebuild.
2994
2995 2010-03-23  Cary Coutant  <ccoutant@google.com>
2996
2997         * fileread.cc (find_or_make_view): Fix comment.
2998
2999 2010-03-23  Ian Lance Taylor  <iant@google.com>
3000
3001         * script-sections.cc (class Orphan_section_placement): Define
3002         PLACE_TLS and PLACE_TLS_BSS.
3003         (Orphan_section_placement::Orphan_section_placement): Initialize
3004         new places.
3005         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3006         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3007         (tls_script_test_SOURCES): Define.
3008         (tls_script_test_DEPENDENCIES): Define.
3009         (tls_script_test_LDFLAGS): Define.
3010         (tls_script_test_LDADD): Define.
3011         * testsuite/Makefile.in: Rebuild.
3012
3013 2010-03-22  Doug Kwan  <dougkwan@google.com>
3014
3015         * arm.cc (Arm_relocate_functions::abs8,
3016         Arm_relocate_functions::abs16): Use correct check for overflow
3017         specified in the ARM ELF specs.
3018         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
3019         target of a BLX instruction specially.
3020         (Reloc_stub::stub_type_for_reloc): Ditto.
3021         (Relocate::relocate): Use symbolic names instead of numeric relocation
3022         codes to report error.
3023         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3024         workaround.
3025         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3026         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3027         thumb2_blx_out_of_range.stdout
3028         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3029         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3030         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3031         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3032         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3033         thumb2_blx_in_range, thumb2_blx_in_range.o,
3034         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3035         thumb2_blx_out_of_range.o): New rules.
3036         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3037         thumb2_blx_in_range and thumb2_blx_out_of_range.
3038         * testsuite/Makefile.in: Regenerate.
3039         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3040         * testsuite/thumb_blx_in_range.s: New file.
3041         * testsuite/thumb_blx_out_of_range.s: New file.
3042
3043 2010-03-22  Rafael Espindola  <espindola@google.com>
3044
3045         * archive.cc (Should_include): Move to archive.h.
3046         (should_include_member): Make it a member of Archive.
3047         (Lib_group): New.
3048         (Add_lib_group_symbols): New.
3049         * archive.h: Include options.h.
3050         (Archive_member): Moved from Archive.
3051         (Should_include): Moved from archive.cc.
3052         (Lib_group): New.
3053         (Add_lib_group_symbols): New.
3054         * dynobj.cc (do_should_include_member): New.
3055         * dynobj.h (do_should_include_member): New.
3056         * gold.cc (queue_initial_tasks): Update call to queue.
3057         * main.cc (main): Print lib group stats.
3058         * object.cc (do_should_include_member): New.
3059         * object.h: Include archive.h.
3060         (Object::should_include_member): New.
3061         (Object::do_should_include_member): New.
3062         (Sized_relobj::do_should_include_member): New.
3063         * options.cc (General_options::parse_start_lib): New.
3064         (General_options::parse_end_lib): New.
3065         (Input_arguments::add_file): Handle lib groups.
3066         (Input_arguments::start_group): Check we are not in a lib.
3067         (Input_arguments::start_lib): New.
3068         (Input_arguments::end_lib): New.
3069         * options.h (General_options): Add start_lib and end_lib.
3070         (Input_argument::lib_): New.
3071         (Input_argument::lib): New.
3072         (Input_argument::is_lib): New.
3073         (Input_file_lib): New.
3074         (Input_arguments::in_lib_): New.
3075         (Input_arguments::in_lib): New.
3076         (Input_arguments::start_lib): New.
3077         (Input_arguments::end_lib_): New.
3078         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3079         in unused members as preempted.
3080         (Sized_pluginobj::do_should_include_member): New.
3081         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3082         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3083         return the blocker.
3084         (Read_symbols::do_whole_lib_group): New.
3085         (Read_symbols::do_lib_group): New.
3086         (Read_symbols::do_read_symbols): Handle lib groups.
3087         (Read_symbols::get_name): Handle lib groups.
3088         * readsyms.h (Read_symbols): Add an archive member pointer.
3089         (Read_symbols::do_whole_lib_group): New.
3090         (Read_symbols::do_lib_group): New.
3091         (Read_symbols::member_): New.
3092         * script.cc (read_input_script): Update call to queue_soon.
3093
3094 2010-03-19  Doug Kwan  <dougkwan@google.com>
3095
3096         * arm.cc (Stub_table::Stub_table): Initialize new data members
3097         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3098         (Stub_table::add_reloc_stub): Assign stub offset and update
3099         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3100         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3101         New data members.
3102         (Stub_table::update_data_size_and_addralign): Use
3103         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3104         instead of going over all reloc stubs.
3105         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3106         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3107         Stringpool_template::offset_ to size of Stringpool_char.
3108         (Stringpool_template::new_key_offset): Remove code to initialize
3109         Stringpool_template::offset_.
3110         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3111         Stringpool_template::offset_ to zero.
3112
3113 2010-03-15  Doug Kwan  <dougkwan@google.com>
3114
3115         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3116         offset_.
3117         (Stringpool_template::new_key_offset): New method.
3118         (Stringpool_template::add_string): Assign offsets when adding new
3119         strings.
3120         (Stringpool_template::set_string_offsets): Do not set string offsets
3121         when not optimizing.
3122         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3123         member size_.
3124         (Chunked_vector::clear): Clear size_.
3125         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3126         (Chunked_vector::size): Return size_.
3127         (Chunked_vector::push_back): Use size_ to find insert position.
3128         (Chunked_vector::size_): New data member.
3129         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3130         (Stringpool_template::new_key_offset): New method declaration.
3131         (Stringpool_template::offset_): New data member.
3132
3133 2010-03-15   Rafael Espindola  <espindola@google.com>
3134
3135         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3136         Add_symbols' constructor.
3137         * readsyms.h (Add_symbols): Remove the input_group member.
3138
3139 2010-03-10  Ian Lance Taylor  <iant@google.com>
3140
3141         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3142         target to ask whether a reference to a symbol requires a stack
3143         split.
3144         * target.h (Target::is_call_to_non_split): New function.
3145         (Target::do_is_call_to_non_split): Declare virtual function.
3146         * target.cc: Include "symtab.h".
3147         (Target::do_is_call_to_non_split): New function.
3148         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3149
3150 2010-03-10  Cary Coutant  <ccoutant@google.com>
3151
3152         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3153         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3154         (File_read::open[2]): Add whole_file_view_ to list of views.
3155         (File_read::make_view): Remove test of whole_file_view_.
3156         (File_read::find_or_make_view): Create whole_file_view_ if
3157         necessary.
3158         (File_read::clear_views): Replace bool parameter with enum;
3159         adjust all callers.  Don't delete views with permanent data;
3160         do delete cached views and views from archives if
3161         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3162         if clearing the corresponding view.
3163         * fileread.h (File_read::Clear_views_mode): New enum.
3164         (File_read::View::is_permanent_view): New method.
3165         (File_read::clear_views): Replace bool parameter
3166         with enum; adjust all callers.
3167         * options.h (General_options): Change keep_files_mapped option;
3168         add map_whole_files.
3169         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3170         releasing the file.
3171         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3172         the file.
3173
3174 2010-03-10  David S. Miller  <davem@davemloft.net>
3175
3176         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3177
3178 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3179
3180         * icf.cc (get_section_contents): Add '@' marker after processing the
3181         merge reloc.
3182
3183 2010-03-08  Doug Kwan  <dougkwan@google.com>
3184
3185         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3186         due to a conversion warning.
3187         (Arm_relobj::update_output_local_symbol_count): Check for local
3188         symbol with unset output index.
3189
3190 2010-03-05  Ian Lance Taylor  <iant@google.com>
3191
3192         * options.h (class General_options): Add --spare-dynamic-tags.
3193         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3194         --spare-dynamic-tags.
3195
3196 2010-03-05  Ian Lance Taylor  <iant@google.com>
3197
3198         * incremental.cc: Include "libiberty.h".
3199
3200 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3201
3202         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3203         function, is_info_ member.
3204         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3205         (Versions::Versions): Update caller.
3206         (Versions::define_base_version): Likewise.
3207         (Versions::add_def): Likewise.
3208
3209 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3210
3211         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3212         (Scan::possible_function_pointer_reloc): New function.
3213         (Scan::local_reloc_may_be_function_pointer): Change to call
3214         possible_function_pointer_reloc.
3215         (Scan::global_reloc_may_be_function_pointer): Ditto.
3216         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3217         relocations in ".data.rel.ro._ZTV" section.
3218         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3219         * testsuite/icf_safe_so_test.cc: Ditto.
3220         * testsuite/icf_safe_test.cc: Ditto.
3221         * testsuite/icf_safe_test.sh: Ditto.
3222
3223 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3224             Ian Lance Taylor  <iant@google.com>
3225
3226         * target-reloc.h (relocate_section): Check the symbol table index
3227         for -1U before setting the local symbol index.
3228         (scan_relocatable_relocs): If copying the relocation, record that
3229         the local symbol is required.
3230         * object.h (Symbol_value::is_output_symtab_index_set): New
3231         function.
3232         (Symbol_value::may_be_discarded_from_output_symtab): New
3233         function.
3234         (Symbol_value::has_output_symtab_entry): New function.
3235         (Symbol_value::needs_output_symtab_entry): Remove.
3236         (Symbol_value::output_symtab_index): Make sure the symbol index is
3237         set.
3238         (Symbol_value::set_output_symtab_index): Make sure the symbol
3239         index is not set.  Make sure the new index is valid.
3240         (Symbol_value::set_must_have_output_symtab_entry): New function.
3241         (Symbol_value::has_output_dynsym_entry): New function.
3242         (Symbol_value::set_output_dynsym_index): Make sure the new index
3243         is valid.
3244         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3245         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3246         local symbol if permitted.
3247         (Sized_relobj::do_finalize_local_symbols): Call
3248         is_output_symtab_index_set rather than needs_output_symtab_entry.
3249         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3250         rather than needs_output_symtab_entry.  Call
3251         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3252         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3253         is_output_symtab_index_set rather than needs_output_symtab_entry.
3254         * testsuite/discard_locals_relocatable_test.c: New file.
3255         * testsuite/discard_locals_test.sh: Test -r.
3256         * testsuite/Makefile.am (check_DATA): Add
3257         discard_locals_relocatable_test1.syms,
3258         discard_local_relocatable_test2.syms.
3259         (MOSTLYCLEANFILES): Likewise.  Also add
3260         discard_locals_relocatable_test1.lout and
3261         discard_locals_relocatable_test2.out.
3262         (discard_locals_relocatable_test1.syms): New target.
3263         (discard_locals_relocatable_test.o): New target.
3264         (discard_locals_relocatable_test1.out): New target.
3265         (discard_locals_relocatable_test2.syms): New target.
3266         (discard_locals_relocatable_test2.out): New target.
3267         (various): Add missing ../ld-new dependencies.
3268         * testsuite/Makefile.in: Rebuild.
3269
3270 2010-03-03  Nick Clifton  <nickc@redhat.com>
3271
3272         * po/fi.po: New Finnish translation.
3273
3274 2010-03-01  Doug Kwan  <dougkwan@google.com>
3275
3276         * layout.cc (Layout::Layout): Force section types of .init_array*,
3277         .preinit_array* and .fini_array* sections.
3278         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3279         Fix check of return value of std::string::find.().
3280         (Output_section::Input_section_sort_compare::operator()): Remove
3281         comment about .init_array.
3282         (Output_section::Input_section_sort_init_fini_compare::operator()):
3283         New method.
3284         (Output_section::sort_attached_input_sections): Handle .init_array
3285         and .fini_array specially.
3286         * output.h (Output_section::Inut_section_sort_compare): Update
3287         comment.
3288         (Output_section::Input_section_sort_init_fini_compare): New struct.
3289
3290 2010-02-26  Doug Kwan  <dougkwan@google.com>
3291
3292         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3293         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3294         * testsuite/debug_msg.sh: Avoid matching source line number for
3295         use of global variable undef_int.
3296
3297 2010-02-26  Doug Kwan  <dougkwan@google.com>
3298
3299         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3300         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3301         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3302         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3303         * options.cc (General_options::General_options): Initialize member
3304         fix_v4bx_.
3305         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3306         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3307         and rm_no_fix_v4bx.stdout
3308         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3309         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3310         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3311         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3312         and arm_no_fix_v4bx.
3313         * Makefile.in: Regenerate.
3314         * testsuite/arm_fix_v4bx.s: New file.
3315         * testsuite/arm_fix_v4bx.sh: Ditto.
3316
3317 2010-02-24  Doug Kwan  <dougkwan@google.com>
3318
3319         * arm.cc (Target_arm::got_section): Make the .got section the first
3320         non RELRO section in the data segment.
3321         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3322         suffixes of section names.
3323
3324 2010-02-24  Doug Kwan  <dougkwan@google.com>
3325
3326         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3327         flags and attributes merging if an input file is a binary file.
3328         * fileread.cc (Input_file::open): Record format of original file.
3329         * fileread.h (Input_file::Format): New enum type.
3330         (Input_file::Input_file): Initialize data member format_.
3331         (Input_file::format): New method definition.
3332         (Input_file::format_):: New data member.
3333
3334 2010-02-24  Doug Kwan  <dougkwan@google.com>
3335
3336         * arm.cc (Arm_output_data_got): New class.
3337         (ARM_TCB_SIZE): New constant
3338         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3339         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3340         If user uses a script with a SECTIONS clause, issue only a warning
3341         for a misplaced EXIDX input section.  Otherwise, issue an error.
3342         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3343         garbage collection.
3344         (Target_arm::got_mode_index_entry): Handle static linking.
3345         (Target_arm::Scan::local): Ditto.
3346         (Target_arm::Scan::global): Ditto.
3347         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3348         all incorrectly implemented relocations.
3349         (Target_arm::fix_exidx_coverage): Pass layout to
3350         Arm_output_section::fix_exidx_coverage.
3351         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3352         from ".ARM.exidx." and ".ARM.extab.".
3353
3354 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3355
3356         * arm.cc (Target_arm::do_finalize_sections): Create attribute
3357         section if it does not already exist.
3358         * attributes.cc (Attributes_section_data::Attributes_section_data):
3359         Don't crash if size is zero.
3360
3361 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3362             Ian Lance Taylor  <iant@google.com>
3363
3364         * gold.cc (queue_middle_tasks): If no input files were opened,
3365         exit.
3366         * workqueue.h (Task_function::Task_function): Assert that there is
3367         a blocker.
3368
3369 2010-02-22  Doug Kwan  <dougkwan@google.com>
3370
3371         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3372         * icf.cc (get_section_contents): Cast snprintf arguments to long long
3373         types to avoid warnings due to different uint64_t implementations
3374         on different hosts.
3375
3376 2010-02-21  Doug Kwan  <dougkwan@google.com>
3377
3378         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3379         handling of the maximum backward branch offset.
3380         (Arm_relocate_functions::thumb_branch_common): Ditto.
3381         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3382         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3383         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3384         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3385         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3386         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3387         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3388         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3389         thumb_bl_out_of_range thumb_bl_out_of_range.o,
3390         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3391         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3392         thumb2_bl_out_of_range.o): New rules.
3393         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3394         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3395         thumb2_bl_out_of_range
3396         * testsuite/Makefile.in: Regenerate.
3397         * testsuite/arm_bl_in_range.s: New file.
3398         * testsuite/arm_bl_out_of_range.s: Ditto.
3399         * testsuite/arm_branch_in_range.sh: Ditto.
3400         * testsuite/arm_branch_range.t: Ditto.
3401         * testsuite/thumb2_branch_range.t: Ditto.
3402         * testsuite/thumb_bl_in_range.s: Ditto.
3403         * testsuite/thumb_bl_out_of_range.s: Ditto.
3404         * testsuite/thumb_branch_range.t: Ditto.
3405
3406 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
3407
3408         * gc.h (gc_process_relocs): Change vectors to point to the new list.
3409         Add reloc offset information.
3410         * icf.cc (get_section_contents): Change iterators to point to the new
3411         vectors. Add reloc offset information to the contents.
3412         * icf.h (Icf::Sections_reachable_info): New typedef.
3413         (Icf::Sections_reachable_list): New typedef.
3414         (Icf::Offset_info): New typedef.
3415         (Icf::Reloc_info): New struct typedef.
3416         (Icf::Reloc_info_list): New typedef.
3417         (Icf::symbol_reloc_list): Delete method.
3418         (Icf::addend_reloc_list): Delete method.
3419         (Icf::section_reloc_list): Delete method.
3420         (Icf::reloc_info_list): New method.
3421         (Icf::reloc_info_list_): New member.
3422
3423 2010-02-19  Doug Kwan  <dougkwan@google.com>
3424
3425         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3426         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3427         * arm.cc (Arm_relocation_functions): New forward declaration.
3428         (Target_arm::Target_arm): Initialize new data members
3429         got_mod_index_offset_ and tls_base_symbol_defined_.
3430         (Target_arm::Relocate::relocate_tls): New method.
3431         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3432          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3433         New methods.
3434         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3435         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3436         (Target_arm::got_mod_index_offset_,
3437         Target_arm::tls_base_symbol_defined_): New data members.
3438         (Target_arm::Scan::local, Target::Scan::global,
3439         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3440         relocations.
3441
3442 2010-02-18  Doug Kwan  <dougkwan@google.com>
3443
3444         * arm.cc (Arm_relobj::find_linked_text_section): New method.
3445         (Arm_relobj::make_exidx_input_section): Pass section index of linked
3446         text section as a parameter becuase some broken tools may not set
3447         the link in section header.
3448         (Target_arm::has_got_section): New method.
3449         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3450         without any mapping symbol as data only.  Remove warning.
3451         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3452         link in its section header, try to discover the link by inspecting the
3453         REL31 relocation at the beginning of the section.
3454         (Target_arm::Scan::check_non_pic): Report name of offending relocation
3455         in error message.
3456         (Target_arm::Scan::global): Treat any reference to the symbol
3457         _GLOBAL_OFFSET_TABLE_ as a GOT access.
3458
3459 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
3460
3461         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3462         (Scan::global_reloc_may_be_function_pointer): New function.
3463         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3464         (Scan::global_reloc_may_be_function_pointer): New function.
3465         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3466         (Scan::global_reloc_may_be_function_pointer): New function.
3467         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3468         (Scan::global_reloc_may_be_function_pointer): New function.
3469         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3470         (Scan::global_reloc_may_be_function_pointer): New function.
3471         (Scan::possible_function_pointer_reloc): New function.
3472         (Target_x86_64::can_check_for_function_pointers): New function.
3473         * gc.h (gc_process_relocs): Scan relocation types to determine if
3474         function pointers were taken for targets that support it.
3475         * icf.cc (Icf::find_identical_sections): Include functions for
3476         folding in safe ICF whose pointer is not taken.
3477         * icf.h (Secn_fptr_taken_set): New typedef.
3478         (fptr_section_id_): New member.
3479         (section_has_function_pointers): New function.
3480         (set_section_has_function_pointers): New function.
3481         (check_section_for_function_pointers): New function.
3482         * options.h: Fix comment for safe ICF option.
3483         * target.h (can_check_for_function_pointers): New function.
3484         * testsuite/Makefile.am: Add icf_safe_so_test test case.
3485         Modify icf_safe_test for X86-64.
3486         * testsuite/Makefile.in: Regenerate.
3487         * testsuite/icf_safe_so_test.cc: New file.
3488         * testsuite/icf_safe_so_test.sh: New file.
3489         * testsuite/icf_safe_test.cc (kept_func_3): New function.
3490         (main): Change to take pointer to function kept_func_3.
3491         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3492         folding is done correctly for X86-64.
3493
3494 2010-02-12  David S. Miller  <davem@davemloft.net>
3495
3496         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3497         is_symbolless parameter.
3498         (Output_reloc<SHT_REL>::is_symbolless): New.
3499         (Output_reloc<SHT_REL>::is_symbolless_): New.
3500         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3501         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3502         (Output_reloc<SHT_RELA>::is_symbolless): New.
3503         (Output_data_reloc::add_global): Handle is_symbolless.
3504         (Output_data_reloc::add_global_relative): Likewise.
3505         (Output_data_reloc::add_local): Likewise.
3506         (Output_data_reloc::add_local_relative): Likewise.
3507         (Output_data_reloc::add_symbolless_global_addend): New.
3508         (Output_data_reloc::add_symbolless_local_addend): New.
3509         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3510         is_symbolless.
3511         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3512         instead of ->is_relative_
3513         (Output_reloc::write): Likewise.
3514         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3515         (Output_reloc::write_rel): Simplify.
3516
3517         * sparc.cc (Target_sparc::Scan::local): Use
3518         ->add_symbolless_local_addend as needed.
3519         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3520         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
3521         based upon relocation offset.
3522
3523 2010-02-11  Doug Kwan  <dougkwan@google.com>
3524
3525         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3526         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
3527         beginning of function.
3528         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3529         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
3530         parameter is_32bit in calls to should_apply_static_reloc.
3531         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3532         (check_DATA): Add arm_abs_global.stdout.
3533         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3534         arm_abs_global.stdout): New rules.
3535         (MOSTLLYCLEANFILES): Add arm_abs_global
3536         * Makefile.in: Regenerate.
3537         * testsuite/arm_abs_global.s: New file.
3538         * testsuite/arm_abs_global.sh: Ditto.
3539         * testsuite/arm_abs_lib.s: Ditto.
3540
3541 2010-02-11  Ian Lance Taylor  <iant@google.com>
3542
3543         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3544         Read_relocs task.
3545         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
3546         Allocate_commons_task first.
3547         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3548         task, rather than symtab_lock_.
3549         (Gc_process_relocs::~Gc_process_relocs): New function.
3550         (Gc_process_relocs::is_runnable): Check this_blocker_.
3551         (Gc_process_relocs::locks): Use next_blocker_ rather than
3552         blocker_.
3553         (Scan_relocs::~Scan_relocs): New function.
3554         (Scan_relocs::is_runnable): Check this_blocker_ rather than
3555         symtab_lock_.
3556         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
3557         next_blocker_.
3558         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3559         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
3560         constructor accordingly.
3561         (class Gc_process_relocs): Likewise.
3562         (class Scan_relocs): Likewise.
3563         * common.h (class Allocate_commons_task): Remove symtab_lock_
3564         field, and corresponding constructor parameter.
3565         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3566         symtab_lock_.
3567         (Allocate_commons_task::locks): Likewise.
3568
3569 2010-02-11  Ian Lance Taylor  <iant@google.com>
3570
3571         * gold-threads.h (class Once): Define.
3572         (class Initialize_lock): Rewrite as child of Once.
3573         * gold-threads.cc (class Once_initialize): Define.
3574         (once_pointer_control): New static variable.
3575         (once_pointer, once_arg): New static variables.
3576         (c_run_once): New static function.
3577         (Once::Once, Once::run_once, Once::internal_run): New functions.
3578         (class Initialize_lock_once): Remove.
3579         (initialize_lock_control): Remove.
3580         (initialize_lock_pointer): Remove.
3581         (initialize_lock_once): Remove.
3582         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3583         (Initialize_lock::initialize): Rewrite.
3584         (Initialize_lock::do_run_once): New function.
3585         * archive.cc (Archive::interpret_header): Only clear name if it is
3586         not already empty.
3587         * fileread.cc: Include "gold-threads.h"
3588         (file_counts_lock): New static variable.
3589         (file_counts_initialize_lock): Likewise.
3590         (File_read::release): Only increment counts when using --stats.
3591         Use a lock around the increment.
3592         * parameters.cc (class Set_parameters_target_once): Define.
3593         (set_parameters_target_once): New static variable.
3594         (Parameters::Parameters): Move here from parameters.h.
3595         (Parameters::set_target): Rewrite.
3596         (Parameters::set_target_once): New function.
3597         (Parameters::clear_target): Move here and rewrite.
3598         * parameters.h (class Parameters): Update declarations.  Add
3599         set_parameters_target_once_ field.
3600         (Parameters::Parameters): Move to parameters.cc.
3601         (Parameters::clear_target): Likewise.
3602         * readsyms.cc (Read_symbols::do_group): Create a Start_group
3603         task.
3604         (Start_group::~Start_group): New function.
3605         (Start_group::is_runnable): New function.
3606         (Start_group::locks, Start_group::run): New functions.
3607         (Finish_group::run): Change saw_undefined to size_t.
3608         * readsyms.h (class Start_group): Define.
3609         (class Finish_group): Change saw_undefined_ field to size_t.
3610         (Finish_group::Finish_group): Remove saw_undefined and
3611         this_blocker parameters.  Change all callers.
3612         (Finish_group::set_saw_undefined): New function.
3613         (Finish_group::set_blocker): New function.
3614         * symtab.h (class Symbol_table): Change saw_undefined to return
3615         size_t.  Change saw_undefined_ field to size_t.
3616         * target-select.cc (Set_target_once::do_run_once): New function.
3617         (Target_selector::Target_selector): Initialize set_target_once_
3618         field.  Don't initialize lock_ and initialize_lock_ fields.
3619         (Target_selector::instantiate_target): Rewrite.
3620         (Target_selector::set_target): New function.
3621         * target-select.h (class Set_target_once): Define.
3622         (class Target_selector): Update declarations.  Make
3623         Set_target_once a friend.  Remove lock_ and initialize_lock_
3624         fields.  Add set_target_once_ field.
3625
3626 2010-02-10  Ian Lance Taylor  <iant@google.com>
3627
3628         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3629         queueing any tasks.
3630         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
3631         (queue_middle_tasks): Add all blockers before queueing any tasks.
3632         (queue_final_tasks): Likewise.
3633         * token.h (Task_token::add_blockers): New function.
3634         * object.h (Input_objects::number_of_relobjs): New function.
3635
3636 2010-02-10  Ian Lance Taylor  <iant@google.com>
3637
3638         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3639         shared, not if not position independent.
3640         * x86_64.cc (Relocate::relocate_tls): Likewise.
3641         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3642         (tls_pie_pic_test): New target.
3643         * testsuite/Makefile.in: Rebuild.
3644
3645         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3646         (tls_test_main_pie.o, tls_test_pie.o): New targets.
3647         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3648         * testsuite/Makefile.in: Rebuild.
3649
3650 2010-02-09  David S. Miller  <davem@davemloft.net>
3651
3652         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3653         R_SPARC_RELATIVE using ->add_local_relative().
3654         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3655
3656         * output.h (Output_data_dynamic::add_section_size): New method
3657         that takes two Output_data objects.
3658         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3659         entry param.  Handle it in initializers.
3660         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3661         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3662         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3663         arg.
3664         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3665         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3666         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3667         for dynrel_includes_plt.
3668         * i386.cc (Target_i386::do_finalize_sections): Likewise.
3669         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3670         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3671         before .rela.plt
3672         (Target_sparc::do_finalize_sections): Update to pass true for
3673         dynrel_includes_plt.
3674         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3675         output before .rela.plt
3676         (Target_powerpc::do_finalize_sections): Update to pass true for
3677         dynrel_includes_plt when 32-bit.
3678
3679 2010-02-08  Doug Kwan  <dougkwan@google.com>
3680
3681         * arm.cc (Arm_relobj::simple_input_section_output_address): New
3682         method.
3683         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3684         Arm_relobj::scan_section_for_cortex_a8_stubs,
3685         Arm_relobj::do_relocation_section): Instead of calling
3686         Output_section::output_address, use faster
3687         Arm_relobj::simple_input_section_output_address.
3688
3689 2010-02-08  David S. Miller  <davem@davemloft.net>
3690
3691         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3692         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3693         relocation helper function.
3694
3695         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3696         just like R_SPARC_GOT{10,13,22}.
3697         (Target_sparc::Scan::local): Likewise.
3698         (Target_sparc::Relocate:relocate): Likewise.
3699
3700 2010-02-06  Ian Lance Taylor  <iant@google.com>
3701
3702         * configure.ac: Rewrite targetobjs duplicate removal code to use
3703         only shell constructs.
3704         * configure: Rebuild.
3705
3706 2010-02-05  Doug Kwan  <dougkwan@google.com>
3707
3708         PR 11247
3709         * arm.cc (Arm_relobj::section_is_scannable): New method.
3710         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3711         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3712
3713 2010-02-04  Doug Kwan  <dougkwan@google.com>
3714
3715         PR 11247
3716         * arm-reloc-property.cc (cstdio): Include.
3717         * configure.ac (targetobjs): Remove duplicates.
3718         * configure: Regenerate.
3719         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3720         big and little endian version for a given address size.
3721
3722 2010-02-03  Doug Kwan  <dougkwan@google.com>
3723
3724         * arm-reloc-property.cc
3725         (Arm_reloc_property_table::reloc_name_in_error_message): New method
3726         definition.
3727         * arm-reloc-property.h
3728         (Arm_reloc_property_table::get_implemented_static_reloc_property):
3729         New method definition.
3730         (Arm_reloc_property_table::reloc_name_in_error_message): New method
3731         declaration.
3732         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3733         overflow to N.
3734         (GOT_PREL): Change implemented to Y.
3735         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3736         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3737         (Arm_relocate_functions::movw_abs_nc): Remove method.
3738         (Arm_relocate_functions::movt_abs): Ditto.
3739         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3740         (Arm_relocate_functions::thm_movt_abs): Ditto.
3741         (Arm_relocate_functions::movw_rel_nc): Ditto.
3742         (Arm_relocate_functions::movw_rel): Ditto.
3743         (Arm_relocate_functions::movt_rel): Ditto.
3744         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3745         (Arm_relocate_functions:thm_movw_rel): Ditto.
3746         (Arm_relocate_functions:thm_movt_rel): Ditto.
3747         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3748         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3749         New method definitions.
3750         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3751         (Arm_relocation_functions::arm_grp_ldr): Ditto.
3752         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3753         (Arm_relocation_functions::arm_grp_ldc): Ditto.
3754         (Target_arm::Relocate::relocate): Check for non-static or
3755         unimplemented relocation code and exit early.  Change calls to
3756         Target_arm::reloc_uses_thumb_bit and
3757         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3758         instead.  Refactor code to handle similar relocations to increase
3759         code sharing.  Remove check for unsupported relocation code in switch
3760         statement.
3761         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3762         relocation property table to find out size.  Change error message to
3763         print out the name of a relocation code instead of the numeric value.
3764         (Target_arm::scan_reloc_for_stub): Use relocation property table
3765         instead of calling Target_arm::reloc_uses_thumb_bit().
3766
3767 2010-02-02  Doug Kwan  <dougkwan@google.com>
3768
3769         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3770         types of relaxed input section.
3771
3772 2010-02-02  Doug Kwan  <dougkwan@google.com>
3773
3774         * Makefile.am (HFILES): Add arm-reloc-property.h.
3775         (DEFFILES): New.
3776         (TARGETSOURCES): Add arm-reloc-property.cc
3777         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3778         (libgold_a_SOURCES): $(DEFFILES)
3779         * Makefile.in: Regenerate.
3780         * arm-reloc-property.cc: New file.
3781         * arm-reloc-property.h: New file.
3782         * arm-reloc.def: New file.
3783         * arm.cc: Update comments.
3784         (arm-reloc-property.h): New included header.
3785         (arm_reloc_property_table): New global variable.
3786         (Target_arm::do_select_as_default_target): New method definition.
3787         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3788         arm-reloc-property to targ_extra_obj.
3789         * parameters.cc (set_parameters_target): Call
3790         Target::select_as_default_target().
3791         * target.h (Target::select_as_default_target): New method definition.
3792         (Target::do_select_as_default_target): Same.
3793
3794 2010-02-01  Doug Kwan  <dougkwan@google.com>
3795
3796         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3797         first_output_text_section_.
3798         (Arm_exidx_fixup::first_output_text_section): New method definition.
3799         (Arm_exidx_fixup::first_output_text_section_): New data member.
3800         (Arm_exidx_fixup::process_exidx_section): Record the first text
3801         output section seen.
3802         (Arm_output_section::fix_exidx_coverage): Set correct linked section
3803         and entsize in output section header.
3804
3805 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3806
3807         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3808         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3809         (Arm_relocate_functions::thm_alu11): New Method.
3810         (Arm_relocate_functions::thm_pc8): New Method.
3811         (Arm_relocate_functions::thm_pc12): New Method.
3812         (Target_arm::Scan::local): Handle the relocations.
3813         (Target_arm::Scan::global): Likewise.
3814         (Target_arm::Relocate::relocate): Likewise.
3815         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3816
3817 2010-01-29  Doug Kwan  <dougkwan@google.com>
3818
3819         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3820         of relocation types as ld.
3821
3822 2010-01-29  Doug Kwan  <dougkwan@google.com>
3823
3824         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3825         to public.
3826         (Arm_relocate_functions::thumb_branch_common): Ditto.
3827         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3828         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3829         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3830         Arm_relocate_functions::jump24): Remove.
3831         (Target_arm::Relocate::relocate): Adjust code to call
3832         Arm_relocation_functions::arm_branch_common and
3833         Arm_relocation_functions::thumb_branch_common instead of their removed
3834         wrappers.  Merge switch-cases together to reduce source code size.
3835
3836 2010-01-29  Doug Kwan  <dougkwan@google.com>
3837
3838         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3839         output_local_symbol_count_needs_update_.
3840         (Arm_relobj::output_local_symbol_count_needs_update,
3841          Arm_relobj::set_output_local_symbol_count_needs_update,
3842          Arm_relobj::update_output_local_symbol_count): New methods.
3843         (Arm_relobj::output_local_symbol_count_needs_update_): New data
3844         member.
3845         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3846         of pointed function as in a R_ARM_PREL31 relocation.
3847         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3848         for output local symbol count updating.
3849         (Target_arm::do_relax): Update output local symbol counts in objects
3850         if necessary.
3851         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3852
3853 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3854
3855         * arm.cc: Added support for the ARM relocations:
3856         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3857         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3858         (Arm_relocate_functions::movw_rel_nc): Renamed (was
3859         movw_prel_nc).
3860         (Arm_relocate_functions::movw_rel): New method.
3861         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3862         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3863         thm_movw_prel_nc).
3864         (Arm_relocate_functions::thm_movw_rel): New method.
3865         (Arm_relocate_functions::thm_movt_rel): Renamed (was
3866         thm_movt_prel).
3867         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3868         relocations.
3869         (Target_arm::Scan::global): Likewise.
3870         (Target_arm::Relocate::relocate): Likewise.
3871         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3872         Likewise.
3873
3874 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3875
3876         * arm.cc: Added support for ARM group relocations.
3877         (Target_arm::reloc_needs_sym_origin): New method.
3878         (Arm_relocate_functions::calc_grp_kn): New method.
3879         (Arm_relocate_functions::calc_grp_residual): New method.
3880         (Arm_relocate_functions::calc_grp_gn): New method.
3881         (Arm_relocate_functions::arm_grp_alu): New Method.
3882         (Arm_relocate_functions::arm_grp_ldr): New Method.
3883         (Arm_relocate_functions::arm_grp_ldrs): New Method.
3884         (Arm_relocate_functions::arm_grp_ldc): New Method.
3885         (Target_arm::Scan::local): Handle the ARM group relocations.
3886         (Target_arm::Scan::global): Likewise.
3887         (Target_arm::Relocate::relocate): Likewise.
3888         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3889         Likewise.
3890
3891 2010-01-26  Doug Kwan  <dougkwan@google.com>
3892
3893         * arm.cc (set): Include.
3894         (class Arm_exidx_fixup): Change type of last_input_section_ to const
3895         pointer type.
3896         (Arm_output_section::Text_section_list): New type.
3897         (Arm_output_section::append_text_sections_to_list): New method.
3898         (Arm_output_section::fix_exidx_coverage): Ditto.
3899         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3900         (Arm_relobj::convert_input_section_to_relaxed_section): Use
3901         Relobj::set_section_offset() instead of
3902         Sized_relobj::invalidate_section_offset().
3903         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3904         parameter for section headers. Ignore relocation sections for
3905         unallocated sections and EXIDX sections.
3906         (Target_arm::fix_exidx_coverage): New method.
3907         (Target_arm::output_section_address_less_than): New type.
3908         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3909         linked text section instead of the EXIDX section.
3910         (Arm_output_section::create_stub_group): Add an assertion to check
3911         that this is not an EXIDX output section.
3912         (Arm_output_section::append_text_sections_to_list): New method.
3913         (Arm_output_section::fix_exidx_coverage): Ditto.
3914         (Arm_relobj::scan_sections_for_stubs): Adjust call to
3915         Arm_relobj::section_needs_reloc_stub_scanning.
3916         (Target_arm::do_relax): Fix EXIDX output section coverage in the
3917         first pass.
3918         (Target_arm::fix_exidx_coverage): New method.
3919         * object.h (Relobj::set_output_section): New method.
3920         (Sized_relobj::invalidate_section_offset): Remove method.
3921         (Sized_relobj::do_invalidate_section_offset): Remove method.
3922         (Sized_relobj::do_set_section_offset): Handle offset value -1.
3923
3924 2010-01-25  Doug Kwan  <dougkwan@google.com>
3925
3926         * arm.cc (Arm_exidx_merged_section::do_output_offset):
3927         Fix warning due to signed and unsigned comparison on a 32-bit host.
3928
3929 2010-01-22  Doug Kwan  <dougkwan@google.com>
3930
3931         * arm.cc (Target_arm::do_relax): Record an output section for section
3932         offset adjustment it contains any stub table that has changed.
3933         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3934         offsets in an output section if necessary.
3935         * output.cc (Output_section::Output_section): Initialize
3936         section_offsets_need_adjustments_.
3937         (Output_section::add_input_section_for_script): Renamed to
3938         Output_section::add_simple_input_section.
3939         (Output_section::save_states): Add a comment.
3940         (Output_section::discard_states): New method defintion.
3941         (Output_section::adjust_section_offsets): Same.
3942         * output.h (Output_section::add_input_section_for_script): Renamed to
3943         Output_section::add_simple_input_section.
3944         (Output_section::discard_states): New method declaration.
3945         (Output_section::adjust_section_offsets): Same.
3946         (Output_section::section_offsets_need_adjustment,
3947         Output_section::set_section_offsets_need_adjustment): New method
3948         definitions.
3949         (Output_section::section_offsets_need_adjustment_): New data member.
3950         * script-sections.cc
3951         (Output_section_element_input::set_section_address): Adjust code for
3952         renaming of Output_section::add_input_section_for_script.
3953         (Orphan_output_section::set_section_address): Same.
3954
3955 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3956
3957         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3958         Fix_v4bx enum values .
3959         * gold/options.h (General_options): New option definitions.
3960         (General_options::fix_v4bx): New method.
3961         (General_options::Fix_v4bx): New enum.
3962         * gold/options.cc (General_options::parse_fix_v4bx): New method.
3963         (General_options::parse_fix_v4bx_interworking): New method.
3964
3965 2010-01-22  Doug Kwan  <dougkwan@google.com>
3966
3967         * arm.cc (Arm_exidx_fixup): New class.
3968
3969 2010-01-21  Doug Kwan  <dougkwan@google.com>
3970
3971         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3972         classes.
3973         (Arm_exidx_section_offset_map): New type.
3974
3975 2010-01-21  Doug Kwan  <dougkwan@google.com>
3976
3977         * arm.cc (Arm_exidx_input_section): New class.
3978         (Arm_relobj::exidx_input_section_by_link,
3979         Arm_relobj::exidx_input_section_by_shndx,
3980         Arm_relobj::make_exidx_input_section): New methods.
3981         (read_arm_attributes_section): Remove.
3982         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3983         information about them.
3984         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3985         to here.
3986
3987 2010-01-20  Doug Kwan  <dougkwan@google.com>
3988
3989         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3990         Input_section_specifier to Section_id.
3991         (Target_arm::new_arm_input_section: Adjust code for change of key
3992         type.
3993         (Target_arm::find_arm_input_section): Ditto.
3994         * gc.h (object.h): Include for Section_id nand Section_id_hash.
3995         (Section_id): Remove.
3996         (Garbage_collection::Section_id_hash): Remove.
3997         * icf.h (object.h): Include for Section_id nand Section_id_hash.
3998         (Section_id): Remove.
3999         (Icf::Section_id_hash): Remove.
4000         * object.h (Section_id, Const_section_id, Section_id_hash,
4001         Const_section_id_hash): New type definitions.
4002         * output.cc (Output_section::add_relaxed_input_section): Change to
4003         use Const_section_id instead of Input_section_specifier as key type.
4004         (Output_section::add_merge_input_section): Ditto.
4005         (Output_section::build_relaxation_map): Change to use Section_id
4006         instead of Input_section_specifier as key type.
4007         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4008         Ditto.
4009         (Output_section::convert_input_sections_to_relaxed_sections): Change
4010         to use Const_section_id instead of Input_section_specifier as key type.
4011         (Output_section::find_merge_section): Ditto.
4012         (Output_section::find_relaxed_input_section): Ditto.
4013         * output.h (Input_section_specifier): Remove class.
4014         (Output_section::Output_section_data_by_input_section_map): Change
4015         key type to Const_section_id.
4016         (Output_section::Output_relaxed_input_section_by_input_section_map):
4017         Ditto.
4018         (Output_section::Relaxation_map): Change key type to Section_id.
4019
4020 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4021
4022         * gold/arm.cc: Added support for R_ARM_V4BX relocation
4023         (class Arm_v4bx_stub): New class.
4024         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4025         (Stub_factory::make_arm_v4bx_stub): New method.
4026         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4027         (Stub_table::empty): Handle v4bx stubs.
4028         (Stub_table::add_arm_v4bx_stub): New method.
4029         (Stub_table::find_arm_v4bx_stub): New method.
4030         (Arm_relocate_functions::v4bx): New method.
4031         (Target_arm::fix_v4bx): New method.
4032         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4033         (Stub_table::relocate_stubs): Likewise.
4034         (Stub_table::do_write): Likewise.
4035         (Stub_table::update_data_size_and_addralign): Likewise.
4036         (Stub_table::finalize_stubs):  Likewise.
4037         (Target_arm::Scan::local): Likewise.
4038         (Target_arm::Scan::global): Likewise.
4039         (Target_arm::do_finalize_sections): Likewise.
4040         (Target_arm::Relocate::relocate): Likewise.
4041         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4042         Likewise.
4043         (Target_arm::scan_reloc_for_stub): Likewise.
4044         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4045
4046 2010-01-19  Ian Lance Taylor  <iant@google.com>
4047
4048         * output.cc (Output_section_headers::do_sized_write): Write large
4049         segment count to sh_info field.
4050         (Output_file_header::do_sized_write): For large segment count,
4051         write PN_XNUM to e_phnum field.
4052
4053 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4054
4055         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4056         (Arm_relocate_functions::thm_jump8): New function.
4057         (Arm_relocate_functions::thm_jump11): New function.
4058         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4059         R_ARM_THM_JUMP11.
4060         (Target_arm::Scan::global): Likewise.
4061         (Target_arm::Relocate::relocate): Likewise.
4062         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4063         Likewise.
4064
4065 2010-01-14  Doug Kwan  <dougkwan@google.com>
4066
4067         * arm.cc (map, utility): Include headers.
4068         (Target_arm::apply_cortex_a8_workaround): New method.
4069         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4070         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4071         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4072         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4073         the --[no-]fix-cortex-a8 command line options.
4074         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4075         (Target_arm::relocate_stub): Use addend in instruction template.
4076         * options.h (DEFINE_bool): Set the user-set flag.
4077         (General_options): Add --[no-]-fix-cortex options.
4078         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4079         : Update fast look-up map after conversion.
4080
4081 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4082
4083         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4084         in the first pass of do_layout.
4085
4086 2010-01-13  Doug Kwan  <dougkwan@google.com>
4087
4088         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4089         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4090         apparent compiler problem of not folding static constant integral
4091         data members of elfcpp::Elf_sizes<32>.
4092
4093 2010-01-13  Doug Kwan  <dougkwan@google.com>
4094
4095         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4096         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4097         Arm_relobj::scan_section_for_cortex_a8_erratum,
4098         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4099         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4100         sections to scan for relocation stubs into a new method
4101         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4102         relocation and Cortex-A8 stub scanning.
4103         (Target_arm::do_relax): Force stubs to be after stubbed sections
4104         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4105         the beginning of a new relaxation pass.  Update a comment.
4106         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4107
4108 2010-01-12  Ian Lance Taylor  <iant@google.com>
4109
4110         * target-reloc.h (visibility_error): New inline function.
4111         (relocate_section): Call visibility_error.
4112         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4113         (MOSTLYCLEANFILES): Likewise.
4114         (protected_4_pic.o, protected_3.err): New targets.
4115         * testsuite/protected_4.cc: New file.
4116
4117 2010-01-12  Doug Kwan  <dougkwan@google.com>
4118
4119         * arm.cc (Cortex_a8_reloc): New class.
4120         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4121         and cortex_a8_relocs_info_.
4122         (Target_arm::fix_cortex_a8): New method definition.
4123         (Target_arm::Cortex_a8_relocs_info): New type.
4124         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4125         New data member declarations.
4126         (Target_arm::scan_reloc_for_stub): Record information about
4127         relocations for THUMB branches that might be exempted from the
4128         Cortex-A8 workaround.
4129         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4130         at the beginning of a relaxation pass.
4131
4132 2010-01-12  Doug Kwan  <dougkwan@google.com>
4133
4134         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4135         (Arm_relobj::Mapping_symbol_position,
4136          Arm_reloj::Mapping_symbol_position_less,
4137          Arm_relobj::Mapping_symbols_info): New types.
4138         (Target_arm::is_mapping_symbol_name): New method definition.
4139         (Arm_relobj::do_count_local_symbols): Save information about mapping
4140         symbols.
4141
4142 2010-01-11  Doug Kwan  <dougkwan@google.com>
4143
4144         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4145         Arm_relocate_functions::thumb32_branch_upper,
4146         Arm_relocate_functions::thumb32_branch_lower,
4147         Arm_relocate_functions::thumb32_cond_branch_offset,
4148         Arm_relocate_functions::thumb32_cond_branch_upper,
4149         Arm_relocate_functions::thumb32_cond_branch_lower,
4150         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4151         branch offset encoding.
4152         (Arm_relocate_functions::thumb_branch_common): Use new branch
4153         offset encoding methods to avoid code duplication.
4154         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4155         (Stub_addend_reader::operator()): Use new branch encoding method
4156         to avoid code duplication.
4157
4158 2010-01-11  Doug Kwan  <dougkwan@google.com>
4159
4160         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4161         (Target_arm::do_finalize_sections): Define special EXIDX section
4162         symbols only if referenced.
4163         * gc.h (Garbage_collection::add_reference): New method.
4164         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4165         code duplication.
4166
4167 2010-01-11  Ian Lance Taylor  <iant@google.com>
4168
4169         * script.cc (Version_script_info::build_expression_list_lookup):
4170         Change complaing about duplicate wildcard match from error to
4171         warning.
4172
4173         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4174         of 2009-12-30.
4175         (Version_script_info::Version_script_info): Initialize globs_,
4176         default_version_, default_is_global_, and exact_.  Don't
4177         initialize globals_ or locals_.
4178         (Version_script_info::build_lookup_tables): Build local symbols
4179         first.
4180         (Version_script_info::unquote): New function.
4181         (Version_script_info::add_exact_match): New function.
4182         (Version_script_info::build_expression_list_lookup): Remove lookup
4183         parameter.  Add is_global parameter.  Change all callers.  Handle
4184         wildcard pattern specially.  Unquote pattern.  Call
4185         add_exact_match.
4186         (Version_script_info::get_name_to_match): New function.
4187         (Version_script_info::get_symbol_version): New function.
4188         (Version_script_info::get_symbol_version_helper): Remove.
4189         (Version_script_info::check_unmatched_names): Call unquote.
4190         * script.h (class Version_script_info): Change get_symbol_version
4191         to be non-inline and add is_global parameter; change all callers.
4192         Rewrite symbol_is_local.  Update declarations.  Define struct
4193         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4194         Remove globals_ and locals_ members.  Add exact_, globs_,
4195         default_version_, is_global_.
4196         (Version_script_info::Glob): Remove pattern, add expression and
4197         is_global.  Update constructor.  Change all callers.
4198         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4199         default version.
4200         (Versions::symbol_section_contents): If a symbol is undefined, or
4201         defined in a dynamic object, set the version index to
4202         VER_NDX_LOCAL.
4203         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4204         symbol_is_local.
4205         (Symbol_table::add_from_pluginobj): Likewise.
4206         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4207
4208 2010-01-11  Doug Kwan  <dougkwan@google.com>
4209
4210         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4211         (incremental_dump_LDADD): Add linking option for libintl.
4212         * Makefile.in: Regenerate.
4213
4214 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4215
4216         PR gold/11144
4217         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4218         instead of -Ds.
4219         * testsuite/Makefile.in: Regenerated.
4220
4221 2010-01-10  Doug Kwan  <dougkwan@google.com>
4222
4223         * options.h (DEFINE_var): Use parentheses around argument varname__
4224         in macro body to avoid any unintended subsequent substitutions.
4225
4226 2010-01-10  Ian Lance Taylor  <iant@google.com>
4227
4228         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4229         candidates before doing symbol resolution.
4230
4231         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4232         ODR candidates if only one is weak.
4233
4234 2010-01-08  Ian Lance Taylor  <iant@google.com>
4235
4236         * script.cc (Version_script_info::build_expression_list_lookup):
4237         Don't warn about ambiguous version, just record the ambiguity.
4238         (Version_script_info::get_symbol_version_helper): Give error if
4239         version is ambiguous.
4240
4241 2010-01-08  Doug Kwan  <dougkwan@google.com>
4242
4243         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4244           prev_data_size_ and prev_addralign_.  Remove initializer for
4245           deleted data member has_been_changed_.
4246           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4247           to determine if the table is empty.
4248           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4249           Remove.
4250           (Stub_table::add_reloc_stub): Define method in class definition
4251           instead of just declaring it there.
4252           (Stub_table::add_cortex_a8_stub): New method definition.
4253           (Stub_table::update_data_size_and_addralign): Ditto.
4254           (Stub_table::finalize_stubs): Ditto.
4255           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4256           (Stub_table::do_addralign_): Return address alignment in the
4257           (Stub_table::do_reset_address_and_file_offset): Define method in
4258           class definition instead of declaring it there.  Set current data
4259           size to be the data size of the previous pass.
4260           (Stub_table::set_final_data_size): Use current data size as the
4261           final data size.
4262           (Stub_table::relocate_stub): Change parameter type of stub from
4263           Reloc_stub pointer to Stub pointer.
4264           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4265           (Stub_table::Cortex_a8_stub_list): New typedef.
4266           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4267            Stub_table::prev_addralign_): New data member.
4268           (Arm_relobj::Arm_relobj): Initialize data member
4269           section_has_cortex_a8_workaround_.
4270           (Arm_relobj::section_has_cortex_a8_workaround,
4271            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4272            definitions.
4273           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4274           declarations.
4275           (Target_arm::relocate_stub): Change parameter type of stub from
4276           Reloc_stub pointer to Stub pointer.
4277           (Insn_template::size, Insn_template::alignment): Handle
4278           THUMB16_SPECIAL_TYPE.
4279           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4280            Stub_table::update_data_size_and_addralign,
4281            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4282           definitions.
4283           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4284           (Stub_table::do_write): Ditto.
4285           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4286
4287 2010-01-08  Ian Lance Taylor  <iant@google.com>
4288
4289         PR 11108
4290         * symtab.h (class Symbol): Remove fields is_target_special_ and
4291         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4292         (Symbol::is_defined_in_discarded_section): New function.
4293         (Symbol::set_is_defined_in_discarded_section): New function.
4294         (Symbol::has_plt_offset): Rewrite.
4295         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4296         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4297         Don't initialize is_target_special_ or has_plt_offset_.
4298         Initialize is_defined_in_discarded_section_.
4299         (Symbol_table::add_from_relobj): If appropriate, set
4300         is_defined_in_discarded_section.
4301         * resolve.cc (Symbol::override_base_with_special): Don't test
4302         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4303         * target-reloc.h (relocate_section): Do special handling for
4304         symbols defined in discarded sections for global symbols as well
4305         as local symbols.
4306
4307 2010-01-08  Ian Lance Taylor  <iant@google.com>
4308
4309         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4310         the SHT_SYMTAB case.
4311
4312 2010-01-08  Ian Lance Taylor  <iant@google.com>
4313
4314         * object.cc (Sized_relobj::do_layout): Don't get confused if
4315         layout_eh_frame returns NULL.
4316
4317 2010-01-08  Ian Lance Taylor  <iant@google.com>
4318
4319         PR 11084
4320         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4321         dynamic symbol table, use the normal symbol table.
4322         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4323         symbol table.
4324
4325 2010-01-08  Ian Lance Taylor  <iant@google.com>
4326
4327         PR 11072
4328         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4329         sections.
4330
4331 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4332
4333         * version.cc (print_version): Change to "Copyright 2010".
4334
4335 2010-01-08  Ian Lance Taylor  <iant@google.com>
4336
4337         PR 10287
4338         PR 11063
4339         * i386.cc (class Target_i386): Change return type of plt_section
4340         to be non-const.
4341         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4342         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4343         tls_desc_rel_ field.
4344         (Output_data_plt_i386::rel_tls_desc): New function.
4345         (Target_i386::rel_tls_desc_section): New function.
4346         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4347         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4348         R_386_TLS_DESC reloc in rel_tls_desc_section.
4349         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4350         Define struct Tlsdesc_info.
4351         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4352         (Target_x86_64::do_reloc_symbol_index): New function.
4353         (Target_x86_64::add_tlsdesc_info): New function.
4354         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4355         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4356         tlsdesc_rel_ field.
4357         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
4358         all callers.
4359         (Output_data_plt_x86_64::rela_tlsdesc): New function.
4360         (Target_x86_64::rela_tlsdesc_section): New function.
4361         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4362         handling.
4363         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4364         (Target_x86_64::do_reloc_addend): New function.
4365         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4366         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4367         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
4368         (Output_reloc::type): New function.
4369         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4370         (Output_reloc::is_target_specific): New function.
4371         (Output_reloc::target_arg): New function.
4372         (class Output_reloc) [SHT_RELA]: Add four new constructors for
4373         absolute relocs and target specific relocs.
4374         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4375         add_target_specific.
4376         (class Output_data_reloc) [SHT_RELA]: Likewise.
4377         * output.cc (Output_reloc::Output_reloc): Add four new versions
4378         for absolute relocs and target specific relocs.
4379         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4380         (Output_reloc::get_symbol_index): Likewise.
4381         (Output_reloc::local_section_offset): Check that local_sym_index_
4382         is not TARGET_CODE or 0.
4383         (Output_reloc::symbol_value): Likewise.
4384         (Output_reloc::write) [SHT_RELA]: Call target for target specific
4385         reloc.
4386         * target.h (class Target): Add reloc_symbol_index and reloc_addend
4387         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
4388         functions.
4389         * layout.cc (add_target_dynamic_tags): Use output section for
4390         DT_PLTRELSZ and DT_JMPREL.
4391
4392 2010-01-07  Ian Lance Taylor  <iant@google.com>
4393
4394         PR 11061
4395         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4396         function.
4397         (class Output_data_reloc_generic): Define.
4398         (class Output_data_reloc_base): Change base class to
4399         Output_data_reloc_generic.  Change add() method to call
4400         bump_relative_reloc_count for a relative reloc.  Remove
4401         sort_relocs_ field.
4402         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4403         to sort_relocs().
4404         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4405         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
4406         appropriate.
4407         * layout.h (class Layout): Update declaration.
4408
4409 2010-01-07  Ian Lance Taylor  <iant@google.com>
4410
4411         * output.h (class Output_data): Add const version of
4412         output_section and do_output_section.
4413         (class Output_section_data): Add const version of
4414         do_output_section.
4415         (class Output_section): Likewise.
4416         * layout.cc (Layout::add_target_dynamic_tags): New function.
4417         * layout.h (class Layout): Update declarations.
4418         * arm.cc (Target_arm::do_finalize_sections): Use
4419         add_target_dynamic_tags.
4420         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4421         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4422         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4423         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4424
4425 2010-01-07  Ian Lance Taylor  <iant@google.com>
4426
4427         PR 11042
4428         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4429         object as needed.
4430
4431 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
4432             Ian Lance Taylor  <iant@google.com>
4433
4434         PR 11019
4435         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4436         Xindex::read_symtab_xindex.
4437
4438 2010-01-07  Doug Kwan  <dougkwan@google.com>
4439
4440         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4441         (Insn_template::thumb16_bcond_insn): New method declaration.
4442         (Insn_template): Fix spelling.
4443         (Stub::thumb16_special): New method declaration.
4444         (Stub::do_write): Define virtual method which was previously pure
4445         virtual.
4446         (Stub::do_thumb16_special): New method declaration.
4447         (Stub::do_fixed_endian_write): New template member.
4448         (Reloc_stub::do_write): Remove.
4449         (Reloc_stub::do_fixed_endian_write): Remove.
4450         (Cortex_a8_stub): New class definition.
4451         (Stub_factory::make_cortex_a8_stub): New method definition.
4452         (Stub_factory::Stub_factory): Add missing static storage class
4453         qualifier for elf32_arm_stub_a8_veneer_blx.
4454
4455 2010-01-07  Ian Lance Taylor  <iant@google.com>
4456
4457         PR 10980
4458         * options.h (class General_options): Add --warn-unresolved-symbols
4459         and --error-unresolved-symbols.
4460         * errors.cc (Errors::undefined_symbol): Implement
4461         --warn-unresolved-symbols.
4462
4463         * options.h (class General_options): Add -z text and -z textoff.
4464         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4465
4466 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
4467
4468         * gc.h (Garbage_collection::Cident_section_map): New typedef.
4469         (Garbage_collection::cident_sections): New function.
4470         (Garbage_collection::add_cident_section): New function.
4471         (Garbage_collection::cident_sections_): New member.
4472         (gc_process_relocs): Add references to sections whose names are C
4473         identifiers.
4474         * gold.h (cident_section_start_prefix): New constant.
4475         (cident_section_stop_prefix): New constant.
4476         (is_cident): New function.
4477         * layout.cc (Layout::define_section_symbols): Replace string constants
4478         with the newly defined constants.
4479         * object.cc (Sized_relobj::do_layout): Track sections whose names are
4480         C identifiers.
4481         * testsuite/Makefile.am: Add gc_orphan_section_test.
4482         * testsuite/Makefile.in: Regenerate.
4483         * testsuite/gc_orphan_section_test.cc: New file.
4484         * testsuite/gc_orphan_section_test.sh: New file.
4485
4486 2010-01-06  Ian Lance Taylor  <iant@google.com>
4487
4488         PR 10980
4489         * options.h (class General_options): Add --warn-shared-textrel.
4490         * layout.cc (Layout::finish_dynamic_section): Implement
4491         --warn-shared-textrel.
4492
4493         PR 10980
4494         * options.h (class General_options): Add --warn-multiple-gp.
4495
4496 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4497
4498         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4499         $(THREADSLIB) and $(LIBDL).
4500         * Makefile.in: Rebuild.
4501
4502 2010-01-06  Ian Lance Taylor  <iant@google.com>
4503
4504         PR 10980
4505         * options.cc (General_options::parse_section_start): New function.
4506         (General_options::section_start): New function.
4507         (General_options::General_options): Initialize all members.
4508         * options.h: Include <map>
4509         (class General_options): Add --section-start.  Add section_starts_
4510         member.
4511         * layout.cc (Layout::attach_allocated_section_to_segment): If
4512         --section-start was used, set the address of the segment.  Remove
4513         local sort_sections.
4514         (Layout::relaxation_loop_body): If the address of the load segment
4515         has been set by --section-start, don't use it.
4516         * output.h (Output_segment::update_flags_for_output_section): New
4517         function.
4518         * output.cc (Output_segment::add_output_section): Call
4519         update_flags_for_output_section.
4520
4521 2010-01-05  Ian Lance Taylor  <iant@google.com>
4522
4523         PR 10980
4524         * options.h (class General_options): Add --undefined-version.
4525         * script.cc (struct Version_expression): Add was_matched_by_symbol
4526         field.
4527         (Version_script_info::matched_symbol): New function.
4528         (Version_script_info::get_symbol_version_helper): Call
4529         matched_symbol.
4530         (Version_script_info::check_unmatched_names): New function.
4531         * script.h (class Version_script_info): Update declarations.
4532         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4533
4534         * options.h (class General_options): Use DEFINE_bool_alias for
4535         allow_multiple_definition.
4536         * resolve.cc (Symbol_table::should_override): Don't test
4537         allow_multiple_definition.
4538
4539         PR 10980
4540         * options.h (class General_options): Add --cref.
4541         * main.cc (main): Print cref table if --cref.  Don't close mapfile
4542         until after printing cref table.
4543         * cref.cc: Include "symtab.h".
4544         (class Cref_inputs): Define Cref_table_compare and Cref_table.
4545         (Cref_table_compare::operator()): New function.
4546         (Cref_inputs::gather_cref): New function.
4547         (filecol): New static const.
4548         (Cref_inputs::print_cref): New function.
4549         (Cref::print_cref): New function.
4550         * cref.h: Include <cstdio>.
4551         (class Cref): Update declarations.
4552         * mapfile.h (Mapfile::file): New function.
4553         * object.h (class Object): Define Symbols.  Declare virtual
4554         do_get_global_symbols.
4555         (Object::get_global_symbols): New function.
4556         * object.cc (Input_objects::add_object): Pass object to cref_ if
4557         --cref.
4558         (Input_objects::archive_start): Likewise.
4559         (Input_objects::archive_stop): Likewise.
4560         (Input_objects::print_cref): New function.
4561         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4562         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4563         --cref.
4564         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4565         function.
4566         * plugin.h (class Sized_pluginobj): Update declarations.
4567
4568 2010-01-05  Ian Lance Taylor  <iant@google.com>
4569
4570         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4571         to is_default_version.  Rename insdef to insdefault.
4572         (Symbol_table::add_from_relobj): Rename def to is_default_version
4573         and local to is_forced_local.
4574         (Symbol_table::add_from_pluginobj): Likewise.
4575         (Symbol_table::add_from_dynobj): Likewise.
4576         (Symbol_table::define_special_symbol): Rename insdef to
4577         insdefault.
4578
4579 2010-01-04  Ian Lance Taylor  <iant@google.com>
4580
4581         PR 10980
4582         * options.h (class General_options): Add
4583         --allow-multiple-definition and -z muldefs.
4584         * resolve.cc (Symbol_table::should_override): Don't warn about a
4585         multiple symbol definition if --allow-multiple-definition or -z
4586         muldefs.
4587
4588         PR 10980
4589         * options.h (class General_options): Add --add-needed and
4590         --copy-dt-needed-entries.  Tweak --as-needed help entry.
4591         * object.cc (Input_objects::check_dynamic_dependencies): Give an
4592         error if --copy-dt-needed-entries aka --add-needed is used and
4593         would cause a change in behaviour.
4594
4595         PR 10980
4596         * options.h (class General_options): Add -G as a short version of
4597         --shared.  Add no-op options -assert, -g, and -i.
4598
4599 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
4600
4601         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4602         check for .text or .gnu.linkonce.t sections.
4603         * icf.cc (Icf::find_identical_sections): Ditto.
4604         Change the detection for mangled function name within the section
4605         name.
4606         * icf.h (is_section_foldable_candidate): New function.
4607
4608 2009-12-30  Ian Lance Taylor  <iant@google.com>
4609
4610         PR 10980
4611         * options.h (class General_options): Permit two dashes with
4612         --retain-symbols-file.
4613
4614 2009-12-30  Ian Lance Taylor  <iant@google.com>
4615
4616         PR 10979
4617         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4618         don't put the file header and segment headers in the text
4619         segment.
4620
4621         PR 10979
4622         * common.cc (Sort_commons::operator()): Stabilize sort when both
4623         entries are NULL.
4624         (Symbol_table::do_allocate_commons_list): When allocating common
4625         symbols, skip a symbol which is no longer common.
4626         * symtab.h (Symbol::is_common): Test whether the symbol comes from
4627         an object before checking its type.
4628         * testsuite/common_test_2.c: New file.
4629         * testsuite/common_test_3.c: New file.
4630         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4631         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4632         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4633         (common_test_2_pic.o, common_test_2.so): New targets.
4634         (common_test_3_pic.o, common_test_3.so): New targets.
4635         * testsuite/Makefile.in: Rebuild.
4636
4637         PR 10979
4638         * script.cc (read_input_script): If we see a new SECTIONS clause,
4639         and we have added an input section, give an error.
4640         * layout.h (class Layout): Add have_added_input_section function.
4641         Add have_added_input_section_ field.
4642         * layout.cc (Layout::Layout): Initialize
4643         have_added_input_section_.
4644         (Layout::layout): Set have_added_input_section_.
4645         (Layout::layout_eh_frame): Likewise.
4646
4647 2009-12-30  Ian Lance Taylor  <iant@google.com>
4648
4649         PR 10931
4650         * options.h (class General_options): Add --sort-common option.
4651         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4652         * common.cc (Sort_common): Add sort_order parameter to
4653         constructor.  Add sort_order_ field.
4654         (Sort_commons::operator): Check sort_order_.
4655         (Symbol_table::allocate_commons): Determine the sort order.
4656         (Symbol_table::do_allocate_commons): Add sort_order parameter.
4657         Change all callers.
4658         (Symbol_table::do_allocate_commons_list): Likewise.
4659
4660 2009-12-30  Ian Lance Taylor  <iant@google.com>
4661
4662         PR 10916
4663         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4664         symbols from this object, don't change the visibility of an
4665         undefined symbol.
4666         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4667
4668 2009-12-30  Ian Lance Taylor  <iant@google.com>
4669
4670         PR 10861
4671         * script.h (class Version_script_info): Define Language enum.
4672         Update declarations.  Define Glob, Exact, and Lookup types.  Add
4673         new fields globals_, locals_, and is_finalized_.
4674         * script.cc: Various formatting fixes.
4675         (class Parser_closure): Change language_stack_ from a vector of
4676         std::string to one of Version_script_info::Language.  Adjust all
4677         uses accordingly.
4678         (class Lazy_demangler): Remove.
4679         (struct Version_expression): Change language from std::string to
4680         Version_script_info::Language.
4681         (Version_script_info::Version_script_info): New function.
4682         (Version_script_info::~Version_script_info): Don't call clear.
4683         (Version_script_info::finalize): New function.
4684         (Version_script_info::build_lookup_tables): New function.
4685         (Version_script_info::build_expression_list_lookup): New
4686         function.
4687         (Version_script_info::get_symbol_version_helper): Rewrite to use
4688         lookup tables.
4689         (Version_script_info::print_expression_list): Adjust to use
4690         Version_script_info::Language.
4691         (script_push_lex_into_version_mode): Check that the version script
4692         has not been finalized.
4693         (version_script_push_lang): Change language string to
4694         Version_script_info::Language.
4695         * options.cc (Command_line::version_script): New function.
4696         * options.h (class General_options): Add finalize_dynamic_list
4697         function.  Change version_script from declaration to definition.
4698         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4699         * testsuite/version_script.map: Remove duplicate def of foo.
4700         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4701         version_script.map.
4702         * testsuite/Makefile.in: Rebuild.
4703
4704 2009-12-30  Ian Lance Taylor  <iant@google.com>
4705
4706         PR 10843
4707         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4708         if the input symbol index is 0, make the output symbol index 0.
4709
4710 2009-12-30  Ian Lance Taylor  <iant@google.com>
4711
4712         PR 10670
4713         * options.h (class General_options): Add -x/--discard-all.
4714         * object.cc (Sized_relobj::do_count_local_symbols): Handle
4715         --discard-all.  If the local symbol needs a dynamic entry, check
4716         that before handling --discard-locals.
4717
4718 2009-12-30  Ian Lance Taylor  <iant@google.com>
4719
4720         PR 10450
4721         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4722         flags to PF_R.
4723         (Output_segment::add_output_section): Don't change the flags if
4724         the type is PT_TLS.
4725
4726         PR 10450
4727         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4728         GNU hash table if they need a dynamic value.  Otherwise, don't add
4729         them if they are defined in a dynamic object or are forced local.
4730
4731 2009-12-29  Ian Lance Taylor  <iant@google.com>
4732
4733         PR 10450
4734         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4735         .gnu.hash table for a 32-bit target.
4736
4737         PR 10450
4738         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4739         regular and a dynamic object only needs a dynamic symbol table
4740         entry if it is externally visible.
4741
4742         PR 10450
4743         * i386.cc (class Target_i386): Initialize global_offset_table_ in
4744         constructor.  Add global_offset_table_ field.
4745         (Target_i386::got_section): Set global_offset_table_.
4746         (Target_i386::do_finalize_sections): Set global_offset_table_
4747         size.
4748         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4749         in constructor.  Add global_offset_table_ field.
4750         (Target_x86_64::got_section): Set global_offset_table_.
4751         (Target_x86_64::do_finalize_sections): Set global_offset_table_
4752         size.
4753
4754         * layout.cc (Layout::Layout): Initialize increase_relro_.
4755         (Layout::get_output_section): Add is_relro, is_last_relro, and
4756         is_first_non_relro parameters.  Change all callers.
4757         (Layout::choose_output_section): Likewise.
4758         (Layout::add_output_section_data): Likewise.
4759         (Layout::make_output_section): Likewise.
4760         (Layout::set_segment_offsets): Clear increase_relro when using a
4761         linker script.
4762         * layout.h (class Layout): Add increase_relro method.  Add
4763         increase_relro_ field.  Update declarations.
4764         * output.cc (Output_section::Output_section): Initialize
4765         is_last_relro_ and is_first_non_relro_.
4766         (Output_segment::add_output_section): Group relro sections is
4767         do_sort is true.  Handle is_last_relro and is_first_non_relro.
4768         (Output_segment::maximum_alignment): Remove relro handling.
4769         (Output_segment::set_section_addresses): Add increase_relro
4770         parameter.  Change all callers.  Add initial alignment to align
4771         relro sections on separate page.  Remove old relro handling.
4772         (Output_segment::set_section_list_addresses): Remove in_relro
4773         parameter.  Change all callers.
4774         (Output_segment::set_offset): Add increase parameter.  Change all
4775         callers.  Remove old relro handling.
4776         * output.h (class Output_section): Add new methods: is_last_relro,
4777         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4778         Add is_last_relro_ and is_first_non_relro_ fields.
4779         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4780         Create separate .got.plt section.  Call increase_relro.
4781         * x86_64.cc (Target_x86_64::got_section): Likewise.
4782         * testsuite/relro_script_test.t: Add .got.plt.
4783
4784         PR 10450
4785         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4786         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4787         (Layout::finalize): Call set_dynamic_symbol_size.
4788         (Layout::set_dynamic_symbol_size): New function.
4789         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
4790         set_dynamic_symbol_size.
4791
4792         PR 10450
4793         * output.h (class Output_section): Add is_entsize_zero_ field.
4794         * output.cc (Output_section::Output_section): Initialize
4795         is_entsize_zero_.
4796         (Output_section::set_entsize): If two different entsizes are
4797         requested, force it to zero.
4798         (Output_section::add_input_section): Set flags for .debug_str
4799         before updating section flags.  Set entsize.
4800         (Output_section::update_flags_for_input_section): Set SHF_MERGE
4801         and SHF_STRING if all input sections have those flags.
4802
4803 2009-12-29   Rafael Espindola  <espindola@google.com>
4804
4805         * main.cc (main): Fix the sys time reporting.
4806         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4807         reporting.
4808
4809 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
4810
4811         * options.cc (General_options::parse_version): Allow -v to exit
4812         without an error if there is nothing to link.
4813
4814 2009-12-29  Ian Lance Taylor  <iant@google.com>
4815
4816         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4817         using a version of gcc before 4.1.
4818         * configure: Rebuild.
4819
4820 2009-12-28  Chris Demetriou  <cgd@google.com>
4821
4822         * attributes.cc (Output_attributes_section_data::do_write): Use
4823         std::vector::front rather than std::vector::data.
4824
4825 2009-12-28  Ian Lance Taylor  <iant@google.com>
4826
4827         * symtab.h (class Symbol_table): Add enum Defined.
4828         * resolve.cc (Symbol_table::should_override): Add defined
4829         parameter.  Change all callers.  Test whether object is NULL
4830         before calling a method on it.
4831         (Symbol_table::report_resolve_problem): Add defined parameter.
4832         Change all callers.
4833         (Symbol_table::should_override_with_special): Likewise.
4834         * symtab.cc (Symbol_table::define_in_output_data): Add defined
4835         parameter.  Change all callers.
4836         (Symbol_table::do_define_in_output_data): Likewise.
4837         (Symbol_table::define_in_output_segment): Likewise.
4838         (Symbol_table::do_define_in_output_segment): Likewise.
4839         (Symbol_table::define_as_constant): Likewise.
4840         (Symbol_table::do_define_as_constant): Likewise.
4841         * script.h (class Symbol_assignment): Add is_defsym parameter to
4842         constructor; change all callers.
4843         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4844         parameter.  Change all callers.  Add is_defsym_ field.
4845         (class Parser_closure): Add parsing_defsym parameter to
4846         constructor; change all callers.  Add parsing_defsym accessor
4847         function.  Add parsing_defsym_ field.
4848
4849 2009-12-28  Ian Lance Taylor  <iant@google.com>
4850
4851         * gold.cc (queue_middle_tasks): Fix formatting.
4852         * object.cc (Relobj::is_section_name_included): Likewise.
4853
4854 2009-12-23  Ian Lance Taylor  <iant@google.com>
4855
4856         * i386.cc (Target_i386::do_calls_non_split): Recognize
4857         -fsplit-stack prologue for a function with a static chain.
4858         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4859         -fsplit-stack prologue when using %r11.
4860
4861 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
4862
4863         * options.cc (General_options::parse_version): Make -v continue and do
4864         the link like GNU ld does.
4865
4866 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
4867
4868         * Makefile.am (CCFILES): Add timer.cc.
4869         (HFILES): Add timer.h.
4870         * configure.ac: Check for sysconf and times.
4871         * main.cc: include timer.h.
4872         (main): Use Timer instead of get_run_time.
4873         * timer.cc: New.
4874         * timer.h: New.
4875         * workqueue.cc: include timer.h.
4876         (Workqueue::find_and_run_task):
4877         Report user, sys and wall time.
4878         * Makefile.in: Regenerate.
4879         * config.in: Regenerate.
4880         * configure: Regenerate.
4881
4882 2009-12-16  Doug Kwan  <dougkwan@google.com>
4883
4884         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4885         sections.
4886         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4887         relaxed input sections.
4888         * output.cc (Output_section::find_relaxed_input_section): Change
4889         return type to Output_relaxed_input_section pointer.  Adjust code
4890         for new type of relaxed_input_section_map_.
4891         * output.h (Output_section::find_relaxed_input_section): Change
4892         return type to Output_relaxed_input_section pointer.
4893         (Output_section::Output_relaxed_input_section_by_input_section_map):
4894         New type.
4895         (Output_section::relaxed_input_section_map_): Change type to
4896         Output_section::Output_relaxed_input_section_by_input_section_map.
4897         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4898         input section.
4899
4900 2009-12-15  Ian Lance Taylor  <iant@google.com>
4901
4902         * layout.cc (Layout::create_shstrtab): Only write out after input
4903         sections if we are compressing debug sections.
4904
4905 2009-12-15  Ian Lance Taylor  <iant@google.com>
4906
4907         * archive.cc (Archive::add_symbols): Only look up a symbol without
4908         a version if there is, in fact, a version.
4909
4910 2009-12-14  Ian Lance Taylor  <iant@google.com>
4911
4912         Revert -Wshadow changes, all changes from:
4913         2009-12-11  Doug Kwan  <dougkwan@google.com>
4914         2009-12-11  Nick Clifton  <nickc@redhat.com>
4915         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4916
4917 2009-12-11  Doug Kwan  <dougkwan@google.com>
4918
4919         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4920         due to -Wshadow.
4921         * attributes.cc (Object_attribute::size): Ditto.
4922         (Attributes_section_data::size): Ditto.
4923         (Attributes_section_data::Attributes_section_data): Ditto.
4924         (Output_attributes_section_data::do_write): Ditto.
4925         * attributes.h (Object_attribute::set_type): Ditto.
4926         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4927
4928 2009-12-11  Nick Clifton  <nickc@redhat.com>
4929
4930         * archive.cc: Fix shadowed variable warnings.
4931         * arm.cc: Likewise.
4932         * compressed_output.cc: Likewise.
4933         * compressed_output.h: Likewise.
4934         * configure: Likewise.
4935         * dwarf_reader.cc: Likewise.
4936         * dynobj.cc: Likewise.
4937         * dynobj.h: Likewise.
4938         * ehframe.cc: Likewise.
4939         * ehframe.h: Likewise.
4940         * errors.cc: Likewise.
4941         * expression.cc: Likewise.
4942         * fileread.cc: Likewise.
4943         * fileread.h: Likewise.
4944         * freebsd.h: Likewise.
4945         * i386.cc: Likewise.
4946         * icf.cc: Likewise.
4947         * incremental.h: Likewise.
4948         * layout.cc: Likewise.
4949         * layout.h: Likewise.
4950         * mapfile.cc: Likewise.
4951         * merge.cc: Likewise.
4952         * merge.h: Likewise.
4953         * object.cc: Likewise.
4954         * object.h: Likewise.
4955         * options.h: Likewise.
4956         * output.cc: Likewise.
4957         * output.h: Likewise.
4958         * parameters.cc: Likewise.
4959         * plugin.cc: Likewise.
4960         * powerpc.cc: Likewise.
4961         * reduced_debug_output.cc: Likewise.
4962         * reduced_debug_output.h: Likewise.
4963         * reloc.cc: Likewise.
4964         * reloc.h: Likewise.
4965         * resolve.cc: Likewise.
4966         * script-sections.cc: Likewise.
4967         * script.cc: Likewise.
4968         * script.h: Likewise.
4969         * sparc.cc: Likewise.
4970         * symtab.cc: Likewise.
4971         * symtab.h: Likewise.
4972         * target-select.cc: Likewise.
4973         * target-select.h: Likewise.
4974         * token.h: Likewise.
4975         * workqueue.cc: Likewise.
4976         * workqueue.h: Likewise.
4977         * x86_64.cc: Likewise.
4978
4979 2009-12-10  Doug Kwan  <dougkwan@google.com>
4980
4981         * arm.cc (attributes.h): New include.
4982         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4983         (Arm_relobj::~Arm_relobj): Delete object pointed by
4984         attributes_section_data_.
4985         (Arm_relobj::attributes_section_data): New method definition.
4986         (Arm_relobj::attributes_section_data_): New data member declaration.
4987         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4988         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4989         attributes_section_data_.
4990         (Arm_dynobj::attributes_section_data): New method definition.
4991         (Arm_dynobj::attributes_section_data_): New data member declaration.
4992         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
4993         initialization value of may_use_blx_ to false.
4994         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4995         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4996         object attributes to compute results instead of hard-coding.
4997         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4998         Target_arm::get_secondary_compatible_arch,
4999         Target_arm::set_secondary_compatible_arch
5000         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5001         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5002         New method declarations.
5003         (Target_arm::get_aeabi_object_attribute): New method definition.
5004         (Target_arm::attributes_section_data_): New data member declaration.
5005         (read_arm_attributes_section): New template definition.
5006         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5007         (Arm_dynobj::do_read_symbols): Ditto.
5008         (Target_arm::do_finalize_sections): Merge attributes sections from
5009         input.  Check for BLX use after attributes section merging.
5010         Fix __exidx_start and __exidx_end visibility.  Create an
5011         .ARM.attributes section if necessary.
5012         (Target_arm::get_secondary_compatible_arch,
5013         Target_arm::set_secondary_compatible_arch,
5014         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5015         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5016         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5017         New method definitions.
5018
5019 2009-12-09  Ian Lance Taylor  <iant@google.com>
5020
5021         * plugin.cc (Plugin::load): Don't cast from void* to a function
5022         pointer.
5023
5024 2009-12-09  Ian Lance Taylor  <iant@google.com>
5025
5026         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5027         information fields.
5028
5029 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5030
5031         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5032         Replace two_file_shared_1.so with two_file_shared_2.so.
5033         * testsuite/Makefile.in: Regenerated.
5034
5035 2009-12-08  Doug Kwan  <dougkwan@google.com>
5036
5037         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5038         (HFILES): Add attributes.h and int_encoding.h.
5039         * Makefile.in: Regenerate.
5040         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5041         function definitions to int_encoding.cc
5042         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5043         prototypes to int_encoding.h
5044         * reduced_debug_output.cc (int_encoding.h): New include.
5045         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5046         function definitions to int_encoding.cc
5047         (insert_into_vector, read_from_pointer): Move template definitions to
5048         int_encoding.h
5049         * attributes.cc: New file.
5050         * attributes.h: New file.
5051         * int_encoding.cc: New file.
5052         * int_encoding.h: New file.
5053
5054 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5055
5056         PR gold/11055
5057         * incremental-dump.cc (dump_incremental_inputs): New.
5058         (main): Use dump_incremental_inputs.
5059
5060 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5061
5062         PR gold/10893
5063         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5064         checking elfcpp::STT_FUNC.
5065         (Target_i386::Relocate::relocate): Likewise.
5066         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5067
5068         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5069         symbols from shared libraries into normal FUNC symbols.
5070
5071         * symtab.h (Symbol): Add is_func and use it.
5072
5073 2009-12-05  Doug Kwan  <dougkwan@google.com>
5074
5075         * arm.cc (Target_arm::arm_info): Initialize new fields
5076         attributes_section and attributes_vendor.
5077         * i386.cc (Target_i386::i386_info): Same.
5078         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5079         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5080         fields attributes_section and attributes_vendor.
5081         * sparc.cc (Target_sparc::sparc_info): Same.
5082         * target.h (Target::attributes_section, Target::attributes_vendor,
5083         Target::is_attributes_section, Target::attribute_arg_type,
5084         Target::attributes_order): New method definitions.
5085         (Target::Target_info::attributes_section,
5086         Target::Target_info::attributes_vendor): New fields.
5087         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5088         virtual method definitions.
5089         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5090         attributes_section and attributes_vendor.
5091         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5092
5093 2009-12-05  Doug Kwan  <dougkwan@google.com>
5094
5095         * arm.cc: Update comments about interworking and stub generation.
5096         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5097         considered as non-PIC.
5098         (Arm_relocate_functions::base_abs): Fix formatting.
5099         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5100         of function to use GOT entry address instead of offset.
5101         (Target_arm::Scan::global): Issue an error if a symbol would need a
5102         PLT does not get one because it is untyped.  Remove code to create
5103         dynamic symbols for relative branches.
5104         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5105         takes unsigned integer instead of boolean.
5106
5107 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5108
5109         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5110         (two_file_test_LDADD): Likewise.
5111         (common_test_1_LDADD): Likewise.
5112         (exception_test_LDADD) Likewise.
5113         (weak_test_LDADD): Likewise.
5114         (many_sections_test_LDADD): Likewise.
5115         (initpri1_LDADD): Likewise.
5116         (script_test_1_LDADD): Likewise.
5117         (script_test_2_LDADD): Likewise.
5118         (justsyms_LDADD): Likewise.
5119         (binary_test_LDADD): Likewise.
5120         (large_LDADD): Likewise.
5121         * testsuite/Makefile.in: Regenerated.
5122
5123 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5124
5125         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5126         (Symbol_table::override_with_special): Likewise.
5127         (Symbol_table::add_from_object): Likewise.
5128
5129 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5130
5131         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5132         Don't set the data_offset twice.
5133
5134 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5135
5136         * testsuite/Makefile.in: Regenerate.
5137
5138 2009-12-03  Doug Kwan  <dougkwan@google.com>
5139
5140         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5141         (Target_arm::do_finalize_sections): Add parameter for symbol table
5142         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5143         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5144         parameter for symbol table pointer.
5145         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5146         an additional parameter for a pointer to symbol table.
5147         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5148         parameter for a symbol table pointer.
5149         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5150         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5151         Ditto.
5152         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5153         parameter for a symbol table pointer.
5154
5155 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5156
5157         * incremental.cc (Incremental_inputs_header)
5158         (Incremental_inputs_header_write, Incremental_inputs_entry)
5159         (Incremental_inputs_entry_write): Move ...
5160         * incremental.h (Incremental_inputs_header)
5161         (Incremental_inputs_header_write, Incremental_inputs_entry)
5162         (Incremental_inputs_entry_write): here.
5163
5164 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5165
5166         * incremental.cc (make_sized_incremental_binary): Set the target.
5167         Error if it is incompatible.
5168         * output.h (Output_file): Add filename method.
5169
5170 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5171
5172         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5173         from the get_* methods.
5174
5175 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5176
5177         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5178         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5179         Write 0 for the data_offset of scripts.
5180
5181 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5182
5183         * testsuite/Makefile.am: Add the incremental_test.sh test.
5184         * testsuite/incremental_test.sh: New.
5185         * testsuite/incremental_test_1.c: New.
5186         * testsuite/incremental_test_2.c: New.
5187
5188 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5189
5190        * incremental-dump.cc (main): Fix typos.
5191
5192 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5193
5194         PR gold/11025
5195         * incremental-dump.cc (main): Use llu to print 64 bit values.
5196
5197 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5198             H.J. Lu  <hongjiu.lu@intel.com>
5199
5200         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5201         $(LIBDL).
5202         (incremental_dump_LDADD): Likewise.
5203         * Makefile.in: Regenerated.
5204
5205 2009-11-25  Doug Kwan  <dougkwan@google.com>
5206
5207         Revert:
5208
5209         2009-11-25  Doug Kwan  <dougkwan@google.com>
5210
5211                 * arm.cc (Target_arm::Target_arm): Move method definition
5212                 outside of class definition.  Add code to handle
5213                 --target1-rel, --target1-abs and --target2= options.
5214                 (Target_arm::get_reloc_reloc_type): Change method to be
5215                 non-static and const.
5216                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5217                 New data member declaration.
5218                 (Target_arm::Scan::local, Target_arm::Scan::global,
5219                 Target_arm::Relocate::relocate,
5220                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5221                 Adjust call to Target_arm::get_real_reloc_type.
5222                 (Target_arm::get_real_reloc_type): Use command line options
5223                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5224                 * options.h (--target1-rel, --target1-abs, --target2): New
5225                 ARM-only options.
5226
5227 2009-11-25  Doug Kwan  <dougkwan@google.com>
5228
5229         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5230         class definition.  Add code to handle --target1-rel, --target1-abs
5231         and --target2= options.
5232         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5233         and const.
5234         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5235         member declaration.
5236         (Target_arm::Scan::local, Target_arm::Scan::global,
5237         Target_arm::Relocate::relocate,
5238         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5239         call to Target_arm::get_real_reloc_type.
5240         (Target_arm::get_real_reloc_type): Use command line options to
5241         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5242         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5243         options.
5244
5245 2009-11-25  Doug Kwan  <dougkwan@google.com>
5246
5247         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5248         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5249         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5250         formatting.
5251         (Arm_relocate_functions::thm_call): Replace body with a call to
5252         Arm_relocate_functions::thumb_branch_common.
5253         (Arm_relocate_functions::thm_jump24,
5254         Arm_relocate_functions::thm_xpc22): New method definitions.
5255         (Arm_relocate_functions::thumb_branch_common): New method definition.
5256         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5257         operator.
5258         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5259         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5260
5261 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5262
5263         * Makefile.am: Build incremental-dump
5264         * Makefile.in: Regenerate.
5265         * incremental-dump.cc: New.
5266         * incremental.cc (Incremental_inputs_header_data,
5267         Incremental_inputs_entry_data): Move to incremental.h
5268         * incremental.h: (Incremental_inputs_header_data,
5269         Incremental_inputs_entry_data): Move from incremental.cc
5270
5271 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5272
5273         * incremental.cc (Incremental_inputs_header,
5274         Incremental_inputs_header_write, Incremental_inputs_entry,
5275         Incremental_inputs_entry_write): Add a typedef with the data type.
5276
5277 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5278
5279         * incremental.cc (Incremental_inputs_header,
5280         Incremental_inputs_header_write, Incremental_inputs_entry,
5281         Incremental_inputs_entry_write): Update comment about which
5282         type has the filed descriptions.
5283
5284 2009-11-15  Doug Kwan  <dougkwan@google.com>
5285
5286         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5287         (Arm_relocate_functions::arm_branch_common): Change method defintion
5288         in class definition to a method declaration and update list of formal
5289         parameters.
5290         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5291         Arm_relocation_functions::jump24): Adjust call to
5292         Arm_relocate_functions::arm_branch_common.  Update list of formal
5293         parameters.
5294         (Arm_relocate_functions::xpc25): New method definition.
5295         (Arm_relocate_functions::arm_branch_common): Move method defintion
5296         out from class definition.  Use stubs for mode-switching and extending
5297         branch ranges.
5298         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5299         specially.  Change code to enable use of stubs in ARM branches.
5300
5301 2009-11-10  Doug Kwan  <dougkwan@google.com>
5302
5303         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5304         in method declaration.
5305         (Target_arm::relocate_stub): New method declaration.
5306         (Target_arm::default_target): Change to return a pointer instead of
5307         a const reference.
5308         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5309         Target_arm::default_target.
5310         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5311         method definition.
5312         (Target_arm::relocate_section): Adjust view.
5313         (Target_arm::relocate_stub): New method definition.
5314
5315 2009-11-10  Doug Kwan  <dougkwan@google.com>
5316
5317         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5318         a format warning.
5319         * incremental.cc (open_incremental_binary): Initialized local
5320         variables to avoid warnings.
5321         * object.cc (make_elf_object): Ditto.
5322         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5323         a format warning.
5324
5325 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5326
5327         PR gold/10930
5328         * testsuite/plugin_test.c: Include "config.h".
5329
5330 2009-11-09  Doug Kwan  <dougkwan@google.com>
5331
5332         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5333         (arm_symbol_value): Remove.
5334         (Arm_relocate_functions::arm_branch_common,
5335         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5336         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5337         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5338         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5339         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5340         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5341         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5342         Arm_relocate_functions::thm_mobw_abs_nc,
5343         Arm_relocate_functions::thm_mov_abs,
5344         Arm_relocate_functions::movw_prel_nc,
5345         Arm_relocate_functions::thm_movt_abs,
5346         Arm_relocate_functions::movt_prel,
5347         Arm_relocate_functions::thm_movw_prel_nc,
5348         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5349         (Target_arm::Relocate::relocate): Only decompose address into two
5350         parts if relocation type uses the thumb-bit and pass the actual
5351         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5352         calls to methods in Arm_relocate_functions for this change.
5353
5354 2009-11-08  Ian Lance Taylor  <iant@google.com>
5355
5356         PR 10925
5357         * reloc.cc: Instantiate
5358         Sized_relobj::initialize_input_to_output_maps and
5359         Sized_relobj:free_input_to_output_maps.
5360
5361 2009-11-06  Ian Lance Taylor  <iant@google.com>
5362
5363         PR 10876
5364         * defstd.cc (in_segment): Set only_if_ref true for "end".
5365
5366 2009-11-06  Doug Kwan  <dougkwan@google.com>
5367
5368         * arm.cc (class Reloc_stub): Correct a comment.
5369         (Target_arm::Target_arm): Initialize arm_input_section_map_.
5370         (Target_arm::scan_section_for_stubs): New method declaration.
5371         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5372         Change methods from private to protected.
5373         (Target_arm::do_may_relax): New method definition.
5374         (Target_arm::do_relax, Target_arm::group_sections,
5375         Target_arm::scan_reloc_for_stub,
5376         Target_arm::scan_reloc_section_for_stubs): New method declarations.
5377         (Target_arm::arm_input_section_map_): New data member declaration.
5378         (Target_arm::scan_reloc_for_stub,
5379         Target_arm::scan_reloc_section_for_stubs,
5380         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5381         Target_arm::do_relax): New method definitions.
5382
5383 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
5384
5385         * configure.ac: Check for (struct stat)::st_mtim
5386         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5387         * config.in: Regenerate.
5388         * configure: Regenerate.
5389
5390 2009-11-05  Ian Lance Taylor  <iant@google.com>
5391
5392         PR 10910
5393         * output.cc (Output_segment::add_output_section): Add missing
5394         return statement.
5395
5396 2009-11-04  Ian Lance Taylor  <iant@google.com>
5397
5398         PR 10880
5399         * object.h (class Object): Add is_needed and set_is_needed
5400         methods.  Add is_needed_ field.  Make bool fields into bitfields.
5401         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5402         defined in a dynamic object and referenced by a regular object,
5403         set is_needed for the dynamic object.
5404         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5405         if the file is marked with as_needed and it is not needed.
5406
5407 2009-11-04  Ian Lance Taylor  <iant@google.com>
5408
5409         PR 10887
5410         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5411         tags if data is discarded by linker script.
5412         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5413         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5414         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5415         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5416
5417 2009-11-04  Ian Lance Taylor  <iant@google.com>
5418
5419         * layout.cc (Layout::get_output_section): Add is_interp and
5420         is_dynamic_linker_section parameters.  Change all callers.
5421         (Layout::choose_output_section): Likewise.
5422         (Layout::make_output_section): Likewise.
5423         (Layout::add_output_section_data): Add is_dynamic_linker_section
5424         parameter.  Change all callers.
5425         * layout.h (class Layout): Update declarations.
5426         * output.h (class Output_section): Add is_interp, set_is_interp,
5427         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5428         Add is_interp_, is_dynamic_linker_section_ fields.  Change
5429         generate_code_fills_at_write_ to a bitfield.
5430         * output.cc (Output_section::Output_sections): Initialize new
5431         fields.
5432         (Output_segment::add_output_section): Add do_sort parameter.
5433         Change all callers.
5434
5435 2009-11-03  Ian Lance Taylor  <iant@google.com>
5436
5437         PR 10860
5438         * options.h (class General_options): Add --warn-common.
5439         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5440         merging two common symbols.
5441         (Symbol_table::should_override): Handle --warn-common when merging
5442         a common symbol with a defined symbol.  Use report_resolve_problem
5443         for multiple definitions.
5444         (Symbol_table::report_resolve_problem): New function.
5445         * symtab.h (class Symbol_table): Declare report_resolve_problem.
5446
5447 2009-11-03  Doug Kwan  <dougkwan@google.com>
5448
5449         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5450         stub_factory_.
5451         (Target_arm::stub_factory): New method definition.
5452         (Target_arm::new_arm_input_section,
5453         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5454         Target_arm::reloc_uses_thumb_bit): New method declarations.
5455         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5456         New type definitions.
5457         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5458         member declarations.
5459         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5460         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5461         New method definitions.
5462
5463 2009-11-03  Ian Lance Taylor  <iant@google.com>
5464
5465         * options.h (class General_options): Add --warn_constructors.
5466
5467 2009-11-03  Ian Lance Taylor  <iant@google.com>
5468
5469         PR 10893
5470         * defstd.cc (in_section): Add entries for __rel_iplt_start,
5471         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5472
5473 2009-11-03  Ian Lance Taylor  <iant@google.com>
5474
5475         PR 10895
5476         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5477         --msgid-bugs-address.
5478         (install-pdf): New target.
5479         (install-data_yes): Look up one directory to find mkinstalldirs.
5480
5481 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
5482
5483         * po/Make-in (.po.gmo): Don't generate .gmo files in source
5484         tree.
5485
5486 2009-10-30  Doug Kwan  <dougkwan@google.com>
5487
5488         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5489
5490 2009-10-30  Doug Kwan  <dougkwan@google.com>
5491
5492         * arm.cc (Stub_addend_reader): New struct template definition
5493         and partial specializations.
5494         (Stub_addend_reader::operator()): New method definition for a
5495         partially specialized template.
5496
5497 2009-10-30  Doug Kwan  <dougkwan@google.com>
5498
5499         * arm.cc (Arm_relobj::processor_specific_flags): New method
5500         definition.
5501         (Arm_relobj::do_read_symbols): New method declaration.
5502         (Arm_relobj::processor_specific_flags_): New data member declaration.
5503         (Arm_dynobj): New class definition.
5504         (Target_arm::do_finalize_sections): Add input_objects parameter.
5505         (Target_arm::do_adjust_elf_header): New method declaration.
5506         (Target_arm::are_eabi_versions_compatible,
5507         (Target_arm::merge_processor_specific_flags): New method declaration.
5508         (Target_arm::do_make_elf_object): New overloaded method definitions
5509         and declaration.
5510         (Arm_relobj::do_read_symbols): New method definition.
5511         (Arm_dynobj::do_read_symbols): Ditto.
5512         (Target_arm::do_finalize_sections): Add input_objects parameters.
5513         Merge processor-specific flags from all input objects.
5514         (Target_arm::are_eabi_versions_compatible,
5515         Target_arm::merge_processor_specific_flags,
5516         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5517         New method definitions.
5518         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5519         Input_objects pointer type parameter.
5520         * layout.cc (Layout::finalize): Pass input objects to target's.
5521         finalize_sections function.
5522         * output.cc (Output_file_header::do_sized_write): Set ELF file
5523         header's processor-specific flags.
5524         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5525         Input_objects pointer type parameter.
5526         * sparc.cc (Target_sparc::do_finalize_sections): Same.
5527         * target.h (Input_objects): New forward class declaration.
5528         (Target::processor_specific_flags,
5529         Target::are_processor_specific_flags_sect): New method definitions.
5530         (Target::finalize_sections): Add input_objects parameter.
5531         (Target::Target): Initialize processor_specific_flags_ and
5532         are_processor_specific_flags_set_.
5533         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5534         parameter.
5535         (Target::set_processor_specific_flags): New method definition.
5536         (Target::processor_specific_flags_,
5537         Target::are_processor_specific_flags_set_): New data member
5538         declarations.
5539         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5540         Input_objects pointer type parameter.
5541
5542 2009-10-30  Doug Kwan  <dougkwan@google.com>
5543
5544         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5545
5546 2009-10-28  Ian Lance Taylor  <iant@google.com>
5547
5548         * object.h (class Relobj): Drop options parameter from
5549         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5550         do_scan_relocs, do_relocate.  Change all callers.
5551         (class Sized_relobj): Drop options parameters from
5552         do_gc_process_relocs, do_scan_relocs, do_relocate,
5553         do_relocate_sections, relocate_sections, emit_relocs_scan,
5554         emit_relocs_scan_reltype.  Change all callers.
5555         (struct Relocate_info): Remove options field and all references to
5556         it.
5557         * reloc.h (class Read_relocs): Remove options constructor
5558         parameter and options_ field.  Change all callers.
5559         (class Gc_process_relocs, class Scan_relocs): Likewise.
5560         (class Relocate_task): Likewise.
5561         * target-reloc.h (scan_relocs): Remove options parameter.  Change
5562         all callers.
5563         (scan_relocatable_relocs): Likewise.
5564         * target.h (class Sized_target): Remove options parameter from
5565         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
5566         all callers.
5567         * gc.h (gc_process_relocs): Remove options parameter.  Change all
5568         callers.
5569         * arm.cc: Update functions to remove options parameters.
5570         * i386.cc: Likewise.
5571         * powerpc.cc: Likewise.
5572         * sparc.cc: Likewise.
5573         * x86_64.cc: Likewise.
5574         * testsuite/testfile.cc: Likewise.
5575
5576 2009-10-28  Doug Kwan  <dougkwan@google.com>
5577
5578         * arm.cc (Arm_relobj): New class definition.
5579         (Arm_relobj::scan_sections_for_stubs,
5580         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5581         New method definitions.
5582
5583 2009-10-28  Cary Coutant  <ccoutant@google.com>
5584
5585         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5586         (Plugin::cleanup_done_): New member.
5587         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5588         (Plugin_manager::cleanup_done_): Remove.
5589         (Plugin_manager::add_input_file): Edit error message.
5590         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5591         (Plugin_manager::cleanup): Remove use of cleanup_done_.
5592
5593 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
5594
5595         * fileread.cc: (File_read::View::~View): Use the new
5596         data_ownership_ filed.
5597         (File_read::~File_read): Dispose the new whole_file_view_.
5598         (File_read::open): Mmap the whole file if needed.
5599         (File_read::open): Use whole_file_view_ instead of contents_.
5600         (File_read::find_view): Use whole_file_view_ if applicable.
5601         (File_read::do_read): Use whole_file_view_ instead of contents_.
5602         (File_read::make_view): Use whole_file_view_ instead of contents_,
5603         update File_read::View::View call.
5604         (File_read::find_or_make_view): Update File_read::View::View
5605         call.
5606         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5607         remove contents_
5608         (File_read::View::Data_ownership): New enum.
5609         (File_read::View::View): Replace bool mapped_ with Data_ownership
5610         argument.
5611         (File_read::View::mapped_): Remove (replaced by data_ownership_).
5612         (File_read::View::data_ownership_): New field.
5613         (File_read::contents_): Remove (replaced by whole_file_view_).
5614         (File_read::whole_file_view_): New field.
5615         * options.h (class General_options): Add --keep-files-mapped.
5616
5617 2009-10-27  Cary Coutant  <ccoutant@google.com>
5618
5619         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5620         * testsuite/Makefile.am (plugin_test_5): New test case.
5621         * testsuite/Makefile.in: Regenerate.
5622
5623 2009-10-25  Doug Kwan  <dougkwan@google.com>
5624
5625         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5626         from private to protected to allow access by child class.
5627         (Sized_relobj::do_relocate_sections): New method declaration.
5628         (Sized_relobj::relocate_sections): Virtualize.
5629         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5630         Sized_relobj::relocate_sections.  Instantiate template explicitly
5631         for different target sizes and endianity.
5632
5633 2009-10-24  Doug Kwan  <dougkwan@google.com>
5634
5635         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5636         (Arm_input_section::as_arm_input_section): New method.
5637         (Arm_output_section): New class definition.
5638         (Arm_output_section::create_stub_group,
5639         Arm_output_section::group_sections): New method definitions.
5640
5641 2009-10-22  Doug Kwan  <dougkwan@google.com>
5642
5643         * arm.cc (Arm_input_section): New class definition.
5644         (Arm_input_section::init, Arm_input_section:do_write,
5645         Arm_input_section::set_final_data_size,
5646         Arm_input_section::do_reset_address_and_file_offset): New method
5647         definitions.
5648
5649 2009-10-21  Doug Kwan  <dougkwan@google.com>
5650
5651         * arm.cc (Stub_table, Arm_input_section): New forward class
5652         declarations.
5653         (Stub_table): New class defintion.
5654         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5655         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5656         New method definition.
5657
5658 2009-10-21  Doug Kwan  <dougkwan@google.com>
5659
5660         * arm.cc: Update copyright comments.
5661         (Target_arm): New forward class template declaration.
5662         (Arm_address): New type.
5663         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5664         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5665         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5666         constants.
5667         (Insn_template): Same.
5668         (DEF_STUBS): New macro.
5669         (Stub_type): New enum type.
5670         (Stub_template): New class definition.
5671         (Stub): Same.
5672         (Reloc_stub): Same.
5673         (Stub_factory): Same.
5674         (Target_arm::Target_arm): Initialize may_use_blx_ and
5675         should_force_pic_veneer_.
5676         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5677         Target_arm::should_force_pic_veneer,
5678         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5679         Target_arm::using_thumb_only, Target_arm:;default_target): New
5680         method defintions.
5681         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5682         New data member declarations.
5683         (Insn_template::size, Insn_template::alignment): New method defintions.
5684         (Stub_template::Stub_template): New method definition.
5685         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5686         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5687         (Stub_factory::Stub_factory): New method definition.
5688         * gold.h (string_hash): New template.
5689         * output.h (Input_section_specifier::hash_value): Use
5690         gold::string_hash.
5691         (Input_section_specifier::string_hash): Remove.
5692         * stringpool.cc (Stringpool_template::string_hash): Use
5693         gold::string_hash.
5694
5695 2009-10-20  Doug Kwan  <dougkwan@google.com>
5696
5697         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5698         symbols of relaxed input sections.
5699         * output.h (Output_section::find_relaxed_input_section): Make
5700         method public.
5701
5702 2009-10-16  Doug Kwan  <dougkwan@google.com>
5703
5704         * dynobj.cc (Versions::Versions): Initialize version_script_.
5705         Only insert base version symbol definition for a shared object
5706         if version script defines any version versions.
5707         (Versions::define_base_version): New method definition.
5708         (Versions::add_def): Check that base version is not needed.
5709         (Versions::add_need): Define base version lazily.
5710         * dynobj.h (Versions::define_base_version): New method declaration.
5711         (Versions::needs_base_version_): New data member declaration.
5712         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5713         (check_DATA): Add no_version_test.stdout.
5714         (libno_version_test.so, no_version_test.o no_version_test.stdout):
5715         New make rules.
5716         * testsuite/Makefile.in: Regenerate.
5717         * testsuite/no_version_test.c: New file.
5718         * testsuite/no_version_test.sh: Ditto.
5719
5720 2009-10-16  Doug Kwan  <dougkwan@google.com>
5721
5722         * expression.cc (class Segment_start_expression): New class definition.
5723         (Segment_start_expression::value): New method definition.
5724         (script_exp_function_segment_start): Return a new
5725         Segment_start_expression.
5726         * gold/script-c.h (script_saw_segment_start_expression): New function
5727         prototype.
5728         * script-sections.cc (Script_sections::Script_sections): Initialize
5729         SAW_SEGMENT_START_EXPRESSION_ to false.
5730         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5731         and -Tbbs options to specify section addresses if given in
5732         command line and no SEGMENT_START expression is seen in a script.
5733         * script-sections.h (Script_sections::saw_segment_start_expression,
5734         Script_sections::set_saw_segment_start_expression): New method
5735         definition.
5736         (Script_sections::saw_segment_start_expression_): New data member
5737         declaration.
5738         * script.cc (script_saw_segment_start_expression): New function.
5739         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5740         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5741         script_test_7.sh and script_test_8.sh.
5742         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5743         script_test_8.stdout.
5744         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5745         (script_test_6, script_test_6.stdout, script_test_7,
5746         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5747         * Makefile.in: Regenerate.
5748         * testsuite/script_test_6.sh: New file.
5749         * testsuite/script_test_6.t: Same.
5750         * testsuite/script_test_7.sh: Same.
5751         * testsuite/script_test_7.t: Same.
5752         * testsuite/script_test_8.sh: Same.
5753
5754 2009-10-16  Doug Kwan  <dougkwan@google.com>
5755
5756         * output.cc (Output_segment::set_section_list_address): Cast
5757         expressions to unsigned long long type to avoid format warnings.
5758
5759 2009-10-15  Ian Lance Taylor  <iant@google.com>
5760
5761         * script.cc (Script_options::add_symbol_assignment): Always add a
5762         dot assignment to script_sections_.
5763         * script-sections.cc (Script_sections::add_dot_assignment):
5764         Initialize if necessary.
5765
5766         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5767         program headers with no load segment if there is a linker script.
5768
5769         * layout.cc (Layout::set_segment_offsets): Align the file offset
5770         to the segment aligment for -N or -n with no load segment.
5771         * output.cc (Output_segment::add_output_section): Don't crash if
5772         the first section is a TLS section.
5773         (Output_segment::set_section_list_addresses): Print an error
5774         message if the address moves backward in a linker script.
5775         * script-sections.cc
5776         (Output_section_element_input::set_section_addresses): Don't
5777         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5778         (Orphan_output_section::set_section_addresses): Likewise.
5779
5780 2009-10-15  Doug Kwan  <dougkwan@google.com>
5781
5782         * layout.cc (Layout::finish_dynamic_section): Generate tags
5783         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5784         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5785         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5786
5787 2009-10-14  Ian Lance Taylor  <iant@google.com>
5788
5789         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5790         fields.
5791         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5792         data_shdr fields of relinfo.
5793         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5794         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
5795         R_386_TLS_LDO_32, adjust based on section flags.
5796         (Target_i386::Relocate::fix_up_ldo): Remove.
5797
5798 2009-10-13  Ian Lance Taylor  <iant@google.com>
5799
5800         Add support for -pie.
5801         * options.h (class General_options): Add -pie and
5802         --pic-executable.
5803         (General_options::output_is_position_independent): Test -pie.
5804         (General_options::output_is_executable): Return true if not shared
5805         and not relocatable.
5806         (General_options::output_is_pie): Remove.
5807         * options.cc (General_options::finalize): Reject incompatible uses
5808         of -pie.
5809         * gold.cc (queue_middle_tasks): A -pie link is not static.
5810         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5811         * symtab.cc (Symbol::final_value_is_known): Return false if
5812         output_is_position_independent.
5813         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5814         output_is_position_independent.
5815         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5816         output_is_position_independent.
5817         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5818         output_is_position_independent.
5819         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5820         two_file_pie_test.
5821         (basic_pie_test.o, basic_pie_test): New targets.
5822         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5823         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5824         (two_file_pie_test): New target.
5825         * testsuite/Makefile.in: Rebuild.
5826         * README: Remove note saying that -pie is not supported.
5827
5828 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
5829
5830         * options.h (class General_options): Add -init and -fini.
5831         * layout.cc (Layout::finish_dynamic_section): Emit
5832         given init and fini functions.
5833
5834 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
5835
5836         * gc.h (gc_process_relocs): Check if icf is enabled using new
5837         function.
5838         * gold.cc (queue_initial_tasks): Likewise.
5839         (queue_middle_tasks): Likewise.
5840         * object.cc (do_layout): Likewise.
5841         * symtab.cc (is_section_folded): Likewise.
5842         * main.cc (main): Likewise.
5843         * reloc.cc (Read_relocs::run): Likewise.
5844         (Sized_relobj::do_scan_relocs): Likewise.
5845         * icf.cc (is_function_ctor_or_dtor): New function.
5846         (Icf::find_identical_sections): Check if function is ctor or dtor when
5847         safe icf is chosen.
5848         * options.h (General_options::icf): Change option to be an enum.
5849         (Icf_status): New enum.
5850         (icf_enabled): New method.
5851         (icf_safe_folding): New method.
5852         (set_icf_status): New method.
5853         (icf_status_): New variable.
5854         * (options.cc) (General_options::finalize): Set icf_status_.
5855         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5856         icf_test and icf_keep_unique_test to use the --icf enum flag.
5857         * testsuite/icf_safe_test.sh: New file.
5858         * testsuite/icf_safe_test.cc: New file.
5859
5860 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
5861
5862         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5863         includes to gc.h and icf.h.
5864         * arm.cc: Include gc.h.
5865         * gold.cc: Likewise.
5866         * i386.cc: Likewise.
5867         * powerpc.cc: Likewise.
5868         * sparc.cc: Likewise.
5869         * x86_64.cc: Likewise.
5870         * gc.h: Include icf.h.
5871
5872 2009-10-11  Ian Lance Taylor  <iant@google.com>
5873
5874         * plugin.cc: Include "gold.h" before other header files.
5875
5876 2009-10-10  Chris Demetriou  <cgd@google.com>
5877
5878         * options.h (Input_file_argument::Input_file_type): New enum.
5879         (Input_file_argument::is_lib_): Replace with...
5880         (Input_file_argument::type_): New member.
5881         (Input_file_argument::Input_file_argument): Take Input_file_type
5882         'type' rather than boolean 'is_lib' as second argument.
5883         (Input_file_argument::is_lib): Use type_.
5884         (Input_file_argument::is_searched_file): New function.
5885         (Input_file_argument::may_need_search): Handle is_searched_file.
5886         * options.cc (General_options::parse_library): Support -l:filename.
5887         (General_options::parse_just_symbols): Update for Input_file_argument
5888         changes.
5889         (Command_line::process): Likewise.
5890         * archive.cc (Archive::get_file_and_offset): Likewise.
5891         * plugin.cc (Plugin_manager::release_input_file): Likewise.
5892         * script.cc (read_script_file, script_add_file): Likewise.
5893         * fileread.cc (Input_file::Input_file): Likewise.
5894         (Input_file::will_search_for): Handle is_searched_file.
5895         (Input_file::open): Likewise.
5896         * readsyms.cc (Read_symbols::get_name): Likewise.
5897         * testsuite/Makefile.am (searched_file_test): New test.
5898         * testsuite/Makefile.in: Regenerate.
5899         * testsuite/searched_file_test.cc: New file.
5900         * testsuite/searched_file_test_lib.cc: New file.
5901
5902 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
5903             Ian Lance Taylor  <iant@google.com>
5904
5905         * descriptor.cc: Include <cstdio> and "binary-io.h".
5906         (Descriptors::open): Open the files in binary mode always.
5907         * script.cc (Lex::get_token): Treat \r as whitespace.
5908
5909 2009-10-09  Ian Lance Taylor  <iant@google.com>
5910
5911         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5912
5913 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
5914             Ian Lance Taylor  <iant@google.com>
5915
5916         * configure.ac: Check for readv function also.
5917         * fileread.cc (readv): Define if not HAVE_READV.
5918         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5919         does not exist.
5920         * config.in: Regenerate.
5921         * configure: Regenerate.
5922
5923 2009-10-09  Doug Kwan  <dougkwan@google.com>
5924
5925         * layout.cc (Layout::make_output_section): Call target hook to make
5926         ordinary output section.
5927         (Layout::finalize): Adjust parameter list of call the
5928         Target::may_relax().
5929         * layout.h (class Layout::section_list): New method.
5930         * merge.h (Output_merge_base::entsize): Change visibility to public.
5931         (Output_merge_base::is_string, Output_merge_base::do_is_string):
5932         New methods.
5933         (Output_merge_string::do_is_string): New method.
5934         * object.cc (Sized_relobj::do_setup): renamed from
5935         Sized_relobj::set_up.
5936         * object.h (Sized_relobj::adjust_shndx,
5937         Sized_relobj::initializ_input_to_output_maps,
5938         Sized_relobj::free_input_to_output_maps): Change visibilities to
5939         protected.
5940         (Sized_relobj::setup): Virtualize.
5941         (Sized_relobj::do_setup): New method declaration.
5942         (Sized_relobj::invalidate_section_offset,
5943         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5944         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5945         * options.cc (parse_int): New function.
5946         * options.h (parse_int): New declaration.
5947         (DEFINE_int): New macro.
5948         (stub_group_size): New option.
5949         * output.cc (Output_section::Output_section): Initialize memebers
5950         merge_section_map_, merge_section_by_properties_map_,
5951         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5952         (Output_section::add_input_section): Handled deferred code-fill
5953         generation and remove an old comment.
5954         (Output_section::add_relaxed_input_section): New method definition.
5955         (Output_section::add_merge_input_section): Use merge section by
5956         properties map to speed to search.  Update merge section maps
5957         as appropriate.
5958         (Output_section::build_relaxation_map): New method definition.
5959         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5960         Same.
5961         (Output_section::relax_input_section): Renamed to
5962         Output_section::convert_input_sections_to_relaxed_sections and change
5963         interface to take a vector of pointers to relaxed sections.
5964         (Output_section::find_merge_section,
5965         Output_section::find_relaxed_input_section): New method definitions.
5966         (Output_section::is_input_address_mapped,
5967         Output_section::output_offset, Output_section::output_address):
5968         Use output section data maps to speed up searching.
5969         (Output_section::find_starting_output_address): Add comments.
5970         (Output_section::do_write,
5971         Output_section::write_to_postprocessing_buffer): Do code-fill
5972         generation as appropriate.
5973         (Output_section::get_input_sections): Invalidate relaxed input section
5974         map.
5975         (Output_section::restore_states): Adjust type of checkpoint .
5976         Invalidate relaxed input section map.
5977         * output.h (Output_merge_base): New class declaration.
5978         (Input_section_specifier): New class defintion.
5979         (class Output_relaxed_input_section) Change base class to
5980         Output_section_data_build.
5981         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5982         base class initializer.
5983         (Output_section::add_relaxed_input_section): New method declaration.
5984         (Output_section::Input_section): Change visibility to protected.
5985         (Output_section::Input_section::relobj,
5986         Output_section::Input_section::shndx): Handle relaxed input sections.
5987         Output_section::input_sections) Change visibility to protected.  Also
5988         define overload to return a non-const pointer.
5989         (Output_section::Merge_section_properties): New class defintion.
5990         (Output_section::Merge_section_by_properties_map,
5991         Output_section::Output_section_data_by_input_section_map,
5992         Output_section::Relaxation_map): New types.
5993         (Output_section::relax_input_section): Rename method to
5994         Output_section::convert_input_sections_to_relaxed_sections and change
5995         interface to take a vector of relaxed section pointers.
5996         (Output_section::find_merge_section,
5997         Output_section::find_relaxed_input_section,
5998         Output_section::build_relaxation_map,
5999         Output_section::convert_input_sections_in_list_to_relaxed_sections):
6000         New method declarations.
6001         (Output_section::merge_section_map_
6002         Output_section::merge_section_by_properties_map_,
6003         Output_section::relaxed_input_section_map_,
6004         Output_section::is_relaxed_input_section_map_valid_,
6005         Output_section::generate_code_fills_at_write_): New data members.
6006         * script-sections.cc
6007         (Output_section_element_input::set_section_addresses): Call
6008         current_data_size and addralign methods of relaxed input sections.
6009         (Orphan_output_section::set_section_addresses): Call current_data_size
6010         and addralign methods of relaxed input sections.
6011         * symtab.cc (Symbol_table::compute_final_value): Extract template
6012         from the body of Symbol_table::sized_finalize_symbol.
6013         (Symbol_table::sized_finalized_symbol): Call
6014         Symbol_table::compute_final_value.
6015         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6016         (Symbol_table::compute_final_value): New templated method declaration.
6017         * target.cc (Target::do_make_output_section): New method defintion.
6018         * target.h (Target::make_output_section): New method declaration.
6019         (Target::relax): Add more parameters for input objects, symbol table
6020         and layout.  Adjust call to do_relax.
6021         (Target::do_make_output_section): New method declaration.
6022         (Target::do_relax): Add parameters for input objects, symbol table
6023         and layout.
6024
6025 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6026
6027         * pread.c: Include stdio.h.
6028
6029 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6030
6031         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6032         defined.
6033
6034 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6035
6036         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6037         Change read_shndx type to unsigned int.
6038         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6039         int.
6040         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6041         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6042         Change read_shndx type to unsigned int.
6043         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6044         int.
6045         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6046         * layout.cc (Layout::create_symtab_sections): Cast the result of
6047         local_symcount * symsize to off_t in the gold_assert.
6048
6049 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6050
6051         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6052         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6053         R_ARM_BASE_ABS.
6054         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6055         (Arm_relocate_functions::thm_abs5): New function.
6056         (Arm_relocate_functions::abs12): New function.
6057         (Arm_relocate_functions::abs16): New function.
6058         (Arm_relocate_functions::base_abs): New function.
6059         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6060         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6061         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6062         R_ARM_BASE_ABS.
6063         (Scan::global): Likewise.
6064         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6065         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6066         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6067         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6068         R_ARM_BASE_ABS.
6069
6070 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6071
6072         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6073         (Arm_relocate_functions::movt_prel): New function.
6074         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6075         (Arm_relocate_functions::thm_movt_prel): New function.
6076         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6077         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6078         (Scan::global, Relocate::relocate): Likewise.
6079         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6080
6081 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6082
6083         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6084         Incremental_checker.
6085         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6086         unsigned int.
6087         (class Incremental_inputs_header): New class.
6088         (Incremental_inputs_header_writer): Edit comment.
6089         (Incremental_inputs_entry): New class.
6090         (Incremental_inputs_entry_writer): Edit comment.
6091         (Sized_incremental_binary::do_find_incremental_inputs_section):
6092         Add *strtab_shndx parameter, fill it.
6093         (Sized_incremental_binary::do_check_inputs): New method.
6094         (Incremental_checker::can_incrementally_link_output_file): Use
6095         Sized_incremental_binary::check_inputs.
6096         (Incremental_inputs::report_command_line): Save command line in
6097         command_line_.
6098         * incremental.h:
6099         (Incremental_binary::find_incremental_inputs_section): New
6100         method.
6101         (Incremental_binary::do_find_incremental_inputs_section): Add
6102         strtab_shndx parameter.
6103         (Incremental_binary::do_check_inputs): New pure virtual method.
6104         (Sized_incremental_binary::do_check_inputs): Declare.
6105         (Incremental_checker::Incremental_checker): Add incremental_inputs
6106         parameter, use it to initialize incremental_inputs_.
6107         (Incremental_checker::incremental_inputs_): New field.
6108         (Incremental_checker::command_line): New method.
6109         (Incremental_checker::inputs): New method.
6110         (Incremental_checker::command_line_): New field.
6111
6112 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6113
6114         * incremental.cc: Include <cstdarg> and "target-select.h".
6115         (vexplain_no_incremental): New function.
6116         (explain_no_incremental): New function.
6117         (Incremental_binary::error): New method.
6118         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6119         method.
6120         (make_sized_incremental_binary): New function.
6121         (open_incremental_binary): New function.
6122         (can_incrementally_link_file): Add checks if output is ELF and has
6123         inputs section.
6124         * incremental.h: Include "elfcpp_file.h" and "output.h".
6125         (Incremental_binary): New class.
6126         (Sized_incremental_binary): New class.
6127         (open_incremental_binary): Declare.
6128         * object.cc (is_elf_object): Use
6129         elfcpp::Elf_recognizer::is_elf_file.
6130         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6131         * output.h (Output_file::filesize): New method.
6132
6133 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6134
6135         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6136         New function.
6137         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6138         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6139         function.
6140         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6141         function.
6142         (Arm_relocate_functions::movw_abs_nc): New function.
6143         (Arm_relocate_functions::movt_abs): New function.
6144         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6145         (Arm_relocate_functions::thm_movt_abs): New function.
6146         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6147         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6148         (Scan::global): Likewise.
6149         (Relocate::relocate): Likewise.
6150         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6151
6152 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6153
6154         * arm.cc (Arm_relocate_functions::got_prel) New function.
6155         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6156         (Relocate::relocate): Likewise.
6157         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6158
6159 2009-10-06  Ian Lance Taylor  <iant@google.com>
6160
6161         * options.h (class General_options): Define
6162         split_stack_adjust_size parameter.
6163         * object.h (class Object): Add uses_split_stack_ and
6164         has_no_split_stack_ fields.  Add uses_split_stack and
6165         has_no_split_stack accessor functions.  Declare
6166         handle_split_stack_section.
6167         (class Reloc_symbol_changes): Define.
6168         (class Sized_relobj): Define Function_offsets.  Declare
6169         split_stack_adjust, split_stack_adjust_reltype, and
6170         find_functions.
6171         * object.cc (Object::handle_split_stack_section): New function.
6172         (Sized_relobj::do_layout): Call handle_split_stack_section.
6173         * dynobj.cc (Sized_dynobj::do_layout): Call
6174         handle_split_stack_section.
6175         * reloc.cc (Sized_relobj::relocate_sections): Call
6176         split_stack_adjust for executable sections in split_stack
6177         objects.  Pass reloc_map to relocate_section.
6178         (Sized_relobj::split_stack_adjust): New function.
6179         (Sized_relobj::split_stack_adjust_reltype): New function.
6180         (Sized_relobj::find_functions): New function.
6181         * target-reloc.h: Include "object.h".
6182         (relocate_section): Add reloc_symbol_changes parameter.  Change
6183         all callers.
6184         * target.h (class Target): Add calls_non_split method.  Declare
6185         do_calls_non_split virtual method.  Declare match_view and
6186         set_view_to_nop.
6187         * target.cc: Include "elfcpp.h".
6188         (Target::do_calls_non_split): New function.
6189         (Target::match_view): New function.
6190         (Target::set_view_to_nop): New function.
6191         * gold.cc (queue_middle_tasks): Give an error if mixing
6192         split-stack and non-split-stack objects with -r.
6193         * i386.cc (Target_i386::relocate_section): Add
6194         reloc_symbol_changes parameter.
6195         (Target_i386::do_calls_non_split): New function.
6196         * x86_64.cc (Target_x86_64::relocate_section): Add
6197         reloc_symbol_changes parameter.
6198         (Target_x86_64::do_calls_non_split): New function.
6199         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6200         parameter.
6201         * powerpc.cc (Target_powerpc::relocate_section): Add
6202         reloc_symbol_changes parameter.
6203         * sparc.cc (Target_sparc::relocate_section): Add
6204         reloc_symbol_changes parameter.
6205         * configure.ac: Call AM_CONDITIONAL for the default target.
6206         * configure: Rebuild.
6207         * testsuite/Makefile.am (TEST_AS): New variable.
6208         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6209         (check_DATA): Add split_i386 and split_x86_64 files.
6210         (SPLIT_DEFSYMS): Define.
6211         (split_i386_[1234n].o): New targets.
6212         (split_i386_[124]): New targets.
6213         (split_i386_[1234r].stdout): New targets.
6214         (split_x86_64_[1234n].o): New targets.
6215         (split_x86_64_[124]): New targets.
6216         (split_x86_64_[1234r].stdout): New targets.
6217         (MOSTLYCLEANFILES): Add new executables.
6218         * testsuite/split_i386.sh: New file.
6219         * testsuite/split_x86_64.sh: New file.
6220         * testsuite/split_i386_1.s: New file.
6221         * testsuite/split_i386_2.s: New file.
6222         * testsuite/split_i386_3.s: New file.
6223         * testsuite/split_i386_4.s: New file.
6224         * testsuite/split_i386_n.s: New file.
6225         * testsuite/split_x86_64_1.s: New file.
6226         * testsuite/split_x86_64_2.s: New file.
6227         * testsuite/split_x86_64_3.s: New file.
6228         * testsuite/split_x86_64_4.s: New file.
6229         * testsuite/split_x86_64_n.s: New file.
6230         * testsuite/testfile.cc (Target_test): Update relocation_section
6231         function.
6232         * testsuite/Makefile.in: Rebuild.
6233
6234 2009-10-06  Ian Lance Taylor  <iant@google.com>
6235
6236         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6237         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6238         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6239         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6240         the address on ldo_addrs_.
6241         (Target_i386::Relocate::fix_up_ldo): New function.
6242
6243 2009-10-06   Rafael Espindola  <espindola@google.com>
6244
6245         * plugin.cc (add_input_library): New.
6246         (Plugin::load): Add add_input_library to tv.
6247         (Plugin_manager::add_input_file): Add the is_lib argument.
6248         (add_input_file): Update call to Plugin_manager::add_input_file.
6249         (add_input_library): New.
6250         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6251
6252 2009-09-30  Doug Kwan  <dougkwan@google.com>
6253
6254         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6255         symbol and call Symbol::may_need_copy_reloc to determine if
6256         a copy reloc is needed.
6257         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6258         nocopyreloc is given in command line.
6259         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6260         given in command line.
6261         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6262         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6263         of the removed Target_i386::may_need_copy_reloc.
6264         * options.h (copyreloc): New option with default value false.
6265         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6266         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6267         instead of the removed Target_powerpc::may_need_copy_reloc.
6268         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6269         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6270         instead of the removed Target_sparc::may_need_copy_reloc.
6271         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6272         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6273         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6274         instead of the removed Target_x86_64::may_need_copy_reloc.
6275
6276 2009-09-30  Ian Lance Taylor  <iant@google.com>
6277
6278         * object.h (class Object): Remove target_ field, and target,
6279         sized_target, and set_target methods.
6280         (Object::sized_target): Remove.
6281         (class Sized_relobj): Update declarations.  Remove sized_target.
6282         * object.cc (Sized_relobj::setup): Remove target parameter.
6283         Change all callers.
6284         (Input_objects::add_object): Don't do anything with the target.
6285         (make_elf_sized_object): Add punconfigured parameter.  Change all
6286         callers.  Set or test parameter target.
6287         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6288         Change all callers.
6289         * parameters.cc (Parameters::set_target): Change parameter type to
6290         be non-const.
6291         (Parameters::default_target): Remove.
6292         (set_parameters_target): Change parameter type to be non-const.
6293         (parameters_force_valid_target): New function.
6294         (parameters_clear_target): New function.
6295         * parameters.h (class Parameters): Update declarations.  Remove
6296         default_target method.  Add sized_target and clear_target
6297         methods.  Change target_ to be non-const.
6298         (set_parameters_target): Update declaration.
6299         (parameters_force_valid_target): Declare.
6300         (parameters_clear_target): Declare.
6301         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6302         as NULL if we aren't searching.
6303         (Add_symbols::run): Don't check for compatible target.
6304         * fileread.cc (Input_file::open_binary): Call
6305         parameters_force_valid_target.
6306         * gold.cc (queue_middle_tasks): Likewise.
6307         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6308         set_target on object.
6309         * dynobj.h (class Sized_dynobj): Update declarations.
6310         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6311         make_elf_object returns NULL.
6312         (Archive::include_member): Don't check whether object target is
6313         compatible.
6314         * output.cc (Output_section::add_input_section): Get target from
6315         parameters.
6316         (Output_section::relax_input_section): Likewise.
6317         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6318         parameters.
6319         (Sized_relobj::do_scan_relocs): Likewise.
6320         (Sized_relobj::relocate_sections): Likewise.
6321         * resolve.cc (Symbol_table::resolve): Likewise.
6322         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6323         parameter.  Change all callers.
6324         (Symbol_table::add_from_object): Get target from parameters.
6325         (Symbol_table::add_from_relobj): Don't check object target.
6326         (Symbol_table::add_from_dynobj): Likewise.
6327         (Symbol_table::define_special_symbol): Get target from
6328         parameters.
6329         * symtab.h (class Symbol_table): Update declaration.
6330         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6331         parameter.  Change all callers.  Clear parameter target.
6332         (Binary_test): Test target here.
6333         * testsuite/object_unittest.cc (gold_testsuite): Remove
6334         target_test_pointer parameter.  Change all callers.
6335         (Object_test): Test target here.
6336
6337 2009-09-26  Ian Lance Taylor  <iant@google.com>
6338
6339         * testsuite/initpri1.c: Don't try to use constructor priorities if
6340         compiling with gcc before 4.3.
6341
6342 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6343
6344         * testsuite/retain_symbols_file_test.sh (check_present): Change
6345         output file name to retain_symbols_file_test.stdout.
6346         (check_absent): Likewise.
6347
6348 2009-09-18  Craig Silverstein  <csilvers@google.com>
6349
6350         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6351         * options.cc: Include <cerrno> and <fstream>.
6352         (General_options::finalize): Parse -retain-symbols-file tag.
6353         * options.h: New flag.
6354         (General_options): New method should_retain_symbol, new
6355         variable symbols_to_retain.
6356         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6357         should_retain_symbol map.
6358         * testsuite/Makefile.am (retain_symbols_file_test): New test.
6359         * testsuite/Makefile.in: Regenerate.
6360         * testsuite/retain_symbols_file_test.sh: New file.
6361
6362 2009-09-18  Nick Clifton  <nickc@redhat.com>
6363
6364         * po/es.po: Updated Spanish translation.
6365
6366 2009-09-17  Doug Kwan  <dougkwan@google.com>
6367
6368         * debug.h (DEBUG_RELAXATION): New constant.
6369         (DEBUG_ALL): Add DEBUG_RELAXATION.
6370         (debug_string_to_enum): Add relaxation debug option.
6371         * layout.cc
6372         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6373         Layout::Relaxation_debug_check::read_sections,
6374         Layout::Relaxation_debug_check::read_sections): New method definitions.
6375         (Layout::Layout): Initialize data members
6376         record_output_section_data_from_scrips_,
6377         script_output_section_data_list_ and relaxation_debug_check_.
6378         (Layout::save_segments, Layout::restore_segments,
6379         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6380         Layout::relaxation_loop_body): New method definitions.
6381         (Layout::finalize): Support relaxation.  Move section layout code to
6382         Layout::relaxation_loop_body.
6383         (Layout::set_asection_address_from_script): Move code for orphan
6384         section placement out.
6385         (Layout::place_orphan_sections_in_script): New method definition.
6386         * layout.h (Output_segment_headers, Output_file_header):
6387         New forward class declarations.
6388         (Layout::~Layout): Define.
6389         (Layout::new_output_section_data_from_script): New method definition.
6390         (Layout::place_orphan_sections_in_script): New method declaration.
6391         (Layout::Segment_states): New type declaration.
6392         (Layout::save_segments, Layout::restore_segments,
6393         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6394         Layout::relaxation_loop_body): New method declarations.
6395         (Layout::Output_section_data_list): New type declaration.
6396         (Layout::Relaxation_debug_check): New class definition.
6397         (Layout::record_output_section_data_from_script_,
6398         Layout::script_output_section_data_list_, Layout::segment_states_,
6399         Layout::relaxation_debug_check_): New data members.
6400         * output.cc: (Output_section_headers::do_size): New method definition.
6401         (Output_section_headers::Output_section_headers): Move size
6402         computation to Output_section_headers::do_size.
6403         (Output_segment_headers::do_size): New method definition.
6404         (Output_file_header::Output_file_header): Move size computation to
6405         Output_file_header::do_size and call it.
6406         (Output_file_header::do_size): New method definition.
6407         (Output_data_group::Output_data_group): Adjust call to
6408         Output_section_data.
6409         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6410         (Output_symtab_xindex::do_write): Add array bound check.
6411         (Output_section::Input_section::print_to_mapfile): Handle
6412         RELAXED_INPUT_SECTION_CODE.
6413         (Output_section::Output_section): Initialize data member checkpoint_.
6414         (Output_section::~Output_section): Delete checkpoint object pointed
6415         by checkpoint_.
6416         (Output_section::add_input_section): Always add an Input_section if
6417         relaxing.
6418         (Output_section::add_merge_input_section): Add assert.
6419         (Output_section::relax_input_section): New method definition.
6420         (Output_section::set_final_data_size): Set load address to zero for
6421         an unallocated section.
6422         (Output_section::do_address_and_file_offset_have_reset_values):
6423         New method definition.
6424         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6425         Handle relaxed input section.
6426         (Output_section::sort_attached_input_sections): Checkpoint input
6427         section list lazily.
6428         (Output_section::get_input_sections): Change type of input_sections to
6429         list of Simple_input_section pointers.  Checkpoint input section list
6430         lazily.  Also handle relaxed input sections.
6431         (Output_section::add_input_section_for_script): Take a reference to
6432         a Simple_input_section object instead of Relobj pointer and section
6433         index as parameter.  Handle relaxed input sections.
6434         (Output_section::save_states, Output_section::restore_states): New
6435         method definitions.
6436         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6437         (Output_data::is_data_size_fixed): New method definition.
6438         (Output_data::reset_addresss_and_file_offset): Do not reset data size
6439         if it is fixed.
6440         (Output_data::address_and_file_offset_have_reset_values): New method
6441         definition.
6442         (Output_data::do_address_and_file_offset_have_reset_values): New method
6443         definition.
6444         (Output_data::set_data_size): Check that data size is not fixed.
6445         (Output_data::fix_data_size): New method definition.
6446         (Output_data::is_data_size_fixed_): New data member.
6447         (Output_section_headers::set_final_data_size): New method definition.
6448         (Output_section_headers::do_size): New method declaration.
6449         (Output_segment_headers::set_final_data_size): New method definition.
6450         (Output_segment_headers::do_size): New method declaration.
6451         (Output_file_header::set_final_data_size)::New method definition.
6452         (Output_file_header::do_size)::New method declaration.
6453         (Output_section_data::Output_section_data): Add new parameter
6454         is_data_size_fixed and use it to fix data size.
6455         (Output_data_const::Output_data_const): Adjust call to base class
6456         constructor and fix data size.
6457         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6458         base class constructor and fix data size.
6459         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6460         base class constructor and fix data size.
6461         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6462         class constructor and fix data size.
6463         (Output_data_group::set_final_data_size): New method definition.
6464         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6465         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6466         class constructor and fix data size.
6467         (Output_relaxed_input_section): New class definition.
6468         (Output_section::Simple_input_section): New class definition.
6469         (Output_section::get_input_sections): Adjust parameter list.
6470         (Output_section::add_input_section_for_script): Same.
6471         (Output_section::save_states, Output_section::restore_states,
6472         Output_section::do_address_and_file_offset_have_reset_values,
6473         (Output_section::Input_section::Input_section): Handle
6474         RELAXED_INPUT_SECTION_CODE.  Add new overload for
6475         Output_relaxed_input_section.
6476         (Output_section::Input_section::is_input_section,
6477         Output_section::Input_section::set_output_section): Handle relaxed
6478         input section.
6479         (Output_section::Input_section::is_relaxed_input_section,
6480         Output_section::Input_section::output_section_data,
6481         Output_section::Input_section::relaxed_input_section): New method
6482         definitions.
6483         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6484         value.
6485         (Output_section::Input_section::u1_): Update comments.
6486         (Output_section::Input_section::u2_): Add new union member poris.
6487         (Output_section::Checkpoint_output_section): New classs definition.
6488         (Output_section::relax_input_section): New method declaration.
6489         (Output_section::checkpoint_): New data member.
6490         (Output_segment): Update comments.
6491         (Output_segment::Output_segment): Un-privatize copy constructor.
6492         (Output_segment::operator=): Un-privatize.
6493         * script-sections.cc (Output_section_element::Input_section_list):
6494         Change element type to Output_section::Simple_input_section.
6495         (Output_section_element_dot_assignment::set_section_addresses):
6496         Register output section data for relaxation clean up.
6497         (Output_data_exression::Output_data_expression): Adjust call to base
6498         constructor to fix data size.
6499         (Output_section_element_data::set_section_addresses): Register
6500         Output_data_expression object for relaxation clean up.
6501         (struct Input_section_info): Replace Relobj pointer and section index
6502         pair with Output_section::Simple_input_section and Convert struct to a
6503         class.
6504         (Input_section_sorter::operator()): Adjust access to
6505         Input_section_info data member to use accessors.
6506         (Output_section_element_input::set_section_addresses): Use layout
6507         parameter.  Adjust code to use Output_section::Simple_input_section
6508         and Input_secction_info classes.  Register filler for relaxation
6509         clean up.
6510         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6511         and section index pair with Output_section::Simple_input_section
6512         class.  Adjust code accordingly.
6513         (Phdrs_element::release_segment): New method definition.
6514         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6515         segment list.
6516         (Script_sections::release_segments): New method definition.
6517         * gold/script-sections.h (Script_sections::release_segments): New
6518         method declaration.
6519         * gold/target.h (Target::may_relax, Target::relax,
6520         Target::do_may_relax, Target::do_relax): New method definitions.
6521
6522 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6523
6524         * arm.cc (has_signed_unsigned_overflow): New function.
6525         (Arm_relocate_functions::abs8): New function.
6526         (Target_arm::Scan::local): Handle R_ARM_ABS8.
6527         (Target_arm::Scan::global): Likewise.
6528         (Target_arm::relocate::relocate): Likewise.
6529         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6530         Likewise.
6531
6532 2009-09-16  Cary Coutant  <ccoutant@google.com>
6533
6534         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6535         * testsuite/Makefile.in: Regenerate.
6536
6537 2009-09-11  Nick Clifton  <nickc@redhat.com>
6538
6539         * po/gold.pot: Updated by the Translation project.
6540
6541 2009-09-08  Cary Coutant  <ccoutant@google.com>
6542
6543         * output.cc (Output_file::open): Add execute permission to empty file.
6544         * testsuite/Makefile.am (permission_test): New test.
6545         * testsuite/Makefile.in: Regenerate.
6546
6547 2009-09-02  Ian Lance Taylor  <iant@google.com>
6548
6549         * output.cc (Output_file::resize): Call map_no_anonymous rather
6550         than map.
6551
6552 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
6553
6554         * gold.cc: Include "incremental.h".
6555         (queue_initial_tasks): Call Incremental_checker methods.
6556         * incremental.cc: Include "output.h".
6557         (Incremental_checker::can_incrementally_link_output_file): New
6558         method.
6559         * incremental.h (Incremental_checker): New class.
6560
6561         * output.cc (Output_file::open_for_modification): New method.
6562         (Output_file::map_anonymous): Changed return type to bool.  Record
6563         map in base_ field.
6564         (Output_file::map_no_anonymous): New method, broken out of map.
6565         (Output_file::map): Use map_no_anonymous and map_anonymous.
6566         * output.h (class Output_file): Update declarations.
6567
6568 2009-08-24  Cary Coutant  <ccoutant@google.com>
6569
6570         * options.h (Command_line::Pre_options): New class.
6571         (Command_line::pre_options): New member.
6572         * options.cc (gold::options::ready_to_register): New variable.
6573         (One_option::register_option): Do nothing if not registering options.
6574         Assert if same short option registered twice.
6575         (General_options::General_options): Turn off option registration when
6576         done constructing.
6577         (Command_line::Pre_options::Pre_options): New constructor.
6578
6579 2009-08-24  Cary Coutant  <ccoutant@google.com>
6580
6581         * options.h (General_options::no_keep_memory): Remove incorrect
6582         short option.
6583
6584 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6585
6586         * Makefile.am (am__skiplex, am__skipyacc): New.
6587         * Makefile.in: Regenerate.
6588
6589 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6590
6591         * Makefile.am (AM_CPPFLAGS): Renamed from ...
6592         (INCLUDES): ... this.
6593         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6594         (AM_CPPFLAGS): Renamed from ...
6595         (INCLUDE): ... this.
6596         * Makefile.in, testsuite/Makefile.in: Regenerate.
6597
6598         * Makefile.in: Regenerate.
6599         * aclocal.m4: Likewise.
6600         * config.in: Likewise.
6601         * configure: Likewise.
6602         * testsuite/Makefile.in: Likewise.
6603
6604         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6605         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6606         * Makefile.in: Regenerate.
6607         * testsuite/Makefile.in: Regenerate.
6608
6609 2009-08-19  Cary Coutant  <ccoutant@google.com>
6610
6611         * resolve.cc (Symbol_table::resolve): Don't complain about defined
6612         symbols in shared libraries overridden by hidden or internal symbols
6613         in the main program.
6614
6615 2009-08-19  Chris Demetriou  <cgd@google.com>
6616
6617         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6618         checking source file names in error messages.
6619
6620 2009-08-18  Doug Kwan  <dougkwan@google.com>
6621
6622         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6623         an elcpp::Ehdr as parameter.  Adjust call to set_target.
6624         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6625         an elfcpp::Ehdr as parameter.
6626         * object.cc (Object::set_target): Remove the version that looks up
6627         a target and sets it.
6628         (Sized_relobj::setup): Take a Target object instead of
6629         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
6630         (make_elf_sized_object): Find target and ask target to
6631         make an ELF object.
6632         * object.h: (Object::set_target): Remove the version that looks up
6633         a target and sets it.
6634         (Sized_relobj::setup): Take a Target object instead of
6635         an elfcpp:Ehdr as parameter.
6636         * target.cc: Include dynobj.h.
6637         (Target::do_make_elf_object_implementation): New.
6638         (Target::do_make_elf_object): New.
6639         * target.h (Target::make_elf_object): New template declaration.
6640         (Target::do_make_elf_object): New method declarations.
6641         (Target::do_make_elf_object_implementation): New template declaration.
6642
6643 2009-08-14  Ian Lance Taylor  <iant@google.com>
6644
6645         * gold.h (FUNCTION_NAME): Define.
6646         (gold_unreachable): Use FUNCTION_NAME.
6647
6648 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
6649
6650         * icf.cc (Icf::find_identical_sections): Issue a warning when a
6651         symbol in the --keep-unique list is not found.
6652
6653 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
6654
6655         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6656         been maked as --keep-unique.
6657         (Icf::unfold_section): New function.
6658         * icf.h (Icf::unfold_section): New function.
6659         * options.h (General_options::keep_unique): New option.
6660         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6661         * testsuite/Makefile.in: Regenerate.
6662         * testsuite/icf_keep_unique_test.sh: New file.
6663         * testsuite/icf_keep_unique_test.cc: New file.
6664
6665 2009-08-12  Cary Coutant  <ccoutant@google.com>
6666
6667         PR 10471
6668         * resolve.cc (Symbol_table::resolve): Check for references from
6669         dynamic objects to hidden and internal symbols.
6670         * testsuite/Makefile.am (hidden_test.sh): New test.
6671         * testsuite/Makefile.in: Regenerate.
6672         * testsuite/hidden_test.sh: New script.
6673         * testsuite/hidden_test_1.c: New test source.
6674         * testsuite/hidden_test_main.c: New test source.
6675
6676 2009-08-11  Doug Kwan  <dougkwan@google.com>
6677
6678         * arm.cc: Update comments.
6679         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6680         segment to locate the .ARM.exidx section if present.
6681
6682 2009-08-09  Doug Kwan  <dougkwan@google.com>
6683
6684         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6685         patch.
6686
6687 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
6688         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6689         compiler warnings.
6690
6691 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
6692
6693         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6694         valid tls_segment only for non-debug-section relocations.
6695         * testsuite/Makefile.am: Add gc_tls_test.
6696         * testsuite/Makefile.in: Regenerate.
6697         * testsuite/gc_tls_test.cc: New file.
6698         * testsuite/gc_tls_test.sh: New file.
6699
6700 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
6701
6702         * icf.cc: New file.
6703         * icf.h: New file.
6704         * Makefile.am (CCFILES): Add icf.cc.
6705         (HFILES): Add icf.h
6706         * Makefile.in: Regenerate.
6707         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6708         * gc.h (gc_process_relocs): Populate lists used by icf to contain
6709         section, symbol and addend information for the relocs.
6710         * gold.cc (queue_middle_tasks): Call identical code folding.
6711         * gold.h: Add defines for multimap.
6712         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6713         to the call of finalize_local_symbols.
6714         * main.cc (main): Create object of class Icf.
6715         * object.cc (Sized_relobj::do_layout): Allow this function to be
6716         called twice during icf.
6717         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6718         to sections marked as identical by icf.
6719         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6720         when available.
6721         (Sized_relobj::do_section_entsize): New function.
6722         * object.h (Object::section_entsize): New function.
6723         (Object::do_section_entsize): New pure virtual function.
6724         (Relobj::finalize_local_symbols): Add new parameter.
6725         (Relobj::do_section_entsize): New function.
6726         * options.h (General_options::icf): New option.
6727         (General_options::icf_iterations): New option.
6728         (General_options::print_icf_sections): New option.
6729         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6730         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6731         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6732         icf.
6733         * symtab.cc (Symbol_table::is_section_folded): New function.
6734         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
6735         to sections marked as identical by icf.
6736         * symtab.h (Symbol_table::set_icf): New function.
6737         (Symbol_table::icf): New function.
6738         (Symbol_table::is_section_folded): New function.
6739         (Symbol_table::icf_): New data member.
6740         * target-reloc.h (relocate_section): Ignore sections folded by icf.
6741         * testsuite/Makefile.am: Add commands to build icf_test.
6742         * testsuite/Makefile.in: Regenerate.
6743         * testsuite/icf_test.sh: New file.
6744         * testsuite/icf_test.cc: New file.
6745
6746 2009-07-24  Chris Demetriou  <cgd@google.com>
6747
6748         * layout.cc (is_compressible_debug_section): Fix incorrect
6749         comment about compressed section names.
6750
6751 2009-07-20  Ian Lance Taylor  <ian@airs.com>
6752
6753         PR 10419
6754         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6755
6756 2009-07-16  Ian Lance Taylor  <iant@google.com>
6757
6758         PR 10400
6759         * layout.h: #include <map>.
6760         (class Kept_section): Change from struct to class.  Add accessors
6761         and setters.  Add section size to Comdat_group mapping.  Change
6762         Comdat_group to std::map.  Add is_comdat_ field.  Add
6763         linkonce_size field in union.
6764         (class Layout): Update declaration of find_or_add_kept_section.
6765         Don't declare find_kept_object.
6766         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6767         parameter.  Add object, shndx, is_comdat, and is_group_name
6768         parameters.  Change all callers.  Adjust for new Kept_section.
6769         (Layout::find_kept_object): Remove.
6770         * object.cc (Sized_relobj::include_section_group): Update use of
6771         Kept_section.  Rename secnum to shndx.  Only record
6772         Kept_comdat_section if sections are the same size.
6773         (Sized_relobj::include_linkonce_section): Update use of
6774         Kept_section.  Only record Kept_comdat_section if sections are the
6775         same size.  Set size of linkonce section.
6776         (Sized_relobj::map_to_kept_section): Update call to
6777         get_kept_comdat_section.
6778         * object.h (class Sized_relobj): Rename fields in
6779         Kept_comdat_section to drop trailing underscores; change object
6780         field to Relobj*.  Change Kept_comdat_section_table to store
6781         struct rather than pointer.
6782         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6783         Add kept_object and kept_shndx parameters.  Change all callers.
6784         (Sized_relobj::get_kept_comdat_section): Change return type to
6785         bool.  Add kept_object and kept_shndx parameters.  Change all
6786         callers.
6787         * plugin.cc (Pluginobj::include_comdat_group): Update call to
6788         Layout::find_or_add_kept_section.
6789
6790 2009-07-09  Ian Lance Taylor  <iant@google.com>
6791
6792         * merge.cc (Object_merge_map::initialize_input_to_output_map):
6793         Reserve space in the hash table.
6794
6795 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
6796
6797         * fileread.cc (File_read::get_mtime): New method.
6798         * fileread.h (Timespec): New structure.
6799         (File_read::get_mtime): New method.
6800         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6801         Renamed from timestamp_nsec.
6802         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6803         Elf_Xword.
6804         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6805         timestamp_nsec.
6806         (Incremental_inputs::report_archive): Save mtime; style fix.
6807         (Incremental_inputs::report_obejct): Save mtime; style fix.
6808         (Incremental_inputs::report_script): Save mtime; style fix.
6809         (Incremental_inputs::finalize_inputs): Style fix.
6810         (Incremental_inputs::finalize): Style fix.
6811         (Incremental_inputs::create_input_section_data): Store inputs
6812         mtime.
6813         * incremental.h (Incremental_inputs::report_script): Add mtime
6814         argument.
6815         (Incremental_inputs::Input_info::Input_info): Intialize only one
6816         union member.
6817         (Incremental_inputs::Input_info::archive): Move to nameless
6818         union.
6819         (Incremental_inputs::Input_info::obejct): Move to nameless union.
6820         (Incremental_inputs::Input_info::script): Move to nameless union.
6821         (Incremental_inputs::mtime): New field.
6822         * script.cc (read_input_script): Pass file mtime to
6823         Incremental_input.
6824         * script.h (Script_info::inputs): Style fix.
6825
6826 2009-07-01  Ian Lance Taylor  <ian@airs.com>
6827
6828         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6829         instead of 32.
6830
6831 2009-06-24  Ian Lance Taylor  <iant@google.com>
6832
6833         PR 10156
6834         * layout.cc (Layout::choose_output_section): If we find an
6835         existing section, update the flags.
6836         (Layout::create_notes): New function, broken out of
6837         Layout::finalize.
6838         (Layout::finalize): Don't create note sections.
6839         (Layout::create_note): Don't crash if linker script discards
6840         section.
6841         (Layout::create_gold_note): Likewise.
6842         (Layout::create_build_id): Likewise.  Don't set
6843         after_input_sections on the section.
6844         (Layout::create_executable_stack_info): Remove target parameter.
6845         Change caller.
6846         * layout.h (class Layout): Declare create_notes.  Update
6847         declaration of create_executable_stack_info.
6848         * gold.cc (queue_middle_tasks): Call create_notes.
6849         * output.cc (Output_section::update_flags_for_input_section): Move
6850         here from output.h.  If SHF_ALLOC flag is newly set, mark address
6851         invalid.
6852         * output.h (Output_data::mark_address_invalid): New function.
6853         (class Output_section): Only declare, not define,
6854         update_flags_for_input_section.  Remove set_flags.
6855
6856 2009-06-24  Ian Lance Taylor  <iant@google.com>
6857
6858         * script-sections.cc (Output_section_definition::
6859         set_section_addresses): Rename shadowing local load_address to
6860         laddr.
6861
6862 2009-06-24  Ian Lance Taylor  <iant@google.com>
6863
6864         PR 10244
6865         * reloc.cc (relocate_sections): Skip empty relocation sections.
6866
6867 2009-06-23  Ian Lance Taylor  <iant@google.com>
6868
6869         PR 10156
6870         * layout.cc (Layout::create_note): Use choose_output_section
6871         rather than make_output_section.
6872
6873 2009-06-23  Ian Lance Taylor  <iant@google.com>
6874
6875         PR 10237
6876         * options.cc (General_options::parse_V): Set printed_version_.
6877         (General_options::General_options): Initialize printed_version_.
6878         * options.h (class General_options): Add printed_version_ field.
6879         * gold.cc (queue_initial_tasks): If there are no input files,
6880         don't give a fatal error if we printed the version information.
6881         (queue_middle_tasks): If using -r with a shared object, give a
6882         fatal error rather than an ordinary error.
6883
6884 2009-06-23  Ian Lance Taylor  <iant@google.com>
6885
6886         PR 10219
6887         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6888         (Layout::make_output_section): Set have_stabstr_section_ if we see
6889         a .stab*str section.
6890         (Layout::finalize): Call link_stabs_sections.
6891         (Layout::link_stabs_sections): New file.
6892         * layout.h (class Layout): Add have_stabstr_section_ field.
6893         Declare link_stabs_sections.
6894
6895 2009-06-23  Doug Kwan  <dougkwan@google.com>
6896
6897         * Makefile.am (libgold_a_LIBADD): New.
6898         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6899         * Makefile.in: Regenerate.
6900         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6901         * configure: Regenerate.
6902         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6903         * fileread.cc: Include sys/state.h
6904         * gold.h: Declare memmem and strndup if found missing.
6905         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6906
6907 2009-06-23  Ian Lance Taylor  <iant@google.com>
6908
6909         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6910         * configure: Rebuild.
6911
6912 2009-06-23  Ian Lance Taylor  <iant@google.com>
6913
6914         PR 10147
6915         * object.cc (Object::section_contents): Don't try to get a view if
6916         the section has length zero.
6917         (Object::handle_gnu_warning_section): If the section is empty, use
6918         the name of the section as the warning.
6919
6920 2009-06-23  Ian Lance Taylor  <iant@google.com>
6921
6922         PR 10133
6923         * stringpool.h (class Stringpool_template): Add optimize_ field.
6924         (Stringpool_template::set_optimize): New function.
6925         * stringpool.cc (Stringpool_template::Stringpool_template):
6926         Initialize optimize_ field.
6927         (Stringpool_template::set_string_offsets): Test local optimize
6928         fild rather than parameter.
6929         * layout.cc (Layout::Layout): Call set_optimize on the section
6930         name stringpool.
6931
6932 2009-06-22  Ian Lance Taylor  <iant@google.com>
6933
6934         PR 10030
6935         * yyscript.y: Parse TARGET.
6936         * script.cc (script_set_target): New function.
6937         * script-c.h (script_set_target): Declare.
6938         * options.cc (General_options::string_to_object_format): Rename
6939         from string_to_object_format in anonymous namespace.  Change
6940         callers.
6941         * options.h (class General_options): Declare
6942         string_to_object_format.
6943
6944 2009-06-22  Ian Lance Taylor  <iant@google.com>
6945
6946         * script-sections.cc (Script_sections::create_segments): Don't put
6947         program headers in a PT_LOAD segment if -n or -N.
6948
6949 2009-06-22  Ian Lance Taylor  <iant@google.com>
6950
6951         PR 10141
6952         * options.h (class General_options): Add -z lazy and -z now.  Sort
6953         -z options into alphabetical order.
6954         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6955
6956 2009-06-21  Ian Lance Taylor  <iant@google.com>
6957
6958         * layout.cc (Layout::make_output_section): Call
6959         Target::new_output_section.
6960         (Layout::attach_allocated_section_to_segment): Put large section
6961         sections in a separate load segment with the large segment flag
6962         set.
6963         (Layout::segment_precedes): Sort large data segments after other
6964         load segments.
6965         (align_file_offset): New static function.
6966         (Layout::set_segment_offsets): Use align_file_offset.
6967         * output.h (class Output_section): Add is_small_section_ and
6968         is_large_section_ fields.
6969         (Output_section::is_small_section): New function.
6970         (Output_section::set_is_small_section):  New function.
6971         (Output_section::is_large_section): New function.
6972         (Output_section::set_is_large_section): New function.
6973         (Output_section::is_large_data_section): New function.
6974         (class Output_segment): Add is_large_data_segment_ field.
6975         (Output_segment::is_large_data_segment): New function.
6976         (Output_segment::set_is_large_data_segment): New function.
6977         * output.cc (Output_section::Output_section): Initialize new
6978         fields.
6979         (Output_segment::Output_segment): Likewise.
6980         (Output_segment::add_output_section): Add assertion that large
6981         data sections always go in large data segments.  Force small data
6982         sections to the end of the list of data sections.  Force small BSS
6983         sections to the start of the list of BSS sections.  For large BSS
6984         sections to the end of the list of BSS sections.
6985         * symtab.h (class Symbol): Declare is_common_shndx.
6986         (Symbol::is_defined): Check Symbol::is_common_shndx.
6987         (Symbol::is_common): Likewise.
6988         (class Symbol_table): Define enum Commons_section_type.  Update
6989         declarations.  Add small_commons_ and large_commons_ fields.
6990         * symtab.cc (Symbol::is_common_shndx): New function.
6991         (Symbol_table::Symbol_table): Initialize new fields.
6992         (Symbol_table::add_from_object): Put small and large common
6993         symbols in the right list.
6994         (Symbol_table::sized_finalized_symbol): Check
6995         Symbol::is_common_shndx.
6996         (Symbol_table::sized_write_globals): Likewise.
6997         * common.cc (Symbol_table::do_allocate_commons): Allocate new
6998         common symbol lists.  Don't call do_allocate_commons_list if the
6999         list is empty.
7000         (Symbol_table::do_allocate_commons_list): Remove is_tls
7001         parameter.  Add comons_section_type parameter.  Change all
7002         callers.  Handle small and large common symbols.
7003         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7004         Symbol::is_common_shndx.
7005         * resolve.cc (symbol_to_bits): Likewise.
7006         * target.h (Target::small_common_shndx): New function.
7007         (Target::small_common_section_flags): New function.
7008         (Target::large_common_shndx): New function.
7009         (Target::large_common_section_flags): New function.
7010         (Target::new_output_section): New function.
7011         (Target::Target_info): Add small_common_shndx, large_common_shndx,
7012         small_common_section_flags, and large_common_section_flags
7013         fields.
7014         (Target::do_new_output_section): New virtual function.
7015         * arm.cc (Target_arm::arm_info): Initialize new fields.
7016         * i386.cc (Target_i386::i386_info): Likewise.
7017         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7018         Likewise.
7019         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7020         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7021         (Target_x86_64::do_new_output_section): New function.
7022         * configure.ac: Define conditional MCMODEL_MEDIUM.
7023         * testsuite/Makefile.am (check_PROGRAMS): Add large.
7024         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7025         (large_LDFLAGS): Define.
7026         * testsuite/large.c: New file.
7027         * testsuite/testfile.cc (Target_test::test_target_info):
7028         Initialize new fields.
7029         * configure, testsuite/Makefile.in: Rebuild.
7030
7031 2009-06-05  Doug Kwan  <dougkwan@google.com>
7032
7033         * Makefile.am (CCFILES): Add target.cc.
7034         * Makefile.in: Regenerate.
7035         * i386.cc (class Target_i386): Define new virtual method to
7036         override do_is_local_label_name in parent.
7037         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7038         local symbols if --discard-locals or -X is given.
7039         * options.h (class General_options): Declare new options
7040         '--discard-locals' and '-X' for discarding locals.
7041         * target.h (class Target): Define new methods is_local_label_name.
7042         Declare new virtual method do_is_local_label_name.
7043         * target.cc: New file.
7044         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7045         (check_SCRIPTS): Add discard_locals_test.sh.
7046         (check_DATA): Add discard_local_tests.syms.
7047         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7048         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7049         * testsuite/Makefile.in: Regenerate.
7050         * testsuite/discard_locals_test.c: New file.
7051         * testsuite/discard_locals_test.sh: Same.
7052
7053 2009-06-05  Doug Kwan  <dougkwan@google.com>
7054
7055         * object.cc (Sized_relobj::Sized_relobj): Initialize
7056         discarded_eh_frame_shndx_ to -1U.
7057         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7058         section.
7059         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7060         a discarded .eh_frame section.
7061         (Sized_relobj::do_finalize_local_symbols): Ditto.
7062         * object.h (class Sized_relobj): Declare new member
7063         discarded_eh_frame_shndx_.
7064         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7065         (local_labels_test.o, local_labels_test): New rules.
7066         * testsuite/Makefile.in: Regenerate.
7067
7068 2009-06-04  Doug Kwan  <dougkwan@google.com>
7069
7070         * layout.cc (Layout::section_name_mapping): Add mapping for
7071         special ARM sections.
7072
7073 2009-06-03  Doug Kwan  <dougkwan@google.com>
7074
7075         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7076         (utils::has_overflow): Same.
7077
7078 2009-06-03  Ian Lance Taylor  <iant@google.com>
7079
7080         * layout.cc (Layout::section_name_mapping): New array, replacing
7081         Layout::linkonce_mapping.
7082         (Layout::section_name_mapping_count): New variable, replacing
7083         Layout::linkonce_mapping_count.
7084         (Layout::linkonce_output_name): Remove.
7085         (Layout::output_section_name): Rewrite.
7086         * layout.h (class Layout): Rename Linkonce_mapping to
7087         Section_name_mapping, linkonce_mapping to section_name_mapping,
7088         linkonce_mapping_count to section_name_mapping_count.  Don't
7089         declare linkonce_output_name.
7090
7091 2009-06-03  Doug Kwan  <dougkwan@google.com>
7092
7093         * gold/arm.cc (namespace utils): New.
7094         (Target_arm::reloc_is_non_pic): Define new method.
7095         (class Arm_relocate_functions): New.
7096         (Target_arm::Relocate::relocate): Handle relocation types used by
7097         Android.
7098
7099 2009-06-03  Ian Lance Taylor  <iant@google.com>
7100
7101         * arm.cc (Target_arm::scan::global): Use || instead of |.
7102
7103 2009-06-02  Doug Kwan  <dougkwan@google.com>
7104
7105         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7106         issued_non_pic_error_.
7107         (class Target_arm::Scan): Declare new method check_non_pic.
7108         Define new method symbol_needs_plt_entry.
7109         Declare new data member issued_non_pic_error_.
7110         (class Target_arm::Relocate): Declare new method
7111         should_apply_static_reloc.
7112         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7113         (Target_arm::Scan::check_non_pic): Define new method.
7114         (Target_arm::Scan::local): Handle a small subset of reloc types used
7115         by Android.
7116         (Target_arm::Scan::local): Same.
7117         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7118
7119 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7120
7121         * incremental.cc (Incremental_inputs::report_command_line): Filter
7122         out --incremental-* options.
7123
7124 2009-05-29  Doug Kwan  <dougkwan@google.com>
7125
7126         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7127         template class.
7128         (class Target_arm): Update comment.
7129         (Target_arm::Target_arm): Initialize new data members GOT_,
7130         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7131         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7132         and Target_arm::rel_dyn_section.
7133         Declare new_enum Target_arm::Got_type.
7134         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7135         and DYNBSS_.
7136         Update commments for member do_dynsym_value.
7137         (Target_arm::got_size, Target_arm::plt_section,
7138         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7139         new methods inside class defintion.
7140         (Target_arm::got_section): Define new method.
7141         (Target_arm::rel_dyn_section): Same.
7142         (Output_data_plt_arm): New template class.
7143         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7144         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7145         (Output_data_plt_arm::add_entry): Same.
7146         (Output_data_plt_arm::first_plt_entry): Define new
7147         static data member for PLT instruction template.
7148         (Output_data_plt_arm::plt_entry): Same.
7149         (Output_data_plt_arm::do_write): Define new method.
7150         (Target_arm::make_plt_entry): Same.
7151         (Target_arm::do_finalize_sections): Same.
7152         (Target_arm::do_dynsym_value): Same.
7153
7154 2009-05-28  Doug Kwan  <dougkwan@google.com>
7155
7156         * Makefile.am (TARGETSOURCES): Add arm.cc.
7157         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7158         * Makefile.in: Regenerate.
7159         * arm.cc: New file.
7160         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7161
7162 2009-05-26  Doug Kwan  <dougkwan@google.com>
7163
7164         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7165         (General_options::check_excluded_libs): Strip off directories in
7166         archive name before matching like GNU ld does.
7167         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7168         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7169         (exclude_libs_test_LDFLAGS): Add linker option
7170         -Wl,--exclude-libs,libexclude_libs_test_3
7171         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7172         an explicit archive without using -l.
7173         (alt/libexclude_libs_test_3.a): New make rule.
7174         * testsuite/Makefile.in: Regenerate.
7175         * testsuite/exclude_libs_test.c : Declare lib3_default().
7176         (main): Call it.
7177         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7178         * exclude_libs_test_3.c: New file.
7179
7180 2009-05-26  Nick Clifton  <nickc@redhat.com>
7181
7182         * po/id.po: New Indonesian translation.
7183         * po/gold.pot: Updated template file.
7184
7185 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7186
7187         * testsuite/Makefile.am: Add -ffunction-sections to compile
7188         gc_comdat_test files.  Add -Wl,--gc-sections to build
7189         gc_comdat_test.
7190         * testsuite/Makefile.in: Regenerate.
7191         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7192
7193 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7194
7195         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7196         kept comdat section was garbage collected.
7197         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7198         * testsuite/Makefile.in: Regenerate.
7199         * testsuite/gc_comdat_test.sh: New file.
7200         * testsuite/gc_comdat_test_1.cc: New file.
7201         * testsuite/gc_comdat_test_2.cc: New file.
7202
7203 2009-05-19  Doug Kwan  <dougkwan@google.com>
7204
7205         * archive.cc (Archive::Archive): Move constructor from archive.h
7206         to here.  Initialize no_export_.
7207         (Archive::get_elf_object_for_member): Set no_export flag of object.
7208         * archive.h (Archive::Archive): Move constructor body to
7209         archive.cc.
7210         (Archive::no_export): New method.
7211         (Archive::no_export_): New field.
7212         * object.h (Object::Object): Initialize no_export_ to false.
7213         (Object::no_export, Object::set_no_export): New methods.
7214         (Object::no_export_): New field.
7215         * options.cc (General_options::parse_exclude_libs): New method.
7216         (General_options::check_excluded_libs) Same.
7217         * options.h (exclude_libs): New option.
7218         (General_options::check_excluded_libs): New method declaration.
7219         (General_options::excluded_libs_): New field.
7220         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7221         default or protected visibility if an object has no-export flag set.
7222         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7223         (check_SCRIPTS): Add exclude_libs_test.sh.
7224         (check_DATA): Add exclude_libs_test.syms.
7225         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7226         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7227         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7228         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7229         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7230         libexclude_libs_test_2.a): New rules.
7231         * testsuite/Makefile.in: Regenerate.
7232         * testsuite/exclude_libs_test.c: New file.
7233         * testsuite/exclude_libs_test.sh: Ditto.
7234         * testsuite/exclude_libs_test_1.c: Ditto.
7235         * testsuite/exclude_libs_test_2.c: Ditto.
7236
7237 2009-05-15  Ian Lance Taylor  <iant@google.com>
7238
7239         * configure.ac: Check for declarations for cases where libiberty.h
7240         checks HAVE_DECL_xxx.
7241         * configure, config.in: Rebuild.
7242
7243 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7244
7245         * gold.h (Incremental_argument_list): Remove (invalid) forward
7246         declaration.
7247         * incremental.cc (Incremental_inputs::report_achive): New method.
7248         (Incremental_inputs::report_object): New method.
7249         (Incremental_inputs::report_script): New method.
7250         (Incremental_inputs::finalize_inputs): New method.
7251         (Incremental_inputs::finalize): Call finalize_inputs().
7252         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7253         Create inputs entries.
7254         * incremental.h (Incremental_input_type): New enum.
7255         (Incremental_inputs::Incremental_input): Initialize new fields.
7256         (Incremental_inputs::report_inputs): New method.
7257         (Incremental_inputs::report_achive): New method.
7258         (Incremental_inputs::report_object): New method.
7259         (Incremental_inputs::report_script): New method.
7260         (Incremental_inputs::finalize_inputs): New method.
7261         (Incremental_inputs::Input_info): New struct.
7262         (Incremental_inputs::Input_info_map): New typedef.
7263         (Incremental_inputs::lock_): New field.
7264         (Incremental_inputs::Inputs_): New field.
7265         (Incremental_inputs::Inputs_map): New field.
7266         * main.cc (main): Call Incremental_input::report_inputs.
7267         * options.h (Input_argument_list): Typedef moved from
7268         Input_arguments.
7269         (Input_file_group::Files): Remove, use ::Input_argument_list.
7270         (Input_file_group::Input_argument_list): Remove, use
7271         ::Input_argument_list.
7272         * plugin.cc (Plugin_manager::add_input_file): Add error in
7273         incremental build.
7274         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7275         functions.
7276         * script.cc (read_input_script): Call
7277         Incremental_input::report_script.
7278         * script.h (Script_info): New class.
7279
7280 2009-04-27  Ian Lance Taylor  <iant@google.com>
7281
7282         * x86_64.cc (do_adjust_output_section): Set entsize to
7283         plt_entry_size.
7284
7285 2009-04-23  Elliott Hughes  <enh@google.com>
7286
7287         * output.cc (Output_file::close): After short writes, continue
7288         writing from the correct offset in the buffer being written.
7289
7290 2009-04-23  Chris Demetriou  <cgd@google.com>
7291
7292         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7293         * configure: Regenerate.
7294         * config.in: Regenerate.
7295         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7296         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7297
7298 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7299
7300         * incremental.cc (Incremental_inputs_header_data): Renamed from
7301         Incremental_input_header_data.
7302         (Incremental_inputs_header_data::data_size): New field.
7303         (Incremental_inputs_header_data::put_input_file_count): Renamed
7304         from input_file_count.
7305         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7306         from command_line_offset.
7307         (Incremental_inputs_header_data::put_reserved): Renamed from
7308         put_reserved.
7309         (Incremental_inputs_entry_data): Renamed from
7310         Incremental_input_entry_data.
7311         (Incremental_inputs_entry_data::data_size): New field.
7312         (Incremental_inputs::report_command_line): New method.
7313         (Incremental_inputs::finalize): New method.
7314         (Incremental_inputs::create_incremental_inputs_data): New method.
7315         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7316         * incremental.h: New file.
7317         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7318        (Layout::finalize): Create incremental inputs section in
7319         incremental builds.
7320        (Layout::create_incremental_info_sections): New method.
7321         * layout.h (Layout::incremental_inputs): New method.
7322        (Layout::create_incremental_info_sections): New method.
7323        (Layout::incremental_inputs_): New field.
7324         * main.cc (main): Notify Incremental_input of the command line.
7325
7326 2009-04-01  Ian Lance Taylor  <iant@google.com>
7327             Mikolaj Zalewski  <mikolajz@google.com>
7328
7329         * gold.h (reserve_unordered_map): Define, three versions, one for
7330         each version of Unordered_map.
7331         * layout.cc (Layout::Layout): Remove options parameter.  Add
7332         number_of_input_files parameter.  Don't initialize options_.
7333         Initialize number_of_input_files_ and resized_signatures_.  Move
7334         sections_are_attached_.
7335         (Layout::layout_group): Reserve space for group_signatures_.
7336         (Layout::find_or_add_kept_section): Change name parameter to be a
7337         reference.  Resize signatures_ map when it gets large enough.
7338         (Layout::layout_eh_frame): Use parameters->options() instead of
7339         this->options_.
7340         (Layout::make_output_section): Likewise.
7341         (Layout::attach_allocated_section_to_segment): Likewise.
7342         (Layout::finalize, Layout::create_executable_stack): Likewise.
7343         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7344         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7345         * layout.h (class Layout): Update declarations.  Remove options_
7346         field.  Add number_of_input_files_ and resized_signatures_
7347         fields.  Move sections_are_attached_ field.
7348         * main.cc (main): Pass number of input files to Layout
7349         constructor.  Don't pass options.
7350
7351 2009-03-30  Ian Lance Taylor  <iant@google.com>
7352
7353         * ffsll.c (ffsll): Correct implementation.
7354
7355 2009-03-27  Ian Lance Taylor  <iant@google.com>
7356
7357         * ffsll.c: New file.
7358         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7359         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7360         * ftruncate.c (ftruncate): Declare before definition.
7361         * mremap.c (mremap): Likewise.
7362         * pread.c (pread): Likewise.
7363         * configure, Makefile.in, config.in: Rebuild.
7364
7365         * mremap.c: New file.
7366         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7367         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7368         (mremap): Declare if HAVE_MREMAP is not defined.
7369         * configure, Makefile.in, config.in: Rebuild.
7370
7371 2009-03-27  Cary Coutant  <ccoutant@google.com>
7372
7373         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7374         position independent.
7375         * sparc.cc (Target_sparc::check_non_pic): Likewise.
7376         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7377
7378 2009-03-24  Cary Coutant  <ccoutant@google.com>
7379
7380         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7381         an executable.
7382         (needs_dynamic_reloc): Likewise.
7383
7384 2009-03-24  Ian Lance Taylor  <iant@google.com>
7385
7386         * yyscript.y (file_cmd): Recognize EXTERN.
7387         (extern_name_list, extern_name_list_body): New nonterminals.
7388         * script.cc (script_add_extern): Define.
7389         * script-c.h (script_add_extern): Declare.
7390
7391 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
7392
7393         * object.cc (is_elf_object): Define.
7394         * object.h (is_elf_object): Declare.
7395         * archive.cc (Archive::get_elf_object_for_member): Call
7396         is_elf_object.
7397         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7398
7399 2009-03-24  Elliott Hughes  <enh@google.com>
7400
7401         * output.cc (Output_file::map_anonymous): Define.
7402         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
7403         try an anonymous one.  Report the size if the mmap fails.
7404         * output.h (class Output_file): Declare map_anonymous.
7405
7406 2009-03-24  Ian Lance Taylor  <iant@google.com>
7407
7408         * target-select.cc (instantiate_target): Don't acquire the lock if
7409         the instantiated_target_ field has already been set.
7410
7411 2009-03-23  Ian Lance Taylor  <iant@google.com>
7412
7413         * gold-threads.h (class Initialize_lock): Define.
7414         * gold-threads.cc (class Initialize_lock_once): Define.
7415         (initialize_lock_control): New static variable.
7416         (initialize_lock_pointer): New static variable.
7417         (initialize_lock_once): New static function.
7418         (Initialize_lock::Initialize_lock): Define.
7419         (Initialize_lock::initialize): Define.
7420         * target-select.h: Include "gold-threads.h".
7421         (class Target_selector): Add lock_ and initialize_lock_ fields.
7422         Don't define instantiate_target, just declare it.
7423         * target-select.cc (Target_selector::Target_selector): Initialize
7424         new fields.
7425         (Target_selector::instantiate_target): Define.
7426         * descriptors.h: Include "gold-threads.h".
7427         (class Descriptors): Add initialize_lock_ field.
7428         * descriptors.cc (Descriptors::Descriptors): Initialize new
7429         field.
7430         (Descriptors::open): Use initialize_lock_ field
7431         * errors.h (class Errors): Add initialize_lock_ field.
7432         * errors.cc (Errors::Errors): Initialize new field.
7433         (Errors::initialize_lock): Use initialize_lock_ field.
7434         * powerpc.cc (class Target_selector_powerpc): Remove
7435         instantiated_target_ field.  In do_recognize call
7436         instantiate_target rather than do_instantiate_target.  In
7437         do_instantiate_target just allocate a new target.
7438         * sparc.cc (class Target_selector_sparc): Likewise.
7439
7440         * freebsd.h: New file.
7441         * i386.cc: Include "freebsd.h".
7442         (Target_i386): Derive from Target_freebsd rather than
7443         Sized_target.
7444         (Target_selector_i386): Derive from Target_selector_freebsd rather
7445         than Target_selector.
7446         * x86_64.cc: Include "freebsd.h".
7447         (Target_x86_64): Derive from Target_freebsd rather than
7448         Sized_target.
7449         (Target_selector_x86_64): Derive from Target_selector_freebsd
7450         rather than Target_selector.
7451         * target.h (class Target): Add adjust_elf_header and
7452         do_adjust_elf_header.
7453         * output.cc (Output_file_header:: do_sized_write): Call target
7454         adjust_elf_header routine.
7455         * configure.tgt: Set targ_osabi.
7456         * configure.ac: Define GOLD_DEFAULT_OSABI.
7457         * parameters.cc (Parameters::default_target): Pass
7458         GOLD_DEFAULT_OSABI to select_target.
7459         * target-select.h (class Target_selector): Make instantiate_target
7460         protected rather than private.
7461         * Makefile.am (HFILES): Add freebsd.h.
7462         * configure, Makefile.in, config.in: Rebuild.
7463
7464         * merge.cc (do_add_input_section): Correct pend value.  Change
7465         message about last entry not being null terminated from error to
7466         warning.
7467
7468 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
7469
7470         * incremental.cc: New file.
7471         * Makefile.am (CCFILES): Add incremental.cc.
7472         * Makefile.in: Rebuild.
7473
7474 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
7475
7476         * layout.cc (Layout::output_section_name): Preserve names
7477         of '.note.' sections.
7478
7479 2009-03-19  Ian Lance Taylor  <iant@google.com>
7480
7481         * descriptors.cc (Descriptors::open): Check that the options are
7482         valid before using them.
7483
7484 2009-03-18  Ian Lance Taylor  <iant@google.com>
7485
7486         * script-sections.h: Include <list>.
7487         (class Script_sections): Change Sections_elements from std::vector
7488         to std::list.  Typedef public Elements_iterator.  Add
7489         orphan_section_placement_, data_segment_align_start_, and
7490         saw_data_segment_align_ fields.  Remove data_segment_align_index_
7491         field.
7492         * script-sections.cc (class Orphan_section_placement): New class.
7493         (class Sections_element): Add virtual functions is_relro and
7494         orphan_section_init.  Remove virtual function place_orphan_here.
7495         (class Output_section_definition): Add is_relro and
7496         orphan_section_init.  Remove place_orphan_here.
7497         (class Orphan_output_section): Likewise.
7498         (Script_sections::Script_sections): Update for field changes.
7499         (Script_sections::data_segment_align): Set saw_data_segment_align_
7500         and data_segment_align_start_, not data_segment_align_index.
7501         (Script_sections::data_segment_relro_end): Check
7502         saw_data_segment_align_.  Use data_segment_align_start_ rather
7503         than data_segment_align_index_.
7504         (Script_sections::place_orphan): Rewrite to use
7505         Orphan_section_placement.
7506
7507 2009-03-17  Ian Lance Taylor  <iant@google.com>
7508
7509         * archive.cc (Archive::add_symbols): Check for a version attached
7510         to the symbol name in the archive map.
7511         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7512         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7513         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7514         (ver_test_11.a): New target.
7515         * testsuite/Makefile.in: Rebuild.
7516
7517         * configure.ac: Check for chsize and posix_fallocate.  Replace
7518         ftruncate.
7519         * ftruncate.c: New file, from gnulib.
7520         * output.cc (posix_fallocate): Define dummy version if not
7521         HAVE_POSIX_FALLOCATE.
7522         (Output_file::map): Call posix_fallocate rather than lseek and
7523         write.
7524         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7525         * configure, Makefile.in, config.in: Rebuild.
7526
7527 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
7528
7529         * layout.h (Layout::create_note): Add section_name parameter.
7530         * layout.cc (Layout::create_note): Likewise.
7531         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7532
7533 2009-03-17  Ian Lance Taylor  <iant@google.com>
7534
7535         * descriptors.cc: Include "options.h".
7536         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7537         (Descriptors::open): Always use O_CLOEXEC when opening a new
7538         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
7539         then set FD_CLOEXEC.
7540
7541         * sparc.cc (class Target_sparc): Add has_got_section.
7542         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7543         make sure we have a GOT section.
7544
7545         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7546         (Target_sparc::Scan::local): Likewise.
7547         (Target_sparc::Scan::global): Likewise.
7548         (Target_sparc::Relocate::relocate): Likewise.
7549         (Target_sparc::Relocate::relocate_tls): Likewise.
7550
7551         * symtab.cc (Symbol_table::define_default_version): New function,
7552         broken out of add_from_object.
7553         (Symbol_table::add_from_object): Call define_default_version.
7554         (Symbol_table::define_special_symbol): Add resolve_oldsym
7555         parameter.  Change all callers.  If the version for a symbol comes
7556         from a version script, resolve it with the symbol with the same
7557         name with no version.  Also add the symbol without a version if
7558         appropriate.
7559         (do_define_in_output_data): If resolving with oldsym, don't delete
7560         sym.
7561         (do_define_in_output_segment): Likewise.
7562         (do_define_as_constant): Likewise.
7563         * symtab.h (class Symbol_table): Update declarations.
7564
7565 2009-03-13  Ian Lance Taylor  <iant@google.com>
7566
7567         * readsyms.cc (Read_symbols::incompatible_warning): New function.
7568         (Read_symbols::requeue): New function.
7569         (Read_symbols::do_read_symbols): If make_elf_object fails because
7570         the target type is not configured, and the file was searched for,
7571         issue a warning and retry with the next directory.
7572         (Add_symbols::run): If the file has an incompatible format, and
7573         it was searched for, requeue the Read_symbols task.  On error,
7574         release the object.
7575         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
7576         dirindex parameter to constructor.  Change all callers.  Declare
7577         incompatible_warning and requeue.
7578         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7579         input_argument_ and input_group_ fields.  Add them to
7580         constructor.  Change all callers.
7581         (class Read_script): Add dirindex_ field.  Add it to constructor.
7582         Change all callers.
7583         * archive.cc (Archive::setup): Remove input_objects parameter.
7584         Change all callers.
7585         (Archive::get_file_and_offset): Likewise.
7586         (Archive::read_all_symbols): Likewise.
7587         (Archive::read_symbols): Likewise.
7588         (Archive::get_elf_object_for_member): Remove input_objects
7589         parameter.  Add punconfigured parameter.  Change all callers.
7590         (Archive::add_symbols): Change return type to bool.  Check return
7591         value of include_member.
7592         (Archive::include_all_members): Likewise.
7593         (Archive::include_member): Change return type to bool.  Return
7594         false if first included object has incompatible target.  Set
7595         included_member_ field.
7596         (Add_archive_symbols::run): If add_symbols returns false, requeue
7597         Read_symbols task.
7598         * archive.h (class Archive): Add included_member_ field.
7599         Initialize it in constructor.  Add input_file and searched_for
7600         methods.  Update declarations.
7601         (class Add_archive_symbols): Add dirpath_, dirindex_, and
7602         input_argument_ fields.  Add them to constructor.  Change all
7603         callers.
7604         * script.cc: Include "target-select.h".
7605         (class Parser_closure): Add skip_on_incompatible_target_ and
7606         found_incompatible_target_ fields.  Add
7607         skip_on_incompatible_target parameter to constructor.  Change all
7608         callers.  Add methods skip_on_incompatible_target,
7609         clear_skip_on_incompatible_target, found_incompatible_target, and
7610         set_found_incompatible_target.
7611         (read_input_script): Add dirindex parameter.  Change all callers.
7612         If parser finds an incompatible target, requeue Read_symbols
7613         task.
7614         (script_set_symbol): Clear skip_on_incompatible_target in
7615         closure.
7616         (script_add_assertion, script_parse_option): Likewise.
7617         (script_start_sections, script_add_phdr): Likewise.
7618         (script_check_output_format): New function.
7619         * script.h (read_input_script): Update declaration.
7620         * script-c.h (script_check_output_format): Declare.
7621         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7622         (ignore_cmd): Remove OUTPUT_FORMAT.
7623         * fileread.cc (Input_file::Input_file): Add explicit this.
7624         (Input_file::will_search_for): New function.
7625         (Input_file::open): Add pindex parameter.  Change all callers.
7626         * fileread.h (class Input_file): Add input_file_argument method.
7627         Declare will_search_for.  Update declarations.
7628         * object.cc (make_elf_object): Add punconfigured parameter.
7629         Change all callers.
7630         * object.h (class Object): Make input_file public.  Add
7631         searched_for method.
7632         (make_elf_object): Update declaration.
7633         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
7634         restart search.
7635         * dirsearch.h (class Dirsearch): Update declaration.
7636         * options.h (class General_options): Add --warn-search-mismatch.
7637         * parameters.cc (Parameters::is_compatible_target): New function.
7638         * parameters.h (class Parameters): Declare is_compatible_target.
7639         * workqueue.cc (Workqueue::add_blocker): New function.
7640         * workqueue.h (class Workqueue): Declare add_blocker.
7641
7642         * fileread.cc (Input_file::open): Remove options parameter.
7643         Change all callers.
7644         (Input_file::open_binary): Likewise.
7645         * script.cc (read_input_script): Likewise.
7646         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
7647         options parameter from constructor.  Change all callers.
7648         (class Read_script): Likewise.
7649         * fileread.h (class Input_file): Update declarations.
7650         * script.h (read_input_script): Update declaration.
7651
7652 2009-03-10  Nick Clifton  <nickc@redhat.com>
7653
7654         * po/es.po: New Spanish translation.
7655
7656 2009-03-06  Cary Coutant  <ccoutant@google.com>
7657
7658         * options.cc (parse_short_option): Keep dash_z from registering itself.
7659
7660 2009-03-03  Ian Lance Taylor  <iant@google.com>
7661
7662         PR 9918
7663         * target-reloc.h (relocate_section): Pass output_section to
7664         relocate.
7665         * i386.cc (Target_i386::should_apply_static_reloc): Add
7666         output_section parameter.  Change all callers.
7667         (Target_i386::Relocate::relocate): Add output_section parameter.
7668         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7669         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7670         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7671         * testsuite/two_file_shared.sh: New script.
7672         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7673         (check_DATA): Add two_file_shared.dbg.
7674         (two_file_shared.dbg): New target.
7675         * testsuite/Makefile.in: Rebuild.
7676
7677 2009-03-01  Ian Lance Taylor  <iant@google.com>
7678
7679         * configure.ac: Check for byteswap.h.
7680         * configure: Rebuild.
7681         * config.in: Rebuild.
7682
7683 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
7684
7685         * layout.cc (Layout::find_or_add_kept_section): New function.
7686         (Layout::add_comdat): Removed.
7687         * layout.h (struct Kept_section): Move out of class Layout.
7688         Remove trailing underscores from field names.  Add group_sections
7689         field.  Rename group_ field to is_group.  Change all uses.
7690         (class Layout): Declare find_or_add_kept_section, not add_comdat.
7691         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7692         comdat_groups_ field.
7693         (Sized_relobj::include_section_group): Use
7694         find_or_add_kept_section and Kept_section::group_sections.
7695         (Sized_relobj::include_linkonce_section): Likewise.
7696         * object.cc (class Sized_relobj): Don't define Comdat_group or
7697         Comdat_group_table.  Remove find_comdat_group and
7698         add_comdat_group.  Remove comdat_groups_ field.
7699         * plugin.cc (include_comdat_group): Use
7700         Layout::find_or_add_kept_section.
7701
7702 2009-02-28  Ian Lance Taylor  <iant@google.com>
7703
7704         * README: --gc-sections and map files are now supported.  Document
7705         some build requirements.
7706
7707         PR 6992
7708         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7709         relocatable link set the value of the section symbol to zero.
7710         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7711         relocatable link don't include the section address in the local
7712         symbol value.
7713
7714 2009-02-27  Ian Lance Taylor  <iant@google.com>
7715
7716         PR 6811
7717         * options.h (class Search_directory): Add is_system_directory.
7718         (class General_options): Declare is_in_system_directory.
7719         * options.cc (get_relative_sysroot): Make static.
7720         (get_default_sysroot): Make static.
7721         (General_optoins::is_in_system_directory): New function.
7722         * fileread.cc (Input_file::is_in_system_directory): New function.
7723         * fileread.h (class Input_file): Declare is_in_system_directory.
7724         * object.h (class Object): Add is_in_system_directory.
7725         (class Input_objects): Remove system_library_directory_ field.
7726         * object.cc (Input_objects::add_object): Don't set
7727         system_library_directory_.
7728         (input_objects::found_in_system_library_directory): Remove.
7729         * symtab.cc (Symbol_table::write_globals): Remove input_objects
7730         parameter.  Change all callers.
7731         (Symbol_table::sized_write_globals): Likewise.
7732         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7733         Call Object::is_in_system_directory.
7734         * symtab.h (class Symbol_table): Update declarations.
7735
7736         PR 5990
7737         * descriptors.h (Open_descriptor): Add is_on_stack field.
7738         * descriptors.cc (Descriptors::open): If the descriptor is on the
7739         top of the stack, remove it.  Initialize is_on_stack field.
7740         (Descriptors::release): Only add pod to stack if it is not on the
7741         stack already.
7742         (Descriptors::close_some_descriptor): Clear stack_next and
7743         is_on_stack fields.
7744
7745         PR 7091
7746         * output.cc (Output_section::find_starting_output_address): Rename
7747         from starting_output_address; add PADDR parameter; change return
7748         type.
7749         * output.h (class Output_section): Declare
7750         find_starting_output_address instead of starting_output_address.
7751         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7752         section symbol for which we can't find a merge section.
7753
7754         PR 9836
7755         * symtab.cc (Symbol_table::add_from_object): If the visibility is
7756         hidden or internal, force the symbol to be local.
7757         * resolve.cc (Symbol::override_visibility): Define.
7758         (Symbol::override_base): Use override_visibility.
7759         (Symbol_table::resolve): Likewise.
7760         (Symbol::override_base_with_special): Likewise.
7761         (Symbol_table::override_with_special): If the visibility is hidden
7762         or internal, force the symbol to be local.
7763         * symtab.h (class Symbol): Add set_visibility and
7764         override_visibility.
7765         * testsuite/ver_test_1.sh: New file.
7766         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7767         (check_DATA): Add ver_test_1.syms.
7768         (ver_test_1.syms): New target.
7769         * testsuite/Makefile.in: Rebuild.
7770
7771 2009-02-25  Cary Coutant  <ccoutant@google.com>
7772
7773         * layout.cc (Layout::choose_output_section): Don't rename sections
7774         when using a linker script that has a SECTIONS clause.
7775         * Makefile.in: Regenerate.
7776
7777         * testsuite/Makefile.am (script_test_5.sh): New test case.
7778         * testsuite/Makefile.in: Regenerate.
7779         * testsuite/script_test_5.cc: New file.
7780         * testsuite/script_test_5.sh: New file.
7781         * testsuite/script_test_5.t: New file.
7782
7783 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
7784
7785         * archive.cc (Archive::include_member): Update calls to add_symbols.
7786         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7787         the Layout argument.
7788         * dynobj.h (do_add_symbols): Add the Layout argument.
7789         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7790         Layout argument.
7791         * object.h (Object::add_symbols): Add the Layout argument.
7792         (Object::do_add_symbols): Add the Layout argument.
7793         (Sized_relobj::do_add_symbols): Add the Layout argument.
7794         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7795         Unify the two versions.
7796         (Add_plugin_symbols): Remove.
7797         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7798         (Sized_pluginobj::do_add_symbols): Unify the two versions.
7799         (Add_plugin_symbols): Remove.
7800         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7801         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7802         (Add_symbols::run): Make it work with Pulginobj.
7803
7804 2009-02-06  Ian Lance Taylor  <iant@google.com>
7805
7806         * object.cc (Sized_relobj::do_layout): Make info message start
7807         with lower case letter.
7808
7809 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
7810
7811         * binary.cc: Fix file comment.
7812
7813         * options.h (enum Incremental_disposition): Define.
7814         (class General_options): Add new options: --incremental,
7815         --incremental_changed, --incremental_unchanged,
7816         --incremental_unknown.  Add incremental_disposition_ and
7817         implicit_incremental_ fields.
7818         (General_options::incremental_disposition): New function.
7819         (class Position_dependent_options): Add incremental_disposition
7820         option.
7821         (Position_dependent_options::copy_from_options): Set incremental
7822         dispositions.
7823         * options.cc (General_options::parse_incremental_changed): New
7824         function.
7825         (General_options::parse_incremental_unchanged): New function.
7826         (General_options::parse_incremental_unknown): New function.
7827         (General_options::General_options): Initialize new fields
7828         incremental_disposition_ and implicit_incremental_.
7829         (General_options::finalize): Check for uasge of --incremental-*
7830         without --incremental.
7831
7832 2009-02-06  Chris Demetriou  <cgd@google.com>
7833
7834         * gold.h (gold_undefined_symbol): Change to take only a Symbol
7835         pointer and to report location as the file name associated with
7836         the symbol.
7837         (gold_undefined_symbol_at_location): New function to replace the
7838         old gold_undefined_symbol functionality.
7839         * target-reloc.h (relocate_section): Update to use
7840         gold_undefined_symbol_at_location.
7841         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7842         Call gold_undefined_symbol function rather than gold_error.
7843         * errors.h (Errors::undefined_symbol): Take location as a
7844         string, rather than calculating it from a relocation.
7845         * errors.cc (Errors::fatal): Print "fatal error:" before the
7846         formatted message.
7847         (Errors::error, Errors::error_at_location): Print "error: "
7848         before the formatted message.
7849         (Errors::undefined_symbol): Take location as a string, rather
7850         than calculating it from a relocation.
7851         (gold_undefined_symbol_at_location): New function akin to
7852         old gold_undefined_symbol, calculates location from relocation.
7853         (gold_undefined_symbol): Change to take only a Symbol pointer
7854         and to report location as the file name associated with the symbol.
7855         * testsuite/debug_msg.sh: Update for changed error messages.
7856         * testsuite/undef_symbol.sh: Likewise.
7857
7858 2009-02-04  Duncan Sands  <baldrick@free.fr>
7859
7860         PR 9812
7861         * reduced_debug_output.h
7862         (Output_reduced_debug_abbrev_section::failed): Use format for
7863         gold_warning.
7864         (Output_reduced_debug_info_section::faild): Likewise.
7865
7866 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
7867
7868         * script.cc (Lazy_demangler): New class.
7869         (Version_script_info::get_symbol_version_helper): Demangle a
7870         symbol only once.
7871
7872 2009-01-29  Cary Coutant  <ccoutant@google.com>
7873
7874         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7875         to __tls_get_addr.
7876         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7877
7878 2009-01-28  Ian Lance Taylor  <iant@google.com>
7879
7880         * version.cc (version_string): Bump to 1.9.
7881
7882         * gold.h: Include <cstring> and <stdint.h>.
7883         * version.cc: Include <cstdio>.
7884         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7885         warning.
7886         * reduced_debug_output.cc (insert_into_vector): Rename from
7887         Insert_into_vector; change all callers.  Use Swap_unaligned to
7888         avoid aliasing issue; remove union since it is unnecessary.
7889
7890 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
7891
7892         * Makefile.am (CCFILES): Add gc.cc.
7893         (HFILES): Add gc.h.
7894         * Makefile.in: Regenerate.
7895         * gold.cc (Gc_runner): New class.
7896         (queue_initial_tasks): Call garbage collection related tasks
7897         when corresponding options are invoked.
7898         (queue_middle_gc_tasks): New function.
7899         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7900         processed early before laying out sections during garbage collection.
7901         * gold.h (queue_middle_gc_tasks): New function.
7902         (is_prefix_of): Move from "layout.cc".
7903         * i386.cc (Target_i386::gc_process_relocs): New function.
7904         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7905         * main.cc (main): Create object of class "Garbage_collection".
7906         * object.cc (Relobj::copy_symbols_data): New function.
7907         (Relobj::is_section_name_included): New function.
7908         (Sized_relobj::do_layout): Allow this function to be called twice
7909         during garbage collection and defer layout of section during the
7910         first call.
7911         * object.h (Relobj::get_symbols_data): New function.
7912         (Relobj::is_section_name_included): New function.
7913         (Relobj::copy_symbols_data): New function.
7914         (Relobj::set_symbols_data): New function.
7915         (Relobj::get_relocs_data): New function.
7916         (Relobj::set_relocs_data): New function.
7917         (Relobj::is_output_section_offset_invalid): New pure virtual function.
7918         (Relobj::gc_process_relocs): New function.
7919         (Relobj::do_gc_process_relocs): New pure virtual function.
7920         (Relobj::sd_): New data member.
7921         (Sized_relobj::is_output_section_offset_invalid): New function.
7922         (Sized_relobj::do_gc_process_relocs): New function.
7923         * options.h (General_options::gc_sections): Modify to not be a no-op.
7924         (General_options::print_gc_sections): New option.
7925         * plugin.cc (Plugin_finish::run): Remove function call to
7926         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
7927         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7928         * reloc.cc (Read_relocs::run): Add task to process relocs and
7929         determine unreferenced sections when doing garbage collection.
7930         (Gc_process_relocs): New class.
7931         (Sized_relobj::do_gc_process_relocs): New function.
7932         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7933         sections that are garbage collected.
7934         * reloc.h (Gc_process_relocs): New class.
7935         * sparc.cc (Target_sparc::gc_process_relocs): New function.
7936         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7937         symbols whose corresponding sections are garbage collected.
7938         (Symbol_table::Symbol_table): Add new parameter for the garbage
7939         collection object.
7940         (Symbol_table::gc_mark_undef_symbols): New function.
7941         (Symbol_table::gc_mark_symbol_for_shlib): New function.
7942         (Symbol_table::gc_mark_dyn_syms): New function.
7943         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7944         as garbage.
7945         (Symbol_table::add_from_object): Likewise.
7946         (Symbol_table::add_from_relobj): When building shared objects, do not
7947         treat externally visible symbols as garbage.
7948         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7949         table information for static and relocatable links.
7950         * symtab.h (Symbol_table::set_gc): New function.
7951         (Symbol_table::gc): New function.
7952         (Symbol_table::gc_mark_undef_symbols): New function.
7953         (Symbol_table::gc_mark_symbol_for_shlib): New function.
7954         (Symbol_table::gc_mark_dyn_syms): New function.
7955         (Symbol_table::gc_): New data member.
7956         * target.h (Sized_target::gc_process_relocs): New pure virtual
7957         function.
7958         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7959         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7960
7961 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
7962
7963         * options.h (General_options::gc_sections): Define as a no-op for now.
7964         (General_options::no_keep_memory): Ditto.
7965         (General_options::Bshareable): Define.
7966         * options.cc (General_options::finalize): Honor -Bshareable.
7967
7968 2009-01-20  Andreas Schwab  <schwab@suse.de>
7969
7970         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7971         read the value in the contents, since we don't use it.  Use the
7972         template endianness when writing.
7973         (Relocate::relocate): Use it for R_PPC_REL16_HA.
7974
7975 2009-01-19  Andreas Schwab  <schwab@suse.de>
7976
7977         * configure.tgt (powerpc64-*): Fix targ_obj.
7978
7979 2009-01-15  Ian Lance Taylor  <iant@google.com>
7980
7981         * object.cc (Sized_relobj::write_local_symbols): Don't write out
7982         local symbols when stripping all symbols.
7983
7984 2009-01-14  Cary Coutant  <ccoutant@google.com>
7985
7986         * output.cc (Output_reloc): Add explicit instantiations.
7987
7988 2009-01-14  Cary Coutant  <ccoutant@google.com>
7989
7990         * archive.cc (Archive::get_elf_object_for_member): Remove call
7991         to File_read::claim_for_plugin.
7992         * descriptors.cc (Descriptors::open): Remove reference to
7993         is_claimed.
7994         (Descriptors::claim_for_plugin): Remove.
7995         * descriptors.h (Descriptors::claim_for_plugin): Remove.
7996         (Descriptors::is_claimed): Remove.
7997         (claim_descriptor_for_plugin): Remove.
7998         * fileread.cc (File_read::claim_for_plugin): Remove.
7999         * fileread.h (File_read::claim_for_plugin): Remove.
8000         (File_read::descriptor): Reopen descriptor if necessary.
8001         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
8002         (Plugin_manager::all_symbols_read): Add task parameter. Change
8003         all callers.
8004         (Plugin_manager::get_input_file): New function.
8005         (Plugin_manager::release_input_file): New function.
8006         (Pluginobj::Pluginobj): Add filesize parameter and initialize
8007         corresponding data member.
8008         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8009         and pass to base constructor. Change all callers.
8010         (get_input_file, release_input_file): New functions.
8011         (make_sized_plugin_object): Add filesize parameter. Change all callers.
8012         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8013         (Plugin_manager::all_symbols_read): Add task parameter.
8014         (Plugin_manager::get_input_file): New function.
8015         (Plugin_manager::release_input_file): New function.
8016         (Plugin_manager::task_): New data member.
8017         (Pluginobj::Pluginobj): Add filesize parameter.
8018         (Pluginobj::filename): New function.
8019         (Pluginobj::descriptor): New function.
8020         (Pluginobj::filesize): New function.
8021         (Pluginobj::filesize_): New data member.
8022         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8023         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8024         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8025
8026         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8027         with archive libraries.
8028         * testsuite/Makefile.in: Regenerate.
8029         * testsuite/plugin_test.c (struct sym_info): New type.
8030         (get_input_file, release_input_file): New static variables.
8031         (onload): Capture new transfer vector entries.
8032         (claim_file_hook): Stop reading at end of file according to filesize.
8033         Factor out parsing of readelf output into separate function.
8034         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8035         APIs and get the source file name from the symbol table.  Convert
8036         source file name to corresponding object file name.  Print info
8037         message when adding new input files.
8038         (parse_readelf_line): New function.
8039         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8040         * testsuite/plugin_test_2.sh: Likewise.
8041         * testsuite/plugin_test_3.sh: Likewise.
8042         * testsuite/plugin_test_4.sh: New test case.
8043
8044 2009-01-07  Ian Lance Taylor  <iant@google.com>
8045
8046         * version.cc (version_string): Bump to 1.8.
8047
8048 2008-12-23  Cary Coutant  <ccoutant@google.com>
8049
8050         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8051         * plugin.cc (Plugin_manager::finish): Rename as
8052         layout_deferred_objects.  Move cleanup to separate function.
8053         (Plugin_manager::cleanup): New function.
8054         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8055         separately.
8056         * plugin.h (Plugin_manager::finish): Rename as
8057         layout_deferred_objects.
8058         (Plugin_manager::cleanup): New function.
8059         (Plugin_manager::cleanup_done): New field.
8060
8061 2008-12-23  Cary Coutant  <ccoutant@google.com>
8062
8063         * plugin.cc (is_visible_from_outside): New function.
8064         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8065         so we don't return "IR only" status for exported symbols or -r links.
8066
8067         * testsuite/Makefile.am (plugin_test_3): New test case.
8068         * testsuite/Makefile.in: Regenerate.
8069         * testsuite/plugin_test_3.sh: New file.
8070
8071 2008-12-22  Cary Coutant  <ccoutant@google.com>
8072
8073         * object.cc (Sized_relobj::layout_section): New function.
8074         (Sized_relobj::do_layout): Defer layout of input sections until after
8075         plugin has provided replacement files.
8076         (Sized_relobj::do_layout_deferred_sections): New function.
8077         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8078         (Relobj::layout_deferred_sections): New function.
8079         (Relobj::do_layout_deferred_sections): New function.
8080         (Sized_relobj::do_layout_deferred_sections): New function.
8081         (Sized_relobj::layout_section): New function.
8082         (Sized_relobj::Deferred_layout): New structure.
8083         (Sized_relobj::deferred_layout_): New field.
8084         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8085         Change all callers.  Layout deferred sections.
8086         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8087         references.
8088         (Plugin_hook::run): Move code from do_plugin_hook inline.
8089         (Plugin_hook::do_plugin_hook): Remove.
8090         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8091         (Plugin_manager::finish): Renamed, was cleanup.
8092         (Plugin_manager::should_defer_layout): New function.
8093         (Plugin_manager::add_deferred_layout_object): New function.
8094         (Plugin_manager::Deferred_layout_list): New type.
8095         (Plugin_manager::deferred_layout_objects_): New field.
8096         (Plugin_hook::do_plugin_hook): Remove.
8097
8098 2008-12-17  Ian Lance Taylor  <iant@google.com>
8099
8100         * options.h (class General_options): Add --no case for
8101         --export-dynamic.
8102
8103 2008-12-16  Cary Coutant  <ccoutant@google.com>
8104
8105         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8106         vector.
8107         (Plugin_manager::claim_file): Create plugin object even if
8108         plugin did not call the add_symbols callback.
8109         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8110         asking for more symbols than were added.
8111         * testsuite/Makefile.am (plugin_test_1): Add test case with
8112         no global symbols.
8113         (empty.syms): New target.
8114         * testsuite/Makefile.in: Regenerate.
8115         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8116         message. Don't call add_symbols if no globals.
8117         (all_symbols_read_hook): Don't provide replacement for empty
8118         claimed file.
8119
8120 2008-12-12  Ian Lance Taylor  <iant@google.com>
8121
8122         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8123         r_type == 0 for a local symbol with r_sym == 0.
8124         (scan_relocatable_relocs): Pass r_sym to
8125         local_non_section_strategy.
8126         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8127         r_sym parameter.
8128
8129         * configure.ac: Update test for TLS descriptors: they are
8130         supported as of glibc 2.9.
8131         * configure: Rebuild.
8132
8133 2008-12-11  Ian Lance Taylor  <iant@google.com>
8134
8135         PR 7091
8136         * target-reloc.h (Default_scan_relocatable_relocs): For each
8137         function, map r_type == 0 to RELOC_DISCARD.
8138
8139 2008-12-10  Cary Coutant  <ccoutant@google.com>
8140
8141         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8142         object to override a kept COMDAT group from a plugin object.
8143
8144 2008-12-09  Ian Lance Taylor  <iant@google.com>
8145
8146         PR 7088
8147         * yyscript.y (file_cmd): Handle INPUT.
8148
8149         * testsuite/initpri1.c: Change all declarations to be full
8150         prototypes by adding void, to avoid compiler warnings.
8151
8152 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8153
8154         * options.cc (General_options::parse_plugin_opt): New.
8155         (General_options::add_plugin): The argument now is just the filename.
8156         (General_options::add_plugin_option): New.
8157         * options.h (plugin_opt): New.
8158         (add_plugin): Change argument name.
8159         (add_plugin_option): New.
8160         * plugin.cc (Plugin::load): Don't parse the plugin option.
8161         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8162         (Plugin::add_option): New.
8163         (Plugin::args_): Change type.
8164         (Plugin::filename_): New.
8165         (Plugin_manager::add_plugin_option): New.
8166         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8167         * testsuite/Makefile.in: Regenerate.
8168
8169 2008-12-05  Cary Coutant  <ccoutant@google.com>
8170
8171         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8172         Handle --strip-lto-sections option.
8173         * options.h (strip_lto_sections): New option.
8174
8175 2008-12-01  Cary Coutant  <ccoutant@google.com>
8176
8177         * plugin.cc (ld_plugin_message): Change format parameter to const.
8178         Fix mismatch between new[] and delete.
8179
8180 2008-11-14  Cary Coutant  <ccoutant@google.com>
8181
8182         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8183         instead of -1U.
8184
8185 2008-11-05  Craig Silverstein  <csilvers@google.com>
8186
8187         * options.cc (General_options::parse_dynamic_list): New function.
8188         * options.h (General_options): New flags dynamic_list,
8189         dynamic_list_data, dynamic_list_cpp_new, and
8190         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8191         (General_options::in_dynamic_list): New function.
8192         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8193         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8194         (Lex::can_continue_name): Likewise.
8195         (yylex): Likewise.
8196         (read_script_file): New parameter script_options.
8197         (read_dynamic_list): New function.
8198         (Script_options::define_dynamic_list): New function.
8199         (dynamic_list_keyword_parsecodes): New variable.
8200         (dynamic_list_keywords): New variable.
8201         * script.h (Script_options::define_dynamic_list): New function
8202         prototype.
8203         (read_dynamic_list): New function prototype.
8204         * symtab.cc (strprefix): New macro.
8205         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8206         dynamic_list_data, dynamic_list_cpp_new, and
8207         dynamic_list_cpp_typeinfo.
8208         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8209         (dynamic_list_expr): New rule.
8210         (dynamic_list_nodes): Likewise.
8211         (dynamic_list_node): Likewise.
8212         * testsuite/Makefile.am (dynamic_list): New test.
8213         * testsuite/Makefile.in: Regenerated.
8214         * testsuite/dynamic_list.t: New file.
8215         * testsuite/dynamic_list.sh: New file.
8216
8217 2008-11-05  Craig Silverstein  <csilvers@google.com>
8218
8219         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8220         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8221         (t11_last): Likewise.
8222         * testsuite/ver_test_6.c (main): Likewise.
8223
8224 2008-10-07  Cary Coutant  <ccoutant@google.com>
8225
8226         * options.c (General_options::finalize): Add check for -static and
8227         -shared.
8228         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8229         is not empty.
8230
8231 2008-10-02  Cary Coutant  <ccoutant@google.com>
8232
8233         * plugin.cc (make_sized_plugin_object): Fix conditional
8234         compilation to work when not all targets are enabled.
8235
8236 2008-09-29  Cary Coutant  <ccoutant@google.com>
8237
8238         * archive.cc (Archive::get_file_and_offset): Use filename instead
8239         of name to get library path.
8240         (Archive::include_member): Unlock external member of a thin archive.
8241
8242         * testsuite/Makefile.am (TEST_AR): New variable.
8243         (thin_archive_test_1): New test.
8244         (thin_archive_test_2): New test.
8245         * testsuite/Makefile.in: Regenerate.
8246         * testsuite/thin_archive_main.cc: New file.
8247         * testsuite/thin_archive_test_1.cc: New file.
8248         * testsuite/thin_archive_test_2.cc: New file.
8249         * testsuite/thin_archive_test_3.cc: New file.
8250         * testsuite/thin_archive_test_4.cc: New file.
8251
8252 2008-09-29  Cary Coutant  <ccoutant@google.com>
8253
8254         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8255         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8256         instead of -1U.
8257         (Sized_relobj::do_finalize_local_symbols): Likewise.
8258         (Sized_relobj::map_to_kept_section): Likewise.
8259         * object.h (Sized_relobj::invalid_address): New constant.
8260         (Sized_relobj::do_output_section_offset): Check for invalid_address
8261         and return -1ULL.
8262         * output.cc (Output_reloc::local_section_offset): Use constant
8263         invalid_address instead of -1U.
8264         (Output_reloc::get_address): Likewise.
8265         (Output_section::output_address): Change -1U to -1ULL.
8266         * output.h (Output_reloc::invalid_address): New constant.
8267         * reloc.cc (Sized_relobj::write_sections): Use constant
8268         invalid_address instead of -1U.
8269         (Sized_relobj::relocate_sections): Likewise.
8270         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8271         values for merge sections.
8272         * target-reloc.h (relocate_for_relocatable): Use constant
8273         invalid_address instead of -1U.
8274
8275 2008-09-19  Cary Coutant  <ccoutant@google.com>
8276
8277         Add plugin functionality for link-time optimization (LTO).
8278         * configure.ac (plugins): Add --enable-plugins option.
8279         * configure: Regenerate.
8280         * config.in: Regenerate.
8281         * Makefile.am (LIBDL): New variable.
8282         (CCFILES): Add plugin.cc.
8283         (HFILES): Add plugin.h.
8284         (ldadd_var): Add LIBDL.
8285         * Makefile.in: Regenerate.
8286
8287         * archive.cc: Include "plugin.h".
8288         (Archive::setup): Don't preread archive symbols when using a plugin.
8289         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8290         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8291         files.
8292         (Archive::include_member): Add symbols from plugin objects.
8293         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8294         * descriptors.cc (Descriptors::open): Check for file descriptors
8295         abandoned by plugins.
8296         (Descriptors::claim_for_plugin): New function.
8297         * descriptors.h (Descriptors::claim_for_plugin): New function.
8298         (Open_descriptor::is_claimed): New field.
8299         (claim_descriptor_for_plugin): New function.
8300         * fileread.cc (File_read::claim_for_plugin): New function.
8301         * fileread.h (File_read::claim_for_plugin): New function.
8302         (File_read::descriptor): New function.
8303         * gold.cc: Include "plugin.h".
8304         (queue_initial_tasks): Add task to call plugin hooks for generating
8305         new object files.
8306         * main.cc: Include "plugin.h".
8307         (main): Load plugin libraries.
8308         * object.h (Pluginobj): Declare.
8309         (Object::pluginobj): New function.
8310         (Object::do_pluginobj): New function.
8311         (Object::set_target): New function.
8312         * options.cc: Include "plugin.h".
8313         (General_options::parse_plugin): New function.
8314         (General_options::General_options): Initialize plugins_ field.
8315         (General_options::add_plugin): New function.
8316         * options.h (Plugin_manager): Declare.
8317         (General_options): Add --plugin option.
8318         (General_options::has_plugins): New function.
8319         (General_options::plugins): New function.
8320         (General_options::add_plugin): New function.
8321         (General_options::plugins_): New field.
8322         * plugin.cc: New file.
8323         * plugin.h: New file.
8324         * readsyms.cc: Include "plugin.h".
8325         (Read_symbols::do_read_symbols): Check for archive before checking
8326         for ELF file.  Call plugin hooks to claim files.
8327         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8328         from a real object file; force override when processing replacement
8329         files.
8330         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8331         (Symbol::init_base_object): Likewise.
8332         (Symbol::init_base_output_data): Likewise.
8333         (Symbol::init_base_output_segment): Likewise.
8334         (Symbol::init_base_constant): Likewise.
8335         (Symbol::init_base_undefined): Likewise.
8336         (Symbol::output_section): Assert that object is not a plugin.
8337         (Symbol_table::add_from_pluginobj): New function.
8338         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8339         undefined.
8340         (Symbol_table::sized_write_globals): Likewise.
8341         (Symbol_table::add_from_pluginobj): Instantiate template.
8342         * symtab.h (Sized_pluginobj): Declare.
8343         (Symbol::in_real_elf): New function.
8344         (Symbol::set_in_real_elf): New function.
8345         (Symbol::in_real_elf_): New field.
8346         (Symbol_table::add_from_pluginobj): New function.
8347
8348         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8349         (LIBDL): New variable.
8350         (LDADD): Add LIBDL.
8351         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8352         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8353         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8354         (MOSTLYCLEANFILES): Likewise.
8355         * testsuite/Makefile.in: Regenerate.
8356         * testsuite/plugin_test.c: New file.
8357         * testsuite/plugin_test_1.sh: New file.
8358         * testsuite/plugin_test_2.sh: New file.
8359
8360 2008-09-16  Ian Lance Taylor  <iant@google.com>
8361
8362         * target-reloc.h (relocate_section): Check whether a symbol is
8363         defined by the ABI before reporting an undefined symbol error.
8364         * target.h (Target::is_defined_by_abi): Make parameter const.
8365         (Target::do_is_defined_by_abi): Likewise.
8366         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8367         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8368         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8369         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8370         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8371         * testsuite/Makefile.in: Rebuild.
8372
8373         * fileread.cc (make_view): Add casts to avoid warning.
8374
8375 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8376
8377         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8378         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8379
8380 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8381
8382         * options.h (General_options::output_is_executable): New.
8383         (General_options::output_is_pie): New.
8384         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8385         for shared libraries.
8386         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8387
8388 2008-09-11  Chris Demetriou  <cgd@google.com>
8389
8390         * options.h (origin): New -z option.
8391         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8392         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8393         in DT_FLAGS_1.
8394
8395 2008-09-05  Cary Coutant  <ccoutant@google.com>
8396
8397         * fileread.cc (File_read::make_view): Add check for attempt to map
8398         beyond end of file.
8399
8400 2008-09-05  Cary Coutant  <ccoutant@google.com>
8401
8402         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8403         explicit instantiations.
8404
8405 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
8406
8407         PR gold/6858
8408         * options.cc (General_options::finalize): Allow undefined symbols
8409         in shlibs if linking -shared.
8410
8411         PR gold/6859
8412         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8413         symbols as not needing a dynsym entry.
8414
8415 2008-08-20  Craig Silverstein  <csilvers@google.com>
8416
8417         * fileread.cc (File_read::open): Do not lock the file unless it
8418         was successfully opened.
8419
8420 2008-08-14  Cary Coutant  <ccoutant@google.com>
8421
8422         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8423         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8424         * testsuite/tls_test.cc (struct int128): 128-bit struct
8425         for testing TLS relocs with non-zero addend.
8426         (v12): New TLS variable.
8427         (t12): New test.
8428         (t_last): Add check for v12.
8429         * testsuite/tls_test.h (t12): New function.
8430         * testsuite/tls_test_main.cc (thread_routine): Call new test.
8431
8432 2008-08-13  Ian Lance Taylor  <iant@google.com>
8433
8434         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8435         set tls_segment_ or relro_segment_.
8436         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8437         when appropriate.
8438         * output.h (Output_section::clear_is_relro): New function.
8439         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8440         sections specially even when output_data_ is empty.
8441         (Output_segment::maximum_alignment): When first section is relro,
8442         only force alignment for PT_LOAD segments.
8443         * script.cc (script_data_segment_align): New function.
8444         (script_data_segment_relro_end): New function.
8445         * script-c.h (script_data_segment_align): Declare.
8446         (script_data_segment_relro_end): Declare.
8447         * script-sections.h (class Script_sections): Declare
8448         data_segment_align and data_segment_relro_end.  Add fields
8449         segment_align_index_ and saw_relro_end_.
8450         * script-sections.cc (class Sections_element): Add set_is_relro
8451         virtual function.  Add new bool* parameter to place_orphan_here.
8452         Add get_output_section virtual function.
8453         (class Output_section_definition): Add set_is_relro.  Add new
8454         bool* parameter to place_orphan_here.  Add get_output_section.
8455         Add is_relro_ field.
8456         (Output_section_definition::Output_section_definition): Initialize
8457         evaluated_address_, evaluated_load_address, evaluated_addralign_,
8458         and is_relro_ fields.
8459         (Output_section_definition::place_orphan_here): Add is_relro
8460         parameter.
8461         (Output_section_definition::set_section_addresses): Set relro for
8462         output section.
8463         (Output_section_definition::alternate_constraint): Likewise.
8464         (class Orphan_output_section): Add new bool* parameter to
8465         place_orphan_here.  Add get_output_section.
8466         (Orphan_output_section::place_orphan_here): Add is_relro
8467         parameter.
8468         (Script_sections::Script_sections): Initialize
8469         data_segment_align_index_ and saw_relro_end_.
8470         (Script_sections::data_segment_align): New function.
8471         (Script_sections::data_segment_relro_end): New function.
8472         (Script_sections::place_orphan): Set or clear is_relro.
8473         (Script_sections::set_section_addresses): Force alignment of first
8474         TLS section.
8475         * yyscript.y (exp): Call script_data_segment_align and
8476         script_data_segment_relro_end.
8477         * testsuite/relro_script_test.t: New file.
8478         * testsuite/relro_test.cc (using_script): Declare.
8479         (t1, t2): Test using_script.
8480         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8481         (relro_script_test_SOURCES): Define.
8482         (relro_script_test_DEPENDENCIES): Define.
8483         (relro_script_test_LDFLAGS): Define.
8484         (relro_script_test_LDADD): Define.
8485         (relro_script_test.so): New target.
8486         * testsuite/Makefile.in: Rebuild.
8487
8488 2008-08-06  Cary Coutant <ccoutant@google.com>
8489
8490         * archive.cc (Archive::total_archives, Archive::total_members)
8491         (Archive::total_members_loaded): New variables.
8492         (Archive::setup): Add parameter.  Add option to preread
8493         archive symbols.
8494         (Archive::read_armap): Add counter.
8495         (Archive::get_file_and_offset): New function.
8496         (Archive::get_elf_object_for_member): New function.
8497         (Archive::read_all_symbols): New function.
8498         (Archive::read_symbols): New function.
8499         (Archive::add_symbols): Add counters.
8500         (Archive::include_all_members): Use armap to find members if it's
8501         already built.
8502         (Archive::include_member): Skip reading symbols if already read.
8503         Factored code into Archive::get_file_and_offset and
8504         Archive::get_elf_object_for_member.  Changed call to
8505         Mapfile::report_include_archive_member.
8506         (Archive::print_stats): New function.
8507         * archive.h: Declare Object and Read_symbols_data classes.
8508         (Archive::Archive): Add initializers for new members.
8509         (Archive::setup): Add parameter.
8510         (Archive::print_stats): New function.
8511         (Archive::total_archives, Archive::total_members)
8512         (Archive::total_members_loaded): New variables.
8513         (Archive::get_file_and_offset): New function.
8514         (Archive::get_elf_object_for_member): New function.
8515         (Archive::read_all_symbols): New function.
8516         (Archive::read_symbols): New function.
8517         (Archive::Archive_member): New class.
8518         (Archive::members_): New member.
8519         (Archive::num_members_): New member.
8520         * main.cc: Include archive.h.
8521         (main): Call Archive::print_stats.
8522         * mapfile.cc (Mapfile::report_include_archive_member): Delete
8523         archive parameter; member_name is now the fully-decorated name.
8524         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8525         * options.h: (General_options): Add --preread-archive-symbols option.
8526         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8527         Archive::setup.
8528
8529 2008-08-04  Ian Lance Taylor  <iant@google.com>
8530
8531         * symtab.h (Symbol::use_plt_offset): New function.
8532         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8533         * powerpc.cc (Relocate::relocate): Likewise.
8534         * sparc.cc (Relocate::relocate): Likewise.
8535         * x86_64.cc (Relocate::relocate): Likewise.
8536         * testsuite/weak_plt.sh: New test.
8537         * testsuite/weak_plt_main.cc: New test.
8538         * testsuite/weak_plt_shared.cc: New test.
8539         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8540         (check_PROGRAMS): Add weak_plt.
8541         (check_DATA): Add weak_plt_shared.so.
8542         (weak_plt_main_pic.o, weak_plt): New targets.
8543         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8544         * testsuite/Makefile.in: Rebuild.
8545
8546         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8547         gcctestdir/ld.
8548         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8549         * testsuite/Makefile.in: Rebuild.
8550
8551 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
8552
8553         * Makefile.am (POTFILES.in): Set LC_ALL=C.
8554         * Makefile.in: Regenerate.
8555         * po/POTFILES.in: Regenerate.
8556
8557 2008-07-29  Ian Lance Taylor  <iant@google.com>
8558
8559         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8560         symbols before other symbols.
8561         * testsuite/script_test_2.cc (test_addr): Declare.
8562         (test_addr_alias): Declare.
8563         (main): Check that test_addr and test_addr_alias have the right
8564         values.
8565         * testsuite/script_test_2.t: Define test_addr_alias and
8566         test_addr.
8567
8568 2008-07-24  Ian Lance Taylor  <iant@google.com>
8569
8570         PR 5990
8571         * descriptors.cc: New file.
8572         * descriptors.h: New file.
8573         * gold-threads.h (class Hold_optional_lock): New class.
8574         * fileread.cc: Include "descriptors.h".
8575         (File_read::~File_read): Release descriptor rather than closing
8576         it.
8577         (File_read::open) [file]: Call open_descriptor rather than open.
8578         Set is_descriptor_opened_.
8579         (File_read::open) [memory]: Assert that descriptor is not open.
8580         (File_read::reopen_descriptor): New function.
8581         (File_read::release): Release descriptor.
8582         (File_read::do_read): Make non-const.  Reopen descriptor.
8583         (File_read::read): Make non-const.
8584         (File_read::make_view): Reopen descriptor.
8585         (File_read::do_readv): Likewise.
8586         * fileread.h (class File_read): Add is_descriptor_opened_ field.
8587         Update declarations.
8588         * layout.cc: Include "descriptors.h".
8589         (Layout::create_build_id): Use open_descriptor rather than open.
8590         * output.cc: Include "descriptors.h".
8591         (Output_file::open): Use open_descriptor rather than open.
8592         * archive.cc (Archive::const_iterator): Change Archive to be
8593         non-const.
8594         (Archive::begin, Archive::end): Make non-const.
8595         (Archive::count_members): Likewise.
8596         * archive.h (class Archive): Update declarations.
8597         * object.h (Object::read): Make non-const.
8598         * Makefile.am (CCFILES): Add descriptors.cc.
8599         (HFILES): Add descriptors.h.
8600         * Makefile.in: Rebuild.
8601
8602         PR 6716
8603         * gold.h: Always include <clocale>.  Add Solaris workarounds
8604         following code in binutils/sysdep.h.
8605
8606         PR 6048
8607         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8608         this->eh_frame_hdr_ is NULL before using it.
8609
8610         * dynobj.cc (Versions::Versions): Update comment.
8611
8612         * dynobj.cc (Versions::Versions): If there is an soname, use it as
8613         the base version name.
8614
8615         * stringpool.cc (Stringpool_template::add_with_length): Set key to
8616         array size plus one.
8617         (Stringpool_template::set_string_offsets): Subtract one from key
8618         before using it as an array index.
8619         (Stringpool_template::get_offset_with_length): Likewise.
8620         (Stringpool_template::write_to_buffer): Likewise.
8621         * stringpool.h (Stringpool_template::get_offset_from_key):
8622         Likewise.
8623
8624 2008-07-23  Ian Lance Taylor  <iant@google.com>
8625
8626         PR 6658
8627         * object.h (Merged_symbol_value::value): Do our best to handle a
8628         negative addend.
8629
8630         PR 6647
8631         * script.cc (Version_script_info::get_versions): Don't add empty
8632         version tag to return value.
8633         (Version_script_info::get_symbol_version_helper): Change return
8634         type to bool.  Add pversion parameter.  Change all callers.
8635         (script_register_vers_node): Don't require a non-NULL tag.
8636         * script.h (class Version_script_info): Update declarations.
8637         (Version_script_info::get_symbol_version): Change return type to
8638         bool.  Add version parameter.  Change all callers.
8639         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8640         handling.  Handle an empty version from a version script.
8641         (Symbol_table::define_special_symbol): Likewise.
8642         * testsuite/ver_test_10.script: New file.
8643         * testsuite/ver_test_10.sh: New file.
8644         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8645         (check_DATA): Add ver_test_10.syms.
8646         (ver_test_10.syms, ver_test_10.so): New target.
8647         * testsuite/Makefile.in: Rebuild.
8648
8649 2008-07-23  Simon Baldwin  <simonb@google.com>
8650
8651         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8652         to zero for undefined symbols from dynamic libraries.
8653
8654 2008-07-23  Ian Lance Taylor  <iant@google.com>
8655
8656         * symtab.cc (Symbol_table::resolve): Remove version parameter.
8657         Change all callers.
8658         * symtab.h (class Symbol_table): Update declaration.
8659         * testsuite/ver_test_9.cc: New file.
8660         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8661         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8662         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8663         (ver_test_9.so, ver_test_9.o): New targets.
8664         * testsuite/Makefile.in: Rebuild.
8665
8666 2008-07-22  Ian Lance Taylor  <iant@google.com>
8667
8668         * options.h (class General_options): Define --check-sections.
8669         * layout.cc (Layout::set_segment_offsets): Handle
8670         --check-sections.
8671
8672         * options.h (class General_options): Define -n/--nmagic and
8673         -N/--omagic.
8674         * options.cc (General_options::finalize): For -n/--nmagic or
8675         -N/--omagic, set -static.
8676         * layout.cc (Layout::attach_allocated_section_to_segment): If
8677         -N/--omagic, don't put read-only and read-write sections in
8678         different segments.
8679         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8680         finding a read-only segment.
8681         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8682         don't set the minimum segment alignment to the common page size,
8683         and don't set the file offset to the address modulo the page size.
8684         * script-sections.cc (Script_sections::create_segments): If
8685         -n/--omagic, don't put read-only and read-write sections in
8686         different segments.
8687
8688         * cref.cc: New file.
8689         * cref.h: New file.
8690         * options.h (class General_options): Add --print-symbol-counts.
8691         * main.cc (main): Issue defined symbol report if requested.
8692         * archive.cc (Archive::interpret_header): Make into a const member
8693         function.
8694         (Archive::add_symbols): Call Input_objects::archive_start and
8695         archive_stop.
8696         (Archive::const_iterator): Define new class.
8697         (Archive::begin, Archive::end): New functions.
8698         (Archive::include_all_members): Rewrite to use iterator.
8699         (Archive::count_members): New function.
8700         * archive.h (class Archive): Update declarations.
8701         (Archive::filename): New function.
8702         * object.cc: Include "cref.h".
8703         (Sized_relobj::Sized_relobj): Initialize defined_count_.
8704         (Sized_relobj::do_get_global_symbol_counts): New function.
8705         (Input_objects::add_object): Add object to cross-referencer.
8706         (Input_objects::archive_start): New function.
8707         (Input_objects::archive_stop): New function.
8708         (Input_objects::print_symbol_counts): New function.
8709         * object.h: Declare Cref and Archive.
8710         (Object::get_global_symbol_counts): New function.
8711         (Object::do_get_global_symbol_counts): New pure virtual function.
8712         (class Sized_relobj): Add defined_count_ field.  Update
8713         declarations.
8714         (class Input_objects): Add cref_ field.  Update constructor.
8715         Update declarations.
8716         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8717         defined_count_.
8718         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8719         symbol counts.
8720         (Sized_dynobj::do_get_global_symbol_counts): New function.
8721         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8722         defined_count_.  Update declarations.  Define Symbols typedef.
8723         * symtab.cc (Symbol_table::add_from_relobj): Add defined
8724         parameter.  Change all callers.
8725         (Symbol_table::add_from_dynobj): Add sympointers and defined
8726         parameters.  Change all callers.
8727         * symtab.h (class Symbol_table): Update declarations.
8728         * Makefile.am (CCFILES): Add cref.cc.
8729         (HFILES): Add cref.h.
8730         * Makefile.in: Rebuild.
8731
8732 2008-07-22  Simon Baldwin  <simonb@google.com>
8733
8734         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8735         to zero when writing undefined symbols.
8736
8737 2008-07-22  Ian Lance Taylor  <iant@google.com>
8738
8739         * output.cc (Output_section::add_input_section): Don't try to
8740         merge empty merge sections.
8741
8742 2008-07-21  Craig Silverstein  <csilvers@google.com>
8743
8744         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8745         Include symbol version in error message.
8746
8747 2008-07-20  Chris Demetriou  <cgd@google.com>
8748
8749         * configure.ac (gold_cv_c_random_seed): New configured variable.
8750         (RANDOM_SEED_CFLAGS): New substituted variable.
8751         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8752         * configure: Rebuild.
8753         * Makefile.in: Likewise.
8754         * testsuite/Makefile.in: Likewise.
8755
8756 2008-07-18  Ian Lance Taylor  <iant@google.com>
8757
8758         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8759         where we see NAME/NULL and NAME/VERSION  as separate symbols.
8760         * testsuite/ver_test_main.cc (main): Call t4.
8761         (t4, t4_2a): Define.
8762         * testsuite/ver_test_2.cc (t4_2): Define.
8763         * testsuite/ver_test_2.script: Put t4_2a in VER2.
8764         * testsuite/ver_test_4.cc (t4_2a): Define.
8765         * testsuite/ver_test_4.script: Put t4_2a in VER2.
8766         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8767
8768 2008-07-17  Ian Lance Taylor  <iant@google.com>
8769
8770         * dynobj.cc (Versions::add_def): If we give an error about a
8771         missing version, go ahead and create the version anyhow.
8772
8773 2008-07-10  Ian Lance Taylor  <iant@google.com>
8774
8775         Handle output sections with more than 0x7fffffff bytes.
8776         * object.h (class Relobj): Change map_to_output_ to
8777         output_sections_, and just keep a section pointer.  Change all
8778         uses.  Move comdat group support to Sized_relobj.
8779         (Relobj::is_section_specially_mapped): Remove.
8780         (Relobj::output_section): Remove poff parameter.  Change all
8781         callers.
8782         (Relobj::output_section_offset): New function.
8783         (Relobj::set_section_offset): Rewrite.
8784         (Relobj::map_to_output): Remove.
8785         (Relobj::output_sections): New function.
8786         (Relobj::do_output_section_offset): New pure virtual function.
8787         (Relobj::do_set_section_offset): Likewise.
8788         (class Sized_relobj): Add section_offsets_ field.  Add comdat
8789         group support from Relobj.  Update declarations.
8790         (Sized_relobj::get_output_section_offset): New function.
8791         (Sized_relobj::do_output_section_offset): New function.
8792         (Sized_relobj::do_set_section_offset): New function.
8793         * object.cc (Relobj::output_section_address): Remove.
8794         (Sized_relobj::Sized_relobj): Initialize new fields.
8795         (Sized_relobj::include_section_group): Cast find_kept_object to
8796         Sized_relobj.
8797         (Sized_relobj::include_linkonce_section): Likewise.
8798         (Sized_relobj::do_layout): Use separate arrays for output section
8799         and output offset.
8800         (Sized_relobj::do_count_local_symbols): Change map_to_output to
8801         output_sections.
8802         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8803         output_sections and section_offsets.
8804         (Sized_relobj::write_local_symbols): Likewise.
8805         (map_to_kept_section): Compute output address directly.
8806         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8807         output_sections and section_offsets.
8808         (Sized_relobj::write_sections): Likewise.
8809         (Sized_relobj::relocate_sections): Likewise.
8810         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8811         * output.h (class Output_reloc): Update declarations.  Change
8812         u2_.relobj to Sized_relobj*.
8813         (class Output_data_reloc): Change add functions to use
8814         Sized_relobj*.
8815         * output.cc (Output_reloc::Output_reloc): Change relobj to
8816         Sized_relobj*.
8817         (Output_reloc::local_section_offset): Change return type to
8818         Elf_Addr.  Use get_output_section_offset.
8819         (Output_reloc::get_address): Likewise.
8820         (Output_section::is_input_address_mapped): Don't call
8821         is_section_specially_mapped.
8822         (Output_section::output_offset): Likewise.
8823         (Output_section::output_address): Likewise.
8824         (Output_section::starting_output_address): Likewise.
8825         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8826         parameter to Sized_relobj*.
8827         (Copy_relocs::need_copy_reloc): Likewise.
8828         (Copy_relocs::save): Likewise.
8829         * copy-relocs.h (class Copy_relocs): Update declarations.
8830         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8831         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
8832         * target-reloc.h (relocate_for_relocatable): Change
8833         offset_in_output_section type to Elf_Addr.  Change code that uses
8834         it as well.
8835         * layout.cc (Layout::layout): Always set *off.
8836         * mapfile.cc (Mapfile::print_input_section): Use
8837         output_section_offset.
8838         * i386.cc (Target_i386::copy_reloc): Change object parameter to
8839         Sized_relobj*.
8840         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8841         * sparc.cc (Target_sparc::copy_reloc): Likewise.
8842         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8843
8844 2008-07-03  Ian Lance Taylor  <iant@google.com>
8845
8846         * layout.cc (Layout::include_section): Do not discard unrecognized
8847         SHT_STRTAB sections.
8848
8849 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
8850
8851         * script.cc (Lex::can_continue_name): Make '?' allowable in
8852         version-script names.
8853         * testsuite/version_script.map: Change glob pattern to use '?'
8854
8855 2008-06-30  Manish Singh  <yosh@gimp.org>
8856
8857         PR 6585
8858         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8859         Correct typo.
8860
8861 2008-06-30  Ian Lance Taylor  <iant@google.com>
8862
8863         PR 6660
8864         PR 6682
8865         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8866         versions]: Don't try to read the value in the contents, since we
8867         don't use it.  Use the template endianness when writing.
8868
8869 2008-06-25  Cary Coutant  <ccoutant@google.com>
8870
8871         * fileread.cc (File_read::make_view): Assert on zero-length view.
8872         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8873         symbol table when there are no symbols to read.
8874
8875 2008-06-23  Craig Silverstein  <csilvers@google.com>
8876
8877         * version.cc (version_string): Bump to 1.7
8878
8879 2008-06-18  Craig Silverstein  <csilvers@google.com>
8880
8881         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8882         constant 0xFFFF to type Valtype.
8883         (Powerpc_relocate_functions::rel16_ha): Likewise.
8884
8885 2008-06-17  Ian Lance Taylor  <iant@google.com>
8886
8887         * output.h (Output_section::Input_section): Initialize p2align_ to
8888         zero for Output_section_data constructors.
8889         (Output_section::Input_section::addralign): If not an input
8890         section, return the alignment of the Output_section_data.
8891         * testsuite/copy_test.cc: New file.
8892         * testsuite/copy_test_1.cc: New file.
8893         * testsuite/copy_test_2.cc: New file.
8894         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8895         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8896         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8897         (copy_test_1_pic.o, copy_test_1.so): New targets.
8898         (copy_test_2_pic.o, copy_test_2.so): New targets.
8899         * testsuite/Makefile.in: Rebuild.
8900
8901         * script-sections.cc (Script_sections::place_orphan): Initialize
8902         local variable exact.
8903
8904 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
8905
8906         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8907
8908 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
8909             David S. Miller  <davem@davemloft.net>
8910
8911         * powerpc.cc: New file.
8912         * Makefile.am (TARGETSOURCES): Add powerpc.cc
8913         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8914         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8915         * Makefile.in: Rebuild.
8916
8917 2008-06-09  Ian Lance Taylor  <iant@google.com>
8918
8919         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8920         <exception>.
8921         (throwing, orig_terminate): New static variables.
8922         (terminate_handler): New static function.
8923         (t2): Set terminate handler.
8924
8925 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
8926
8927         PR 6584
8928         * binary.cc (Binary_to_elf::sized_convert): Fix .data
8929         alignment.
8930
8931 2008-05-30  Cary Coutant  <ccoutant@google.com>
8932
8933         * archive.cc (Archive::include_all_members) Correct to step
8934         over symbol table and extended name table in thin archives.
8935
8936 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
8937
8938         PR 6407
8939         * target-reloc.h (relocate_for_relocatable): Fix new_offset
8940         calculation.
8941
8942 2008-05-28  Caleb Howe  <cshowe@google.com>
8943
8944         * reduced_debug_output.cc: New file.
8945         * reduced_debug_output.h: New file.
8946         * options.h (class General_options): Add --strip-debug-non-line.
8947         * options.cc (General_options::finalize): Add strip_debug_non_line
8948         to the strip heirarchy.
8949         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8950         fields.
8951         * layout.cc: Include "reduced_debug_output.h".
8952         (Layout::Layout): Initialize new fields.
8953         (line_only_debug_sections): New static array.
8954         (is_lines_only_debug_sections): New static inline function.
8955         (Layout::include_section): Handle --strip-debug-non-line.
8956         (Layout::make_output_section): If --strip-debug-non-line, build
8957         new output sections for .debug_abbrev and .debug_info.
8958         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8959         gold.  Warn about possible overflow.
8960         (read_signed_LEB_128): Likewise.
8961         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8962         (read_signed_LEB_128): Declare.
8963         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8964         (HFILES): Add reduced_debug_output.h.
8965         * Makefile.in: Rebuild.
8966
8967 2008-05-21  Ian Lance Taylor  <iant@google.com>
8968
8969         * mapfile.cc: New file.
8970         * mapfile.h: New file.
8971         * options.h (class General_options): Add -M/--print-map and -Map.
8972         * options.cc (General_options::finalize): Make -M equivalent to
8973         -Map -.
8974         * main.cc: Include <cstdio> and "mapfile.h".
8975         (main): Open mapfile if requested.
8976         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
8977         constructor.  Change caller.
8978         (queue_initial_tasks): Add mapfile parameter.  Change caller.
8979         (queue_middle_tasks): Likewise.
8980         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8981         declarations.
8982         * archive.cc: Include "mapfile.h".
8983         (Archive::add_symbols): Add mapfile parameter.  Change all
8984         callers.  Pass mapfile, symbol, and reason to include_member.
8985         (Archive::include_all_members): Add mapfile parameter.  Change all
8986         callers.
8987         (Archive::include_member): Add mapfile, sym, and why parameters.
8988         Change all callers.  Report inclusion to map file.
8989         * archive.h: Include "fileread.h".
8990         (class Archive): Update declarations.
8991         (Archive::file): New const method.
8992         (class Add_archive_symbols): Add mapfile_ field.  Update
8993         constructor.  Change all callers.
8994         * readsyms.h (class Read_symbols): Likewise.
8995         (class Finish_group): Likewise.
8996         (class Read_script): Likewise.
8997         * common.cc: Include "mapfile.h".
8998         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
8999         all callers.
9000         (Symbol_table::do_allocate_commons): Likewise.
9001         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
9002         symbol allocation to mapfile.
9003         * common.h (class Allocate_commons_task): Add mapfile_ field.
9004         Update constructor.  Change all callers.
9005         * symtab.h (class Symbol_table): Update declarations.
9006         * layout.cc: Include "mapfile.h".
9007         (Layout_task_runner::run): Print information to mapfile.
9008         (Layout::create_gold_note): Change Output_data_fixed_space to
9009         Output_data_zero_fill.
9010         (Layout::create_build_id): Likewise.
9011         (Layout::print_to_mapfile): New function.
9012         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
9013         constructor.  Change caller.
9014         (class Layout): Declare print_to_mapfile.
9015         * output.cc (Output_section::Input_section::print_to_mapfile): New
9016         function.
9017         (Output_section::add_input_section): If producing a map, always
9018         add to input_sections_ list.
9019         (Output_section::do_print_to_mapfile): New function.
9020         (Output_segment::print_sections_to_mapfile): New function.
9021         (Output_segment::print_section_list_to_mapfile): New function.
9022         * output.h: Include "mapfile.h".
9023         (Output_data::print_to_mapfile): New function.
9024         (Output_data::do_print_to_mapfile): New virtual function.
9025         (Output_segment_headers::do_print_to_mapfile): New function.
9026         (Output_file_header::do_print_to_mapfile): New function.
9027         (Output_data_const::do_print_to_mapfile): New function.
9028         (class Output_data_const_buffer): Add map_name_ field.  Update
9029         constructor.  Change all callers.  Add do_print_to_mapfile
9030         function.
9031         (class Output_data_fixed_space): Likewise.
9032         (class Output_data_space): Likewise.
9033         (class Output_data_zero_fill): New class.
9034         (Output_data_strtab::do_print_to_mapfile): New function.
9035         (Output_data_reloc_base::do_print_to_mapfile): New function.
9036         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9037         (Output_data_group::do_print_to_mapfile): New function.
9038         (Output_data_got::do_print_to_mapfile): New function.
9039         (Output_data_dynamic::do_print_to_mapfile): New function.
9040         (Output_symtab_xindex::do_print_to_mapfile): New function.
9041         (class Output_section): Declare do_print_to_mapflie.  Declare
9042         print_to_mapfile in Input_section.
9043         (class Output_segment): Declare new functions.
9044         * object.h (Sized_relobj::symbol_count): New function.
9045         * script-sections.cc
9046         (Output_section_element_dot_assignment::set_section_addresses):
9047         Change Output_data_fixed_space to Output_data_zero_fill.
9048         (Output_data_expression::do_print_to_mapfile): New function.
9049         * script.cc (read_input_script): Add mapfile parameter.  Change
9050         all callers.
9051         * script.h (read_input_script): Update declaration.
9052         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9053         (Eh_frame::do_print_to_mapfile): New function.
9054         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9055         (Output_merge_string::do_print_to_mapfile): New function.
9056         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9057         function.
9058         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9059         function.
9060         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9061         function.
9062         * Makefile.am (CCFILES): Add mapfile.cc.
9063         (HFILES): Add mapfile.h.
9064         * Makefile.in: Rebuild.
9065
9066 2008-05-19  Ian Lance Taylor  <iant@google.com>
9067
9068         * options.h (class General_options): Add -z relro.
9069         * layout.cc (Layout::Layout): Initialize relro_segment_.
9070         (Layout::add_output_section_data): Return the output section.
9071         (Layout::make_output_section): Rcognize relro sections and mark
9072         them appropriately.
9073         (Layout::attach_allocated_section_to_segment): Put relro sections
9074         in a PT_GNU_RELRO segment.
9075         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9076         section as relro.
9077         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9078         PT_TLS segments.
9079         (Layout::linkonce_mapping): Map d.rel.ro.local to
9080         .data.rel.ro.local.
9081         (Layout::output_section_name): Us .data.rel.ro.local for any
9082         section which begins with that.
9083         * layout.h (class Layout): Update add_output_section_data
9084         declaration.  Add relro_segment_ field.
9085         * output.cc (Output_section::Output_section): Initialize is_relro_
9086         and is_relro_local_ fields.
9087         (Output_segment::add_output_section): Group relro sections.
9088         (Output_segment::is_first_section_relro): New function.
9089         (Output_segment::maximum_alignment): If there is a relro section,
9090         align the segment to the common page size.
9091         (Output_segment::set_section_addresses): Track whether we are
9092         looking at relro sections.  If the last section is a relro
9093         section, align to the common page size.
9094         (Output_segment::set_section_list_addresses): Add in_relro
9095         parameter.  Change all callers.  Align to the page size when
9096         moving from relro to non-relro section.
9097         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9098         segment.
9099         * output.h (class Output_section): Add is_relro_ and
9100         is_relro_local_ fields.
9101         (Output_section::is_relro): New function.
9102         (Output_section::set_is_relro): New function.
9103         (Output_section::is_relro_local): New function.
9104         (Output_section::set_is_relro_local): New function.
9105         (class Output_segment): Update declarations.
9106         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9107         * sparc.cc (Target_sparc::got_section): Likewise.
9108         * x86_64.cc (Target_x86_64::got_section): Likewise.
9109         * testsuite/relro_test_main.cc: New file.
9110         * testsuite/relro_test.cc: New file.
9111         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9112         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9113         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9114         (relro_test.so, relro_test_pic.o): New targets.
9115         * testsuite/Makefile.in: Rebuild.
9116
9117 2008-05-16  Ian Lance Taylor  <iant@google.com>
9118
9119         * output.cc (Output_segment::add_output_section): Remove front
9120         parameter.
9121         * output.h (class Output_segment): Remove
9122         add_initial_output_section and overloaded add_output_section.
9123         Update declaration of remaining add_output_section.
9124         * layout.cc (Layout::create_interp): Call add_output_section
9125         rather than add_initial_output_section.
9126         (Layout::finish_dynamic_section): Likewise.
9127
9128         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9129         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9130         know the dynamic type.
9131         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9132         field.  Initialize it in constructor.
9133         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9134         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9135         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9136         reloc.
9137
9138         * output.cc (Output_reloc::get_address): Change return type to
9139         Elf_Addr.
9140         * output.h (class Output_reloc): Update get_address declaration.
9141         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9142         for section addresses.
9143
9144 2008-05-09  Ian Lance Taylor  <iant@google.com>
9145
9146         PR 6493
9147         * gold.cc (gold_nomem): Use return value of write.
9148
9149 2008-05-08  Ian Lance Taylor  <iant@google.com>
9150
9151         * symtab.c (Symbol::init_base_output_data): Add version
9152         parameter.  Change all callers.
9153         (Symbol::init_base_output_segment): Likewise.
9154         (Symbol::init_base_constant): Likewise.
9155         (Symbol::init_base_undefined): Likewise.
9156         (Sized_symbol::init_output_data): Likewise.
9157         (Sized_symbol::init_output_segment): Likewise.
9158         (Sized_symbol::init_constant): Likewise.
9159         (Sized_symbol::init_undefined): Likewise.
9160         (Symbol_table::do_define_in_output_data): If the new symbol has a
9161         version, mark it as the default.
9162         (Symbol_table::do_define_in_output_segment): Likewise.
9163         (Symbol_table::do_define_as_constant): Likewise.
9164         * symtab.h (class Symbol): Update declarations.
9165         (class Sized_symbol): Likewise.
9166         * resolve.cc (Symbol::override_version): New function.
9167         (Symbol::override_base): Call override_version.
9168         (Symbol::override_base_with_special): Likewise.
9169         * testsuite/ver_script_8.script: New file.
9170         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9171         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9172         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9173         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9174
9175 2008-05-06  Ian Lance Taylor  <iant@google.com>
9176
9177         PR 6049
9178         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9179         functions.
9180         (class General_options): Remove existing --undefined, and add
9181         --no-undefined instead.  Add new --undefined as synonym for -u.
9182         * archive.cc (Archive::add_symbols): Check whether symbol was
9183         named with -u.
9184         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9185         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9186         all uses.  Add IS_UNDEFINED.  Update declarations to split
9187         different versions of init_base.  Declare init_base_undefined.
9188         (Symbol::is_defined): Handle IS_UNDEFINED.
9189         (Symbol::is_undefined): Likewise.
9190         (Symbol::is_weak_undefined): Call is_undefined.
9191         (Symbol::is_absolute): Handle IS_CONSTANT.
9192         (class Sized_symbol): Update declarations to split different
9193         versions of init.  Declare init_undefined.
9194         (class Symbol_table): Declare new functions.
9195         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9196         Change all callers.
9197         (Symbol::init_base_output_data): Likewise.
9198         (Symbol::init_base_output_segment): Likewise.
9199         (Symbol::init_base_constant): Likewise.
9200         (Symbol::init_base_undefined): New function.
9201         (Sized_symbol::init_object): Rename from init.  Change all
9202         callers.
9203         (Sized_symbol::init_output_data): Likewise.
9204         (Sized_symbol::init_output_segment): Likewise.
9205         (Sized_symbol::init_constant): Likewise.
9206         (Sized_symbol::init_undefined): New function.
9207         (Symbol_table::add_undefined_symbols_from_command_line): New
9208         function.
9209         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9210         function.
9211         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9212         (Symbol::output_section): Likewise.
9213         (Symbol::set_output_section): Likewise.
9214         (Symbol_table::sized_finalize_symbol): Likewise.
9215         (Symbol_table::sized_write_globals): Likewise.
9216         * resolve.cc (Symbol_table::should_override): Likewise.
9217         (Symbol::override_base_with_special): Likewise.
9218
9219         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9220         symbol, change it to have default visibility.
9221         * testsuite/protected_1.cc: New file.
9222         * testsuite/protected_2.cc: New file.
9223         * testsuite/protected_3.cc: New file.
9224         * testsuite/protected_main_1.cc: New file.
9225         * testsuite/protected_main_2.cc: New file.
9226         * testsuite/protected_main_3.cc: New file.
9227         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9228         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9229         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9230         (protected_1.so): New target.
9231         (protected_1_pic.o, protected_2_pic.o): New targets.
9232         (protected_3_pic.o): New target.
9233         (check_PROGRAMS): Add protected_2.
9234         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9235         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9236         * testsuite/Makefile.in: Rebuild.
9237
9238         * options.h (DEFINE_var): Add set_user_set_##varname__.
9239         (DEFINE_bool_alias): New macro.
9240         (class General_options): Define -Bstatic using DEFINE_bool_alias
9241         rather than DEFINE_special.  Add --undefined as an alias for -z
9242         defs.
9243         * options.cc (General_options::parse_Bstatic): Remove.
9244
9245         * options.h (class General_options): Add --fatal-warnings.
9246         * main.cc (main): Implement --fatal-warnings.
9247         * errors.h (Errors::warning_count): New function.
9248
9249         * options.h (class General_options): Add -Bsymbolic-functions.
9250         * symtab.h (Symbol::is_preemptible): Check for
9251         -Bsymbolic-functions.
9252
9253 2008-05-05  Ian Lance Taylor  <iant@google.com>
9254
9255         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9256         as noVARNAME rather than no-VARNAME.
9257         (class General_options): Add option -z combreloc.
9258         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9259         get_address.
9260         (Output_reloc::sort_before) [SHT_REL]: New function.
9261         (Output_reloc::sort_before) [SHT_RELA]: New function.
9262         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9263         Sort_relocs_comparison.
9264         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9265         parameter.  Change all callers.
9266         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9267         sort_relocs parameter.  Change all callers.
9268         * output.cc (Output_reloc::get_address): New function, broken out
9269         of write_rel.
9270         (Output_reloc::write_rel): Call it.
9271         (Output_reloc::compare): New function.
9272         (Output_data_reloc_base::do_write): Optionally sort relocs.
9273
9274         * configure.ac: If targ_extra_obj is set, link it in.
9275         * configure.tgt: Initialize all variables.
9276         (x86_64*): Set targ_extra_obj and targ_extra_size.
9277         * configure: Rebuild.
9278
9279         * object.cc (Sized_relobj::include_section_group): Adjust section
9280         indexes read from group data.  Build vector to pass to
9281         layout_group.
9282         * layout.cc (Layout::layout_group): Add flags and shndxes
9283         parameters.  Remove contents parameter.  Change caller.  Update
9284         explicit instantiations.
9285         * layout.h (class Layout): Update layout_group declaration.
9286         * output.cc (Output_data_group::Output_data_group): Add flags and
9287         input_shndxes parameters.  Remove contents parameter.  Change
9288         caller.
9289         (Output_data_group::do_write): Change input_sections_ to
9290         input_shndxes_.
9291         * output.h (class Output_data_group): Update constructor
9292         declaration.  Rename input_sections_ to input_shndxes_.
9293         * testsuite/many_sections_test.cc: Add template.
9294
9295 2008-04-30  Cary Coutant  <ccoutant@google.com>
9296
9297         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9298
9299         * layout.cc (Layout::include_section): Refactored check for debug
9300         info section.
9301         (Layout::add_comdat): Add new parameters.  Change type
9302         of signature parameter.  Add object and shndx to signatures table.
9303         (Layout::find_kept_object): New function.
9304         * layout.h: Include <cstring>.
9305         (Layout::is_debug_info_section): New function.
9306         (Layout::add_comdat): Add new parameters.
9307         (Layout::find_kept_object): New function.
9308         (Layout::Kept_section): New struct.
9309         (Layout::Signatures): Change type of map range.
9310         * object.cc (Relobj::output_section_address): New function.
9311         (Sized_relobj::include_section_group): Add new parameters.  Change
9312         calls to Layout::add_comdat.  Change to build table of kept comdat
9313         groups and table mapping discarded sections to kept sections.
9314         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9315         (Sized_relobj::do_layout): Change calls to include_section_group and
9316         include_linkonce_section.
9317         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9318         value to zero when section is discarded.
9319         (Sized_relobj::map_to_kept_section): New function.
9320         * object.h (Relobj::output_section_address): New function.
9321         (Relobj::Comdat_group): New type.
9322         (Relobj::find_comdat_group): New function.
9323         (Relobj::Comdat_group_table): New type.
9324         (Relobj::Kept_comdat_section): New type.
9325         (Relobj::Kept_comdat_section_table): New type.
9326         (Relobj::add_comdat_group): New function.
9327         (Relobj::set_kept_comdat_section): New function.
9328         (Relobj::get_kept_comdat_section): New function.
9329         (Relobj::comdat_groups_): New field.
9330         (Relobj::kept_comdat_sections_): New field.
9331         (Symbol_value::input_value): Update comment.
9332         (Sized_relobj::map_to_kept_section) New function.
9333         (Sized_relobj::include_linkonce_section): Add new parameter.
9334         * target-reloc.h (Comdat_behavior): New type.
9335         (get_comdat_behavior): New function.
9336         (relocate_section): Add code to map a discarded section to the
9337         corresponding kept section when applying a relocation.
9338
9339 2008-04-30  Craig Silverstein  <csilvers@google.com>
9340
9341         * dwarf_reader.cc (next_generation_count): New static var.
9342         (Addr2line_cache_entry): New struct.
9343         (addr2line_cache): New static var.
9344         (Dwarf_line_info::one_addr2line): Added caching.
9345         (Dwarf_line_info::clear_addr2line_cache): New function.
9346         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9347         cache-size parameter.
9348         (Dwarf_line_info::one_addr2line_cache): New function.
9349         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9350         new cache-size argument to one_addr2line(), and clear cache.
9351
9352 2008-04-28  Cary Coutant  <ccoutant@google.com>
9353
9354         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9355         R_386_PC8 relocations.
9356
9357 2008-04-23  Ian Lance Taylor  <iant@google.com>
9358
9359         * object.cc (Sized_relobj::include_section_group): Check for
9360         invalid section group.
9361
9362         * object.cc (make_elf_object): Correct test for 64-bit ELF file
9363         header size.
9364
9365         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9366         than read for file header.
9367         * archive.cc (Archive::include_member): Likewise.
9368
9369 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
9370
9371         * aclocal.m4: Regenerate.
9372         * configure: Regenerate.
9373
9374 2008-04-19  Ian Lance Taylor  <iant@google.com>
9375
9376         * version.cc (version_string): Bump to 1.6.
9377
9378         * testsuite/Makefile.am (many_sections_r_test): New target.
9379         (many_sections_r_test_SOURCES): Remove.
9380         (many_sections_r_test_DEPENDENCIES): Remove.
9381         (many_sections_r_test_LDFLAGS): Remove.
9382         (many_sections_r_test_LDADD): Remove.
9383
9384         * object.cc (Sized_relobj::do_add_symbols): Always pass
9385         local_symbol_count_ to add_from_relobj.
9386
9387         * testsuite/Makefile.am (many_sections_check.h): Only check one in
9388         every thousand variables.
9389         * testsuite/Makefile.in: Rebuild.
9390
9391         * object.cc (Xindex::initialize_symtab_xindex): New function.
9392         (Xindex::read_symtab_xindex): New function.
9393         (Xindex::sym_xindex_to_shndx): New function.
9394         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9395         available.
9396         (Sized_relobj::do_initialize_xindex): New function.
9397         (Sized_relobj::do_read_symbols): Adjust section links.
9398         (Sized_relobj::symbol_section_and_value): Add is_ordinary
9399         parameter.  Change all callers.
9400         (Sized_relobj::include_section_group): Adjust section links and
9401         symbol section indexes.
9402         (Sized_relobj::do_layout): Adjust section links.
9403         (Sized_relobj::do_count_local_symbols): Adjust section links and
9404         symbol section indexes.
9405         (Sized_relobj::do_finalize_local_symbols): Distinguish between
9406         ordinary and special symbols.
9407         (Sized_relobj::write_local_symbols): Add symtab_xindex and
9408         dynsym_xindex parameters.  Change all callers.  Adjust section
9409         links.  Use SHN_XINDEX when needed.
9410         (Sized_relobj::get_symbol_location_info): Adjust section links.
9411         Don't get fooled by special symbols.
9412         * object.h (class Xindex): Define.
9413         (class Object): Add xindex_ parameter.  Declare virtual functoin
9414         do_initialize_xindex.
9415         (Object::adjust_sym_shndx): New function.
9416         (Object::set_xindex): New protected function.
9417         (class Symbol_value): Add is_ordinary_shndx_ field.
9418         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9419         (Symbol_value::value): Assert ordinary section.
9420         (Symbol_value::initialize_input_to_output_map): Likewise.
9421         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9422         Change all callers.
9423         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
9424         all callers.
9425         (class Sized_relobj): Update declarations.
9426         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9427         parameter.  Change all callers.
9428         (Sized_relobj::adjust_shndx): New function.
9429         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9430         field.
9431         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9432         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
9433         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
9434         (Sized_dynobj::read_dynsym_section): Adjust section links.
9435         (Sized_dynobj::read_dynamic): Likewise.
9436         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
9437         section links.
9438         (Sized_dynobj::do_initialize_xindex): New function.
9439         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
9440         do_initialize_xindex.
9441         (Sized_dynobj::adjust_shndx): New function.
9442         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9443         dynsym_xindex_ fields.
9444         (Layout::finalize): Add a call to set_section_indexes before
9445         creating the symtab sections.
9446         (Layout::set_section_indexes): Don't do anything if the section
9447         already has a section index.
9448         (Layout::create_symtab_sections): Add shnum parameter.  Change
9449         caller.  Create .symtab_shndx section if needed.
9450         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
9451         caller.
9452         (Layout::allocated_output_section_count): New function.
9453         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9454         needed.
9455         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9456         fields.  Update declarations.
9457         (Layout::symtab_xindex): New function.
9458         (Layout::dynsym_xindex): New function.
9459         (class Write_symbols_task): Add layout_ field.
9460         (Write_symbols_task::Write_symbols_task): Add layout parameter.
9461         Change caller.
9462         * output.cc (Output_section_headers::Output_section_headers): Add
9463         shstrtab_section parameter.  Change all callers.
9464         (Output_section_headers::do_sized_write): Store overflow values
9465         for section count and section string table section index in
9466         section header zero.
9467         (Output_file_header::do_sized_write): Check for overflow of
9468         section count and section string table section index.
9469         (Output_symtab_xindex::do_write): New function.
9470         (Output_symtab_xindex::endian_do_write): New function.
9471         * output.h (class Output_section_headers): Add shstrtab_section_.
9472         Update declarations.
9473         (class Output_symtab_xindex): Define.
9474         (Output_section::has_out_shndx): New function.
9475         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9476         field.
9477         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9478         Change all callers.
9479         (Sized_symbol::init): Likewise.
9480         (Symbol::output_section): Check for ordinary symbol.
9481         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
9482         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
9483         callers.
9484         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9485         Change all callers.  Simplify handling of symbols from sections
9486         not included in the link.
9487         (Symbol_table::add_from_dynobj): Handle ordinary symbol
9488         distinction.
9489         (Weak_alias_sorter::operator()): Assert that symbols are
9490         ordinary.
9491         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9492         distinction.
9493         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9494         parameters.  Change all callers.
9495         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
9496         symbol distinction.  Use SHN_XINDEX when needed.
9497         (Symbol_table::write_section_symbol): Add symtab_xindex
9498         parameter.  Change all callers.
9499         (Symbol_table::sized_write_section_symbol): Likewise.  Use
9500         SHN_XINDEX when needed.
9501         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
9502         declarations.
9503         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
9504         (Symbol::is_defined): Check is_ordinary.
9505         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9506         (Symbol::is_absolute, Symbol::is_common): Likewise.
9507         (class Sized_symbol): Update declarations.
9508         (class Symbol_table): Update declarations.
9509         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9510         parameters.  Change all callers.
9511         (Sized_symbol::override): Likewise.
9512         (Symbol_table::override): Likewise.
9513         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
9514         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
9515         is_ordinary, and orig_st_shndx parameters.  Change all callers.
9516         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9517         to be in an ordinary section.
9518         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9519         object and is_ordinary parameters.  Change all callers.
9520         (Sized_dwarf_line_info::read_relocs): Add object parameter.
9521         Change all callers.  Don't add undefined or non-ordinary symbols
9522         to reloc_map_.
9523         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9524         Change all callers.
9525         * dwarf_reader.h (class Sized_dwarf_line_info): Update
9526         declarations.
9527         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9528         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9529         (Sized_relobj::relocate_sections): Likewise.
9530         * target-reloc.h (scan_relocs): Adjust section symbol index.
9531         (scan_relocatable_relocs): Likewise.
9532         * i386.cc (Scan::local): Check for ordinary symbols.
9533         * sparc.cc (Scan::local): Likewise.
9534         * x86_64.cc (Scan::local): Likewise.
9535         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9536         to symbol_section_and_value.
9537         * testsuite/many_sections_test.cc: New file.
9538         * testsuite/Makefile.am (BUILT_SOURCES): Define.
9539         (check_PROGRAMS): Add many_sections_test.
9540         (many_sections_test_SOURCES): Define.
9541         (many_sections_test_DEPENDENCIES): Define.
9542         (many_sections_test_LDFLAGS): Define.
9543         (BUILT_SOURCES): Add many_sections_define.h.
9544         (many_sections_define.h): New target.
9545         (BUILT_SOURCES): Add many_sections_check.h.
9546         (many_sections_check.h): New target.
9547         (check_PROGRAMS): Add many_sections_r_test.
9548         (many_sections_r_test_SOURCES): Define.
9549         (many_sections_r_test_DEPENDENCIES): Define.
9550         (many_sections_r_test_LDFLAGS): Define.
9551         (many_sections_r_test_LDADD): Define.
9552         (many_sections_r_test.o): New target.
9553         * testsuite/Makefile.in: Rebuild.
9554
9555 2008-04-17  Cary Coutant  <ccoutant@google.com>
9556
9557         * errors.cc (Errors::info): New function.
9558         (gold_info): New function.
9559         * errors.h (Errors::info): New function.
9560         * gold.h (gold_info): New function.
9561         * object.cc (Input_objects::add_object): Print trace output.
9562         * options.cc (options::parse_set): New function.
9563         (General_options::parse_wrap): Deleted.
9564         (General_options::General_options): Deleted initializer.
9565         * options.h (options::String_set): New typedef.
9566         (options::parse_set): New function.
9567         (DEFINE_set): New macro.
9568         (General_options::wrap): Changed to use DEFINE_set. Changed
9569         callers of any_wrap_symbols and is_wrap_symbol.
9570         (General_options::trace, General_options::trace_symbol):
9571         New options.
9572         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9573         (General_options::wrap_symbols_): Deleted.
9574         * symtab.cc (Symbol_table::add_from_object): Print trace output.
9575
9576 2008-04-17  David S. Miller  <davem@davemloft.net>
9577
9578         * options.cc (General_options::parse_V): New function.
9579         * options.h: Add entries for -V and -Qy.
9580
9581 2008-04-17  Ian Lance Taylor  <iant@google.com>
9582
9583         * common.cc (Symbol_table::allocate_commons): Remove options
9584         parameter.  Change caller.
9585         (Symbol_table::do_allocate_commons): Remove options parameter.
9586         Change caller.  Just call do_allocate_commons_list twice.
9587         (Symbol_table::do_allocate_commons_list): New function, broken out
9588         of do_allocate_commons.
9589         * common.h (class Allocate_commons_task): Remove options_ field.
9590         Update constructor.
9591         * symtab.cc (Symbol_table::Symbol_table): Initialize
9592         tls_commons_.
9593         (Symbol_table::add_from_object): Put TLS common symbols on
9594         tls_commons_ list.
9595         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9596         which are IN_OUTPUT_DATA.
9597         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
9598         allocate_commons and do_allocate_commons declarations.  Declare
9599         do_allocate_commons_list.
9600         * gold.cc (queue_middle_tasks): Update creation of
9601         Allocate_commons_task to not pass options.
9602         * testsuite/Makefile.am (INCLUDES): Add -I.. .
9603         (TLS_TEST_C_FLAGS): New variable.
9604         (tls_test_c_pic.o): New target.
9605         (tls_test_shared.so): Link in tls_test_c_pic.o.
9606         (tls_test_c_pic_ie.o): New target.
9607         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9608         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9609         (tls_test_c.o): New target.
9610         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9611         (tls_pic_test_LDADD): Likewise.
9612         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9613         (tls_shared_gd_to_ie_test_LDADD): Likewise.
9614         (tls_test_c_gnu2.o): New target.
9615         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9616         tls_test_c_gnu2.o.
9617         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9618         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9619         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9620         * testsuite/tls_test.cc: Include "config.h".
9621         (t_last): Call t11_last.
9622         * testsuite/tls_test.h (t11, t11_last): Declare.
9623         * testsuite/tls_test_c.c: New file.
9624         * testsuite/tls_test_main.cc (thread_routine): Call t11.
9625         * configure.ac: Check for OpenMP support.
9626         * configure, config.in, Makefile.in: Rebuild.
9627         * testsuite/Makefile.in: Rebuild.
9628
9629 2008-04-16  Cary Coutant  <ccoutant@google.com>
9630
9631         * i386.cc (Target_i386::define_tls_base_symbol): New function.
9632         (Target_i386::tls_base_symbol_defined_): New field.
9633         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9634         (Target_i386::Scan::global): Likewise.
9635         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9636         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9637         (Target_x86_64::tls_base_symbol_defined_): New field.
9638         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9639         (Target_x86_64::Scan::global): Likewise.
9640
9641 2008-04-16  Cary Coutant  <ccoutant@google.com>
9642
9643         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9644         (Symbol::needs_plt_entry): Allow weak undefined symbols.
9645         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9646         building shared libraries.
9647         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9648         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9649         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9650         * testsuite/Makefile.in: Rebuild.
9651         * testsuite/weak_undef.h: New file.
9652         * testsuite/weak_undef_file1.cc: Add extra test cases.
9653         * testsuite/weak_undef_file2.cc: Likewise.
9654         * testsuite/weak_undef_test.cc: Likewise.
9655
9656 2008-04-16  David S. Miller  <davem@davemloft.net>
9657
9658         * sparc.cc (Target_sparc::Scan): Change from struct to class.
9659         Add issued_non_pic_error_ field.  Declare check_non_pic.
9660         (Target_sparc::Scan::check_non_pic): New function.
9661         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9662         (Target_sparc::Scan::global): Likewise.
9663
9664         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9665         * configure: Rebuild.
9666
9667         * options.h (DEFINE_enable): New macro.
9668         (new_dtags): New enable option.
9669         (initfirst, interpose, loadfltr, nodefaultlib,
9670         nodelete, nodlopen, nodump): New -z options.
9671         * layout.cc (Layout:finish_dynamic_section): If new
9672         dtags enabled, emit DT_RUNPATH.  Also, emit a
9673         DT_FLAGS_1 containing any specified -z flags.
9674
9675 2008-04-16  Ian Lance Taylor  <iant@google.com>
9676
9677         * copy-relocs.cc: New file.
9678         * copy-relocs.h: New file.
9679         * reloc.cc: Remove Copy_relocs code.
9680         * reloc.h: Likewise.
9681         * reloc-types.h (struct Reloc_types) [both versions]: Add
9682         get_reloc_addend_noerror.
9683         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9684         variants of add_global which take an addend which must be zero.
9685         * i386.cc: Include "copy-relocs.h".
9686         (class Target_i386): Change type of copy_relocs_ to variable,
9687         update initializer.
9688         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9689         Change all callers.
9690         (Target_i386::do_finalize_sections): Change handling of
9691         copy_relocs_.
9692         * sparc.cc: Include "copy-relocs.h".
9693         (class Target_sparc): Change type of copy_relocs_ to variable,
9694         update initializer.
9695         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9696         Change all callers.
9697         (Target_sparc::do_finalize_sections): Change handling of
9698         copy_relocs_.
9699         * x86_64.cc: Include "copy-relocs.h".
9700         (class Target_x86_64): Change type of copy_relocs_ to variable,
9701         update initializer.
9702         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9703         class.  Change all callers.
9704         (Target_x86_64::do_finalize_sections): Change handling of
9705         copy_relocs_.
9706         * Makefile.am (CCFILES): Add copy-relocs.cc.
9707         (HFILES): Add copy-relocs.h.
9708
9709         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9710
9711         * testsuite/script_test_4.sh: Permit leading zeroes.
9712
9713 2008-04-15  Ian Lance Taylor  <iant@google.com>
9714
9715         * script-sections.cc (Script_sections::create_segments): Use
9716         header_size_adjustment even when there is enough room for the
9717         headers.
9718         * testsuite/script_test_4.sh: New file.
9719         * testsuite/script_test_4.t: New file.
9720         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9721         (check_DATA): Add script_test_4.stdout.
9722         (MOSTLYCLEANFILES): Likewise.
9723         (script_test_4): New target.
9724         (script_test_4.stdout): New target.
9725         * testsuite/Makefile.in: Rebuild.
9726
9727         * sparc.cc: Add definitions for Output_data_plt_sparc class
9728         constants.
9729
9730 2008-04-14  David S. Miller  <davem@davemloft.net>
9731
9732         * sparc.cc: New file.
9733         * Makefile.am (TARGETSOURCES): Add sparc.cc
9734         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9735         * configure.tgt: Document targ_extra_size and
9736         targ_extra_big_endian.  Add entries for sparc-* and
9737         sparc64-*.
9738         * configure.ac: Handle targ_extra_size and
9739         targ_extra_big_endian.
9740         * Makefile.in: Rebuild.
9741         * configure: Likewise.
9742         * po/POTFILES.in: Likewise.
9743         * po/gold.pot: Likewise.
9744
9745 2008-04-14  Ian Lance Taylor  <iant@google.com>
9746
9747         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9748         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9749         in the name/type/flags to section mapping.  Don't call
9750         allocate_output_section.
9751         (Layout::choose_output_section): Change parameter from adjust_name
9752         to is_input_section.  Don't permit input sections after sections
9753         are attached to segments.  Don't call allocate_output_section.
9754         (Layout::layout_eh_frame): Call update_flags_for_input_section,
9755         not write_enable_output_section.
9756         (Layout::make_output_section): Don't push to
9757         unattached_section_list_ nor call attach_to_segment.  Call
9758         attach_section_to_segment if sections are attached.
9759         (Layout::attach_sections_to_segments): New function.
9760         (Layout::attach_section_to_segment): New function.
9761         (Layout::attach_allocated_section_to_segment): Rename from
9762         attach_to_segment.  Remove flags parameter.
9763         (Layout::allocate_output_section): Remove function.
9764         (Layout::write_enable_output_section): Remove function.
9765         * layout.h (class Layout): Update for above changes.  Add new
9766         field sections_are_attached_.
9767         * output.h (Output_section::update_flags_for_input_section): New
9768         function.
9769         * output.cc (Output_section::add_input_section): Call
9770         update_flags_for_input_section.
9771         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9772
9773 2008-04-11  Cary Coutant  <ccoutant@google.com>
9774
9775         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9776         thought unnecessary.
9777         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9778
9779 2008-04-11  Ian Lance Taylor  <iant@google.com>
9780
9781         * output.h (class Output_section_data): Remove inline definition
9782         of set_addralign.
9783         * output.cc (Output_section_data::set_addralign): New function.
9784
9785 2008-04-11  Cary Coutant  <ccoutant@google.com>
9786
9787         Add support for TLS descriptors for i386 and x86_64.
9788         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9789         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9790         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9791         GOT_TYPE_TLS_DESC.
9792         (Target_i386::got_mod_index_entry): Remove unnecessary code.
9793         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9794         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
9795         relocations.
9796         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9797         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9798         Fix problem with initial-exec relocations.
9799         (Target_i386::Relocate::relocate_tls): Likewise.
9800         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9801         relaxation.
9802         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9803         support for section-plus-offset dynamic table entries.
9804         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9805         (Output_data_dynamic::Dynamic_entry): Add support for
9806         section-plus-offset dynamic table entries.
9807         (Output_data_dynamic::Classification): Likewise.
9808         (Output_data_dynamic::classification_): Renamed offset_.
9809         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9810         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9811         (Target_x86_64::make_plt_section): New function.
9812         (Target_x86_64::reserve_tlsdesc_entries): New function.
9813         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9814         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9815         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9816         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9817         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9818         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9819         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9820         add extra PLT entry for TLS descriptors.
9821         (Output_data_plt_x86_64::got_): New field.
9822         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9823         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9824         fields.
9825         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9826         descriptors.
9827         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9828         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9829         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9830         R_386_TLS_DESC_CALL relocations.
9831         (Target_x86_64::Scan::global): Likewise.
9832         (Target_x86_64::do_finalize_sections): Add dynamic table entries
9833         for TLS descriptors.
9834         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9835         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9836         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9837         GD-to-IE relaxation.
9838         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9839         and TLS_DESCRIPTORS.
9840         * Makefile.in: Rebuild.
9841         * configure: Rebuild.
9842         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9843         (tls_test_shared2.so): New target.
9844         (tls_shared_gd_to_ie_test_SOURCES): New variable.
9845         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9846         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9847         (tls_shared_gd_to_ie_test_LDADD): New variable.
9848         (tls_shared_gnu2_gd_to_ie_test): New target.
9849         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9850         New targets.
9851         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9852         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9853         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9854         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9855         (tls_shared_gnu2_test): New target.
9856         (tls_test_gnu2_shared.so): New target.
9857         (tls_shared_gnu2_test_SOURCES): New variable.
9858         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9859         (tls_shared_gnu2_test_LDFLAGS): New variable.
9860         (tls_shared_gnu2_test_LDADD): New variable.
9861         * testsuite/Makefile.in: Rebuild.
9862         * testsuite/Makefile.
9863
9864 2008-04-11  Ian Lance Taylor  <iant@google.com>
9865
9866         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9867         justsyms.t.
9868         * testsuite/Makefile.in: Rebuild.
9869
9870         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9871         long.
9872         * testsuite/script_test_2.cc (main): Adjust test.
9873
9874 2008-04-11  David S. Miller  <davem@davemloft.net>
9875             Ian Lance Taylor  <iant@google.com>
9876
9877         * options.h (General_options): Add entries for '-Y' and
9878         '-relax'.
9879         * options.cc (General_options:finalize): If -Y was used, add those
9880         entries to the library path instead of the default "/lib" and
9881         "/usr/lib".
9882
9883 2008-04-11  David S. Miller  <davem@davemloft.net>
9884
9885         * testsuite/justsyms.t: Start at 0x100.
9886         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9887         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9888         long.
9889         * testsuite/script_test_2.cc: Adjust string and section length
9890         checks.
9891
9892 2008-04-09  Ian Lance Taylor  <iant@google.com>
9893
9894         PR gold/5996
9895         * script-sections.cc (Sections_element::allocate_to_segment): Add
9896         orphan parameter.
9897         (Output_section_definition::allocate_to_segment): Likewise.
9898         (Orphan_output_section::allocate_to_segment): Likewise.
9899         (Script_sections::attach_sections_using_phdrs_clause): Don't
9900         propagate non-PT_LOAD segments to orphan sections.
9901         * testsuite/Makefile.am (script_test_3.stdout): Generate using
9902         readelf rather than objdump.
9903         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
9904         .interp section and PT_INTERP segment are the same size.
9905         * testsuite/Makefile.in: Rebuild.
9906
9907         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9908         aliases for symbols defined in the same object.
9909         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9910         (weak_alias_test_SOURCES): New variable.
9911         (weak_alias_test_DEPENDENCIES): New variable.
9912         (weak_alias_test_LDFLAGS): New variable.
9913         (weak_alias_test_LDADD): New variable.
9914         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9915         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9916         (weak_alias_test_3.o): New target.
9917         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9918         * testsuite/weak_alias_test_main.cc: New file.
9919         * testsuite/weak_alias_test_1.cc: New file.
9920         * testsuite/weak_alias_test_2.cc: New file.
9921         * testsuite/weak_alias_test_3.cc: New file.
9922
9923 2008-04-08  Ian Lance Taylor  <iant@google.com>
9924
9925         * options.h (class General_options): Add --noinhibit-exec option.
9926         * main.cc (main): Check --noinhibit-exec.
9927
9928         * options.h (class General_options): Define --wrap as a special
9929         option.  Add wrap_symbols_ field.
9930         (General_options::any_wrap_symbols): New function.
9931         (General_options::is_wrap_symbol): New function.
9932         * options.cc (General_options::parse_wrap): New function.
9933         (General_options::General_options): Initialize wrap_symbols_.
9934         * symtab.cc (Symbol_table::wrap_symbol): New function.
9935         (Symbol_table::add_from_object): Handle --wrap.
9936         * symtab.h (class Symbol_table): Declare wrap_symbol.
9937         * target.h (Target::wrap_char): New function.
9938         (Target::Target_info): Add wrap_char field.
9939         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9940         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9941         * testsuite/testfile.cc (Target_test::test_target_info):
9942         Likewise.
9943
9944         * errors.cc (Errors::undefined_symbol): Mention symbol version if
9945         there is one.
9946
9947         * layout.h (class Layout): Add added_eh_frame_data_ field.
9948         * layout.cc (Layout::Layout): Initialize new field.
9949         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9950         output section until we find a section we merged successfully.
9951         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9952         that the size be non-zero.
9953
9954         * merge.cc (Object_merge_map::get_output_offset): Remove inline
9955         qualifier.
9956
9957 2008-04-08  Craig Silverstein  <csilvers@google.com>
9958
9959         * configure.ac: Export new conditional variable HAVE_ZLIB.
9960         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9961         on HAVE_ZLIB.
9962         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9963         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9964
9965 2008-04-07  Ian Lance Taylor  <iant@google.com>
9966
9967         * version.cc (version_string): Set to "1.5".
9968
9969         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9970         Add issued_non_pic_error_ field.  Declare check_non_pic.
9971         (Target_x86_64::Scan::check_non_pic): New function.
9972         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9973         (Target_x86_64::Scan::global): Likewise.
9974
9975         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9976         addend parameter.  Change caller.  Handle merge sections.
9977         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9978         Address to Addend.  Don't add in the result of
9979         local_section_offset, pass down the addend and use the returned
9980         value.
9981         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9982         Update declarations of local_section_offset and symbol_value.
9983         * testsuite/two_file_test_1.cc (t18): New function.
9984         * testsuite/two_file_test_2.cc (f18): New function.
9985         * testsuite/two_file_test_main.cc (main): Call t18.
9986         * testsuite/two_file_test.h (t18, f18): Declare.
9987
9988         * configure.ac: Don't test for objdump, c++filt, or readelf.
9989         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9990         conditionals.
9991         (TEST_READELF): New variable.
9992         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9993         (check_PROGRAMS): Add two_file_strip_test.
9994         (two_file_strip_test): New target.
9995         (check_PROGRAMS): Add two_file_same_shared_strip_test.
9996         (two_file_same_shared_strip_test_SOURCES): New variable.
9997         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9998         (two_file_same_shared_strip_test_LDFLAGS): New variable.
9999         (two_file_same_shared_strip_test_LDADD): New variable.
10000         (two_file_shared_strip.so): New target.
10001         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10002         (ver_test_5.syms, ver_test_7.syms): Likewise.
10003         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10004         (strip_test_3.stdout): Use TEST_OBJDUMP.
10005         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10006
10007 2008-04-04  Cary Coutant  <ccoutant@google.com>
10008
10009         * symtab.h (Symbol::is_weak_undefined): New function.
10010         (Symbol::is_strong_undefined): New function.
10011         (Symbol::is_absolute): New function.
10012         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10013         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10014         absolute symbols.
10015         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10016         (weak_undef_test): New target.
10017         * testsuite/Makefile.in: Rebuild.
10018         * testsuite/weak_undef_file1.cc: New file.
10019         * testsuite/weak_undef_file2.cc: New file.
10020         * testsuite/weak_undef_test.cc: New file.
10021
10022 2008-04-03  Craig Silverstein  <csilvers@google.com>
10023
10024         * compressed_output.h (class Output_compressed_section): Use
10025         unsigned buffer.
10026         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10027         add zlib header.
10028         (zlib_compressed_suffix): Removed.
10029         (Output_compressed_section::set_final_data_size): Use unsigned
10030         buffers.
10031         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10032         Fix linker invocation.
10033         (flagstest_o_specialfile_and_compress_debug_sections):
10034         Likewise.
10035         * testsuite/Makefile.in: Regenerated.
10036
10037 2008-04-02  David S. Miller  <davem@davemloft.net>
10038
10039         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10040         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10041
10042 2008-04-02  Craig Silverstein  <csilvers@google.com>
10043
10044         * TODO: New file.
10045
10046 2008-04-02  Ian Lance Taylor  <iant@google.com>
10047
10048         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10049         parameters.  Update for new key type to views_.  Change all
10050         callers.
10051         (File_read::read): Adjust for byteshift in returned view.
10052         (File_read::add_view): New function, broken out of
10053         find_and_make_view.
10054         (File_read::make_view): New function, broken out of
10055         find_and_make_view.
10056         (File_read::find_or_make_view): Add offset and aligned
10057         parameters.  Rewrite accordingly.  Change all callers.
10058         (File_read::get_view): Add offset and aligned parameters.  Adjust
10059         for byteshift in return value.
10060         (File_read::get_lasting_view): Likewise.
10061         * fileread.h (class File_read): Update declarations.
10062         (class File_read::View): Add byteshift_ field.  Add byteshift to
10063         constructor.  Add byteshift method.
10064         * archive.h (Archive::clear_uncached_views): New function.
10065         (Archive::get_view): Add aligned parameter.  Change all callers.
10066         * object.h (Object::get_view): Add aligned parameter.  Change all
10067         callers.
10068         (Object::get_lasting_view): Likewise.
10069
10070         * fileread.cc (File_read::release): Don't call clear_views if
10071         there are multiple objects.
10072         * fileread.h (File_read::clear_uncached_views): New function.
10073         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10074         on the archive.
10075
10076 2008-03-31  Cary Coutant  <ccoutant@google.com>
10077
10078         Add thin archive support.
10079         * archive.cc (Archive::armagt): New const.
10080         (Archive::setup): Remove task parameter and calls to unlock.
10081         (Archive::unlock_nested_archives): New function.
10082         (Archive::read_header): Add nested_off parameter. Change
10083         all callers.
10084         (Archive::interpret_header): Likewise.
10085         (Archive::include_all_members): Change to handle thin
10086         archives.
10087         (Archive::include_member): Likewise.
10088         * archive.h (Archive::Archive): Add new parameters and
10089         initializers.
10090         (Archive::armagt): New const.
10091         (Archive::setup): Remove task parameter.
10092         (Archive::unlock_nested_archives): New function.
10093         (Archive::read_header): Add nested_off parameter.
10094         (Archive::interpret_header): Likewise.
10095         (Archive::Nested_archive_table): New typedef.
10096         (Archive::is_thin_archive_): New field.
10097         (Archive::nested_archives_): New field.
10098         (Archive::options_): New field.
10099         (Archive::dirpath_): New field.
10100         (Archive::task_): New field.
10101         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10102         for thin archives.  Pass additional parameters to
10103         Archive::Archive.  Unlock the archive file after calling
10104         Archive::setup.
10105
10106 2008-03-29  Ian Lance Taylor  <iant@google.com>
10107
10108         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10109         version symbol to be local.
10110         * testsuite/ver_test_4.sh: New file.
10111         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10112         (check_DATA): Add ver_test_4.syms.
10113         (ver_test_4.syms): New target.
10114         * testsuite/Makefile.in: Rebuild.
10115
10116         * output.cc
10117         (Output_section::Input_section_sort_entry::has_priority): New
10118         function.
10119         (Output_section::Input_section_sort_entry::match_file_name): New
10120         function.
10121         (Output_section::Input_section_sort_entry::match_section_name):
10122         Remove.
10123         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10124         Remove.
10125         (Output_section::Input_section_sort_entry::match_section_file):
10126         Remove.
10127         (Output_section::Input_section_sort_compare::operator()): Rewrite
10128         using new Input_section_sort_entry functions.  Sort crtbegin and
10129         crtend first.  Sort sections with no priority before sections with
10130         a priority.
10131         * testsuite/initpri1.c (d3): Check j != 4.
10132         (cd5): New constructor/destructor function.
10133         (main): Check j != 2.
10134
10135         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10136         new symbol when resolving, don't call set_is_default.
10137         * testsuite/ver_test_7.cc: New file.
10138         * testsuite/ver_test_7.sh: New file.
10139         * testsuite/Makefile.am (ver_test_7.so): New target.
10140         (ver_test_7.o): New target.
10141         (check_SCRIPTS): Add ver_test_7.sh.
10142         (check_DATA): Add ver_test_7.syms.
10143         (ver_test_7.syms): New target.
10144
10145 2008-03-28  Ian Lance Taylor  <iant@google.com>
10146
10147         * layout.cc (Layout::layout): If we see an input section with a
10148         name that needs sorting, set the must_sort flag for the output
10149         section.
10150         (Layout::make_output_section): If the name of the output section
10151         indicates that it might require sorting, set the may_sort flag.
10152         * output.h (Output_section::may_sort_attached_input_sections): New
10153         function.
10154         (Output_section::set_may_sort_attached_input_sections): New
10155         function.
10156         (Output_section::must_sort_attached_input_sections): New
10157         function.
10158         (Output_section::set_must_sort_attached_input_sections): New
10159         function.
10160         (class Output_section): Declare Input_section_sort_entry.  Define
10161         Input_section_sort_compare.  Declare
10162         sort_attached_input_sections.  Add new fields:
10163         may_sort_attached_input_sections_,
10164         must_sort_attached_input_sections_,
10165         attached_input_sections_are_sorted_.
10166         * output.cc (Output_section::Output_section): Initialize new
10167         fields.
10168         (Output_section::add_input_section): Add an entry to
10169         input_sections_ if may_sort or must_sort are true.
10170         (Output_section::set_final_data_size): Call
10171         sort_attached_input_sections if necessary.
10172         (Output_section::Input_section_sort_entry): Define new class.
10173         (Output_section::Input_section_sort_compare::operator()): New
10174         function.
10175         (Output_section::sort_attached_input_sections): New function.
10176         * configure.ac: Check whether the compiler supports constructor
10177         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10178         * testsuite/initpri1.c: New file.
10179         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10180         CONSTRUCTOR_PRIORITY.
10181         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10182         (initpri1_LDFLAGS): New variable.
10183         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10184
10185 2008-03-27  Ian Lance Taylor  <iant@google.com>
10186
10187         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10188         * testsuite/common_test_1.c: New file.
10189         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10190         (common_test_1_SOURCES): New variable.
10191         (common_test_1_DEPENDENCIES): New variable.
10192         (common_test_1_LDFLAGS): New variable.
10193
10194         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10195         and commons_ correctly when NAME/VERSION does not override
10196         NAME/NULL.
10197         * testsuite/ver_test_6.c: New file.
10198         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10199         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10200         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10201
10202 2008-03-26  Ian Lance Taylor  <iant@google.com>
10203
10204         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10205         of an undefined symbol from a version script.
10206         * testsuite/Makefile.am (ver_test_5.so): New target.
10207         (ver_test_5.o): New target.
10208         (check_SCRIPTS): Add ver_test_5.sh.
10209         (check_DATA): Add ver_test_5.syms.
10210         (ver_test_5.syms): New target.
10211         * testsuite/ver_test_5.cc: New file.
10212         * testsuite/ver_test_5.script: New file.
10213         * testsuite/ver_test_5.sh: New file.
10214         * Makefile.in, testsuite/Makefile.in: Rebuild.
10215
10216         PR gold/5986
10217         Fix problems building gold with gcc 4.3.0.
10218         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10219         (gold_error_at_location, gold_warning_at_location): Use it.
10220         * configure.ac: Check whether we can compile and use a template
10221         function with a printf attribute.
10222         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10223         when jumping over bytes.
10224         * object.cc: Instantiate Object::read_section_data.
10225         * debug.h: Include <cstring>
10226         * dwarf_reader.cc: Include <algorithm>
10227         * main.cc: Include <cstring>.
10228         * options.cc: Include <cstring>.
10229         * output.cc: Include <cstring>.
10230         * script.cc: Include <cstring>.
10231         * script.h: Include <string>.
10232         * symtab.cc: Include <cstring> and <algorithm>.
10233         * target-select.cc: Include <cstring>.
10234         * version.cc: Include <string>.
10235         * testsuite/testmain.cc: Include <cstdlib>.
10236         * configure, config.in: Rebuild.
10237
10238 2008-03-25  Ian Lance Taylor  <iant@google.com>
10239
10240         * options.cc: Include "../bfd/bfdver.h".
10241         (options::help): Print bug reporting address.
10242
10243         * version.cc (print_version): Adjust output for current value of
10244         BFD_VERSION_STRING.
10245
10246         * NEWS: New file.
10247
10248         * options.cc (options::help): Print list of supported targets.
10249         * target-select.h: Include <vector>.
10250         (class Target_selector): Make machine_, size_, and is_big_endian_
10251         fields const.  Add bfd_name_ and instantiated_target_ fields.
10252         (Target_selector::Target_selector): Add bfd_name parameter.
10253         (Target_selector::recognize): Make non-virtual, call
10254         do_recognize.
10255         (Target_selector::recognize_by_name): Make non-virtual, call
10256         do_recognize_by_name.
10257         (Target_selector::supported_names): New function.
10258         (Target_selector::bfd_name): New function.
10259         (Target_selector::do_instantiate_target): New pure virtual
10260         function.
10261         (Target_selector::do_recognize): New virtual function.
10262         (Target_selector::do_recognize_by_name): New virtual function.
10263         (Target_selector::instantiate_target): New private function.
10264         (supported_target_names): Declare.
10265         * target-select.cc (Target_selector::Target_selector): Update for
10266         new parameter and fields.
10267         (select_target_by_name): Check that the name matches before
10268         calling recognize_by_name.
10269         (supported_target_names): New function.
10270         * i386.cc (class Target_selector_i386): Update Target_selector
10271         constructor call.  Remove recognize and recognize_by_name.  Add
10272         do_instantiate_target.
10273         * x86_64.cc (class Target_selector_x86_64): Likewise.
10274         * testsuite/testfile.cc (class Target_selector_test): Update for
10275         changes to Target_selector.
10276
10277         * README: Rewrite, with some notes on unsupported features.
10278
10279 2008-03-24  Cary Coutant  <ccoutant@google.com>
10280
10281         * i386.cc (Target_i386::Got_type): New enum declaration.
10282         (Target_i386::Scan::local): Updated callers of Output_data_got
10283         member functions.
10284         (Target_i386::Scan::global): Likewise.
10285         (Target_i386::Relocate::relocate): Likewise.
10286         (Target_i386::Relocate::relocate_tls): Likewise.
10287         * object.h (Got_offset_list): New class.
10288         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10289         (Sized_relobj::local_got_offset): Likewise.
10290         (Sized_relobj::set_local_got_offset): Likewise.
10291         (Sized_relobj::local_has_tls_got_offset): Removed.
10292         (Sized_relobj::local_tls_got_offset): Removed.
10293         (Sized_relobj::set_local_tls_got_offset): Removed.
10294         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10295         * output.cc (Output_data_got::add_global): Added got_type parameter.
10296         (Output_data_got::add_global_with_rel): Likewise.
10297         (Output_data_got::add_global_with_rela): Likewise.
10298         (Output_data_got::add_global_pair_with_rel): New function.
10299         (Output_data_got::add_global_pair_with_rela): New function.
10300         (Output_data_got::add_local): Added got_type parameter.
10301         (Output_data_got::add_local_with_rel): Likewise.
10302         (Output_data_got::add_local_with_rela): Likewise.
10303         (Output_data_got::add_local_pair_with_rel): New function.
10304         (Output_data_got::add_local_pair_with_rela): New function.
10305         (Output_data_got::add_global_tls): Removed.
10306         (Output_data_got::add_global_tls_with_rel): Removed.
10307         (Output_data_got::add_global_tls_with_rela): Removed.
10308         (Output_data_got::add_local_tls): Removed.
10309         (Output_data_got::add_local_tls_with_rel): Removed.
10310         (Output_data_got::add_local_tls_with_rela): Removed.
10311         * output.h (Output_data_got::add_global): Added got_type parameter.
10312         (Output_data_got::add_global_with_rel): Likewise.
10313         (Output_data_got::add_global_with_rela): Likewise.
10314         (Output_data_got::add_global_pair_with_rel): New function.
10315         (Output_data_got::add_global_pair_with_rela): New function.
10316         (Output_data_got::add_local): Added got_type parameter.
10317         (Output_data_got::add_local_with_rel): Likewise.
10318         (Output_data_got::add_local_with_rela): Likewise.
10319         (Output_data_got::add_local_pair_with_rel): New function.
10320         (Output_data_got::add_local_pair_with_rela): New function.
10321         (Output_data_got::add_global_tls): Removed.
10322         (Output_data_got::add_global_tls_with_rel): Removed.
10323         (Output_data_got::add_global_tls_with_rela): Removed.
10324         (Output_data_got::add_local_tls): Removed.
10325         (Output_data_got::add_local_tls_with_rel): Removed.
10326         (Output_data_got::add_local_tls_with_rela): Removed.
10327         * resolve.cc (Symbol::override_base_with_special): Removed
10328         reference to has_got_offset_ field.
10329         * symtab.cc (Symbol::init_fields): Replaced initialization
10330         of got_offset_ with got_offsets_.  Removed initialization
10331         of has_got_offset_
10332         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10333         (Symbol::got_offset): Likewise.
10334         (Symbol::set_got_offset): Likewise.
10335         (Symbol::has_tls_got_offset): Removed.
10336         (Symbol::tls_got_offset): Removed.
10337         (Symbol::set_tls_got_offset): Removed.
10338         (Symbol::got_offset_): Removed.
10339         (Symbol::tls_mod_got_offset_): Removed.
10340         (Symbol::tls_pair_got_offset_): Removed.
10341         (Symbol::got_offsets_): New field.
10342         (Symbol::has_got_offset): Removed.
10343         (Symbol::has_tls_mod_got_offset): Removed.
10344         (Symbol::has_tls_pair_got_offset): Removed.
10345         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10346         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10347         member functions.
10348         (Target_x86_64::Scan::global): Likewise.
10349         (Target_x86_64::Relocate::relocate): Likewise.
10350         (Target_x86_64::Relocate::relocate_tls): Likewise.
10351
10352 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10353
10354         * yyscript.y: Fix spelling error in comment.
10355
10356 2008-03-24  Ian Lance Taylor  <iant@google.com>
10357
10358         * options.h (class General_options): Define build_id option.
10359         * layout.h (class Layout): Declare write_build_id, create_note,
10360         create_build_id.  Add build_id_note_ member.
10361         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10362         "libiberty.h", "md5.h", "sha1.h".
10363         (Layout::Layout): Initialize eh_frame_data_,
10364         eh_frame_hdr_section_, and build_id_note_.
10365         (Layout::finalize): Call create_build_id.
10366         (Layout::create_note): New function, broken out of
10367         Layout::create_gold_note.
10368         (Layout::create_gold_note): Call create_note.
10369         (Layout::create_build_id): New function.
10370         (Layout::write_build_id): New function.
10371         (Close_task_runner::run): Call write_build_id.
10372
10373         * x86_64.cc: Correct license to GPLv3.
10374
10375 2008-03-23  Ian Lance Taylor  <iant@google.com>
10376
10377         * options.cc: Include "demangle.h".
10378         (parse_optional_string): New function.
10379         (parse_long_option): Handle takes_optional_argument.
10380         (parse_short_option): Update dash_z initializer.  Handle
10381         takes_optional_argument.
10382         (General_options::General_options): Initialize do_demangle_.
10383         (General_options::finalize): Set do_demangle_.  Handle demangling
10384         style.
10385         * options.h (parse_optional_string): Declare.
10386         (struct One_option): Add optional_arg field.  Update constructor.
10387         Update call constructor calls.  Add takes_optional_argument
10388         function.
10389         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
10390         (DEFINE_optional_string): Define.
10391         (General_options::demangle): Change from DEFINE_bool to
10392         DEFINE_optional_string.
10393         (General_options::no_demangle): New function.
10394         (General_options::do_demangle): New function.
10395         (General_options::set_do_demangle): New function.
10396         (General_options::execstack_status_): Move definition to end of
10397         class definition.
10398         (General_options::static_): Likewise.
10399         (General_options::do_demangle_): New field.
10400         * object.cc (big_endian>::get_symbol_location_info): Call
10401         Options::do_demangle, not Options::demangle.
10402         * symtab.cc (demangle): Likewise.
10403
10404 2008-03-22  Ian Lance Taylor  <iant@google.com>
10405
10406         * gold.h: Include <cstddef> and <sys/types.h>
10407         * options.h: Include <cstring>.
10408
10409 2008-03-21  Ian Lance Taylor  <iant@google.com>
10410
10411         * Added source code to GNU binutils.