* incremental.cc (Sized_incr_relobj::do_add_symbols): Always
[binutils.git] / gold / ChangeLog
blobcb4cdfa880542db092ce20fffedbdeb0678bc7be
1 2011-04-11  Ian Lance Taylor  <iant@google.com>
3         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4         initialize local variable v.
6 2011-04-11  Cary Coutant  <ccoutant@google.com>
8         * archive.cc (Archive::include_member): Adjust call to
9         report_object.
10         (Add_archive_symbols::run): Track argument serial numbers.
11         (Lib_group::include_member): Likewise.
12         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
13         * archive.h (Incremental_archive_entry::Archive_member):
14         Initialize arg_serial_.
15         (Archive_member::arg_serial_): New data member.
16         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
17         (Sized_dynobj::do_add_symbols): Track symbols when doing an
18         incremental link.
19         (Sized_dynobj::do_for_all_local_got_entries): New function.
20         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
21         function.
22         * fileread.cc (get_mtime): New function.
23         * fileread.h (get_mtime): New function.
24         * gold.cc (queue_initial_tasks): Check for incremental update.
25         (process_incremental_input): New function.
26         (queue_middle_tasks): Don't force valid target for incremental
27         update.
28         * incremental-dump.cc (find_input_containing_global): Adjust
29         size of symbol info entry.
30         (dump_incremental_inputs): Dump argument serial number and
31         in_system_directory flag; bias shndx by 1; print symbol names
32         when dumping per-file symbol lists; use new symbol info readers.
33         * incremental.cc
34         (Output_section_incremental_inputs:update_data_size): New function.
35         (Sized_incremental_binary::setup_readers): Setup input readers
36         for each input file; build maps for files added from libraries
37         and scripts.
38         (Sized_incremental_binary::check_input_args): New function.
39         (Sized_incremental_binary::do_check_inputs): Build map of argument
40         serial numbers to input arguments.
41         (Sized_incremental_binary::do_file_has_changed): Rename
42         do_file_is_unchanged to this; compare file modification times.
43         (Sized_incremental_binary::do_init_layout): New function.
44         (Sized_incremental_binary::do_reserve_layout): New function.
45         (Sized_incremental_binary::do_get_input_reader): Remove.
46         (Sized_incremental_binary::get_symtab_view): New function.
47         (Incremental_checker::can_incrementally_link_output_file): Remove.
48         (Incremental_inputs::report_command_line): Exclude --debug options.
49         (Incremental_inputs::report_archive_begin): Add parameter; track
50         argument serial numbers; don't put input file entry for archive
51         before archive members.
52         (Incremental_inputs::report_archive_end): Put input file entry
53         for archive after archive members.
54         (Incremental_inputs::report_object): Add parameter; track argument
55         serial numbers and in_system_directory flag.
56         (Incremental_inputs::report_script): Add parameter; track argument
57         serial numbers.
58         (Output_section_incremental_inputs::set_final_data_size): Adjust
59         size of symbol info entry; check for forwarding symbols.
60         (Output_section_incremental_inputs::write_input_files): Write
61         in_system_directory flag and argument serial number.
62         (Output_section_incremental_inputs::write_info_blocks): Map section
63         indices between incremental info and original input file; store
64         input section index for each symbol.
65         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
66         change operator() to visit().
67         (class Global_got_offset_visitor): Likewise.
68         (class Global_symbol_visitor_got_plt):
69         (Output_section_incremental_inputs::write_got_plt): Use new visitor
70         classes.
71         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
72         (Sized_incr_relobj::do_read_symbols): New function.
73         (Sized_incr_relobj::do_layout): New function.
74         (Sized_incr_relobj::do_layout_deferred_sections): New function.
75         (Sized_incr_relobj::do_add_symbols): New function.
76         (Sized_incr_relobj::do_should_include_member): New function.
77         (Sized_incr_relobj::do_for_all_global_symbols): New function.
78         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
79         (Sized_incr_relobj::do_section_size): New function.
80         (Sized_incr_relobj::do_section_name): New function.
81         (Sized_incr_relobj::do_section_contents): New function.
82         (Sized_incr_relobj::do_section_flags): New function.
83         (Sized_incr_relobj::do_section_entsize): New function.
84         (Sized_incr_relobj::do_section_address): New function.
85         (Sized_incr_relobj::do_section_type): New function.
86         (Sized_incr_relobj::do_section_link): New function.
87         (Sized_incr_relobj::do_section_info): New function.
88         (Sized_incr_relobj::do_section_addralign): New function.
89         (Sized_incr_relobj::do_initialize_xindex): New function.
90         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
91         (Sized_incr_relobj::do_read_relocs): New function.
92         (Sized_incr_relobj::do_gc_process_relocs): New function.
93         (Sized_incr_relobj::do_scan_relocs): New function.
94         (Sized_incr_relobj::do_count_local_symbols): New function.
95         (Sized_incr_relobj::do_finalize_local_symbols): New function.
96         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
97         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
98         (Sized_incr_relobj::do_relocate): New function.
99         (Sized_incr_relobj::do_set_section_offset): New function.
100         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
101         (Sized_incr_dynobj::do_read_symbols): New function.
102         (Sized_incr_dynobj::do_layout): New function.
103         (Sized_incr_dynobj::do_add_symbols): New function.
104         (Sized_incr_dynobj::do_should_include_member): New function.
105         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
106         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
107         (Sized_incr_dynobj::do_section_size): New function.
108         (Sized_incr_dynobj::do_section_name): New function.
109         (Sized_incr_dynobj::do_section_contents): New function.
110         (Sized_incr_dynobj::do_section_flags): New function.
111         (Sized_incr_dynobj::do_section_entsize): New function.
112         (Sized_incr_dynobj::do_section_address): New function.
113         (Sized_incr_dynobj::do_section_type): New function.
114         (Sized_incr_dynobj::do_section_link): New function.
115         (Sized_incr_dynobj::do_section_info): New function.
116         (Sized_incr_dynobj::do_section_addralign): New function.
117         (Sized_incr_dynobj::do_initialize_xindex): New function.
118         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
119         (make_sized_incremental_object): New function.
120         (Incremental_library::copy_unused_symbols): New function.
121         (Incremental_library::do_for_all_unused_symbols): New function.
122         * incremental.h (enum Incremental_input_flags): New type.
123         (class Incremental_checker): Remove.
124         (Incremental_input_entry::Incremental_input_entry): Add argument
125         serial number.
126         (Incremental_input_entry::arg_serial): New function.
127         (Incremental_input_entry::set_is_in_system_directory): New function.
128         (Incremental_input_entry::is_in_system_directory): New function.
129         (Incremental_input_entry::arg_serial_): New data member.
130         (Incremental_input_entry::is_in_system_directory_): New data member.
131         (class Script_info): Move here from script.h.
132         (Script_info::Script_info): Add filename parameter.
133         (Script_info::filename): New function.
134         (Script_info::filename_): New data member.
135         (Incremental_script_entry::Incremental_script_entry): Add argument
136         serial number.
137         (Incremental_object_entry::Incremental_object_entry): Likewise.
138         (Incremental_object_entry::add_input_section): Build list of input
139         sections with map to original shndx.
140         (Incremental_object_entry::get_input_section_index): New function.
141         (Incremental_object_entry::shndx_): New data member.
142         (Incremental_object_entry::name_key_): Rename; adjust all refs.
143         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
144         (Incremental_archive_entry::Incremental_archive_entry): Add argument
145         serial number.
146         (Incremental_inputs::report_archive_begin): Likewise.
147         (Incremental_inputs::report_object): Likewise.
148         (Incremental_inputs::report_script): Likewise.
149         (class Incremental_global_symbol_reader): New class.
150         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
151         and store flags and input file type.
152         (Incremental_input_entry_reader::arg_serial): New function.
153         (Incremental_input_entry_reader::type): Extract type from flags.
154         (Incremental_input_entry_reader::is_in_system_directory): New function.
155         (Incremental_input_entry_reader::get_input_section_count): Call
156         accessor function for type.
157         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
158         function for type; adjust size of global symbol entry.
159         (Incremental_input_entry_reader::get_global_symbol_count): Call
160         accessor function for type.
161         (Incremental_input_entry_reader::get_object_count): Likewise.
162         (Incremental_input_entry_reader::get_object_offset): Likewise.
163         (Incremental_input_entry_reader::get_member_count): Likewise.
164         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
165         (Incremental_input_entry_reader::get_member_offset): Likewise.
166         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
167         (Incremental_input_entry_reader::Global_symbol_info): Remove.
168         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
169         (Incremental_input_entry_reader::get_global_symbol_reader): New
170         function.
171         (Incremental_input_entry_reader::get_output_symbol_index): New
172         function.
173         (Incremental_input_entry_reader::type_): Remove.
174         (Incremental_input_entry_reader::flags_): New data member.
175         (Incremental_inputs_reader::input_file_offset): New function.
176         (Incremental_inputs_reader::input_file_index): New function.
177         (Incremental_inputs_reader::input_file): Call input_file_offset.
178         (Incremental_inputs_reader::input_file_at_offset): New function.
179         (Incremental_relocs_reader::get_r_type): Reformat.
180         (Incremental_relocs_reader::get_r_shndx): Reformat.
181         (Incremental_relocs_reader::get_r_offset): Reformat.
182         (Incremental_relocs_reader::data): New function.
183         (Incremental_binary::Incremental_binary): Initialize new data members.
184         (Incremental_binary::check_inputs): Add cmdline parameter.
185         (Incremental_binary::file_is_unchanged): Remove.
186         (Input_reader::arg_serial): New function.
187         (Input_reader::get_unused_symbol_count): New function.
188         (Input_reader::get_unused_symbol): New function.
189         (Input_reader::do_arg_serial): New function.
190         (Input_reader::do_get_unused_symbol_count): New function.
191         (Input_reader::do_get_unused_symbol): New function.
192         (Incremental_binary::input_file_count): New function.
193         (Incremental_binary::get_input_reader): Change signature to use
194         index instead of filename.
195         (Incremental_binary::file_has_changed): New function.
196         (Incremental_binary::get_input_argument): New function.
197         (Incremental_binary::get_library): New function.
198         (Incremental_binary::get_script_info): New function.
199         (Incremental_binary::init_layout): New function.
200         (Incremental_binary::reserve_layout): New function.
201         (Incremental_binary::output_file): New function.
202         (Incremental_binary::do_check_inputs): New function.
203         (Incremental_binary::do_file_is_unchanged): Remove.
204         (Incremental_binary::do_file_has_changed): New function.
205         (Incremental_binary::do_init_layout): New function.
206         (Incremental_binary::do_reserve_layout): New function.
207         (Incremental_binary::do_input_file_count): New function.
208         (Incremental_binary::do_get_input_reader): Change signature.
209         (Incremental_binary::input_args_map_): New data member.
210         (Incremental_binary::library_map_): New data member.
211         (Incremental_binary::script_map_): New data member.
212         (Sized_incremental_binary::Sized_incremental_binary): Initialize
213         new data members.
214         (Sized_incremental_binary::output_section): New function.
215         (Sized_incremental_binary::inputs_reader): Add const.
216         (Sized_incremental_binary::symtab_reader): Add const.
217         (Sized_incremental_binary::relocs_reader): Add const.
218         (Sized_incremental_binary::got_plt_reader): Add const.
219         (Sized_incremental_binary::get_symtab_view): New function.
220         (Sized_incremental_binary::Inputs_reader): New typedef.
221         (Sized_incremental_binary::Input_entry_reader): New typedef.
222         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
223         (Sized_incremental_binary::do_file_is_unchanged): Remove.
224         (Sized_incremental_binary::do_file_has_changed): New function.
225         (Sized_incremental_binary::do_init_layout): New function.
226         (Sized_incremental_binary::do_reserve_layout): New function.
227         (Sized_input_reader::Inputs_reader): Remove.
228         (Sized_input_reader::Input_entry_reader): Remove.
229         (Sized_input_reader::do_arg_serial): New function.
230         (Sized_input_reader::do_get_unused_symbol_count): New function.
231         (Sized_input_reader::do_get_unused_symbol): New function.
232         (Sized_incremental_binary::do_input_file_count): New function.
233         (Sized_incremental_binary::do_get_input_reader): Change signature;
234         use index instead of filename.
235         (Sized_incremental_binary::section_map_): New data member.
236         (Sized_incremental_binary::input_entry_readers_): New data member.
237         (class Sized_incr_relobj): New class.
238         (class Sized_incr_dynobj): New class.
239         (make_sized_incremental_object): New function.
240         (class Incremental_library): New class.
241         * layout.cc (Free_list::num_lists): New static data member.
242         (Free_list::num_nodes): New static data member.
243         (Free_list::num_removes): New static data member.
244         (Free_list::num_remove_visits): New static data member.
245         (Free_list::num_allocates): New static data member.
246         (Free_list::num_allocate_visits): New static data member.
247         (Free_list::init): New function.
248         (Free_list::remove): New function.
249         (Free_list::allocate): New function.
250         (Free_list::dump): New function.
251         (Free_list::print_stats): New function.
252         (Layout_task_runner::run): Resize output file for incremental updates.
253         (Layout::Layout): Initialize new data members.
254         (Layout::set_incremental_base): New function.
255         (Layout::init_fixed_output_section): New function.
256         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
257         incremental updates.
258         (Layout::create_gold_note): Do not create gold note section for
259         incremental updates.
260         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
261         for incremental updates.
262         (Layout::set_section_offsets): For incremental updates, allocate space
263         from free list.
264         (Layout::create_symtab_sections): Layout with offsets relative to
265         start of section; for incremental updates, allocate space from free
266         list.
267         (Layout::create_shdrs): For incremental updates, allocate space from
268         free list.
269         (Layout::finish_dynamic_section): For incremental updates, do not
270         check --as-needed (fixed in subsequent patch).
271         * layout.h (class Free_list): New class.
272         (Layout::set_incremental_base): New function.
273         (Layout::incremental_base): New function.
274         (Layout::init_fixed_output_section): New function.
275         (Layout::allocate): New function.
276         (Layout::incremental_base_): New data member.
277         (Layout::free_list_): New data member.
278         * main.cc (main): Print Free_list statistics.
279         * object.cc (Relobj::finalize_incremental_relocs): Add
280         clear_counts parameter; clear counts only when clear_counts is set.
281         (Sized_relobj::Sized_relobj): Initialize new base class.
282         (Sized_relobj::do_layout): Don't report special sections.
283         (Sized_relobj::do_for_all_local_got_entries): New function.
284         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
285         symtab_off to all symbol table offsets.
286         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
287         * object.h (class Got_offset_list): Move to top of file.
288         (Object::Object): Allow case where input_file == NULL.
289         (Object::~Object): Likewise.
290         (Object::input_file): Assert that input_file != NULL.
291         (Object::lock): Allow case where input_file == NULL.
292         (Object::unlock): Likewise.
293         (Object::is_locked): Likewise.
294         (Object::token): Likewise.
295         (Object::release): Likewise.
296         (Object::is_incremental): New function.
297         (Object::get_mtime): New function.
298         (Object::for_all_local_got_entries): New function.
299         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
300         (Object::set_is_in_system_directory): New function.
301         (Object::is_in_system_directory): New function.
302         (Object::do_is_incremental): New function.
303         (Object::do_get_mtime): New function.
304         (Object::do_for_all_local_got_entries): New function.
305         (Object::is_in_system_directory_): New data member.
306         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
307         (class Sized_relobj_base): New class.
308         (class Sized_relobj): Derive from Sized_relobj_base.
309         (class Sized_relobj::Symbols): Redeclare from base class.
310         (class Sized_relobj::local_got_offset_list): Remove.
311         (class Sized_relobj::Output_sections): Redeclare from base class.
312         (class Sized_relobj::do_for_all_local_got_entries): New function.
313         (class Sized_relobj::write_local_symbols): Add offset parameter.
314         (class Sized_relobj::local_symbol_offset_): Update comment.
315         (class Sized_relobj::local_dynsym_offset_): Update comment.
316         * options.cc (Input_arguments::add_file): Remove const.
317         * options.h (Input_file_argument::Input_file_argument):
318         Initialize arg_serial_ (all constructors).
319         (Input_file_argument::set_arg_serial): New function.
320         (Input_file_argument::arg_serial): New function.
321         (Input_file_argument::arg_serial_): New data member.
322         (Input_arguments::Input_arguments): Initialize file_count_.
323         (Input_arguments::add_file): Remove const.
324         (Input_arguments::number_of_input_files): New function.
325         (Input_arguments::file_count_): New data member.
326         (Command_line::number_of_input_files): Call
327         Input_arguments::number_of_input_files.
328         * output.cc (Output_segment_headers::Output_segment_headers):
329         Set current size.
330         (Output_section::Input_section::current_data_size): New function.
331         (Output_section::Output_section): Initialize new data members.
332         (Output_section::add_input_section): Don't do merge sections for
333         an incremental link; allocate space from free list for an
334         incremental update.
335         (Output_section::add_output_section_data): Allocate space from
336         free list for an incremental update.
337         (Output_section::update_data_size): New function.
338         (Output_section::set_fixed_layout): New function.
339         (Output_section::reserve): New function.
340         (Output_segment::set_section_addresses): Remove const.
341         (Output_segment::set_section_list_addresses): Remove const; allocate
342         space from free list for an incremental update.
343         (Output_segment::set_offset): Adjust size of RELRO segment for an
344         incremental update.
345         * output.h (Output_data::current_data_size): Move here from
346         child classes.
347         (Output_data::pre_finalize_data_size): New function.
348         (Output_data::update_data_size): New function.
349         (Output_section_headers::update_data_size): new function.
350         (Output_section_data_build::current_data_size): Move to Output_data.
351         (Output_data_strtab::update_data_size): New function.
352         (Output_section::current_data_size): Move to Output_data.
353         (Output_section::set_fixed_layout): New function.
354         (Output_section::has_fixed_layout): New function.
355         (Output_section::reserve): New function.
356         (Output_section::update_data_size): New function.
357         (Output_section::has_fixed_layout_): New data member.
358         (Output_section::free_list_): New data member.
359         (Output_segment::set_section_addresses): Remove const.
360         (Output_segment::set_section_list_addresses): Remove const.
361         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
362         New function.
363         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
364         New function.
365         * readsyms.cc (Read_symbols::do_read_symbols): Add library
366         parameter when calling Add_symbols constructor; store argument
367         serial number for members of a lib group.
368         (Add_symbols::locks): Allow case where token == NULL.
369         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
370         (Read_member::~Read_member): New function.
371         (Read_member::is_runnable): New function.
372         (Read_member::locks): New function.
373         (Read_member::run): New function.
374         (Check_script::~Check_script): New function.
375         (Check_script::is_runnable): New function.
376         (Check_script::locks): New function.
377         (Check_script::run): New function.
378         (Check_library::~Check_library): New function.
379         (Check_library::is_runnable): New function.
380         (Check_library::locks): New function.
381         (Check_library::run): New function.
382         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
383         (Add_symbols::library_): New data member.
384         (class Read_member): New class.
385         (class Check_script): New class.
386         (class Check_library): New class.
387         * reloc.cc (Read_relocs::is_runnable): Allow case where
388         token == NULL.
389         (Read_relocs::locks): Likewise.
390         (Scan_relocs::locks): Likewise.
391         (Relocate_task::locks): Likewise.
392         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
393         to clear counters.
394         (Sized_relobj::incremental_relocs_scan): Fix comment.
395         (Sized_relobj::do_relocate): Pass output file offset to
396         write_local_symbols.
397         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
398         from class declaration.
399         * script.cc (read_input_script): Allocate Script_info; pass
400         argument serial number to report_script.
401         * script.h (class Script_info): Move to incremental.h.
402         * symtab.cc (Symbol_table::add_from_incrobj): New function.
403         * symtab.h (Symbol_table::add_from_incrobj): New function.
404         (Symbol_table::set_file_offset): New function.
406 2011-04-05  Cary Coutant  <ccoutant@google.com>
408         * incremental-dump.cc (dump_incremental_inputs): Change signature
409         to take a Sized_incremental_binary; change caller.  Use readers
410         in Sized_incremental_binary.
411         * incremental.cc
412         (Sized_incremental_binary::find_incremental_inputs_sections):
413         Rename do_find_incremental_inputs_sections to this.
414         (Sized_incremental_binary::setup_readers): New function.
415         (Sized_incremental_binary::do_check_inputs): Check
416         has_incremental_info_ flag; move setup code to setup_readers;
417         use input readers.
418         (Sized_incremental_binary::do_file_is_unchanged): New function.
419         (Sized_incremental_binary::do_get_input_reader): New function.
420         * incremental.h (class Incremental_binary): Move to end of file.
421         (Incremental_binary::file_is_unchanged): New function.
422         (Incremental_binary::do_file_is_unchanged): New function.
423         (Incremental_binary::Input_reader): New class.
424         (Incremental_binary::get_input_reader): New function.
425         (class Sized_incremental_binary): Move to end of file.
426         (Sized_incremental_binary::Sized_incremental_binary): Setup the
427         input section reader classes.
428         (Sized_incremental_binary::has_incremental_info): New function.
429         (Sized_incremental_binary::inputs_reader): New function.
430         (Sized_incremental_binary::symtab_reader): New function.
431         (Sized_incremental_binary::relocs_reader): New function.
432         (Sized_incremental_binary::got_plt_reader): New function.
433         (Sized_incremental_binary::do_file_is_unchanged): New function.
434         (Sized_incremental_binary::Sized_input_reader): New class.
435         (Sized_incremental_binary::get_input_reader): New function.
436         (Sized_incremental_binary::find_incremental_inputs_sections):
437         Rename do_find_incremental_inputs_sections to this.
438         (Sized_incremental_binary::setup_readers): New function.
439         (Sized_incremental_binary::has_incremental_info_): New data member.
440         (Sized_incremental_binary::inputs_reader_): New data member.
441         (Sized_incremental_binary::symtab_reader_): New data member.
442         (Sized_incremental_binary::relocs_reader_): New data member.
443         (Sized_incremental_binary::got_plt_reader_): New data member.
444         (Sized_incremental_binary::current_input_file_): New data member.
446 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
448         PR gold/12640
449         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
450         violation.
452 2011-03-30  Cary Coutant  <ccoutant@google.com>
454         * archive.cc (Archive::include_member): Adjust call to report_object.
455         (Add_archive_symbols::run): Add script_info to call to
456         report_archive_begin.
457         (Lib_group::include_member): Adjust call to report_object.
458         (Add_lib_group_symbols::run): Adjust call to report_object.
459         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
460         blocks.  Add object count for script input files.
461         * incremental.cc (Incremental_inputs::report_archive_begin): Add
462         script_info parameter; change all callers.
463         (Incremental_inputs::report_object): Add script_info parameter;
464         change all callers.
465         (Incremental_inputs::report_script): Store backpointer to
466         incremental info entry.
467         (Output_section_incremental_inputs::set_final_data_size): Record
468         additional information for scripts.
469         (Output_section_incremental_inputs::write_info_blocks): Likewise.
470         * incremental.h (Incremental_script_entry::add_object): New function.
471         (Incremental_script_entry::get_object_count): New function.
472         (Incremental_script_entry::get_object): New function.
473         (Incremental_script_entry::objects_): New data member; adjust
474         constructor.
475         (Incremental_inputs::report_archive_begin): Add script_info parameter.
476         (Incremental_inputs::report_object): Add script_info parameter.
477         (Incremental_inputs_reader::get_object_count): New function.
478         (Incremental_inputs_reader::get_object_offset): New function.
479         * options.cc (Input_arguments::add_file): Return reference to
480         new input argument.
481         * options.h (Input_argument::set_script_info): New function.
482         (Input_argument::script_info): New function.
483         (Input_argument::script_info_): New data member; adjust all
484         constructors.
485         (Input_file_group::add_file): Return reference to new input argument.
486         (Input_file_lib::add_file): Likewise.
487         (Input_arguments::add_file): Likewise.
488         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
489         * script.cc (Parser_closure::Parser_closure): Add script_info
490         parameter; adjust all callers.
491         (Parser_closure::script_info): New function.
492         (Parser_closure::script_info_): New data member.
493         (read_input_script): Report scripts earlier to incremental info.
494         (script_add_file): Set script_info in Input_argument.
495         (script_add_library): Likewise.
496         * script.h (Script_options::Script_info): Rewrite class.
498 2011-03-29  Cary Coutant  <ccoutant@google.com>
500         * archive.cc (Library_base::should_include_member): Move
501         method here from class Archive.
502         (Archive::Archive): Initialize base class.
503         (Archive::should_include_member): Move to base class.
504         (Archive::do_for_all_unused_symbols): New function.
505         (Add_archive_symbols::run): Remove redundant access to
506         incremental_inputs.
507         (Lib_group::Lib_group): Initialize base class.
508         (Lib_group::do_filename): New function.
509         (Lib_group::include_member): Pass pointer to Lib_group to
510         report_object.
511         (Lib_group::do_for_all_unused_symbols): New function.
512         (Add_lib_group_symbols::run): Report archive information for
513         incremental links.
514         * archive.h (class Library_base): New base class.
515         (class Archive): Derive from Library_base.
516         (Archive::filename): Move to base class.
517         (Archive::set_incremental_info): Likewise.
518         (Archive::incremental_info): Likewise.
519         (Archive::Should_include): Likewise.
520         (Archive::should_include_member): Likewise.
521         (Archive::Armap_entry): Remove.
522         (Archive::Unused_symbol_iterator): Remove.
523         (Archive::unused_symbols_begin): Remove.
524         (Archive::unused_symbols_end): Remove.
525         (Archive::do_filename): New function.
526         (Archive::do_get_mtime): New function.
527         (Archive::do_for_all_unused_symbols): New function.
528         (Archive::task_): Move to base class.
529         (Archive::incremental_info_): Likewise.
530         (class Lib_group): Derive from Library_base.
531         (Lib_group::do_filename): New function.
532         (Lib_group::do_get_mtime): New function.
533         (Lib_group::do_for_all_unused_symbols): New function.
534         (Lib_group::task_): Move to base class.
535         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
536         function.
537         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
538         function.
539         * incremental.cc (Incremental_inputs::report_archive_begin):
540         Use Library_base; call library's get_mtime; add incremental inputs
541         entry before members.
542         (class Unused_symbol_visitor): New class.
543         (Incremental_inputs::report_archive_end): Use Library_base; use
544         visitor class to record unused symbols; don't add incremental inputs
545         entry after members.
546         (Incremental_inputs::report_object): Use Library_base.
547         * incremental.h
548         (Incremental_archive_entry::Incremental_archive_entry): Remove
549         unused Archive parameter.
550         (Incremental_inputs::report_archive_begin): Use Library_base.
551         (Incremental_inputs::report_archive_end): Likewise.
552         (Incremental_inputs::report_object): Likewise.
553         * object.cc (Sized_relobj::do_for_all_global_symbols): New
554         function.
555         * object.h (Object::for_all_global_symbols): New function.
556         (Object::do_for_all_global_symbols): New function.
557         (Sized_relobj::do_for_all_global_symbols): New function.
558         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
559         function.
560         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
561         function.
563 2011-03-27  Ian Lance Taylor  <iant@google.com>
565         * archive.cc (Archive::interpret_header): Return -1 if something
566         goes wrong.  Change callers accordingly.
568 2011-03-25  Cary Coutant  <ccoutant@google.com>
570         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
571         * testsuite/Makefile.in: Regenerate.
573 2010-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
575         * plugin.cc (get_view): New.
576         (Plugin::load): Pass get_view to the plugin.
577         (Plugin_manager::get_view): New.
579 2011-03-21  Ian Lance Taylor  <iant@google.com>
581         * testsuite/final_layout.sh: Rewrite to not use dc.
582         * testsuite/relro_test.sh: Fail if dc is not present.
584 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
586         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
587         Change == to -eq.
588         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
589         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
590         Change == to -eq.
591         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
592         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
594 2011-03-14  Ian Lance Taylor  <iant@google.com>
596         * script-sections.cc (Sort_output_sections::script_compare):
597         Rename from is_before, change return type.
598         (Sort_output_sections::operator()): Adjust accordingly.
600 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
602         PR gold/12572
603         * testsuite/odr_violation2.cc: Add comment to make all error line
604         numbers double digits.
605         * testsuite/debug_msg.sh: Adjust expected errors.
607 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
609         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
610         but mark earlier ones as non-canonical
611         (offset_to_iterator): Update search target and example
612         (do_addr2line): Return extra lines in a vector*
613         (format_file_lineno): Extract from do_addr2line
614         (one_addr2line): Add vector* out-param
615         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
616         when a lineno entry appeared last for its instruction
617         (Dwarf_line_info): Add vector* out-param
618         * object.cc (Relocate_info): Pass NULL for the vector* out-param
619         * symtab.cc (Odr_violation_compare): Include the lineno in the
620         comparison again.
621         (linenos_from_loc): New. Combine the canonical line for an
622         address with its other lines.
623         (True_if_intersect): New. Helper functor to make
624         std::set_intersection a query.
625         (detect_odr_violations): Compare sets of lines instead of just
626         one line for each function. This became less deterministic, but
627         has fewer false positives.
628         * symtab.h: Declarations.
629         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
630         mix an optimized and non-optimized object in the same binary
631         (odr_violation2.so): Same.
632         * testsuite/Makefile.in: Regenerate from Makefile.am.
633         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
634         * testsuite/debug_msg.sh: Update line numbers and add
635         assertions.
636         * testsuite/odr_violation1.cc: Use OdrDerived, in a
637         non-optimized context.
638         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
639         isn't inlined, and use OdrDerived in an optimized context.
640         * testsuite/odr_header1.h: Defines OdrDerived, where
641         optimization will change the
642         first-instruction-in-the-destructor's file and line number.
643         * testsuite/odr_header2.h: Defines OdrBase.
645 2011-03-09  Ian Lance Taylor  <iant@google.com>
647         * fileread.cc (File_read::clear_views): Don't delete the whole
648         file view.
650 2011-03-08  Ian Lance Taylor  <iant@google.com>
652         PR gold/12525
653         * fileread.cc: #include <climits>.
654         (GOLD_IOV_MAX): Define.
655         (File_read::read_multiple): Limit number of entries by iov_max.
656         * fileread.h (class File_read): Always set max_readv_entries to
657         128.
659 2011-03-07  Ian Lance Taylor  <iant@google.com>
661         PR gold/12525
662         * options.h (class General_options): Add -dy and -dn.
664 2011-03-02  Cary Coutant  <ccoutant@google.com>
666         * testsuite/script_test_9.t: Add TLS segment.
668 2011-03-02  Simon Baldwin  <simonb@google.com>
670         * configure.ac: Add check for gnu_indirect_function support in
671         the toolchain building binutils.
672         * configure: Rebuild.
674 2010-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
676         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
677         plugin only symbols.
678         (Symbol_table::sized_finalize_symbol) Mark symbol only present
679         in plugin files as not needed in the symbol table.
681 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
683         * output.cc (Output_section::add_input_section): Delay fill
684         generation for section ordering.
686 2011-02-09  Ian Lance Taylor  <iant@google.com>
688         PR gold/12316
689         * object.h (class Sized_relobj): Remove clear_local_symbols.
690         * reloc.cc (Sized_relobj::do_relocate): Don't call
691         clear_local_symbols.
693 2010-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
695         * plugin.cc (is_visible_from_outside): Return true for symbols
696         in the -u option.
698 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
700         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
701         filename.
703 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
705         * icf.h (is_section_foldable_candidate): Change type of parameter
706         to std::string.
707         * icf.cc (Icf::find_identical_sections): Change type of local variable
708         section_name to be std::string.
709         (is_function_ctor_or_dtor): Change type of parameter to std::string.
711 2011-01-25  Ian Lance Taylor  <iant@google.com>
713         * script.cc (script_add_extern): Rewrite to use
714         add_symbol_reference.
716 2011-01-25  Doug Kwan  <dougkwan@google.com>
718         * icf.cc (get_section_contents): Always lock section's object.
720 2011-01-24  Ian Lance Taylor  <iant@google.com>
722         * options.h (class General_options): Accept
723         --no-detect-odr-violations.
725 2011-01-24  Ian Lance Taylor  <iant@google.com>
727         * version.cc (version_string): Bump to 1.11.
729 2011-01-24  Ian Lance Taylor  <iant@google.com>
731         * plugin.cc (class Plugin_rescan): Define new class.
732         (Plugin_manager::claim_file): Set any_claimed_.
733         (Plugin_manager::save_archive): New function.
734         (Plugin_manager::save_input_group): New function.
735         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
736         necessary.
737         (Plugin_manager::new_undefined_symbol): New function.
738         (Plugin_manager::rescan): New function.
739         (Plugin_manager::rescannable_defines): New function.
740         (Plugin_manager::add_input_file): Set any_added_.
741         * plugin.h (class Plugin_manager): define new fields rescannable_,
742         undefined_symbols_, any_claimed_, and any_added_.  Declare
743         Plugin_rescan as friend.  Declare new functions.
744         (Plugin_manager::Rescannable): Define type.
745         (Plugin_manager::Rescannable_list): Define type.
746         (Plugin_manager::Undefined_symbol_list): Define type.
747         (Plugin_manager::Plugin_manager): Initialize new fields.
748         * archive.cc (Archive::defines_symbol): New function.
749         (Add_archive_symbols::run): Pass archive to plugins if any.
750         * archive.h (class Archive): Declare defines_symbol.
751         * readsyms.cc (Input_group::~Input_group): New function.
752         (Finish_group::run): Pass input_group to plugins if any.
753         * readsyms.h (class Input_group): Declare destructor.
754         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
755         any.
757 2011-01-10  Ian Lance Taylor  <iant@google.com>
759         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
760         section as relro.
761         (Layout::set_segment_offsets): Reset increase_relro before calling
762         set_section_addresses a second time.
764 2011-01-04  Cary Coutant  <ccoutant@google.com>
766         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
767         sections before NOBITS sections.
769 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
771         * version.cc (print_version): Update copyright to 2011.
773 2010-12-23  Cary Coutant  <ccoutant@google.com>
775         * output.h (Output_data_reloc::add_output_section): Pass OD instead
776         of OS to this->add.  Add OD parameter to second form of the function.
778 2010-12-20  Ian Lance Taylor  <iant@google.com>
780         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
781         second of two consecutive entries with same offset.
783 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
785         * testsuite/Makefile.am (ifuncmain2static_LDADD)
786         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
787         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
788         to avoid unneeded links against $(LDADD).
789         * testsuite/Makefile.in: Regenerate.
791 2010-12-15  Ian Lance Taylor  <iant@google.com>
793         PR gold/12324
794         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
795         for R_X86_64_32 and R_X86_64_PC32.
796         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
797         ver_matching_def_pic.o.
798         (ver_matching_def_pic.o): New target.
800 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
802         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
803         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
804         Move definition before File_read::View member definitions.
805         (File_read::View::~View): Initialize and hold lock before
806         updating current_mapped_bytes.
808 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
810         * dwarf_reader.cc: Remove outdated comment.
811         * gold-threads.cc: Fix typo in error message.
812         * archive.cc: Fix typos in comments.
813         * archive.h: Likewise.
814         * arm-reloc-property.cc: Likewise.
815         * arm-reloc-property.h: Likewise.
816         * arm-reloc.def: Likewise.
817         * arm.cc: Likewise.
818         * attributes.h: Likewise.
819         * cref.cc: Likewise.
820         * ehframe.cc: Likewise.
821         * fileread.h: Likewise.
822         * gold.h: Likewise.
823         * i386.cc: Likewise.
824         * icf.cc: Likewise.
825         * incremental.h: Likewise.
826         * int_encoding.cc: Likewise.
827         * layout.h: Likewise.
828         * main.cc: Likewise.
829         * merge.h: Likewise.
830         * object.cc: Likewise.
831         * object.h: Likewise.
832         * options.cc: Likewise.
833         * readsyms.cc: Likewise.
834         * reduced_debug_output.cc: Likewise.
835         * reloc.cc: Likewise.
836         * script-sections.cc: Likewise.
837         * sparc.cc: Likewise.
838         * symtab.h: Likewise.
839         * target-reloc.h: Likewise.
840         * target.cc: Likewise.
841         * target.h: Likewise.
842         * timer.cc: Likewise.
843         * timer.h: Likewise.
844         * x86_64.cc: Likewise.
846 2010-12-09  Cary Coutant  <ccoutant@google.com>
848         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
849         stack.
850         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
851         parameter; change all callers.
852         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
853         * options.h (warn_execstack): New option.
855 2010-12-07  Doug Kwan  <dougkwan@google.com>
857         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
858         like function call relocations.
860 2010-12-07  Ian Lance Taylor  <iant@google.com>
862         * archive.cc (Archive::get_elf_object_for_member): Permit
863         punconfigured to be NULL.
864         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
865         (Archive::include_member): Pass NULL to get_elf_object_for_member
866         if we searched for the archive and this is the first included
867         object.
869 2010-12-01  Ian Lance Taylor  <iant@google.com>
871         * dwarf_reader.h (class Sized_dwarf_line_info): Add
872         track_relocs_type_ field.
873         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
874         Set track_relocs_type_.
875         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
876         contents when using RELA relocs.
877         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
878         reloc_map_.
879         * reloc.cc (Track_relocs::next_addend): New function.
880         * reloc.h (class Track_relocs): Declare next_addend.
882 2010-12-01  Ian Lance Taylor  <iant@google.com>
884         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
885         virtual destructor.
887 2010-12-01  Ian Lance Taylor  <iant@google.com>
889         * README: Update compilers known to work and fail.
891 2010-11-23  Matthias Klose  <doko@ubuntu.com>
893         * configure.in: For --enable-gold, handle value `default' instead of
894         `both*'.  Always install ld as ld.bfd, install as ld if gold is
895         not the default.
896         * configure: Regenerate.
898 2010-11-18  Doug Kwan  <dougkwan@google.com>
900         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
901         and right_alignment to be zero.  Store result alignment only if it is
902         greater than existing alignment.
904 2010-11-16  Cary Coutant  <ccoutant@google.com>
906         PR gold/12220
907         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
908         Check for ".zdebug_line".
910 2010-11-16  Doug Kwan  <dougkwan@google.com>
911             Cary Coutant  <ccoutant@google.com>
913         * output.h (Output_segment::set_section_addresses): Pass increase_relro
914         by reference; adjust all callers.
915         * output.cc (Output_segment::set_section_addresses): Adjust references
916         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
917         list is empty.
918         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
919         end at page boundary.
921 2010-11-16  Cary Coutant  <ccoutant@google.com>
923         PR gold/12220
924         * layout.cc (Layout::choose_output_section): Transform names of
925         compressed sections even when using a script with a SECTIONS clause.
926         (Layout::output_section_name): Remove code to transform
927         compressed debug section names.
928         * output.cc (Output_section::add_input_section): Use uncompressed
929         section size when tracking input sections.
931 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
933         * symtab.h (Symbol::NON_PIC_REF): Remove.
934         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
935         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
936         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
937         (Symbol::use_plt_offset): Take a flags argument and pass it
938         directly to needs_dynamic_reloc.  Restrict check for undefined
939         weak symbols to function calls.
940         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
941         (Target_arm::Scan::global): Use it.
942         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
943         (Target_arm::Relocate::relocate): Likewise.
944         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
945         parameter with an r_type parameter.  Use get_reference_flags
946         to get the flags.
947         (Target_arm::Relocate::relocate): Update accordingly.
948         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
949         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
950         (Target_i386::Scan::global): Likewise.
951         (Target_i386::Relocate::relocate): Likewise.
952         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
953         parameter with an r_type parameter.  Use get_reference_flags
954         to get the flags.
955         (Target_i386::Relocate::relocate): Update accordingly.
956         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
957         (Target_powerpc::Scan::global): Use it.
958         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
959         (Target_powerpc::Relocate::relocate): Likewise.
960         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
961         (Target_sparc::Scan::global): Use it.
962         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
963         (Target_sparc::Relocate::relocate): Likewise.
964         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
965         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
966         (Target_x86_64::Scan::global): Likewise.
967         (Target_x86_64::Relocate::relocate): Likewise.
969 2010-11-08  Doug Kwan  <dougkwan@google.com>
970             Cary Coutant  <ccoutant@google.com>
972         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
973         (Arm_exidx_merge_section::section_contents_): New data member.
974         (Arm_input_section::Arm_input_section): Initialize original_contents_.
975         (Arm_input_section::~Arm_input_section): De-allocate memory.
976         (Arm_input_section::original_contents_): New data member.       
977         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
978         in parameters instead of calling Object::section_contents without
979         locking.
980         (Arm_output_section::group_section): New parameter TASK.  Pass it
981         to callees that need locking objects.
982         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
983         to lock EXIDX input sections.  Fix a formatting issue.  Call
984         Arm_exidx_merged_section::build_contents to create merged section
985         contents.
986         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
987         to lock object of stub table owner.
988         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
989         TEXT_SIZE to initialize data member TEXT_SIZE_.
990         (Arm_exidx_input_section::addralign): Fix typo in comment.
991         (Arm_exidx_input_section::text_size): New method.
992         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
993         that require locking objects.  Lock objects before scanning for stubs
994         and updating local symbols.
995         (Arm_input_section<big_endian>::init): Copy contents of original
996         input section.
997         (Arm_input_section<big_endian>::do_write): Use saved contents of
998         original input section instead of calling Object::section_contents
999         without locking.
1000         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1001         size without calling Object::section_size().
1002         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1003         for size.  Allocate a buffer for merged EXIDX entries.
1004         (Arm_exidx_merged_section::build_contents): New method.
1005         (Arm_exidx_merged_section::do_write): Move merge section contents
1006         building code to Arm_exidx_merged_section::build_contetns.  Write
1007         out contetns in buffer instead of building it on the fly.
1008         (Arm_relobj::make_exidx_input_section): Also pass text section size
1009         to Arm_exidx_input_section constructor.
1010         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
1011         (Arm_dynobj::do_read_symbols): Fix memory leak.
1012         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1013         * target.h: (class Task): Add forward declaration.
1014         (Target::relax): Add new parameter TASK and pass it to
1015         Target::do_relax().
1016         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
1018 2010-11-05  Cary Coutant  <ccoutant@google.com>
1020         PR gold/10708
1021         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1022         object when reading from the file.
1023         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1024         second layout pass.
1025         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1026         when reading section contents.
1027         (get_section_contents): Likewise.
1028         (icf::find_identical_sections): Likewise.
1029         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1030         object when reading from the file.
1031         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1032         the object when doing deferred section layout.
1034 2010-11-03  Nick Clifton  <nickc@redhat.com>
1036         PR gold/12001
1037         * script.h (class Symbol_assignment: name): New member.  Returns
1038         the name of the symbol.
1039         * scrfipt.cc (Script_options::is_pending_assignment): New member.
1040         Returns true if the given symbol name is on the list of
1041         assignments wating to be processed.
1042         * archive.cc (should_incldue_member): If the symbol is undefined,
1043         check to see if it is on the list of symbols pending assignment.
1045 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
1047         * script-sections.cc (Script_sections::find_memory_region): Check
1048         for a NULL output section pointer.
1050 2010-10-29  Doug Kwan  <dougkwan@google.com>
1052         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
1053         Output_section::add_relaxed_input_section.
1054         * output.cc (Output_section::add_relaxed_input_section): Add new
1055         arguments LAYOUT and NAME.  Set section order index.
1056         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1057         Copy section order index.
1058         * output.h (Output_section::add_relaxed_input_section): Add new
1059         arguments LAYOUT and NAME.
1061 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1063         * testsuite/Makefile.am: Move gcctestdir/ld rule to
1064         NATIVE_OR_CROSS_LINKER.
1065         * testsuite/Makefile.in: Regenerate.
1067 2010-10-20  Doug Kwan  <dougkwan@google.com>
1069         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
1070         without SHF_LINK_ORDER flags.
1071         * layout.cc (Layout::choose_output_section): Do not filter
1072         SHF_LINK_ORDER flag in a relocatable link.
1074 2010-10-17  Cary Coutant  <ccoutant@google.com>
1076         * output.h (Output_segment::set_section_addresses): Change function
1077         signature.  Update all callers.
1078         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
1079         sections.
1080         (Output_segment::set_section_addresses): Align after last TLS
1081         section.  Add padding before last relro section instead of after.
1083 2010-10-17  Doug Kwan  <dougkwan@google.com>
1085         * gold/arm.cc (Target_arm::got_section): Use correct order and set
1086         GOT output section to be writable.
1088 2010-10-14  Cary Coutant  <ccoutant@google.com>
1090         * debug.h (DEBUG_INCREMENTAL): New flag.
1091         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
1092         * gold.cc (queue_initial_tasks): Check parameters for incremental link
1093         mode.
1094         * incremental.cc (report_command_line): Ignore all forms of
1095         --incremental.
1096         * layout.cc (Layout::Layout): Check parameters for incremental link
1097         mode.
1098         * options.cc (General_options::parse_incremental): New function.
1099         (General_options::parse_no_incremental): New function.
1100         (General_options::parse_incremental_full): New function.
1101         (General_options::parse_incremental_update): New function.
1102         (General_options::incremental_mode_): New data member.
1103         (General_options::finalize): Check incremental_mode_.
1104         * options.h (General_options): Update help text for --incremental.
1105         Add --no-incremental, --incremental-full, --incremental-update.
1106         (General_options::Incremental_mode): New enum type.
1107         (General_options::incremental_mode): New function.
1108         (General_options::incremental_mode_): New data member.
1109         * parameters.cc (Parameters::incremental_mode_): New data member.
1110         (Parameters::set_options): Set incremental_mode_.
1111         (Parameters::set_incremental_full): New function.
1112         (Parameters::incremental): New function.
1113         (Parameters::incremental_update): New function.
1114         (set_parameters_incremental_full): New function.
1115         * parameters.h (Parameters::set_incremental_full): New function.
1116         (Parameters::incremental): New function.
1117         (Parameters::incremental_update): New function.
1118         (Parameters::incremental_mode_): New data member.
1119         (set_parameters_incremental_full): New function.
1120         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
1121         incremental link mode.
1122         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
1123         (Sized_relobj::do_relocate_sections): Likewise.
1124         * testsuite/Makefile.am (incremental_test): Use --incremental-full
1125         option.
1126         * testsuite/Makefile.in: Regenerate.
1127         * testsuite/incremental_test.sh: Filter all forms of --incremental.
1129 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1131         * script-sections.h (class Script_sections): Make
1132         Sections_elements typedef public.
1133         * script-sections.cc (class Sort_output_sections): Add elements_
1134         field.  Add constructor which sets it; change all callers.
1135         (Sort_output_sections::is_before): New function.
1136         (Sort_output_sections::operator()): Call is_before.
1137         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
1138         conditional.
1139         * testsuite/script_test_10.sh: New test. Test script section
1140         order.
1141         * testsuite/script_test_10.t: Likewise.
1142         * testsuite/script_test_10.s: Likewise.
1143         * testsuite/Makefile.am: Wrap the cross linker tests and the
1144         common tests into NATIVE_OR_CROSS_LINKER.
1145         (check_SCRIPTS): Add script_test_10.sh.
1146         (check_DATA): Add script_test_10.stdout.
1147         (script_test_10.o, script_test_10): New targets.
1148         (script_test_10.stdout): New target.
1149         * configure, testsuite/Makefile.in: Regenerate.
1151 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1153         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
1154         error for the deprecated relocations.
1155         (Target_arm::Scan::global): Likewise.
1156         (Target_arm::Relocate::relocate): Likewise.
1158 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
1160         * fileread.cc (Input_file::find_file): Initialize *found_name
1161         and *namep when using the fallback search for case 4.
1163 2010-10-11  Cary Coutant  <ccoutant@google.com>
1165         * options.h (class General_options): Redefine -z lazy as an alias for
1166         the negation of -z now.
1168 2010-10-11  Ian Lance Taylor  <iant@google.com>
1170         * resolve.cc (symbol_to_bits): Report the value of the unsupported
1171         binding.
1173 2010-10-06  Nick Clifton  <nickc@redhat.com>
1175         * script-sections.cc(class Memory_region): Remove
1176         current_lma_offset_ field.  Rename current_vma_offset_ to
1177         current_offset_.  Add last_section_ field.
1178         (Memory_region::get_current_vma_address): Rename to
1179         get_current_address.
1180         (Memory_region::get_current_lma_address): Delete.
1181         (Memory_region::increment_vma_offset): Rename to
1182         increment_offset.
1183         (Memory_region::increment_lma_offset): Delete.
1184         (Memory_region::attributes_compatible): New method.  Returns
1185         true if the provided section is compatible with the region.
1186         (Memory_region::get_last_section): New method.  Returns the last
1187         section to use the region.
1188         (Memory_region::set_last_section): New method.  Stores the last
1189         section to use the region.
1190         (Script_sections::block_in_region): New method.  Returns true if
1191         a block of memory is contained within a region.
1192         (Script_sections::find_memory_region): New method.  Locates a
1193         memory region to be used to set a VMA or LMA address.
1194         (Output_section_definition::set_section_addresses): Add code to
1195         check for addresses set by memory regions.
1196         (Output_segment::set_section_addresses): Remove memory region
1197         walking code.
1198         (Script_sections::create_segment): Add a warning if a header
1199         segment is created outside of any region.
1200         * script-sections.h (class Script_sections): Add prototypes for
1201         find_memory_region and block_in_region methods.
1202         * testsuite/memory_test.s: Use .long instead of .word.
1203         * testsuite/memory_test.t: Add some more output sections.
1204         * testsuite/memory_test.sh: Update expected output.
1206 2010-10-02  Doug Kwan  <dougkwan@google.com>
1208         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
1209         defintion to symtab.h
1210         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
1211         declaration to defintion.
1213 2010-10-01  Nick Clifton  <nickc@redhat.com>
1215         * expression.cc (eval): Replace dummy argument with NULL.
1216         (eval_maybe_dot): Check for a NULL result section pointer.
1217         (Symbol_expression::value): Likewise.
1218         (Dot_expression::value): Likewise.
1219         (BINARY_EXPRESSION): Likewise.
1220         (Max_expression::value): Likewise.
1221         (Min_expression::value): Likewise.
1222         (Absolute_expression::value): Likewise.
1223         (Addr_expression::value_from_output_section): Likewise.
1224         (Loaddddr_expression::value_from_output_section): Likewise.
1225         (Segment_start_expression::value): Likewise.
1226         * script-sections.cc
1227         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
1228         argument with NULL.
1229         (Sections_elememt_dot_assignment::set_section_addresses):
1230         Likewise.
1231         (Output_data_expression::do_write_to_buffer): Likewise.
1232         (Output_section_definition::finalize_symbols): Likewise.
1233         (Output_section_definition::set_section_addresses): Likewise.
1235 2010-09-30  Doug Kwan  <dougkwan@google.com>
1237         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
1239 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
1241         * target.h (Target::can_icf_inline_merge_sections): New virtual
1242         function.
1243         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
1244         virtual function.
1245         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
1246         virtual function.
1247         * icf.cc (get_section_contents): Inline merge sections only when
1248         target allows it.
1250 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1252         * configure: Regenerate.
1254 2010-09-17  Ian Lance Taylor  <iant@google.com>
1256         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
1257         * testsuite/Makefile.am (memory_test.o): New target.
1258         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
1259         memory_test.t.
1260         * testsuite/Makefile.in: Rebuild.
1262 2010-09-17  Doug Kwan  <dougkwan@google.com>
1264         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
1265         defintion if relocation uses GOT entries of the symbol.
1266         * testsuite/icf_safe_test.sh: Fix test.
1267         * testsuite/icf_safe_so_test.sh: Fix test.
1269 2010-09-16  Cary Coutant  <ccoutant@google.com>
1271         * script_sections.cc (class Memory_region): Remove "NULL" from
1272         vector initializations.
1274 2010-09-15  Cary Coutant  <ccoutant@google.com>
1276         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
1277         Resolve forwarding symbols.
1279 2010-09-15  Doug Kwan  <dougkwan@google.com>
1281         * gold/testsuite/script_test_3.t: Add ARM special sections.
1282         * gold/testsuite/script_test_4.t: Same.
1283         * gold/testsuite/script_test_5.t: Same.
1284         * gold/testsuite/script_test_6.t: Same.
1285         * gold/testsuite/script_test_7.t: Same.
1286         * gold/testsuite/script_test_7.t: Same.
1287         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
1289 2010-09-14  Cary Coutant  <ccoutant@google.com>
1291         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
1292         (Target_x86_64::Relocate::relocate_tls): Replace check for
1293         saw_tls_block_reloc_ with test for executable section.
1295 2010-09-12  Cary Coutant  <ccoutant@google.com>
1297         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
1298         position-independent executables to shared libraries need dynamic
1299         relocations.
1300         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
1301         position-independent executables.
1302         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
1303         * testsuite/Makefile.in: Regenerate.
1305 2010-09-10  Nick Clifton  <nickc@redhat.com>
1307         PR gold/11997
1308         * testsuite/memory_test.t: Discard any sections that are not
1309         needed.
1311 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
1313         PR gold/11996
1314         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
1315         "This::" to work around a bug in gcc 4.2.
1317         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
1319 2010-09-09  Rafael Espindola  <espindola@google.com>
1321         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
1322         sections with different PF_X flags in the same segment.
1323         (Layout::find_first_load_seg): Search all segments to find the first
1324         one.
1325         * options.h (rosegment): New.
1327 2010-09-08  Rafael Espindola  <espindola@google.com>
1329         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
1331 2010-09-08  Doug Kwan  <dougkwan@google.com>
1333         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
1334         (Arm_relobj::do_relocate_sections): Add new parameter for output
1335         file to match the parent.
1336         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
1337         of local symbols instead of input values.  Update code to track
1338         changes in gold::relocate_section.
1339         * object.cc (Sized_relobj::compute_final_local_value): New methods.
1340         (Sized_relobj::compute_final_local_value_internal): New methods.
1341         (Sized_relobj::do_finalize_local_symbols): Move code from loop
1342         body into private version of Sized_relobj::compute_final_local_value.
1343         Call the inline method.
1344         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
1345         merged symbol value if there is one.
1346         (Symbol_value::has_output_value): New method defintiion.
1347         (Sized_relobj::Compute_final_local_value_status): New enum type.
1348         (Sized_relobj::compute_final_local_value): New methods.
1349         (Sized_relobj::compute_final_local_value_internal): New methods.
1350         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
1351         and arm_cortex_a8.sh.
1352         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
1353         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
1354         New tests.
1355         * Makefile.in: Regenerate.
1356         * testsuite/arm_bl_out_of_range.s: Update test.
1357         * testsuite/thumb_bl_out_of_range.s: Ditto.
1358         * testsuite/thumb_blx_out_of_range.s: Ditto.
1359         * testsuite/arm_branch_out_of_range.sh: New file.
1360         * testsuite/arm_cortex_a8.sh: Ditto.
1361         * testsuite/arm_cortex_a8_b.s: Ditto.
1362         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
1363         * testsuite/arm_cortex_a8_b_local.s: Ditto.
1364         * testsuite/arm_cortex_a8_bl.s: Ditto.
1365         * testsuite/arm_cortex_a8_blx.s: Ditto.
1366         * testsuite/arm_cortex_a8_local.s: Ditto.
1367         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
1368         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
1370 2010-09-08  Rafael Espindola  <espindola@google.com>
1372         * Makefile.am (memory_test.stdout): Run readelf with -W.
1373         * Makefile.in: Regenerate.
1374         * testsuite/memory_test.sh: Make the regexps accept both 32 and
1375         64 bit output.
1377 2010-09-08  Rafael Espindola  <espindola@google.com>
1379         * script-sections.cc (Script_sections::add_memory_region): Convert
1380         field precision to int.
1381         * script.cc (script_set_section_region, script_set_section_region):
1382         Convert field precision to int.
1384 2010-09-08  Rafael Espindola  <espindola@google.com>
1386         * arm.cc (do_finalize_sections): Create the __exidx_start and
1387         __exdix_end symbols even when the section is missing.
1389 2010-09-08  Nick Clifton  <nickc@redhat.com>
1391         * README: Remove claim that MEMORY is not supported.
1392         * expression.cc (script_exp_function_origin)
1393         (script_exp_function_length): Move from here to ...
1394         * script.cc: ... here.
1395         (script_set_section_region, script_add_memory)
1396         (script_parse_memory_attr, script_include_directive): New
1397         functions.
1398         * script-sections.cc
1399         (class Memory_region): New class.
1400         (class Output_section_definition): Add set_memory_region,
1401         set_section_vma, set_section_lma and get_section_name methods.
1402         (class Script_Sections): Add add_memory_region,
1403         find_memory_region, find_memory_region_origin,
1404         find_memory_region_length and set_memory_region methods.
1405         Have set_section_addresses method walk the list of set memory
1406         regions.
1407         Extend the print methos to display memory regions.
1408         * script-sections.h: Add prototypes for new methods.
1409         Add enum for MEMORY region attributes.
1410         * yyscript.y: Add support for parsing MEMORY regions.
1411         * script-c.h: Add prototypes for new functions.
1412         * testsuite/Makefile.am: Add test of MEMORY region functionality.
1413         * testsuite/Makefile.in: Regenerate.
1414         * testsuite/memory_test.sh: New script.
1415         * testsuite/memory_test.s: New assembler source file.
1416         * testsuite/memory_test.t: New linker script.
1418 2010-08-27  Doug Kwan  <dougkwan@google.com>
1420         * gold/resolve.cc (Symbol_table::should_override): Let a weak
1421         reference override an existing dynamic weak reference.
1422         * testsuite/Makefile.am: Add new test dyn_weak_ref.
1423         * testsuite/Makefile.in: Regenerate.
1424         * testsuite/dyn_weak_ref.sh: New file.
1425         * testsuite/dyn_weak_ref_1.c: Ditto.
1426         * testsuite/dyn_weak_ref_2.c: Ditto.
1428 2010-08-27  Ian Lance Taylor  <iant@google.com>
1430         * incremental.h (class Incremental_input_entry): Add virtual
1431         destructor.
1433 2010-08-27  Ian Lance Taylor  <iant@google.com>
1435         * testsuite/start_lib_test_3.c: Mark t3 as used.
1437 2010-08-27  Nick Clifton  <nickc@redhat.com>
1439         * options.cc (version_script): Fix small typo in previous
1440         whitespace tidyup.
1442 2010-08-25  Nick Clifton  <nickc@redhat.com>
1444         * archive.cc: Formatting fixes: Remove whitespace between
1445         typename and following asterisk.  Remove whitespace between
1446         function name and opening parenthesis.
1447         * archive.h: Likewise.
1448         * arm.cc: Likewise.
1449         * attributes.cc: Likewise.
1450         * attributes.h: Likewise.
1451         * common.cc: Likewise.
1452         * copy-relocs.cc: Likewise.
1453         * dirsearch.h: Likewise.
1454         * dynobj.cc: Likewise.
1455         * ehframe.cc: Likewise.
1456         * ehframe.h: Likewise.
1457         * expression.cc: Likewise.
1458         * fileread.cc: Likewise.
1459         * fileread.h: Likewise.
1460         * gc.h: Likewise.
1461         * gold-threads.cc: Likewise.
1462         * gold.cc: Likewise.
1463         * i386.cc: Likewise.
1464         * icf.h: Likewise.
1465         * incremental-dump.cc: Likewise.
1466         * incremental.cc: Likewise.
1467         * layout.cc: Likewise.
1468         * layout.h: Likewise.
1469         * main.cc: Likewise.
1470         * merge.cc: Likewise.
1471         * merge.h: Likewise.
1472         * object.cc: Likewise.
1473         * object.h: Likewise.
1474         * options.cc: Likewise.
1475         * options.h: Likewise.
1476         * output.cc: Likewise.
1477         * output.h: Likewise.
1478         * plugin.cc: Likewise.
1479         * plugin.h: Likewise.
1480         * powerpc.cc: Likewise.
1481         * reloc.cc: Likewise.
1482         * script-c.h: Likewise.
1483         * script-sections.cc: Likewise.
1484         * script.cc: Likewise.
1485         * stringpool.cc: Likewise.
1486         * symtab.cc: Likewise.
1487         * symtab.h: Likewise.
1488         * target.cc: Likewise.
1489         * timer.cc: Likewise.
1490         * timer.h: Likewise.
1491         * version.cc: Likewise.
1492         * x86_64.cc: Likewise.
1494 2010-08-24  Nick Clifton  <nickc@redhat.com>
1496         PR 11899
1497         * layout.cc (segment_precedes): Sort segments by their physical
1498         addresses, if they have been set.
1500 2010-08-23  Cary Coutant  <ccoutant@google.com>
1502         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
1503         symbols data.
1504         (Lib_group::include_member): Unlock object after deleting its
1505         symbols data.
1506         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
1507         the bug fixed here.
1509 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
1510             Cary Coutant  <ccoutant@google.com>
1512         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
1513         constructor, and set_blocker.
1514         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
1515         readsyms_blocker_.
1516         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
1517         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
1518         * testsuite/Makefile.am (start_lib_test): New test case.
1519         * testsuite/Makefile.in: Regenerate.
1520         * testsuite/start_lib_test_main.c: New file.
1521         * testsuite/start_lib_test_1.c: New file.
1522         * testsuite/start_lib_test_2.c: New file.
1523         * testsuite/start_lib_test_3.c: New file.
1525 2010-08-19  Ian Lance Taylor  <iant@google.com>
1527         * Makefile.in: Rebuild with automake 1.11.1.
1528         * aclocal.m4: Likewise.
1529         * testsuite/Makefile.in: Likewise.
1531 2010-08-19  Ian Lance Taylor  <iant@google.com>
1533         PR 10893
1534         * i386.cc (class Output_data_plt_i386): Update declarations.
1535         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
1536         local_ifuncs_ fields.
1537         (Target_i386::do_plt_section_for_global): New function.
1538         (Target_i386::do_plt_section_for_local): New function.
1539         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
1540         parameter; change all callers.  Initialize global_ifuncs_ and
1541         local_ifuncs_.  If doing a static link define __rel_iplt_start and
1542         __rel_iplt_end.
1543         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
1544         (Output_data_plt_i386::add_local_ifunc_entry): New function.
1545         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
1546         symbols.
1547         (Target_i386::make_plt_section): New function, broken out of
1548         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
1549         (Target_i386::make_plt_entry): Call make_plt_section.
1550         (Target_i386::make_local_ifunc_plt_entry): New function.
1551         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
1552         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
1553         R_386_IRELATIVE to switch.
1554         (Target_i386::Scan::global): Likewise.
1555         (Target_i386::Relocate::relocate): Likewise.
1556         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
1557         switch.
1558         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
1559         (Target_x86_64::do_plt_section_for_global): New function.
1560         (Target_x86_64::do_plt_section_for_local): New function.
1561         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
1562         parameter; change all callers.  If doing a static link define
1563         __rela_iplt_start and __rela_iplt_end.
1564         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
1565         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
1566         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
1567         to point to .plt.
1568         (Target_x86_64::make_local_ifunc_plt_entry): New function.
1569         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
1570         switch.
1571         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
1572         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
1573         R_X86_64_IRELATIVE to switch.
1574         (Target_x86_64::Scan::global): Likewise.
1575         (Target_x86_64::Relocate::relocate): Likewise.
1576         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
1577         switch.
1578         * target.h (class Target): Add plt_section_for_global and
1579         plt_section_for_local functions.  Add do_plt_section_for_global
1580         and do_plt_section_for_local virtual functions.
1581         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
1582         clarifying comments.
1583         (Symbol::use_plt_offset): Handle IFUNC symbol.
1584         * object.cc (Sized_relobj::Sized_relobj): Initialize
1585         local_plt_offsets_.
1586         (Sized_relobj::local_has_plt_offset): New function.
1587         (Sized_relobj::local_plt_offset): New function.
1588         (Sized_relobj::set_local_plt_offset): New function.
1589         (Sized_relobj::do_count): Handle IFUNC symbol.
1590         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
1591         a bit away from input_shndx_ field.  Add set_is_func_symbol and
1592         is_ifunc_symbol functions.
1593         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
1594         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
1595         local_plt_offsets_ field.
1596         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
1597         * output.h (class Output_section_data): Add non-const
1598         output_section function.
1599         (class Output_data_got): Update declarations.
1600         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
1601         Add use_plt_offset parameter to global and local constructors.
1602         Change all callers.  Change local_sym_index_ field to 31 bits.
1603         Change GSYM_CODE and CONSTANT_CODE accordingly.
1604         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
1605         doing a static link don't set sh_link field.
1606         (Output_data_got::Got_entry::write): Use PLT offset if
1607         appropriate.
1608         (Output_data_got::add_global_plt): New function.
1609         (Output_data_got::add_local_plt): New function.
1610         * target-reloc.h (relocate_section): Handle IFUNC symbol.
1611         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
1612         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
1613         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
1614         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
1615         IFUNC conditional.
1616         * testsuite/ifunc-sel.h: New file.
1617         * testsuite/ifuncmain1.c: New file.
1618         * testsuite/ifuncmain1vis.c: New file.
1619         * testsuite/ifuncmod1.c: New file.
1620         * testsuite/ifuncdep2.c: New file.
1621         * testsuite/ifuncmain2.c: New file.
1622         * testsuite/ifuncmain3.c: New file.
1623         * testsuite/ifuncmod3.c: New file.
1624         * testsuite/ifuncmain4.c: New file.
1625         * testsuite/ifuncmain5.c: New file.
1626         * testsuite/ifuncmod5.c: New file.
1627         * testsuite/ifuncmain6pie.c: New file.
1628         * testsuite/ifuncmod6.c: New file.
1629         * testsuite/ifuncmain7.c: New file.
1630         * configure, testsuite/Makefile.in: Rebuild.
1632 2010-08-18  Ian Lance Taylor  <iant@google.com>
1634         * incremental.cc
1635         (Output_section_incremental_inputs::write_input_files): Add cast
1636         to avoid signed/unsigned comparison warning.
1637         (Output_section_incremental_inputs::write_info_blocks): Likewise.
1639 2010-08-12  Cary Coutant  <ccoutant@google.com>
1641         * common.cc (Sort_commons::operator()): Remove unnecessary code.
1643 2010-08-13  Ian Lance Taylor  <iant@google.com>
1645         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
1647 2010-08-12  Cary Coutant  <ccoutant@google.com>
1648             Doug Kwan  <dougkwan@google.com>
1650         * resolve.cc (Symbol_table::should_override): When a weak dynamic
1651         defintion overrides non-weak undef, remember that the original undef
1652         is not weak.
1653         * symtab.cc (Symbol_table::sized_write_global): For undef without
1654         an original weak binding, set binding to global in output.
1655         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
1656         * testsuite/Makefile.in: Regenerate.
1657         * testsuite/strong_ref_weak_def.sh: New file.
1658         * testsuite/strong_ref_weak_def_1.c: Ditto.
1659         * testsuite/strong_ref_weak_def_2.c: Ditto.
1661 2010-08-12  Cary Coutant  <ccoutant@google.com>
1663         * testsuite/incremental_test.sh: Rewrite.
1664         * testsuite/incremental_test_1.c: Rewrite.
1665         * testsuite/incremental_test_2.c: Rewrite.
1667 2010-08-12  Cary Coutant  <ccoutant@google.com>
1669         * arm.cc (Target_arm::got_size): Add const.
1670         (Target_arm::got_entry_count): New function.
1671         (Target_arm::plt_entry_count): New function.
1672         (Target_arm::first_plt_entry_offset): New function.
1673         (Target_arm::plt_entry_size): New function.
1674         (Output_data_plt_arm::entry_count): New function.
1675         (Output_data_plt_arm::first_plt_entry_offset): New function.
1676         (Output_data_plt_arm::get_plt_entry_size): New function.
1677         * i386.cc (Target_i386::got_size): Add const.
1678         (Target_i386::got_entry_count): New function.
1679         (Target_i386::plt_entry_count): New function.
1680         (Target_i386::first_plt_entry_offset): New function.
1681         (Target_i386::plt_entry_size): New function.
1682         (Output_data_plt_i386::entry_count): New function.
1683         (Output_data_plt_i386::first_plt_entry_offset): New function.
1684         (Output_data_plt_i386::get_plt_entry_size): New function.
1685         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
1686         find_incremental_inputs_sections.  Dump incremental_got_plt section.
1687         * incremental.cc: Include target.h.
1688         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
1689         parameter.  Adjust all callers.  Find incremental_got_plt section.
1690         (Incremental_inputs::create_data_sections): Create incremental_got_plt
1691         section.
1692         (Output_section_incremental_inputs::set_final_data_size): Calculate
1693         size of incremental_got_plt section.
1694         (Output_section_incremental_inputs::do_write): Write the
1695         incremental_got_plt section.
1696         (Got_plt_view_info): New struct.
1697         (Local_got_offset_visitor): New class.
1698         (Global_got_offset_visitor): New class.
1699         (Global_symbol_visitor_got_plt): New class.
1700         (Output_section_incremental_inputs::write_got_plt): New function.
1701         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
1702         Add parameter.  Adjust all callers.
1703         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1704         (Incremental_inputs::got_plt_section): New function.
1705         (Incremental_inputs::got_plt_section_): New data member.
1706         (Incremental_got_plt_reader): New class.
1707         * layout.cc (Layout::create_incremental_info_sections): Add the
1708         incremental_got_plt section.
1709         * object.h (Got_offset_list::get_list): New function.
1710         (Got offset_list::for_all_got_offsets): New function.
1711         (Sized_relobj::local_got_offset_list): New function.
1712         * powerpc.cc (Target_powerpc::got_size): Add const.
1713         (Target_powerpc::got_entry_count): New function.
1714         (Target_powerpc::plt_entry_count): New function.
1715         (Target_powerpc::first_plt_entry_offset): New function.
1716         (Target_powerpc::plt_entry_size): New function.
1717         (Output_data_plt_powerpc::entry_count): New function.
1718         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
1719         (Output_data_plt_powerpc::get_plt_entry_size): New function.
1720         * sparc.cc (Target_sparc::got_size): Add const.
1721         (Target_sparc::got_entry_count): New function.
1722         (Target_sparc::plt_entry_count): New function.
1723         (Target_sparc::first_plt_entry_offset): New function.
1724         (Target_sparc::plt_entry_size): New function.
1725         (Output_data_plt_sparc::entry_count): New function.
1726         (Output_data_plt_sparc::first_plt_entry_offset): New function.
1727         (Output_data_plt_sparc::get_plt_entry_size): New function.
1728         * symtab.h (Symbol::got_offset_list): New function.
1729         (Symbol_table::for_all_symbols): New function.
1730         * target.h (Sized_target::got_entry_count): New function.
1731         (Sized_target::plt_entry_count): New function.
1732         (Sized_target::plt_entry_size): New function.
1733         * x86_64.cc (Target_x86_64::got_size): Add const.
1734         (Target_x86_64::got_entry_count): New function.
1735         (Target_x86_64::plt_entry_count): New function.
1736         (Target_x86_64::first_plt_entry_offset): New function.
1737         (Target_x86_64::plt_entry_size): New function.
1738         (Output_data_plt_x86_64::entry_count): New function.
1739         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
1740         (Output_data_plt_x86_64::get_plt_entry_size): New function.
1742 2010-08-12  Cary Coutant  <ccoutant@google.com>
1744         * archive.cc: Include incremental.h.
1745         (Archive::Archive): Initialize incremental_info_.
1746         (Archive::include_member): Record archive members in incremental info.
1747         (Add_archive_symbols::run): Record begin and end of an archive in
1748         incremental info.
1749         (Lib_group::include_member): Record objects in incremental info.
1750         * archive.h (Incremental_archive_entry): Forward declaration.
1751         (Archive::set_incremental_info): New member function.
1752         (Archive::incremental_info): New member function.
1753         (Archive::Unused_symbol_iterator): New class.
1754         (Archive::unused_symbols_begin): New member function.
1755         (Archive::unused_symbols_end): New member function.
1756         (Archive::incremental_info_): New data member.
1757         * incremental-dump.cc (find_input_containing_global): New function.
1758         (dump_incremental_inputs): Dump new incremental info sections.
1759         * incremental.cc: Include symtab.h.
1760         (Output_section_incremental_inputs): New class.
1761         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
1762         new incremental info sections.
1763         (Sized_incremental_binary::do_check_inputs): Likewise.
1764         (Incremental_inputs::report_archive): Remove.
1765         (Incremental_inputs::report_archive_begin): New function.
1766         (Incremental_inputs::report_archive_end): New function.
1767         (Incremental_inputs::report_object): New function.
1768         (Incremental_inputs::finalize_inputs): Remove.
1769         (Incremental_inputs::report_input_section): New function.
1770         (Incremental_inputs::report_script): Rewrite.
1771         (Incremental_inputs::finalize): Do nothing but finalize string table.
1772         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1773         (Incremental_inputs::sized_create_inputs_section_data): Remove.
1774         (Incremental_inputs::create_data_sections): New function.
1775         (Incremental_inputs::relocs_entsize): New function.
1776         (Output_section_incremental_inputs::set_final_data_size): New function.
1777         (Output_section_incremental_inputs::do_write): New function.
1778         (Output_section_incremental_inputs::write_header): New function.
1779         (Output_section_incremental_inputs::write_input_files): New function.
1780         (Output_section_incremental_inputs::write_info_blocks): New function.
1781         (Output_section_incremental_inputs::write_symtab): New function.
1782         * incremental.h (Incremental_script_entry): Forward declaration.
1783         (Incremental_object_entry): Forward declaration.
1784         (Incremental_archive_entry): Forward declaration.
1785         (Incremental_inputs): Forward declaration.
1786         (Incremental_inputs_header_data): Remove.
1787         (Incremental_inputs_header): Remove.
1788         (Incremental_inputs_header_write): Remove.
1789         (Incremental_inputs_entry_data): Remove.
1790         (Incremental_inputs_entry): Remove.
1791         (Incremental_inputs_entry_write): Remove.
1792         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
1793         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
1794         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
1795         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
1796         Likewise.
1797         (Incremental_input_entry): New class.
1798         (Incremental_script_entry): New class.
1799         (Incremental_object_entry): New class.
1800         (Incremental_archive_entry): New class.
1801         (Incremental_inputs::Incremental_inputs): Initialize new data members.
1802         (Incremental_inputs::report_inputs): Remove.
1803         (Incremental_inputs::report_archive): Remove.
1804         (Incremental_inputs::report_archive_begin): New function.
1805         (Incremental_inputs::report_archive_end): New function.
1806         (Incremental_inputs::report_object): Change prototype.
1807         (Incremental_inputs::report_input_section): New function.
1808         (Incremental_inputs::report_script): Change prototype.
1809         (Incremental_inputs::get_reloc_count): New function.
1810         (Incremental_inputs::set_reloc_count): New function.
1811         (Incremental_inputs::create_data_sections): New function.
1812         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
1813         (Incremental_inputs::inputs_section): New function.
1814         (Incremental_inputs::symtab_section): New function.
1815         (Incremental_inputs::relocs_section): New function.
1816         (Incremental_inputs::get_stringpool): Add const.
1817         (Incremental_inputs::command_line): Add const.
1818         (Incremental_inputs::inputs): Remove.
1819         (Incremental_inputs::command_line_key): New function.
1820         (Incremental_inputs::input_file_count): New function.
1821         (Incremental_inputs::input_files): New function.
1822         (Incremental_inputs::relocs_entsize): New function.
1823         (Incremental_inputs::sized_create_inputs_section_data): Remove.
1824         (Incremental_inputs::finalize_inputs): Remove.
1825         (Incremental_inputs::Input_info): Remove.
1826         (Incremental_inputs::lock_): Remove.
1827         (Incremental_inputs::inputs_): Change type.
1828         (Incremental_inputs::inputs_map_): Remove.
1829         (Incremental_inputs::current_object_entry_): New data member.
1830         (Incremental_inputs::inputs_section_): New data member.
1831         (Incremental_inputs::symtab_section_): New data member.
1832         (Incremental_inputs::relocs_section_): New data member.
1833         (Incremental_inputs::reloc_count_): New data member.
1834         (Incremental_inputs_reader): New class.
1835         (Incremental_symtab_reader): New class.
1836         (Incremental_relocs_reader): New class.
1837         * layout.cc (Layout::finalize): Move finalization of incremental info
1838         and creation of incremental info sections to follow finalization of
1839         symbol table.  Set offsets for postprocessing sections.
1840         (Layout::create_incremental_info_sections): Call
1841         Incremental_inputs::create_data_sections.  Add incremental symtab
1842         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
1843         sections to layout after input sections.
1844         * layout.h (struct Timespec): Forward declaration.
1845         (Layout::incremental_inputs): Add const.
1846         (Layout::create_incremental_info_sections): Add parameter.
1847         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
1848         * object.cc: Include incremental.h.
1849         (Relobj::finalize_incremental_relocs): New function.
1850         (Sized_relobj::do_layout): Record input sections in incremental info.
1851         * object.h (Object::output_section): New function.
1852         (Object::output_section_offset): Moved from Relobj.
1853         (Object::get_incremental_reloc_base): New function.
1854         (Object::get_incremental_reloc_count): New function.
1855         (Object::do_output_section): New function.
1856         (Object::do_output_section_offset): Moved from Relobj.
1857         (Object::do_get_incremental_reloc_base): New function.
1858         (Object::do_get_incremental_reloc_count): New function.
1859         (Object::Object): Initialize new data members.
1860         (Relobj::output_section): Renamed do_output_section and moved to
1861         protected.
1862         (Relobj::output_section_offset): Moved to Object.
1863         (Relobj::do_get_incremental_reloc_base): New function.
1864         (Relobj::do_get_incremental_reloc_count): New function.
1865         (Relobj::allocate_incremental_reloc_counts): New function.
1866         (Relobj::count_incremental_reloc): New function.
1867         (Relobj::finalize_incremental_relocs): New function.
1868         (Relobj::next_incremental_reloc_index): New function.
1869         (Relobj::reloc_counts_): New data member.
1870         (Relobj::reloc_bases_): New data member.
1871         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
1872         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
1873         (Sized_relobj::incremental_relocs_scan): New function.
1874         (Sized_relobj::incremental_relocs_scan_reltype): New function.
1875         (Sized_relobj::incremental_relocs_write): New function.
1876         (Sized_relobj::incremental_relocs_write_reltype): New function.
1877         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
1878         incremental link.
1879         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
1880         archives and object files elsewhere.
1881         (Add_symbols::run): Report object files here.
1882         (Finish_group::run): Report end of archive at end of group.
1883         * reloc.cc: Include layout.h, incremental.h.
1884         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
1885         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
1886         (Sized_relobj::incremental_relocs_scan): New function.
1887         (Sized_relobj::incremental_relocs_scan_reltype): New function.
1888         (Sized_relobj::do_relocate_sections): Write incremental relocations.
1889         (Sized_relobj::incremental_relocs_write): New function.
1890         (Sized_relobj::incremental_relocs_write_reltype): New function.
1891         * script.cc (read_input_script): Rewrite test for incremental link.
1892         Change call to Incremental_inputs::report_script.
1893         * symtab.h (Symbol_table::first_global_index): New function.
1894         (Symbol_table::output_count): New function.
1896 2010-08-12  Doug Kwan  <dougkwan@google.com>
1898         * arm.cc (Target_arm::merge_object_attributes): Check command line
1899         options --no-wchar-size-warning and --no-enum-size-warning.
1900         * options.h (General_options): Add ld-compatible options
1901         --no-enum-size-warning and --no-wchar-size-warning.
1903 2010-08-04  Ian Lance Taylor  <iant@google.com>
1905         * x86_64.cc (Target_x86_64::Scan::local): Use
1906         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
1907         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
1908         (Target_x86_64::Scan::global): Likewise.
1909         (Target_x86_64::Relocate::relocate): Likewise.
1910         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
1911         Likewise.
1913 2010-08-03  Cary Coutant  <ccoutant@google.com>
1915         * merge.cc (Output_merge_string::do_add_input_section): Count strings
1916         to reserve space in merged_strings vector. Keep total input size
1917         for stats.
1918         (Output_merge_string::do_print_merge_stats): Print total input size.
1919         * merge.h (Output_merge_string): Add input_size_ field.
1920         * stringpool.cc (Stringpool_template::string_length): Move
1921         implementations out of Stringpool_template class and place in
1922         stringpool.h.
1923         * stringpool.h (string_length): Move out of Stringpool_template.
1925 2010-08-03  Ian Lance Taylor  <iant@google.com>
1927         PR 11712
1928         * layout.cc (relaxation_loop_body): If address of load segment is
1929         set, adjust address to include headers if possible.
1931 2010-08-03  Ian Lance Taylor  <iant@google.com>
1933         * version.cc (version_string): Bump to 1.10.
1935 2010-08-03  Ian Lance Taylor  <iant@google.com>
1937         PR 11805
1938         * layout.h (enum Output_section_order): Define.
1939         (class Layout): Update declarations.
1940         * layout.cc (Layout::get_output_section): Add order parameter.
1941         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
1942         is_first_non_relro parameters.  Change all callers.
1943         (Layout::choose_output_section): Likewise.
1944         (Layout::add_output_section_data): Likewise.
1945         (Layout::make_output_section): Likewise.  Set order.
1946         (Layout::default_section_order): New function.
1947         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
1948         * output.cc (Output_section::Output_section): Initialize order_.
1949         Don't initialize deleted fields.
1950         (Output_segment::Output_segment): Don't initialize deleted
1951         fields.
1952         (Output_segment::add_output_section_to_load): New function
1953         replacing add_output_section.  Change all callers to call this or
1954         add_output_section_to_nonload.
1955         (Output_segment::add_output_section_to_nonload): New function.
1956         (Output_segment::remove_output_section): Rewrite.
1957         (Output_segment::add_initial_output_data): Likewise.
1958         (Output_segment::has_any_data_sections): Likewise.
1959         (Output_segment::is_first_section_relro): Likewise.
1960         (Output_segment::maximum_alignment): Likewise.
1961         (Output_segment::has_dynamic_reloc): New function replacing
1962         dynamic_reloc_count.  Change all callers.
1963         (Output_segment::has_dynamic_reloc_list): New function replacing
1964         dynamic_reloc_count_list.  Change all callers.
1965         (Output_segment::set_section_addresses): Rewrite.
1966         (Output_segment::set_offset): Rewrite.
1967         (Output_segment::find_first_and_last_list): Remove.
1968         (Output_segment::set_tls_offsets): Rewrite.
1969         (Output_segment::first_section_load_address): Likewise.
1970         (Output_segment::output_section_count): Likewise.
1971         (Output_segment::section_with_lowest_load_address): Likewise.
1972         (Output_segment::write_section_headers): Likewise.
1973         (Output_segment::print_sections_to_map): Likewise.
1974         * output.h (class Output_data): Remove dynamic_reloc_count_
1975         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
1976         (Output_data::add_dynamic_reloc): Rewrite.
1977         (Output_data::has_dynamic_reloc): New function.
1978         (Output_data::dynamic_reloc_count): Remove.
1979         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
1980         is_last_relro_, is_first_non_relro_, is_interp_,
1981         is_dynamic_linker_section_ fields.  Add order and set_order
1982         functions.  Remove is_relro_local, set_is_relro_local,
1983         is_last_relro, set_is_last_relro, is_first_non_relro,
1984         set_is_first_non_relro functions, is_interp, set_is_interp,
1985         is_dynamic_linker_section, and set_is_dynamic_linker_section
1986         functions.
1987         (class Output_segment): Change Output_data_list from std::list to
1988         std:;vector.  Add output_lists_ field.  Remove output_data_ and
1989         output_bss_ fields.  Update declarations.
1991 2010-08-02  Ian Lance Taylor  <iant@google.com>
1993         * arm.cc (Target_arm::gc_process_relocs): Use typename.
1994         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
1995         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
1997 2010-08-02  Ian Lance Taylor  <iant@google.com>
1999         PR 11855
2000         * script.cc (Script_options::Script_options): Initialize
2001         symbol_definitions_ and symbol_references_.
2002         (Script_options::add_symbol_assignment): Update
2003         symbol_definitions_ and symbol_references_.
2004         (Script_options::add_symbol_reference): New function.
2005         (script_symbol): New function.
2006         * script.h (class Script_options): Add symbol_definitions_ and
2007         symbol_references_ fields.
2008         (Script_options::referenced_const_iterator): New type.
2009         (Script_options::referenced_begin): New function.
2010         (Script_options::referenced_end): New function.
2011         (Script_options::is_referenced): New function.
2012         (Script_options::any_unreferenced): New function.
2013         * script-c.h (script_symbol): Declare.
2014         * yyscript.y (exp): Call script_symbol.
2015         * symtab.cc: Include "script.h".
2016         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2017         Change all callers.  Check symbols referenced by scripts.
2018         (Symbol_table::add_undefined_symbols_from_command_line): Add
2019         layout parameter.  Change all callers.
2020         (Symbol_table::do_add_undefined_symbols_from_command_line):
2021         Likewise.  Break out loop body.  Check symbols referenced by
2022         scripts.
2023         (Symbol_table::add_undefined_symbol_from_command_line): New
2024         function broken out of
2025         do_add_undefined_symbols_from_command_line.
2026         * symtab.h (class Symbol_table): Update declarations.
2027         * archive.cc: Include "layout.h".
2028         (Archive::should_include_member): Add layout parameter.  Change
2029         all callers.  Check for symbol mentioned in expression.
2030         * archive.h (class Archive): Update declaration.
2031         * object.cc (Sized_relobj::do_should_include_member): Add layout
2032         parameter.
2033         * object.h (Object::should_include_member): Add layout parameter.
2034         Change all callers.
2035         (Object::do_should_include_member): Add layout parameter.
2036         (class Sized_relobj): Update declaration.
2037         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2038         parameter.
2039         * dynobj.h (class Sized_dynobj): Update declaration.
2040         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2041         layout parameter.
2042         * plugin.h (class Sized_pluginobj): Update declaration.
2044 2010-08-02  Ian Lance Taylor  <iant@google.com>
2046         PR 11866
2047         * output.cc (Output_segment::set_offset): Search for the first and
2048         last sections rather than assuming that the list is in order.
2049         (Output_segment::find_first_and_last_list): New function.
2050         * output.h (class Output_segment): Update declarations.
2051         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
2052         (relro_strip_test_SOURCES): New variable.
2053         (relro_strip_test_DEPENDENCIES): New variable.
2054         (relro_strip_test_LDFLAGS): New variable.
2055         (relro_strip_test_LDADD): New variable.
2056         (relro_strip_test.so): New target.
2058 2010-08-02  Ian Lance Taylor  <iant@google.com>
2060         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
2061         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
2062         (Target_i386::got_tlsdesc_section): New function.
2063         (Target_i386::got_section): Create space for GOT entries for
2064         TLSDESC relocations.
2065         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
2066         R_386_TLS_GOTDESC.
2067         (Target_i386::Scan::global): Likewise.
2068         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
2069         using TLSDESC GOT.
2070         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
2071         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
2072         (Target_x86_64::got_tlsdesc_section): New function.
2073         (Target_x86_64::got_section): Create space for GOT entries for
2074         TLSDESC relocations.
2075         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
2076         R_386_TLS_GOTDESC.
2077         (Target_x86_64::Scan::global): Likewise.
2078         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
2079         using TLSDESC GOT.
2081 2010-08-02  Ian Lance Taylor  <iant@google.com>
2083         * testsuite/final_layout.sh: Use dc to convert from hex to
2084         decimal.
2086 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
2088         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
2089         paramter to the call to gold::gc_process_relocs.
2090         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
2091         paramter to the call to gold::gc_process_relocs.
2092         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
2093         parameter to the call to gold::gc_process_relocs.
2094         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
2095         template parameter to the call to gold::gc_process_relocs.
2096         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
2097         paramter to the call to gold::gc_process_relocs.
2098         * gc.h (get_embedded_addend_size): New function.
2099         (gc_process_relocs): Save the size of the reloc for use by ICF.
2100         * icf.cc (get_section_contents): Get the addend from the text section
2101         for SHT_REL relocation sections.
2102         * icf.h (Icf::Reloc_addend_size_info): New typedef.
2103         (Icf::Reloc_info): Add new member reloc_addend_size_info.
2104         * int_encoding.h (read_from_pointer): New overloaded function.
2105         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
2106         * testsuite/icf_sht_rel_addend_test.sh: New file.
2107         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
2108         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
2110 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2112         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
2113         * Makefile.in: Regenerate.
2114         * testsuite/Makefile.in: Regenerate.
2116 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
2118         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
2119         * gold/testsuite/debug_msg.cc: Likewise.
2120         * gold/testsuite/odr_violation1.cc
2121         * gold/testsuite/odr_violation2.cc
2123 2010-07-21  Cary Coutant  <ccoutant@google.com>
2125         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
2126         string, and length fields.
2127         (Output_merge_string::Merged_strings_list): New type.
2128         (Output_merge_string::Merged_strings_lists): New typedef.
2129         (Output_merge_string): Replace merged_strings_ with
2130         merged_strings_lists_.
2131         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
2132         Merged_strings_list per input object and section.  Don't store pointer
2133         to the string.  Don't store length with each merged string entry.
2134         (Output_merge_string::finalize_merged_data): Loop over list of merged
2135         strings lists.  Recompute length of each merged string.
2137 2010-07-15  Cary Coutant  <ccoutant@google.com>
2139         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
2140         here.
2142 2010-07-14  Ian Lance Taylor  <iant@google.com>
2144         * descriptors.cc (Descriptors::open): Report correct name in error
2145         message.
2147 2010-07-13  Doug Kwan  <dougkwan@google.com>
2149         * arm.cc (Arm_input_section::Arm_input_section): For a
2150         SHT_ARM_EXIDX section, always keeps the input sections.
2151         (Arm_input_section::set_exidx_section_link): New method.
2152         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
2153         has_errors_ to false.
2154         (Arm_exidx_input_section::has_errors,
2155         Arm_exidx_input_section::set_has_errors): New methods.
2156         (Arm_exidx_input_section::has_errors_): New data member.
2157         (Arm_relobj::get_exidx_shndx_list): New method.
2158         (Arm_output_section::append_text_sections_to_list): Do not skip
2159         section without SHF_EXECINSTR.
2160         (Arm_output_section::fix_exidx_coverage): Skip input sections with
2161         errors.
2162         (Arm_relobj::make_exidx_input_section): Add new parameter for text
2163         section header.  Make error messages more verbose.  Check for
2164         a non-executable section linked to an EXIDX section.
2165         (Arm_relobj::do_read_symbols): Remove error checking, which has been
2166         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
2167         check that there is no deferred EXIDX section if we exit early.
2168         Instead of not making an EXIDX section in case of an error, make one
2169         and set the has_errors flag of it.
2170         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
2171         in a relocatable link.
2172         (Target_arm::do_relax): Look for the EXIDX output section instead of
2173         assuming that it is called .ARM.exidx.
2174         (Target_arm::fix_exidx_coverage): Add a new parameter for input
2175         section list.  Do not check for SHF_EXECINSTR section flags but
2176         skip any input section with errors.
2177         * output.cc (Output_section::Output_section): Initialize
2178         always_keeps_input_sections_ to false.
2179         (Output_section::add_input_section): Check for
2180         always_keeps_input_sections_.
2181         *  output.h (Output_section::always_keeps_input_sections,
2182         Output_section::set_always_keeps_input_sections): New methods.
2183         (Output_section::always_keeps_input_sections): New data member.
2185 2010-07-13  Rafael Espindola  <espindola@google.com>
2187         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
2188         * fileread.h (Input_file): Add try_extra_search_path and find_file.
2190 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
2191             Ian Lance Taylor  <iant@google.com>
2193         * output.h (Output_section_lookup_maps::add_merge_section):
2194         Correct check of whether value was inserted.
2195         (Output_section_lookup_maps::add_merge_input_section): Likewise.
2196         (Output_section_lookup_maps::add_relaxed_input_section):
2197         Likewise.
2198         * arm.cc (Target_arm::got_section): Remove used local os.
2199         * i386.cc (Target_i386::got_section): Likewise.
2200         * x86_64.cc (Target_x86_64::got_section): Likewise.
2201         * sparc.cc (Target_sparc::got_section): Likewise.
2202         (Target_sparc::relocate): Remove unused local have_got_offset.
2203         * powerpc.cc (Target_powerpc::relocate): Likewise.
2205 2010-07-13  Ian Lance Taylor  <iant@google.com>
2207         * compressed_output.cc (zlib_decompress): Fix signature in
2208         !HAVE_ZLIB_H case.
2210         * archive.cc (Archive::include_member): Unlock an external member
2211         of a thin archive.  Don't bother to delete an object we know is
2212         NULL.
2214 2010-07-12  Cary Coutant  <ccoutant@google.com>
2216         * compressed_output.cc (zlib_decompress): New function.
2217         (get_uncompressed_size): New function.
2218         (decompress_input_section): New function.
2219         * compressed_output.h (get_uncompressed_size): New function.
2220         (decompress_input_section): New function.
2221         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
2222         Handle compressed debug sections.
2223         * layout.cc (is_compressed_debug_section): New function.
2224         (Layout::output_section_name): Map compressed section names to
2225         canonical names.
2226         * layout.h (is_compressed_debug_section): New function.
2227         (is_debug_info_section): Recognize compressed debug sections.
2228         * merge.cc: Include compressed_output.h.
2229         (Output_merge_data::do_add_input_section): Handle compressed
2230         debug sections.
2231         (Output_merge_string::do_add_input_section): Handle compressed
2232         debug sections.
2233         * object.cc: Include compressed_output.h.
2234         (Sized_relobj::Sized_relobj): Initialize new data members.
2235         (build_compressed_section_map): New function.
2236         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
2237         * object.h (Object::section_is_compressed): New method.
2238         (Object::do_section_is_compressed): New method.
2239         (Sized_relobj::Compressed_section_map): New type.
2240         (Sized_relobj::do_section_is_compressed): New method.
2241         (Sized_relobj::compressed_sections_): New data member.
2242         * output.cc (Output_section::add_input_section): Handle compressed
2243         debug sections.
2244         * reloc.cc: Include compressed_output.h.
2245         (Sized_relobj::write_sections): Handle compressed debug sections.
2247 2010-07-08  Cary Coutant  <ccoutant@google.com>
2249         * resolve.cc (Symbol_table::resolve): Remember whether undef was
2250         weak when resolving to a dynamic def.
2251         (Symbol_table::should_override): Add adjust_dyndef flag; set it
2252         for weak undef/dynamic def cases. Adjust callers.
2253         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
2254         undef_binding_weak_.
2255         (Symbol_table::sized_write_globals): Adjust symbol binding.
2256         (Symbol_table::sized_write_symbol): Add binding parameter.
2257         * symtab.h (Symbol::set_undef_binding): New method.
2258         (Symbol::is_undef_binding_weak): New method.
2259         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
2260         (Symbol_table::should_override): Add new parameter.
2261         (Symbol_table::sized_write_symbol): Add new parameter.
2263         * testsuite/weak_undef_file1.cc: Add new test case.
2264         * testsuite/weak_undef_file2.cc: Fix header comment.
2265         * testsuite/weak_undef_test.cc: Add new test case.
2267 2010-06-29  Doug Kwan  <dougkwan@google.com>
2269         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
2270         Initialize USE_SYMBOL_.
2271         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
2272         definition.
2273         (Arm_reloc_property::uses_symbol_): New data member declaration.
2274         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
2275         uses symbol value and symbol is undefined but not weakly undefined.
2277 2010-06-28  Rafael Espindola  <espindola@google.com>
2279         * plugin.cc (Plugin::load): Use dlerror.
2281 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
2283         * symtab.cc (detect_odr_violations): When reporting an ODR
2284         violation, report an object where the symbol is defined.
2286 2010-06-25  Doug Kwan  <dougkwan@google.com>
2288         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
2289         (Target_arm::section_may_have_icf_unsafe_pointers): New method
2290         definition.
2291         (Target_arm::Scan::local_reloc_may_be_function_pointer,
2292         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
2293         target hook to detect function points.
2294         (Target_arm::Scan::possible_function_pointer_reloc): New method.
2295         * icf.h (Icf::check_section_for_function_pointers): Change type of
2296         parameter SECTION_NAME to const reference to std::string.  Use
2297         target hook to determine if section may have unsafe pointers.
2298         * target.h (Target::section_may_have_icf_unsafe_pointers): New
2299         method definition.
2301 2010-06-21  Rafael Espindola  <espindola@google.com>
2303         * fileread.cc (Input_file::find_fie): New
2304         (Input_file::open): Use Input_file::find_fie.
2305         * fileread.h (Input_file::find_fie): New
2306         * plugin.cc (set_extra_library_path): New.
2307         (Plugin::load): Add set_extra_library_path to the transfer vector.
2308         (Plugin_manager::set_extra_library_path): New.
2309         (Plugin_manager::add_input_file): Use the extra search path if set.
2310         (set_extra_library_path(): New.
2311         * plugin.h (Plugin_manager): Add set_extra_library_path and
2312         extra_search_path_.
2314 2010-06-19  Cary Coutant  <ccoutant@google.com>
2316         * layout.cc (gdb_sections): Add .debug_types.
2317         (lines_only_debug_sections): Likewise.
2319 2010-06-18  Rafael Espindola  <espindola@google.com>
2321         * plugin.cc (add_input_file,add_input_library)
2322         (Plugin_manager::add_input_file): Make filename arguments const.
2323         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
2324         const.
2326 2010-06-16  Doug Kwan  <dougkwan@google.com>
2328         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
2329         .ARM.attributes section if we have not merged any input
2330         attributes sections.
2332 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2334         * arm.cc: Allow combining objects with no EABI version
2335         information.
2337 2010-06-15  Rafael Espindola  <espindola@google.com>
2339         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
2341 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2343         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
2344         (struct iovec): Correct !HAVE_READV definition.
2346 2010-06-10  Cary Coutant  <ccoutant@google.com>
2348         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
2349         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
2350         reloc sections.
2351         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
2353         PR 11683
2354         * symtab.h (Symbol::is_placeholder): New member function.
2355         * target-reloc.h (relocate_section): Check for placeholder symbols.
2357         * testsuite/Makefile.am (plugin_test_8): New test.
2358         (plugin_test_9): New test.
2359         * testsuite/Makefile.in: Regenerate.
2361 2010-06-09  Nick Clifton  <nickc@redhat.com>
2363         * yyscript.y (input_list_element): Allow strings prefixed with
2364         the '-' character.  Treat these as libraries.
2365         * script.cc (script_add_library): New function.  Adds a library
2366         specified by "-l<name>" found in an input script.
2367         * script-c.h: Add prototype for script_add_library.
2369 2010-06-07  Doug Kwan  <dougkwan@google.com>
2371         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
2372         Restrict stub-group size to be within long conditional branch
2373         range when working around cortex-A8 erratum.
2375 2010-06-07  Damien Diederen  <dd@crosstwine.com>
2377         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
2378         #ifdef typo.
2380 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
2382         PR gold/11658
2383         * output.cc
2384         (Output_section::Input_section_sort_entry::compare_section_ordering):
2385         Change to return non-zero correctly.
2386         (Output_section::Input_section_sort_section_order_index_compare
2387         ::operator()): Change to fix ambiguity in comparisons.
2389 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
2391         * gold.h (is_wildcard_string): New function.
2392         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
2393         (Layout::layout_eh_frame): Ditto.
2394         (Layout::find_section_order_index): New method.
2395         (Layout::read_layout_from_file): New method.
2396         * layout.h (Layout::find_section_order_index): New method.
2397         (Layout::read_layout_from_file): New method.
2398         (Layout::input_section_position_): New private member.
2399         (Layout::input_section_glob_): New private member.
2400         * main.cc (main): Call read_layout_from_file here.
2401         * options.h (--section-ordering-file): New option.
2402         * output.cc (Output_section::input_section_order_specified_): New
2403         member.
2404         (Output_section::Output_section): Initialize new member.
2405         (Output_section::add_input_section): Add new parameter.
2406         Keep input sections when --section-ordering-file is used.
2407         (Output_section::set_final_data_size): Sort input sections when
2408         section ordering file is specified.
2409         (Output_section::Input_section_sort_entry): Add new parameter.
2410         Check sorting type.
2411         (Output_section::Input_section_sort_entry::compare_section_ordering):
2412         New method.
2413         (Output_section::Input_section_sort_compare::operator()): Change to
2414         consider section_order_index.
2415         (Output_section::Input_section_sort_init_fini_compare::operator()):
2416         Change to consider section_order_index.
2417         (Output_section::Input_section_sort_section_order_index_compare
2418         ::operator()): New method.
2419         (Output_section::sort_attached_input_sections): Change to sort
2420         according to section order when specified.
2421         (Output_section::add_input_section<32, true>): Add new parameter.
2422         (Output_section::add_input_section<64, true>): Add new parameter.
2423         (Output_section::add_input_section<32, false>): Add new parameter.
2424         (Output_section::add_input_section<64, false>): Add new parameter.
2425         * output.h (Output_section::add_input_section): Add new parameter.
2426         (Output_section::input_section_order_specified): New
2427         method.
2428         (Output_section::set_input_section_order_specified): New method.
2429         (Input_section::Input_section): Initialize section_order_index_.
2430         (Input_section::section_order_index): New method.
2431         (Input_section::set_section_order_index): New method.
2432         (Input_section::section_order_index_): New member.
2433         (Input_section::Input_section_sort_section_order_index_compare): New
2434         struct.
2435         (Output_section::input_section_order_specified_): New member.
2436         * script-sections.cc (is_wildcard_string): Delete and move modified
2437         method to gold.h.
2438         (Output_section_element_input::Output_section_element_input): Modify
2439         call to is_wildcard_string.
2440         (Output_section_element_input::Input_section_pattern
2441         ::Input_section_pattern): Ditto.
2442         (Output_section_element_input::Output_section_element_input): Ditto.
2443         * testsuite/Makefile.am (final_layout): New test case.
2444         * testsuite/Makefile.in: Regenerate.
2445         * testsuite/final_layout.cc: New file.
2446         * testsuite/final_layout.sh: New file.
2448 2010-06-01  Rafael Espindola  <espindola@google.com>
2450         * plugin.cc (Plugin::load): Pass the output name to the plugin.
2452 2010-06-01  Rafael Espindola  <espindola@google.com>
2454         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
2455         visibility of symbols.
2457 2010-05-27  Doug Kwan  <dougkwan@google.com>
2459         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
2460         from start of output section instead of address for a local symbol
2461         in a merged or relaxed section when doing a relocatable link.
2463 2010-05-26  Rafael Espindola  <espindola@google.com>
2465        PR 11604
2466         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
2467         adding sections the garbage collector removed.
2468         * gold/testsuite/Makefile.am: Add test.
2469         * gold/testsuite/Makefile.in: Regenerate.
2470         * gold/testsuite/plugin_test_7.sh: New.
2471         * gold/testsuite/plugin_test_7_1.c: New.
2472         * gold/testsuite/plugin_test_7_2.c: New.
2474 2010-05-26  Rafael Espindola  <espindola@google.com>
2476         * script-sections.cc (Output_section_definition::set_section_addresses):
2477         Check for --section-start.
2479 2010-05-26  Doug Kwan  <dougkwan@google.com>
2481         * arm.cc (Arm_scan_relocatable_relocs): New class.
2482         (Target_arm::relocate_special_relocatable): New method.
2483         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
2484         (Arm_relocate_functions::thumb_branch_common): Same.
2485         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
2486         instead of Default_scan_relocatable_relocs.
2487         * target-reloc.h (relocate_for_relocatable): Let target handle
2488         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
2489         * target.h (Sized_target::relocate_special_relocatable): New method.
2491 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2493         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
2495 2010-05-23  Doug Kwan  <dougkwan@google.com>
2497         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
2498         instead of a cast.
2499         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
2500         with a direct branch, not a conditional branch, to a stub.
2501         * merge.cc (Output_merge_base::record_input_section): New method
2502         defintion.
2503         (Output_merge_data::do_add_input_section): Record input section if
2504         keeps-input-sections flag is set.
2505         (Output_merge_string::do_add_input_section): Ditto.
2506         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
2507         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
2508         INPUT_SECTIONS_.
2509         (Output_merge_base::keeps_input_sections,
2510         Output_merge_base::set_keeps_input_sections,
2511         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
2512         method definitions.
2513         (Output_merge_base::Input_sections): New type declaration.
2514         (Output_merge_base::input_sections_begin,
2515         Output_merge_base::input_sections_end,
2516         Output_merge_base::do_set_keeps_input_sections): New method definitions.
2517         (Output_merge_base::bool keeps_input_sections_,
2518         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
2519         Output_merge_base::input_sections_): New data members.
2520         (Output_merge_data::do_set_keeps_input_sections): New method
2521         defintion.
2522         (Output_merge_string::do_set_keeps_input_sections): Ditto.
2523         * output.cc (Output_section::Input_section::relobj): Move method
2524         defintion from class declaration to here and handle merge sections.
2525         (Output_section::Input_section::shndx): Ditto.
2526         (Output_section::Output_section): Remove initializations of removed
2527         data members and initialize new data member LOOKUP_MAPS_.
2528         (Output_section::add_input_section): Set keeps-input-sections flag
2529         for a newly created merge output section as appropriate.  Adjust code
2530         to use Output_section_lookup_maps class.
2531         (Output_section::add_relaxed_input_section): Adjst code for lookup
2532         maps code refactoring.
2533         (Output_section::add_merge_input_section): Add a new parameter
2534         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
2535         class.  If adding input section to a newly created merge output
2536         section fails, remove the new merge section.
2537         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
2538         Adjust code for use of the Output_section_lookup_maps class.
2539         (Output_section::find_merge_section): Ditto.
2540         (Output_section::build_lookup_maps): New method defintion.
2541         (Output_section::find_relaxed_input_section): Adjust code to use
2542         Output_section_lookup_maps class.
2543         (Output_section::get_input_sections): Export merge sections.  Adjust
2544         code to use Output_section_lookup_maps class.
2545         (Output_section:::add_script_input_section): Adjust code to use
2546         Output_section_lookup_maps class.  Update lookup maps for merge
2547         sections also.
2548         (Output_section::discard_states): Use Output_section_lookup_maps.
2549         (Output_section::restore_states): Same.
2550         * output.h (Merge_section_properties): Move class defintion out of
2551         Output_section.
2552         (Output_section_lookup_maps): New class.
2553         (Output_section::Input_section::is_merge_section): New method
2554         defintion.
2555         (Output_section::Input_section::relobj): Move defintion out of class
2556         defintion.  Declare method only.
2557         (Output_section::Input_section::shndx): Ditto.
2558         (Output_section::Input_section::output_merge_base): New method defintion.
2559         (Output_section::Input_section::u2_.pomb): New union field.
2560         (Output_section::Merge_section_by_properties_map,
2561         Output_section::Output_section_data_by_input_section_map,
2562         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
2563         Remove types.
2564         (Output_section::add_merge_input_section): Add new parameter
2565         KEEPS_INPUT_SECTIONS.
2566         (Output_section::build_lookup_maps): New method declaration.
2567         (Output_section::merge_section_map_,
2568         Output_section::merge_section_by_properties_map_,
2569         Output_section::relaxed_input_section_map_,
2570         Output_section::is_relaxed_input_section_map_valid_): Remove data
2571         members.
2572         (Output_section::lookup_maps_): New data member.
2574 2010-05-21  Doug Kwan  <dougkwan@google.com>
2576         PR gold/11619
2577         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
2578         avoid a compilation error.
2580 2010-05-19  Rafael Espindola  <espindola@google.com>
2582         * script-sections.cc (Output_section_definition::allocate_to_segment):
2583         Update the phdrs_list even when the output section is NULL.
2584         * testsuite/Makefile.am: Add test.
2585         * testsuite/Makefile.in: Regenerate.
2586         * testsuite/script_test_9.cc: New.
2587         * testsuite/script_test_9.sh: New.
2588         * testsuite/script_test_9.t: New.
2590 2010-05-19  Doug Kwan  <dougkwan@google.com>
2592         * arm.cc (Arm_input_section::original_size): New method.
2593         (Arm_input_section::do_addralign): Add a cast.
2594         (Arm_input_section::do_output_offset): Remove static cast.
2595         (Arm_input_section::original_addralign,
2596          Arm_input_section::original_size_): Change type to uint32_t.
2597         (Arm_input_section::init): Add safe casts for section alignment
2598         and size.
2599         (Arm_input_section::set_final_data_size): Do not set address and
2600         offset of stub table.
2601         (Arm_output_section::fix_exidx_coverage): Change use of of
2602         Output_section::Simple_input_section to that of
2603         Output_section::Input_section.
2604         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
2605         except for the first pass.
2606         * output.cc (Output_section::get_input_sections): Change type of
2607         input_sections to std::list<Input_section>.
2608         (Output_section::add_script_input_section): Rename from
2609         Output_section::add_simple_input_section.  Change type of SIS
2610         parameter from Simple_input_section to Input_section.
2611         * output.h (Output_section::Simple_input_section): Remove class.
2612         (Output_section::Input_section): Change class visibility to public.
2613         (Output_section::Input_section::addralign): Use stored alignments
2614         for special input sections if set.
2615         (Output_section::Input_section::set_addralign): New method.
2616         (Output_section::get_input_sections): Change parameter type from
2617         list of Simple_input_section to list of Input_section.
2618         (Output_section::add_script_input_section): Rename from
2619         Output_section::add_simple_input_section. Change first parameter's
2620         type from Simple_input_section to Input_section and remove the
2621         second and third parameters.
2622         * script-sections.cc (Input_section::Input_section_list): Change
2623         type to list of Output_section::Input_section/
2624         (Input_section_info::Input_section_info): Change parameter type of
2625         INPUT_SECTION to Output_section::Input_section.
2626         (Input_section_info::input_section): Change return type.
2627         (Input_section_info::input_section_): Change type to
2628         Output_section::Input_section.
2629         (Output_section_element_input::set_section_addresses): Adjust code
2630         to use Output_section::Input_section instead of
2631         Output_section::Simple_input_section.  Adjust code for renaming
2632         of Output_section::add_simple_input_section.
2633         (Orphan_output_section::set_section_addresses): Ditto.
2635 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2637         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
2638         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
2640 2010-05-18  Rafael Espindola  <espindola@google.com>
2642         * options.cc (General_options::finalize): Handle -nostdlib.
2643         * options.h (nostdlib): New option.
2644         * script.cc (script_add_search_dir): Handle -nostdlib.
2646 2010-05-12  Doug Kwan  <dougkwan@google.com>
2648         * arm.cc (Target_arm::do_finalize_sections): Create an empty
2649         attributes section only if there no attributes section after merging.
2650         (Target_arm::merge_object_attributes): Move value of
2651         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
2652         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
2653         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
2654         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
2655         and arm_attr_merge_7.stdout.
2656         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
2657         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
2658         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
2659         arm_attr_merge_7b.o): New rules.
2660         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
2661         arm_attr_merge_7
2662         * testsuite/Makefile.in: Regenerate.
2663         * testsuite/arm_attr_merge.sh: New file.
2664         * testsuite/arm_attr_merge_[67][ab].s: Same.
2666 2010-05-05  Nick Clifton  <nickc@redhat.com>
2668         * po/es.po: Updated Spanish translation.
2670 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2672         * Makefile.am (install-exec-local): Properly install gold as
2673         default cross linker.
2674         * Makefile.in: Regenerated.
2676 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2677             Nick Clifton  <nickc@redhat.com>
2679         * configure.ac (install_as_default): Define and set to false
2680         unless --enable-gold or --enable-gold=both/gold has been
2681         specified.
2682         * configure: Regenerate.
2684         * Makefile.am (install-exec-local): Install the executable as
2685         'ld.gold'.  If install_as_default is true then also install it as
2686         'ld'.
2687         * Makefile.in: Regenerated.
2689 2010-04-24  Ian Lance Taylor  <iant@google.com>
2691         * layout.cc (Layout::layout_reloc): In relocatable link don't
2692         combine reloc sections for grouped sections.
2694 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
2696         * gc.h (gc_process_relocs): Pass information on relocs pointing to
2697         sections that are not ordinary to icf.
2698         * icf.cc (get_section_contents): Handle relocation pointing to section
2699         with no object or shndx information.
2700         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
2701         * testsuite/Makefile.in: Regenerate.
2702         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
2703         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
2705 2010-04-22  Ian Lance Taylor  <iant@google.com>
2707         * expression.cc (Expression::Expression_eval_info): Add
2708         result_alignment_pointer field.
2709         (Expression::eval_with_dot): Add result_alignment_pointer
2710         parameter.  Change all callers.
2711         (Expression::eval_maybe_dot): Likewise.
2712         (class Binary_expression): Add alignment_pointer parameter to
2713         left_value and right_value.  Change all callers.
2714         (BINARY_EXPRESSION): Set result alignment.
2715         (class Trinary_expression): Add alignment_pointer parameter to
2716         arg2_value and arg3_value.  Change all callers.
2717         (Trinary_cond::value): Set result alignment.
2718         (Max_expression::value, Min_expression::value): Likewise.
2719         (Align_expression::value): Likewise.
2720         * script-sections.cc (class Sections_element): Add dot_alignment
2721         parameter to set_section_addresses virtual function.  Update
2722         instantiations.
2723         (class Output_section_element): Likewise.
2724         (Script_sections::create_segments): Add dot_alignment parameter.
2725         Change all callers.
2726         (Script_sections::create_segments_from_phdrs_clause): Likewise.
2727         (Script_sections::set_phdrs_clause_addresses): Likewise.
2728         * script-sections.h: Update declarations.
2729         * script.h: Update declarations.
2730         * output.h (Output_segment::set_minimum_p_align): Don't decrease
2731         min_p_align.
2732         * testsuite/script_test_3.t: Set large alignment.
2733         * testsuite/script_test_3.sh: Make sure that at least one LOAD
2734         segment has expected alignment.
2736 2010-04-22  Nick Clifton  <nickc@redhat.com>
2738         * po/gold.pot: Updated by the Translation project.
2739         * po/vi.po: Updated Vietnamese translation.
2741 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
2743         * testsuite/Makefile.am (check_PROGRAMS): Add
2744         icf_virtual_function_folding_test.
2745         * testsuite/Makefile.in: Regenerated.
2747 2010-04-15  Andrew Haley  <aph@redhat.com>
2749         * options.h (merge_exidx_entries): New option.
2750         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
2751         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
2752         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
2753         (Target_arm::merge_exidx_entries): New function.
2754         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
2755         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
2756         to Arm_exidx_fixup constructor.
2757         Add new arg, merge_exidx_entries.
2758         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
2759         Arm_output_section::fix_exidx_coverage.
2761 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
2763         * icf.cc (get_section_contents): Check for preemptible functions.
2764         Ignore addend when appropriate.
2765         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
2766         section folded.
2767         (add_from_relobj): Check for section folded.
2768         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
2769         * symtab.h (should_add_dynsym_entry): Add new parameter.
2770         * target-reloc.h (scan_relocs): Check for section folded.
2771         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
2772         Check reloc types for function pointers in shared objects.
2773         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
2774         case.
2775         (icf_preemptible_functions_test): New test case.
2776         (icf_string_merge_test): New test case.
2777         * testsuite.Makefile.in: Regenerate.
2778         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
2779         bar_glob.  Refactor code.
2780         * testsuite/icf_preemptible_functions_test.cc: New file.
2781         * testsuite/icf_preemptible_functions_test.sh: New file.
2782         * testsuite/icf_string_merge_test.cc: New file.
2783         * testsuite/icf_string_merge_test.sh: New file.
2784         * testsuite/icf_virtual_function_folding_test.cc: New file.
2785         * testsuite/icf_virtual_function_folding_test.sh: New file.
2787 2010-04-14  Doug Kwan  <dougkwan@google.com>
2789         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
2790         for local symbol recounting if we remove a section due to ICF.
2791         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
2792         there are no regular objects in input.
2794 2010-04-13  Doug Kwan  <dougkwan@google.com>
2796         * arm.cc (Arm_input_section::set_final_data_size): Compute
2797         accurate final data size instead of using current data size.
2799 2010-04-09  Doug Kwan  <dougkwan@google.com>
2801         * layout.cc (Layout::choose_output_section): Handle script section
2802         types.
2803         (Layout::make_output_section_for_script): Add section type parameter.
2804         Handle script section types.
2805         * layout.h (Layout::make_output_section_for_script): Add section
2806         type parameter.
2807         * output.cc (Output_section::Output_section): Initialize data member
2808         is_noload_.
2809         (Output_section::do_reset_address_and_file_offset): Do not set address
2810         to 0 if section is a NOLOAD section.
2811         * output.h (Output_section::is_noload): New method.
2812         (Output_section::set_is_noload): Ditto.
2813         (Output_section::is_noload_): New data member.
2814         * script-c.h (Script_section_type): New enum type.
2815         (struct Parser_output_section_header): Add new file section_type.
2816         * script-sections.cc (Sections_element::output_section_name): Add
2817         parameter for returning script section type.
2818         (Output_section_definition::output_section_name): Ditto.
2819         (Output_section_definition::section_type)P; New method.
2820         (Output_section_definiton::script_section_type_name): Ditto.
2821         (Output_section_definition::script_section_type_): New data member.
2822         (Output_section_definition::Output_section_definition): Initialize
2823         data member Output_section_definition::script_section_type_.
2824         (Output_section_definition::create_sections): Pass script section type
2825         to Layout::make_output_section_for_script.
2826         (Output_section_definition::output_section_name): Return script
2827         section type to caller.
2828         (Output_section_definition::set_section_address): Do not advance
2829         dot value and load address if section type is NOLOAD.  Set address
2830         of NOLOAD sections regardless of section flags.
2831         (Output_section_definition::print): Print section type if it is
2832         not SCRIPT_SECTION_TYPE_NONE.
2833         (Output_section_definition::section_type): New method.
2834         (Output_section_definition::script_section_type_name): Ditto.
2835         (Script_sections::output_section_name): Add new parameter
2836         PSECTION_TYPE for returning script section type.  Pass it to
2837         section elements.  Handle discard sections.
2838         (Sort_output_sections::operator()): Handle NOLOAD sections.
2839         * script-sections.h (Script_sections::Section_type): New enum type.
2840         (Script_sections::output_section_name): Add a new parameter for
2841         returning script section type.
2842         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
2843         INFO and NOLOAD.
2844         * yyscript.y (union): Add new field SECTION_TYPE.
2845         (COPY, DSECT, INFO, NOLOAD): New tokens.
2846         (opt_address_and_section_type): Change type to output_section_header.
2847         (section_type): New non-terminal
2848         (section_header): Handle section type.
2849         (opt_address_and_section_type): Return section type value.
2851 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
2853         * testsuite/plugin_common_test_1.c (foo): Add prototype.
2854         * testsuite/plugin_common_test_2.c (foo): Likewise.
2856 2010-04-08  Doug Kwan  <dougkwan@google.com>
2858         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
2859         Output_merge_data.
2860         * output.cc (Output_section::add_merge_input_section): Simplify
2861         code and return status of Output_merge_base::add_input_section.
2862         Update merge section map only if Output_merge_base::add_input_section
2863         returns true.
2865 2010-04-07  Doug Kwan  <dougkwan@google.com>
2867         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
2868         if section is marked as containing instructions but has no mapping
2869         symbols.
2870         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
2871         correct section index.
2872         (Arm_relobj::find_linked_text_section): Ditto.
2874 2010-04-07  Cary Coutant  <ccoutant@google.com>
2876         * archive.cc (include_member): Destroy Read_symbols_data object before
2877         releasing file.
2878         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
2879         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
2880         (Read_symbols_data::~Read_symbols_data) New destructor.
2881         (Section_relocs::Section_relocs) New constructor.
2882         (Section_relocs::~Section_relocs) New destructor.
2883         (Read_relocs_data::Read_relocs_data) New constructor.
2884         (Read_relocs_data::~Read_relocs_data) New destructor.
2885         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
2886         pointers to NULL after deleting.
2888 2010-04-07  Doug Kwan  <dougkwan@google.com>
2890         * arm.cc: Replace "endianity" with "endianness" in comments.
2891         (Arm_exidx_cantunwind): Ditto.
2892         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
2893         (Arm_relobj::merge_flags_and_attributes): New method.
2894         (Arm_relobj::merge_flags_and_attributes_): New data member.
2895         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
2896         (Arm_relobj::scan_sections_for_stubs): Ditto.
2897         (Arm_relobj::do_read_symbols): Check to see if we really want to
2898         merge processor-specific flags and attributes.  Exit early if
2899         an object is empty except for section names and the undefined symbol.
2900         (Target_arm::do_finalize_sections): Move check for ELF format to
2901         Arm_relobj::do_read_symbols.  Merge processor specific flags and
2902         attributes from a regular object only when we have determined that
2903         it is aapropriate.  Do not create an .ARM.attributes section in
2904         output if there is no regular input object.
2905         (Target_arm::merge_processor_specific_flags): Check
2906         --warn-mismatch before printing any error.
2907         (Target_arm::merge_object_attributes): Ditto.
2908         * gold.cc (queue_middle_tasks): Handle the case in which there is
2909         no regular object in input.
2910         * options.cc (General_options::parse_EB): New method.
2911         (General_options::parse_EL): Same.
2912         (General_options::General_options): Initialize endianness_.
2913         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
2914         New options.
2915         (General_options::Endianness): New enum.
2916         (General_options::endianness): New method.
2917         (General_options::endianness_): New data member.
2918         * parameters.cc (Parameters::set_options): Check target endianness.
2919         (Parameters::set_target_once): Ditto.
2920         (Parameters::check_target_endianness): New method.
2921         (parameters_force_valid_target): If either -EL or -EB is specified,
2922         use it to define endianness of default target.
2923         * parameters.h (Parameters::check_target_endianness): New method
2924         declaration.
2925         * target.h (class Target): Change "endianity" to "endianness"
2926         in comments.
2928 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2930         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
2931         * configure: Regenerate.
2932         * Makefile.in: Regenerate.
2933         * testsuite/Makefile.in: Regenerate.
2935 2010-04-06  Cary Coutant  <ccoutant@google.com>
2937         gcc PR lto/42757
2938         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
2939         prevailing definitions of common symbols.
2940         * testsuite/plugin_test_6.sh: New test case.
2941         * testsuite/plugin_common_test_1.c: New test case.
2942         * testsuite/plugin_common_test_2.c: New test case.
2943         * testsuite/Makefile.am (plugin_test_6): New test case.
2944         * testsuite/Makefile.in: Regenerate.
2946 2010-04-06  Nick Clifton  <nickc@redhat.com>
2948         * po/vi.po: New Vietnamese translation.
2950 2010-03-30  Doug Kwan  <dougkwan@google.com>
2952         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
2954 2010-03-25  Doug Kwan  <dougkwan@google.com>
2956         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
2957         to avoid a conversion warning on a 32-bit host.
2959 2010-03-24  Ian Lance Taylor  <iant@google.com>
2961         * testsuite/script_test_3.t: Add a TLS segment.
2962         * testsuite/Makefile.am (check_PROGRAMS): Add
2963         tls_phdrs_script_test.
2964         (tls_phdrs_script_test_SOURCES): Define.
2965         (tls_phdrs_script_test_DEPENDENCIES): Define.
2966         (tls_phdrs_script_test_LDFLAGS): Define.
2967         (tls_phdrs_script_test_LDADD): Define.
2968         * testsuite/Makefile.in: Rebuild.
2970 2010-03-23  Cary Coutant  <ccoutant@google.com>
2972         * fileread.cc (find_or_make_view): Fix comment.
2974 2010-03-23  Ian Lance Taylor  <iant@google.com>
2976         * script-sections.cc (class Orphan_section_placement): Define
2977         PLACE_TLS and PLACE_TLS_BSS.
2978         (Orphan_section_placement::Orphan_section_placement): Initialize
2979         new places.
2980         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
2981         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
2982         (tls_script_test_SOURCES): Define.
2983         (tls_script_test_DEPENDENCIES): Define.
2984         (tls_script_test_LDFLAGS): Define.
2985         (tls_script_test_LDADD): Define.
2986         * testsuite/Makefile.in: Rebuild.
2988 2010-03-22  Doug Kwan  <dougkwan@google.com>
2990         * arm.cc (Arm_relocate_functions::abs8,
2991         Arm_relocate_functions::abs16): Use correct check for overflow
2992         specified in the ARM ELF specs.
2993         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
2994         target of a BLX instruction specially.
2995         (Reloc_stub::stub_type_for_reloc): Ditto.
2996         (Relocate::relocate): Use symbolic names instead of numeric relocation
2997         codes to report error.
2998         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
2999         workaround.
3000         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3001         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3002         thumb2_blx_out_of_range.stdout
3003         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3004         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3005         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3006         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3007         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3008         thumb2_blx_in_range, thumb2_blx_in_range.o,
3009         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3010         thumb2_blx_out_of_range.o): New rules.
3011         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3012         thumb2_blx_in_range and thumb2_blx_out_of_range.
3013         * testsuite/Makefile.in: Regenerate.
3014         * arm_branch_in_range.sh: Add tests for THUMB BLX.
3015         * testsuite/thumb_blx_in_range.s: New file.
3016         * testsuite/thumb_blx_out_of_range.s: New file.
3018 2010-03-22  Rafael Espindola  <espindola@google.com>
3020         * archive.cc (Should_include): Move to archive.h.
3021         (should_include_member): Make it a member of Archive.
3022         (Lib_group): New.
3023         (Add_lib_group_symbols): New.
3024         * archive.h: Include options.h.
3025         (Archive_member): Moved from Archive.
3026         (Should_include): Moved from archive.cc.
3027         (Lib_group): New.
3028         (Add_lib_group_symbols): New.
3029         * dynobj.cc (do_should_include_member): New.
3030         * dynobj.h (do_should_include_member): New.
3031         * gold.cc (queue_initial_tasks): Update call to queue.
3032         * main.cc (main): Print lib group stats.
3033         * object.cc (do_should_include_member): New.
3034         * object.h: Include archive.h.
3035         (Object::should_include_member): New.
3036         (Object::do_should_include_member): New.
3037         (Sized_relobj::do_should_include_member): New.
3038         * options.cc (General_options::parse_start_lib): New.
3039         (General_options::parse_end_lib): New.
3040         (Input_arguments::add_file): Handle lib groups.
3041         (Input_arguments::start_group): Check we are not in a lib.
3042         (Input_arguments::start_lib): New.
3043         (Input_arguments::end_lib): New.
3044         * options.h (General_options): Add start_lib and end_lib.
3045         (Input_argument::lib_): New.
3046         (Input_argument::lib): New.
3047         (Input_argument::is_lib): New.
3048         (Input_file_lib): New.
3049         (Input_arguments::in_lib_): New.
3050         (Input_arguments::in_lib): New.
3051         (Input_arguments::start_lib): New.
3052         (Input_arguments::end_lib_): New.
3053         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
3054         in unused members as preempted.
3055         (Sized_pluginobj::do_should_include_member): New.
3056         * plugin.h (Sized_pluginobj::do_should_include_member): New.
3057         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
3058         return the blocker.
3059         (Read_symbols::do_whole_lib_group): New.
3060         (Read_symbols::do_lib_group): New.
3061         (Read_symbols::do_read_symbols): Handle lib groups.
3062         (Read_symbols::get_name): Handle lib groups.
3063         * readsyms.h (Read_symbols): Add an archive member pointer.
3064         (Read_symbols::do_whole_lib_group): New.
3065         (Read_symbols::do_lib_group): New.
3066         (Read_symbols::member_): New.
3067         * script.cc (read_input_script): Update call to queue_soon.
3069 2010-03-19  Doug Kwan  <dougkwan@google.com>
3071         * arm.cc (Stub_table::Stub_table): Initialize new data members
3072         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3073         (Stub_table::add_reloc_stub): Assign stub offset and update
3074         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
3075         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
3076         New data members.
3077         (Stub_table::update_data_size_and_addralign): Use
3078         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
3079         instead of going over all reloc stubs.
3080         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
3081         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3082         Stringpool_template::offset_ to size of Stringpool_char.
3083         (Stringpool_template::new_key_offset): Remove code to initialize
3084         Stringpool_template::offset_.
3085         * stringpool.h (Stringpool_template::set_no_zero_null): Set
3086         Stringpool_template::offset_ to zero.
3088 2010-03-15  Doug Kwan  <dougkwan@google.com>
3090         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
3091         offset_.
3092         (Stringpool_template::new_key_offset): New method.
3093         (Stringpool_template::add_string): Assign offsets when adding new
3094         strings.
3095         (Stringpool_template::set_string_offsets): Do not set string offsets
3096         when not optimizing.
3097         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
3098         member size_.
3099         (Chunked_vector::clear): Clear size_.
3100         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
3101         (Chunked_vector::size): Return size_.
3102         (Chunked_vector::push_back): Use size_ to find insert position.
3103         (Chunked_vector::size_): New data member.
3104         (Stringpool_template::set_no_zero_null): Assert string set is empty.
3105         (Stringpool_template::new_key_offset): New method declaration.
3106         (Stringpool_template::offset_): New data member.
3108 2010-03-15   Rafael Espindola  <espindola@google.com>
3110         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
3111         Add_symbols' constructor.
3112         * readsyms.h (Add_symbols): Remove the input_group member.
3114 2010-03-10  Ian Lance Taylor  <iant@google.com>
3116         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
3117         target to ask whether a reference to a symbol requires a stack
3118         split.
3119         * target.h (Target::is_call_to_non_split): New function.
3120         (Target::do_is_call_to_non_split): Declare virtual function.
3121         * target.cc: Include "symtab.h".
3122         (Target::do_is_call_to_non_split): New function.
3123         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
3125 2010-03-10  Cary Coutant  <ccoutant@google.com>
3127         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
3128         (File_read::open[1]): Remove initial mapping of whole_file_view_.
3129         (File_read::open[2]): Add whole_file_view_ to list of views.
3130         (File_read::make_view): Remove test of whole_file_view_.
3131         (File_read::find_or_make_view): Create whole_file_view_ if
3132         necessary.
3133         (File_read::clear_views): Replace bool parameter with enum;
3134         adjust all callers.  Don't delete views with permanent data;
3135         do delete cached views and views from archives if
3136         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
3137         if clearing the corresponding view.
3138         * fileread.h (File_read::Clear_views_mode): New enum.
3139         (File_read::View::is_permanent_view): New method.
3140         (File_read::clear_views): Replace bool parameter
3141         with enum; adjust all callers.
3142         * options.h (General_options): Change keep_files_mapped option;
3143         add map_whole_files.
3144         * readsyms.cc (Add_symbols::run): Delete sd_ object before
3145         releasing the file.
3146         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
3147         the file.
3149 2010-03-10  David S. Miller  <davem@davemloft.net>
3151         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
3153 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
3155         * icf.cc (get_section_contents): Add '@' marker after processing the
3156         merge reloc.
3158 2010-03-08  Doug Kwan  <dougkwan@google.com>
3160         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
3161         due to a conversion warning.
3162         (Arm_relobj::update_output_local_symbol_count): Check for local
3163         symbol with unset output index.
3165 2010-03-05  Ian Lance Taylor  <iant@google.com>
3167         * options.h (class General_options): Add --spare-dynamic-tags.
3168         * output.cc (Output_data_dynamic::set_final_data_size): Implement
3169         --spare-dynamic-tags.
3171 2010-03-05  Ian Lance Taylor  <iant@google.com>
3173         * incremental.cc: Include "libiberty.h".
3175 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3177         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
3178         function, is_info_ member.
3179         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
3180         (Versions::Versions): Update caller.
3181         (Versions::define_base_version): Likewise.
3182         (Versions::add_def): Likewise.
3184 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
3186         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
3187         (Scan::possible_function_pointer_reloc): New function.
3188         (Scan::local_reloc_may_be_function_pointer): Change to call
3189         possible_function_pointer_reloc.
3190         (Scan::global_reloc_may_be_function_pointer): Ditto.
3191         * icf.h (Icf::check_section_for_function_pointers): Change to reject
3192         relocations in ".data.rel.ro._ZTV" section.
3193         * testsuite/icf_safe_so_test.sh: Change to pass i386.
3194         * testsuite/icf_safe_so_test.cc: Ditto.
3195         * testsuite/icf_safe_test.cc: Ditto.
3196         * testsuite/icf_safe_test.sh: Ditto.
3198 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3199             Ian Lance Taylor  <iant@google.com>
3201         * target-reloc.h (relocate_section): Check the symbol table index
3202         for -1U before setting the local symbol index.
3203         (scan_relocatable_relocs): If copying the relocation, record that
3204         the local symbol is required.
3205         * object.h (Symbol_value::is_output_symtab_index_set): New
3206         function.
3207         (Symbol_value::may_be_discarded_from_output_symtab): New
3208         function.
3209         (Symbol_value::has_output_symtab_entry): New function.
3210         (Symbol_value::needs_output_symtab_entry): Remove.
3211         (Symbol_value::output_symtab_index): Make sure the symbol index is
3212         set.
3213         (Symbol_value::set_output_symtab_index): Make sure the symbol
3214         index is not set.  Make sure the new index is valid.
3215         (Symbol_value::set_must_have_output_symtab_entry): New function.
3216         (Symbol_value::has_output_dynsym_entry): New function.
3217         (Symbol_value::set_output_dynsym_index): Make sure the new index
3218         is valid.
3219         (Sized_relobj::set_must_have_output_symtab_entry): New function.
3220         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
3221         local symbol if permitted.
3222         (Sized_relobj::do_finalize_local_symbols): Call
3223         is_output_symtab_index_set rather than needs_output_symtab_entry.
3224         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
3225         rather than needs_output_symtab_entry.  Call
3226         has_output_dynsym_entry rather than needs_output_dynsym_entry.
3227         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
3228         is_output_symtab_index_set rather than needs_output_symtab_entry.
3229         * testsuite/discard_locals_relocatable_test.c: New file.
3230         * testsuite/discard_locals_test.sh: Test -r.
3231         * testsuite/Makefile.am (check_DATA): Add
3232         discard_locals_relocatable_test1.syms,
3233         discard_local_relocatable_test2.syms.
3234         (MOSTLYCLEANFILES): Likewise.  Also add
3235         discard_locals_relocatable_test1.lout and
3236         discard_locals_relocatable_test2.out.
3237         (discard_locals_relocatable_test1.syms): New target.
3238         (discard_locals_relocatable_test.o): New target.
3239         (discard_locals_relocatable_test1.out): New target.
3240         (discard_locals_relocatable_test2.syms): New target.
3241         (discard_locals_relocatable_test2.out): New target.
3242         (various): Add missing ../ld-new dependencies.
3243         * testsuite/Makefile.in: Rebuild.
3245 2010-03-03  Nick Clifton  <nickc@redhat.com>
3247         * po/fi.po: New Finnish translation.
3249 2010-03-01  Doug Kwan  <dougkwan@google.com>
3251         * layout.cc (Layout::Layout): Force section types of .init_array*,
3252         .preinit_array* and .fini_array* sections.
3253         * output.cc (Output_section::Input_section_sort_entry::has_priority):
3254         Fix check of return value of std::string::find.().
3255         (Output_section::Input_section_sort_compare::operator()): Remove
3256         comment about .init_array.
3257         (Output_section::Input_section_sort_init_fini_compare::operator()):
3258         New method.
3259         (Output_section::sort_attached_input_sections): Handle .init_array
3260         and .fini_array specially.
3261         * output.h (Output_section::Inut_section_sort_compare): Update
3262         comment.
3263         (Output_section::Input_section_sort_init_fini_compare): New struct.
3265 2010-02-26  Doug Kwan  <dougkwan@google.com>
3267         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
3268         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
3269         * testsuite/debug_msg.sh: Avoid matching source line number for
3270         use of global variable undef_int.
3272 2010-02-26  Doug Kwan  <dougkwan@google.com>
3274         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
3275         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
3276         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
3277         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
3278         * options.cc (General_options::General_options): Initialize member
3279         fix_v4bx_.
3280         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
3281         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
3282         and rm_no_fix_v4bx.stdout
3283         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
3284         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
3285         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
3286         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
3287         and arm_no_fix_v4bx.
3288         * Makefile.in: Regenerate.
3289         * testsuite/arm_fix_v4bx.s: New file.
3290         * testsuite/arm_fix_v4bx.sh: Ditto.
3292 2010-02-24  Doug Kwan  <dougkwan@google.com>
3294         * arm.cc (Target_arm::got_section): Make the .got section the first
3295         non RELRO section in the data segment.
3296         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
3297         suffixes of section names.
3299 2010-02-24  Doug Kwan  <dougkwan@google.com>
3301         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
3302         flags and attributes merging if an input file is a binary file.
3303         * fileread.cc (Input_file::open): Record format of original file.
3304         * fileread.h (Input_file::Format): New enum type.
3305         (Input_file::Input_file): Initialize data member format_.
3306         (Input_file::format): New method definition.
3307         (Input_file::format_):: New data member.
3309 2010-02-24  Doug Kwan  <dougkwan@google.com>
3311         * arm.cc (Arm_output_data_got): New class.
3312         (ARM_TCB_SIZE): New constant
3313         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
3314         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
3315         If user uses a script with a SECTIONS clause, issue only a warning
3316         for a misplaced EXIDX input section.  Otherwise, issue an error.
3317         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
3318         garbage collection.
3319         (Target_arm::got_mode_index_entry): Handle static linking.
3320         (Target_arm::Scan::local): Ditto.
3321         (Target_arm::Scan::global): Ditto.
3322         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
3323         all incorrectly implemented relocations.
3324         (Target_arm::fix_exidx_coverage): Pass layout to
3325         Arm_output_section::fix_exidx_coverage.
3326         * layout.cc (Layout::section_name_mapping): Remove trailing dots
3327         from ".ARM.exidx." and ".ARM.extab.".
3329 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3331         * arm.cc (Target_arm::do_finalize_sections): Create attribute
3332         section if it does not already exist.
3333         * attributes.cc (Attributes_section_data::Attributes_section_data):
3334         Don't crash if size is zero.
3336 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3337             Ian Lance Taylor  <iant@google.com>
3339         * gold.cc (queue_middle_tasks): If no input files were opened,
3340         exit.
3341         * workqueue.h (Task_function::Task_function): Assert that there is
3342         a blocker.
3344 2010-02-22  Doug Kwan  <dougkwan@google.com>
3346         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
3347         * icf.cc (get_section_contents): Cast snprintf arguments to long long
3348         types to avoid warnings due to different uint64_t implementations
3349         on different hosts.
3351 2010-02-21  Doug Kwan  <dougkwan@google.com>
3353         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
3354         handling of the maximum backward branch offset.
3355         (Arm_relocate_functions::thumb_branch_common): Ditto.
3356         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
3357         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
3358         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
3359         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
3360         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
3361         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
3362         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
3363         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
3364         thumb_bl_out_of_range thumb_bl_out_of_range.o,
3365         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
3366         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
3367         thumb2_bl_out_of_range.o): New rules.
3368         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
3369         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
3370         thumb2_bl_out_of_range
3371         * testsuite/Makefile.in: Regenerate.
3372         * testsuite/arm_bl_in_range.s: New file.
3373         * testsuite/arm_bl_out_of_range.s: Ditto.
3374         * testsuite/arm_branch_in_range.sh: Ditto.
3375         * testsuite/arm_branch_range.t: Ditto.
3376         * testsuite/thumb2_branch_range.t: Ditto.
3377         * testsuite/thumb_bl_in_range.s: Ditto.
3378         * testsuite/thumb_bl_out_of_range.s: Ditto.
3379         * testsuite/thumb_branch_range.t: Ditto.
3381 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
3383         * gc.h (gc_process_relocs): Change vectors to point to the new list.
3384         Add reloc offset information.
3385         * icf.cc (get_section_contents): Change iterators to point to the new
3386         vectors. Add reloc offset information to the contents.
3387         * icf.h (Icf::Sections_reachable_info): New typedef.
3388         (Icf::Sections_reachable_list): New typedef.
3389         (Icf::Offset_info): New typedef.
3390         (Icf::Reloc_info): New struct typedef.
3391         (Icf::Reloc_info_list): New typedef.
3392         (Icf::symbol_reloc_list): Delete method.
3393         (Icf::addend_reloc_list): Delete method.
3394         (Icf::section_reloc_list): Delete method.
3395         (Icf::reloc_info_list): New method.
3396         (Icf::reloc_info_list_): New member.
3398 2010-02-19  Doug Kwan  <dougkwan@google.com>
3400         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
3401         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
3402         * arm.cc (Arm_relocation_functions): New forward declaration.
3403         (Target_arm::Target_arm): Initialize new data members
3404         got_mod_index_offset_ and tls_base_symbol_defined_.
3405         (Target_arm::Relocate::relocate_tls): New method.
3406         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
3407          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
3408         New methods.
3409         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
3410         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
3411         (Target_arm::got_mod_index_offset_,
3412         Target_arm::tls_base_symbol_defined_): New data members.
3413         (Target_arm::Scan::local, Target::Scan::global,
3414         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
3415         relocations.
3417 2010-02-18  Doug Kwan  <dougkwan@google.com>
3419         * arm.cc (Arm_relobj::find_linked_text_section): New method.
3420         (Arm_relobj::make_exidx_input_section): Pass section index of linked
3421         text section as a parameter becuase some broken tools may not set
3422         the link in section header.
3423         (Target_arm::has_got_section): New method.
3424         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
3425         without any mapping symbol as data only.  Remove warning.
3426         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
3427         link in its section header, try to discover the link by inspecting the
3428         REL31 relocation at the beginning of the section.
3429         (Target_arm::Scan::check_non_pic): Report name of offending relocation
3430         in error message.
3431         (Target_arm::Scan::global): Treat any reference to the symbol
3432         _GLOBAL_OFFSET_TABLE_ as a GOT access.
3434 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
3436         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
3437         (Scan::global_reloc_may_be_function_pointer): New function.
3438         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3439         (Scan::global_reloc_may_be_function_pointer): New function.
3440         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
3441         (Scan::global_reloc_may_be_function_pointer): New function.
3442         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
3443         (Scan::global_reloc_may_be_function_pointer): New function.
3444         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
3445         (Scan::global_reloc_may_be_function_pointer): New function.
3446         (Scan::possible_function_pointer_reloc): New function.
3447         (Target_x86_64::can_check_for_function_pointers): New function.
3448         * gc.h (gc_process_relocs): Scan relocation types to determine if
3449         function pointers were taken for targets that support it.
3450         * icf.cc (Icf::find_identical_sections): Include functions for
3451         folding in safe ICF whose pointer is not taken.
3452         * icf.h (Secn_fptr_taken_set): New typedef.
3453         (fptr_section_id_): New member.
3454         (section_has_function_pointers): New function.
3455         (set_section_has_function_pointers): New function.
3456         (check_section_for_function_pointers): New function.
3457         * options.h: Fix comment for safe ICF option.
3458         * target.h (can_check_for_function_pointers): New function.
3459         * testsuite/Makefile.am: Add icf_safe_so_test test case.
3460         Modify icf_safe_test for X86-64.
3461         * testsuite/Makefile.in: Regenerate.
3462         * testsuite/icf_safe_so_test.cc: New file.
3463         * testsuite/icf_safe_so_test.sh: New file.
3464         * testsuite/icf_safe_test.cc (kept_func_3): New function.
3465         (main): Change to take pointer to function kept_func_3.
3466         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
3467         folding is done correctly for X86-64.
3469 2010-02-12  David S. Miller  <davem@davemloft.net>
3471         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
3472         is_symbolless parameter.
3473         (Output_reloc<SHT_REL>::is_symbolless): New.
3474         (Output_reloc<SHT_REL>::is_symbolless_): New.
3475         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
3476         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
3477         (Output_reloc<SHT_RELA>::is_symbolless): New.
3478         (Output_data_reloc::add_global): Handle is_symbolless.
3479         (Output_data_reloc::add_global_relative): Likewise.
3480         (Output_data_reloc::add_local): Likewise.
3481         (Output_data_reloc::add_local_relative): Likewise.
3482         (Output_data_reloc::add_symbolless_global_addend): New.
3483         (Output_data_reloc::add_symbolless_local_addend): New.
3484         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
3485         is_symbolless.
3486         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
3487         instead of ->is_relative_
3488         (Output_reloc::write): Likewise.
3489         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
3490         (Output_reloc::write_rel): Simplify.
3492         * sparc.cc (Target_sparc::Scan::local): Use
3493         ->add_symbolless_local_addend as needed.
3494         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
3495         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
3496         based upon relocation offset.
3498 2010-02-11  Doug Kwan  <dougkwan@google.com>
3500         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
3501         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
3502         beginning of function.
3503         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
3504         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
3505         parameter is_32bit in calls to should_apply_static_reloc.
3506         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
3507         (check_DATA): Add arm_abs_global.stdout.
3508         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
3509         arm_abs_global.stdout): New rules.
3510         (MOSTLLYCLEANFILES): Add arm_abs_global
3511         * Makefile.in: Regenerate.
3512         * testsuite/arm_abs_global.s: New file.
3513         * testsuite/arm_abs_global.sh: Ditto.
3514         * testsuite/arm_abs_lib.s: Ditto.
3516 2010-02-11  Ian Lance Taylor  <iant@google.com>
3518         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
3519         Read_relocs task.
3520         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
3521         Allocate_commons_task first.
3522         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
3523         task, rather than symtab_lock_.
3524         (Gc_process_relocs::~Gc_process_relocs): New function.
3525         (Gc_process_relocs::is_runnable): Check this_blocker_.
3526         (Gc_process_relocs::locks): Use next_blocker_ rather than
3527         blocker_.
3528         (Scan_relocs::~Scan_relocs): New function.
3529         (Scan_relocs::is_runnable): Check this_blocker_ rather than
3530         symtab_lock_.
3531         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
3532         next_blocker_.
3533         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
3534         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
3535         constructor accordingly.
3536         (class Gc_process_relocs): Likewise.
3537         (class Scan_relocs): Likewise.
3538         * common.h (class Allocate_commons_task): Remove symtab_lock_
3539         field, and corresponding constructor parameter.
3540         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
3541         symtab_lock_.
3542         (Allocate_commons_task::locks): Likewise.
3544 2010-02-11  Ian Lance Taylor  <iant@google.com>
3546         * gold-threads.h (class Once): Define.
3547         (class Initialize_lock): Rewrite as child of Once.
3548         * gold-threads.cc (class Once_initialize): Define.
3549         (once_pointer_control): New static variable.
3550         (once_pointer, once_arg): New static variables.
3551         (c_run_once): New static function.
3552         (Once::Once, Once::run_once, Once::internal_run): New functions.
3553         (class Initialize_lock_once): Remove.
3554         (initialize_lock_control): Remove.
3555         (initialize_lock_pointer): Remove.
3556         (initialize_lock_once): Remove.
3557         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
3558         (Initialize_lock::initialize): Rewrite.
3559         (Initialize_lock::do_run_once): New function.
3560         * archive.cc (Archive::interpret_header): Only clear name if it is
3561         not already empty.
3562         * fileread.cc: Include "gold-threads.h"
3563         (file_counts_lock): New static variable.
3564         (file_counts_initialize_lock): Likewise.
3565         (File_read::release): Only increment counts when using --stats.
3566         Use a lock around the increment.
3567         * parameters.cc (class Set_parameters_target_once): Define.
3568         (set_parameters_target_once): New static variable.
3569         (Parameters::Parameters): Move here from parameters.h.
3570         (Parameters::set_target): Rewrite.
3571         (Parameters::set_target_once): New function.
3572         (Parameters::clear_target): Move here and rewrite.
3573         * parameters.h (class Parameters): Update declarations.  Add
3574         set_parameters_target_once_ field.
3575         (Parameters::Parameters): Move to parameters.cc.
3576         (Parameters::clear_target): Likewise.
3577         * readsyms.cc (Read_symbols::do_group): Create a Start_group
3578         task.
3579         (Start_group::~Start_group): New function.
3580         (Start_group::is_runnable): New function.
3581         (Start_group::locks, Start_group::run): New functions.
3582         (Finish_group::run): Change saw_undefined to size_t.
3583         * readsyms.h (class Start_group): Define.
3584         (class Finish_group): Change saw_undefined_ field to size_t.
3585         (Finish_group::Finish_group): Remove saw_undefined and
3586         this_blocker parameters.  Change all callers.
3587         (Finish_group::set_saw_undefined): New function.
3588         (Finish_group::set_blocker): New function.
3589         * symtab.h (class Symbol_table): Change saw_undefined to return
3590         size_t.  Change saw_undefined_ field to size_t.
3591         * target-select.cc (Set_target_once::do_run_once): New function.
3592         (Target_selector::Target_selector): Initialize set_target_once_
3593         field.  Don't initialize lock_ and initialize_lock_ fields.
3594         (Target_selector::instantiate_target): Rewrite.
3595         (Target_selector::set_target): New function.
3596         * target-select.h (class Set_target_once): Define.
3597         (class Target_selector): Update declarations.  Make
3598         Set_target_once a friend.  Remove lock_ and initialize_lock_
3599         fields.  Add set_target_once_ field.
3601 2010-02-10  Ian Lance Taylor  <iant@google.com>
3603         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
3604         queueing any tasks.
3605         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
3606         (queue_middle_tasks): Add all blockers before queueing any tasks.
3607         (queue_final_tasks): Likewise.
3608         * token.h (Task_token::add_blockers): New function.
3609         * object.h (Input_objects::number_of_relobjs): New function.
3611 2010-02-10  Ian Lance Taylor  <iant@google.com>
3613         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
3614         shared, not if not position independent.
3615         * x86_64.cc (Relocate::relocate_tls): Likewise.
3616         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
3617         (tls_pie_pic_test): New target.
3618         * testsuite/Makefile.in: Rebuild.
3620         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
3621         (tls_test_main_pie.o, tls_test_pie.o): New targets.
3622         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
3623         * testsuite/Makefile.in: Rebuild.
3625 2010-02-09  David S. Miller  <davem@davemloft.net>
3627         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
3628         R_SPARC_RELATIVE using ->add_local_relative().
3629         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
3631         * output.h (Output_data_dynamic::add_section_size): New method
3632         that takes two Output_data objects.
3633         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
3634         entry param.  Handle it in initializers.
3635         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
3636         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
3637         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
3638         arg.
3639         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
3640         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
3641         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
3642         for dynrel_includes_plt.
3643         * i386.cc (Target_i386::do_finalize_sections): Likewise.
3644         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3645         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
3646         before .rela.plt
3647         (Target_sparc::do_finalize_sections): Update to pass true for
3648         dynrel_includes_plt.
3649         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
3650         output before .rela.plt
3651         (Target_powerpc::do_finalize_sections): Update to pass true for
3652         dynrel_includes_plt when 32-bit.
3654 2010-02-08  Doug Kwan  <dougkwan@google.com>
3656         * arm.cc (Arm_relobj::simple_input_section_output_address): New
3657         method.
3658         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
3659         Arm_relobj::scan_section_for_cortex_a8_stubs,
3660         Arm_relobj::do_relocation_section): Instead of calling
3661         Output_section::output_address, use faster
3662         Arm_relobj::simple_input_section_output_address.
3664 2010-02-08  David S. Miller  <davem@davemloft.net>
3666         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
3667         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
3668         relocation helper function.
3670         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
3671         just like R_SPARC_GOT{10,13,22}.
3672         (Target_sparc::Scan::local): Likewise.
3673         (Target_sparc::Relocate:relocate): Likewise.
3675 2010-02-06  Ian Lance Taylor  <iant@google.com>
3677         * configure.ac: Rewrite targetobjs duplicate removal code to use
3678         only shell constructs.
3679         * configure: Rebuild.
3681 2010-02-05  Doug Kwan  <dougkwan@google.com>
3683         PR 11247
3684         * arm.cc (Arm_relobj::section_is_scannable): New method.
3685         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
3686         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
3688 2010-02-04  Doug Kwan  <dougkwan@google.com>
3690         PR 11247
3691         * arm-reloc-property.cc (cstdio): Include.
3692         * configure.ac (targetobjs): Remove duplicates.
3693         * configure: Regenerate.
3694         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
3695         big and little endian version for a given address size.
3697 2010-02-03  Doug Kwan  <dougkwan@google.com>
3699         * arm-reloc-property.cc
3700         (Arm_reloc_property_table::reloc_name_in_error_message): New method
3701         definition.
3702         * arm-reloc-property.h
3703         (Arm_reloc_property_table::get_implemented_static_reloc_property):
3704         New method definition.
3705         (Arm_reloc_property_table::reloc_name_in_error_message): New method
3706         declaration.
3707         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
3708         overflow to N.
3709         (GOT_PREL): Change implemented to Y.
3710         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
3711         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
3712         (Arm_relocate_functions::movw_abs_nc): Remove method.
3713         (Arm_relocate_functions::movt_abs): Ditto.
3714         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
3715         (Arm_relocate_functions::thm_movt_abs): Ditto.
3716         (Arm_relocate_functions::movw_rel_nc): Ditto.
3717         (Arm_relocate_functions::movw_rel): Ditto.
3718         (Arm_relocate_functions::movt_rel): Ditto.
3719         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
3720         (Arm_relocate_functions:thm_movw_rel): Ditto.
3721         (Arm_relocate_functions:thm_movt_rel): Ditto.
3722         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
3723         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
3724         New method definitions.
3725         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
3726         (Arm_relocation_functions::arm_grp_ldr): Ditto.
3727         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
3728         (Arm_relocation_functions::arm_grp_ldc): Ditto.
3729         (Target_arm::Relocate::relocate): Check for non-static or
3730         unimplemented relocation code and exit early.  Change calls to
3731         Target_arm::reloc_uses_thumb_bit and
3732         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
3733         instead.  Refactor code to handle similar relocations to increase
3734         code sharing.  Remove check for unsupported relocation code in switch
3735         statement.
3736         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
3737         relocation property table to find out size.  Change error message to
3738         print out the name of a relocation code instead of the numeric value.
3739         (Target_arm::scan_reloc_for_stub): Use relocation property table
3740         instead of calling Target_arm::reloc_uses_thumb_bit().
3742 2010-02-02  Doug Kwan  <dougkwan@google.com>
3744         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
3745         types of relaxed input section.
3747 2010-02-02  Doug Kwan  <dougkwan@google.com>
3749         * Makefile.am (HFILES): Add arm-reloc-property.h.
3750         (DEFFILES): New.
3751         (TARGETSOURCES): Add arm-reloc-property.cc
3752         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
3753         (libgold_a_SOURCES): $(DEFFILES)
3754         * Makefile.in: Regenerate.
3755         * arm-reloc-property.cc: New file.
3756         * arm-reloc-property.h: New file.
3757         * arm-reloc.def: New file.
3758         * arm.cc: Update comments.
3759         (arm-reloc-property.h): New included header.
3760         (arm_reloc_property_table): New global variable.
3761         (Target_arm::do_select_as_default_target): New method definition.
3762         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
3763         arm-reloc-property to targ_extra_obj.
3764         * parameters.cc (set_parameters_target): Call
3765         Target::select_as_default_target().
3766         * target.h (Target::select_as_default_target): New method definition.
3767         (Target::do_select_as_default_target): Same.
3769 2010-02-01  Doug Kwan  <dougkwan@google.com>
3771         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
3772         first_output_text_section_.
3773         (Arm_exidx_fixup::first_output_text_section): New method definition.
3774         (Arm_exidx_fixup::first_output_text_section_): New data member.
3775         (Arm_exidx_fixup::process_exidx_section): Record the first text
3776         output section seen.
3777         (Arm_output_section::fix_exidx_coverage): Set correct linked section
3778         and entsize in output section header.
3780 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3782         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
3783         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
3784         (Arm_relocate_functions::thm_alu11): New Method.
3785         (Arm_relocate_functions::thm_pc8): New Method.
3786         (Arm_relocate_functions::thm_pc12): New Method.
3787         (Target_arm::Scan::local): Handle the relocations.
3788         (Target_arm::Scan::global): Likewise.
3789         (Target_arm::Relocate::relocate): Likewise.
3790         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3792 2010-01-29  Doug Kwan  <dougkwan@google.com>
3794         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
3795         of relocation types as ld.
3797 2010-01-29  Doug Kwan  <dougkwan@google.com>
3799         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
3800         to public.
3801         (Arm_relocate_functions::thumb_branch_common): Ditto.
3802         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
3803         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
3804         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
3805         Arm_relocate_functions::jump24): Remove.
3806         (Target_arm::Relocate::relocate): Adjust code to call
3807         Arm_relocation_functions::arm_branch_common and
3808         Arm_relocation_functions::thumb_branch_common instead of their removed
3809         wrappers.  Merge switch-cases together to reduce source code size.
3811 2010-01-29  Doug Kwan  <dougkwan@google.com>
3813         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
3814         output_local_symbol_count_needs_update_.
3815         (Arm_relobj::output_local_symbol_count_needs_update,
3816          Arm_relobj::set_output_local_symbol_count_needs_update,
3817          Arm_relobj::update_output_local_symbol_count): New methods.
3818         (Arm_relobj::output_local_symbol_count_needs_update_): New data
3819         member.
3820         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
3821         of pointed function as in a R_ARM_PREL31 relocation.
3822         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
3823         for output local symbol count updating.
3824         (Target_arm::do_relax): Update output local symbol counts in objects
3825         if necessary.
3826         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
3828 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3830         * arm.cc: Added support for the ARM relocations:
3831         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
3832         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
3833         (Arm_relocate_functions::movw_rel_nc): Renamed (was
3834         movw_prel_nc).
3835         (Arm_relocate_functions::movw_rel): New method.
3836         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
3837         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
3838         thm_movw_prel_nc).
3839         (Arm_relocate_functions::thm_movw_rel): New method.
3840         (Arm_relocate_functions::thm_movt_rel): Renamed (was
3841         thm_movt_prel).
3842         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
3843         relocations.
3844         (Target_arm::Scan::global): Likewise.
3845         (Target_arm::Relocate::relocate): Likewise.
3846         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3847         Likewise.
3849 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3851         * arm.cc: Added support for ARM group relocations.
3852         (Target_arm::reloc_needs_sym_origin): New method.
3853         (Arm_relocate_functions::calc_grp_kn): New method.
3854         (Arm_relocate_functions::calc_grp_residual): New method.
3855         (Arm_relocate_functions::calc_grp_gn): New method.
3856         (Arm_relocate_functions::arm_grp_alu): New Method.
3857         (Arm_relocate_functions::arm_grp_ldr): New Method.
3858         (Arm_relocate_functions::arm_grp_ldrs): New Method.
3859         (Arm_relocate_functions::arm_grp_ldc): New Method.
3860         (Target_arm::Scan::local): Handle the ARM group relocations.
3861         (Target_arm::Scan::global): Likewise.
3862         (Target_arm::Relocate::relocate): Likewise.
3863         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3864         Likewise.
3866 2010-01-26  Doug Kwan  <dougkwan@google.com>
3868         * arm.cc (set): Include.
3869         (class Arm_exidx_fixup): Change type of last_input_section_ to const
3870         pointer type.
3871         (Arm_output_section::Text_section_list): New type.
3872         (Arm_output_section::append_text_sections_to_list): New method.
3873         (Arm_output_section::fix_exidx_coverage): Ditto.
3874         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
3875         (Arm_relobj::convert_input_section_to_relaxed_section): Use
3876         Relobj::set_section_offset() instead of
3877         Sized_relobj::invalidate_section_offset().
3878         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
3879         parameter for section headers. Ignore relocation sections for
3880         unallocated sections and EXIDX sections.
3881         (Target_arm::fix_exidx_coverage): New method.
3882         (Target_arm::output_section_address_less_than): New type.
3883         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
3884         linked text section instead of the EXIDX section.
3885         (Arm_output_section::create_stub_group): Add an assertion to check
3886         that this is not an EXIDX output section.
3887         (Arm_output_section::append_text_sections_to_list): New method.
3888         (Arm_output_section::fix_exidx_coverage): Ditto.
3889         (Arm_relobj::scan_sections_for_stubs): Adjust call to
3890         Arm_relobj::section_needs_reloc_stub_scanning.
3891         (Target_arm::do_relax): Fix EXIDX output section coverage in the
3892         first pass.
3893         (Target_arm::fix_exidx_coverage): New method.
3894         * object.h (Relobj::set_output_section): New method.
3895         (Sized_relobj::invalidate_section_offset): Remove method.
3896         (Sized_relobj::do_invalidate_section_offset): Remove method.
3897         (Sized_relobj::do_set_section_offset): Handle offset value -1.
3899 2010-01-25  Doug Kwan  <dougkwan@google.com>
3901         * arm.cc (Arm_exidx_merged_section::do_output_offset):
3902         Fix warning due to signed and unsigned comparison on a 32-bit host.
3904 2010-01-22  Doug Kwan  <dougkwan@google.com>
3906         * arm.cc (Target_arm::do_relax): Record an output section for section
3907         offset adjustment it contains any stub table that has changed.
3908         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
3909         offsets in an output section if necessary.
3910         * output.cc (Output_section::Output_section): Initialize
3911         section_offsets_need_adjustments_.
3912         (Output_section::add_input_section_for_script): Renamed to
3913         Output_section::add_simple_input_section.
3914         (Output_section::save_states): Add a comment.
3915         (Output_section::discard_states): New method defintion.
3916         (Output_section::adjust_section_offsets): Same.
3917         * output.h (Output_section::add_input_section_for_script): Renamed to
3918         Output_section::add_simple_input_section.
3919         (Output_section::discard_states): New method declaration.
3920         (Output_section::adjust_section_offsets): Same.
3921         (Output_section::section_offsets_need_adjustment,
3922         Output_section::set_section_offsets_need_adjustment): New method
3923         definitions.
3924         (Output_section::section_offsets_need_adjustment_): New data member.
3925         * script-sections.cc
3926         (Output_section_element_input::set_section_address): Adjust code for
3927         renaming of Output_section::add_input_section_for_script.
3928         (Orphan_output_section::set_section_address): Same.
3930 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3932         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
3933         Fix_v4bx enum values .
3934         * gold/options.h (General_options): New option definitions.
3935         (General_options::fix_v4bx): New method.
3936         (General_options::Fix_v4bx): New enum.
3937         * gold/options.cc (General_options::parse_fix_v4bx): New method.
3938         (General_options::parse_fix_v4bx_interworking): New method.
3940 2010-01-22  Doug Kwan  <dougkwan@google.com>
3942         * arm.cc (Arm_exidx_fixup): New class.
3944 2010-01-21  Doug Kwan  <dougkwan@google.com>
3946         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
3947         classes.
3948         (Arm_exidx_section_offset_map): New type.
3950 2010-01-21  Doug Kwan  <dougkwan@google.com>
3952         * arm.cc (Arm_exidx_input_section): New class.
3953         (Arm_relobj::exidx_input_section_by_link,
3954         Arm_relobj::exidx_input_section_by_shndx,
3955         Arm_relobj::make_exidx_input_section): New methods.
3956         (read_arm_attributes_section): Remove.
3957         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
3958         information about them.
3959         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
3960         to here.
3962 2010-01-20  Doug Kwan  <dougkwan@google.com>
3964         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
3965         Input_section_specifier to Section_id.
3966         (Target_arm::new_arm_input_section: Adjust code for change of key
3967         type.
3968         (Target_arm::find_arm_input_section): Ditto.
3969         * gc.h (object.h): Include for Section_id nand Section_id_hash.
3970         (Section_id): Remove.
3971         (Garbage_collection::Section_id_hash): Remove.
3972         * icf.h (object.h): Include for Section_id nand Section_id_hash.
3973         (Section_id): Remove.
3974         (Icf::Section_id_hash): Remove.
3975         * object.h (Section_id, Const_section_id, Section_id_hash,
3976         Const_section_id_hash): New type definitions.
3977         * output.cc (Output_section::add_relaxed_input_section): Change to
3978         use Const_section_id instead of Input_section_specifier as key type.
3979         (Output_section::add_merge_input_section): Ditto.
3980         (Output_section::build_relaxation_map): Change to use Section_id
3981         instead of Input_section_specifier as key type.
3982         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3983         Ditto.
3984         (Output_section::convert_input_sections_to_relaxed_sections): Change
3985         to use Const_section_id instead of Input_section_specifier as key type.
3986         (Output_section::find_merge_section): Ditto.
3987         (Output_section::find_relaxed_input_section): Ditto.
3988         * output.h (Input_section_specifier): Remove class.
3989         (Output_section::Output_section_data_by_input_section_map): Change
3990         key type to Const_section_id.
3991         (Output_section::Output_relaxed_input_section_by_input_section_map):
3992         Ditto.
3993         (Output_section::Relaxation_map): Change key type to Section_id.
3995 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3997         * gold/arm.cc: Added support for R_ARM_V4BX relocation
3998         (class Arm_v4bx_stub): New class.
3999         (DEF_STUBS): Updated definition to support v4_veneer_bx.
4000         (Stub_factory::make_arm_v4bx_stub): New method.
4001         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4002         (Stub_table::empty): Handle v4bx stubs.
4003         (Stub_table::add_arm_v4bx_stub): New method.
4004         (Stub_table::find_arm_v4bx_stub): New method.
4005         (Arm_relocate_functions::v4bx): New method.
4006         (Target_arm::fix_v4bx): New method.
4007         (Target_arm::Target_arm): Handle R_ARM_V4BX.
4008         (Stub_table::relocate_stubs): Likewise.
4009         (Stub_table::do_write): Likewise.
4010         (Stub_table::update_data_size_and_addralign): Likewise.
4011         (Stub_table::finalize_stubs):  Likewise.
4012         (Target_arm::Scan::local): Likewise.
4013         (Target_arm::Scan::global): Likewise.
4014         (Target_arm::do_finalize_sections): Likewise.
4015         (Target_arm::Relocate::relocate): Likewise.
4016         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4017         Likewise.
4018         (Target_arm::scan_reloc_for_stub): Likewise.
4019         (Target_arm::scan_reloc_section_for_stubs): Likewise.
4021 2010-01-19  Ian Lance Taylor  <iant@google.com>
4023         * output.cc (Output_section_headers::do_sized_write): Write large
4024         segment count to sh_info field.
4025         (Output_file_header::do_sized_write): For large segment count,
4026         write PN_XNUM to e_phnum field.
4028 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4030         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4031         (Arm_relocate_functions::thm_jump8): New function.
4032         (Arm_relocate_functions::thm_jump11): New function.
4033         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4034         R_ARM_THM_JUMP11.
4035         (Target_arm::Scan::global): Likewise.
4036         (Target_arm::Relocate::relocate): Likewise.
4037         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4038         Likewise.
4040 2010-01-14  Doug Kwan  <dougkwan@google.com>
4042         * arm.cc (map, utility): Include headers.
4043         (Target_arm::apply_cortex_a8_workaround): New method.
4044         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4045         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4046         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4047         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4048         the --[no-]fix-cortex-a8 command line options.
4049         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
4050         (Target_arm::relocate_stub): Use addend in instruction template.
4051         * options.h (DEFINE_bool): Set the user-set flag.
4052         (General_options): Add --[no-]-fix-cortex options.
4053         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
4054         : Update fast look-up map after conversion.
4056 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
4058         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4059         in the first pass of do_layout.
4061 2010-01-13  Doug Kwan  <dougkwan@google.com>
4063         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4064         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
4065         apparent compiler problem of not folding static constant integral
4066         data members of elfcpp::Elf_sizes<32>.
4068 2010-01-13  Doug Kwan  <dougkwan@google.com>
4070         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
4071         Arm_relobj::section_needs_cortex_a8_stub_scanning,
4072         Arm_relobj::scan_section_for_cortex_a8_erratum,
4073         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
4074         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
4075         sections to scan for relocation stubs into a new method
4076         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
4077         relocation and Cortex-A8 stub scanning.
4078         (Target_arm::do_relax): Force stubs to be after stubbed sections
4079         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
4080         the beginning of a new relaxation pass.  Update a comment.
4081         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
4083 2010-01-12  Ian Lance Taylor  <iant@google.com>
4085         * target-reloc.h (visibility_error): New inline function.
4086         (relocate_section): Call visibility_error.
4087         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
4088         (MOSTLYCLEANFILES): Likewise.
4089         (protected_4_pic.o, protected_3.err): New targets.
4090         * testsuite/protected_4.cc: New file.
4092 2010-01-12  Doug Kwan  <dougkwan@google.com>
4094         * arm.cc (Cortex_a8_reloc): New class.
4095         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
4096         and cortex_a8_relocs_info_.
4097         (Target_arm::fix_cortex_a8): New method definition.
4098         (Target_arm::Cortex_a8_relocs_info): New type.
4099         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
4100         New data member declarations.
4101         (Target_arm::scan_reloc_for_stub): Record information about
4102         relocations for THUMB branches that might be exempted from the
4103         Cortex-A8 workaround.
4104         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
4105         at the beginning of a relaxation pass.
4107 2010-01-12  Doug Kwan  <dougkwan@google.com>
4109         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
4110         (Arm_relobj::Mapping_symbol_position,
4111          Arm_reloj::Mapping_symbol_position_less,
4112          Arm_relobj::Mapping_symbols_info): New types.
4113         (Target_arm::is_mapping_symbol_name): New method definition.
4114         (Arm_relobj::do_count_local_symbols): Save information about mapping
4115         symbols.
4117 2010-01-11  Doug Kwan  <dougkwan@google.com>
4119         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
4120         Arm_relocate_functions::thumb32_branch_upper,
4121         Arm_relocate_functions::thumb32_branch_lower,
4122         Arm_relocate_functions::thumb32_cond_branch_offset,
4123         Arm_relocate_functions::thumb32_cond_branch_upper,
4124         Arm_relocate_functions::thumb32_cond_branch_lower,
4125         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
4126         branch offset encoding.
4127         (Arm_relocate_functions::thumb_branch_common): Use new branch
4128         offset encoding methods to avoid code duplication.
4129         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
4130         (Stub_addend_reader::operator()): Use new branch encoding method
4131         to avoid code duplication.
4133 2010-01-11  Doug Kwan  <dougkwan@google.com>
4135         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
4136         (Target_arm::do_finalize_sections): Define special EXIDX section
4137         symbols only if referenced.
4138         * gc.h (Garbage_collection::add_reference): New method.
4139         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
4140         code duplication.
4142 2010-01-11  Ian Lance Taylor  <iant@google.com>
4144         * script.cc (Version_script_info::build_expression_list_lookup):
4145         Change complaing about duplicate wildcard match from error to
4146         warning.
4148         * script.cc (class Lazy_demangler): Recreate--revert part of patch
4149         of 2009-12-30.
4150         (Version_script_info::Version_script_info): Initialize globs_,
4151         default_version_, default_is_global_, and exact_.  Don't
4152         initialize globals_ or locals_.
4153         (Version_script_info::build_lookup_tables): Build local symbols
4154         first.
4155         (Version_script_info::unquote): New function.
4156         (Version_script_info::add_exact_match): New function.
4157         (Version_script_info::build_expression_list_lookup): Remove lookup
4158         parameter.  Add is_global parameter.  Change all callers.  Handle
4159         wildcard pattern specially.  Unquote pattern.  Call
4160         add_exact_match.
4161         (Version_script_info::get_name_to_match): New function.
4162         (Version_script_info::get_symbol_version): New function.
4163         (Version_script_info::get_symbol_version_helper): Remove.
4164         (Version_script_info::check_unmatched_names): Call unquote.
4165         * script.h (class Version_script_info): Change get_symbol_version
4166         to be non-inline and add is_global parameter; change all callers.
4167         Rewrite symbol_is_local.  Update declarations.  Define struct
4168         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
4169         Remove globals_ and locals_ members.  Add exact_, globs_,
4170         default_version_, is_global_.
4171         (Version_script_info::Glob): Remove pattern, add expression and
4172         is_global.  Update constructor.  Change all callers.
4173         * dynobj.cc (Versions::finalize): Mark the version symbol as the
4174         default version.
4175         (Versions::symbol_section_contents): If a symbol is undefined, or
4176         defined in a dynamic object, set the version index to
4177         VER_NDX_LOCAL.
4178         * symtab.cc (Symbol_table::add_from_relobj): Don't call
4179         symbol_is_local.
4180         (Symbol_table::add_from_pluginobj): Likewise.
4181         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
4183 2010-01-11  Doug Kwan  <dougkwan@google.com>
4185         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
4186         (incremental_dump_LDADD): Add linking option for libintl.
4187         * Makefile.in: Regenerate.
4189 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4191         PR gold/11144
4192         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
4193         instead of -Ds.
4194         * testsuite/Makefile.in: Regenerated.
4196 2010-01-10  Doug Kwan  <dougkwan@google.com>
4198         * options.h (DEFINE_var): Use parentheses around argument varname__
4199         in macro body to avoid any unintended subsequent substitutions.
4201 2010-01-10  Ian Lance Taylor  <iant@google.com>
4203         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
4204         candidates before doing symbol resolution.
4206         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
4207         ODR candidates if only one is weak.
4209 2010-01-08  Ian Lance Taylor  <iant@google.com>
4211         * script.cc (Version_script_info::build_expression_list_lookup):
4212         Don't warn about ambiguous version, just record the ambiguity.
4213         (Version_script_info::get_symbol_version_helper): Give error if
4214         version is ambiguous.
4216 2010-01-08  Doug Kwan  <dougkwan@google.com>
4218         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
4219           prev_data_size_ and prev_addralign_.  Remove initializer for
4220           deleted data member has_been_changed_.
4221           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
4222           to determine if the table is empty.
4223           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
4224           Remove.
4225           (Stub_table::add_reloc_stub): Define method in class definition
4226           instead of just declaring it there.
4227           (Stub_table::add_cortex_a8_stub): New method definition.
4228           (Stub_table::update_data_size_and_addralign): Ditto.
4229           (Stub_table::finalize_stubs): Ditto.
4230           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
4231           (Stub_table::do_addralign_): Return address alignment in the
4232           (Stub_table::do_reset_address_and_file_offset): Define method in
4233           class definition instead of declaring it there.  Set current data
4234           size to be the data size of the previous pass.
4235           (Stub_table::set_final_data_size): Use current data size as the
4236           final data size.
4237           (Stub_table::relocate_stub): Change parameter type of stub from
4238           Reloc_stub pointer to Stub pointer.
4239           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
4240           (Stub_table::Cortex_a8_stub_list): New typedef.
4241           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
4242            Stub_table::prev_addralign_): New data member.
4243           (Arm_relobj::Arm_relobj): Initialize data member
4244           section_has_cortex_a8_workaround_.
4245           (Arm_relobj::section_has_cortex_a8_workaround,
4246            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
4247            definitions.
4248           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
4249           declarations.
4250           (Target_arm::relocate_stub): Change parameter type of stub from
4251           Reloc_stub pointer to Stub pointer.
4252           (Insn_template::size, Insn_template::alignment): Handle
4253           THUMB16_SPECIAL_TYPE.
4254           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
4255            Stub_table::update_data_size_and_addralign,
4256            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
4257           definitions.
4258           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
4259           (Stub_table::do_write): Ditto.
4260           (Target_arm::do_relax): Adjust code for changes in Stub_table.
4262 2010-01-08  Ian Lance Taylor  <iant@google.com>
4264         PR 11108
4265         * symtab.h (class Symbol): Remove fields is_target_special_ and
4266         has_plt_offset_.  Add field is_defined_in_discarded_section_.
4267         (Symbol::is_defined_in_discarded_section): New function.
4268         (Symbol::set_is_defined_in_discarded_section): New function.
4269         (Symbol::has_plt_offset): Rewrite.
4270         (Symbol::set_plt_offset): Verify that new offset is not -1U.
4271         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
4272         Don't initialize is_target_special_ or has_plt_offset_.
4273         Initialize is_defined_in_discarded_section_.
4274         (Symbol_table::add_from_relobj): If appropriate, set
4275         is_defined_in_discarded_section.
4276         * resolve.cc (Symbol::override_base_with_special): Don't test
4277         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
4278         * target-reloc.h (relocate_section): Do special handling for
4279         symbols defined in discarded sections for global symbols as well
4280         as local symbols.
4282 2010-01-08  Ian Lance Taylor  <iant@google.com>
4284         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
4285         the SHT_SYMTAB case.
4287 2010-01-08  Ian Lance Taylor  <iant@google.com>
4289         * object.cc (Sized_relobj::do_layout): Don't get confused if
4290         layout_eh_frame returns NULL.
4292 2010-01-08  Ian Lance Taylor  <iant@google.com>
4294         PR 11084
4295         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
4296         dynamic symbol table, use the normal symbol table.
4297         (Sized_dynobj::do_read_symbols): Remove assertion about type of
4298         symbol table.
4300 2010-01-08  Ian Lance Taylor  <iant@google.com>
4302         PR 11072
4303         * layout.cc (Layout::include_section): Remove .gnu_debuglink
4304         sections.
4306 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
4308         * version.cc (print_version): Change to "Copyright 2010".
4310 2010-01-08  Ian Lance Taylor  <iant@google.com>
4312         PR 10287
4313         PR 11063
4314         * i386.cc (class Target_i386): Change return type of plt_section
4315         to be non-const.
4316         (class Output_data_plt_i386): Add tls_desc_rel_ field.
4317         (Output_data_plt_i386::Output_data_plt_i386): Initialize
4318         tls_desc_rel_ field.
4319         (Output_data_plt_i386::rel_tls_desc): New function.
4320         (Target_i386::rel_tls_desc_section): New function.
4321         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
4322         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
4323         R_386_TLS_DESC reloc in rel_tls_desc_section.
4324         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
4325         Define struct Tlsdesc_info.
4326         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
4327         (Target_x86_64::do_reloc_symbol_index): New function.
4328         (Target_x86_64::add_tlsdesc_info): New function.
4329         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
4330         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
4331         tlsdesc_rel_ field.
4332         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
4333         all callers.
4334         (Output_data_plt_x86_64::rela_tlsdesc): New function.
4335         (Target_x86_64::rela_tlsdesc_section): New function.
4336         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
4337         handling.
4338         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
4339         (Target_x86_64::do_reloc_addend): New function.
4340         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
4341         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
4342         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
4343         (Output_reloc::type): New function.
4344         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
4345         (Output_reloc::is_target_specific): New function.
4346         (Output_reloc::target_arg): New function.
4347         (class Output_reloc) [SHT_RELA]: Add four new constructors for
4348         absolute relocs and target specific relocs.
4349         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
4350         add_target_specific.
4351         (class Output_data_reloc) [SHT_RELA]: Likewise.
4352         * output.cc (Output_reloc::Output_reloc): Add four new versions
4353         for absolute relocs and target specific relocs.
4354         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
4355         (Output_reloc::get_symbol_index): Likewise.
4356         (Output_reloc::local_section_offset): Check that local_sym_index_
4357         is not TARGET_CODE or 0.
4358         (Output_reloc::symbol_value): Likewise.
4359         (Output_reloc::write) [SHT_RELA]: Call target for target specific
4360         reloc.
4361         * target.h (class Target): Add reloc_symbol_index and reloc_addend
4362         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
4363         functions.
4364         * layout.cc (add_target_dynamic_tags): Use output section for
4365         DT_PLTRELSZ and DT_JMPREL.
4367 2010-01-07  Ian Lance Taylor  <iant@google.com>
4369         PR 11061
4370         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
4371         function.
4372         (class Output_data_reloc_generic): Define.
4373         (class Output_data_reloc_base): Change base class to
4374         Output_data_reloc_generic.  Change add() method to call
4375         bump_relative_reloc_count for a relative reloc.  Remove
4376         sort_relocs_ field.
4377         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
4378         to sort_relocs().
4379         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
4380         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
4381         appropriate.
4382         * layout.h (class Layout): Update declaration.
4384 2010-01-07  Ian Lance Taylor  <iant@google.com>
4386         * output.h (class Output_data): Add const version of
4387         output_section and do_output_section.
4388         (class Output_section_data): Add const version of
4389         do_output_section.
4390         (class Output_section): Likewise.
4391         * layout.cc (Layout::add_target_dynamic_tags): New function.
4392         * layout.h (class Layout): Update declarations.
4393         * arm.cc (Target_arm::do_finalize_sections): Use
4394         add_target_dynamic_tags.
4395         * i386.cc (Target_i386::do_finalize_sections): Likewise.
4396         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
4397         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
4398         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4400 2010-01-07  Ian Lance Taylor  <iant@google.com>
4402         PR 11042
4403         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
4404         object as needed.
4406 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
4407             Ian Lance Taylor  <iant@google.com>
4409         PR 11019
4410         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
4411         Xindex::read_symtab_xindex.
4413 2010-01-07  Doug Kwan  <dougkwan@google.com>
4415         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
4416         (Insn_template::thumb16_bcond_insn): New method declaration.
4417         (Insn_template): Fix spelling.
4418         (Stub::thumb16_special): New method declaration.
4419         (Stub::do_write): Define virtual method which was previously pure
4420         virtual.
4421         (Stub::do_thumb16_special): New method declaration.
4422         (Stub::do_fixed_endian_write): New template member.
4423         (Reloc_stub::do_write): Remove.
4424         (Reloc_stub::do_fixed_endian_write): Remove.
4425         (Cortex_a8_stub): New class definition.
4426         (Stub_factory::make_cortex_a8_stub): New method definition.
4427         (Stub_factory::Stub_factory): Add missing static storage class
4428         qualifier for elf32_arm_stub_a8_veneer_blx.
4430 2010-01-07  Ian Lance Taylor  <iant@google.com>
4432         PR 10980
4433         * options.h (class General_options): Add --warn-unresolved-symbols
4434         and --error-unresolved-symbols.
4435         * errors.cc (Errors::undefined_symbol): Implement
4436         --warn-unresolved-symbols.
4438         * options.h (class General_options): Add -z text and -z textoff.
4439         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
4441 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
4443         * gc.h (Garbage_collection::Cident_section_map): New typedef.
4444         (Garbage_collection::cident_sections): New function.
4445         (Garbage_collection::add_cident_section): New function.
4446         (Garbage_collection::cident_sections_): New member.
4447         (gc_process_relocs): Add references to sections whose names are C
4448         identifiers.
4449         * gold.h (cident_section_start_prefix): New constant.
4450         (cident_section_stop_prefix): New constant.
4451         (is_cident): New function.
4452         * layout.cc (Layout::define_section_symbols): Replace string constants
4453         with the newly defined constants.
4454         * object.cc (Sized_relobj::do_layout): Track sections whose names are
4455         C identifiers.
4456         * testsuite/Makefile.am: Add gc_orphan_section_test.
4457         * testsuite/Makefile.in: Regenerate.
4458         * testsuite/gc_orphan_section_test.cc: New file.
4459         * testsuite/gc_orphan_section_test.sh: New file.
4461 2010-01-06  Ian Lance Taylor  <iant@google.com>
4463         PR 10980
4464         * options.h (class General_options): Add --warn-shared-textrel.
4465         * layout.cc (Layout::finish_dynamic_section): Implement
4466         --warn-shared-textrel.
4468         PR 10980
4469         * options.h (class General_options): Add --warn-multiple-gp.
4471 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4473         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
4474         $(THREADSLIB) and $(LIBDL).
4475         * Makefile.in: Rebuild.
4477 2010-01-06  Ian Lance Taylor  <iant@google.com>
4479         PR 10980
4480         * options.cc (General_options::parse_section_start): New function.
4481         (General_options::section_start): New function.
4482         (General_options::General_options): Initialize all members.
4483         * options.h: Include <map>
4484         (class General_options): Add --section-start.  Add section_starts_
4485         member.
4486         * layout.cc (Layout::attach_allocated_section_to_segment): If
4487         --section-start was used, set the address of the segment.  Remove
4488         local sort_sections.
4489         (Layout::relaxation_loop_body): If the address of the load segment
4490         has been set by --section-start, don't use it.
4491         * output.h (Output_segment::update_flags_for_output_section): New
4492         function.
4493         * output.cc (Output_segment::add_output_section): Call
4494         update_flags_for_output_section.
4496 2010-01-05  Ian Lance Taylor  <iant@google.com>
4498         PR 10980
4499         * options.h (class General_options): Add --undefined-version.
4500         * script.cc (struct Version_expression): Add was_matched_by_symbol
4501         field.
4502         (Version_script_info::matched_symbol): New function.
4503         (Version_script_info::get_symbol_version_helper): Call
4504         matched_symbol.
4505         (Version_script_info::check_unmatched_names): New function.
4506         * script.h (class Version_script_info): Update declarations.
4507         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
4509         * options.h (class General_options): Use DEFINE_bool_alias for
4510         allow_multiple_definition.
4511         * resolve.cc (Symbol_table::should_override): Don't test
4512         allow_multiple_definition.
4514         PR 10980
4515         * options.h (class General_options): Add --cref.
4516         * main.cc (main): Print cref table if --cref.  Don't close mapfile
4517         until after printing cref table.
4518         * cref.cc: Include "symtab.h".
4519         (class Cref_inputs): Define Cref_table_compare and Cref_table.
4520         (Cref_table_compare::operator()): New function.
4521         (Cref_inputs::gather_cref): New function.
4522         (filecol): New static const.
4523         (Cref_inputs::print_cref): New function.
4524         (Cref::print_cref): New function.
4525         * cref.h: Include <cstdio>.
4526         (class Cref): Update declarations.
4527         * mapfile.h (Mapfile::file): New function.
4528         * object.h (class Object): Define Symbols.  Declare virtual
4529         do_get_global_symbols.
4530         (Object::get_global_symbols): New function.
4531         * object.cc (Input_objects::add_object): Pass object to cref_ if
4532         --cref.
4533         (Input_objects::archive_start): Likewise.
4534         (Input_objects::archive_stop): Likewise.
4535         (Input_objects::print_cref): New function.
4536         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
4537         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
4538         --cref.
4539         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
4540         function.
4541         * plugin.h (class Sized_pluginobj): Update declarations.
4543 2010-01-05  Ian Lance Taylor  <iant@google.com>
4545         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
4546         to is_default_version.  Rename insdef to insdefault.
4547         (Symbol_table::add_from_relobj): Rename def to is_default_version
4548         and local to is_forced_local.
4549         (Symbol_table::add_from_pluginobj): Likewise.
4550         (Symbol_table::add_from_dynobj): Likewise.
4551         (Symbol_table::define_special_symbol): Rename insdef to
4552         insdefault.
4554 2010-01-04  Ian Lance Taylor  <iant@google.com>
4556         PR 10980
4557         * options.h (class General_options): Add
4558         --allow-multiple-definition and -z muldefs.
4559         * resolve.cc (Symbol_table::should_override): Don't warn about a
4560         multiple symbol definition if --allow-multiple-definition or -z
4561         muldefs.
4563         PR 10980
4564         * options.h (class General_options): Add --add-needed and
4565         --copy-dt-needed-entries.  Tweak --as-needed help entry.
4566         * object.cc (Input_objects::check_dynamic_dependencies): Give an
4567         error if --copy-dt-needed-entries aka --add-needed is used and
4568         would cause a change in behaviour.
4570         PR 10980
4571         * options.h (class General_options): Add -G as a short version of
4572         --shared.  Add no-op options -assert, -g, and -i.
4574 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
4576         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
4577         check for .text or .gnu.linkonce.t sections.
4578         * icf.cc (Icf::find_identical_sections): Ditto.
4579         Change the detection for mangled function name within the section
4580         name.
4581         * icf.h (is_section_foldable_candidate): New function.
4583 2009-12-30  Ian Lance Taylor  <iant@google.com>
4585         PR 10980
4586         * options.h (class General_options): Permit two dashes with
4587         --retain-symbols-file.
4589 2009-12-30  Ian Lance Taylor  <iant@google.com>
4591         PR 10979
4592         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
4593         don't put the file header and segment headers in the text
4594         segment.
4596         PR 10979
4597         * common.cc (Sort_commons::operator()): Stabilize sort when both
4598         entries are NULL.
4599         (Symbol_table::do_allocate_commons_list): When allocating common
4600         symbols, skip a symbol which is no longer common.
4601         * symtab.h (Symbol::is_common): Test whether the symbol comes from
4602         an object before checking its type.
4603         * testsuite/common_test_2.c: New file.
4604         * testsuite/common_test_3.c: New file.
4605         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
4606         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
4607         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
4608         (common_test_2_pic.o, common_test_2.so): New targets.
4609         (common_test_3_pic.o, common_test_3.so): New targets.
4610         * testsuite/Makefile.in: Rebuild.
4612         PR 10979
4613         * script.cc (read_input_script): If we see a new SECTIONS clause,
4614         and we have added an input section, give an error.
4615         * layout.h (class Layout): Add have_added_input_section function.
4616         Add have_added_input_section_ field.
4617         * layout.cc (Layout::Layout): Initialize
4618         have_added_input_section_.
4619         (Layout::layout): Set have_added_input_section_.
4620         (Layout::layout_eh_frame): Likewise.
4622 2009-12-30  Ian Lance Taylor  <iant@google.com>
4624         PR 10931
4625         * options.h (class General_options): Add --sort-common option.
4626         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
4627         * common.cc (Sort_common): Add sort_order parameter to
4628         constructor.  Add sort_order_ field.
4629         (Sort_commons::operator): Check sort_order_.
4630         (Symbol_table::allocate_commons): Determine the sort order.
4631         (Symbol_table::do_allocate_commons): Add sort_order parameter.
4632         Change all callers.
4633         (Symbol_table::do_allocate_commons_list): Likewise.
4635 2009-12-30  Ian Lance Taylor  <iant@google.com>
4637         PR 10916
4638         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
4639         symbols from this object, don't change the visibility of an
4640         undefined symbol.
4641         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
4643 2009-12-30  Ian Lance Taylor  <iant@google.com>
4645         PR 10861
4646         * script.h (class Version_script_info): Define Language enum.
4647         Update declarations.  Define Glob, Exact, and Lookup types.  Add
4648         new fields globals_, locals_, and is_finalized_.
4649         * script.cc: Various formatting fixes.
4650         (class Parser_closure): Change language_stack_ from a vector of
4651         std::string to one of Version_script_info::Language.  Adjust all
4652         uses accordingly.
4653         (class Lazy_demangler): Remove.
4654         (struct Version_expression): Change language from std::string to
4655         Version_script_info::Language.
4656         (Version_script_info::Version_script_info): New function.
4657         (Version_script_info::~Version_script_info): Don't call clear.
4658         (Version_script_info::finalize): New function.
4659         (Version_script_info::build_lookup_tables): New function.
4660         (Version_script_info::build_expression_list_lookup): New
4661         function.
4662         (Version_script_info::get_symbol_version_helper): Rewrite to use
4663         lookup tables.
4664         (Version_script_info::print_expression_list): Adjust to use
4665         Version_script_info::Language.
4666         (script_push_lex_into_version_mode): Check that the version script
4667         has not been finalized.
4668         (version_script_push_lang): Change language string to
4669         Version_script_info::Language.
4670         * options.cc (Command_line::version_script): New function.
4671         * options.h (class General_options): Add finalize_dynamic_list
4672         function.  Change version_script from declaration to definition.
4673         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
4674         * testsuite/version_script.map: Remove duplicate def of foo.
4675         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
4676         version_script.map.
4677         * testsuite/Makefile.in: Rebuild.
4679 2009-12-30  Ian Lance Taylor  <iant@google.com>
4681         PR 10843
4682         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
4683         if the input symbol index is 0, make the output symbol index 0.
4685 2009-12-30  Ian Lance Taylor  <iant@google.com>
4687         PR 10670
4688         * options.h (class General_options): Add -x/--discard-all.
4689         * object.cc (Sized_relobj::do_count_local_symbols): Handle
4690         --discard-all.  If the local symbol needs a dynamic entry, check
4691         that before handling --discard-locals.
4693 2009-12-30  Ian Lance Taylor  <iant@google.com>
4695         PR 10450
4696         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
4697         flags to PF_R.
4698         (Output_segment::add_output_section): Don't change the flags if
4699         the type is PT_TLS.
4701         PR 10450
4702         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
4703         GNU hash table if they need a dynamic value.  Otherwise, don't add
4704         them if they are defined in a dynamic object or are forced local.
4706 2009-12-29  Ian Lance Taylor  <iant@google.com>
4708         PR 10450
4709         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
4710         .gnu.hash table for a 32-bit target.
4712         PR 10450
4713         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
4714         regular and a dynamic object only needs a dynamic symbol table
4715         entry if it is externally visible.
4717         PR 10450
4718         * i386.cc (class Target_i386): Initialize global_offset_table_ in
4719         constructor.  Add global_offset_table_ field.
4720         (Target_i386::got_section): Set global_offset_table_.
4721         (Target_i386::do_finalize_sections): Set global_offset_table_
4722         size.
4723         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
4724         in constructor.  Add global_offset_table_ field.
4725         (Target_x86_64::got_section): Set global_offset_table_.
4726         (Target_x86_64::do_finalize_sections): Set global_offset_table_
4727         size.
4729         * layout.cc (Layout::Layout): Initialize increase_relro_.
4730         (Layout::get_output_section): Add is_relro, is_last_relro, and
4731         is_first_non_relro parameters.  Change all callers.
4732         (Layout::choose_output_section): Likewise.
4733         (Layout::add_output_section_data): Likewise.
4734         (Layout::make_output_section): Likewise.
4735         (Layout::set_segment_offsets): Clear increase_relro when using a
4736         linker script.
4737         * layout.h (class Layout): Add increase_relro method.  Add
4738         increase_relro_ field.  Update declarations.
4739         * output.cc (Output_section::Output_section): Initialize
4740         is_last_relro_ and is_first_non_relro_.
4741         (Output_segment::add_output_section): Group relro sections is
4742         do_sort is true.  Handle is_last_relro and is_first_non_relro.
4743         (Output_segment::maximum_alignment): Remove relro handling.
4744         (Output_segment::set_section_addresses): Add increase_relro
4745         parameter.  Change all callers.  Add initial alignment to align
4746         relro sections on separate page.  Remove old relro handling.
4747         (Output_segment::set_section_list_addresses): Remove in_relro
4748         parameter.  Change all callers.
4749         (Output_segment::set_offset): Add increase parameter.  Change all
4750         callers.  Remove old relro handling.
4751         * output.h (class Output_section): Add new methods: is_last_relro,
4752         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
4753         Add is_last_relro_ and is_first_non_relro_ fields.
4754         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
4755         Create separate .got.plt section.  Call increase_relro.
4756         * x86_64.cc (Target_x86_64::got_section): Likewise.
4757         * testsuite/relro_script_test.t: Add .got.plt.
4759         PR 10450
4760         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
4761         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
4762         (Layout::finalize): Call set_dynamic_symbol_size.
4763         (Layout::set_dynamic_symbol_size): New function.
4764         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
4765         set_dynamic_symbol_size.
4767         PR 10450
4768         * output.h (class Output_section): Add is_entsize_zero_ field.
4769         * output.cc (Output_section::Output_section): Initialize
4770         is_entsize_zero_.
4771         (Output_section::set_entsize): If two different entsizes are
4772         requested, force it to zero.
4773         (Output_section::add_input_section): Set flags for .debug_str
4774         before updating section flags.  Set entsize.
4775         (Output_section::update_flags_for_input_section): Set SHF_MERGE
4776         and SHF_STRING if all input sections have those flags.
4778 2009-12-29   Rafael Espindola  <espindola@google.com>
4780         * main.cc (main): Fix the sys time reporting.
4781         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
4782         reporting.
4784 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
4786         * options.cc (General_options::parse_version): Allow -v to exit
4787         without an error if there is nothing to link.
4789 2009-12-29  Ian Lance Taylor  <iant@google.com>
4791         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
4792         using a version of gcc before 4.1.
4793         * configure: Rebuild.
4795 2009-12-28  Chris Demetriou  <cgd@google.com>
4797         * attributes.cc (Output_attributes_section_data::do_write): Use
4798         std::vector::front rather than std::vector::data.
4800 2009-12-28  Ian Lance Taylor  <iant@google.com>
4802         * symtab.h (class Symbol_table): Add enum Defined.
4803         * resolve.cc (Symbol_table::should_override): Add defined
4804         parameter.  Change all callers.  Test whether object is NULL
4805         before calling a method on it.
4806         (Symbol_table::report_resolve_problem): Add defined parameter.
4807         Change all callers.
4808         (Symbol_table::should_override_with_special): Likewise.
4809         * symtab.cc (Symbol_table::define_in_output_data): Add defined
4810         parameter.  Change all callers.
4811         (Symbol_table::do_define_in_output_data): Likewise.
4812         (Symbol_table::define_in_output_segment): Likewise.
4813         (Symbol_table::do_define_in_output_segment): Likewise.
4814         (Symbol_table::define_as_constant): Likewise.
4815         (Symbol_table::do_define_as_constant): Likewise.
4816         * script.h (class Symbol_assignment): Add is_defsym parameter to
4817         constructor; change all callers.
4818         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
4819         parameter.  Change all callers.  Add is_defsym_ field.
4820         (class Parser_closure): Add parsing_defsym parameter to
4821         constructor; change all callers.  Add parsing_defsym accessor
4822         function.  Add parsing_defsym_ field.
4824 2009-12-28  Ian Lance Taylor  <iant@google.com>
4826         * gold.cc (queue_middle_tasks): Fix formatting.
4827         * object.cc (Relobj::is_section_name_included): Likewise.
4829 2009-12-23  Ian Lance Taylor  <iant@google.com>
4831         * i386.cc (Target_i386::do_calls_non_split): Recognize
4832         -fsplit-stack prologue for a function with a static chain.
4833         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
4834         -fsplit-stack prologue when using %r11.
4836 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
4838         * options.cc (General_options::parse_version): Make -v continue and do
4839         the link like GNU ld does.
4841 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
4843         * Makefile.am (CCFILES): Add timer.cc.
4844         (HFILES): Add timer.h.
4845         * configure.ac: Check for sysconf and times.
4846         * main.cc: include timer.h.
4847         (main): Use Timer instead of get_run_time.
4848         * timer.cc: New.
4849         * timer.h: New.
4850         * workqueue.cc: include timer.h.
4851         (Workqueue::find_and_run_task):
4852         Report user, sys and wall time.
4853         * Makefile.in: Regenerate.
4854         * config.in: Regenerate.
4855         * configure: Regenerate.
4857 2009-12-16  Doug Kwan  <dougkwan@google.com>
4859         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
4860         sections.
4861         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
4862         relaxed input sections.
4863         * output.cc (Output_section::find_relaxed_input_section): Change
4864         return type to Output_relaxed_input_section pointer.  Adjust code
4865         for new type of relaxed_input_section_map_.
4866         * output.h (Output_section::find_relaxed_input_section): Change
4867         return type to Output_relaxed_input_section pointer.
4868         (Output_section::Output_relaxed_input_section_by_input_section_map):
4869         New type.
4870         (Output_section::relaxed_input_section_map_): Change type to
4871         Output_section::Output_relaxed_input_section_by_input_section_map.
4872         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
4873         input section.
4875 2009-12-15  Ian Lance Taylor  <iant@google.com>
4877         * layout.cc (Layout::create_shstrtab): Only write out after input
4878         sections if we are compressing debug sections.
4880 2009-12-15  Ian Lance Taylor  <iant@google.com>
4882         * archive.cc (Archive::add_symbols): Only look up a symbol without
4883         a version if there is, in fact, a version.
4885 2009-12-14  Ian Lance Taylor  <iant@google.com>
4887         Revert -Wshadow changes, all changes from:
4888         2009-12-11  Doug Kwan  <dougkwan@google.com>
4889         2009-12-11  Nick Clifton  <nickc@redhat.com>
4890         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
4892 2009-12-11  Doug Kwan  <dougkwan@google.com>
4894         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
4895         due to -Wshadow.
4896         * attributes.cc (Object_attribute::size): Ditto.
4897         (Attributes_section_data::size): Ditto.
4898         (Attributes_section_data::Attributes_section_data): Ditto.
4899         (Output_attributes_section_data::do_write): Ditto.
4900         * attributes.h (Object_attribute::set_type): Ditto.
4901         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
4903 2009-12-11  Nick Clifton  <nickc@redhat.com>
4905         * archive.cc: Fix shadowed variable warnings.
4906         * arm.cc: Likewise.
4907         * compressed_output.cc: Likewise.
4908         * compressed_output.h: Likewise.
4909         * configure: Likewise.
4910         * dwarf_reader.cc: Likewise.
4911         * dynobj.cc: Likewise.
4912         * dynobj.h: Likewise.
4913         * ehframe.cc: Likewise.
4914         * ehframe.h: Likewise.
4915         * errors.cc: Likewise.
4916         * expression.cc: Likewise.
4917         * fileread.cc: Likewise.
4918         * fileread.h: Likewise.
4919         * freebsd.h: Likewise.
4920         * i386.cc: Likewise.
4921         * icf.cc: Likewise.
4922         * incremental.h: Likewise.
4923         * layout.cc: Likewise.
4924         * layout.h: Likewise.
4925         * mapfile.cc: Likewise.
4926         * merge.cc: Likewise.
4927         * merge.h: Likewise.
4928         * object.cc: Likewise.
4929         * object.h: Likewise.
4930         * options.h: Likewise.
4931         * output.cc: Likewise.
4932         * output.h: Likewise.
4933         * parameters.cc: Likewise.
4934         * plugin.cc: Likewise.
4935         * powerpc.cc: Likewise.
4936         * reduced_debug_output.cc: Likewise.
4937         * reduced_debug_output.h: Likewise.
4938         * reloc.cc: Likewise.
4939         * reloc.h: Likewise.
4940         * resolve.cc: Likewise.
4941         * script-sections.cc: Likewise.
4942         * script.cc: Likewise.
4943         * script.h: Likewise.
4944         * sparc.cc: Likewise.
4945         * symtab.cc: Likewise.
4946         * symtab.h: Likewise.
4947         * target-select.cc: Likewise.
4948         * target-select.h: Likewise.
4949         * token.h: Likewise.
4950         * workqueue.cc: Likewise.
4951         * workqueue.h: Likewise.
4952         * x86_64.cc: Likewise.
4954 2009-12-10  Doug Kwan  <dougkwan@google.com>
4956         * arm.cc (attributes.h): New include.
4957         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
4958         (Arm_relobj::~Arm_relobj): Delete object pointed by
4959         attributes_section_data_.
4960         (Arm_relobj::attributes_section_data): New method definition.
4961         (Arm_relobj::attributes_section_data_): New data member declaration.
4962         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
4963         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
4964         attributes_section_data_.
4965         (Arm_dynobj::attributes_section_data): New method definition.
4966         (Arm_dynobj::attributes_section_data_): New data member declaration.
4967         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
4968         initialization value of may_use_blx_ to false.
4969         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
4970         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
4971         object attributes to compute results instead of hard-coding.
4972         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
4973         Target_arm::get_secondary_compatible_arch,
4974         Target_arm::set_secondary_compatible_arch
4975         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4976         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
4977         New method declarations.
4978         (Target_arm::get_aeabi_object_attribute): New method definition.
4979         (Target_arm::attributes_section_data_): New data member declaration.
4980         (read_arm_attributes_section): New template definition.
4981         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
4982         (Arm_dynobj::do_read_symbols): Ditto.
4983         (Target_arm::do_finalize_sections): Merge attributes sections from
4984         input.  Check for BLX use after attributes section merging.
4985         Fix __exidx_start and __exidx_end visibility.  Create an
4986         .ARM.attributes section if necessary.
4987         (Target_arm::get_secondary_compatible_arch,
4988         Target_arm::set_secondary_compatible_arch,
4989         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
4990         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
4991         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
4992         New method definitions.
4994 2009-12-09  Ian Lance Taylor  <iant@google.com>
4996         * plugin.cc (Plugin::load): Don't cast from void* to a function
4997         pointer.
4999 2009-12-09  Ian Lance Taylor  <iant@google.com>
5001         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5002         information fields.
5004 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
5006         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5007         Replace two_file_shared_1.so with two_file_shared_2.so.
5008         * testsuite/Makefile.in: Regenerated.
5010 2009-12-08  Doug Kwan  <dougkwan@google.com>
5012         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5013         (HFILES): Add attributes.h and int_encoding.h.
5014         * Makefile.in: Regenerate.
5015         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5016         function definitions to int_encoding.cc
5017         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5018         prototypes to int_encoding.h
5019         * reduced_debug_output.cc (int_encoding.h): New include.
5020         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5021         function definitions to int_encoding.cc
5022         (insert_into_vector, read_from_pointer): Move template definitions to
5023         int_encoding.h
5024         * attributes.cc: New file.
5025         * attributes.h: New file.
5026         * int_encoding.cc: New file.
5027         * int_encoding.h: New file.
5029 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
5031         PR gold/11055
5032         * incremental-dump.cc (dump_incremental_inputs): New.
5033         (main): Use dump_incremental_inputs.
5035 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
5037         PR gold/10893
5038         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5039         checking elfcpp::STT_FUNC.
5040         (Target_i386::Relocate::relocate): Likewise.
5041         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5043         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5044         symbols from shared libraries into normal FUNC symbols.
5046         * symtab.h (Symbol): Add is_func and use it.
5048 2009-12-05  Doug Kwan  <dougkwan@google.com>
5050         * arm.cc (Target_arm::arm_info): Initialize new fields
5051         attributes_section and attributes_vendor.
5052         * i386.cc (Target_i386::i386_info): Same.
5053         * object.cc (Sized_relobj::do_layout): Skip attribute section.
5054         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
5055         fields attributes_section and attributes_vendor.
5056         * sparc.cc (Target_sparc::sparc_info): Same.
5057         * target.h (Target::attributes_section, Target::attributes_vendor,
5058         Target::is_attributes_section, Target::attribute_arg_type,
5059         Target::attributes_order): New method definitions.
5060         (Target::Target_info::attributes_section,
5061         Target::Target_info::attributes_vendor): New fields.
5062         (Target::do_attribute_arg_type, Target::do_attributes_order): New
5063         virtual method definitions.
5064         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
5065         attributes_section and attributes_vendor.
5066         * testsuite/testfile.cc (Target_test::test_target_info): Same.
5068 2009-12-05  Doug Kwan  <dougkwan@google.com>
5070         * arm.cc: Update comments about interworking and stub generation.
5071         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
5072         considered as non-PIC.
5073         (Arm_relocate_functions::base_abs): Fix formatting.
5074         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
5075         of function to use GOT entry address instead of offset.
5076         (Target_arm::Scan::global): Issue an error if a symbol would need a
5077         PLT does not get one because it is untyped.  Remove code to create
5078         dynamic symbols for relative branches.
5079         (Target_arm::Relocate::relocate: Use 0 instead of false since function
5080         takes unsigned integer instead of boolean.
5082 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
5084         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
5085         (two_file_test_LDADD): Likewise.
5086         (common_test_1_LDADD): Likewise.
5087         (exception_test_LDADD) Likewise.
5088         (weak_test_LDADD): Likewise.
5089         (many_sections_test_LDADD): Likewise.
5090         (initpri1_LDADD): Likewise.
5091         (script_test_1_LDADD): Likewise.
5092         (script_test_2_LDADD): Likewise.
5093         (justsyms_LDADD): Likewise.
5094         (binary_test_LDADD): Likewise.
5095         (large_LDADD): Likewise.
5096         * testsuite/Makefile.in: Regenerated.
5098 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
5100         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
5101         (Symbol_table::override_with_special): Likewise.
5102         (Symbol_table::add_from_object): Likewise.
5104 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5106         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5107         Don't set the data_offset twice.
5109 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
5111         * testsuite/Makefile.in: Regenerate.
5113 2009-12-03  Doug Kwan  <dougkwan@google.com>
5115         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
5116         (Target_arm::do_finalize_sections): Add parameter for symbol table
5117         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
5118         * i386.cc (Target_i386::do_finalize_sections): Add an additional
5119         parameter for symbol table pointer.
5120         * layout.cc (Layout::finalize): Call Target::finalize_sections with
5121         an additional parameter for a pointer to symbol table.
5122         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
5123         parameter for a symbol table pointer.
5124         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
5125         * target.h (Target::finalize_sections, Target::do_finalize_sections):
5126         Ditto.
5127         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
5128         parameter for a symbol table pointer.
5130 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
5132         * incremental.cc (Incremental_inputs_header)
5133         (Incremental_inputs_header_write, Incremental_inputs_entry)
5134         (Incremental_inputs_entry_write): Move ...
5135         * incremental.h (Incremental_inputs_header)
5136         (Incremental_inputs_header_write, Incremental_inputs_entry)
5137         (Incremental_inputs_entry_write): here.
5139 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5141         * incremental.cc (make_sized_incremental_binary): Set the target.
5142         Error if it is incompatible.
5143         * output.h (Output_file): Add filename method.
5145 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5147         * incremental.cc (Incremental_inputs_entry): Remove unused argument
5148         from the get_* methods.
5150 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5152         * incremental-dump.cc (main): Check that the offeset of a script is 0.
5153         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
5154         Write 0 for the data_offset of scripts.
5156 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
5158         * testsuite/Makefile.am: Add the incremental_test.sh test.
5159         * testsuite/incremental_test.sh: New.
5160         * testsuite/incremental_test_1.c: New.
5161         * testsuite/incremental_test_2.c: New.
5163 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
5165        * incremental-dump.cc (main): Fix typos.
5167 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
5169         PR gold/11025
5170         * incremental-dump.cc (main): Use llu to print 64 bit values.
5172 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
5173             H.J. Lu  <hongjiu.lu@intel.com>
5175         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
5176         $(LIBDL).
5177         (incremental_dump_LDADD): Likewise.
5178         * Makefile.in: Regenerated.
5180 2009-11-25  Doug Kwan  <dougkwan@google.com>
5182         Revert:
5184         2009-11-25  Doug Kwan  <dougkwan@google.com>
5186                 * arm.cc (Target_arm::Target_arm): Move method definition
5187                 outside of class definition.  Add code to handle
5188                 --target1-rel, --target1-abs and --target2= options.
5189                 (Target_arm::get_reloc_reloc_type): Change method to be
5190                 non-static and const.
5191                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
5192                 New data member declaration.
5193                 (Target_arm::Scan::local, Target_arm::Scan::global,
5194                 Target_arm::Relocate::relocate,
5195                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5196                 Adjust call to Target_arm::get_real_reloc_type.
5197                 (Target_arm::get_real_reloc_type): Use command line options
5198                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5199                 * options.h (--target1-rel, --target1-abs, --target2): New
5200                 ARM-only options.
5202 2009-11-25  Doug Kwan  <dougkwan@google.com>
5204         * arm.cc (Target_arm::Target_arm): Move method definition outside of
5205         class definition.  Add code to handle --target1-rel, --target1-abs
5206         and --target2= options.
5207         (Target_arm::get_reloc_reloc_type): Change method to be non-static
5208         and const.
5209         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
5210         member declaration.
5211         (Target_arm::Scan::local, Target_arm::Scan::global,
5212         Target_arm::Relocate::relocate,
5213         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
5214         call to Target_arm::get_real_reloc_type.
5215         (Target_arm::get_real_reloc_type): Use command line options to
5216         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
5217         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
5218         options.
5220 2009-11-25  Doug Kwan  <dougkwan@google.com>
5222         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
5223         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
5224         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
5225         formatting.
5226         (Arm_relocate_functions::thm_call): Replace body with a call to
5227         Arm_relocate_functions::thumb_branch_common.
5228         (Arm_relocate_functions::thm_jump24,
5229         Arm_relocate_functions::thm_xpc22): New method definitions.
5230         (Arm_relocate_functions::thumb_branch_common): New method definition.
5231         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
5232         operator.
5233         (Target_arm::Relocate::relocate): Adjust call to thm_call.
5234         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
5236 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5238         * Makefile.am: Build incremental-dump
5239         * Makefile.in: Regenerate.
5240         * incremental-dump.cc: New.
5241         * incremental.cc (Incremental_inputs_header_data,
5242         Incremental_inputs_entry_data): Move to incremental.h
5243         * incremental.h: (Incremental_inputs_header_data,
5244         Incremental_inputs_entry_data): Move from incremental.cc
5246 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5248         * incremental.cc (Incremental_inputs_header,
5249         Incremental_inputs_header_write, Incremental_inputs_entry,
5250         Incremental_inputs_entry_write): Add a typedef with the data type.
5252 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
5254         * incremental.cc (Incremental_inputs_header,
5255         Incremental_inputs_header_write, Incremental_inputs_entry,
5256         Incremental_inputs_entry_write): Update comment about which
5257         type has the filed descriptions.
5259 2009-11-15  Doug Kwan  <dougkwan@google.com>
5261         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
5262         (Arm_relocate_functions::arm_branch_common): Change method defintion
5263         in class definition to a method declaration and update list of formal
5264         parameters.
5265         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
5266         Arm_relocation_functions::jump24): Adjust call to
5267         Arm_relocate_functions::arm_branch_common.  Update list of formal
5268         parameters.
5269         (Arm_relocate_functions::xpc25): New method definition.
5270         (Arm_relocate_functions::arm_branch_common): Move method defintion
5271         out from class definition.  Use stubs for mode-switching and extending
5272         branch ranges.
5273         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
5274         specially.  Change code to enable use of stubs in ARM branches.
5276 2009-11-10  Doug Kwan  <dougkwan@google.com>
5278         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
5279         in method declaration.
5280         (Target_arm::relocate_stub): New method declaration.
5281         (Target_arm::default_target): Change to return a pointer instead of
5282         a const reference.
5283         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
5284         Target_arm::default_target.
5285         (Arm_Relobj::do_relocate_sections): Remove options paramater in
5286         method definition.
5287         (Target_arm::relocate_section): Adjust view.
5288         (Target_arm::relocate_stub): New method definition.
5290 2009-11-10  Doug Kwan  <dougkwan@google.com>
5292         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
5293         a format warning.
5294         * incremental.cc (open_incremental_binary): Initialized local
5295         variables to avoid warnings.
5296         * object.cc (make_elf_object): Ditto.
5297         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
5298         a format warning.
5300 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
5302         PR gold/10930
5303         * testsuite/plugin_test.c: Include "config.h".
5305 2009-11-09  Doug Kwan  <dougkwan@google.com>
5307         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
5308         (arm_symbol_value): Remove.
5309         (Arm_relocate_functions::arm_branch_common,
5310         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
5311         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
5312         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
5313         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
5314         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
5315         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
5316         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
5317         Arm_relocate_functions::thm_mobw_abs_nc,
5318         Arm_relocate_functions::thm_mov_abs,
5319         Arm_relocate_functions::movw_prel_nc,
5320         Arm_relocate_functions::thm_movt_abs,
5321         Arm_relocate_functions::movt_prel,
5322         Arm_relocate_functions::thm_movw_prel_nc,
5323         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
5324         (Target_arm::Relocate::relocate): Only decompose address into two
5325         parts if relocation type uses the thumb-bit and pass the actual
5326         bit instead of a flag indicating that the thumb-bit is used.  Adjust
5327         calls to methods in Arm_relocate_functions for this change.
5329 2009-11-08  Ian Lance Taylor  <iant@google.com>
5331         PR 10925
5332         * reloc.cc: Instantiate
5333         Sized_relobj::initialize_input_to_output_maps and
5334         Sized_relobj:free_input_to_output_maps.
5336 2009-11-06  Ian Lance Taylor  <iant@google.com>
5338         PR 10876
5339         * defstd.cc (in_segment): Set only_if_ref true for "end".
5341 2009-11-06  Doug Kwan  <dougkwan@google.com>
5343         * arm.cc (class Reloc_stub): Correct a comment.
5344         (Target_arm::Target_arm): Initialize arm_input_section_map_.
5345         (Target_arm::scan_section_for_stubs): New method declaration.
5346         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
5347         Change methods from private to protected.
5348         (Target_arm::do_may_relax): New method definition.
5349         (Target_arm::do_relax, Target_arm::group_sections,
5350         Target_arm::scan_reloc_for_stub,
5351         Target_arm::scan_reloc_section_for_stubs): New method declarations.
5352         (Target_arm::arm_input_section_map_): New data member declaration.
5353         (Target_arm::scan_reloc_for_stub,
5354         Target_arm::scan_reloc_section_for_stubs,
5355         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
5356         Target_arm::do_relax): New method definitions.
5358 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
5360         * configure.ac: Check for (struct stat)::st_mtim
5361         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
5362         * config.in: Regenerate.
5363         * configure: Regenerate.
5365 2009-11-05  Ian Lance Taylor  <iant@google.com>
5367         PR 10910
5368         * output.cc (Output_segment::add_output_section): Add missing
5369         return statement.
5371 2009-11-04  Ian Lance Taylor  <iant@google.com>
5373         PR 10880
5374         * object.h (class Object): Add is_needed and set_is_needed
5375         methods.  Add is_needed_ field.  Make bool fields into bitfields.
5376         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
5377         defined in a dynamic object and referenced by a regular object,
5378         set is_needed for the dynamic object.
5379         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
5380         if the file is marked with as_needed and it is not needed.
5382 2009-11-04  Ian Lance Taylor  <iant@google.com>
5384         PR 10887
5385         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
5386         tags if data is discarded by linker script.
5387         * i386.cc (Target_i386::do_finalize_sections): Likewise.
5388         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5389         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5390         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5392 2009-11-04  Ian Lance Taylor  <iant@google.com>
5394         * layout.cc (Layout::get_output_section): Add is_interp and
5395         is_dynamic_linker_section parameters.  Change all callers.
5396         (Layout::choose_output_section): Likewise.
5397         (Layout::make_output_section): Likewise.
5398         (Layout::add_output_section_data): Add is_dynamic_linker_section
5399         parameter.  Change all callers.
5400         * layout.h (class Layout): Update declarations.
5401         * output.h (class Output_section): Add is_interp, set_is_interp,
5402         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
5403         Add is_interp_, is_dynamic_linker_section_ fields.  Change
5404         generate_code_fills_at_write_ to a bitfield.
5405         * output.cc (Output_section::Output_sections): Initialize new
5406         fields.
5407         (Output_segment::add_output_section): Add do_sort parameter.
5408         Change all callers.
5410 2009-11-03  Ian Lance Taylor  <iant@google.com>
5412         PR 10860
5413         * options.h (class General_options): Add --warn-common.
5414         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
5415         merging two common symbols.
5416         (Symbol_table::should_override): Handle --warn-common when merging
5417         a common symbol with a defined symbol.  Use report_resolve_problem
5418         for multiple definitions.
5419         (Symbol_table::report_resolve_problem): New function.
5420         * symtab.h (class Symbol_table): Declare report_resolve_problem.
5422 2009-11-03  Doug Kwan  <dougkwan@google.com>
5424         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
5425         stub_factory_.
5426         (Target_arm::stub_factory): New method definition.
5427         (Target_arm::new_arm_input_section,
5428         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
5429         Target_arm::reloc_uses_thumb_bit): New method declarations.
5430         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
5431         New type definitions.
5432         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
5433         member declarations.
5434         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
5435         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
5436         New method definitions.
5438 2009-11-03  Ian Lance Taylor  <iant@google.com>
5440         * options.h (class General_options): Add --warn_constructors.
5442 2009-11-03  Ian Lance Taylor  <iant@google.com>
5444         PR 10893
5445         * defstd.cc (in_section): Add entries for __rel_iplt_start,
5446         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
5448 2009-11-03  Ian Lance Taylor  <iant@google.com>
5450         PR 10895
5451         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
5452         --msgid-bugs-address.
5453         (install-pdf): New target.
5454         (install-data_yes): Look up one directory to find mkinstalldirs.
5456 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
5458         * po/Make-in (.po.gmo): Don't generate .gmo files in source
5459         tree.
5461 2009-10-30  Doug Kwan  <dougkwan@google.com>
5463         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
5465 2009-10-30  Doug Kwan  <dougkwan@google.com>
5467         * arm.cc (Stub_addend_reader): New struct template definition
5468         and partial specializations.
5469         (Stub_addend_reader::operator()): New method definition for a
5470         partially specialized template.
5472 2009-10-30  Doug Kwan  <dougkwan@google.com>
5474         * arm.cc (Arm_relobj::processor_specific_flags): New method
5475         definition.
5476         (Arm_relobj::do_read_symbols): New method declaration.
5477         (Arm_relobj::processor_specific_flags_): New data member declaration.
5478         (Arm_dynobj): New class definition.
5479         (Target_arm::do_finalize_sections): Add input_objects parameter.
5480         (Target_arm::do_adjust_elf_header): New method declaration.
5481         (Target_arm::are_eabi_versions_compatible,
5482         (Target_arm::merge_processor_specific_flags): New method declaration.
5483         (Target_arm::do_make_elf_object): New overloaded method definitions
5484         and declaration.
5485         (Arm_relobj::do_read_symbols): New method definition.
5486         (Arm_dynobj::do_read_symbols): Ditto.
5487         (Target_arm::do_finalize_sections): Add input_objects parameters.
5488         Merge processor-specific flags from all input objects.
5489         (Target_arm::are_eabi_versions_compatible,
5490         Target_arm::merge_processor_specific_flags,
5491         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
5492         New method definitions.
5493         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
5494         Input_objects pointer type parameter.
5495         * layout.cc (Layout::finalize): Pass input objects to target's.
5496         finalize_sections function.
5497         * output.cc (Output_file_header::do_sized_write): Set ELF file
5498         header's processor-specific flags.
5499         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
5500         Input_objects pointer type parameter.
5501         * sparc.cc (Target_sparc::do_finalize_sections): Same.
5502         * target.h (Input_objects): New forward class declaration.
5503         (Target::processor_specific_flags,
5504         Target::are_processor_specific_flags_sect): New method definitions.
5505         (Target::finalize_sections): Add input_objects parameter.
5506         (Target::Target): Initialize processor_specific_flags_ and
5507         are_processor_specific_flags_set_.
5508         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
5509         parameter.
5510         (Target::set_processor_specific_flags): New method definition.
5511         (Target::processor_specific_flags_,
5512         Target::are_processor_specific_flags_set_): New data member
5513         declarations.
5514         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
5515         Input_objects pointer type parameter.
5517 2009-10-30  Doug Kwan  <dougkwan@google.com>
5519         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
5521 2009-10-28  Ian Lance Taylor  <iant@google.com>
5523         * object.h (class Relobj): Drop options parameter from
5524         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
5525         do_scan_relocs, do_relocate.  Change all callers.
5526         (class Sized_relobj): Drop options parameters from
5527         do_gc_process_relocs, do_scan_relocs, do_relocate,
5528         do_relocate_sections, relocate_sections, emit_relocs_scan,
5529         emit_relocs_scan_reltype.  Change all callers.
5530         (struct Relocate_info): Remove options field and all references to
5531         it.
5532         * reloc.h (class Read_relocs): Remove options constructor
5533         parameter and options_ field.  Change all callers.
5534         (class Gc_process_relocs, class Scan_relocs): Likewise.
5535         (class Relocate_task): Likewise.
5536         * target-reloc.h (scan_relocs): Remove options parameter.  Change
5537         all callers.
5538         (scan_relocatable_relocs): Likewise.
5539         * target.h (class Sized_target): Remove options parameter from
5540         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
5541         all callers.
5542         * gc.h (gc_process_relocs): Remove options parameter.  Change all
5543         callers.
5544         * arm.cc: Update functions to remove options parameters.
5545         * i386.cc: Likewise.
5546         * powerpc.cc: Likewise.
5547         * sparc.cc: Likewise.
5548         * x86_64.cc: Likewise.
5549         * testsuite/testfile.cc: Likewise.
5551 2009-10-28  Doug Kwan  <dougkwan@google.com>
5553         * arm.cc (Arm_relobj): New class definition.
5554         (Arm_relobj::scan_sections_for_stubs,
5555         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
5556         New method definitions.
5558 2009-10-28  Cary Coutant  <ccoutant@google.com>
5560         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
5561         (Plugin::cleanup_done_): New member.
5562         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
5563         (Plugin_manager::cleanup_done_): Remove.
5564         (Plugin_manager::add_input_file): Edit error message.
5565         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
5566         (Plugin_manager::cleanup): Remove use of cleanup_done_.
5568 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
5570         * fileread.cc: (File_read::View::~View): Use the new
5571         data_ownership_ filed.
5572         (File_read::~File_read): Dispose the new whole_file_view_.
5573         (File_read::open): Mmap the whole file if needed.
5574         (File_read::open): Use whole_file_view_ instead of contents_.
5575         (File_read::find_view): Use whole_file_view_ if applicable.
5576         (File_read::do_read): Use whole_file_view_ instead of contents_.
5577         (File_read::make_view): Use whole_file_view_ instead of contents_,
5578         update File_read::View::View call.
5579         (File_read::find_or_make_view): Update File_read::View::View
5580         call.
5581         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
5582         remove contents_
5583         (File_read::View::Data_ownership): New enum.
5584         (File_read::View::View): Replace bool mapped_ with Data_ownership
5585         argument.
5586         (File_read::View::mapped_): Remove (replaced by data_ownership_).
5587         (File_read::View::data_ownership_): New field.
5588         (File_read::contents_): Remove (replaced by whole_file_view_).
5589         (File_read::whole_file_view_): New field.
5590         * options.h (class General_options): Add --keep-files-mapped.
5592 2009-10-27  Cary Coutant  <ccoutant@google.com>
5594         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
5595         * testsuite/Makefile.am (plugin_test_5): New test case.
5596         * testsuite/Makefile.in: Regenerate.
5598 2009-10-25  Doug Kwan  <dougkwan@google.com>
5600         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
5601         from private to protected to allow access by child class.
5602         (Sized_relobj::do_relocate_sections): New method declaration.
5603         (Sized_relobj::relocate_sections): Virtualize.
5604         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
5605         Sized_relobj::relocate_sections.  Instantiate template explicitly
5606         for different target sizes and endianity.
5608 2009-10-24  Doug Kwan  <dougkwan@google.com>
5610         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
5611         (Arm_input_section::as_arm_input_section): New method.
5612         (Arm_output_section): New class definition.
5613         (Arm_output_section::create_stub_group,
5614         Arm_output_section::group_sections): New method definitions.
5616 2009-10-22  Doug Kwan  <dougkwan@google.com>
5618         * arm.cc (Arm_input_section): New class definition.
5619         (Arm_input_section::init, Arm_input_section:do_write,
5620         Arm_input_section::set_final_data_size,
5621         Arm_input_section::do_reset_address_and_file_offset): New method
5622         definitions.
5624 2009-10-21  Doug Kwan  <dougkwan@google.com>
5626         * arm.cc (Stub_table, Arm_input_section): New forward class
5627         declarations.
5628         (Stub_table): New class defintion.
5629         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
5630         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
5631         New method definition.
5633 2009-10-21  Doug Kwan  <dougkwan@google.com>
5635         * arm.cc: Update copyright comments.
5636         (Target_arm): New forward class template declaration.
5637         (Arm_address): New type.
5638         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
5639         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
5640         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
5641         constants.
5642         (Insn_template): Same.
5643         (DEF_STUBS): New macro.
5644         (Stub_type): New enum type.
5645         (Stub_template): New class definition.
5646         (Stub): Same.
5647         (Reloc_stub): Same.
5648         (Stub_factory): Same.
5649         (Target_arm::Target_arm): Initialize may_use_blx_ and
5650         should_force_pic_veneer_.
5651         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
5652         Target_arm::should_force_pic_veneer,
5653         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
5654         Target_arm::using_thumb_only, Target_arm:;default_target): New
5655         method defintions.
5656         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
5657         New data member declarations.
5658         (Insn_template::size, Insn_template::alignment): New method defintions.
5659         (Stub_template::Stub_template): New method definition.
5660         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
5661         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
5662         (Stub_factory::Stub_factory): New method definition.
5663         * gold.h (string_hash): New template.
5664         * output.h (Input_section_specifier::hash_value): Use
5665         gold::string_hash.
5666         (Input_section_specifier::string_hash): Remove.
5667         * stringpool.cc (Stringpool_template::string_hash): Use
5668         gold::string_hash.
5670 2009-10-20  Doug Kwan  <dougkwan@google.com>
5672         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
5673         symbols of relaxed input sections.
5674         * output.h (Output_section::find_relaxed_input_section): Make
5675         method public.
5677 2009-10-16  Doug Kwan  <dougkwan@google.com>
5679         * dynobj.cc (Versions::Versions): Initialize version_script_.
5680         Only insert base version symbol definition for a shared object
5681         if version script defines any version versions.
5682         (Versions::define_base_version): New method definition.
5683         (Versions::add_def): Check that base version is not needed.
5684         (Versions::add_need): Define base version lazily.
5685         * dynobj.h (Versions::define_base_version): New method declaration.
5686         (Versions::needs_base_version_): New data member declaration.
5687         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
5688         (check_DATA): Add no_version_test.stdout.
5689         (libno_version_test.so, no_version_test.o no_version_test.stdout):
5690         New make rules.
5691         * testsuite/Makefile.in: Regenerate.
5692         * testsuite/no_version_test.c: New file.
5693         * testsuite/no_version_test.sh: Ditto.
5695 2009-10-16  Doug Kwan  <dougkwan@google.com>
5697         * expression.cc (class Segment_start_expression): New class definition.
5698         (Segment_start_expression::value): New method definition.
5699         (script_exp_function_segment_start): Return a new
5700         Segment_start_expression.
5701         * gold/script-c.h (script_saw_segment_start_expression): New function
5702         prototype.
5703         * script-sections.cc (Script_sections::Script_sections): Initialize
5704         SAW_SEGMENT_START_EXPRESSION_ to false.
5705         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
5706         and -Tbbs options to specify section addresses if given in
5707         command line and no SEGMENT_START expression is seen in a script.
5708         * script-sections.h (Script_sections::saw_segment_start_expression,
5709         Script_sections::set_saw_segment_start_expression): New method
5710         definition.
5711         (Script_sections::saw_segment_start_expression_): New data member
5712         declaration.
5713         * script.cc (script_saw_segment_start_expression): New function.
5714         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
5715         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
5716         script_test_7.sh and script_test_8.sh.
5717         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
5718         script_test_8.stdout.
5719         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
5720         (script_test_6, script_test_6.stdout, script_test_7,
5721         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
5722         * Makefile.in: Regenerate.
5723         * testsuite/script_test_6.sh: New file.
5724         * testsuite/script_test_6.t: Same.
5725         * testsuite/script_test_7.sh: Same.
5726         * testsuite/script_test_7.t: Same.
5727         * testsuite/script_test_8.sh: Same.
5729 2009-10-16  Doug Kwan  <dougkwan@google.com>
5731         * output.cc (Output_segment::set_section_list_address): Cast
5732         expressions to unsigned long long type to avoid format warnings.
5734 2009-10-15  Ian Lance Taylor  <iant@google.com>
5736         * script.cc (Script_options::add_symbol_assignment): Always add a
5737         dot assignment to script_sections_.
5738         * script-sections.cc (Script_sections::add_dot_assignment):
5739         Initialize if necessary.
5741         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
5742         program headers with no load segment if there is a linker script.
5744         * layout.cc (Layout::set_segment_offsets): Align the file offset
5745         to the segment aligment for -N or -n with no load segment.
5746         * output.cc (Output_segment::add_output_section): Don't crash if
5747         the first section is a TLS section.
5748         (Output_segment::set_section_list_addresses): Print an error
5749         message if the address moves backward in a linker script.
5750         * script-sections.cc
5751         (Output_section_element_input::set_section_addresses): Don't
5752         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
5753         (Orphan_output_section::set_section_addresses): Likewise.
5755 2009-10-15  Doug Kwan  <dougkwan@google.com>
5757         * layout.cc (Layout::finish_dynamic_section): Generate tags
5758         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
5759         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
5760         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
5762 2009-10-14  Ian Lance Taylor  <iant@google.com>
5764         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
5765         fields.
5766         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
5767         data_shdr fields of relinfo.
5768         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
5769         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
5770         R_386_TLS_LDO_32, adjust based on section flags.
5771         (Target_i386::Relocate::fix_up_ldo): Remove.
5773 2009-10-13  Ian Lance Taylor  <iant@google.com>
5775         Add support for -pie.
5776         * options.h (class General_options): Add -pie and
5777         --pic-executable.
5778         (General_options::output_is_position_independent): Test -pie.
5779         (General_options::output_is_executable): Return true if not shared
5780         and not relocatable.
5781         (General_options::output_is_pie): Remove.
5782         * options.cc (General_options::finalize): Reject incompatible uses
5783         of -pie.
5784         * gold.cc (queue_middle_tasks): A -pie link is not static.
5785         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
5786         * symtab.cc (Symbol::final_value_is_known): Return false if
5787         output_is_position_independent.
5788         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
5789         output_is_position_independent.
5790         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
5791         output_is_position_independent.
5792         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
5793         output_is_position_independent.
5794         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
5795         two_file_pie_test.
5796         (basic_pie_test.o, basic_pie_test): New targets.
5797         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
5798         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
5799         (two_file_pie_test): New target.
5800         * testsuite/Makefile.in: Rebuild.
5801         * README: Remove note saying that -pie is not supported.
5803 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
5805         * options.h (class General_options): Add -init and -fini.
5806         * layout.cc (Layout::finish_dynamic_section): Emit
5807         given init and fini functions.
5809 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
5811         * gc.h (gc_process_relocs): Check if icf is enabled using new
5812         function.
5813         * gold.cc (queue_initial_tasks): Likewise.
5814         (queue_middle_tasks): Likewise.
5815         * object.cc (do_layout): Likewise.
5816         * symtab.cc (is_section_folded): Likewise.
5817         * main.cc (main): Likewise.
5818         * reloc.cc (Read_relocs::run): Likewise.
5819         (Sized_relobj::do_scan_relocs): Likewise.
5820         * icf.cc (is_function_ctor_or_dtor): New function.
5821         (Icf::find_identical_sections): Check if function is ctor or dtor when
5822         safe icf is chosen.
5823         * options.h (General_options::icf): Change option to be an enum.
5824         (Icf_status): New enum.
5825         (icf_enabled): New method.
5826         (icf_safe_folding): New method.
5827         (set_icf_status): New method.
5828         (icf_status_): New variable.
5829         * (options.cc) (General_options::finalize): Set icf_status_.
5830         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
5831         icf_test and icf_keep_unique_test to use the --icf enum flag.
5832         * testsuite/icf_safe_test.sh: New file.
5833         * testsuite/icf_safe_test.cc: New file.
5835 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
5837         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
5838         includes to gc.h and icf.h.
5839         * arm.cc: Include gc.h.
5840         * gold.cc: Likewise.
5841         * i386.cc: Likewise.
5842         * powerpc.cc: Likewise.
5843         * sparc.cc: Likewise.
5844         * x86_64.cc: Likewise.
5845         * gc.h: Include icf.h.
5847 2009-10-11  Ian Lance Taylor  <iant@google.com>
5849         * plugin.cc: Include "gold.h" before other header files.
5851 2009-10-10  Chris Demetriou  <cgd@google.com>
5853         * options.h (Input_file_argument::Input_file_type): New enum.
5854         (Input_file_argument::is_lib_): Replace with...
5855         (Input_file_argument::type_): New member.
5856         (Input_file_argument::Input_file_argument): Take Input_file_type
5857         'type' rather than boolean 'is_lib' as second argument.
5858         (Input_file_argument::is_lib): Use type_.
5859         (Input_file_argument::is_searched_file): New function.
5860         (Input_file_argument::may_need_search): Handle is_searched_file.
5861         * options.cc (General_options::parse_library): Support -l:filename.
5862         (General_options::parse_just_symbols): Update for Input_file_argument
5863         changes.
5864         (Command_line::process): Likewise.
5865         * archive.cc (Archive::get_file_and_offset): Likewise.
5866         * plugin.cc (Plugin_manager::release_input_file): Likewise.
5867         * script.cc (read_script_file, script_add_file): Likewise.
5868         * fileread.cc (Input_file::Input_file): Likewise.
5869         (Input_file::will_search_for): Handle is_searched_file.
5870         (Input_file::open): Likewise.
5871         * readsyms.cc (Read_symbols::get_name): Likewise.
5872         * testsuite/Makefile.am (searched_file_test): New test.
5873         * testsuite/Makefile.in: Regenerate.
5874         * testsuite/searched_file_test.cc: New file.
5875         * testsuite/searched_file_test_lib.cc: New file.
5877 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
5878             Ian Lance Taylor  <iant@google.com>
5880         * descriptor.cc: Include <cstdio> and "binary-io.h".
5881         (Descriptors::open): Open the files in binary mode always.
5882         * script.cc (Lex::get_token): Treat \r as whitespace.
5884 2009-10-09  Ian Lance Taylor  <iant@google.com>
5886         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
5888 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
5889             Ian Lance Taylor  <iant@google.com>
5891         * configure.ac: Check for readv function also.
5892         * fileread.cc (readv): Define if not HAVE_READV.
5893         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
5894         does not exist.
5895         * config.in: Regenerate.
5896         * configure: Regenerate.
5898 2009-10-09  Doug Kwan  <dougkwan@google.com>
5900         * layout.cc (Layout::make_output_section): Call target hook to make
5901         ordinary output section.
5902         (Layout::finalize): Adjust parameter list of call the
5903         Target::may_relax().
5904         * layout.h (class Layout::section_list): New method.
5905         * merge.h (Output_merge_base::entsize): Change visibility to public.
5906         (Output_merge_base::is_string, Output_merge_base::do_is_string):
5907         New methods.
5908         (Output_merge_string::do_is_string): New method.
5909         * object.cc (Sized_relobj::do_setup): renamed from
5910         Sized_relobj::set_up.
5911         * object.h (Sized_relobj::adjust_shndx,
5912         Sized_relobj::initializ_input_to_output_maps,
5913         Sized_relobj::free_input_to_output_maps): Change visibilities to
5914         protected.
5915         (Sized_relobj::setup): Virtualize.
5916         (Sized_relobj::do_setup): New method declaration.
5917         (Sized_relobj::invalidate_section_offset,
5918         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
5919         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
5920         * options.cc (parse_int): New function.
5921         * options.h (parse_int): New declaration.
5922         (DEFINE_int): New macro.
5923         (stub_group_size): New option.
5924         * output.cc (Output_section::Output_section): Initialize memebers
5925         merge_section_map_, merge_section_by_properties_map_,
5926         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
5927         (Output_section::add_input_section): Handled deferred code-fill
5928         generation and remove an old comment.
5929         (Output_section::add_relaxed_input_section): New method definition.
5930         (Output_section::add_merge_input_section): Use merge section by
5931         properties map to speed to search.  Update merge section maps
5932         as appropriate.
5933         (Output_section::build_relaxation_map): New method definition.
5934         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5935         Same.
5936         (Output_section::relax_input_section): Renamed to
5937         Output_section::convert_input_sections_to_relaxed_sections and change
5938         interface to take a vector of pointers to relaxed sections.
5939         (Output_section::find_merge_section,
5940         Output_section::find_relaxed_input_section): New method definitions.
5941         (Output_section::is_input_address_mapped,
5942         Output_section::output_offset, Output_section::output_address):
5943         Use output section data maps to speed up searching.
5944         (Output_section::find_starting_output_address): Add comments.
5945         (Output_section::do_write,
5946         Output_section::write_to_postprocessing_buffer): Do code-fill
5947         generation as appropriate.
5948         (Output_section::get_input_sections): Invalidate relaxed input section
5949         map.
5950         (Output_section::restore_states): Adjust type of checkpoint .
5951         Invalidate relaxed input section map.
5952         * output.h (Output_merge_base): New class declaration.
5953         (Input_section_specifier): New class defintion.
5954         (class Output_relaxed_input_section) Change base class to
5955         Output_section_data_build.
5956         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
5957         base class initializer.
5958         (Output_section::add_relaxed_input_section): New method declaration.
5959         (Output_section::Input_section): Change visibility to protected.
5960         (Output_section::Input_section::relobj,
5961         Output_section::Input_section::shndx): Handle relaxed input sections.
5962         Output_section::input_sections) Change visibility to protected.  Also
5963         define overload to return a non-const pointer.
5964         (Output_section::Merge_section_properties): New class defintion.
5965         (Output_section::Merge_section_by_properties_map,
5966         Output_section::Output_section_data_by_input_section_map,
5967         Output_section::Relaxation_map): New types.
5968         (Output_section::relax_input_section): Rename method to
5969         Output_section::convert_input_sections_to_relaxed_sections and change
5970         interface to take a vector of relaxed section pointers.
5971         (Output_section::find_merge_section,
5972         Output_section::find_relaxed_input_section,
5973         Output_section::build_relaxation_map,
5974         Output_section::convert_input_sections_in_list_to_relaxed_sections):
5975         New method declarations.
5976         (Output_section::merge_section_map_
5977         Output_section::merge_section_by_properties_map_,
5978         Output_section::relaxed_input_section_map_,
5979         Output_section::is_relaxed_input_section_map_valid_,
5980         Output_section::generate_code_fills_at_write_): New data members.
5981         * script-sections.cc
5982         (Output_section_element_input::set_section_addresses): Call
5983         current_data_size and addralign methods of relaxed input sections.
5984         (Orphan_output_section::set_section_addresses): Call current_data_size
5985         and addralign methods of relaxed input sections.
5986         * symtab.cc (Symbol_table::compute_final_value): Extract template
5987         from the body of Symbol_table::sized_finalize_symbol.
5988         (Symbol_table::sized_finalized_symbol): Call
5989         Symbol_table::compute_final_value.
5990         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
5991         (Symbol_table::compute_final_value): New templated method declaration.
5992         * target.cc (Target::do_make_output_section): New method defintion.
5993         * target.h (Target::make_output_section): New method declaration.
5994         (Target::relax): Add more parameters for input objects, symbol table
5995         and layout.  Adjust call to do_relax.
5996         (Target::do_make_output_section): New method declaration.
5997         (Target::do_relax): Add parameters for input objects, symbol table
5998         and layout.
6000 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6002         * pread.c: Include stdio.h.
6004 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6006         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6007         defined.
6009 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
6011         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6012         Change read_shndx type to unsigned int.
6013         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6014         int.
6015         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6016         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6017         Change read_shndx type to unsigned int.
6018         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6019         int.
6020         (Sized_dwarf_line_info::read_line_mappings): Likewise.
6021         * layout.cc (Layout::create_symtab_sections): Cast the result of
6022         local_symcount * symsize to off_t in the gold_assert.
6024 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6026         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6027         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6028         R_ARM_BASE_ABS.
6029         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6030         (Arm_relocate_functions::thm_abs5): New function.
6031         (Arm_relocate_functions::abs12): New function.
6032         (Arm_relocate_functions::abs16): New function.
6033         (Arm_relocate_functions::base_abs): New function.
6034         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6035         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
6036         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6037         R_ARM_BASE_ABS.
6038         (Scan::global): Likewise.
6039         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6040         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6041         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6042         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6043         R_ARM_BASE_ABS.
6045 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6047         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6048         (Arm_relocate_functions::movt_prel): New function.
6049         (Arm_relocate_functions::thm_movw_prel_nc): New function.
6050         (Arm_relocate_functions::thm_movt_prel): New function.
6051         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
6052         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
6053         (Scan::global, Relocate::relocate): Likewise.
6054         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6056 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6058         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
6059         Incremental_checker.
6060         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
6061         unsigned int.
6062         (class Incremental_inputs_header): New class.
6063         (Incremental_inputs_header_writer): Edit comment.
6064         (Incremental_inputs_entry): New class.
6065         (Incremental_inputs_entry_writer): Edit comment.
6066         (Sized_incremental_binary::do_find_incremental_inputs_section):
6067         Add *strtab_shndx parameter, fill it.
6068         (Sized_incremental_binary::do_check_inputs): New method.
6069         (Incremental_checker::can_incrementally_link_output_file): Use
6070         Sized_incremental_binary::check_inputs.
6071         (Incremental_inputs::report_command_line): Save command line in
6072         command_line_.
6073         * incremental.h:
6074         (Incremental_binary::find_incremental_inputs_section): New
6075         method.
6076         (Incremental_binary::do_find_incremental_inputs_section): Add
6077         strtab_shndx parameter.
6078         (Incremental_binary::do_check_inputs): New pure virtual method.
6079         (Sized_incremental_binary::do_check_inputs): Declare.
6080         (Incremental_checker::Incremental_checker): Add incremental_inputs
6081         parameter, use it to initialize incremental_inputs_.
6082         (Incremental_checker::incremental_inputs_): New field.
6083         (Incremental_checker::command_line): New method.
6084         (Incremental_checker::inputs): New method.
6085         (Incremental_checker::command_line_): New field.
6087 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
6089         * incremental.cc: Include <cstdarg> and "target-select.h".
6090         (vexplain_no_incremental): New function.
6091         (explain_no_incremental): New function.
6092         (Incremental_binary::error): New method.
6093         (Sized_incremental_binary::do_find_incremental_inputs_section): New
6094         method.
6095         (make_sized_incremental_binary): New function.
6096         (open_incremental_binary): New function.
6097         (can_incrementally_link_file): Add checks if output is ELF and has
6098         inputs section.
6099         * incremental.h: Include "elfcpp_file.h" and "output.h".
6100         (Incremental_binary): New class.
6101         (Sized_incremental_binary): New class.
6102         (open_incremental_binary): Declare.
6103         * object.cc (is_elf_object): Use
6104         elfcpp::Elf_recognizer::is_elf_file.
6105         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
6106         * output.h (Output_file::filesize): New method.
6108 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6110         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
6111         New function.
6112         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
6113         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
6114         function.
6115         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
6116         function.
6117         (Arm_relocate_functions::movw_abs_nc): New function.
6118         (Arm_relocate_functions::movt_abs): New function.
6119         (Arm_relocate_functions::thm_movw_abs_nc): New function.
6120         (Arm_relocate_functions::thm_movt_abs): New function.
6121         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
6122         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
6123         (Scan::global): Likewise.
6124         (Relocate::relocate): Likewise.
6125         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6127 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6129         * arm.cc (Arm_relocate_functions::got_prel) New function.
6130         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
6131         (Relocate::relocate): Likewise.
6132         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6134 2009-10-06  Ian Lance Taylor  <iant@google.com>
6136         * options.h (class General_options): Define
6137         split_stack_adjust_size parameter.
6138         * object.h (class Object): Add uses_split_stack_ and
6139         has_no_split_stack_ fields.  Add uses_split_stack and
6140         has_no_split_stack accessor functions.  Declare
6141         handle_split_stack_section.
6142         (class Reloc_symbol_changes): Define.
6143         (class Sized_relobj): Define Function_offsets.  Declare
6144         split_stack_adjust, split_stack_adjust_reltype, and
6145         find_functions.
6146         * object.cc (Object::handle_split_stack_section): New function.
6147         (Sized_relobj::do_layout): Call handle_split_stack_section.
6148         * dynobj.cc (Sized_dynobj::do_layout): Call
6149         handle_split_stack_section.
6150         * reloc.cc (Sized_relobj::relocate_sections): Call
6151         split_stack_adjust for executable sections in split_stack
6152         objects.  Pass reloc_map to relocate_section.
6153         (Sized_relobj::split_stack_adjust): New function.
6154         (Sized_relobj::split_stack_adjust_reltype): New function.
6155         (Sized_relobj::find_functions): New function.
6156         * target-reloc.h: Include "object.h".
6157         (relocate_section): Add reloc_symbol_changes parameter.  Change
6158         all callers.
6159         * target.h (class Target): Add calls_non_split method.  Declare
6160         do_calls_non_split virtual method.  Declare match_view and
6161         set_view_to_nop.
6162         * target.cc: Include "elfcpp.h".
6163         (Target::do_calls_non_split): New function.
6164         (Target::match_view): New function.
6165         (Target::set_view_to_nop): New function.
6166         * gold.cc (queue_middle_tasks): Give an error if mixing
6167         split-stack and non-split-stack objects with -r.
6168         * i386.cc (Target_i386::relocate_section): Add
6169         reloc_symbol_changes parameter.
6170         (Target_i386::do_calls_non_split): New function.
6171         * x86_64.cc (Target_x86_64::relocate_section): Add
6172         reloc_symbol_changes parameter.
6173         (Target_x86_64::do_calls_non_split): New function.
6174         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
6175         parameter.
6176         * powerpc.cc (Target_powerpc::relocate_section): Add
6177         reloc_symbol_changes parameter.
6178         * sparc.cc (Target_sparc::relocate_section): Add
6179         reloc_symbol_changes parameter.
6180         * configure.ac: Call AM_CONDITIONAL for the default target.
6181         * configure: Rebuild.
6182         * testsuite/Makefile.am (TEST_AS): New variable.
6183         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
6184         (check_DATA): Add split_i386 and split_x86_64 files.
6185         (SPLIT_DEFSYMS): Define.
6186         (split_i386_[1234n].o): New targets.
6187         (split_i386_[124]): New targets.
6188         (split_i386_[1234r].stdout): New targets.
6189         (split_x86_64_[1234n].o): New targets.
6190         (split_x86_64_[124]): New targets.
6191         (split_x86_64_[1234r].stdout): New targets.
6192         (MOSTLYCLEANFILES): Add new executables.
6193         * testsuite/split_i386.sh: New file.
6194         * testsuite/split_x86_64.sh: New file.
6195         * testsuite/split_i386_1.s: New file.
6196         * testsuite/split_i386_2.s: New file.
6197         * testsuite/split_i386_3.s: New file.
6198         * testsuite/split_i386_4.s: New file.
6199         * testsuite/split_i386_n.s: New file.
6200         * testsuite/split_x86_64_1.s: New file.
6201         * testsuite/split_x86_64_2.s: New file.
6202         * testsuite/split_x86_64_3.s: New file.
6203         * testsuite/split_x86_64_4.s: New file.
6204         * testsuite/split_x86_64_n.s: New file.
6205         * testsuite/testfile.cc (Target_test): Update relocation_section
6206         function.
6207         * testsuite/Makefile.in: Rebuild.
6209 2009-10-06  Ian Lance Taylor  <iant@google.com>
6211         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
6212         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
6213         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
6214         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
6215         the address on ldo_addrs_.
6216         (Target_i386::Relocate::fix_up_ldo): New function.
6218 2009-10-06   Rafael Espindola  <espindola@google.com>
6220         * plugin.cc (add_input_library): New.
6221         (Plugin::load): Add add_input_library to tv.
6222         (Plugin_manager::add_input_file): Add the is_lib argument.
6223         (add_input_file): Update call to Plugin_manager::add_input_file.
6224         (add_input_library): New.
6225         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
6227 2009-09-30  Doug Kwan  <dougkwan@google.com>
6229         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
6230         symbol and call Symbol::may_need_copy_reloc to determine if
6231         a copy reloc is needed.
6232         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
6233         nocopyreloc is given in command line.
6234         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
6235         given in command line.
6236         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
6237         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
6238         of the removed Target_i386::may_need_copy_reloc.
6239         * options.h (copyreloc): New option with default value false.
6240         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6241         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
6242         instead of the removed Target_powerpc::may_need_copy_reloc.
6243         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
6244         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
6245         instead of the removed Target_sparc::may_need_copy_reloc.
6246         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
6247         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
6248         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
6249         instead of the removed Target_x86_64::may_need_copy_reloc.
6251 2009-09-30  Ian Lance Taylor  <iant@google.com>
6253         * object.h (class Object): Remove target_ field, and target,
6254         sized_target, and set_target methods.
6255         (Object::sized_target): Remove.
6256         (class Sized_relobj): Update declarations.  Remove sized_target.
6257         * object.cc (Sized_relobj::setup): Remove target parameter.
6258         Change all callers.
6259         (Input_objects::add_object): Don't do anything with the target.
6260         (make_elf_sized_object): Add punconfigured parameter.  Change all
6261         callers.  Set or test parameter target.
6262         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
6263         Change all callers.
6264         * parameters.cc (Parameters::set_target): Change parameter type to
6265         be non-const.
6266         (Parameters::default_target): Remove.
6267         (set_parameters_target): Change parameter type to be non-const.
6268         (parameters_force_valid_target): New function.
6269         (parameters_clear_target): New function.
6270         * parameters.h (class Parameters): Update declarations.  Remove
6271         default_target method.  Add sized_target and clear_target
6272         methods.  Change target_ to be non-const.
6273         (set_parameters_target): Update declaration.
6274         (parameters_force_valid_target): Declare.
6275         (parameters_clear_target): Declare.
6276         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
6277         as NULL if we aren't searching.
6278         (Add_symbols::run): Don't check for compatible target.
6279         * fileread.cc (Input_file::open_binary): Call
6280         parameters_force_valid_target.
6281         * gold.cc (queue_middle_tasks): Likewise.
6282         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
6283         set_target on object.
6284         * dynobj.h (class Sized_dynobj): Update declarations.
6285         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
6286         make_elf_object returns NULL.
6287         (Archive::include_member): Don't check whether object target is
6288         compatible.
6289         * output.cc (Output_section::add_input_section): Get target from
6290         parameters.
6291         (Output_section::relax_input_section): Likewise.
6292         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
6293         parameters.
6294         (Sized_relobj::do_scan_relocs): Likewise.
6295         (Sized_relobj::relocate_sections): Likewise.
6296         * resolve.cc (Symbol_table::resolve): Likewise.
6297         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
6298         parameter.  Change all callers.
6299         (Symbol_table::add_from_object): Get target from parameters.
6300         (Symbol_table::add_from_relobj): Don't check object target.
6301         (Symbol_table::add_from_dynobj): Likewise.
6302         (Symbol_table::define_special_symbol): Get target from
6303         parameters.
6304         * symtab.h (class Symbol_table): Update declaration.
6305         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
6306         parameter.  Change all callers.  Clear parameter target.
6307         (Binary_test): Test target here.
6308         * testsuite/object_unittest.cc (gold_testsuite): Remove
6309         target_test_pointer parameter.  Change all callers.
6310         (Object_test): Test target here.
6312 2009-09-26  Ian Lance Taylor  <iant@google.com>
6314         * testsuite/initpri1.c: Don't try to use constructor priorities if
6315         compiling with gcc before 4.3.
6317 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
6319         * testsuite/retain_symbols_file_test.sh (check_present): Change
6320         output file name to retain_symbols_file_test.stdout.
6321         (check_absent): Likewise.
6323 2009-09-18  Craig Silverstein  <csilvers@google.com>
6325         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
6326         * options.cc: Include <cerrno> and <fstream>.
6327         (General_options::finalize): Parse -retain-symbols-file tag.
6328         * options.h: New flag.
6329         (General_options): New method should_retain_symbol, new
6330         variable symbols_to_retain.
6331         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
6332         should_retain_symbol map.
6333         * testsuite/Makefile.am (retain_symbols_file_test): New test.
6334         * testsuite/Makefile.in: Regenerate.
6335         * testsuite/retain_symbols_file_test.sh: New file.
6337 2009-09-18  Nick Clifton  <nickc@redhat.com>
6339         * po/es.po: Updated Spanish translation.
6341 2009-09-17  Doug Kwan  <dougkwan@google.com>
6343         * debug.h (DEBUG_RELAXATION): New constant.
6344         (DEBUG_ALL): Add DEBUG_RELAXATION.
6345         (debug_string_to_enum): Add relaxation debug option.
6346         * layout.cc
6347         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
6348         Layout::Relaxation_debug_check::read_sections,
6349         Layout::Relaxation_debug_check::read_sections): New method definitions.
6350         (Layout::Layout): Initialize data members
6351         record_output_section_data_from_scrips_,
6352         script_output_section_data_list_ and relaxation_debug_check_.
6353         (Layout::save_segments, Layout::restore_segments,
6354         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6355         Layout::relaxation_loop_body): New method definitions.
6356         (Layout::finalize): Support relaxation.  Move section layout code to
6357         Layout::relaxation_loop_body.
6358         (Layout::set_asection_address_from_script): Move code for orphan
6359         section placement out.
6360         (Layout::place_orphan_sections_in_script): New method definition.
6361         * layout.h (Output_segment_headers, Output_file_header):
6362         New forward class declarations.
6363         (Layout::~Layout): Define.
6364         (Layout::new_output_section_data_from_script): New method definition.
6365         (Layout::place_orphan_sections_in_script): New method declaration.
6366         (Layout::Segment_states): New type declaration.
6367         (Layout::save_segments, Layout::restore_segments,
6368         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
6369         Layout::relaxation_loop_body): New method declarations.
6370         (Layout::Output_section_data_list): New type declaration.
6371         (Layout::Relaxation_debug_check): New class definition.
6372         (Layout::record_output_section_data_from_script_,
6373         Layout::script_output_section_data_list_, Layout::segment_states_,
6374         Layout::relaxation_debug_check_): New data members.
6375         * output.cc: (Output_section_headers::do_size): New method definition.
6376         (Output_section_headers::Output_section_headers): Move size
6377         computation to Output_section_headers::do_size.
6378         (Output_segment_headers::do_size): New method definition.
6379         (Output_file_header::Output_file_header): Move size computation to
6380         Output_file_header::do_size and call it.
6381         (Output_file_header::do_size): New method definition.
6382         (Output_data_group::Output_data_group): Adjust call to
6383         Output_section_data.
6384         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
6385         (Output_symtab_xindex::do_write): Add array bound check.
6386         (Output_section::Input_section::print_to_mapfile): Handle
6387         RELAXED_INPUT_SECTION_CODE.
6388         (Output_section::Output_section): Initialize data member checkpoint_.
6389         (Output_section::~Output_section): Delete checkpoint object pointed
6390         by checkpoint_.
6391         (Output_section::add_input_section): Always add an Input_section if
6392         relaxing.
6393         (Output_section::add_merge_input_section): Add assert.
6394         (Output_section::relax_input_section): New method definition.
6395         (Output_section::set_final_data_size): Set load address to zero for
6396         an unallocated section.
6397         (Output_section::do_address_and_file_offset_have_reset_values):
6398         New method definition.
6399         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
6400         Handle relaxed input section.
6401         (Output_section::sort_attached_input_sections): Checkpoint input
6402         section list lazily.
6403         (Output_section::get_input_sections): Change type of input_sections to
6404         list of Simple_input_section pointers.  Checkpoint input section list
6405         lazily.  Also handle relaxed input sections.
6406         (Output_section::add_input_section_for_script): Take a reference to
6407         a Simple_input_section object instead of Relobj pointer and section
6408         index as parameter.  Handle relaxed input sections.
6409         (Output_section::save_states, Output_section::restore_states): New
6410         method definitions.
6411         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
6412         (Output_data::is_data_size_fixed): New method definition.
6413         (Output_data::reset_addresss_and_file_offset): Do not reset data size
6414         if it is fixed.
6415         (Output_data::address_and_file_offset_have_reset_values): New method
6416         definition.
6417         (Output_data::do_address_and_file_offset_have_reset_values): New method
6418         definition.
6419         (Output_data::set_data_size): Check that data size is not fixed.
6420         (Output_data::fix_data_size): New method definition.
6421         (Output_data::is_data_size_fixed_): New data member.
6422         (Output_section_headers::set_final_data_size): New method definition.
6423         (Output_section_headers::do_size): New method declaration.
6424         (Output_segment_headers::set_final_data_size): New method definition.
6425         (Output_segment_headers::do_size): New method declaration.
6426         (Output_file_header::set_final_data_size)::New method definition.
6427         (Output_file_header::do_size)::New method declaration.
6428         (Output_section_data::Output_section_data): Add new parameter
6429         is_data_size_fixed and use it to fix data size.
6430         (Output_data_const::Output_data_const): Adjust call to base class
6431         constructor and fix data size.
6432         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
6433         base class constructor and fix data size.
6434         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
6435         base class constructor and fix data size.
6436         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
6437         class constructor and fix data size.
6438         (Output_data_group::set_final_data_size): New method definition.
6439         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
6440         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
6441         class constructor and fix data size.
6442         (Output_relaxed_input_section): New class definition.
6443         (Output_section::Simple_input_section): New class definition.
6444         (Output_section::get_input_sections): Adjust parameter list.
6445         (Output_section::add_input_section_for_script): Same.
6446         (Output_section::save_states, Output_section::restore_states,
6447         Output_section::do_address_and_file_offset_have_reset_values,
6448         (Output_section::Input_section::Input_section): Handle
6449         RELAXED_INPUT_SECTION_CODE.  Add new overload for
6450         Output_relaxed_input_section.
6451         (Output_section::Input_section::is_input_section,
6452         Output_section::Input_section::set_output_section): Handle relaxed
6453         input section.
6454         (Output_section::Input_section::is_relaxed_input_section,
6455         Output_section::Input_section::output_section_data,
6456         Output_section::Input_section::relaxed_input_section): New method
6457         definitions.
6458         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
6459         value.
6460         (Output_section::Input_section::u1_): Update comments.
6461         (Output_section::Input_section::u2_): Add new union member poris.
6462         (Output_section::Checkpoint_output_section): New classs definition.
6463         (Output_section::relax_input_section): New method declaration.
6464         (Output_section::checkpoint_): New data member.
6465         (Output_segment): Update comments.
6466         (Output_segment::Output_segment): Un-privatize copy constructor.
6467         (Output_segment::operator=): Un-privatize.
6468         * script-sections.cc (Output_section_element::Input_section_list):
6469         Change element type to Output_section::Simple_input_section.
6470         (Output_section_element_dot_assignment::set_section_addresses):
6471         Register output section data for relaxation clean up.
6472         (Output_data_exression::Output_data_expression): Adjust call to base
6473         constructor to fix data size.
6474         (Output_section_element_data::set_section_addresses): Register
6475         Output_data_expression object for relaxation clean up.
6476         (struct Input_section_info): Replace Relobj pointer and section index
6477         pair with Output_section::Simple_input_section and Convert struct to a
6478         class.
6479         (Input_section_sorter::operator()): Adjust access to
6480         Input_section_info data member to use accessors.
6481         (Output_section_element_input::set_section_addresses): Use layout
6482         parameter.  Adjust code to use Output_section::Simple_input_section
6483         and Input_secction_info classes.  Register filler for relaxation
6484         clean up.
6485         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
6486         and section index pair with Output_section::Simple_input_section
6487         class.  Adjust code accordingly.
6488         (Phdrs_element::release_segment): New method definition.
6489         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
6490         segment list.
6491         (Script_sections::release_segments): New method definition.
6492         * gold/script-sections.h (Script_sections::release_segments): New
6493         method declaration.
6494         * gold/target.h (Target::may_relax, Target::relax,
6495         Target::do_may_relax, Target::do_relax): New method definitions.
6497 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6499         * arm.cc (has_signed_unsigned_overflow): New function.
6500         (Arm_relocate_functions::abs8): New function.
6501         (Target_arm::Scan::local): Handle R_ARM_ABS8.
6502         (Target_arm::Scan::global): Likewise.
6503         (Target_arm::relocate::relocate): Likewise.
6504         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6505         Likewise.
6507 2009-09-16  Cary Coutant  <ccoutant@google.com>
6509         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
6510         * testsuite/Makefile.in: Regenerate.
6512 2009-09-11  Nick Clifton  <nickc@redhat.com>
6514         * po/gold.pot: Updated by the Translation project.
6516 2009-09-08  Cary Coutant  <ccoutant@google.com>
6518         * output.cc (Output_file::open): Add execute permission to empty file.
6519         * testsuite/Makefile.am (permission_test): New test.
6520         * testsuite/Makefile.in: Regenerate.
6522 2009-09-02  Ian Lance Taylor  <iant@google.com>
6524         * output.cc (Output_file::resize): Call map_no_anonymous rather
6525         than map.
6527 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
6529         * gold.cc: Include "incremental.h".
6530         (queue_initial_tasks): Call Incremental_checker methods.
6531         * incremental.cc: Include "output.h".
6532         (Incremental_checker::can_incrementally_link_output_file): New
6533         method.
6534         * incremental.h (Incremental_checker): New class.
6536         * output.cc (Output_file::open_for_modification): New method.
6537         (Output_file::map_anonymous): Changed return type to bool.  Record
6538         map in base_ field.
6539         (Output_file::map_no_anonymous): New method, broken out of map.
6540         (Output_file::map): Use map_no_anonymous and map_anonymous.
6541         * output.h (class Output_file): Update declarations.
6543 2009-08-24  Cary Coutant  <ccoutant@google.com>
6545         * options.h (Command_line::Pre_options): New class.
6546         (Command_line::pre_options): New member.
6547         * options.cc (gold::options::ready_to_register): New variable.
6548         (One_option::register_option): Do nothing if not registering options.
6549         Assert if same short option registered twice.
6550         (General_options::General_options): Turn off option registration when
6551         done constructing.
6552         (Command_line::Pre_options::Pre_options): New constructor.
6554 2009-08-24  Cary Coutant  <ccoutant@google.com>
6556         * options.h (General_options::no_keep_memory): Remove incorrect
6557         short option.
6559 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6561         * Makefile.am (am__skiplex, am__skipyacc): New.
6562         * Makefile.in: Regenerate.
6564 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6566         * Makefile.am (AM_CPPFLAGS): Renamed from ...
6567         (INCLUDES): ... this.
6568         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
6569         (AM_CPPFLAGS): Renamed from ...
6570         (INCLUDE): ... this.
6571         * Makefile.in, testsuite/Makefile.in: Regenerate.
6573         * Makefile.in: Regenerate.
6574         * aclocal.m4: Likewise.
6575         * config.in: Likewise.
6576         * configure: Likewise.
6577         * testsuite/Makefile.in: Likewise.
6579         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6580         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
6581         * Makefile.in: Regenerate.
6582         * testsuite/Makefile.in: Regenerate.
6584 2009-08-19  Cary Coutant  <ccoutant@google.com>
6586         * resolve.cc (Symbol_table::resolve): Don't complain about defined
6587         symbols in shared libraries overridden by hidden or internal symbols
6588         in the main program.
6590 2009-08-19  Chris Demetriou  <cgd@google.com>
6592         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
6593         checking source file names in error messages.
6595 2009-08-18  Doug Kwan  <dougkwan@google.com>
6597         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
6598         an elcpp::Ehdr as parameter.  Adjust call to set_target.
6599         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
6600         an elfcpp::Ehdr as parameter.
6601         * object.cc (Object::set_target): Remove the version that looks up
6602         a target and sets it.
6603         (Sized_relobj::setup): Take a Target object instead of
6604         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
6605         (make_elf_sized_object): Find target and ask target to
6606         make an ELF object.
6607         * object.h: (Object::set_target): Remove the version that looks up
6608         a target and sets it.
6609         (Sized_relobj::setup): Take a Target object instead of
6610         an elfcpp:Ehdr as parameter.
6611         * target.cc: Include dynobj.h.
6612         (Target::do_make_elf_object_implementation): New.
6613         (Target::do_make_elf_object): New.
6614         * target.h (Target::make_elf_object): New template declaration.
6615         (Target::do_make_elf_object): New method declarations.
6616         (Target::do_make_elf_object_implementation): New template declaration.
6618 2009-08-14  Ian Lance Taylor  <iant@google.com>
6620         * gold.h (FUNCTION_NAME): Define.
6621         (gold_unreachable): Use FUNCTION_NAME.
6623 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
6625         * icf.cc (Icf::find_identical_sections): Issue a warning when a
6626         symbol in the --keep-unique list is not found.
6628 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
6630         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
6631         been maked as --keep-unique.
6632         (Icf::unfold_section): New function.
6633         * icf.h (Icf::unfold_section): New function.
6634         * options.h (General_options::keep_unique): New option.
6635         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
6636         * testsuite/Makefile.in: Regenerate.
6637         * testsuite/icf_keep_unique_test.sh: New file.
6638         * testsuite/icf_keep_unique_test.cc: New file.
6640 2009-08-12  Cary Coutant  <ccoutant@google.com>
6642         PR 10471
6643         * resolve.cc (Symbol_table::resolve): Check for references from
6644         dynamic objects to hidden and internal symbols.
6645         * testsuite/Makefile.am (hidden_test.sh): New test.
6646         * testsuite/Makefile.in: Regenerate.
6647         * testsuite/hidden_test.sh: New script.
6648         * testsuite/hidden_test_1.c: New test source.
6649         * testsuite/hidden_test_main.c: New test source.
6651 2009-08-11  Doug Kwan  <dougkwan@google.com>
6653         * arm.cc: Update comments.
6654         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
6655         segment to locate the .ARM.exidx section if present.
6657 2009-08-09  Doug Kwan  <dougkwan@google.com>
6659         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
6660         patch.
6662 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
6663         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
6664         compiler warnings.
6666 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
6668         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
6669         valid tls_segment only for non-debug-section relocations.
6670         * testsuite/Makefile.am: Add gc_tls_test.
6671         * testsuite/Makefile.in: Regenerate.
6672         * testsuite/gc_tls_test.cc: New file.
6673         * testsuite/gc_tls_test.sh: New file.
6675 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
6677         * icf.cc: New file.
6678         * icf.h: New file.
6679         * Makefile.am (CCFILES): Add icf.cc.
6680         (HFILES): Add icf.h
6681         * Makefile.in: Regenerate.
6682         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
6683         * gc.h (gc_process_relocs): Populate lists used by icf to contain
6684         section, symbol and addend information for the relocs.
6685         * gold.cc (queue_middle_tasks): Call identical code folding.
6686         * gold.h: Add defines for multimap.
6687         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
6688         to the call of finalize_local_symbols.
6689         * main.cc (main): Create object of class Icf.
6690         * object.cc (Sized_relobj::do_layout): Allow this function to be
6691         called twice during icf.
6692         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
6693         to sections marked as identical by icf.
6694         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
6695         when available.
6696         (Sized_relobj::do_section_entsize): New function.
6697         * object.h (Object::section_entsize): New function.
6698         (Object::do_section_entsize): New pure virtual function.
6699         (Relobj::finalize_local_symbols): Add new parameter.
6700         (Relobj::do_section_entsize): New function.
6701         * options.h (General_options::icf): New option.
6702         (General_options::icf_iterations): New option.
6703         (General_options::print_icf_sections): New option.
6704         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
6705         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
6706         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
6707         icf.
6708         * symtab.cc (Symbol_table::is_section_folded): New function.
6709         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
6710         to sections marked as identical by icf.
6711         * symtab.h (Symbol_table::set_icf): New function.
6712         (Symbol_table::icf): New function.
6713         (Symbol_table::is_section_folded): New function.
6714         (Symbol_table::icf_): New data member.
6715         * target-reloc.h (relocate_section): Ignore sections folded by icf.
6716         * testsuite/Makefile.am: Add commands to build icf_test.
6717         * testsuite/Makefile.in: Regenerate.
6718         * testsuite/icf_test.sh: New file.
6719         * testsuite/icf_test.cc: New file.
6721 2009-07-24  Chris Demetriou  <cgd@google.com>
6723         * layout.cc (is_compressible_debug_section): Fix incorrect
6724         comment about compressed section names.
6726 2009-07-20  Ian Lance Taylor  <ian@airs.com>
6728         PR 10419
6729         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
6731 2009-07-16  Ian Lance Taylor  <iant@google.com>
6733         PR 10400
6734         * layout.h: #include <map>.
6735         (class Kept_section): Change from struct to class.  Add accessors
6736         and setters.  Add section size to Comdat_group mapping.  Change
6737         Comdat_group to std::map.  Add is_comdat_ field.  Add
6738         linkonce_size field in union.
6739         (class Layout): Update declaration of find_or_add_kept_section.
6740         Don't declare find_kept_object.
6741         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
6742         parameter.  Add object, shndx, is_comdat, and is_group_name
6743         parameters.  Change all callers.  Adjust for new Kept_section.
6744         (Layout::find_kept_object): Remove.
6745         * object.cc (Sized_relobj::include_section_group): Update use of
6746         Kept_section.  Rename secnum to shndx.  Only record
6747         Kept_comdat_section if sections are the same size.
6748         (Sized_relobj::include_linkonce_section): Update use of
6749         Kept_section.  Only record Kept_comdat_section if sections are the
6750         same size.  Set size of linkonce section.
6751         (Sized_relobj::map_to_kept_section): Update call to
6752         get_kept_comdat_section.
6753         * object.h (class Sized_relobj): Rename fields in
6754         Kept_comdat_section to drop trailing underscores; change object
6755         field to Relobj*.  Change Kept_comdat_section_table to store
6756         struct rather than pointer.
6757         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
6758         Add kept_object and kept_shndx parameters.  Change all callers.
6759         (Sized_relobj::get_kept_comdat_section): Change return type to
6760         bool.  Add kept_object and kept_shndx parameters.  Change all
6761         callers.
6762         * plugin.cc (Pluginobj::include_comdat_group): Update call to
6763         Layout::find_or_add_kept_section.
6765 2009-07-09  Ian Lance Taylor  <iant@google.com>
6767         * merge.cc (Object_merge_map::initialize_input_to_output_map):
6768         Reserve space in the hash table.
6770 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
6772         * fileread.cc (File_read::get_mtime): New method.
6773         * fileread.h (Timespec): New structure.
6774         (File_read::get_mtime): New method.
6775         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
6776         Renamed from timestamp_nsec.
6777         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
6778         Elf_Xword.
6779         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
6780         timestamp_nsec.
6781         (Incremental_inputs::report_archive): Save mtime; style fix.
6782         (Incremental_inputs::report_obejct): Save mtime; style fix.
6783         (Incremental_inputs::report_script): Save mtime; style fix.
6784         (Incremental_inputs::finalize_inputs): Style fix.
6785         (Incremental_inputs::finalize): Style fix.
6786         (Incremental_inputs::create_input_section_data): Store inputs
6787         mtime.
6788         * incremental.h (Incremental_inputs::report_script): Add mtime
6789         argument.
6790         (Incremental_inputs::Input_info::Input_info): Intialize only one
6791         union member.
6792         (Incremental_inputs::Input_info::archive): Move to nameless
6793         union.
6794         (Incremental_inputs::Input_info::obejct): Move to nameless union.
6795         (Incremental_inputs::Input_info::script): Move to nameless union.
6796         (Incremental_inputs::mtime): New field.
6797         * script.cc (read_input_script): Pass file mtime to
6798         Incremental_input.
6799         * script.h (Script_info::inputs): Style fix.
6801 2009-07-01  Ian Lance Taylor  <ian@airs.com>
6803         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
6804         instead of 32.
6806 2009-06-24  Ian Lance Taylor  <iant@google.com>
6808         PR 10156
6809         * layout.cc (Layout::choose_output_section): If we find an
6810         existing section, update the flags.
6811         (Layout::create_notes): New function, broken out of
6812         Layout::finalize.
6813         (Layout::finalize): Don't create note sections.
6814         (Layout::create_note): Don't crash if linker script discards
6815         section.
6816         (Layout::create_gold_note): Likewise.
6817         (Layout::create_build_id): Likewise.  Don't set
6818         after_input_sections on the section.
6819         (Layout::create_executable_stack_info): Remove target parameter.
6820         Change caller.
6821         * layout.h (class Layout): Declare create_notes.  Update
6822         declaration of create_executable_stack_info.
6823         * gold.cc (queue_middle_tasks): Call create_notes.
6824         * output.cc (Output_section::update_flags_for_input_section): Move
6825         here from output.h.  If SHF_ALLOC flag is newly set, mark address
6826         invalid.
6827         * output.h (Output_data::mark_address_invalid): New function.
6828         (class Output_section): Only declare, not define,
6829         update_flags_for_input_section.  Remove set_flags.
6831 2009-06-24  Ian Lance Taylor  <iant@google.com>
6833         * script-sections.cc (Output_section_definition::
6834         set_section_addresses): Rename shadowing local load_address to
6835         laddr.
6837 2009-06-24  Ian Lance Taylor  <iant@google.com>
6839         PR 10244
6840         * reloc.cc (relocate_sections): Skip empty relocation sections.
6842 2009-06-23  Ian Lance Taylor  <iant@google.com>
6844         PR 10156
6845         * layout.cc (Layout::create_note): Use choose_output_section
6846         rather than make_output_section.
6848 2009-06-23  Ian Lance Taylor  <iant@google.com>
6850         PR 10237
6851         * options.cc (General_options::parse_V): Set printed_version_.
6852         (General_options::General_options): Initialize printed_version_.
6853         * options.h (class General_options): Add printed_version_ field.
6854         * gold.cc (queue_initial_tasks): If there are no input files,
6855         don't give a fatal error if we printed the version information.
6856         (queue_middle_tasks): If using -r with a shared object, give a
6857         fatal error rather than an ordinary error.
6859 2009-06-23  Ian Lance Taylor  <iant@google.com>
6861         PR 10219
6862         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
6863         (Layout::make_output_section): Set have_stabstr_section_ if we see
6864         a .stab*str section.
6865         (Layout::finalize): Call link_stabs_sections.
6866         (Layout::link_stabs_sections): New file.
6867         * layout.h (class Layout): Add have_stabstr_section_ field.
6868         Declare link_stabs_sections.
6870 2009-06-23  Doug Kwan  <dougkwan@google.com>
6872         * Makefile.am (libgold_a_LIBADD): New.
6873         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
6874         * Makefile.in: Regenerate.
6875         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
6876         * configure: Regenerate.
6877         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
6878         * fileread.cc: Include sys/state.h
6879         * gold.h: Declare memmem and strndup if found missing.
6880         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
6882 2009-06-23  Ian Lance Taylor  <iant@google.com>
6884         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
6885         * configure: Rebuild.
6887 2009-06-23  Ian Lance Taylor  <iant@google.com>
6889         PR 10147
6890         * object.cc (Object::section_contents): Don't try to get a view if
6891         the section has length zero.
6892         (Object::handle_gnu_warning_section): If the section is empty, use
6893         the name of the section as the warning.
6895 2009-06-23  Ian Lance Taylor  <iant@google.com>
6897         PR 10133
6898         * stringpool.h (class Stringpool_template): Add optimize_ field.
6899         (Stringpool_template::set_optimize): New function.
6900         * stringpool.cc (Stringpool_template::Stringpool_template):
6901         Initialize optimize_ field.
6902         (Stringpool_template::set_string_offsets): Test local optimize
6903         fild rather than parameter.
6904         * layout.cc (Layout::Layout): Call set_optimize on the section
6905         name stringpool.
6907 2009-06-22  Ian Lance Taylor  <iant@google.com>
6909         PR 10030
6910         * yyscript.y: Parse TARGET.
6911         * script.cc (script_set_target): New function.
6912         * script-c.h (script_set_target): Declare.
6913         * options.cc (General_options::string_to_object_format): Rename
6914         from string_to_object_format in anonymous namespace.  Change
6915         callers.
6916         * options.h (class General_options): Declare
6917         string_to_object_format.
6919 2009-06-22  Ian Lance Taylor  <iant@google.com>
6921         * script-sections.cc (Script_sections::create_segments): Don't put
6922         program headers in a PT_LOAD segment if -n or -N.
6924 2009-06-22  Ian Lance Taylor  <iant@google.com>
6926         PR 10141
6927         * options.h (class General_options): Add -z lazy and -z now.  Sort
6928         -z options into alphabetical order.
6929         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
6931 2009-06-21  Ian Lance Taylor  <iant@google.com>
6933         * layout.cc (Layout::make_output_section): Call
6934         Target::new_output_section.
6935         (Layout::attach_allocated_section_to_segment): Put large section
6936         sections in a separate load segment with the large segment flag
6937         set.
6938         (Layout::segment_precedes): Sort large data segments after other
6939         load segments.
6940         (align_file_offset): New static function.
6941         (Layout::set_segment_offsets): Use align_file_offset.
6942         * output.h (class Output_section): Add is_small_section_ and
6943         is_large_section_ fields.
6944         (Output_section::is_small_section): New function.
6945         (Output_section::set_is_small_section):  New function.
6946         (Output_section::is_large_section): New function.
6947         (Output_section::set_is_large_section): New function.
6948         (Output_section::is_large_data_section): New function.
6949         (class Output_segment): Add is_large_data_segment_ field.
6950         (Output_segment::is_large_data_segment): New function.
6951         (Output_segment::set_is_large_data_segment): New function.
6952         * output.cc (Output_section::Output_section): Initialize new
6953         fields.
6954         (Output_segment::Output_segment): Likewise.
6955         (Output_segment::add_output_section): Add assertion that large
6956         data sections always go in large data segments.  Force small data
6957         sections to the end of the list of data sections.  Force small BSS
6958         sections to the start of the list of BSS sections.  For large BSS
6959         sections to the end of the list of BSS sections.
6960         * symtab.h (class Symbol): Declare is_common_shndx.
6961         (Symbol::is_defined): Check Symbol::is_common_shndx.
6962         (Symbol::is_common): Likewise.
6963         (class Symbol_table): Define enum Commons_section_type.  Update
6964         declarations.  Add small_commons_ and large_commons_ fields.
6965         * symtab.cc (Symbol::is_common_shndx): New function.
6966         (Symbol_table::Symbol_table): Initialize new fields.
6967         (Symbol_table::add_from_object): Put small and large common
6968         symbols in the right list.
6969         (Symbol_table::sized_finalized_symbol): Check
6970         Symbol::is_common_shndx.
6971         (Symbol_table::sized_write_globals): Likewise.
6972         * common.cc (Symbol_table::do_allocate_commons): Allocate new
6973         common symbol lists.  Don't call do_allocate_commons_list if the
6974         list is empty.
6975         (Symbol_table::do_allocate_commons_list): Remove is_tls
6976         parameter.  Add comons_section_type parameter.  Change all
6977         callers.  Handle small and large common symbols.
6978         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
6979         Symbol::is_common_shndx.
6980         * resolve.cc (symbol_to_bits): Likewise.
6981         * target.h (Target::small_common_shndx): New function.
6982         (Target::small_common_section_flags): New function.
6983         (Target::large_common_shndx): New function.
6984         (Target::large_common_section_flags): New function.
6985         (Target::new_output_section): New function.
6986         (Target::Target_info): Add small_common_shndx, large_common_shndx,
6987         small_common_section_flags, and large_common_section_flags
6988         fields.
6989         (Target::do_new_output_section): New virtual function.
6990         * arm.cc (Target_arm::arm_info): Initialize new fields.
6991         * i386.cc (Target_i386::i386_info): Likewise.
6992         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6993         Likewise.
6994         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
6995         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
6996         (Target_x86_64::do_new_output_section): New function.
6997         * configure.ac: Define conditional MCMODEL_MEDIUM.
6998         * testsuite/Makefile.am (check_PROGRAMS): Add large.
6999         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7000         (large_LDFLAGS): Define.
7001         * testsuite/large.c: New file.
7002         * testsuite/testfile.cc (Target_test::test_target_info):
7003         Initialize new fields.
7004         * configure, testsuite/Makefile.in: Rebuild.
7006 2009-06-05  Doug Kwan  <dougkwan@google.com>
7008         * Makefile.am (CCFILES): Add target.cc.
7009         * Makefile.in: Regenerate.
7010         * i386.cc (class Target_i386): Define new virtual method to
7011         override do_is_local_label_name in parent.
7012         * object.cc (Sized_relobj::do_count_local_symbols): Discard
7013         local symbols if --discard-locals or -X is given.
7014         * options.h (class General_options): Declare new options
7015         '--discard-locals' and '-X' for discarding locals.
7016         * target.h (class Target): Define new methods is_local_label_name.
7017         Declare new virtual method do_is_local_label_name.
7018         * target.cc: New file.
7019         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7020         (check_SCRIPTS): Add discard_locals_test.sh.
7021         (check_DATA): Add discard_local_tests.syms.
7022         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7023         (discard_local_tests.syms, discard_locals_test.o): New make rules.
7024         * testsuite/Makefile.in: Regenerate.
7025         * testsuite/discard_locals_test.c: New file.
7026         * testsuite/discard_locals_test.sh: Same.
7028 2009-06-05  Doug Kwan  <dougkwan@google.com>
7030         * object.cc (Sized_relobj::Sized_relobj): Initialize
7031         discarded_eh_frame_shndx_ to -1U.
7032         (Sized_relobj::do_layout): Record index of a discard .eh_frame
7033         section.
7034         (Sized_relobj::do_count_local_symbols): Skip local symbols in
7035         a discarded .eh_frame section.
7036         (Sized_relobj::do_finalize_local_symbols): Ditto.
7037         * object.h (class Sized_relobj): Declare new member
7038         discarded_eh_frame_shndx_.
7039         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7040         (local_labels_test.o, local_labels_test): New rules.
7041         * testsuite/Makefile.in: Regenerate.
7043 2009-06-04  Doug Kwan  <dougkwan@google.com>
7045         * layout.cc (Layout::section_name_mapping): Add mapping for
7046         special ARM sections.
7048 2009-06-03  Doug Kwan  <dougkwan@google.com>
7050         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
7051         (utils::has_overflow): Same.
7053 2009-06-03  Ian Lance Taylor  <iant@google.com>
7055         * layout.cc (Layout::section_name_mapping): New array, replacing
7056         Layout::linkonce_mapping.
7057         (Layout::section_name_mapping_count): New variable, replacing
7058         Layout::linkonce_mapping_count.
7059         (Layout::linkonce_output_name): Remove.
7060         (Layout::output_section_name): Rewrite.
7061         * layout.h (class Layout): Rename Linkonce_mapping to
7062         Section_name_mapping, linkonce_mapping to section_name_mapping,
7063         linkonce_mapping_count to section_name_mapping_count.  Don't
7064         declare linkonce_output_name.
7066 2009-06-03  Doug Kwan  <dougkwan@google.com>
7068         * gold/arm.cc (namespace utils): New.
7069         (Target_arm::reloc_is_non_pic): Define new method.
7070         (class Arm_relocate_functions): New.
7071         (Target_arm::Relocate::relocate): Handle relocation types used by
7072         Android.
7074 2009-06-03  Ian Lance Taylor  <iant@google.com>
7076         * arm.cc (Target_arm::scan::global): Use || instead of |.
7078 2009-06-02  Doug Kwan  <dougkwan@google.com>
7080         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
7081         issued_non_pic_error_.
7082         (class Target_arm::Scan): Declare new method check_non_pic.
7083         Define new method symbol_needs_plt_entry.
7084         Declare new data member issued_non_pic_error_.
7085         (class Target_arm::Relocate): Declare new method
7086         should_apply_static_reloc.
7087         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
7088         (Target_arm::Scan::check_non_pic): Define new method.
7089         (Target_arm::Scan::local): Handle a small subset of reloc types used
7090         by Android.
7091         (Target_arm::Scan::local): Same.
7092         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
7094 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
7096         * incremental.cc (Incremental_inputs::report_command_line): Filter
7097         out --incremental-* options.
7099 2009-05-29  Doug Kwan  <dougkwan@google.com>
7101         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
7102         template class.
7103         (class Target_arm): Update comment.
7104         (Target_arm::Target_arm): Initialize new data members GOT_,
7105         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
7106         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
7107         and Target_arm::rel_dyn_section.
7108         Declare new_enum Target_arm::Got_type.
7109         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
7110         and DYNBSS_.
7111         Update commments for member do_dynsym_value.
7112         (Target_arm::got_size, Target_arm::plt_section,
7113         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
7114         new methods inside class defintion.
7115         (Target_arm::got_section): Define new method.
7116         (Target_arm::rel_dyn_section): Same.
7117         (Output_data_plt_arm): New template class.
7118         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
7119         (Output_data_plt_arm:do_adjust_output_section): Define new method.
7120         (Output_data_plt_arm::add_entry): Same.
7121         (Output_data_plt_arm::first_plt_entry): Define new
7122         static data member for PLT instruction template.
7123         (Output_data_plt_arm::plt_entry): Same.
7124         (Output_data_plt_arm::do_write): Define new method.
7125         (Target_arm::make_plt_entry): Same.
7126         (Target_arm::do_finalize_sections): Same.
7127         (Target_arm::do_dynsym_value): Same.
7129 2009-05-28  Doug Kwan  <dougkwan@google.com>
7131         * Makefile.am (TARGETSOURCES): Add arm.cc.
7132         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
7133         * Makefile.in: Regenerate.
7134         * arm.cc: New file.
7135         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
7137 2009-05-26  Doug Kwan  <dougkwan@google.com>
7139         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
7140         (General_options::check_excluded_libs): Strip off directories in
7141         archive name before matching like GNU ld does.
7142         * testsuite/Makefile.am (MOSTLYCLEANFILES,
7143         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
7144         (exclude_libs_test_LDFLAGS): Add linker option
7145         -Wl,--exclude-libs,libexclude_libs_test_3
7146         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
7147         an explicit archive without using -l.
7148         (alt/libexclude_libs_test_3.a): New make rule.
7149         * testsuite/Makefile.in: Regenerate.
7150         * testsuite/exclude_libs_test.c : Declare lib3_default().
7151         (main): Call it.
7152         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
7153         * exclude_libs_test_3.c: New file.
7155 2009-05-26  Nick Clifton  <nickc@redhat.com>
7157         * po/id.po: New Indonesian translation.
7158         * po/gold.pot: Updated template file.
7160 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
7162         * testsuite/Makefile.am: Add -ffunction-sections to compile
7163         gc_comdat_test files.  Add -Wl,--gc-sections to build
7164         gc_comdat_test.
7165         * testsuite/Makefile.in: Regenerate.
7166         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
7168 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
7170         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
7171         kept comdat section was garbage collected.
7172         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
7173         * testsuite/Makefile.in: Regenerate.
7174         * testsuite/gc_comdat_test.sh: New file.
7175         * testsuite/gc_comdat_test_1.cc: New file.
7176         * testsuite/gc_comdat_test_2.cc: New file.
7178 2009-05-19  Doug Kwan  <dougkwan@google.com>
7180         * archive.cc (Archive::Archive): Move constructor from archive.h
7181         to here.  Initialize no_export_.
7182         (Archive::get_elf_object_for_member): Set no_export flag of object.
7183         * archive.h (Archive::Archive): Move constructor body to
7184         archive.cc.
7185         (Archive::no_export): New method.
7186         (Archive::no_export_): New field.
7187         * object.h (Object::Object): Initialize no_export_ to false.
7188         (Object::no_export, Object::set_no_export): New methods.
7189         (Object::no_export_): New field.
7190         * options.cc (General_options::parse_exclude_libs): New method.
7191         (General_options::check_excluded_libs) Same.
7192         * options.h (exclude_libs): New option.
7193         (General_options::check_excluded_libs): New method declaration.
7194         (General_options::excluded_libs_): New field.
7195         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
7196         default or protected visibility if an object has no-export flag set.
7197         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
7198         (check_SCRIPTS): Add exclude_libs_test.sh.
7199         (check_DATA): Add exclude_libs_test.syms.
7200         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
7201         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
7202         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
7203         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
7204         (exclude_libs_test.syms, libexclude_libs_test_1.a,
7205         libexclude_libs_test_2.a): New rules.
7206         * testsuite/Makefile.in: Regenerate.
7207         * testsuite/exclude_libs_test.c: New file.
7208         * testsuite/exclude_libs_test.sh: Ditto.
7209         * testsuite/exclude_libs_test_1.c: Ditto.
7210         * testsuite/exclude_libs_test_2.c: Ditto.
7212 2009-05-15  Ian Lance Taylor  <iant@google.com>
7214         * configure.ac: Check for declarations for cases where libiberty.h
7215         checks HAVE_DECL_xxx.
7216         * configure, config.in: Rebuild.
7218 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
7220         * gold.h (Incremental_argument_list): Remove (invalid) forward
7221         declaration.
7222         * incremental.cc (Incremental_inputs::report_achive): New method.
7223         (Incremental_inputs::report_object): New method.
7224         (Incremental_inputs::report_script): New method.
7225         (Incremental_inputs::finalize_inputs): New method.
7226         (Incremental_inputs::finalize): Call finalize_inputs().
7227         (Incremental_inputs::sized_create_incremental_inputs_section_data):
7228         Create inputs entries.
7229         * incremental.h (Incremental_input_type): New enum.
7230         (Incremental_inputs::Incremental_input): Initialize new fields.
7231         (Incremental_inputs::report_inputs): New method.
7232         (Incremental_inputs::report_achive): New method.
7233         (Incremental_inputs::report_object): New method.
7234         (Incremental_inputs::report_script): New method.
7235         (Incremental_inputs::finalize_inputs): New method.
7236         (Incremental_inputs::Input_info): New struct.
7237         (Incremental_inputs::Input_info_map): New typedef.
7238         (Incremental_inputs::lock_): New field.
7239         (Incremental_inputs::Inputs_): New field.
7240         (Incremental_inputs::Inputs_map): New field.
7241         * main.cc (main): Call Incremental_input::report_inputs.
7242         * options.h (Input_argument_list): Typedef moved from
7243         Input_arguments.
7244         (Input_file_group::Files): Remove, use ::Input_argument_list.
7245         (Input_file_group::Input_argument_list): Remove, use
7246         ::Input_argument_list.
7247         * plugin.cc (Plugin_manager::add_input_file): Add error in
7248         incremental build.
7249         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
7250         functions.
7251         * script.cc (read_input_script): Call
7252         Incremental_input::report_script.
7253         * script.h (Script_info): New class.
7255 2009-04-27  Ian Lance Taylor  <iant@google.com>
7257         * x86_64.cc (do_adjust_output_section): Set entsize to
7258         plt_entry_size.
7260 2009-04-23  Elliott Hughes  <enh@google.com>
7262         * output.cc (Output_file::close): After short writes, continue
7263         writing from the correct offset in the buffer being written.
7265 2009-04-23  Chris Demetriou  <cgd@google.com>
7267         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
7268         * configure: Regenerate.
7269         * config.in: Regenerate.
7270         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
7271         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
7273 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
7275         * incremental.cc (Incremental_inputs_header_data): Renamed from
7276         Incremental_input_header_data.
7277         (Incremental_inputs_header_data::data_size): New field.
7278         (Incremental_inputs_header_data::put_input_file_count): Renamed
7279         from input_file_count.
7280         (Incremental_inputs_header_data::put_command_line_offset): Renamed
7281         from command_line_offset.
7282         (Incremental_inputs_header_data::put_reserved): Renamed from
7283         put_reserved.
7284         (Incremental_inputs_entry_data): Renamed from
7285         Incremental_input_entry_data.
7286         (Incremental_inputs_entry_data::data_size): New field.
7287         (Incremental_inputs::report_command_line): New method.
7288         (Incremental_inputs::finalize): New method.
7289         (Incremental_inputs::create_incremental_inputs_data): New method.
7290         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
7291         * incremental.h: New file.
7292         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
7293        (Layout::finalize): Create incremental inputs section in
7294         incremental builds.
7295        (Layout::create_incremental_info_sections): New method.
7296         * layout.h (Layout::incremental_inputs): New method.
7297        (Layout::create_incremental_info_sections): New method.
7298        (Layout::incremental_inputs_): New field.
7299         * main.cc (main): Notify Incremental_input of the command line.
7301 2009-04-01  Ian Lance Taylor  <iant@google.com>
7302             Mikolaj Zalewski  <mikolajz@google.com>
7304         * gold.h (reserve_unordered_map): Define, three versions, one for
7305         each version of Unordered_map.
7306         * layout.cc (Layout::Layout): Remove options parameter.  Add
7307         number_of_input_files parameter.  Don't initialize options_.
7308         Initialize number_of_input_files_ and resized_signatures_.  Move
7309         sections_are_attached_.
7310         (Layout::layout_group): Reserve space for group_signatures_.
7311         (Layout::find_or_add_kept_section): Change name parameter to be a
7312         reference.  Resize signatures_ map when it gets large enough.
7313         (Layout::layout_eh_frame): Use parameters->options() instead of
7314         this->options_.
7315         (Layout::make_output_section): Likewise.
7316         (Layout::attach_allocated_section_to_segment): Likewise.
7317         (Layout::finalize, Layout::create_executable_stack): Likewise.
7318         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
7319         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
7320         * layout.h (class Layout): Update declarations.  Remove options_
7321         field.  Add number_of_input_files_ and resized_signatures_
7322         fields.  Move sections_are_attached_ field.
7323         * main.cc (main): Pass number of input files to Layout
7324         constructor.  Don't pass options.
7326 2009-03-30  Ian Lance Taylor  <iant@google.com>
7328         * ffsll.c (ffsll): Correct implementation.
7330 2009-03-27  Ian Lance Taylor  <iant@google.com>
7332         * ffsll.c: New file.
7333         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
7334         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
7335         * ftruncate.c (ftruncate): Declare before definition.
7336         * mremap.c (mremap): Likewise.
7337         * pread.c (pread): Likewise.
7338         * configure, Makefile.in, config.in: Rebuild.
7340         * mremap.c: New file.
7341         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
7342         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
7343         (mremap): Declare if HAVE_MREMAP is not defined.
7344         * configure, Makefile.in, config.in: Rebuild.
7346 2009-03-27  Cary Coutant  <ccoutant@google.com>
7348         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
7349         position independent.
7350         * sparc.cc (Target_sparc::check_non_pic): Likewise.
7351         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
7353 2009-03-24  Cary Coutant  <ccoutant@google.com>
7355         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
7356         an executable.
7357         (needs_dynamic_reloc): Likewise.
7359 2009-03-24  Ian Lance Taylor  <iant@google.com>
7361         * yyscript.y (file_cmd): Recognize EXTERN.
7362         (extern_name_list, extern_name_list_body): New nonterminals.
7363         * script.cc (script_add_extern): Define.
7364         * script-c.h (script_add_extern): Declare.
7366 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
7368         * object.cc (is_elf_object): Define.
7369         * object.h (is_elf_object): Declare.
7370         * archive.cc (Archive::get_elf_object_for_member): Call
7371         is_elf_object.
7372         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
7374 2009-03-24  Elliott Hughes  <enh@google.com>
7376         * output.cc (Output_file::map_anonymous): Define.
7377         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
7378         try an anonymous one.  Report the size if the mmap fails.
7379         * output.h (class Output_file): Declare map_anonymous.
7381 2009-03-24  Ian Lance Taylor  <iant@google.com>
7383         * target-select.cc (instantiate_target): Don't acquire the lock if
7384         the instantiated_target_ field has already been set.
7386 2009-03-23  Ian Lance Taylor  <iant@google.com>
7388         * gold-threads.h (class Initialize_lock): Define.
7389         * gold-threads.cc (class Initialize_lock_once): Define.
7390         (initialize_lock_control): New static variable.
7391         (initialize_lock_pointer): New static variable.
7392         (initialize_lock_once): New static function.
7393         (Initialize_lock::Initialize_lock): Define.
7394         (Initialize_lock::initialize): Define.
7395         * target-select.h: Include "gold-threads.h".
7396         (class Target_selector): Add lock_ and initialize_lock_ fields.
7397         Don't define instantiate_target, just declare it.
7398         * target-select.cc (Target_selector::Target_selector): Initialize
7399         new fields.
7400         (Target_selector::instantiate_target): Define.
7401         * descriptors.h: Include "gold-threads.h".
7402         (class Descriptors): Add initialize_lock_ field.
7403         * descriptors.cc (Descriptors::Descriptors): Initialize new
7404         field.
7405         (Descriptors::open): Use initialize_lock_ field
7406         * errors.h (class Errors): Add initialize_lock_ field.
7407         * errors.cc (Errors::Errors): Initialize new field.
7408         (Errors::initialize_lock): Use initialize_lock_ field.
7409         * powerpc.cc (class Target_selector_powerpc): Remove
7410         instantiated_target_ field.  In do_recognize call
7411         instantiate_target rather than do_instantiate_target.  In
7412         do_instantiate_target just allocate a new target.
7413         * sparc.cc (class Target_selector_sparc): Likewise.
7415         * freebsd.h: New file.
7416         * i386.cc: Include "freebsd.h".
7417         (Target_i386): Derive from Target_freebsd rather than
7418         Sized_target.
7419         (Target_selector_i386): Derive from Target_selector_freebsd rather
7420         than Target_selector.
7421         * x86_64.cc: Include "freebsd.h".
7422         (Target_x86_64): Derive from Target_freebsd rather than
7423         Sized_target.
7424         (Target_selector_x86_64): Derive from Target_selector_freebsd
7425         rather than Target_selector.
7426         * target.h (class Target): Add adjust_elf_header and
7427         do_adjust_elf_header.
7428         * output.cc (Output_file_header:: do_sized_write): Call target
7429         adjust_elf_header routine.
7430         * configure.tgt: Set targ_osabi.
7431         * configure.ac: Define GOLD_DEFAULT_OSABI.
7432         * parameters.cc (Parameters::default_target): Pass
7433         GOLD_DEFAULT_OSABI to select_target.
7434         * target-select.h (class Target_selector): Make instantiate_target
7435         protected rather than private.
7436         * Makefile.am (HFILES): Add freebsd.h.
7437         * configure, Makefile.in, config.in: Rebuild.
7439         * merge.cc (do_add_input_section): Correct pend value.  Change
7440         message about last entry not being null terminated from error to
7441         warning.
7443 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
7445         * incremental.cc: New file.
7446         * Makefile.am (CCFILES): Add incremental.cc.
7447         * Makefile.in: Rebuild.
7449 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
7451         * layout.cc (Layout::output_section_name): Preserve names
7452         of '.note.' sections.
7454 2009-03-19  Ian Lance Taylor  <iant@google.com>
7456         * descriptors.cc (Descriptors::open): Check that the options are
7457         valid before using them.
7459 2009-03-18  Ian Lance Taylor  <iant@google.com>
7461         * script-sections.h: Include <list>.
7462         (class Script_sections): Change Sections_elements from std::vector
7463         to std::list.  Typedef public Elements_iterator.  Add
7464         orphan_section_placement_, data_segment_align_start_, and
7465         saw_data_segment_align_ fields.  Remove data_segment_align_index_
7466         field.
7467         * script-sections.cc (class Orphan_section_placement): New class.
7468         (class Sections_element): Add virtual functions is_relro and
7469         orphan_section_init.  Remove virtual function place_orphan_here.
7470         (class Output_section_definition): Add is_relro and
7471         orphan_section_init.  Remove place_orphan_here.
7472         (class Orphan_output_section): Likewise.
7473         (Script_sections::Script_sections): Update for field changes.
7474         (Script_sections::data_segment_align): Set saw_data_segment_align_
7475         and data_segment_align_start_, not data_segment_align_index.
7476         (Script_sections::data_segment_relro_end): Check
7477         saw_data_segment_align_.  Use data_segment_align_start_ rather
7478         than data_segment_align_index_.
7479         (Script_sections::place_orphan): Rewrite to use
7480         Orphan_section_placement.
7482 2009-03-17  Ian Lance Taylor  <iant@google.com>
7484         * archive.cc (Archive::add_symbols): Check for a version attached
7485         to the symbol name in the archive map.
7486         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
7487         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
7488         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
7489         (ver_test_11.a): New target.
7490         * testsuite/Makefile.in: Rebuild.
7492         * configure.ac: Check for chsize and posix_fallocate.  Replace
7493         ftruncate.
7494         * ftruncate.c: New file, from gnulib.
7495         * output.cc (posix_fallocate): Define dummy version if not
7496         HAVE_POSIX_FALLOCATE.
7497         (Output_file::map): Call posix_fallocate rather than lseek and
7498         write.
7499         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
7500         * configure, Makefile.in, config.in: Rebuild.
7502 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
7504         * layout.h (Layout::create_note): Add section_name parameter.
7505         * layout.cc (Layout::create_note): Likewise.
7506         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
7508 2009-03-17  Ian Lance Taylor  <iant@google.com>
7510         * descriptors.cc: Include "options.h".
7511         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
7512         (Descriptors::open): Always use O_CLOEXEC when opening a new
7513         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
7514         then set FD_CLOEXEC.
7516         * sparc.cc (class Target_sparc): Add has_got_section.
7517         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
7518         make sure we have a GOT section.
7520         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
7521         (Target_sparc::Scan::local): Likewise.
7522         (Target_sparc::Scan::global): Likewise.
7523         (Target_sparc::Relocate::relocate): Likewise.
7524         (Target_sparc::Relocate::relocate_tls): Likewise.
7526         * symtab.cc (Symbol_table::define_default_version): New function,
7527         broken out of add_from_object.
7528         (Symbol_table::add_from_object): Call define_default_version.
7529         (Symbol_table::define_special_symbol): Add resolve_oldsym
7530         parameter.  Change all callers.  If the version for a symbol comes
7531         from a version script, resolve it with the symbol with the same
7532         name with no version.  Also add the symbol without a version if
7533         appropriate.
7534         (do_define_in_output_data): If resolving with oldsym, don't delete
7535         sym.
7536         (do_define_in_output_segment): Likewise.
7537         (do_define_as_constant): Likewise.
7538         * symtab.h (class Symbol_table): Update declarations.
7540 2009-03-13  Ian Lance Taylor  <iant@google.com>
7542         * readsyms.cc (Read_symbols::incompatible_warning): New function.
7543         (Read_symbols::requeue): New function.
7544         (Read_symbols::do_read_symbols): If make_elf_object fails because
7545         the target type is not configured, and the file was searched for,
7546         issue a warning and retry with the next directory.
7547         (Add_symbols::run): If the file has an incompatible format, and
7548         it was searched for, requeue the Read_symbols task.  On error,
7549         release the object.
7550         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
7551         dirindex parameter to constructor.  Change all callers.  Declare
7552         incompatible_warning and requeue.
7553         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
7554         input_argument_ and input_group_ fields.  Add them to
7555         constructor.  Change all callers.
7556         (class Read_script): Add dirindex_ field.  Add it to constructor.
7557         Change all callers.
7558         * archive.cc (Archive::setup): Remove input_objects parameter.
7559         Change all callers.
7560         (Archive::get_file_and_offset): Likewise.
7561         (Archive::read_all_symbols): Likewise.
7562         (Archive::read_symbols): Likewise.
7563         (Archive::get_elf_object_for_member): Remove input_objects
7564         parameter.  Add punconfigured parameter.  Change all callers.
7565         (Archive::add_symbols): Change return type to bool.  Check return
7566         value of include_member.
7567         (Archive::include_all_members): Likewise.
7568         (Archive::include_member): Change return type to bool.  Return
7569         false if first included object has incompatible target.  Set
7570         included_member_ field.
7571         (Add_archive_symbols::run): If add_symbols returns false, requeue
7572         Read_symbols task.
7573         * archive.h (class Archive): Add included_member_ field.
7574         Initialize it in constructor.  Add input_file and searched_for
7575         methods.  Update declarations.
7576         (class Add_archive_symbols): Add dirpath_, dirindex_, and
7577         input_argument_ fields.  Add them to constructor.  Change all
7578         callers.
7579         * script.cc: Include "target-select.h".
7580         (class Parser_closure): Add skip_on_incompatible_target_ and
7581         found_incompatible_target_ fields.  Add
7582         skip_on_incompatible_target parameter to constructor.  Change all
7583         callers.  Add methods skip_on_incompatible_target,
7584         clear_skip_on_incompatible_target, found_incompatible_target, and
7585         set_found_incompatible_target.
7586         (read_input_script): Add dirindex parameter.  Change all callers.
7587         If parser finds an incompatible target, requeue Read_symbols
7588         task.
7589         (script_set_symbol): Clear skip_on_incompatible_target in
7590         closure.
7591         (script_add_assertion, script_parse_option): Likewise.
7592         (script_start_sections, script_add_phdr): Likewise.
7593         (script_check_output_format): New function.
7594         * script.h (read_input_script): Update declaration.
7595         * script-c.h (script_check_output_format): Declare.
7596         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
7597         (ignore_cmd): Remove OUTPUT_FORMAT.
7598         * fileread.cc (Input_file::Input_file): Add explicit this.
7599         (Input_file::will_search_for): New function.
7600         (Input_file::open): Add pindex parameter.  Change all callers.
7601         * fileread.h (class Input_file): Add input_file_argument method.
7602         Declare will_search_for.  Update declarations.
7603         * object.cc (make_elf_object): Add punconfigured parameter.
7604         Change all callers.
7605         * object.h (class Object): Make input_file public.  Add
7606         searched_for method.
7607         (make_elf_object): Update declaration.
7608         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
7609         restart search.
7610         * dirsearch.h (class Dirsearch): Update declaration.
7611         * options.h (class General_options): Add --warn-search-mismatch.
7612         * parameters.cc (Parameters::is_compatible_target): New function.
7613         * parameters.h (class Parameters): Declare is_compatible_target.
7614         * workqueue.cc (Workqueue::add_blocker): New function.
7615         * workqueue.h (class Workqueue): Declare add_blocker.
7617         * fileread.cc (Input_file::open): Remove options parameter.
7618         Change all callers.
7619         (Input_file::open_binary): Likewise.
7620         * script.cc (read_input_script): Likewise.
7621         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
7622         options parameter from constructor.  Change all callers.
7623         (class Read_script): Likewise.
7624         * fileread.h (class Input_file): Update declarations.
7625         * script.h (read_input_script): Update declaration.
7627 2009-03-10  Nick Clifton  <nickc@redhat.com>
7629         * po/es.po: New Spanish translation.
7631 2009-03-06  Cary Coutant  <ccoutant@google.com>
7633         * options.cc (parse_short_option): Keep dash_z from registering itself.
7635 2009-03-03  Ian Lance Taylor  <iant@google.com>
7637         PR 9918
7638         * target-reloc.h (relocate_section): Pass output_section to
7639         relocate.
7640         * i386.cc (Target_i386::should_apply_static_reloc): Add
7641         output_section parameter.  Change all callers.
7642         (Target_i386::Relocate::relocate): Add output_section parameter.
7643         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7644         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
7645         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
7646         * testsuite/two_file_shared.sh: New script.
7647         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
7648         (check_DATA): Add two_file_shared.dbg.
7649         (two_file_shared.dbg): New target.
7650         * testsuite/Makefile.in: Rebuild.
7652 2009-03-01  Ian Lance Taylor  <iant@google.com>
7654         * configure.ac: Check for byteswap.h.
7655         * configure: Rebuild.
7656         * config.in: Rebuild.
7658 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
7660         * layout.cc (Layout::find_or_add_kept_section): New function.
7661         (Layout::add_comdat): Removed.
7662         * layout.h (struct Kept_section): Move out of class Layout.
7663         Remove trailing underscores from field names.  Add group_sections
7664         field.  Rename group_ field to is_group.  Change all uses.
7665         (class Layout): Declare find_or_add_kept_section, not add_comdat.
7666         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
7667         comdat_groups_ field.
7668         (Sized_relobj::include_section_group): Use
7669         find_or_add_kept_section and Kept_section::group_sections.
7670         (Sized_relobj::include_linkonce_section): Likewise.
7671         * object.cc (class Sized_relobj): Don't define Comdat_group or
7672         Comdat_group_table.  Remove find_comdat_group and
7673         add_comdat_group.  Remove comdat_groups_ field.
7674         * plugin.cc (include_comdat_group): Use
7675         Layout::find_or_add_kept_section.
7677 2009-02-28  Ian Lance Taylor  <iant@google.com>
7679         * README: --gc-sections and map files are now supported.  Document
7680         some build requirements.
7682         PR 6992
7683         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
7684         relocatable link set the value of the section symbol to zero.
7685         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
7686         relocatable link don't include the section address in the local
7687         symbol value.
7689 2009-02-27  Ian Lance Taylor  <iant@google.com>
7691         PR 6811
7692         * options.h (class Search_directory): Add is_system_directory.
7693         (class General_options): Declare is_in_system_directory.
7694         * options.cc (get_relative_sysroot): Make static.
7695         (get_default_sysroot): Make static.
7696         (General_optoins::is_in_system_directory): New function.
7697         * fileread.cc (Input_file::is_in_system_directory): New function.
7698         * fileread.h (class Input_file): Declare is_in_system_directory.
7699         * object.h (class Object): Add is_in_system_directory.
7700         (class Input_objects): Remove system_library_directory_ field.
7701         * object.cc (Input_objects::add_object): Don't set
7702         system_library_directory_.
7703         (input_objects::found_in_system_library_directory): Remove.
7704         * symtab.cc (Symbol_table::write_globals): Remove input_objects
7705         parameter.  Change all callers.
7706         (Symbol_table::sized_write_globals): Likewise.
7707         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
7708         Call Object::is_in_system_directory.
7709         * symtab.h (class Symbol_table): Update declarations.
7711         PR 5990
7712         * descriptors.h (Open_descriptor): Add is_on_stack field.
7713         * descriptors.cc (Descriptors::open): If the descriptor is on the
7714         top of the stack, remove it.  Initialize is_on_stack field.
7715         (Descriptors::release): Only add pod to stack if it is not on the
7716         stack already.
7717         (Descriptors::close_some_descriptor): Clear stack_next and
7718         is_on_stack fields.
7720         PR 7091
7721         * output.cc (Output_section::find_starting_output_address): Rename
7722         from starting_output_address; add PADDR parameter; change return
7723         type.
7724         * output.h (class Output_section): Declare
7725         find_starting_output_address instead of starting_output_address.
7726         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
7727         section symbol for which we can't find a merge section.
7729         PR 9836
7730         * symtab.cc (Symbol_table::add_from_object): If the visibility is
7731         hidden or internal, force the symbol to be local.
7732         * resolve.cc (Symbol::override_visibility): Define.
7733         (Symbol::override_base): Use override_visibility.
7734         (Symbol_table::resolve): Likewise.
7735         (Symbol::override_base_with_special): Likewise.
7736         (Symbol_table::override_with_special): If the visibility is hidden
7737         or internal, force the symbol to be local.
7738         * symtab.h (class Symbol): Add set_visibility and
7739         override_visibility.
7740         * testsuite/ver_test_1.sh: New file.
7741         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
7742         (check_DATA): Add ver_test_1.syms.
7743         (ver_test_1.syms): New target.
7744         * testsuite/Makefile.in: Rebuild.
7746 2009-02-25  Cary Coutant  <ccoutant@google.com>
7748         * layout.cc (Layout::choose_output_section): Don't rename sections
7749         when using a linker script that has a SECTIONS clause.
7750         * Makefile.in: Regenerate.
7752         * testsuite/Makefile.am (script_test_5.sh): New test case.
7753         * testsuite/Makefile.in: Regenerate.
7754         * testsuite/script_test_5.cc: New file.
7755         * testsuite/script_test_5.sh: New file.
7756         * testsuite/script_test_5.t: New file.
7758 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
7760         * archive.cc (Archive::include_member): Update calls to add_symbols.
7761         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
7762         the Layout argument.
7763         * dynobj.h (do_add_symbols): Add the Layout argument.
7764         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
7765         Layout argument.
7766         * object.h (Object::add_symbols): Add the Layout argument.
7767         (Object::do_add_symbols): Add the Layout argument.
7768         (Sized_relobj::do_add_symbols): Add the Layout argument.
7769         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
7770         Unify the two versions.
7771         (Add_plugin_symbols): Remove.
7772         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
7773         (Sized_pluginobj::do_add_symbols): Unify the two versions.
7774         (Add_plugin_symbols): Remove.
7775         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
7776         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
7777         (Add_symbols::run): Make it work with Pulginobj.
7779 2009-02-06  Ian Lance Taylor  <iant@google.com>
7781         * object.cc (Sized_relobj::do_layout): Make info message start
7782         with lower case letter.
7784 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
7786         * binary.cc: Fix file comment.
7788         * options.h (enum Incremental_disposition): Define.
7789         (class General_options): Add new options: --incremental,
7790         --incremental_changed, --incremental_unchanged,
7791         --incremental_unknown.  Add incremental_disposition_ and
7792         implicit_incremental_ fields.
7793         (General_options::incremental_disposition): New function.
7794         (class Position_dependent_options): Add incremental_disposition
7795         option.
7796         (Position_dependent_options::copy_from_options): Set incremental
7797         dispositions.
7798         * options.cc (General_options::parse_incremental_changed): New
7799         function.
7800         (General_options::parse_incremental_unchanged): New function.
7801         (General_options::parse_incremental_unknown): New function.
7802         (General_options::General_options): Initialize new fields
7803         incremental_disposition_ and implicit_incremental_.
7804         (General_options::finalize): Check for uasge of --incremental-*
7805         without --incremental.
7807 2009-02-06  Chris Demetriou  <cgd@google.com>
7809         * gold.h (gold_undefined_symbol): Change to take only a Symbol
7810         pointer and to report location as the file name associated with
7811         the symbol.
7812         (gold_undefined_symbol_at_location): New function to replace the
7813         old gold_undefined_symbol functionality.
7814         * target-reloc.h (relocate_section): Update to use
7815         gold_undefined_symbol_at_location.
7816         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7817         Call gold_undefined_symbol function rather than gold_error.
7818         * errors.h (Errors::undefined_symbol): Take location as a
7819         string, rather than calculating it from a relocation.
7820         * errors.cc (Errors::fatal): Print "fatal error:" before the
7821         formatted message.
7822         (Errors::error, Errors::error_at_location): Print "error: "
7823         before the formatted message.
7824         (Errors::undefined_symbol): Take location as a string, rather
7825         than calculating it from a relocation.
7826         (gold_undefined_symbol_at_location): New function akin to
7827         old gold_undefined_symbol, calculates location from relocation.
7828         (gold_undefined_symbol): Change to take only a Symbol pointer
7829         and to report location as the file name associated with the symbol.
7830         * testsuite/debug_msg.sh: Update for changed error messages.
7831         * testsuite/undef_symbol.sh: Likewise.
7833 2009-02-04  Duncan Sands  <baldrick@free.fr>
7835         PR 9812
7836         * reduced_debug_output.h
7837         (Output_reduced_debug_abbrev_section::failed): Use format for
7838         gold_warning.
7839         (Output_reduced_debug_info_section::faild): Likewise.
7841 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
7843         * script.cc (Lazy_demangler): New class.
7844         (Version_script_info::get_symbol_version_helper): Demangle a
7845         symbol only once.
7847 2009-01-29  Cary Coutant  <ccoutant@google.com>
7849         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
7850         to __tls_get_addr.
7851         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
7853 2009-01-28  Ian Lance Taylor  <iant@google.com>
7855         * version.cc (version_string): Bump to 1.9.
7857         * gold.h: Include <cstring> and <stdint.h>.
7858         * version.cc: Include <cstdio>.
7859         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
7860         warning.
7861         * reduced_debug_output.cc (insert_into_vector): Rename from
7862         Insert_into_vector; change all callers.  Use Swap_unaligned to
7863         avoid aliasing issue; remove union since it is unnecessary.
7865 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
7867         * Makefile.am (CCFILES): Add gc.cc.
7868         (HFILES): Add gc.h.
7869         * Makefile.in: Regenerate.
7870         * gold.cc (Gc_runner): New class.
7871         (queue_initial_tasks): Call garbage collection related tasks
7872         when corresponding options are invoked.
7873         (queue_middle_gc_tasks): New function.
7874         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
7875         processed early before laying out sections during garbage collection.
7876         * gold.h (queue_middle_gc_tasks): New function.
7877         (is_prefix_of): Move from "layout.cc".
7878         * i386.cc (Target_i386::gc_process_relocs): New function.
7879         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
7880         * main.cc (main): Create object of class "Garbage_collection".
7881         * object.cc (Relobj::copy_symbols_data): New function.
7882         (Relobj::is_section_name_included): New function.
7883         (Sized_relobj::do_layout): Allow this function to be called twice
7884         during garbage collection and defer layout of section during the
7885         first call.
7886         * object.h (Relobj::get_symbols_data): New function.
7887         (Relobj::is_section_name_included): New function.
7888         (Relobj::copy_symbols_data): New function.
7889         (Relobj::set_symbols_data): New function.
7890         (Relobj::get_relocs_data): New function.
7891         (Relobj::set_relocs_data): New function.
7892         (Relobj::is_output_section_offset_invalid): New pure virtual function.
7893         (Relobj::gc_process_relocs): New function.
7894         (Relobj::do_gc_process_relocs): New pure virtual function.
7895         (Relobj::sd_): New data member.
7896         (Sized_relobj::is_output_section_offset_invalid): New function.
7897         (Sized_relobj::do_gc_process_relocs): New function.
7898         * options.h (General_options::gc_sections): Modify to not be a no-op.
7899         (General_options::print_gc_sections): New option.
7900         * plugin.cc (Plugin_finish::run): Remove function call to
7901         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
7902         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
7903         * reloc.cc (Read_relocs::run): Add task to process relocs and
7904         determine unreferenced sections when doing garbage collection.
7905         (Gc_process_relocs): New class.
7906         (Sized_relobj::do_gc_process_relocs): New function.
7907         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
7908         sections that are garbage collected.
7909         * reloc.h (Gc_process_relocs): New class.
7910         * sparc.cc (Target_sparc::gc_process_relocs): New function.
7911         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
7912         symbols whose corresponding sections are garbage collected.
7913         (Symbol_table::Symbol_table): Add new parameter for the garbage
7914         collection object.
7915         (Symbol_table::gc_mark_undef_symbols): New function.
7916         (Symbol_table::gc_mark_symbol_for_shlib): New function.
7917         (Symbol_table::gc_mark_dyn_syms): New function.
7918         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
7919         as garbage.
7920         (Symbol_table::add_from_object): Likewise.
7921         (Symbol_table::add_from_relobj): When building shared objects, do not
7922         treat externally visible symbols as garbage.
7923         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
7924         table information for static and relocatable links.
7925         * symtab.h (Symbol_table::set_gc): New function.
7926         (Symbol_table::gc): New function.
7927         (Symbol_table::gc_mark_undef_symbols): New function.
7928         (Symbol_table::gc_mark_symbol_for_shlib): New function.
7929         (Symbol_table::gc_mark_dyn_syms): New function.
7930         (Symbol_table::gc_): New data member.
7931         * target.h (Sized_target::gc_process_relocs): New pure virtual
7932         function.
7933         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
7934         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
7936 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
7938         * options.h (General_options::gc_sections): Define as a no-op for now.
7939         (General_options::no_keep_memory): Ditto.
7940         (General_options::Bshareable): Define.
7941         * options.cc (General_options::finalize): Honor -Bshareable.
7943 2009-01-20  Andreas Schwab  <schwab@suse.de>
7945         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
7946         read the value in the contents, since we don't use it.  Use the
7947         template endianness when writing.
7948         (Relocate::relocate): Use it for R_PPC_REL16_HA.
7950 2009-01-19  Andreas Schwab  <schwab@suse.de>
7952         * configure.tgt (powerpc64-*): Fix targ_obj.
7954 2009-01-15  Ian Lance Taylor  <iant@google.com>
7956         * object.cc (Sized_relobj::write_local_symbols): Don't write out
7957         local symbols when stripping all symbols.
7959 2009-01-14  Cary Coutant  <ccoutant@google.com>
7961         * output.cc (Output_reloc): Add explicit instantiations.
7963 2009-01-14  Cary Coutant  <ccoutant@google.com>
7965         * archive.cc (Archive::get_elf_object_for_member): Remove call
7966         to File_read::claim_for_plugin.
7967         * descriptors.cc (Descriptors::open): Remove reference to
7968         is_claimed.
7969         (Descriptors::claim_for_plugin): Remove.
7970         * descriptors.h (Descriptors::claim_for_plugin): Remove.
7971         (Descriptors::is_claimed): Remove.
7972         (claim_descriptor_for_plugin): Remove.
7973         * fileread.cc (File_read::claim_for_plugin): Remove.
7974         * fileread.h (File_read::claim_for_plugin): Remove.
7975         (File_read::descriptor): Reopen descriptor if necessary.
7976         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
7977         (Plugin_manager::all_symbols_read): Add task parameter. Change
7978         all callers.
7979         (Plugin_manager::get_input_file): New function.
7980         (Plugin_manager::release_input_file): New function.
7981         (Pluginobj::Pluginobj): Add filesize parameter and initialize
7982         corresponding data member.
7983         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
7984         and pass to base constructor. Change all callers.
7985         (get_input_file, release_input_file): New functions.
7986         (make_sized_plugin_object): Add filesize parameter. Change all callers.
7987         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
7988         (Plugin_manager::all_symbols_read): Add task parameter.
7989         (Plugin_manager::get_input_file): New function.
7990         (Plugin_manager::release_input_file): New function.
7991         (Plugin_manager::task_): New data member.
7992         (Pluginobj::Pluginobj): Add filesize parameter.
7993         (Pluginobj::filename): New function.
7994         (Pluginobj::descriptor): New function.
7995         (Pluginobj::filesize): New function.
7996         (Pluginobj::filesize_): New data member.
7997         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
7998         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
7999         File_read::claim_for_plugin; use Object::unlock to unlock the file.
8001         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8002         with archive libraries.
8003         * testsuite/Makefile.in: Regenerate.
8004         * testsuite/plugin_test.c (struct sym_info): New type.
8005         (get_input_file, release_input_file): New static variables.
8006         (onload): Capture new transfer vector entries.
8007         (claim_file_hook): Stop reading at end of file according to filesize.
8008         Factor out parsing of readelf output into separate function.
8009         (all_symbols_read_hook): Exercise get_input_file and release_input_file
8010         APIs and get the source file name from the symbol table.  Convert
8011         source file name to corresponding object file name.  Print info
8012         message when adding new input files.
8013         (parse_readelf_line): New function.
8014         * testsuite/plugin_test_1.sh: Add checks for new info messages.
8015         * testsuite/plugin_test_2.sh: Likewise.
8016         * testsuite/plugin_test_3.sh: Likewise.
8017         * testsuite/plugin_test_4.sh: New test case.
8019 2009-01-07  Ian Lance Taylor  <iant@google.com>
8021         * version.cc (version_string): Bump to 1.8.
8023 2008-12-23  Cary Coutant  <ccoutant@google.com>
8025         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8026         * plugin.cc (Plugin_manager::finish): Rename as
8027         layout_deferred_objects.  Move cleanup to separate function.
8028         (Plugin_manager::cleanup): New function.
8029         (Plugin_finish::run): Call layout_deferred_objects and cleanup
8030         separately.
8031         * plugin.h (Plugin_manager::finish): Rename as
8032         layout_deferred_objects.
8033         (Plugin_manager::cleanup): New function.
8034         (Plugin_manager::cleanup_done): New field.
8036 2008-12-23  Cary Coutant  <ccoutant@google.com>
8038         * plugin.cc (is_visible_from_outside): New function.
8039         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8040         so we don't return "IR only" status for exported symbols or -r links.
8042         * testsuite/Makefile.am (plugin_test_3): New test case.
8043         * testsuite/Makefile.in: Regenerate.
8044         * testsuite/plugin_test_3.sh: New file.
8046 2008-12-22  Cary Coutant  <ccoutant@google.com>
8048         * object.cc (Sized_relobj::layout_section): New function.
8049         (Sized_relobj::do_layout): Defer layout of input sections until after
8050         plugin has provided replacement files.
8051         (Sized_relobj::do_layout_deferred_sections): New function.
8052         * object.h (Relobj::set_section_offset): Remove virtual keyword.
8053         (Relobj::layout_deferred_sections): New function.
8054         (Relobj::do_layout_deferred_sections): New function.
8055         (Sized_relobj::do_layout_deferred_sections): New function.
8056         (Sized_relobj::layout_section): New function.
8057         (Sized_relobj::Deferred_layout): New structure.
8058         (Sized_relobj::deferred_layout_): New field.
8059         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
8060         Change all callers.  Layout deferred sections.
8061         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
8062         references.
8063         (Plugin_hook::run): Move code from do_plugin_hook inline.
8064         (Plugin_hook::do_plugin_hook): Remove.
8065         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
8066         (Plugin_manager::finish): Renamed, was cleanup.
8067         (Plugin_manager::should_defer_layout): New function.
8068         (Plugin_manager::add_deferred_layout_object): New function.
8069         (Plugin_manager::Deferred_layout_list): New type.
8070         (Plugin_manager::deferred_layout_objects_): New field.
8071         (Plugin_hook::do_plugin_hook): Remove.
8073 2008-12-17  Ian Lance Taylor  <iant@google.com>
8075         * options.h (class General_options): Add --no case for
8076         --export-dynamic.
8078 2008-12-16  Cary Coutant  <ccoutant@google.com>
8080         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
8081         vector.
8082         (Plugin_manager::claim_file): Create plugin object even if
8083         plugin did not call the add_symbols callback.
8084         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
8085         asking for more symbols than were added.
8086         * testsuite/Makefile.am (plugin_test_1): Add test case with
8087         no global symbols.
8088         (empty.syms): New target.
8089         * testsuite/Makefile.in: Regenerate.
8090         * testsuite/plugin_test.c (claim_file_hook): Add new debug
8091         message. Don't call add_symbols if no globals.
8092         (all_symbols_read_hook): Don't provide replacement for empty
8093         claimed file.
8095 2008-12-12  Ian Lance Taylor  <iant@google.com>
8097         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
8098         r_type == 0 for a local symbol with r_sym == 0.
8099         (scan_relocatable_relocs): Pass r_sym to
8100         local_non_section_strategy.
8101         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
8102         r_sym parameter.
8104         * configure.ac: Update test for TLS descriptors: they are
8105         supported as of glibc 2.9.
8106         * configure: Rebuild.
8108 2008-12-11  Ian Lance Taylor  <iant@google.com>
8110         PR 7091
8111         * target-reloc.h (Default_scan_relocatable_relocs): For each
8112         function, map r_type == 0 to RELOC_DISCARD.
8114 2008-12-10  Cary Coutant  <ccoutant@google.com>
8116         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
8117         object to override a kept COMDAT group from a plugin object.
8119 2008-12-09  Ian Lance Taylor  <iant@google.com>
8121         PR 7088
8122         * yyscript.y (file_cmd): Handle INPUT.
8124         * testsuite/initpri1.c: Change all declarations to be full
8125         prototypes by adding void, to avoid compiler warnings.
8127 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
8129         * options.cc (General_options::parse_plugin_opt): New.
8130         (General_options::add_plugin): The argument now is just the filename.
8131         (General_options::add_plugin_option): New.
8132         * options.h (plugin_opt): New.
8133         (add_plugin): Change argument name.
8134         (add_plugin_option): New.
8135         * plugin.cc (Plugin::load): Don't parse the plugin option.
8136         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
8137         (Plugin::add_option): New.
8138         (Plugin::args_): Change type.
8139         (Plugin::filename_): New.
8140         (Plugin_manager::add_plugin_option): New.
8141         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
8142         * testsuite/Makefile.in: Regenerate.
8144 2008-12-05  Cary Coutant  <ccoutant@google.com>
8146         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
8147         Handle --strip-lto-sections option.
8148         * options.h (strip_lto_sections): New option.
8150 2008-12-01  Cary Coutant  <ccoutant@google.com>
8152         * plugin.cc (ld_plugin_message): Change format parameter to const.
8153         Fix mismatch between new[] and delete.
8155 2008-11-14  Cary Coutant  <ccoutant@google.com>
8157         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
8158         instead of -1U.
8160 2008-11-05  Craig Silverstein  <csilvers@google.com>
8162         * options.cc (General_options::parse_dynamic_list): New function.
8163         * options.h (General_options): New flags dynamic_list,
8164         dynamic_list_data, dynamic_list_cpp_new, and
8165         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
8166         (General_options::in_dynamic_list): New function.
8167         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
8168         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
8169         (Lex::can_continue_name): Likewise.
8170         (yylex): Likewise.
8171         (read_script_file): New parameter script_options.
8172         (read_dynamic_list): New function.
8173         (Script_options::define_dynamic_list): New function.
8174         (dynamic_list_keyword_parsecodes): New variable.
8175         (dynamic_list_keywords): New variable.
8176         * script.h (Script_options::define_dynamic_list): New function
8177         prototype.
8178         (read_dynamic_list): New function prototype.
8179         * symtab.cc (strprefix): New macro.
8180         (Symbol::should_add_dynsym_entry): Support dynamic_list,
8181         dynamic_list_data, dynamic_list_cpp_new, and
8182         dynamic_list_cpp_typeinfo.
8183         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
8184         (dynamic_list_expr): New rule.
8185         (dynamic_list_nodes): Likewise.
8186         (dynamic_list_node): Likewise.
8187         * testsuite/Makefile.am (dynamic_list): New test.
8188         * testsuite/Makefile.in: Regenerated.
8189         * testsuite/dynamic_list.t: New file.
8190         * testsuite/dynamic_list.sh: New file.
8192 2008-11-05  Craig Silverstein  <csilvers@google.com>
8194         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
8195         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
8196         (t11_last): Likewise.
8197         * testsuite/ver_test_6.c (main): Likewise.
8199 2008-10-07  Cary Coutant  <ccoutant@google.com>
8201         * options.c (General_options::finalize): Add check for -static and
8202         -shared.
8203         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
8204         is not empty.
8206 2008-10-02  Cary Coutant  <ccoutant@google.com>
8208         * plugin.cc (make_sized_plugin_object): Fix conditional
8209         compilation to work when not all targets are enabled.
8211 2008-09-29  Cary Coutant  <ccoutant@google.com>
8213         * archive.cc (Archive::get_file_and_offset): Use filename instead
8214         of name to get library path.
8215         (Archive::include_member): Unlock external member of a thin archive.
8217         * testsuite/Makefile.am (TEST_AR): New variable.
8218         (thin_archive_test_1): New test.
8219         (thin_archive_test_2): New test.
8220         * testsuite/Makefile.in: Regenerate.
8221         * testsuite/thin_archive_main.cc: New file.
8222         * testsuite/thin_archive_test_1.cc: New file.
8223         * testsuite/thin_archive_test_2.cc: New file.
8224         * testsuite/thin_archive_test_3.cc: New file.
8225         * testsuite/thin_archive_test_4.cc: New file.
8227 2008-09-29  Cary Coutant  <ccoutant@google.com>
8229         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
8230         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
8231         instead of -1U.
8232         (Sized_relobj::do_finalize_local_symbols): Likewise.
8233         (Sized_relobj::map_to_kept_section): Likewise.
8234         * object.h (Sized_relobj::invalid_address): New constant.
8235         (Sized_relobj::do_output_section_offset): Check for invalid_address
8236         and return -1ULL.
8237         * output.cc (Output_reloc::local_section_offset): Use constant
8238         invalid_address instead of -1U.
8239         (Output_reloc::get_address): Likewise.
8240         (Output_section::output_address): Change -1U to -1ULL.
8241         * output.h (Output_reloc::invalid_address): New constant.
8242         * reloc.cc (Sized_relobj::write_sections): Use constant
8243         invalid_address instead of -1U.
8244         (Sized_relobj::relocate_sections): Likewise.
8245         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
8246         values for merge sections.
8247         * target-reloc.h (relocate_for_relocatable): Use constant
8248         invalid_address instead of -1U.
8250 2008-09-19  Cary Coutant  <ccoutant@google.com>
8252         Add plugin functionality for link-time optimization (LTO).
8253         * configure.ac (plugins): Add --enable-plugins option.
8254         * configure: Regenerate.
8255         * config.in: Regenerate.
8256         * Makefile.am (LIBDL): New variable.
8257         (CCFILES): Add plugin.cc.
8258         (HFILES): Add plugin.h.
8259         (ldadd_var): Add LIBDL.
8260         * Makefile.in: Regenerate.
8262         * archive.cc: Include "plugin.h".
8263         (Archive::setup): Don't preread archive symbols when using a plugin.
8264         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
8265         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
8266         files.
8267         (Archive::include_member): Add symbols from plugin objects.
8268         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
8269         * descriptors.cc (Descriptors::open): Check for file descriptors
8270         abandoned by plugins.
8271         (Descriptors::claim_for_plugin): New function.
8272         * descriptors.h (Descriptors::claim_for_plugin): New function.
8273         (Open_descriptor::is_claimed): New field.
8274         (claim_descriptor_for_plugin): New function.
8275         * fileread.cc (File_read::claim_for_plugin): New function.
8276         * fileread.h (File_read::claim_for_plugin): New function.
8277         (File_read::descriptor): New function.
8278         * gold.cc: Include "plugin.h".
8279         (queue_initial_tasks): Add task to call plugin hooks for generating
8280         new object files.
8281         * main.cc: Include "plugin.h".
8282         (main): Load plugin libraries.
8283         * object.h (Pluginobj): Declare.
8284         (Object::pluginobj): New function.
8285         (Object::do_pluginobj): New function.
8286         (Object::set_target): New function.
8287         * options.cc: Include "plugin.h".
8288         (General_options::parse_plugin): New function.
8289         (General_options::General_options): Initialize plugins_ field.
8290         (General_options::add_plugin): New function.
8291         * options.h (Plugin_manager): Declare.
8292         (General_options): Add --plugin option.
8293         (General_options::has_plugins): New function.
8294         (General_options::plugins): New function.
8295         (General_options::add_plugin): New function.
8296         (General_options::plugins_): New field.
8297         * plugin.cc: New file.
8298         * plugin.h: New file.
8299         * readsyms.cc: Include "plugin.h".
8300         (Read_symbols::do_read_symbols): Check for archive before checking
8301         for ELF file.  Call plugin hooks to claim files.
8302         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
8303         from a real object file; force override when processing replacement
8304         files.
8305         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
8306         (Symbol::init_base_object): Likewise.
8307         (Symbol::init_base_output_data): Likewise.
8308         (Symbol::init_base_output_segment): Likewise.
8309         (Symbol::init_base_constant): Likewise.
8310         (Symbol::init_base_undefined): Likewise.
8311         (Symbol::output_section): Assert that object is not a plugin.
8312         (Symbol_table::add_from_pluginobj): New function.
8313         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
8314         undefined.
8315         (Symbol_table::sized_write_globals): Likewise.
8316         (Symbol_table::add_from_pluginobj): Instantiate template.
8317         * symtab.h (Sized_pluginobj): Declare.
8318         (Symbol::in_real_elf): New function.
8319         (Symbol::set_in_real_elf): New function.
8320         (Symbol::in_real_elf_): New field.
8321         (Symbol_table::add_from_pluginobj): New function.
8323         * testsuite/Makefile.am (AM_CFLAGS): New variable.
8324         (LIBDL): New variable.
8325         (LDADD): Add LIBDL.
8326         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
8327         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
8328         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
8329         (MOSTLYCLEANFILES): Likewise.
8330         * testsuite/Makefile.in: Regenerate.
8331         * testsuite/plugin_test.c: New file.
8332         * testsuite/plugin_test_1.sh: New file.
8333         * testsuite/plugin_test_2.sh: New file.
8335 2008-09-16  Ian Lance Taylor  <iant@google.com>
8337         * target-reloc.h (relocate_section): Check whether a symbol is
8338         defined by the ABI before reporting an undefined symbol error.
8339         * target.h (Target::is_defined_by_abi): Make parameter const.
8340         (Target::do_is_defined_by_abi): Likewise.
8341         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
8342         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
8343         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
8344         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
8345         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
8346         * testsuite/Makefile.in: Rebuild.
8348         * fileread.cc (make_view): Add casts to avoid warning.
8350 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8352         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
8353         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8355 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
8357         * options.h (General_options::output_is_executable): New.
8358         (General_options::output_is_pie): New.
8359         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
8360         for shared libraries.
8361         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
8363 2008-09-11  Chris Demetriou  <cgd@google.com>
8365         * options.h (origin): New -z option.
8366         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
8367         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
8368         in DT_FLAGS_1.
8370 2008-09-05  Cary Coutant  <ccoutant@google.com>
8372         * fileread.cc (File_read::make_view): Add check for attempt to map
8373         beyond end of file.
8375 2008-09-05  Cary Coutant  <ccoutant@google.com>
8377         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
8378         explicit instantiations.
8380 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
8382         PR gold/6858
8383         * options.cc (General_options::finalize): Allow undefined symbols
8384         in shlibs if linking -shared.
8386         PR gold/6859
8387         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
8388         symbols as not needing a dynsym entry.
8390 2008-08-20  Craig Silverstein  <csilvers@google.com>
8392         * fileread.cc (File_read::open): Do not lock the file unless it
8393         was successfully opened.
8395 2008-08-14  Cary Coutant  <ccoutant@google.com>
8397         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
8398         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
8399         * testsuite/tls_test.cc (struct int128): 128-bit struct
8400         for testing TLS relocs with non-zero addend.
8401         (v12): New TLS variable.
8402         (t12): New test.
8403         (t_last): Add check for v12.
8404         * testsuite/tls_test.h (t12): New function.
8405         * testsuite/tls_test_main.cc (thread_routine): Call new test.
8407 2008-08-13  Ian Lance Taylor  <iant@google.com>
8409         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
8410         set tls_segment_ or relro_segment_.
8411         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
8412         when appropriate.
8413         * output.h (Output_section::clear_is_relro): New function.
8414         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
8415         sections specially even when output_data_ is empty.
8416         (Output_segment::maximum_alignment): When first section is relro,
8417         only force alignment for PT_LOAD segments.
8418         * script.cc (script_data_segment_align): New function.
8419         (script_data_segment_relro_end): New function.
8420         * script-c.h (script_data_segment_align): Declare.
8421         (script_data_segment_relro_end): Declare.
8422         * script-sections.h (class Script_sections): Declare
8423         data_segment_align and data_segment_relro_end.  Add fields
8424         segment_align_index_ and saw_relro_end_.
8425         * script-sections.cc (class Sections_element): Add set_is_relro
8426         virtual function.  Add new bool* parameter to place_orphan_here.
8427         Add get_output_section virtual function.
8428         (class Output_section_definition): Add set_is_relro.  Add new
8429         bool* parameter to place_orphan_here.  Add get_output_section.
8430         Add is_relro_ field.
8431         (Output_section_definition::Output_section_definition): Initialize
8432         evaluated_address_, evaluated_load_address, evaluated_addralign_,
8433         and is_relro_ fields.
8434         (Output_section_definition::place_orphan_here): Add is_relro
8435         parameter.
8436         (Output_section_definition::set_section_addresses): Set relro for
8437         output section.
8438         (Output_section_definition::alternate_constraint): Likewise.
8439         (class Orphan_output_section): Add new bool* parameter to
8440         place_orphan_here.  Add get_output_section.
8441         (Orphan_output_section::place_orphan_here): Add is_relro
8442         parameter.
8443         (Script_sections::Script_sections): Initialize
8444         data_segment_align_index_ and saw_relro_end_.
8445         (Script_sections::data_segment_align): New function.
8446         (Script_sections::data_segment_relro_end): New function.
8447         (Script_sections::place_orphan): Set or clear is_relro.
8448         (Script_sections::set_section_addresses): Force alignment of first
8449         TLS section.
8450         * yyscript.y (exp): Call script_data_segment_align and
8451         script_data_segment_relro_end.
8452         * testsuite/relro_script_test.t: New file.
8453         * testsuite/relro_test.cc (using_script): Declare.
8454         (t1, t2): Test using_script.
8455         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
8456         (relro_script_test_SOURCES): Define.
8457         (relro_script_test_DEPENDENCIES): Define.
8458         (relro_script_test_LDFLAGS): Define.
8459         (relro_script_test_LDADD): Define.
8460         (relro_script_test.so): New target.
8461         * testsuite/Makefile.in: Rebuild.
8463 2008-08-06  Cary Coutant <ccoutant@google.com>
8465         * archive.cc (Archive::total_archives, Archive::total_members)
8466         (Archive::total_members_loaded): New variables.
8467         (Archive::setup): Add parameter.  Add option to preread
8468         archive symbols.
8469         (Archive::read_armap): Add counter.
8470         (Archive::get_file_and_offset): New function.
8471         (Archive::get_elf_object_for_member): New function.
8472         (Archive::read_all_symbols): New function.
8473         (Archive::read_symbols): New function.
8474         (Archive::add_symbols): Add counters.
8475         (Archive::include_all_members): Use armap to find members if it's
8476         already built.
8477         (Archive::include_member): Skip reading symbols if already read.
8478         Factored code into Archive::get_file_and_offset and
8479         Archive::get_elf_object_for_member.  Changed call to
8480         Mapfile::report_include_archive_member.
8481         (Archive::print_stats): New function.
8482         * archive.h: Declare Object and Read_symbols_data classes.
8483         (Archive::Archive): Add initializers for new members.
8484         (Archive::setup): Add parameter.
8485         (Archive::print_stats): New function.
8486         (Archive::total_archives, Archive::total_members)
8487         (Archive::total_members_loaded): New variables.
8488         (Archive::get_file_and_offset): New function.
8489         (Archive::get_elf_object_for_member): New function.
8490         (Archive::read_all_symbols): New function.
8491         (Archive::read_symbols): New function.
8492         (Archive::Archive_member): New class.
8493         (Archive::members_): New member.
8494         (Archive::num_members_): New member.
8495         * main.cc: Include archive.h.
8496         (main): Call Archive::print_stats.
8497         * mapfile.cc (Mapfile::report_include_archive_member): Delete
8498         archive parameter; member_name is now the fully-decorated name.
8499         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
8500         * options.h: (General_options): Add --preread-archive-symbols option.
8501         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
8502         Archive::setup.
8504 2008-08-04  Ian Lance Taylor  <iant@google.com>
8506         * symtab.h (Symbol::use_plt_offset): New function.
8507         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
8508         * powerpc.cc (Relocate::relocate): Likewise.
8509         * sparc.cc (Relocate::relocate): Likewise.
8510         * x86_64.cc (Relocate::relocate): Likewise.
8511         * testsuite/weak_plt.sh: New test.
8512         * testsuite/weak_plt_main.cc: New test.
8513         * testsuite/weak_plt_shared.cc: New test.
8514         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
8515         (check_PROGRAMS): Add weak_plt.
8516         (check_DATA): Add weak_plt_shared.so.
8517         (weak_plt_main_pic.o, weak_plt): New targets.
8518         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
8519         * testsuite/Makefile.in: Rebuild.
8521         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
8522         gcctestdir/ld.
8523         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
8524         * testsuite/Makefile.in: Rebuild.
8526 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
8528         * Makefile.am (POTFILES.in): Set LC_ALL=C.
8529         * Makefile.in: Regenerate.
8530         * po/POTFILES.in: Regenerate.
8532 2008-07-29  Ian Lance Taylor  <iant@google.com>
8534         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
8535         symbols before other symbols.
8536         * testsuite/script_test_2.cc (test_addr): Declare.
8537         (test_addr_alias): Declare.
8538         (main): Check that test_addr and test_addr_alias have the right
8539         values.
8540         * testsuite/script_test_2.t: Define test_addr_alias and
8541         test_addr.
8543 2008-07-24  Ian Lance Taylor  <iant@google.com>
8545         PR 5990
8546         * descriptors.cc: New file.
8547         * descriptors.h: New file.
8548         * gold-threads.h (class Hold_optional_lock): New class.
8549         * fileread.cc: Include "descriptors.h".
8550         (File_read::~File_read): Release descriptor rather than closing
8551         it.
8552         (File_read::open) [file]: Call open_descriptor rather than open.
8553         Set is_descriptor_opened_.
8554         (File_read::open) [memory]: Assert that descriptor is not open.
8555         (File_read::reopen_descriptor): New function.
8556         (File_read::release): Release descriptor.
8557         (File_read::do_read): Make non-const.  Reopen descriptor.
8558         (File_read::read): Make non-const.
8559         (File_read::make_view): Reopen descriptor.
8560         (File_read::do_readv): Likewise.
8561         * fileread.h (class File_read): Add is_descriptor_opened_ field.
8562         Update declarations.
8563         * layout.cc: Include "descriptors.h".
8564         (Layout::create_build_id): Use open_descriptor rather than open.
8565         * output.cc: Include "descriptors.h".
8566         (Output_file::open): Use open_descriptor rather than open.
8567         * archive.cc (Archive::const_iterator): Change Archive to be
8568         non-const.
8569         (Archive::begin, Archive::end): Make non-const.
8570         (Archive::count_members): Likewise.
8571         * archive.h (class Archive): Update declarations.
8572         * object.h (Object::read): Make non-const.
8573         * Makefile.am (CCFILES): Add descriptors.cc.
8574         (HFILES): Add descriptors.h.
8575         * Makefile.in: Rebuild.
8577         PR 6716
8578         * gold.h: Always include <clocale>.  Add Solaris workarounds
8579         following code in binutils/sysdep.h.
8581         PR 6048
8582         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
8583         this->eh_frame_hdr_ is NULL before using it.
8585         * dynobj.cc (Versions::Versions): Update comment.
8587         * dynobj.cc (Versions::Versions): If there is an soname, use it as
8588         the base version name.
8590         * stringpool.cc (Stringpool_template::add_with_length): Set key to
8591         array size plus one.
8592         (Stringpool_template::set_string_offsets): Subtract one from key
8593         before using it as an array index.
8594         (Stringpool_template::get_offset_with_length): Likewise.
8595         (Stringpool_template::write_to_buffer): Likewise.
8596         * stringpool.h (Stringpool_template::get_offset_from_key):
8597         Likewise.
8599 2008-07-23  Ian Lance Taylor  <iant@google.com>
8601         PR 6658
8602         * object.h (Merged_symbol_value::value): Do our best to handle a
8603         negative addend.
8605         PR 6647
8606         * script.cc (Version_script_info::get_versions): Don't add empty
8607         version tag to return value.
8608         (Version_script_info::get_symbol_version_helper): Change return
8609         type to bool.  Add pversion parameter.  Change all callers.
8610         (script_register_vers_node): Don't require a non-NULL tag.
8611         * script.h (class Version_script_info): Update declarations.
8612         (Version_script_info::get_symbol_version): Change return type to
8613         bool.  Add version parameter.  Change all callers.
8614         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
8615         handling.  Handle an empty version from a version script.
8616         (Symbol_table::define_special_symbol): Likewise.
8617         * testsuite/ver_test_10.script: New file.
8618         * testsuite/ver_test_10.sh: New file.
8619         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
8620         (check_DATA): Add ver_test_10.syms.
8621         (ver_test_10.syms, ver_test_10.so): New target.
8622         * testsuite/Makefile.in: Rebuild.
8624 2008-07-23  Simon Baldwin  <simonb@google.com>
8626         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
8627         to zero for undefined symbols from dynamic libraries.
8629 2008-07-23  Ian Lance Taylor  <iant@google.com>
8631         * symtab.cc (Symbol_table::resolve): Remove version parameter.
8632         Change all callers.
8633         * symtab.h (class Symbol_table): Update declaration.
8634         * testsuite/ver_test_9.cc: New file.
8635         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
8636         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
8637         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
8638         (ver_test_9.so, ver_test_9.o): New targets.
8639         * testsuite/Makefile.in: Rebuild.
8641 2008-07-22  Ian Lance Taylor  <iant@google.com>
8643         * options.h (class General_options): Define --check-sections.
8644         * layout.cc (Layout::set_segment_offsets): Handle
8645         --check-sections.
8647         * options.h (class General_options): Define -n/--nmagic and
8648         -N/--omagic.
8649         * options.cc (General_options::finalize): For -n/--nmagic or
8650         -N/--omagic, set -static.
8651         * layout.cc (Layout::attach_allocated_section_to_segment): If
8652         -N/--omagic, don't put read-only and read-write sections in
8653         different segments.
8654         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
8655         finding a read-only segment.
8656         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
8657         don't set the minimum segment alignment to the common page size,
8658         and don't set the file offset to the address modulo the page size.
8659         * script-sections.cc (Script_sections::create_segments): If
8660         -n/--omagic, don't put read-only and read-write sections in
8661         different segments.
8663         * cref.cc: New file.
8664         * cref.h: New file.
8665         * options.h (class General_options): Add --print-symbol-counts.
8666         * main.cc (main): Issue defined symbol report if requested.
8667         * archive.cc (Archive::interpret_header): Make into a const member
8668         function.
8669         (Archive::add_symbols): Call Input_objects::archive_start and
8670         archive_stop.
8671         (Archive::const_iterator): Define new class.
8672         (Archive::begin, Archive::end): New functions.
8673         (Archive::include_all_members): Rewrite to use iterator.
8674         (Archive::count_members): New function.
8675         * archive.h (class Archive): Update declarations.
8676         (Archive::filename): New function.
8677         * object.cc: Include "cref.h".
8678         (Sized_relobj::Sized_relobj): Initialize defined_count_.
8679         (Sized_relobj::do_get_global_symbol_counts): New function.
8680         (Input_objects::add_object): Add object to cross-referencer.
8681         (Input_objects::archive_start): New function.
8682         (Input_objects::archive_stop): New function.
8683         (Input_objects::print_symbol_counts): New function.
8684         * object.h: Declare Cref and Archive.
8685         (Object::get_global_symbol_counts): New function.
8686         (Object::do_get_global_symbol_counts): New pure virtual function.
8687         (class Sized_relobj): Add defined_count_ field.  Update
8688         declarations.
8689         (class Input_objects): Add cref_ field.  Update constructor.
8690         Update declarations.
8691         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
8692         defined_count_.
8693         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
8694         symbol counts.
8695         (Sized_dynobj::do_get_global_symbol_counts): New function.
8696         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
8697         defined_count_.  Update declarations.  Define Symbols typedef.
8698         * symtab.cc (Symbol_table::add_from_relobj): Add defined
8699         parameter.  Change all callers.
8700         (Symbol_table::add_from_dynobj): Add sympointers and defined
8701         parameters.  Change all callers.
8702         * symtab.h (class Symbol_table): Update declarations.
8703         * Makefile.am (CCFILES): Add cref.cc.
8704         (HFILES): Add cref.h.
8705         * Makefile.in: Rebuild.
8707 2008-07-22  Simon Baldwin  <simonb@google.com>
8709         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
8710         to zero when writing undefined symbols.
8712 2008-07-22  Ian Lance Taylor  <iant@google.com>
8714         * output.cc (Output_section::add_input_section): Don't try to
8715         merge empty merge sections.
8717 2008-07-21  Craig Silverstein  <csilvers@google.com>
8719         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8720         Include symbol version in error message.
8722 2008-07-20  Chris Demetriou  <cgd@google.com>
8724         * configure.ac (gold_cv_c_random_seed): New configured variable.
8725         (RANDOM_SEED_CFLAGS): New substituted variable.
8726         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
8727         * configure: Rebuild.
8728         * Makefile.in: Likewise.
8729         * testsuite/Makefile.in: Likewise.
8731 2008-07-18  Ian Lance Taylor  <iant@google.com>
8733         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
8734         where we see NAME/NULL and NAME/VERSION  as separate symbols.
8735         * testsuite/ver_test_main.cc (main): Call t4.
8736         (t4, t4_2a): Define.
8737         * testsuite/ver_test_2.cc (t4_2): Define.
8738         * testsuite/ver_test_2.script: Put t4_2a in VER2.
8739         * testsuite/ver_test_4.cc (t4_2a): Define.
8740         * testsuite/ver_test_4.script: Put t4_2a in VER2.
8741         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
8743 2008-07-17  Ian Lance Taylor  <iant@google.com>
8745         * dynobj.cc (Versions::add_def): If we give an error about a
8746         missing version, go ahead and create the version anyhow.
8748 2008-07-10  Ian Lance Taylor  <iant@google.com>
8750         Handle output sections with more than 0x7fffffff bytes.
8751         * object.h (class Relobj): Change map_to_output_ to
8752         output_sections_, and just keep a section pointer.  Change all
8753         uses.  Move comdat group support to Sized_relobj.
8754         (Relobj::is_section_specially_mapped): Remove.
8755         (Relobj::output_section): Remove poff parameter.  Change all
8756         callers.
8757         (Relobj::output_section_offset): New function.
8758         (Relobj::set_section_offset): Rewrite.
8759         (Relobj::map_to_output): Remove.
8760         (Relobj::output_sections): New function.
8761         (Relobj::do_output_section_offset): New pure virtual function.
8762         (Relobj::do_set_section_offset): Likewise.
8763         (class Sized_relobj): Add section_offsets_ field.  Add comdat
8764         group support from Relobj.  Update declarations.
8765         (Sized_relobj::get_output_section_offset): New function.
8766         (Sized_relobj::do_output_section_offset): New function.
8767         (Sized_relobj::do_set_section_offset): New function.
8768         * object.cc (Relobj::output_section_address): Remove.
8769         (Sized_relobj::Sized_relobj): Initialize new fields.
8770         (Sized_relobj::include_section_group): Cast find_kept_object to
8771         Sized_relobj.
8772         (Sized_relobj::include_linkonce_section): Likewise.
8773         (Sized_relobj::do_layout): Use separate arrays for output section
8774         and output offset.
8775         (Sized_relobj::do_count_local_symbols): Change map_to_output to
8776         output_sections.
8777         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
8778         output_sections and section_offsets.
8779         (Sized_relobj::write_local_symbols): Likewise.
8780         (map_to_kept_section): Compute output address directly.
8781         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
8782         output_sections and section_offsets.
8783         (Sized_relobj::write_sections): Likewise.
8784         (Sized_relobj::relocate_sections): Likewise.
8785         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
8786         * output.h (class Output_reloc): Update declarations.  Change
8787         u2_.relobj to Sized_relobj*.
8788         (class Output_data_reloc): Change add functions to use
8789         Sized_relobj*.
8790         * output.cc (Output_reloc::Output_reloc): Change relobj to
8791         Sized_relobj*.
8792         (Output_reloc::local_section_offset): Change return type to
8793         Elf_Addr.  Use get_output_section_offset.
8794         (Output_reloc::get_address): Likewise.
8795         (Output_section::is_input_address_mapped): Don't call
8796         is_section_specially_mapped.
8797         (Output_section::output_offset): Likewise.
8798         (Output_section::output_address): Likewise.
8799         (Output_section::starting_output_address): Likewise.
8800         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
8801         parameter to Sized_relobj*.
8802         (Copy_relocs::need_copy_reloc): Likewise.
8803         (Copy_relocs::save): Likewise.
8804         * copy-relocs.h (class Copy_relocs): Update declarations.
8805         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
8806         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
8807         * target-reloc.h (relocate_for_relocatable): Change
8808         offset_in_output_section type to Elf_Addr.  Change code that uses
8809         it as well.
8810         * layout.cc (Layout::layout): Always set *off.
8811         * mapfile.cc (Mapfile::print_input_section): Use
8812         output_section_offset.
8813         * i386.cc (Target_i386::copy_reloc): Change object parameter to
8814         Sized_relobj*.
8815         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
8816         * sparc.cc (Target_sparc::copy_reloc): Likewise.
8817         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
8819 2008-07-03  Ian Lance Taylor  <iant@google.com>
8821         * layout.cc (Layout::include_section): Do not discard unrecognized
8822         SHT_STRTAB sections.
8824 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
8826         * script.cc (Lex::can_continue_name): Make '?' allowable in
8827         version-script names.
8828         * testsuite/version_script.map: Change glob pattern to use '?'
8830 2008-06-30  Manish Singh  <yosh@gimp.org>
8832         PR 6585
8833         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
8834         Correct typo.
8836 2008-06-30  Ian Lance Taylor  <iant@google.com>
8838         PR 6660
8839         PR 6682
8840         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
8841         versions]: Don't try to read the value in the contents, since we
8842         don't use it.  Use the template endianness when writing.
8844 2008-06-25  Cary Coutant  <ccoutant@google.com>
8846         * fileread.cc (File_read::make_view): Assert on zero-length view.
8847         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
8848         symbol table when there are no symbols to read.
8850 2008-06-23  Craig Silverstein  <csilvers@google.com>
8852         * version.cc (version_string): Bump to 1.7
8854 2008-06-18  Craig Silverstein  <csilvers@google.com>
8856         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
8857         constant 0xFFFF to type Valtype.
8858         (Powerpc_relocate_functions::rel16_ha): Likewise.
8860 2008-06-17  Ian Lance Taylor  <iant@google.com>
8862         * output.h (Output_section::Input_section): Initialize p2align_ to
8863         zero for Output_section_data constructors.
8864         (Output_section::Input_section::addralign): If not an input
8865         section, return the alignment of the Output_section_data.
8866         * testsuite/copy_test.cc: New file.
8867         * testsuite/copy_test_1.cc: New file.
8868         * testsuite/copy_test_2.cc: New file.
8869         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
8870         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
8871         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
8872         (copy_test_1_pic.o, copy_test_1.so): New targets.
8873         (copy_test_2_pic.o, copy_test_2.so): New targets.
8874         * testsuite/Makefile.in: Rebuild.
8876         * script-sections.cc (Script_sections::place_orphan): Initialize
8877         local variable exact.
8879 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
8881         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
8883 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
8884             David S. Miller  <davem@davemloft.net>
8886         * powerpc.cc: New file.
8887         * Makefile.am (TARGETSOURCES): Add powerpc.cc
8888         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
8889         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
8890         * Makefile.in: Rebuild.
8892 2008-06-09  Ian Lance Taylor  <iant@google.com>
8894         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
8895         <exception>.
8896         (throwing, orig_terminate): New static variables.
8897         (terminate_handler): New static function.
8898         (t2): Set terminate handler.
8900 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
8902         PR 6584
8903         * binary.cc (Binary_to_elf::sized_convert): Fix .data
8904         alignment.
8906 2008-05-30  Cary Coutant  <ccoutant@google.com>
8908         * archive.cc (Archive::include_all_members) Correct to step
8909         over symbol table and extended name table in thin archives.
8911 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
8913         PR 6407
8914         * target-reloc.h (relocate_for_relocatable): Fix new_offset
8915         calculation.
8917 2008-05-28  Caleb Howe  <cshowe@google.com>
8919         * reduced_debug_output.cc: New file.
8920         * reduced_debug_output.h: New file.
8921         * options.h (class General_options): Add --strip-debug-non-line.
8922         * options.cc (General_options::finalize): Add strip_debug_non_line
8923         to the strip heirarchy.
8924         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
8925         fields.
8926         * layout.cc: Include "reduced_debug_output.h".
8927         (Layout::Layout): Initialize new fields.
8928         (line_only_debug_sections): New static array.
8929         (is_lines_only_debug_sections): New static inline function.
8930         (Layout::include_section): Handle --strip-debug-non-line.
8931         (Layout::make_output_section): If --strip-debug-non-line, build
8932         new output sections for .debug_abbrev and .debug_info.
8933         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
8934         gold.  Warn about possible overflow.
8935         (read_signed_LEB_128): Likewise.
8936         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
8937         (read_signed_LEB_128): Declare.
8938         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
8939         (HFILES): Add reduced_debug_output.h.
8940         * Makefile.in: Rebuild.
8942 2008-05-21  Ian Lance Taylor  <iant@google.com>
8944         * mapfile.cc: New file.
8945         * mapfile.h: New file.
8946         * options.h (class General_options): Add -M/--print-map and -Map.
8947         * options.cc (General_options::finalize): Make -M equivalent to
8948         -Map -.
8949         * main.cc: Include <cstdio> and "mapfile.h".
8950         (main): Open mapfile if requested.
8951         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
8952         constructor.  Change caller.
8953         (queue_initial_tasks): Add mapfile parameter.  Change caller.
8954         (queue_middle_tasks): Likewise.
8955         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
8956         declarations.
8957         * archive.cc: Include "mapfile.h".
8958         (Archive::add_symbols): Add mapfile parameter.  Change all
8959         callers.  Pass mapfile, symbol, and reason to include_member.
8960         (Archive::include_all_members): Add mapfile parameter.  Change all
8961         callers.
8962         (Archive::include_member): Add mapfile, sym, and why parameters.
8963         Change all callers.  Report inclusion to map file.
8964         * archive.h: Include "fileread.h".
8965         (class Archive): Update declarations.
8966         (Archive::file): New const method.
8967         (class Add_archive_symbols): Add mapfile_ field.  Update
8968         constructor.  Change all callers.
8969         * readsyms.h (class Read_symbols): Likewise.
8970         (class Finish_group): Likewise.
8971         (class Read_script): Likewise.
8972         * common.cc: Include "mapfile.h".
8973         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
8974         all callers.
8975         (Symbol_table::do_allocate_commons): Likewise.
8976         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
8977         symbol allocation to mapfile.
8978         * common.h (class Allocate_commons_task): Add mapfile_ field.
8979         Update constructor.  Change all callers.
8980         * symtab.h (class Symbol_table): Update declarations.
8981         * layout.cc: Include "mapfile.h".
8982         (Layout_task_runner::run): Print information to mapfile.
8983         (Layout::create_gold_note): Change Output_data_fixed_space to
8984         Output_data_zero_fill.
8985         (Layout::create_build_id): Likewise.
8986         (Layout::print_to_mapfile): New function.
8987         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
8988         constructor.  Change caller.
8989         (class Layout): Declare print_to_mapfile.
8990         * output.cc (Output_section::Input_section::print_to_mapfile): New
8991         function.
8992         (Output_section::add_input_section): If producing a map, always
8993         add to input_sections_ list.
8994         (Output_section::do_print_to_mapfile): New function.
8995         (Output_segment::print_sections_to_mapfile): New function.
8996         (Output_segment::print_section_list_to_mapfile): New function.
8997         * output.h: Include "mapfile.h".
8998         (Output_data::print_to_mapfile): New function.
8999         (Output_data::do_print_to_mapfile): New virtual function.
9000         (Output_segment_headers::do_print_to_mapfile): New function.
9001         (Output_file_header::do_print_to_mapfile): New function.
9002         (Output_data_const::do_print_to_mapfile): New function.
9003         (class Output_data_const_buffer): Add map_name_ field.  Update
9004         constructor.  Change all callers.  Add do_print_to_mapfile
9005         function.
9006         (class Output_data_fixed_space): Likewise.
9007         (class Output_data_space): Likewise.
9008         (class Output_data_zero_fill): New class.
9009         (Output_data_strtab::do_print_to_mapfile): New function.
9010         (Output_data_reloc_base::do_print_to_mapfile): New function.
9011         (Output_relocatable_relocs::do_print_to_mapfile): New function.
9012         (Output_data_group::do_print_to_mapfile): New function.
9013         (Output_data_got::do_print_to_mapfile): New function.
9014         (Output_data_dynamic::do_print_to_mapfile): New function.
9015         (Output_symtab_xindex::do_print_to_mapfile): New function.
9016         (class Output_section): Declare do_print_to_mapflie.  Declare
9017         print_to_mapfile in Input_section.
9018         (class Output_segment): Declare new functions.
9019         * object.h (Sized_relobj::symbol_count): New function.
9020         * script-sections.cc
9021         (Output_section_element_dot_assignment::set_section_addresses):
9022         Change Output_data_fixed_space to Output_data_zero_fill.
9023         (Output_data_expression::do_print_to_mapfile): New function.
9024         * script.cc (read_input_script): Add mapfile parameter.  Change
9025         all callers.
9026         * script.h (read_input_script): Update declaration.
9027         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9028         (Eh_frame::do_print_to_mapfile): New function.
9029         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9030         (Output_merge_string::do_print_to_mapfile): New function.
9031         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9032         function.
9033         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9034         function.
9035         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9036         function.
9037         * Makefile.am (CCFILES): Add mapfile.cc.
9038         (HFILES): Add mapfile.h.
9039         * Makefile.in: Rebuild.
9041 2008-05-19  Ian Lance Taylor  <iant@google.com>
9043         * options.h (class General_options): Add -z relro.
9044         * layout.cc (Layout::Layout): Initialize relro_segment_.
9045         (Layout::add_output_section_data): Return the output section.
9046         (Layout::make_output_section): Rcognize relro sections and mark
9047         them appropriately.
9048         (Layout::attach_allocated_section_to_segment): Put relro sections
9049         in a PT_GNU_RELRO segment.
9050         (Layout::create_initial_dynamic_sections): Mark the .dynamic
9051         section as relro.
9052         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
9053         PT_TLS segments.
9054         (Layout::linkonce_mapping): Map d.rel.ro.local to
9055         .data.rel.ro.local.
9056         (Layout::output_section_name): Us .data.rel.ro.local for any
9057         section which begins with that.
9058         * layout.h (class Layout): Update add_output_section_data
9059         declaration.  Add relro_segment_ field.
9060         * output.cc (Output_section::Output_section): Initialize is_relro_
9061         and is_relro_local_ fields.
9062         (Output_segment::add_output_section): Group relro sections.
9063         (Output_segment::is_first_section_relro): New function.
9064         (Output_segment::maximum_alignment): If there is a relro section,
9065         align the segment to the common page size.
9066         (Output_segment::set_section_addresses): Track whether we are
9067         looking at relro sections.  If the last section is a relro
9068         section, align to the common page size.
9069         (Output_segment::set_section_list_addresses): Add in_relro
9070         parameter.  Change all callers.  Align to the page size when
9071         moving from relro to non-relro section.
9072         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
9073         segment.
9074         * output.h (class Output_section): Add is_relro_ and
9075         is_relro_local_ fields.
9076         (Output_section::is_relro): New function.
9077         (Output_section::set_is_relro): New function.
9078         (Output_section::is_relro_local): New function.
9079         (Output_section::set_is_relro_local): New function.
9080         (class Output_segment): Update declarations.
9081         * i386.cc (Target_i386::got_section): Mark .got section as relro.
9082         * sparc.cc (Target_sparc::got_section): Likewise.
9083         * x86_64.cc (Target_x86_64::got_section): Likewise.
9084         * testsuite/relro_test_main.cc: New file.
9085         * testsuite/relro_test.cc: New file.
9086         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
9087         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
9088         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
9089         (relro_test.so, relro_test_pic.o): New targets.
9090         * testsuite/Makefile.in: Rebuild.
9092 2008-05-16  Ian Lance Taylor  <iant@google.com>
9094         * output.cc (Output_segment::add_output_section): Remove front
9095         parameter.
9096         * output.h (class Output_segment): Remove
9097         add_initial_output_section and overloaded add_output_section.
9098         Update declaration of remaining add_output_section.
9099         * layout.cc (Layout::create_interp): Call add_output_section
9100         rather than add_initial_output_section.
9101         (Layout::finish_dynamic_section): Likewise.
9103         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
9104         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
9105         know the dynamic type.
9106         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
9107         field.  Initialize it in constructor.
9108         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
9109         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
9110         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
9111         reloc.
9113         * output.cc (Output_reloc::get_address): Change return type to
9114         Elf_Addr.
9115         * output.h (class Output_reloc): Update get_address declaration.
9116         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
9117         for section addresses.
9119 2008-05-09  Ian Lance Taylor  <iant@google.com>
9121         PR 6493
9122         * gold.cc (gold_nomem): Use return value of write.
9124 2008-05-08  Ian Lance Taylor  <iant@google.com>
9126         * symtab.c (Symbol::init_base_output_data): Add version
9127         parameter.  Change all callers.
9128         (Symbol::init_base_output_segment): Likewise.
9129         (Symbol::init_base_constant): Likewise.
9130         (Symbol::init_base_undefined): Likewise.
9131         (Sized_symbol::init_output_data): Likewise.
9132         (Sized_symbol::init_output_segment): Likewise.
9133         (Sized_symbol::init_constant): Likewise.
9134         (Sized_symbol::init_undefined): Likewise.
9135         (Symbol_table::do_define_in_output_data): If the new symbol has a
9136         version, mark it as the default.
9137         (Symbol_table::do_define_in_output_segment): Likewise.
9138         (Symbol_table::do_define_as_constant): Likewise.
9139         * symtab.h (class Symbol): Update declarations.
9140         (class Sized_symbol): Likewise.
9141         * resolve.cc (Symbol::override_version): New function.
9142         (Symbol::override_base): Call override_version.
9143         (Symbol::override_base_with_special): Likewise.
9144         * testsuite/ver_script_8.script: New file.
9145         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
9146         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
9147         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
9148         (ver_test_8_1.so, ver_test_8_2.so): New targets.
9150 2008-05-06  Ian Lance Taylor  <iant@google.com>
9152         PR 6049
9153         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
9154         functions.
9155         (class General_options): Remove existing --undefined, and add
9156         --no-undefined instead.  Add new --undefined as synonym for -u.
9157         * archive.cc (Archive::add_symbols): Check whether symbol was
9158         named with -u.
9159         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
9160         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
9161         all uses.  Add IS_UNDEFINED.  Update declarations to split
9162         different versions of init_base.  Declare init_base_undefined.
9163         (Symbol::is_defined): Handle IS_UNDEFINED.
9164         (Symbol::is_undefined): Likewise.
9165         (Symbol::is_weak_undefined): Call is_undefined.
9166         (Symbol::is_absolute): Handle IS_CONSTANT.
9167         (class Sized_symbol): Update declarations to split different
9168         versions of init.  Declare init_undefined.
9169         (class Symbol_table): Declare new functions.
9170         * symtab.cc (Symbol::init_base_object): Rename from init_base.
9171         Change all callers.
9172         (Symbol::init_base_output_data): Likewise.
9173         (Symbol::init_base_output_segment): Likewise.
9174         (Symbol::init_base_constant): Likewise.
9175         (Symbol::init_base_undefined): New function.
9176         (Sized_symbol::init_object): Rename from init.  Change all
9177         callers.
9178         (Sized_symbol::init_output_data): Likewise.
9179         (Sized_symbol::init_output_segment): Likewise.
9180         (Sized_symbol::init_constant): Likewise.
9181         (Sized_symbol::init_undefined): New function.
9182         (Symbol_table::add_undefined_symbols_from_command_line): New
9183         function.
9184         (Symbol_table::do_add_undefined_symbols_from_command_line): New
9185         function.
9186         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
9187         (Symbol::output_section): Likewise.
9188         (Symbol::set_output_section): Likewise.
9189         (Symbol_table::sized_finalize_symbol): Likewise.
9190         (Symbol_table::sized_write_globals): Likewise.
9191         * resolve.cc (Symbol_table::should_override): Likewise.
9192         (Symbol::override_base_with_special): Likewise.
9194         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
9195         symbol, change it to have default visibility.
9196         * testsuite/protected_1.cc: New file.
9197         * testsuite/protected_2.cc: New file.
9198         * testsuite/protected_3.cc: New file.
9199         * testsuite/protected_main_1.cc: New file.
9200         * testsuite/protected_main_2.cc: New file.
9201         * testsuite/protected_main_3.cc: New file.
9202         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
9203         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
9204         (protected_1_LDFLAGS, protected_1_LDADD): Define.
9205         (protected_1.so): New target.
9206         (protected_1_pic.o, protected_2_pic.o): New targets.
9207         (protected_3_pic.o): New target.
9208         (check_PROGRAMS): Add protected_2.
9209         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
9210         (protected_2_LDFLAGS, protected_2_LDADD): Define.
9211         * testsuite/Makefile.in: Rebuild.
9213         * options.h (DEFINE_var): Add set_user_set_##varname__.
9214         (DEFINE_bool_alias): New macro.
9215         (class General_options): Define -Bstatic using DEFINE_bool_alias
9216         rather than DEFINE_special.  Add --undefined as an alias for -z
9217         defs.
9218         * options.cc (General_options::parse_Bstatic): Remove.
9220         * options.h (class General_options): Add --fatal-warnings.
9221         * main.cc (main): Implement --fatal-warnings.
9222         * errors.h (Errors::warning_count): New function.
9224         * options.h (class General_options): Add -Bsymbolic-functions.
9225         * symtab.h (Symbol::is_preemptible): Check for
9226         -Bsymbolic-functions.
9228 2008-05-05  Ian Lance Taylor  <iant@google.com>
9230         * options.h (DEFINE_bool): For DASH_Z, create the negative option
9231         as noVARNAME rather than no-VARNAME.
9232         (class General_options): Add option -z combreloc.
9233         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
9234         get_address.
9235         (Output_reloc::sort_before) [SHT_REL]: New function.
9236         (Output_reloc::sort_before) [SHT_RELA]: New function.
9237         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
9238         Sort_relocs_comparison.
9239         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
9240         parameter.  Change all callers.
9241         (Output_data_reloc::Output_data_reloc) [both versions]: Add
9242         sort_relocs parameter.  Change all callers.
9243         * output.cc (Output_reloc::get_address): New function, broken out
9244         of write_rel.
9245         (Output_reloc::write_rel): Call it.
9246         (Output_reloc::compare): New function.
9247         (Output_data_reloc_base::do_write): Optionally sort relocs.
9249         * configure.ac: If targ_extra_obj is set, link it in.
9250         * configure.tgt: Initialize all variables.
9251         (x86_64*): Set targ_extra_obj and targ_extra_size.
9252         * configure: Rebuild.
9254         * object.cc (Sized_relobj::include_section_group): Adjust section
9255         indexes read from group data.  Build vector to pass to
9256         layout_group.
9257         * layout.cc (Layout::layout_group): Add flags and shndxes
9258         parameters.  Remove contents parameter.  Change caller.  Update
9259         explicit instantiations.
9260         * layout.h (class Layout): Update layout_group declaration.
9261         * output.cc (Output_data_group::Output_data_group): Add flags and
9262         input_shndxes parameters.  Remove contents parameter.  Change
9263         caller.
9264         (Output_data_group::do_write): Change input_sections_ to
9265         input_shndxes_.
9266         * output.h (class Output_data_group): Update constructor
9267         declaration.  Rename input_sections_ to input_shndxes_.
9268         * testsuite/many_sections_test.cc: Add template.
9270 2008-04-30  Cary Coutant  <ccoutant@google.com>
9272         * target-reloc.h (relocate_section): Fix dead-pointer bug.
9274         * layout.cc (Layout::include_section): Refactored check for debug
9275         info section.
9276         (Layout::add_comdat): Add new parameters.  Change type
9277         of signature parameter.  Add object and shndx to signatures table.
9278         (Layout::find_kept_object): New function.
9279         * layout.h: Include <cstring>.
9280         (Layout::is_debug_info_section): New function.
9281         (Layout::add_comdat): Add new parameters.
9282         (Layout::find_kept_object): New function.
9283         (Layout::Kept_section): New struct.
9284         (Layout::Signatures): Change type of map range.
9285         * object.cc (Relobj::output_section_address): New function.
9286         (Sized_relobj::include_section_group): Add new parameters.  Change
9287         calls to Layout::add_comdat.  Change to build table of kept comdat
9288         groups and table mapping discarded sections to kept sections.
9289         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
9290         (Sized_relobj::do_layout): Change calls to include_section_group and
9291         include_linkonce_section.
9292         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
9293         value to zero when section is discarded.
9294         (Sized_relobj::map_to_kept_section): New function.
9295         * object.h (Relobj::output_section_address): New function.
9296         (Relobj::Comdat_group): New type.
9297         (Relobj::find_comdat_group): New function.
9298         (Relobj::Comdat_group_table): New type.
9299         (Relobj::Kept_comdat_section): New type.
9300         (Relobj::Kept_comdat_section_table): New type.
9301         (Relobj::add_comdat_group): New function.
9302         (Relobj::set_kept_comdat_section): New function.
9303         (Relobj::get_kept_comdat_section): New function.
9304         (Relobj::comdat_groups_): New field.
9305         (Relobj::kept_comdat_sections_): New field.
9306         (Symbol_value::input_value): Update comment.
9307         (Sized_relobj::map_to_kept_section) New function.
9308         (Sized_relobj::include_linkonce_section): Add new parameter.
9309         * target-reloc.h (Comdat_behavior): New type.
9310         (get_comdat_behavior): New function.
9311         (relocate_section): Add code to map a discarded section to the
9312         corresponding kept section when applying a relocation.
9314 2008-04-30  Craig Silverstein  <csilvers@google.com>
9316         * dwarf_reader.cc (next_generation_count): New static var.
9317         (Addr2line_cache_entry): New struct.
9318         (addr2line_cache): New static var.
9319         (Dwarf_line_info::one_addr2line): Added caching.
9320         (Dwarf_line_info::clear_addr2line_cache): New function.
9321         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
9322         cache-size parameter.
9323         (Dwarf_line_info::one_addr2line_cache): New function.
9324         * symtab.cc (Symbol_table::detect_odr_violations): Pass
9325         new cache-size argument to one_addr2line(), and clear cache.
9327 2008-04-28  Cary Coutant  <ccoutant@google.com>
9329         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
9330         R_386_PC8 relocations.
9332 2008-04-23  Ian Lance Taylor  <iant@google.com>
9334         * object.cc (Sized_relobj::include_section_group): Check for
9335         invalid section group.
9337         * object.cc (make_elf_object): Correct test for 64-bit ELF file
9338         header size.
9340         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
9341         than read for file header.
9342         * archive.cc (Archive::include_member): Likewise.
9344 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
9346         * aclocal.m4: Regenerate.
9347         * configure: Regenerate.
9349 2008-04-19  Ian Lance Taylor  <iant@google.com>
9351         * version.cc (version_string): Bump to 1.6.
9353         * testsuite/Makefile.am (many_sections_r_test): New target.
9354         (many_sections_r_test_SOURCES): Remove.
9355         (many_sections_r_test_DEPENDENCIES): Remove.
9356         (many_sections_r_test_LDFLAGS): Remove.
9357         (many_sections_r_test_LDADD): Remove.
9359         * object.cc (Sized_relobj::do_add_symbols): Always pass
9360         local_symbol_count_ to add_from_relobj.
9362         * testsuite/Makefile.am (many_sections_check.h): Only check one in
9363         every thousand variables.
9364         * testsuite/Makefile.in: Rebuild.
9366         * object.cc (Xindex::initialize_symtab_xindex): New function.
9367         (Xindex::read_symtab_xindex): New function.
9368         (Xindex::sym_xindex_to_shndx): New function.
9369         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
9370         available.
9371         (Sized_relobj::do_initialize_xindex): New function.
9372         (Sized_relobj::do_read_symbols): Adjust section links.
9373         (Sized_relobj::symbol_section_and_value): Add is_ordinary
9374         parameter.  Change all callers.
9375         (Sized_relobj::include_section_group): Adjust section links and
9376         symbol section indexes.
9377         (Sized_relobj::do_layout): Adjust section links.
9378         (Sized_relobj::do_count_local_symbols): Adjust section links and
9379         symbol section indexes.
9380         (Sized_relobj::do_finalize_local_symbols): Distinguish between
9381         ordinary and special symbols.
9382         (Sized_relobj::write_local_symbols): Add symtab_xindex and
9383         dynsym_xindex parameters.  Change all callers.  Adjust section
9384         links.  Use SHN_XINDEX when needed.
9385         (Sized_relobj::get_symbol_location_info): Adjust section links.
9386         Don't get fooled by special symbols.
9387         * object.h (class Xindex): Define.
9388         (class Object): Add xindex_ parameter.  Declare virtual functoin
9389         do_initialize_xindex.
9390         (Object::adjust_sym_shndx): New function.
9391         (Object::set_xindex): New protected function.
9392         (class Symbol_value): Add is_ordinary_shndx_ field.
9393         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
9394         (Symbol_value::value): Assert ordinary section.
9395         (Symbol_value::initialize_input_to_output_map): Likewise.
9396         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
9397         Change all callers.
9398         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
9399         all callers.
9400         (class Sized_relobj): Update declarations.
9401         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
9402         parameter.  Change all callers.
9403         (Sized_relobj::adjust_shndx): New function.
9404         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
9405         field.
9406         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
9407         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
9408         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
9409         (Sized_dynobj::read_dynsym_section): Adjust section links.
9410         (Sized_dynobj::read_dynamic): Likewise.
9411         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
9412         section links.
9413         (Sized_dynobj::do_initialize_xindex): New function.
9414         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
9415         do_initialize_xindex.
9416         (Sized_dynobj::adjust_shndx): New function.
9417         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
9418         dynsym_xindex_ fields.
9419         (Layout::finalize): Add a call to set_section_indexes before
9420         creating the symtab sections.
9421         (Layout::set_section_indexes): Don't do anything if the section
9422         already has a section index.
9423         (Layout::create_symtab_sections): Add shnum parameter.  Change
9424         caller.  Create .symtab_shndx section if needed.
9425         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
9426         caller.
9427         (Layout::allocated_output_section_count): New function.
9428         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
9429         needed.
9430         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
9431         fields.  Update declarations.
9432         (Layout::symtab_xindex): New function.
9433         (Layout::dynsym_xindex): New function.
9434         (class Write_symbols_task): Add layout_ field.
9435         (Write_symbols_task::Write_symbols_task): Add layout parameter.
9436         Change caller.
9437         * output.cc (Output_section_headers::Output_section_headers): Add
9438         shstrtab_section parameter.  Change all callers.
9439         (Output_section_headers::do_sized_write): Store overflow values
9440         for section count and section string table section index in
9441         section header zero.
9442         (Output_file_header::do_sized_write): Check for overflow of
9443         section count and section string table section index.
9444         (Output_symtab_xindex::do_write): New function.
9445         (Output_symtab_xindex::endian_do_write): New function.
9446         * output.h (class Output_section_headers): Add shstrtab_section_.
9447         Update declarations.
9448         (class Output_symtab_xindex): Define.
9449         (Output_section::has_out_shndx): New function.
9450         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
9451         field.
9452         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
9453         Change all callers.
9454         (Sized_symbol::init): Likewise.
9455         (Symbol::output_section): Check for ordinary symbol.
9456         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
9457         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
9458         callers.
9459         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
9460         Change all callers.  Simplify handling of symbols from sections
9461         not included in the link.
9462         (Symbol_table::add_from_dynobj): Handle ordinary symbol
9463         distinction.
9464         (Weak_alias_sorter::operator()): Assert that symbols are
9465         ordinary.
9466         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
9467         distinction.
9468         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
9469         parameters.  Change all callers.
9470         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
9471         symbol distinction.  Use SHN_XINDEX when needed.
9472         (Symbol_table::write_section_symbol): Add symtab_xindex
9473         parameter.  Change all callers.
9474         (Symbol_table::sized_write_section_symbol): Likewise.  Use
9475         SHN_XINDEX when needed.
9476         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
9477         declarations.
9478         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
9479         (Symbol::is_defined): Check is_ordinary.
9480         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
9481         (Symbol::is_absolute, Symbol::is_common): Likewise.
9482         (class Sized_symbol): Update declarations.
9483         (class Symbol_table): Update declarations.
9484         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
9485         parameters.  Change all callers.
9486         (Sized_symbol::override): Likewise.
9487         (Symbol_table::override): Likewise.
9488         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
9489         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
9490         is_ordinary, and orig_st_shndx parameters.  Change all callers.
9491         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
9492         to be in an ordinary section.
9493         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
9494         object and is_ordinary parameters.  Change all callers.
9495         (Sized_dwarf_line_info::read_relocs): Add object parameter.
9496         Change all callers.  Don't add undefined or non-ordinary symbols
9497         to reloc_map_.
9498         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
9499         Change all callers.
9500         * dwarf_reader.h (class Sized_dwarf_line_info): Update
9501         declarations.
9502         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
9503         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
9504         (Sized_relobj::relocate_sections): Likewise.
9505         * target-reloc.h (scan_relocs): Adjust section symbol index.
9506         (scan_relocatable_relocs): Likewise.
9507         * i386.cc (Scan::local): Check for ordinary symbols.
9508         * sparc.cc (Scan::local): Likewise.
9509         * x86_64.cc (Scan::local): Likewise.
9510         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
9511         to symbol_section_and_value.
9512         * testsuite/many_sections_test.cc: New file.
9513         * testsuite/Makefile.am (BUILT_SOURCES): Define.
9514         (check_PROGRAMS): Add many_sections_test.
9515         (many_sections_test_SOURCES): Define.
9516         (many_sections_test_DEPENDENCIES): Define.
9517         (many_sections_test_LDFLAGS): Define.
9518         (BUILT_SOURCES): Add many_sections_define.h.
9519         (many_sections_define.h): New target.
9520         (BUILT_SOURCES): Add many_sections_check.h.
9521         (many_sections_check.h): New target.
9522         (check_PROGRAMS): Add many_sections_r_test.
9523         (many_sections_r_test_SOURCES): Define.
9524         (many_sections_r_test_DEPENDENCIES): Define.
9525         (many_sections_r_test_LDFLAGS): Define.
9526         (many_sections_r_test_LDADD): Define.
9527         (many_sections_r_test.o): New target.
9528         * testsuite/Makefile.in: Rebuild.
9530 2008-04-17  Cary Coutant  <ccoutant@google.com>
9532         * errors.cc (Errors::info): New function.
9533         (gold_info): New function.
9534         * errors.h (Errors::info): New function.
9535         * gold.h (gold_info): New function.
9536         * object.cc (Input_objects::add_object): Print trace output.
9537         * options.cc (options::parse_set): New function.
9538         (General_options::parse_wrap): Deleted.
9539         (General_options::General_options): Deleted initializer.
9540         * options.h (options::String_set): New typedef.
9541         (options::parse_set): New function.
9542         (DEFINE_set): New macro.
9543         (General_options::wrap): Changed to use DEFINE_set. Changed
9544         callers of any_wrap_symbols and is_wrap_symbol.
9545         (General_options::trace, General_options::trace_symbol):
9546         New options.
9547         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
9548         (General_options::wrap_symbols_): Deleted.
9549         * symtab.cc (Symbol_table::add_from_object): Print trace output.
9551 2008-04-17  David S. Miller  <davem@davemloft.net>
9553         * options.cc (General_options::parse_V): New function.
9554         * options.h: Add entries for -V and -Qy.
9556 2008-04-17  Ian Lance Taylor  <iant@google.com>
9558         * common.cc (Symbol_table::allocate_commons): Remove options
9559         parameter.  Change caller.
9560         (Symbol_table::do_allocate_commons): Remove options parameter.
9561         Change caller.  Just call do_allocate_commons_list twice.
9562         (Symbol_table::do_allocate_commons_list): New function, broken out
9563         of do_allocate_commons.
9564         * common.h (class Allocate_commons_task): Remove options_ field.
9565         Update constructor.
9566         * symtab.cc (Symbol_table::Symbol_table): Initialize
9567         tls_commons_.
9568         (Symbol_table::add_from_object): Put TLS common symbols on
9569         tls_commons_ list.
9570         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
9571         which are IN_OUTPUT_DATA.
9572         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
9573         allocate_commons and do_allocate_commons declarations.  Declare
9574         do_allocate_commons_list.
9575         * gold.cc (queue_middle_tasks): Update creation of
9576         Allocate_commons_task to not pass options.
9577         * testsuite/Makefile.am (INCLUDES): Add -I.. .
9578         (TLS_TEST_C_FLAGS): New variable.
9579         (tls_test_c_pic.o): New target.
9580         (tls_test_shared.so): Link in tls_test_c_pic.o.
9581         (tls_test_c_pic_ie.o): New target.
9582         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
9583         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
9584         (tls_test_c.o): New target.
9585         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
9586         (tls_pic_test_LDADD): Likewise.
9587         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
9588         (tls_shared_gd_to_ie_test_LDADD): Likewise.
9589         (tls_test_c_gnu2.o): New target.
9590         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
9591         tls_test_c_gnu2.o.
9592         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
9593         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
9594         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
9595         * testsuite/tls_test.cc: Include "config.h".
9596         (t_last): Call t11_last.
9597         * testsuite/tls_test.h (t11, t11_last): Declare.
9598         * testsuite/tls_test_c.c: New file.
9599         * testsuite/tls_test_main.cc (thread_routine): Call t11.
9600         * configure.ac: Check for OpenMP support.
9601         * configure, config.in, Makefile.in: Rebuild.
9602         * testsuite/Makefile.in: Rebuild.
9604 2008-04-16  Cary Coutant  <ccoutant@google.com>
9606         * i386.cc (Target_i386::define_tls_base_symbol): New function.
9607         (Target_i386::tls_base_symbol_defined_): New field.
9608         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9609         (Target_i386::Scan::global): Likewise.
9610         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
9611         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
9612         (Target_x86_64::tls_base_symbol_defined_): New field.
9613         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
9614         (Target_x86_64::Scan::global): Likewise.
9616 2008-04-16  Cary Coutant  <ccoutant@google.com>
9618         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
9619         (Symbol::needs_plt_entry): Allow weak undefined symbols.
9620         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
9621         building shared libraries.
9622         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
9623         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
9624         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
9625         * testsuite/Makefile.in: Rebuild.
9626         * testsuite/weak_undef.h: New file.
9627         * testsuite/weak_undef_file1.cc: Add extra test cases.
9628         * testsuite/weak_undef_file2.cc: Likewise.
9629         * testsuite/weak_undef_test.cc: Likewise.
9631 2008-04-16  David S. Miller  <davem@davemloft.net>
9633         * sparc.cc (Target_sparc::Scan): Change from struct to class.
9634         Add issued_non_pic_error_ field.  Declare check_non_pic.
9635         (Target_sparc::Scan::check_non_pic): New function.
9636         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
9637         (Target_sparc::Scan::global): Likewise.
9639         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
9640         * configure: Rebuild.
9642         * options.h (DEFINE_enable): New macro.
9643         (new_dtags): New enable option.
9644         (initfirst, interpose, loadfltr, nodefaultlib,
9645         nodelete, nodlopen, nodump): New -z options.
9646         * layout.cc (Layout:finish_dynamic_section): If new
9647         dtags enabled, emit DT_RUNPATH.  Also, emit a
9648         DT_FLAGS_1 containing any specified -z flags.
9650 2008-04-16  Ian Lance Taylor  <iant@google.com>
9652         * copy-relocs.cc: New file.
9653         * copy-relocs.h: New file.
9654         * reloc.cc: Remove Copy_relocs code.
9655         * reloc.h: Likewise.
9656         * reloc-types.h (struct Reloc_types) [both versions]: Add
9657         get_reloc_addend_noerror.
9658         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
9659         variants of add_global which take an addend which must be zero.
9660         * i386.cc: Include "copy-relocs.h".
9661         (class Target_i386): Change type of copy_relocs_ to variable,
9662         update initializer.
9663         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
9664         Change all callers.
9665         (Target_i386::do_finalize_sections): Change handling of
9666         copy_relocs_.
9667         * sparc.cc: Include "copy-relocs.h".
9668         (class Target_sparc): Change type of copy_relocs_ to variable,
9669         update initializer.
9670         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
9671         Change all callers.
9672         (Target_sparc::do_finalize_sections): Change handling of
9673         copy_relocs_.
9674         * x86_64.cc: Include "copy-relocs.h".
9675         (class Target_x86_64): Change type of copy_relocs_ to variable,
9676         update initializer.
9677         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
9678         class.  Change all callers.
9679         (Target_x86_64::do_finalize_sections): Change handling of
9680         copy_relocs_.
9681         * Makefile.am (CCFILES): Add copy-relocs.cc.
9682         (HFILES): Add copy-relocs.h.
9684         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
9686         * testsuite/script_test_4.sh: Permit leading zeroes.
9688 2008-04-15  Ian Lance Taylor  <iant@google.com>
9690         * script-sections.cc (Script_sections::create_segments): Use
9691         header_size_adjustment even when there is enough room for the
9692         headers.
9693         * testsuite/script_test_4.sh: New file.
9694         * testsuite/script_test_4.t: New file.
9695         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
9696         (check_DATA): Add script_test_4.stdout.
9697         (MOSTLYCLEANFILES): Likewise.
9698         (script_test_4): New target.
9699         (script_test_4.stdout): New target.
9700         * testsuite/Makefile.in: Rebuild.
9702         * sparc.cc: Add definitions for Output_data_plt_sparc class
9703         constants.
9705 2008-04-14  David S. Miller  <davem@davemloft.net>
9707         * sparc.cc: New file.
9708         * Makefile.am (TARGETSOURCES): Add sparc.cc
9709         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
9710         * configure.tgt: Document targ_extra_size and
9711         targ_extra_big_endian.  Add entries for sparc-* and
9712         sparc64-*.
9713         * configure.ac: Handle targ_extra_size and
9714         targ_extra_big_endian.
9715         * Makefile.in: Rebuild.
9716         * configure: Likewise.
9717         * po/POTFILES.in: Likewise.
9718         * po/gold.pot: Likewise.
9720 2008-04-14  Ian Lance Taylor  <iant@google.com>
9722         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
9723         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
9724         in the name/type/flags to section mapping.  Don't call
9725         allocate_output_section.
9726         (Layout::choose_output_section): Change parameter from adjust_name
9727         to is_input_section.  Don't permit input sections after sections
9728         are attached to segments.  Don't call allocate_output_section.
9729         (Layout::layout_eh_frame): Call update_flags_for_input_section,
9730         not write_enable_output_section.
9731         (Layout::make_output_section): Don't push to
9732         unattached_section_list_ nor call attach_to_segment.  Call
9733         attach_section_to_segment if sections are attached.
9734         (Layout::attach_sections_to_segments): New function.
9735         (Layout::attach_section_to_segment): New function.
9736         (Layout::attach_allocated_section_to_segment): Rename from
9737         attach_to_segment.  Remove flags parameter.
9738         (Layout::allocate_output_section): Remove function.
9739         (Layout::write_enable_output_section): Remove function.
9740         * layout.h (class Layout): Update for above changes.  Add new
9741         field sections_are_attached_.
9742         * output.h (Output_section::update_flags_for_input_section): New
9743         function.
9744         * output.cc (Output_section::add_input_section): Call
9745         update_flags_for_input_section.
9746         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
9748 2008-04-11  Cary Coutant  <ccoutant@google.com>
9750         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
9751         thought unnecessary.
9752         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
9754 2008-04-11  Ian Lance Taylor  <iant@google.com>
9756         * output.h (class Output_section_data): Remove inline definition
9757         of set_addralign.
9758         * output.cc (Output_section_data::set_addralign): New function.
9760 2008-04-11  Cary Coutant  <ccoutant@google.com>
9762         Add support for TLS descriptors for i386 and x86_64.
9763         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
9764         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
9765         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
9766         GOT_TYPE_TLS_DESC.
9767         (Target_i386::got_mod_index_entry): Remove unnecessary code.
9768         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
9769         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
9770         relocations.
9771         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
9772         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
9773         Fix problem with initial-exec relocations.
9774         (Target_i386::Relocate::relocate_tls): Likewise.
9775         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
9776         relaxation.
9777         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
9778         support for section-plus-offset dynamic table entries.
9779         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
9780         (Output_data_dynamic::Dynamic_entry): Add support for
9781         section-plus-offset dynamic table entries.
9782         (Output_data_dynamic::Classification): Likewise.
9783         (Output_data_dynamic::classification_): Renamed offset_.
9784         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
9785         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
9786         (Target_x86_64::make_plt_section): New function.
9787         (Target_x86_64::reserve_tlsdesc_entries): New function.
9788         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
9789         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
9790         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
9791         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
9792         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
9793         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
9794         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
9795         add extra PLT entry for TLS descriptors.
9796         (Output_data_plt_x86_64::got_): New field.
9797         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
9798         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
9799         fields.
9800         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
9801         descriptors.
9802         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
9803         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
9804         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
9805         R_386_TLS_DESC_CALL relocations.
9806         (Target_x86_64::Scan::global): Likewise.
9807         (Target_x86_64::do_finalize_sections): Add dynamic table entries
9808         for TLS descriptors.
9809         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
9810         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
9811         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
9812         GD-to-IE relaxation.
9813         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
9814         and TLS_DESCRIPTORS.
9815         * Makefile.in: Rebuild.
9816         * configure: Rebuild.
9817         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
9818         (tls_test_shared2.so): New target.
9819         (tls_shared_gd_to_ie_test_SOURCES): New variable.
9820         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
9821         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
9822         (tls_shared_gd_to_ie_test_LDADD): New variable.
9823         (tls_shared_gnu2_gd_to_ie_test): New target.
9824         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
9825         New targets.
9826         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
9827         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
9828         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
9829         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
9830         (tls_shared_gnu2_test): New target.
9831         (tls_test_gnu2_shared.so): New target.
9832         (tls_shared_gnu2_test_SOURCES): New variable.
9833         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
9834         (tls_shared_gnu2_test_LDFLAGS): New variable.
9835         (tls_shared_gnu2_test_LDADD): New variable.
9836         * testsuite/Makefile.in: Rebuild.
9837         * testsuite/Makefile.
9839 2008-04-11  Ian Lance Taylor  <iant@google.com>
9841         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
9842         justsyms.t.
9843         * testsuite/Makefile.in: Rebuild.
9845         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
9846         long.
9847         * testsuite/script_test_2.cc (main): Adjust test.
9849 2008-04-11  David S. Miller  <davem@davemloft.net>
9850             Ian Lance Taylor  <iant@google.com>
9852         * options.h (General_options): Add entries for '-Y' and
9853         '-relax'.
9854         * options.cc (General_options:finalize): If -Y was used, add those
9855         entries to the library path instead of the default "/lib" and
9856         "/usr/lib".
9858 2008-04-11  David S. Miller  <davem@davemloft.net>
9860         * testsuite/justsyms.t: Start at 0x100.
9861         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
9862         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
9863         long.
9864         * testsuite/script_test_2.cc: Adjust string and section length
9865         checks.
9867 2008-04-09  Ian Lance Taylor  <iant@google.com>
9869         PR gold/5996
9870         * script-sections.cc (Sections_element::allocate_to_segment): Add
9871         orphan parameter.
9872         (Output_section_definition::allocate_to_segment): Likewise.
9873         (Orphan_output_section::allocate_to_segment): Likewise.
9874         (Script_sections::attach_sections_using_phdrs_clause): Don't
9875         propagate non-PT_LOAD segments to orphan sections.
9876         * testsuite/Makefile.am (script_test_3.stdout): Generate using
9877         readelf rather than objdump.
9878         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
9879         .interp section and PT_INTERP segment are the same size.
9880         * testsuite/Makefile.in: Rebuild.
9882         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
9883         aliases for symbols defined in the same object.
9884         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
9885         (weak_alias_test_SOURCES): New variable.
9886         (weak_alias_test_DEPENDENCIES): New variable.
9887         (weak_alias_test_LDFLAGS): New variable.
9888         (weak_alias_test_LDADD): New variable.
9889         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
9890         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
9891         (weak_alias_test_3.o): New target.
9892         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
9893         * testsuite/weak_alias_test_main.cc: New file.
9894         * testsuite/weak_alias_test_1.cc: New file.
9895         * testsuite/weak_alias_test_2.cc: New file.
9896         * testsuite/weak_alias_test_3.cc: New file.
9898 2008-04-08  Ian Lance Taylor  <iant@google.com>
9900         * options.h (class General_options): Add --noinhibit-exec option.
9901         * main.cc (main): Check --noinhibit-exec.
9903         * options.h (class General_options): Define --wrap as a special
9904         option.  Add wrap_symbols_ field.
9905         (General_options::any_wrap_symbols): New function.
9906         (General_options::is_wrap_symbol): New function.
9907         * options.cc (General_options::parse_wrap): New function.
9908         (General_options::General_options): Initialize wrap_symbols_.
9909         * symtab.cc (Symbol_table::wrap_symbol): New function.
9910         (Symbol_table::add_from_object): Handle --wrap.
9911         * symtab.h (class Symbol_table): Declare wrap_symbol.
9912         * target.h (Target::wrap_char): New function.
9913         (Target::Target_info): Add wrap_char field.
9914         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
9915         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9916         * testsuite/testfile.cc (Target_test::test_target_info):
9917         Likewise.
9919         * errors.cc (Errors::undefined_symbol): Mention symbol version if
9920         there is one.
9922         * layout.h (class Layout): Add added_eh_frame_data_ field.
9923         * layout.cc (Layout::Layout): Initialize new field.
9924         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
9925         output section until we find a section we merged successfully.
9926         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
9927         that the size be non-zero.
9929         * merge.cc (Object_merge_map::get_output_offset): Remove inline
9930         qualifier.
9932 2008-04-08  Craig Silverstein  <csilvers@google.com>
9934         * configure.ac: Export new conditional variable HAVE_ZLIB.
9935         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
9936         on HAVE_ZLIB.
9937         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
9938         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9940 2008-04-07  Ian Lance Taylor  <iant@google.com>
9942         * version.cc (version_string): Set to "1.5".
9944         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
9945         Add issued_non_pic_error_ field.  Declare check_non_pic.
9946         (Target_x86_64::Scan::check_non_pic): New function.
9947         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
9948         (Target_x86_64::Scan::global): Likewise.
9950         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
9951         addend parameter.  Change caller.  Handle merge sections.
9952         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
9953         Address to Addend.  Don't add in the result of
9954         local_section_offset, pass down the addend and use the returned
9955         value.
9956         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
9957         Update declarations of local_section_offset and symbol_value.
9958         * testsuite/two_file_test_1.cc (t18): New function.
9959         * testsuite/two_file_test_2.cc (f18): New function.
9960         * testsuite/two_file_test_main.cc (main): Call t18.
9961         * testsuite/two_file_test.h (t18, f18): Declare.
9963         * configure.ac: Don't test for objdump, c++filt, or readelf.
9964         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
9965         conditionals.
9966         (TEST_READELF): New variable.
9967         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
9968         (check_PROGRAMS): Add two_file_strip_test.
9969         (two_file_strip_test): New target.
9970         (check_PROGRAMS): Add two_file_same_shared_strip_test.
9971         (two_file_same_shared_strip_test_SOURCES): New variable.
9972         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
9973         (two_file_same_shared_strip_test_LDFLAGS): New variable.
9974         (two_file_same_shared_strip_test_LDADD): New variable.
9975         (two_file_shared_strip.so): New target.
9976         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
9977         (ver_test_5.syms, ver_test_7.syms): Likewise.
9978         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
9979         (strip_test_3.stdout): Use TEST_OBJDUMP.
9980         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
9982 2008-04-04  Cary Coutant  <ccoutant@google.com>
9984         * symtab.h (Symbol::is_weak_undefined): New function.
9985         (Symbol::is_strong_undefined): New function.
9986         (Symbol::is_absolute): New function.
9987         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
9988         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
9989         absolute symbols.
9990         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
9991         (weak_undef_test): New target.
9992         * testsuite/Makefile.in: Rebuild.
9993         * testsuite/weak_undef_file1.cc: New file.
9994         * testsuite/weak_undef_file2.cc: New file.
9995         * testsuite/weak_undef_test.cc: New file.
9997 2008-04-03  Craig Silverstein  <csilvers@google.com>
9999         * compressed_output.h (class Output_compressed_section): Use
10000         unsigned buffer.
10001         * compressed_output.cc (zlib_compress): Use unsigned buffers,
10002         add zlib header.
10003         (zlib_compressed_suffix): Removed.
10004         (Output_compressed_section::set_final_data_size): Use unsigned
10005         buffers.
10006         * testsuite/Makefile.am (flagstest_compress_debug_sections):
10007         Fix linker invocation.
10008         (flagstest_o_specialfile_and_compress_debug_sections):
10009         Likewise.
10010         * testsuite/Makefile.in: Regenerated.
10012 2008-04-02  David S. Miller  <davem@davemloft.net>
10014         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10015         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10017 2008-04-02  Craig Silverstein  <csilvers@google.com>
10019         * TODO: New file.
10021 2008-04-02  Ian Lance Taylor  <iant@google.com>
10023         * fileread.cc (File_read::find_view): Add byteshift and vshifted
10024         parameters.  Update for new key type to views_.  Change all
10025         callers.
10026         (File_read::read): Adjust for byteshift in returned view.
10027         (File_read::add_view): New function, broken out of
10028         find_and_make_view.
10029         (File_read::make_view): New function, broken out of
10030         find_and_make_view.
10031         (File_read::find_or_make_view): Add offset and aligned
10032         parameters.  Rewrite accordingly.  Change all callers.
10033         (File_read::get_view): Add offset and aligned parameters.  Adjust
10034         for byteshift in return value.
10035         (File_read::get_lasting_view): Likewise.
10036         * fileread.h (class File_read): Update declarations.
10037         (class File_read::View): Add byteshift_ field.  Add byteshift to
10038         constructor.  Add byteshift method.
10039         * archive.h (Archive::clear_uncached_views): New function.
10040         (Archive::get_view): Add aligned parameter.  Change all callers.
10041         * object.h (Object::get_view): Add aligned parameter.  Change all
10042         callers.
10043         (Object::get_lasting_view): Likewise.
10045         * fileread.cc (File_read::release): Don't call clear_views if
10046         there are multiple objects.
10047         * fileread.h (File_read::clear_uncached_views): New function.
10048         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
10049         on the archive.
10051 2008-03-31  Cary Coutant  <ccoutant@google.com>
10053         Add thin archive support.
10054         * archive.cc (Archive::armagt): New const.
10055         (Archive::setup): Remove task parameter and calls to unlock.
10056         (Archive::unlock_nested_archives): New function.
10057         (Archive::read_header): Add nested_off parameter. Change
10058         all callers.
10059         (Archive::interpret_header): Likewise.
10060         (Archive::include_all_members): Change to handle thin
10061         archives.
10062         (Archive::include_member): Likewise.
10063         * archive.h (Archive::Archive): Add new parameters and
10064         initializers.
10065         (Archive::armagt): New const.
10066         (Archive::setup): Remove task parameter.
10067         (Archive::unlock_nested_archives): New function.
10068         (Archive::read_header): Add nested_off parameter.
10069         (Archive::interpret_header): Likewise.
10070         (Archive::Nested_archive_table): New typedef.
10071         (Archive::is_thin_archive_): New field.
10072         (Archive::nested_archives_): New field.
10073         (Archive::options_): New field.
10074         (Archive::dirpath_): New field.
10075         (Archive::task_): New field.
10076         * readsyms.cc (Read_symbols::do_read_symbols): Add check
10077         for thin archives.  Pass additional parameters to
10078         Archive::Archive.  Unlock the archive file after calling
10079         Archive::setup.
10081 2008-03-29  Ian Lance Taylor  <iant@google.com>
10083         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
10084         version symbol to be local.
10085         * testsuite/ver_test_4.sh: New file.
10086         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
10087         (check_DATA): Add ver_test_4.syms.
10088         (ver_test_4.syms): New target.
10089         * testsuite/Makefile.in: Rebuild.
10091         * output.cc
10092         (Output_section::Input_section_sort_entry::has_priority): New
10093         function.
10094         (Output_section::Input_section_sort_entry::match_file_name): New
10095         function.
10096         (Output_section::Input_section_sort_entry::match_section_name):
10097         Remove.
10098         (Output_section::Input_section_sort_entry::match_section_name_prefix):
10099         Remove.
10100         (Output_section::Input_section_sort_entry::match_section_file):
10101         Remove.
10102         (Output_section::Input_section_sort_compare::operator()): Rewrite
10103         using new Input_section_sort_entry functions.  Sort crtbegin and
10104         crtend first.  Sort sections with no priority before sections with
10105         a priority.
10106         * testsuite/initpri1.c (d3): Check j != 4.
10107         (cd5): New constructor/destructor function.
10108         (main): Check j != 2.
10110         * symtab.cc (Symbol_table::add_from_object): If we don't use the
10111         new symbol when resolving, don't call set_is_default.
10112         * testsuite/ver_test_7.cc: New file.
10113         * testsuite/ver_test_7.sh: New file.
10114         * testsuite/Makefile.am (ver_test_7.so): New target.
10115         (ver_test_7.o): New target.
10116         (check_SCRIPTS): Add ver_test_7.sh.
10117         (check_DATA): Add ver_test_7.syms.
10118         (ver_test_7.syms): New target.
10120 2008-03-28  Ian Lance Taylor  <iant@google.com>
10122         * layout.cc (Layout::layout): If we see an input section with a
10123         name that needs sorting, set the must_sort flag for the output
10124         section.
10125         (Layout::make_output_section): If the name of the output section
10126         indicates that it might require sorting, set the may_sort flag.
10127         * output.h (Output_section::may_sort_attached_input_sections): New
10128         function.
10129         (Output_section::set_may_sort_attached_input_sections): New
10130         function.
10131         (Output_section::must_sort_attached_input_sections): New
10132         function.
10133         (Output_section::set_must_sort_attached_input_sections): New
10134         function.
10135         (class Output_section): Declare Input_section_sort_entry.  Define
10136         Input_section_sort_compare.  Declare
10137         sort_attached_input_sections.  Add new fields:
10138         may_sort_attached_input_sections_,
10139         must_sort_attached_input_sections_,
10140         attached_input_sections_are_sorted_.
10141         * output.cc (Output_section::Output_section): Initialize new
10142         fields.
10143         (Output_section::add_input_section): Add an entry to
10144         input_sections_ if may_sort or must_sort are true.
10145         (Output_section::set_final_data_size): Call
10146         sort_attached_input_sections if necessary.
10147         (Output_section::Input_section_sort_entry): Define new class.
10148         (Output_section::Input_section_sort_compare::operator()): New
10149         function.
10150         (Output_section::sort_attached_input_sections): New function.
10151         * configure.ac: Check whether the compiler supports constructor
10152         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
10153         * testsuite/initpri1.c: New file.
10154         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
10155         CONSTRUCTOR_PRIORITY.
10156         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
10157         (initpri1_LDFLAGS): New variable.
10158         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10160 2008-03-27  Ian Lance Taylor  <iant@google.com>
10162         * common.cc (Sort_commons::operator): Correct sorting algorithm.
10163         * testsuite/common_test_1.c: New file.
10164         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
10165         (common_test_1_SOURCES): New variable.
10166         (common_test_1_DEPENDENCIES): New variable.
10167         (common_test_1_LDFLAGS): New variable.
10169         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
10170         and commons_ correctly when NAME/VERSION does not override
10171         NAME/NULL.
10172         * testsuite/ver_test_6.c: New file.
10173         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
10174         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
10175         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
10177 2008-03-26  Ian Lance Taylor  <iant@google.com>
10179         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
10180         of an undefined symbol from a version script.
10181         * testsuite/Makefile.am (ver_test_5.so): New target.
10182         (ver_test_5.o): New target.
10183         (check_SCRIPTS): Add ver_test_5.sh.
10184         (check_DATA): Add ver_test_5.syms.
10185         (ver_test_5.syms): New target.
10186         * testsuite/ver_test_5.cc: New file.
10187         * testsuite/ver_test_5.script: New file.
10188         * testsuite/ver_test_5.sh: New file.
10189         * Makefile.in, testsuite/Makefile.in: Rebuild.
10191         PR gold/5986
10192         Fix problems building gold with gcc 4.3.0.
10193         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
10194         (gold_error_at_location, gold_warning_at_location): Use it.
10195         * configure.ac: Check whether we can compile and use a template
10196         function with a printf attribute.
10197         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
10198         when jumping over bytes.
10199         * object.cc: Instantiate Object::read_section_data.
10200         * debug.h: Include <cstring>
10201         * dwarf_reader.cc: Include <algorithm>
10202         * main.cc: Include <cstring>.
10203         * options.cc: Include <cstring>.
10204         * output.cc: Include <cstring>.
10205         * script.cc: Include <cstring>.
10206         * script.h: Include <string>.
10207         * symtab.cc: Include <cstring> and <algorithm>.
10208         * target-select.cc: Include <cstring>.
10209         * version.cc: Include <string>.
10210         * testsuite/testmain.cc: Include <cstdlib>.
10211         * configure, config.in: Rebuild.
10213 2008-03-25  Ian Lance Taylor  <iant@google.com>
10215         * options.cc: Include "../bfd/bfdver.h".
10216         (options::help): Print bug reporting address.
10218         * version.cc (print_version): Adjust output for current value of
10219         BFD_VERSION_STRING.
10221         * NEWS: New file.
10223         * options.cc (options::help): Print list of supported targets.
10224         * target-select.h: Include <vector>.
10225         (class Target_selector): Make machine_, size_, and is_big_endian_
10226         fields const.  Add bfd_name_ and instantiated_target_ fields.
10227         (Target_selector::Target_selector): Add bfd_name parameter.
10228         (Target_selector::recognize): Make non-virtual, call
10229         do_recognize.
10230         (Target_selector::recognize_by_name): Make non-virtual, call
10231         do_recognize_by_name.
10232         (Target_selector::supported_names): New function.
10233         (Target_selector::bfd_name): New function.
10234         (Target_selector::do_instantiate_target): New pure virtual
10235         function.
10236         (Target_selector::do_recognize): New virtual function.
10237         (Target_selector::do_recognize_by_name): New virtual function.
10238         (Target_selector::instantiate_target): New private function.
10239         (supported_target_names): Declare.
10240         * target-select.cc (Target_selector::Target_selector): Update for
10241         new parameter and fields.
10242         (select_target_by_name): Check that the name matches before
10243         calling recognize_by_name.
10244         (supported_target_names): New function.
10245         * i386.cc (class Target_selector_i386): Update Target_selector
10246         constructor call.  Remove recognize and recognize_by_name.  Add
10247         do_instantiate_target.
10248         * x86_64.cc (class Target_selector_x86_64): Likewise.
10249         * testsuite/testfile.cc (class Target_selector_test): Update for
10250         changes to Target_selector.
10252         * README: Rewrite, with some notes on unsupported features.
10254 2008-03-24  Cary Coutant  <ccoutant@google.com>
10256         * i386.cc (Target_i386::Got_type): New enum declaration.
10257         (Target_i386::Scan::local): Updated callers of Output_data_got
10258         member functions.
10259         (Target_i386::Scan::global): Likewise.
10260         (Target_i386::Relocate::relocate): Likewise.
10261         (Target_i386::Relocate::relocate_tls): Likewise.
10262         * object.h (Got_offset_list): New class.
10263         (Sized_relobj::local_has_got_offset): Added got_type parameter.
10264         (Sized_relobj::local_got_offset): Likewise.
10265         (Sized_relobj::set_local_got_offset): Likewise.
10266         (Sized_relobj::local_has_tls_got_offset): Removed.
10267         (Sized_relobj::local_tls_got_offset): Removed.
10268         (Sized_relobj::set_local_tls_got_offset): Removed.
10269         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
10270         * output.cc (Output_data_got::add_global): Added got_type parameter.
10271         (Output_data_got::add_global_with_rel): Likewise.
10272         (Output_data_got::add_global_with_rela): Likewise.
10273         (Output_data_got::add_global_pair_with_rel): New function.
10274         (Output_data_got::add_global_pair_with_rela): New function.
10275         (Output_data_got::add_local): Added got_type parameter.
10276         (Output_data_got::add_local_with_rel): Likewise.
10277         (Output_data_got::add_local_with_rela): Likewise.
10278         (Output_data_got::add_local_pair_with_rel): New function.
10279         (Output_data_got::add_local_pair_with_rela): New function.
10280         (Output_data_got::add_global_tls): Removed.
10281         (Output_data_got::add_global_tls_with_rel): Removed.
10282         (Output_data_got::add_global_tls_with_rela): Removed.
10283         (Output_data_got::add_local_tls): Removed.
10284         (Output_data_got::add_local_tls_with_rel): Removed.
10285         (Output_data_got::add_local_tls_with_rela): Removed.
10286         * output.h (Output_data_got::add_global): Added got_type parameter.
10287         (Output_data_got::add_global_with_rel): Likewise.
10288         (Output_data_got::add_global_with_rela): Likewise.
10289         (Output_data_got::add_global_pair_with_rel): New function.
10290         (Output_data_got::add_global_pair_with_rela): New function.
10291         (Output_data_got::add_local): Added got_type parameter.
10292         (Output_data_got::add_local_with_rel): Likewise.
10293         (Output_data_got::add_local_with_rela): Likewise.
10294         (Output_data_got::add_local_pair_with_rel): New function.
10295         (Output_data_got::add_local_pair_with_rela): New function.
10296         (Output_data_got::add_global_tls): Removed.
10297         (Output_data_got::add_global_tls_with_rel): Removed.
10298         (Output_data_got::add_global_tls_with_rela): Removed.
10299         (Output_data_got::add_local_tls): Removed.
10300         (Output_data_got::add_local_tls_with_rel): Removed.
10301         (Output_data_got::add_local_tls_with_rela): Removed.
10302         * resolve.cc (Symbol::override_base_with_special): Removed
10303         reference to has_got_offset_ field.
10304         * symtab.cc (Symbol::init_fields): Replaced initialization
10305         of got_offset_ with got_offsets_.  Removed initialization
10306         of has_got_offset_
10307         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
10308         (Symbol::got_offset): Likewise.
10309         (Symbol::set_got_offset): Likewise.
10310         (Symbol::has_tls_got_offset): Removed.
10311         (Symbol::tls_got_offset): Removed.
10312         (Symbol::set_tls_got_offset): Removed.
10313         (Symbol::got_offset_): Removed.
10314         (Symbol::tls_mod_got_offset_): Removed.
10315         (Symbol::tls_pair_got_offset_): Removed.
10316         (Symbol::got_offsets_): New field.
10317         (Symbol::has_got_offset): Removed.
10318         (Symbol::has_tls_mod_got_offset): Removed.
10319         (Symbol::has_tls_pair_got_offset): Removed.
10320         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
10321         (Target_x86_64::Scan::local): Updated callers of Output_data_got
10322         member functions.
10323         (Target_x86_64::Scan::global): Likewise.
10324         (Target_x86_64::Relocate::relocate): Likewise.
10325         (Target_x86_64::Relocate::relocate_tls): Likewise.
10327 2008-03-25  Ben Elliston  <bje@au.ibm.com>
10329         * yyscript.y: Fix spelling error in comment.
10331 2008-03-24  Ian Lance Taylor  <iant@google.com>
10333         * options.h (class General_options): Define build_id option.
10334         * layout.h (class Layout): Declare write_build_id, create_note,
10335         create_build_id.  Add build_id_note_ member.
10336         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
10337         "libiberty.h", "md5.h", "sha1.h".
10338         (Layout::Layout): Initialize eh_frame_data_,
10339         eh_frame_hdr_section_, and build_id_note_.
10340         (Layout::finalize): Call create_build_id.
10341         (Layout::create_note): New function, broken out of
10342         Layout::create_gold_note.
10343         (Layout::create_gold_note): Call create_note.
10344         (Layout::create_build_id): New function.
10345         (Layout::write_build_id): New function.
10346         (Close_task_runner::run): Call write_build_id.
10348         * x86_64.cc: Correct license to GPLv3.
10350 2008-03-23  Ian Lance Taylor  <iant@google.com>
10352         * options.cc: Include "demangle.h".
10353         (parse_optional_string): New function.
10354         (parse_long_option): Handle takes_optional_argument.
10355         (parse_short_option): Update dash_z initializer.  Handle
10356         takes_optional_argument.
10357         (General_options::General_options): Initialize do_demangle_.
10358         (General_options::finalize): Set do_demangle_.  Handle demangling
10359         style.
10360         * options.h (parse_optional_string): Declare.
10361         (struct One_option): Add optional_arg field.  Update constructor.
10362         Update call constructor calls.  Add takes_optional_argument
10363         function.
10364         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
10365         (DEFINE_optional_string): Define.
10366         (General_options::demangle): Change from DEFINE_bool to
10367         DEFINE_optional_string.
10368         (General_options::no_demangle): New function.
10369         (General_options::do_demangle): New function.
10370         (General_options::set_do_demangle): New function.
10371         (General_options::execstack_status_): Move definition to end of
10372         class definition.
10373         (General_options::static_): Likewise.
10374         (General_options::do_demangle_): New field.
10375         * object.cc (big_endian>::get_symbol_location_info): Call
10376         Options::do_demangle, not Options::demangle.
10377         * symtab.cc (demangle): Likewise.
10379 2008-03-22  Ian Lance Taylor  <iant@google.com>
10381         * gold.h: Include <cstddef> and <sys/types.h>
10382         * options.h: Include <cstring>.
10384 2008-03-21  Ian Lance Taylor  <iant@google.com>
10386         * Added source code to GNU binutils.