* testsuite/incremental_test_1.c: Add prototype to avoid warning.
[binutils.git] / gold / ChangeLog
blob9eb928d6d3cc28463d6bfe75f7df2702090423b5
1 2010-08-13  Ian Lance Taylor  <iant@google.com>
3         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5 2010-08-12  Cary Coutant  <ccoutant@google.com>
6             Doug Kwan  <dougkwan@google.com>
8         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9         defintion overrides non-weak undef, remember that the original undef
10         is not weak.
11         * symtab.cc (Symbol_table::sized_write_global): For undef without
12         an original weak binding, set binding to global in output.
13         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
14         * testsuite/Makefile.in: Regenerate.
15         * testsuite/strong_ref_weak_def.sh: New file.
16         * testsuite/strong_ref_weak_def_1.c: Ditto.
17         * testsuite/strong_ref_weak_def_2.c: Ditto.
19 2010-08-12  Cary Coutant  <ccoutant@google.com>
21         * testsuite/incremental_test.sh: Rewrite.
22         * testsuite/incremental_test_1.c: Rewrite.
23         * testsuite/incremental_test_2.c: Rewrite.
25 2010-08-12  Cary Coutant  <ccoutant@google.com>
27         * arm.cc (Target_arm::got_size): Add const.
28         (Target_arm::got_entry_count): New function.
29         (Target_arm::plt_entry_count): New function.
30         (Target_arm::first_plt_entry_offset): New function.
31         (Target_arm::plt_entry_size): New function.
32         (Output_data_plt_arm::entry_count): New function.
33         (Output_data_plt_arm::first_plt_entry_offset): New function.
34         (Output_data_plt_arm::get_plt_entry_size): New function.
35         * i386.cc (Target_i386::got_size): Add const.
36         (Target_i386::got_entry_count): New function.
37         (Target_i386::plt_entry_count): New function.
38         (Target_i386::first_plt_entry_offset): New function.
39         (Target_i386::plt_entry_size): New function.
40         (Output_data_plt_i386::entry_count): New function.
41         (Output_data_plt_i386::first_plt_entry_offset): New function.
42         (Output_data_plt_i386::get_plt_entry_size): New function.
43         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
44         find_incremental_inputs_sections.  Dump incremental_got_plt section.
45         * incremental.cc: Include target.h.
46         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
47         parameter.  Adjust all callers.  Find incremental_got_plt section.
48         (Incremental_inputs::create_data_sections): Create incremental_got_plt
49         section.
50         (Output_section_incremental_inputs::set_final_data_size): Calculate
51         size of incremental_got_plt section.
52         (Output_section_incremental_inputs::do_write): Write the
53         incremental_got_plt section.
54         (Got_plt_view_info): New struct.
55         (Local_got_offset_visitor): New class.
56         (Global_got_offset_visitor): New class.
57         (Global_symbol_visitor_got_plt): New class.
58         (Output_section_incremental_inputs::write_got_plt): New function.
59         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
60         Add parameter.  Adjust all callers.
61         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
62         (Incremental_inputs::got_plt_section): New function.
63         (Incremental_inputs::got_plt_section_): New data member.
64         (Incremental_got_plt_reader): New class.
65         * layout.cc (Layout::create_incremental_info_sections): Add the
66         incremental_got_plt section.
67         * object.h (Got_offset_list::get_list): New function.
68         (Got offset_list::for_all_got_offsets): New function.
69         (Sized_relobj::local_got_offset_list): New function.
70         * powerpc.cc (Target_powerpc::got_size): Add const.
71         (Target_powerpc::got_entry_count): New function.
72         (Target_powerpc::plt_entry_count): New function.
73         (Target_powerpc::first_plt_entry_offset): New function.
74         (Target_powerpc::plt_entry_size): New function.
75         (Output_data_plt_powerpc::entry_count): New function.
76         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
77         (Output_data_plt_powerpc::get_plt_entry_size): New function.
78         * sparc.cc (Target_sparc::got_size): Add const.
79         (Target_sparc::got_entry_count): New function.
80         (Target_sparc::plt_entry_count): New function.
81         (Target_sparc::first_plt_entry_offset): New function.
82         (Target_sparc::plt_entry_size): New function.
83         (Output_data_plt_sparc::entry_count): New function.
84         (Output_data_plt_sparc::first_plt_entry_offset): New function.
85         (Output_data_plt_sparc::get_plt_entry_size): New function.
86         * symtab.h (Symbol::got_offset_list): New function.
87         (Symbol_table::for_all_symbols): New function.
88         * target.h (Sized_target::got_entry_count): New function.
89         (Sized_target::plt_entry_count): New function.
90         (Sized_target::plt_entry_size): New function.
91         * x86_64.cc (Target_x86_64::got_size): Add const.
92         (Target_x86_64::got_entry_count): New function.
93         (Target_x86_64::plt_entry_count): New function.
94         (Target_x86_64::first_plt_entry_offset): New function.
95         (Target_x86_64::plt_entry_size): New function.
96         (Output_data_plt_x86_64::entry_count): New function.
97         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
98         (Output_data_plt_x86_64::get_plt_entry_size): New function.
100 2010-08-12  Cary Coutant  <ccoutant@google.com>
102         * archive.cc: Include incremental.h.
103         (Archive::Archive): Initialize incremental_info_.
104         (Archive::include_member): Record archive members in incremental info.
105         (Add_archive_symbols::run): Record begin and end of an archive in
106         incremental info.
107         (Lib_group::include_member): Record objects in incremental info.
108         * archive.h (Incremental_archive_entry): Forward declaration.
109         (Archive::set_incremental_info): New member function.
110         (Archive::incremental_info): New member function.
111         (Archive::Unused_symbol_iterator): New class.
112         (Archive::unused_symbols_begin): New member function.
113         (Archive::unused_symbols_end): New member function.
114         (Archive::incremental_info_): New data member.
115         * incremental-dump.cc (find_input_containing_global): New function.
116         (dump_incremental_inputs): Dump new incremental info sections.
117         * incremental.cc: Include symtab.h.
118         (Output_section_incremental_inputs): New class.
119         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
120         new incremental info sections.
121         (Sized_incremental_binary::do_check_inputs): Likewise.
122         (Incremental_inputs::report_archive): Remove.
123         (Incremental_inputs::report_archive_begin): New function.
124         (Incremental_inputs::report_archive_end): New function.
125         (Incremental_inputs::report_object): New function.
126         (Incremental_inputs::finalize_inputs): Remove.
127         (Incremental_inputs::report_input_section): New function.
128         (Incremental_inputs::report_script): Rewrite.
129         (Incremental_inputs::finalize): Do nothing but finalize string table.
130         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
131         (Incremental_inputs::sized_create_inputs_section_data): Remove.
132         (Incremental_inputs::create_data_sections): New function.
133         (Incremental_inputs::relocs_entsize): New function.
134         (Output_section_incremental_inputs::set_final_data_size): New function.
135         (Output_section_incremental_inputs::do_write): New function.
136         (Output_section_incremental_inputs::write_header): New function.
137         (Output_section_incremental_inputs::write_input_files): New function.
138         (Output_section_incremental_inputs::write_info_blocks): New function.
139         (Output_section_incremental_inputs::write_symtab): New function.
140         * incremental.h (Incremental_script_entry): Forward declaration.
141         (Incremental_object_entry): Forward declaration.
142         (Incremental_archive_entry): Forward declaration.
143         (Incremental_inputs): Forward declaration.
144         (Incremental_inputs_header_data): Remove.
145         (Incremental_inputs_header): Remove.
146         (Incremental_inputs_header_write): Remove.
147         (Incremental_inputs_entry_data): Remove.
148         (Incremental_inputs_entry): Remove.
149         (Incremental_inputs_entry_write): Remove.
150         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
151         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
152         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
153         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
154         Likewise.
155         (Incremental_input_entry): New class.
156         (Incremental_script_entry): New class.
157         (Incremental_object_entry): New class.
158         (Incremental_archive_entry): New class.
159         (Incremental_inputs::Incremental_inputs): Initialize new data members.
160         (Incremental_inputs::report_inputs): Remove.
161         (Incremental_inputs::report_archive): Remove.
162         (Incremental_inputs::report_archive_begin): New function.
163         (Incremental_inputs::report_archive_end): New function.
164         (Incremental_inputs::report_object): Change prototype.
165         (Incremental_inputs::report_input_section): New function.
166         (Incremental_inputs::report_script): Change prototype.
167         (Incremental_inputs::get_reloc_count): New function.
168         (Incremental_inputs::set_reloc_count): New function.
169         (Incremental_inputs::create_data_sections): New function.
170         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
171         (Incremental_inputs::inputs_section): New function.
172         (Incremental_inputs::symtab_section): New function.
173         (Incremental_inputs::relocs_section): New function.
174         (Incremental_inputs::get_stringpool): Add const.
175         (Incremental_inputs::command_line): Add const.
176         (Incremental_inputs::inputs): Remove.
177         (Incremental_inputs::command_line_key): New function.
178         (Incremental_inputs::input_file_count): New function.
179         (Incremental_inputs::input_files): New function.
180         (Incremental_inputs::relocs_entsize): New function.
181         (Incremental_inputs::sized_create_inputs_section_data): Remove.
182         (Incremental_inputs::finalize_inputs): Remove.
183         (Incremental_inputs::Input_info): Remove.
184         (Incremental_inputs::lock_): Remove.
185         (Incremental_inputs::inputs_): Change type.
186         (Incremental_inputs::inputs_map_): Remove.
187         (Incremental_inputs::current_object_entry_): New data member.
188         (Incremental_inputs::inputs_section_): New data member.
189         (Incremental_inputs::symtab_section_): New data member.
190         (Incremental_inputs::relocs_section_): New data member.
191         (Incremental_inputs::reloc_count_): New data member.
192         (Incremental_inputs_reader): New class.
193         (Incremental_symtab_reader): New class.
194         (Incremental_relocs_reader): New class.
195         * layout.cc (Layout::finalize): Move finalization of incremental info
196         and creation of incremental info sections to follow finalization of
197         symbol table.  Set offsets for postprocessing sections.
198         (Layout::create_incremental_info_sections): Call
199         Incremental_inputs::create_data_sections.  Add incremental symtab
200         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
201         sections to layout after input sections.
202         * layout.h (struct Timespec): Forward declaration.
203         (Layout::incremental_inputs): Add const.
204         (Layout::create_incremental_info_sections): Add parameter.
205         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
206         * object.cc: Include incremental.h.
207         (Relobj::finalize_incremental_relocs): New function.
208         (Sized_relobj::do_layout): Record input sections in incremental info.
209         * object.h (Object::output_section): New function.
210         (Object::output_section_offset): Moved from Relobj.
211         (Object::get_incremental_reloc_base): New function.
212         (Object::get_incremental_reloc_count): New function.
213         (Object::do_output_section): New function.
214         (Object::do_output_section_offset): Moved from Relobj.
215         (Object::do_get_incremental_reloc_base): New function.
216         (Object::do_get_incremental_reloc_count): New function.
217         (Object::Object): Initialize new data members.
218         (Relobj::output_section): Renamed do_output_section and moved to
219         protected.
220         (Relobj::output_section_offset): Moved to Object.
221         (Relobj::do_get_incremental_reloc_base): New function.
222         (Relobj::do_get_incremental_reloc_count): New function.
223         (Relobj::allocate_incremental_reloc_counts): New function.
224         (Relobj::count_incremental_reloc): New function.
225         (Relobj::finalize_incremental_relocs): New function.
226         (Relobj::next_incremental_reloc_index): New function.
227         (Relobj::reloc_counts_): New data member.
228         (Relobj::reloc_bases_): New data member.
229         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
230         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
231         (Sized_relobj::incremental_relocs_scan): New function.
232         (Sized_relobj::incremental_relocs_scan_reltype): New function.
233         (Sized_relobj::incremental_relocs_write): New function.
234         (Sized_relobj::incremental_relocs_write_reltype): New function.
235         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
236         incremental link.
237         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
238         archives and object files elsewhere.
239         (Add_symbols::run): Report object files here.
240         (Finish_group::run): Report end of archive at end of group.
241         * reloc.cc: Include layout.h, incremental.h.
242         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
243         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
244         (Sized_relobj::incremental_relocs_scan): New function.
245         (Sized_relobj::incremental_relocs_scan_reltype): New function.
246         (Sized_relobj::do_relocate_sections): Write incremental relocations.
247         (Sized_relobj::incremental_relocs_write): New function.
248         (Sized_relobj::incremental_relocs_write_reltype): New function.
249         * script.cc (read_input_script): Rewrite test for incremental link.
250         Change call to Incremental_inputs::report_script.
251         * symtab.h (Symbol_table::first_global_index): New function.
252         (Symbol_table::output_count): New function.
254 2010-08-12  Doug Kwan  <dougkwan@google.com>
256         * arm.cc (Target_arm::merge_object_attributes): Check command line
257         options --no-wchar-size-warning and --no-enum-size-warning.
258         * options.h (General_options): Add ld-compatible options
259         --no-enum-size-warning and --no-wchar-size-warning.
261 2010-08-04  Ian Lance Taylor  <iant@google.com>
263         * x86_64.cc (Target_x86_64::Scan::local): Use
264         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
265         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
266         (Target_x86_64::Scan::global): Likewise.
267         (Target_x86_64::Relocate::relocate): Likewise.
268         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
269         Likewise.
271 2010-08-03  Cary Coutant  <ccoutant@google.com>
273         * merge.cc (Output_merge_string::do_add_input_section): Count strings
274         to reserve space in merged_strings vector. Keep total input size
275         for stats.
276         (Output_merge_string::do_print_merge_stats): Print total input size.
277         * merge.h (Output_merge_string): Add input_size_ field.
278         * stringpool.cc (Stringpool_template::string_length): Move
279         implementations out of Stringpool_template class and place in
280         stringpool.h.
281         * stringpool.h (string_length): Move out of Stringpool_template.
283 2010-08-03  Ian Lance Taylor  <iant@google.com>
285         PR 11712
286         * layout.cc (relaxation_loop_body): If address of load segment is
287         set, adjust address to include headers if possible.
289 2010-08-03  Ian Lance Taylor  <iant@google.com>
291         * version.cc (version_string): Bump to 1.10.
293 2010-08-03  Ian Lance Taylor  <iant@google.com>
295         PR 11805
296         * layout.h (enum Output_section_order): Define.
297         (class Layout): Update declarations.
298         * layout.cc (Layout::get_output_section): Add order parameter.
299         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
300         is_first_non_relro parameters.  Change all callers.
301         (Layout::choose_output_section): Likewise.
302         (Layout::add_output_section_data): Likewise.
303         (Layout::make_output_section): Likewise.  Set order.
304         (Layout::default_section_order): New function.
305         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
306         * output.cc (Output_section::Output_section): Initialize order_.
307         Don't initialize deleted fields.
308         (Output_segment::Output_segment): Don't initialize deleted
309         fields.
310         (Output_segment::add_output_section_to_load): New function
311         replacing add_output_section.  Change all callers to call this or
312         add_output_section_to_nonload.
313         (Output_segment::add_output_section_to_nonload): New function.
314         (Output_segment::remove_output_section): Rewrite.
315         (Output_segment::add_initial_output_data): Likewise.
316         (Output_segment::has_any_data_sections): Likewise.
317         (Output_segment::is_first_section_relro): Likewise.
318         (Output_segment::maximum_alignment): Likewise.
319         (Output_segment::has_dynamic_reloc): New function replacing
320         dynamic_reloc_count.  Change all callers.
321         (Output_segment::has_dynamic_reloc_list): New function replacing
322         dynamic_reloc_count_list.  Change all callers.
323         (Output_segment::set_section_addresses): Rewrite.
324         (Output_segment::set_offset): Rewrite.
325         (Output_segment::find_first_and_last_list): Remove.
326         (Output_segment::set_tls_offsets): Rewrite.
327         (Output_segment::first_section_load_address): Likewise.
328         (Output_segment::output_section_count): Likewise.
329         (Output_segment::section_with_lowest_load_address): Likewise.
330         (Output_segment::write_section_headers): Likewise.
331         (Output_segment::print_sections_to_map): Likewise.
332         * output.h (class Output_data): Remove dynamic_reloc_count_
333         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
334         (Output_data::add_dynamic_reloc): Rewrite.
335         (Output_data::has_dynamic_reloc): New function.
336         (Output_data::dynamic_reloc_count): Remove.
337         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
338         is_last_relro_, is_first_non_relro_, is_interp_,
339         is_dynamic_linker_section_ fields.  Add order and set_order
340         functions.  Remove is_relro_local, set_is_relro_local,
341         is_last_relro, set_is_last_relro, is_first_non_relro,
342         set_is_first_non_relro functions, is_interp, set_is_interp,
343         is_dynamic_linker_section, and set_is_dynamic_linker_section
344         functions.
345         (class Output_segment): Change Output_data_list from std::list to
346         std:;vector.  Add output_lists_ field.  Remove output_data_ and
347         output_bss_ fields.  Update declarations.
349 2010-08-02  Ian Lance Taylor  <iant@google.com>
351         * arm.cc (Target_arm::gc_process_relocs): Use typename.
352         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
353         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
355 2010-08-02  Ian Lance Taylor  <iant@google.com>
357         PR 11855
358         * script.cc (Script_options::Script_options): Initialize
359         symbol_definitions_ and symbol_references_.
360         (Script_options::add_symbol_assignment): Update
361         symbol_definitions_ and symbol_references_.
362         (Script_options::add_symbol_reference): New function.
363         (script_symbol): New function.
364         * script.h (class Script_options): Add symbol_definitions_ and
365         symbol_references_ fields.
366         (Script_options::referenced_const_iterator): New type.
367         (Script_options::referenced_begin): New function.
368         (Script_options::referenced_end): New function.
369         (Script_options::is_referenced): New function.
370         (Script_options::any_unreferenced): New function.
371         * script-c.h (script_symbol): Declare.
372         * yyscript.y (exp): Call script_symbol.
373         * symtab.cc: Include "script.h".
374         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
375         Change all callers.  Check symbols referenced by scripts.
376         (Symbol_table::add_undefined_symbols_from_command_line): Add
377         layout parameter.  Change all callers.
378         (Symbol_table::do_add_undefined_symbols_from_command_line):
379         Likewise.  Break out loop body.  Check symbols referenced by
380         scripts.
381         (Symbol_table::add_undefined_symbol_from_command_line): New
382         function broken out of
383         do_add_undefined_symbols_from_command_line.
384         * symtab.h (class Symbol_table): Update declarations.
385         * archive.cc: Include "layout.h".
386         (Archive::should_include_member): Add layout parameter.  Change
387         all callers.  Check for symbol mentioned in expression.
388         * archive.h (class Archive): Update declaration.
389         * object.cc (Sized_relobj::do_should_include_member): Add layout
390         parameter.
391         * object.h (Object::should_include_member): Add layout parameter.
392         Change all callers.
393         (Object::do_should_include_member): Add layout parameter.
394         (class Sized_relobj): Update declaration.
395         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
396         parameter.
397         * dynobj.h (class Sized_dynobj): Update declaration.
398         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
399         layout parameter.
400         * plugin.h (class Sized_pluginobj): Update declaration.
402 2010-08-02  Ian Lance Taylor  <iant@google.com>
404         PR 11866
405         * output.cc (Output_segment::set_offset): Search for the first and
406         last sections rather than assuming that the list is in order.
407         (Output_segment::find_first_and_last_list): New function.
408         * output.h (class Output_segment): Update declarations.
409         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
410         (relro_strip_test_SOURCES): New variable.
411         (relro_strip_test_DEPENDENCIES): New variable.
412         (relro_strip_test_LDFLAGS): New variable.
413         (relro_strip_test_LDADD): New variable.
414         (relro_strip_test.so): New target.
416 2010-08-02  Ian Lance Taylor  <iant@google.com>
418         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
419         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
420         (Target_i386::got_tlsdesc_section): New function.
421         (Target_i386::got_section): Create space for GOT entries for
422         TLSDESC relocations.
423         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
424         R_386_TLS_GOTDESC.
425         (Target_i386::Scan::global): Likewise.
426         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
427         using TLSDESC GOT.
428         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
429         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
430         (Target_x86_64::got_tlsdesc_section): New function.
431         (Target_x86_64::got_section): Create space for GOT entries for
432         TLSDESC relocations.
433         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
434         R_386_TLS_GOTDESC.
435         (Target_x86_64::Scan::global): Likewise.
436         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
437         using TLSDESC GOT.
439 2010-08-02  Ian Lance Taylor  <iant@google.com>
441         * testsuite/final_layout.sh: Use dc to convert from hex to
442         decimal.
444 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
446         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
447         paramter to the call to gold::gc_process_relocs.
448         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
449         paramter to the call to gold::gc_process_relocs.
450         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
451         parameter to the call to gold::gc_process_relocs.
452         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
453         template parameter to the call to gold::gc_process_relocs.
454         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
455         paramter to the call to gold::gc_process_relocs.
456         * gc.h (get_embedded_addend_size): New function.
457         (gc_process_relocs): Save the size of the reloc for use by ICF.
458         * icf.cc (get_section_contents): Get the addend from the text section
459         for SHT_REL relocation sections.
460         * icf.h (Icf::Reloc_addend_size_info): New typedef.
461         (Icf::Reloc_info): Add new member reloc_addend_size_info.
462         * int_encoding.h (read_from_pointer): New overloaded function.
463         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
464         * testsuite/icf_sht_rel_addend_test.sh: New file.
465         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
466         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
468 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
470         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
471         * Makefile.in: Regenerate.
472         * testsuite/Makefile.in: Regenerate.
474 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
476         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
477         * gold/testsuite/debug_msg.cc: Likewise.
478         * gold/testsuite/odr_violation1.cc
479         * gold/testsuite/odr_violation2.cc
481 2010-07-21  Cary Coutant  <ccoutant@google.com>
483         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
484         string, and length fields.
485         (Output_merge_string::Merged_strings_list): New type.
486         (Output_merge_string::Merged_strings_lists): New typedef.
487         (Output_merge_string): Replace merged_strings_ with
488         merged_strings_lists_.
489         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
490         Merged_strings_list per input object and section.  Don't store pointer
491         to the string.  Don't store length with each merged string entry.
492         (Output_merge_string::finalize_merged_data): Loop over list of merged
493         strings lists.  Recompute length of each merged string.
495 2010-07-15  Cary Coutant  <ccoutant@google.com>
497         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
498         here.
500 2010-07-14  Ian Lance Taylor  <iant@google.com>
502         * descriptors.cc (Descriptors::open): Report correct name in error
503         message.
505 2010-07-13  Doug Kwan  <dougkwan@google.com>
507         * arm.cc (Arm_input_section::Arm_input_section): For a
508         SHT_ARM_EXIDX section, always keeps the input sections.
509         (Arm_input_section::set_exidx_section_link): New method.
510         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
511         has_errors_ to false.
512         (Arm_exidx_input_section::has_errors,
513         Arm_exidx_input_section::set_has_errors): New methods.
514         (Arm_exidx_input_section::has_errors_): New data member.
515         (Arm_relobj::get_exidx_shndx_list): New method.
516         (Arm_output_section::append_text_sections_to_list): Do not skip
517         section without SHF_EXECINSTR.
518         (Arm_output_section::fix_exidx_coverage): Skip input sections with
519         errors.
520         (Arm_relobj::make_exidx_input_section): Add new parameter for text
521         section header.  Make error messages more verbose.  Check for
522         a non-executable section linked to an EXIDX section.
523         (Arm_relobj::do_read_symbols): Remove error checking, which has been
524         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
525         check that there is no deferred EXIDX section if we exit early.
526         Instead of not making an EXIDX section in case of an error, make one
527         and set the has_errors flag of it.
528         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
529         in a relocatable link.
530         (Target_arm::do_relax): Look for the EXIDX output section instead of
531         assuming that it is called .ARM.exidx.
532         (Target_arm::fix_exidx_coverage): Add a new parameter for input
533         section list.  Do not check for SHF_EXECINSTR section flags but
534         skip any input section with errors.
535         * output.cc (Output_section::Output_section): Initialize
536         always_keeps_input_sections_ to false.
537         (Output_section::add_input_section): Check for
538         always_keeps_input_sections_.
539         *  output.h (Output_section::always_keeps_input_sections,
540         Output_section::set_always_keeps_input_sections): New methods.
541         (Output_section::always_keeps_input_sections): New data member.
543 2010-07-13  Rafael Espindola  <espindola@google.com>
545         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
546         * fileread.h (Input_file): Add try_extra_search_path and find_file.
548 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
549             Ian Lance Taylor  <iant@google.com>
551         * output.h (Output_section_lookup_maps::add_merge_section):
552         Correct check of whether value was inserted.
553         (Output_section_lookup_maps::add_merge_input_section): Likewise.
554         (Output_section_lookup_maps::add_relaxed_input_section):
555         Likewise.
556         * arm.cc (Target_arm::got_section): Remove used local os.
557         * i386.cc (Target_i386::got_section): Likewise.
558         * x86_64.cc (Target_x86_64::got_section): Likewise.
559         * sparc.cc (Target_sparc::got_section): Likewise.
560         (Target_sparc::relocate): Remove unused local have_got_offset.
561         * powerpc.cc (Target_powerpc::relocate): Likewise.
563 2010-07-13  Ian Lance Taylor  <iant@google.com>
565         * compressed_output.cc (zlib_decompress): Fix signature in
566         !HAVE_ZLIB_H case.
568         * archive.cc (Archive::include_member): Unlock an external member
569         of a thin archive.  Don't bother to delete an object we know is
570         NULL.
572 2010-07-12  Cary Coutant  <ccoutant@google.com>
574         * compressed_output.cc (zlib_decompress): New function.
575         (get_uncompressed_size): New function.
576         (decompress_input_section): New function.
577         * compressed_output.h (get_uncompressed_size): New function.
578         (decompress_input_section): New function.
579         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
580         Handle compressed debug sections.
581         * layout.cc (is_compressed_debug_section): New function.
582         (Layout::output_section_name): Map compressed section names to
583         canonical names.
584         * layout.h (is_compressed_debug_section): New function.
585         (is_debug_info_section): Recognize compressed debug sections.
586         * merge.cc: Include compressed_output.h.
587         (Output_merge_data::do_add_input_section): Handle compressed
588         debug sections.
589         (Output_merge_string::do_add_input_section): Handle compressed
590         debug sections.
591         * object.cc: Include compressed_output.h.
592         (Sized_relobj::Sized_relobj): Initialize new data members.
593         (build_compressed_section_map): New function.
594         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
595         * object.h (Object::section_is_compressed): New method.
596         (Object::do_section_is_compressed): New method.
597         (Sized_relobj::Compressed_section_map): New type.
598         (Sized_relobj::do_section_is_compressed): New method.
599         (Sized_relobj::compressed_sections_): New data member.
600         * output.cc (Output_section::add_input_section): Handle compressed
601         debug sections.
602         * reloc.cc: Include compressed_output.h.
603         (Sized_relobj::write_sections): Handle compressed debug sections.
605 2010-07-08  Cary Coutant  <ccoutant@google.com>
607         * resolve.cc (Symbol_table::resolve): Remember whether undef was
608         weak when resolving to a dynamic def.
609         (Symbol_table::should_override): Add adjust_dyndef flag; set it
610         for weak undef/dynamic def cases. Adjust callers.
611         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
612         undef_binding_weak_.
613         (Symbol_table::sized_write_globals): Adjust symbol binding.
614         (Symbol_table::sized_write_symbol): Add binding parameter.
615         * symtab.h (Symbol::set_undef_binding): New method.
616         (Symbol::is_undef_binding_weak): New method.
617         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
618         (Symbol_table::should_override): Add new parameter.
619         (Symbol_table::sized_write_symbol): Add new parameter.
621         * testsuite/weak_undef_file1.cc: Add new test case.
622         * testsuite/weak_undef_file2.cc: Fix header comment.
623         * testsuite/weak_undef_test.cc: Add new test case.
625 2010-06-29  Doug Kwan  <dougkwan@google.com>
627         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
628         Initialize USE_SYMBOL_.
629         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
630         definition.
631         (Arm_reloc_property::uses_symbol_): New data member declaration.
632         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
633         uses symbol value and symbol is undefined but not weakly undefined.
635 2010-06-28  Rafael Espindola  <espindola@google.com>
637         * plugin.cc (Plugin::load): Use dlerror.
639 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
641         * symtab.cc (detect_odr_violations): When reporting an ODR
642         violation, report an object where the symbol is defined.
644 2010-06-25  Doug Kwan  <dougkwan@google.com>
646         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
647         (Target_arm::section_may_have_icf_unsafe_pointers): New method
648         definition.
649         (Target_arm::Scan::local_reloc_may_be_function_pointer,
650         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
651         target hook to detect function points.
652         (Target_arm::Scan::possible_function_pointer_reloc): New method.
653         * icf.h (Icf::check_section_for_function_pointers): Change type of
654         parameter SECTION_NAME to const reference to std::string.  Use
655         target hook to determine if section may have unsafe pointers.
656         * target.h (Target::section_may_have_icf_unsafe_pointers): New
657         method definition.
659 2010-06-21  Rafael Espindola  <espindola@google.com>
661         * fileread.cc (Input_file::find_fie): New
662         (Input_file::open): Use Input_file::find_fie.
663         * fileread.h (Input_file::find_fie): New
664         * plugin.cc (set_extra_library_path): New.
665         (Plugin::load): Add set_extra_library_path to the transfer vector.
666         (Plugin_manager::set_extra_library_path): New.
667         (Plugin_manager::add_input_file): Use the extra search path if set.
668         (set_extra_library_path(): New.
669         * plugin.h (Plugin_manager): Add set_extra_library_path and
670         extra_search_path_.
672 2010-06-19  Cary Coutant  <ccoutant@google.com>
674         * layout.cc (gdb_sections): Add .debug_types.
675         (lines_only_debug_sections): Likewise.
677 2010-06-18  Rafael Espindola  <espindola@google.com>
679         * plugin.cc (add_input_file,add_input_library)
680         (Plugin_manager::add_input_file): Make filename arguments const.
681         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
682         const.
684 2010-06-16  Doug Kwan  <dougkwan@google.com>
686         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
687         .ARM.attributes section if we have not merged any input
688         attributes sections.
690 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
692         * arm.cc: Allow combining objects with no EABI version
693         information.
695 2010-06-15  Rafael Espindola  <espindola@google.com>
697         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
699 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
701         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
702         (struct iovec): Correct !HAVE_READV definition.
704 2010-06-10  Cary Coutant  <ccoutant@google.com>
706         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
707         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
708         reloc sections.
709         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
711         PR 11683
712         * symtab.h (Symbol::is_placeholder): New member function.
713         * target-reloc.h (relocate_section): Check for placeholder symbols.
715         * testsuite/Makefile.am (plugin_test_8): New test.
716         (plugin_test_9): New test.
717         * testsuite/Makefile.in: Regenerate.
719 2010-06-09  Nick Clifton  <nickc@redhat.com>
721         * yyscript.y (input_list_element): Allow strings prefixed with
722         the '-' character.  Treat these as libraries.
723         * script.cc (script_add_library): New function.  Adds a library
724         specified by "-l<name>" found in an input script.
725         * script-c.h: Add prototype for script_add_library.
727 2010-06-07  Doug Kwan  <dougkwan@google.com>
729         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
730         Restrict stub-group size to be within long conditional branch
731         range when working around cortex-A8 erratum.
733 2010-06-07  Damien Diederen  <dd@crosstwine.com>
735         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
736         #ifdef typo.
738 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
740         PR gold/11658
741         * output.cc
742         (Output_section::Input_section_sort_entry::compare_section_ordering):
743         Change to return non-zero correctly.
744         (Output_section::Input_section_sort_section_order_index_compare
745         ::operator()): Change to fix ambiguity in comparisons.
747 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
749         * gold.h (is_wildcard_string): New function.
750         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
751         (Layout::layout_eh_frame): Ditto.
752         (Layout::find_section_order_index): New method.
753         (Layout::read_layout_from_file): New method.
754         * layout.h (Layout::find_section_order_index): New method.
755         (Layout::read_layout_from_file): New method.
756         (Layout::input_section_position_): New private member.
757         (Layout::input_section_glob_): New private member.
758         * main.cc (main): Call read_layout_from_file here.
759         * options.h (--section-ordering-file): New option.
760         * output.cc (Output_section::input_section_order_specified_): New
761         member.
762         (Output_section::Output_section): Initialize new member.
763         (Output_section::add_input_section): Add new parameter.
764         Keep input sections when --section-ordering-file is used.
765         (Output_section::set_final_data_size): Sort input sections when
766         section ordering file is specified.
767         (Output_section::Input_section_sort_entry): Add new parameter.
768         Check sorting type.
769         (Output_section::Input_section_sort_entry::compare_section_ordering):
770         New method.
771         (Output_section::Input_section_sort_compare::operator()): Change to
772         consider section_order_index.
773         (Output_section::Input_section_sort_init_fini_compare::operator()):
774         Change to consider section_order_index.
775         (Output_section::Input_section_sort_section_order_index_compare
776         ::operator()): New method.
777         (Output_section::sort_attached_input_sections): Change to sort
778         according to section order when specified.
779         (Output_section::add_input_section<32, true>): Add new parameter.
780         (Output_section::add_input_section<64, true>): Add new parameter.
781         (Output_section::add_input_section<32, false>): Add new parameter.
782         (Output_section::add_input_section<64, false>): Add new parameter.
783         * output.h (Output_section::add_input_section): Add new parameter.
784         (Output_section::input_section_order_specified): New
785         method.
786         (Output_section::set_input_section_order_specified): New method.
787         (Input_section::Input_section): Initialize section_order_index_.
788         (Input_section::section_order_index): New method.
789         (Input_section::set_section_order_index): New method.
790         (Input_section::section_order_index_): New member.
791         (Input_section::Input_section_sort_section_order_index_compare): New
792         struct.
793         (Output_section::input_section_order_specified_): New member.
794         * script-sections.cc (is_wildcard_string): Delete and move modified
795         method to gold.h.
796         (Output_section_element_input::Output_section_element_input): Modify
797         call to is_wildcard_string.
798         (Output_section_element_input::Input_section_pattern
799         ::Input_section_pattern): Ditto.
800         (Output_section_element_input::Output_section_element_input): Ditto.
801         * testsuite/Makefile.am (final_layout): New test case.
802         * testsuite/Makefile.in: Regenerate.
803         * testsuite/final_layout.cc: New file.
804         * testsuite/final_layout.sh: New file.
806 2010-06-01  Rafael Espindola  <espindola@google.com>
808         * plugin.cc (Plugin::load): Pass the output name to the plugin.
810 2010-06-01  Rafael Espindola  <espindola@google.com>
812         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
813         visibility of symbols.
815 2010-05-27  Doug Kwan  <dougkwan@google.com>
817         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
818         from start of output section instead of address for a local symbol
819         in a merged or relaxed section when doing a relocatable link.
821 2010-05-26  Rafael Espindola  <espindola@google.com>
823        PR 11604
824         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
825         adding sections the garbage collector removed.
826         * gold/testsuite/Makefile.am: Add test.
827         * gold/testsuite/Makefile.in: Regenerate.
828         * gold/testsuite/plugin_test_7.sh: New.
829         * gold/testsuite/plugin_test_7_1.c: New.
830         * gold/testsuite/plugin_test_7_2.c: New.
832 2010-05-26  Rafael Espindola  <espindola@google.com>
834         * script-sections.cc (Output_section_definition::set_section_addresses):
835         Check for --section-start.
837 2010-05-26  Doug Kwan  <dougkwan@google.com>
839         * arm.cc (Arm_scan_relocatable_relocs): New class.
840         (Target_arm::relocate_special_relocatable): New method.
841         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
842         (Arm_relocate_functions::thumb_branch_common): Same.
843         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
844         instead of Default_scan_relocatable_relocs.
845         * target-reloc.h (relocate_for_relocatable): Let target handle
846         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
847         * target.h (Sized_target::relocate_special_relocatable): New method.
849 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
851         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
853 2010-05-23  Doug Kwan  <dougkwan@google.com>
855         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
856         instead of a cast.
857         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
858         with a direct branch, not a conditional branch, to a stub.
859         * merge.cc (Output_merge_base::record_input_section): New method
860         defintion.
861         (Output_merge_data::do_add_input_section): Record input section if
862         keeps-input-sections flag is set.
863         (Output_merge_string::do_add_input_section): Ditto.
864         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
865         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
866         INPUT_SECTIONS_.
867         (Output_merge_base::keeps_input_sections,
868         Output_merge_base::set_keeps_input_sections,
869         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
870         method definitions.
871         (Output_merge_base::Input_sections): New type declaration.
872         (Output_merge_base::input_sections_begin,
873         Output_merge_base::input_sections_end,
874         Output_merge_base::do_set_keeps_input_sections): New method definitions.
875         (Output_merge_base::bool keeps_input_sections_,
876         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
877         Output_merge_base::input_sections_): New data members.
878         (Output_merge_data::do_set_keeps_input_sections): New method
879         defintion.
880         (Output_merge_string::do_set_keeps_input_sections): Ditto.
881         * output.cc (Output_section::Input_section::relobj): Move method
882         defintion from class declaration to here and handle merge sections.
883         (Output_section::Input_section::shndx): Ditto.
884         (Output_section::Output_section): Remove initializations of removed
885         data members and initialize new data member LOOKUP_MAPS_.
886         (Output_section::add_input_section): Set keeps-input-sections flag
887         for a newly created merge output section as appropriate.  Adjust code
888         to use Output_section_lookup_maps class.
889         (Output_section::add_relaxed_input_section): Adjst code for lookup
890         maps code refactoring.
891         (Output_section::add_merge_input_section): Add a new parameter
892         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
893         class.  If adding input section to a newly created merge output
894         section fails, remove the new merge section.
895         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
896         Adjust code for use of the Output_section_lookup_maps class.
897         (Output_section::find_merge_section): Ditto.
898         (Output_section::build_lookup_maps): New method defintion.
899         (Output_section::find_relaxed_input_section): Adjust code to use
900         Output_section_lookup_maps class.
901         (Output_section::get_input_sections): Export merge sections.  Adjust
902         code to use Output_section_lookup_maps class.
903         (Output_section:::add_script_input_section): Adjust code to use
904         Output_section_lookup_maps class.  Update lookup maps for merge
905         sections also.
906         (Output_section::discard_states): Use Output_section_lookup_maps.
907         (Output_section::restore_states): Same.
908         * output.h (Merge_section_properties): Move class defintion out of
909         Output_section.
910         (Output_section_lookup_maps): New class.
911         (Output_section::Input_section::is_merge_section): New method
912         defintion.
913         (Output_section::Input_section::relobj): Move defintion out of class
914         defintion.  Declare method only.
915         (Output_section::Input_section::shndx): Ditto.
916         (Output_section::Input_section::output_merge_base): New method defintion.
917         (Output_section::Input_section::u2_.pomb): New union field.
918         (Output_section::Merge_section_by_properties_map,
919         Output_section::Output_section_data_by_input_section_map,
920         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
921         Remove types.
922         (Output_section::add_merge_input_section): Add new parameter
923         KEEPS_INPUT_SECTIONS.
924         (Output_section::build_lookup_maps): New method declaration.
925         (Output_section::merge_section_map_,
926         Output_section::merge_section_by_properties_map_,
927         Output_section::relaxed_input_section_map_,
928         Output_section::is_relaxed_input_section_map_valid_): Remove data
929         members.
930         (Output_section::lookup_maps_): New data member.
932 2010-05-21  Doug Kwan  <dougkwan@google.com>
934         PR gold/11619
935         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
936         avoid a compilation error.
938 2010-05-19  Rafael Espindola  <espindola@google.com>
940         * script-sections.cc (Output_section_definition::allocate_to_segment):
941         Update the phdrs_list even when the output section is NULL.
942         * testsuite/Makefile.am: Add test.
943         * testsuite/Makefile.in: Regenerate.
944         * testsuite/script_test_9.cc: New.
945         * testsuite/script_test_9.sh: New.
946         * testsuite/script_test_9.t: New.
948 2010-05-19  Doug Kwan  <dougkwan@google.com>
950         * arm.cc (Arm_input_section::original_size): New method.
951         (Arm_input_section::do_addralign): Add a cast.
952         (Arm_input_section::do_output_offset): Remove static cast.
953         (Arm_input_section::original_addralign,
954          Arm_input_section::original_size_): Change type to uint32_t.
955         (Arm_input_section::init): Add safe casts for section alignment
956         and size.
957         (Arm_input_section::set_final_data_size): Do not set address and
958         offset of stub table.
959         (Arm_output_section::fix_exidx_coverage): Change use of of
960         Output_section::Simple_input_section to that of
961         Output_section::Input_section.
962         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
963         except for the first pass.
964         * output.cc (Output_section::get_input_sections): Change type of
965         input_sections to std::list<Input_section>.
966         (Output_section::add_script_input_section): Rename from
967         Output_section::add_simple_input_section.  Change type of SIS
968         parameter from Simple_input_section to Input_section.
969         * output.h (Output_section::Simple_input_section): Remove class.
970         (Output_section::Input_section): Change class visibility to public.
971         (Output_section::Input_section::addralign): Use stored alignments
972         for special input sections if set.
973         (Output_section::Input_section::set_addralign): New method.
974         (Output_section::get_input_sections): Change parameter type from
975         list of Simple_input_section to list of Input_section.
976         (Output_section::add_script_input_section): Rename from
977         Output_section::add_simple_input_section. Change first parameter's
978         type from Simple_input_section to Input_section and remove the
979         second and third parameters.
980         * script-sections.cc (Input_section::Input_section_list): Change
981         type to list of Output_section::Input_section/
982         (Input_section_info::Input_section_info): Change parameter type of
983         INPUT_SECTION to Output_section::Input_section.
984         (Input_section_info::input_section): Change return type.
985         (Input_section_info::input_section_): Change type to
986         Output_section::Input_section.
987         (Output_section_element_input::set_section_addresses): Adjust code
988         to use Output_section::Input_section instead of
989         Output_section::Simple_input_section.  Adjust code for renaming
990         of Output_section::add_simple_input_section.
991         (Orphan_output_section::set_section_addresses): Ditto.
993 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
995         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
996         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
998 2010-05-18  Rafael Espindola  <espindola@google.com>
1000         * options.cc (General_options::finalize): Handle -nostdlib.
1001         * options.h (nostdlib): New option.
1002         * script.cc (script_add_search_dir): Handle -nostdlib.
1004 2010-05-12  Doug Kwan  <dougkwan@google.com>
1006         * arm.cc (Target_arm::do_finalize_sections): Create an empty
1007         attributes section only if there no attributes section after merging.
1008         (Target_arm::merge_object_attributes): Move value of
1009         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
1010         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
1011         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
1012         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
1013         and arm_attr_merge_7.stdout.
1014         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
1015         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
1016         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
1017         arm_attr_merge_7b.o): New rules.
1018         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
1019         arm_attr_merge_7
1020         * testsuite/Makefile.in: Regenerate.
1021         * testsuite/arm_attr_merge.sh: New file.
1022         * testsuite/arm_attr_merge_[67][ab].s: Same.
1024 2010-05-05  Nick Clifton  <nickc@redhat.com>
1026         * po/es.po: Updated Spanish translation.
1028 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1030         * Makefile.am (install-exec-local): Properly install gold as
1031         default cross linker.
1032         * Makefile.in: Regenerated.
1034 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1035             Nick Clifton  <nickc@redhat.com>
1037         * configure.ac (install_as_default): Define and set to false
1038         unless --enable-gold or --enable-gold=both/gold has been
1039         specified.
1040         * configure: Regenerate.
1042         * Makefile.am (install-exec-local): Install the executable as
1043         'ld.gold'.  If install_as_default is true then also install it as
1044         'ld'.
1045         * Makefile.in: Regenerated.
1047 2010-04-24  Ian Lance Taylor  <iant@google.com>
1049         * layout.cc (Layout::layout_reloc): In relocatable link don't
1050         combine reloc sections for grouped sections.
1052 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
1054         * gc.h (gc_process_relocs): Pass information on relocs pointing to
1055         sections that are not ordinary to icf.
1056         * icf.cc (get_section_contents): Handle relocation pointing to section
1057         with no object or shndx information.
1058         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
1059         * testsuite/Makefile.in: Regenerate.
1060         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
1061         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
1063 2010-04-22  Ian Lance Taylor  <iant@google.com>
1065         * expression.cc (Expression::Expression_eval_info): Add
1066         result_alignment_pointer field.
1067         (Expression::eval_with_dot): Add result_alignment_pointer
1068         parameter.  Change all callers.
1069         (Expression::eval_maybe_dot): Likewise.
1070         (class Binary_expression): Add alignment_pointer parameter to
1071         left_value and right_value.  Change all callers.
1072         (BINARY_EXPRESSION): Set result alignment.
1073         (class Trinary_expression): Add alignment_pointer parameter to
1074         arg2_value and arg3_value.  Change all callers.
1075         (Trinary_cond::value): Set result alignment.
1076         (Max_expression::value, Min_expression::value): Likewise.
1077         (Align_expression::value): Likewise.
1078         * script-sections.cc (class Sections_element): Add dot_alignment
1079         parameter to set_section_addresses virtual function.  Update
1080         instantiations.
1081         (class Output_section_element): Likewise.
1082         (Script_sections::create_segments): Add dot_alignment parameter.
1083         Change all callers.
1084         (Script_sections::create_segments_from_phdrs_clause): Likewise.
1085         (Script_sections::set_phdrs_clause_addresses): Likewise.
1086         * script-sections.h: Update declarations.
1087         * script.h: Update declarations.
1088         * output.h (Output_segment::set_minimum_p_align): Don't decrease
1089         min_p_align.
1090         * testsuite/script_test_3.t: Set large alignment.
1091         * testsuite/script_test_3.sh: Make sure that at least one LOAD
1092         segment has expected alignment.
1094 2010-04-22  Nick Clifton  <nickc@redhat.com>
1096         * po/gold.pot: Updated by the Translation project.
1097         * po/vi.po: Updated Vietnamese translation.
1099 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
1101         * testsuite/Makefile.am (check_PROGRAMS): Add
1102         icf_virtual_function_folding_test.
1103         * testsuite/Makefile.in: Regenerated.
1105 2010-04-15  Andrew Haley  <aph@redhat.com>
1107         * options.h (merge_exidx_entries): New option.
1108         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
1109         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
1110         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
1111         (Target_arm::merge_exidx_entries): New function.
1112         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
1113         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
1114         to Arm_exidx_fixup constructor.
1115         Add new arg, merge_exidx_entries.
1116         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
1117         Arm_output_section::fix_exidx_coverage.
1119 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
1121         * icf.cc (get_section_contents): Check for preemptible functions.
1122         Ignore addend when appropriate.
1123         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
1124         section folded.
1125         (add_from_relobj): Check for section folded.
1126         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
1127         * symtab.h (should_add_dynsym_entry): Add new parameter.
1128         * target-reloc.h (scan_relocs): Check for section folded.
1129         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
1130         Check reloc types for function pointers in shared objects.
1131         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
1132         case.
1133         (icf_preemptible_functions_test): New test case.
1134         (icf_string_merge_test): New test case.
1135         * testsuite.Makefile.in: Regenerate.
1136         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
1137         bar_glob.  Refactor code.
1138         * testsuite/icf_preemptible_functions_test.cc: New file.
1139         * testsuite/icf_preemptible_functions_test.sh: New file.
1140         * testsuite/icf_string_merge_test.cc: New file.
1141         * testsuite/icf_string_merge_test.sh: New file.
1142         * testsuite/icf_virtual_function_folding_test.cc: New file.
1143         * testsuite/icf_virtual_function_folding_test.sh: New file.
1145 2010-04-14  Doug Kwan  <dougkwan@google.com>
1147         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
1148         for local symbol recounting if we remove a section due to ICF.
1149         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
1150         there are no regular objects in input.
1152 2010-04-13  Doug Kwan  <dougkwan@google.com>
1154         * arm.cc (Arm_input_section::set_final_data_size): Compute
1155         accurate final data size instead of using current data size.
1157 2010-04-09  Doug Kwan  <dougkwan@google.com>
1159         * layout.cc (Layout::choose_output_section): Handle script section
1160         types.
1161         (Layout::make_output_section_for_script): Add section type parameter.
1162         Handle script section types.
1163         * layout.h (Layout::make_output_section_for_script): Add section
1164         type parameter.
1165         * output.cc (Output_section::Output_section): Initialize data member
1166         is_noload_.
1167         (Output_section::do_reset_address_and_file_offset): Do not set address
1168         to 0 if section is a NOLOAD section.
1169         * output.h (Output_section::is_noload): New method.
1170         (Output_section::set_is_noload): Ditto.
1171         (Output_section::is_noload_): New data member.
1172         * script-c.h (Script_section_type): New enum type.
1173         (struct Parser_output_section_header): Add new file section_type.
1174         * script-sections.cc (Sections_element::output_section_name): Add
1175         parameter for returning script section type.
1176         (Output_section_definition::output_section_name): Ditto.
1177         (Output_section_definition::section_type)P; New method.
1178         (Output_section_definiton::script_section_type_name): Ditto.
1179         (Output_section_definition::script_section_type_): New data member.
1180         (Output_section_definition::Output_section_definition): Initialize
1181         data member Output_section_definition::script_section_type_.
1182         (Output_section_definition::create_sections): Pass script section type
1183         to Layout::make_output_section_for_script.
1184         (Output_section_definition::output_section_name): Return script
1185         section type to caller.
1186         (Output_section_definition::set_section_address): Do not advance
1187         dot value and load address if section type is NOLOAD.  Set address
1188         of NOLOAD sections regardless of section flags.
1189         (Output_section_definition::print): Print section type if it is
1190         not SCRIPT_SECTION_TYPE_NONE.
1191         (Output_section_definition::section_type): New method.
1192         (Output_section_definition::script_section_type_name): Ditto.
1193         (Script_sections::output_section_name): Add new parameter
1194         PSECTION_TYPE for returning script section type.  Pass it to
1195         section elements.  Handle discard sections.
1196         (Sort_output_sections::operator()): Handle NOLOAD sections.
1197         * script-sections.h (Script_sections::Section_type): New enum type.
1198         (Script_sections::output_section_name): Add a new parameter for
1199         returning script section type.
1200         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
1201         INFO and NOLOAD.
1202         * yyscript.y (union): Add new field SECTION_TYPE.
1203         (COPY, DSECT, INFO, NOLOAD): New tokens.
1204         (opt_address_and_section_type): Change type to output_section_header.
1205         (section_type): New non-terminal
1206         (section_header): Handle section type.
1207         (opt_address_and_section_type): Return section type value.
1209 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
1211         * testsuite/plugin_common_test_1.c (foo): Add prototype.
1212         * testsuite/plugin_common_test_2.c (foo): Likewise.
1214 2010-04-08  Doug Kwan  <dougkwan@google.com>
1216         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
1217         Output_merge_data.
1218         * output.cc (Output_section::add_merge_input_section): Simplify
1219         code and return status of Output_merge_base::add_input_section.
1220         Update merge section map only if Output_merge_base::add_input_section
1221         returns true.
1223 2010-04-07  Doug Kwan  <dougkwan@google.com>
1225         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
1226         if section is marked as containing instructions but has no mapping
1227         symbols.
1228         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
1229         correct section index.
1230         (Arm_relobj::find_linked_text_section): Ditto.
1232 2010-04-07  Cary Coutant  <ccoutant@google.com>
1234         * archive.cc (include_member): Destroy Read_symbols_data object before
1235         releasing file.
1236         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
1237         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
1238         (Read_symbols_data::~Read_symbols_data) New destructor.
1239         (Section_relocs::Section_relocs) New constructor.
1240         (Section_relocs::~Section_relocs) New destructor.
1241         (Read_relocs_data::Read_relocs_data) New constructor.
1242         (Read_relocs_data::~Read_relocs_data) New destructor.
1243         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
1244         pointers to NULL after deleting.
1246 2010-04-07  Doug Kwan  <dougkwan@google.com>
1248         * arm.cc: Replace "endianity" with "endianness" in comments.
1249         (Arm_exidx_cantunwind): Ditto.
1250         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
1251         (Arm_relobj::merge_flags_and_attributes): New method.
1252         (Arm_relobj::merge_flags_and_attributes_): New data member.
1253         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
1254         (Arm_relobj::scan_sections_for_stubs): Ditto.
1255         (Arm_relobj::do_read_symbols): Check to see if we really want to
1256         merge processor-specific flags and attributes.  Exit early if
1257         an object is empty except for section names and the undefined symbol.
1258         (Target_arm::do_finalize_sections): Move check for ELF format to
1259         Arm_relobj::do_read_symbols.  Merge processor specific flags and
1260         attributes from a regular object only when we have determined that
1261         it is aapropriate.  Do not create an .ARM.attributes section in
1262         output if there is no regular input object.
1263         (Target_arm::merge_processor_specific_flags): Check
1264         --warn-mismatch before printing any error.
1265         (Target_arm::merge_object_attributes): Ditto.
1266         * gold.cc (queue_middle_tasks): Handle the case in which there is
1267         no regular object in input.
1268         * options.cc (General_options::parse_EB): New method.
1269         (General_options::parse_EL): Same.
1270         (General_options::General_options): Initialize endianness_.
1271         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
1272         New options.
1273         (General_options::Endianness): New enum.
1274         (General_options::endianness): New method.
1275         (General_options::endianness_): New data member.
1276         * parameters.cc (Parameters::set_options): Check target endianness.
1277         (Parameters::set_target_once): Ditto.
1278         (Parameters::check_target_endianness): New method.
1279         (parameters_force_valid_target): If either -EL or -EB is specified,
1280         use it to define endianness of default target.
1281         * parameters.h (Parameters::check_target_endianness): New method
1282         declaration.
1283         * target.h (class Target): Change "endianity" to "endianness"
1284         in comments.
1286 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1288         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
1289         * configure: Regenerate.
1290         * Makefile.in: Regenerate.
1291         * testsuite/Makefile.in: Regenerate.
1293 2010-04-06  Cary Coutant  <ccoutant@google.com>
1295         gcc PR lto/42757
1296         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
1297         prevailing definitions of common symbols.
1298         * testsuite/plugin_test_6.sh: New test case.
1299         * testsuite/plugin_common_test_1.c: New test case.
1300         * testsuite/plugin_common_test_2.c: New test case.
1301         * testsuite/Makefile.am (plugin_test_6): New test case.
1302         * testsuite/Makefile.in: Regenerate.
1304 2010-04-06  Nick Clifton  <nickc@redhat.com>
1306         * po/vi.po: New Vietnamese translation.
1308 2010-03-30  Doug Kwan  <dougkwan@google.com>
1310         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
1312 2010-03-25  Doug Kwan  <dougkwan@google.com>
1314         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
1315         to avoid a conversion warning on a 32-bit host.
1317 2010-03-24  Ian Lance Taylor  <iant@google.com>
1319         * testsuite/script_test_3.t: Add a TLS segment.
1320         * testsuite/Makefile.am (check_PROGRAMS): Add
1321         tls_phdrs_script_test.
1322         (tls_phdrs_script_test_SOURCES): Define.
1323         (tls_phdrs_script_test_DEPENDENCIES): Define.
1324         (tls_phdrs_script_test_LDFLAGS): Define.
1325         (tls_phdrs_script_test_LDADD): Define.
1326         * testsuite/Makefile.in: Rebuild.
1328 2010-03-23  Cary Coutant  <ccoutant@google.com>
1330         * fileread.cc (find_or_make_view): Fix comment.
1332 2010-03-23  Ian Lance Taylor  <iant@google.com>
1334         * script-sections.cc (class Orphan_section_placement): Define
1335         PLACE_TLS and PLACE_TLS_BSS.
1336         (Orphan_section_placement::Orphan_section_placement): Initialize
1337         new places.
1338         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
1339         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
1340         (tls_script_test_SOURCES): Define.
1341         (tls_script_test_DEPENDENCIES): Define.
1342         (tls_script_test_LDFLAGS): Define.
1343         (tls_script_test_LDADD): Define.
1344         * testsuite/Makefile.in: Rebuild.
1346 2010-03-22  Doug Kwan  <dougkwan@google.com>
1348         * arm.cc (Arm_relocate_functions::abs8,
1349         Arm_relocate_functions::abs16): Use correct check for overflow
1350         specified in the ARM ELF specs.
1351         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
1352         target of a BLX instruction specially.
1353         (Reloc_stub::stub_type_for_reloc): Ditto.
1354         (Relocate::relocate): Use symbolic names instead of numeric relocation
1355         codes to report error.
1356         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
1357         workaround.
1358         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
1359         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
1360         thumb2_blx_out_of_range.stdout
1361         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
1362         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
1363         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
1364         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
1365         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
1366         thumb2_blx_in_range, thumb2_blx_in_range.o,
1367         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
1368         thumb2_blx_out_of_range.o): New rules.
1369         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
1370         thumb2_blx_in_range and thumb2_blx_out_of_range.
1371         * testsuite/Makefile.in: Regenerate.
1372         * arm_branch_in_range.sh: Add tests for THUMB BLX.
1373         * testsuite/thumb_blx_in_range.s: New file.
1374         * testsuite/thumb_blx_out_of_range.s: New file.
1376 2010-03-22  Rafael Espindola  <espindola@google.com>
1378         * archive.cc (Should_include): Move to archive.h.
1379         (should_include_member): Make it a member of Archive.
1380         (Lib_group): New.
1381         (Add_lib_group_symbols): New.
1382         * archive.h: Include options.h.
1383         (Archive_member): Moved from Archive.
1384         (Should_include): Moved from archive.cc.
1385         (Lib_group): New.
1386         (Add_lib_group_symbols): New.
1387         * dynobj.cc (do_should_include_member): New.
1388         * dynobj.h (do_should_include_member): New.
1389         * gold.cc (queue_initial_tasks): Update call to queue.
1390         * main.cc (main): Print lib group stats.
1391         * object.cc (do_should_include_member): New.
1392         * object.h: Include archive.h.
1393         (Object::should_include_member): New.
1394         (Object::do_should_include_member): New.
1395         (Sized_relobj::do_should_include_member): New.
1396         * options.cc (General_options::parse_start_lib): New.
1397         (General_options::parse_end_lib): New.
1398         (Input_arguments::add_file): Handle lib groups.
1399         (Input_arguments::start_group): Check we are not in a lib.
1400         (Input_arguments::start_lib): New.
1401         (Input_arguments::end_lib): New.
1402         * options.h (General_options): Add start_lib and end_lib.
1403         (Input_argument::lib_): New.
1404         (Input_argument::lib): New.
1405         (Input_argument::is_lib): New.
1406         (Input_file_lib): New.
1407         (Input_arguments::in_lib_): New.
1408         (Input_arguments::in_lib): New.
1409         (Input_arguments::start_lib): New.
1410         (Input_arguments::end_lib_): New.
1411         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
1412         in unused members as preempted.
1413         (Sized_pluginobj::do_should_include_member): New.
1414         * plugin.h (Sized_pluginobj::do_should_include_member): New.
1415         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
1416         return the blocker.
1417         (Read_symbols::do_whole_lib_group): New.
1418         (Read_symbols::do_lib_group): New.
1419         (Read_symbols::do_read_symbols): Handle lib groups.
1420         (Read_symbols::get_name): Handle lib groups.
1421         * readsyms.h (Read_symbols): Add an archive member pointer.
1422         (Read_symbols::do_whole_lib_group): New.
1423         (Read_symbols::do_lib_group): New.
1424         (Read_symbols::member_): New.
1425         * script.cc (read_input_script): Update call to queue_soon.
1427 2010-03-19  Doug Kwan  <dougkwan@google.com>
1429         * arm.cc (Stub_table::Stub_table): Initialize new data members
1430         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1431         (Stub_table::add_reloc_stub): Assign stub offset and update
1432         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1433         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
1434         New data members.
1435         (Stub_table::update_data_size_and_addralign): Use
1436         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
1437         instead of going over all reloc stubs.
1438         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
1439         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1440         Stringpool_template::offset_ to size of Stringpool_char.
1441         (Stringpool_template::new_key_offset): Remove code to initialize
1442         Stringpool_template::offset_.
1443         * stringpool.h (Stringpool_template::set_no_zero_null): Set
1444         Stringpool_template::offset_ to zero.
1446 2010-03-15  Doug Kwan  <dougkwan@google.com>
1448         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1449         offset_.
1450         (Stringpool_template::new_key_offset): New method.
1451         (Stringpool_template::add_string): Assign offsets when adding new
1452         strings.
1453         (Stringpool_template::set_string_offsets): Do not set string offsets
1454         when not optimizing.
1455         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
1456         member size_.
1457         (Chunked_vector::clear): Clear size_.
1458         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
1459         (Chunked_vector::size): Return size_.
1460         (Chunked_vector::push_back): Use size_ to find insert position.
1461         (Chunked_vector::size_): New data member.
1462         (Stringpool_template::set_no_zero_null): Assert string set is empty.
1463         (Stringpool_template::new_key_offset): New method declaration.
1464         (Stringpool_template::offset_): New data member.
1466 2010-03-15   Rafael Espindola  <espindola@google.com>
1468         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
1469         Add_symbols' constructor.
1470         * readsyms.h (Add_symbols): Remove the input_group member.
1472 2010-03-10  Ian Lance Taylor  <iant@google.com>
1474         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
1475         target to ask whether a reference to a symbol requires a stack
1476         split.
1477         * target.h (Target::is_call_to_non_split): New function.
1478         (Target::do_is_call_to_non_split): Declare virtual function.
1479         * target.cc: Include "symtab.h".
1480         (Target::do_is_call_to_non_split): New function.
1481         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
1483 2010-03-10  Cary Coutant  <ccoutant@google.com>
1485         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
1486         (File_read::open[1]): Remove initial mapping of whole_file_view_.
1487         (File_read::open[2]): Add whole_file_view_ to list of views.
1488         (File_read::make_view): Remove test of whole_file_view_.
1489         (File_read::find_or_make_view): Create whole_file_view_ if
1490         necessary.
1491         (File_read::clear_views): Replace bool parameter with enum;
1492         adjust all callers.  Don't delete views with permanent data;
1493         do delete cached views and views from archives if
1494         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
1495         if clearing the corresponding view.
1496         * fileread.h (File_read::Clear_views_mode): New enum.
1497         (File_read::View::is_permanent_view): New method.
1498         (File_read::clear_views): Replace bool parameter
1499         with enum; adjust all callers.
1500         * options.h (General_options): Change keep_files_mapped option;
1501         add map_whole_files.
1502         * readsyms.cc (Add_symbols::run): Delete sd_ object before
1503         releasing the file.
1504         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
1505         the file.
1507 2010-03-10  David S. Miller  <davem@davemloft.net>
1509         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
1511 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
1513         * icf.cc (get_section_contents): Add '@' marker after processing the
1514         merge reloc.
1516 2010-03-08  Doug Kwan  <dougkwan@google.com>
1518         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
1519         due to a conversion warning.
1520         (Arm_relobj::update_output_local_symbol_count): Check for local
1521         symbol with unset output index.
1523 2010-03-05  Ian Lance Taylor  <iant@google.com>
1525         * options.h (class General_options): Add --spare-dynamic-tags.
1526         * output.cc (Output_data_dynamic::set_final_data_size): Implement
1527         --spare-dynamic-tags.
1529 2010-03-05  Ian Lance Taylor  <iant@google.com>
1531         * incremental.cc: Include "libiberty.h".
1533 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
1535         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
1536         function, is_info_ member.
1537         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
1538         (Versions::Versions): Update caller.
1539         (Versions::define_base_version): Likewise.
1540         (Versions::add_def): Likewise.
1542 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
1544         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
1545         (Scan::possible_function_pointer_reloc): New function.
1546         (Scan::local_reloc_may_be_function_pointer): Change to call
1547         possible_function_pointer_reloc.
1548         (Scan::global_reloc_may_be_function_pointer): Ditto.
1549         * icf.h (Icf::check_section_for_function_pointers): Change to reject
1550         relocations in ".data.rel.ro._ZTV" section.
1551         * testsuite/icf_safe_so_test.sh: Change to pass i386.
1552         * testsuite/icf_safe_so_test.cc: Ditto.
1553         * testsuite/icf_safe_test.cc: Ditto.
1554         * testsuite/icf_safe_test.sh: Ditto.
1556 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1557             Ian Lance Taylor  <iant@google.com>
1559         * target-reloc.h (relocate_section): Check the symbol table index
1560         for -1U before setting the local symbol index.
1561         (scan_relocatable_relocs): If copying the relocation, record that
1562         the local symbol is required.
1563         * object.h (Symbol_value::is_output_symtab_index_set): New
1564         function.
1565         (Symbol_value::may_be_discarded_from_output_symtab): New
1566         function.
1567         (Symbol_value::has_output_symtab_entry): New function.
1568         (Symbol_value::needs_output_symtab_entry): Remove.
1569         (Symbol_value::output_symtab_index): Make sure the symbol index is
1570         set.
1571         (Symbol_value::set_output_symtab_index): Make sure the symbol
1572         index is not set.  Make sure the new index is valid.
1573         (Symbol_value::set_must_have_output_symtab_entry): New function.
1574         (Symbol_value::has_output_dynsym_entry): New function.
1575         (Symbol_value::set_output_dynsym_index): Make sure the new index
1576         is valid.
1577         (Sized_relobj::set_must_have_output_symtab_entry): New function.
1578         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
1579         local symbol if permitted.
1580         (Sized_relobj::do_finalize_local_symbols): Call
1581         is_output_symtab_index_set rather than needs_output_symtab_entry.
1582         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
1583         rather than needs_output_symtab_entry.  Call
1584         has_output_dynsym_entry rather than needs_output_dynsym_entry.
1585         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
1586         is_output_symtab_index_set rather than needs_output_symtab_entry.
1587         * testsuite/discard_locals_relocatable_test.c: New file.
1588         * testsuite/discard_locals_test.sh: Test -r.
1589         * testsuite/Makefile.am (check_DATA): Add
1590         discard_locals_relocatable_test1.syms,
1591         discard_local_relocatable_test2.syms.
1592         (MOSTLYCLEANFILES): Likewise.  Also add
1593         discard_locals_relocatable_test1.lout and
1594         discard_locals_relocatable_test2.out.
1595         (discard_locals_relocatable_test1.syms): New target.
1596         (discard_locals_relocatable_test.o): New target.
1597         (discard_locals_relocatable_test1.out): New target.
1598         (discard_locals_relocatable_test2.syms): New target.
1599         (discard_locals_relocatable_test2.out): New target.
1600         (various): Add missing ../ld-new dependencies.
1601         * testsuite/Makefile.in: Rebuild.
1603 2010-03-03  Nick Clifton  <nickc@redhat.com>
1605         * po/fi.po: New Finnish translation.
1607 2010-03-01  Doug Kwan  <dougkwan@google.com>
1609         * layout.cc (Layout::Layout): Force section types of .init_array*,
1610         .preinit_array* and .fini_array* sections.
1611         * output.cc (Output_section::Input_section_sort_entry::has_priority):
1612         Fix check of return value of std::string::find.().
1613         (Output_section::Input_section_sort_compare::operator()): Remove
1614         comment about .init_array.
1615         (Output_section::Input_section_sort_init_fini_compare::operator()):
1616         New method.
1617         (Output_section::sort_attached_input_sections): Handle .init_array
1618         and .fini_array specially.
1619         * output.h (Output_section::Inut_section_sort_compare): Update
1620         comment.
1621         (Output_section::Input_section_sort_init_fini_compare): New struct.
1623 2010-02-26  Doug Kwan  <dougkwan@google.com>
1625         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
1626         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
1627         * testsuite/debug_msg.sh: Avoid matching source line number for
1628         use of global variable undef_int.
1630 2010-02-26  Doug Kwan  <dougkwan@google.com>
1632         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
1633         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
1634         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
1635         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
1636         * options.cc (General_options::General_options): Initialize member
1637         fix_v4bx_.
1638         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
1639         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
1640         and rm_no_fix_v4bx.stdout
1641         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
1642         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
1643         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
1644         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
1645         and arm_no_fix_v4bx.
1646         * Makefile.in: Regenerate.
1647         * testsuite/arm_fix_v4bx.s: New file.
1648         * testsuite/arm_fix_v4bx.sh: Ditto.
1650 2010-02-24  Doug Kwan  <dougkwan@google.com>
1652         * arm.cc (Target_arm::got_section): Make the .got section the first
1653         non RELRO section in the data segment.
1654         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
1655         suffixes of section names.
1657 2010-02-24  Doug Kwan  <dougkwan@google.com>
1659         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
1660         flags and attributes merging if an input file is a binary file.
1661         * fileread.cc (Input_file::open): Record format of original file.
1662         * fileread.h (Input_file::Format): New enum type.
1663         (Input_file::Input_file): Initialize data member format_.
1664         (Input_file::format): New method definition.
1665         (Input_file::format_):: New data member.
1667 2010-02-24  Doug Kwan  <dougkwan@google.com>
1669         * arm.cc (Arm_output_data_got): New class.
1670         (ARM_TCB_SIZE): New constant
1671         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
1672         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
1673         If user uses a script with a SECTIONS clause, issue only a warning
1674         for a misplaced EXIDX input section.  Otherwise, issue an error.
1675         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
1676         garbage collection.
1677         (Target_arm::got_mode_index_entry): Handle static linking.
1678         (Target_arm::Scan::local): Ditto.
1679         (Target_arm::Scan::global): Ditto.
1680         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
1681         all incorrectly implemented relocations.
1682         (Target_arm::fix_exidx_coverage): Pass layout to
1683         Arm_output_section::fix_exidx_coverage.
1684         * layout.cc (Layout::section_name_mapping): Remove trailing dots
1685         from ".ARM.exidx." and ".ARM.extab.".
1687 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1689         * arm.cc (Target_arm::do_finalize_sections): Create attribute
1690         section if it does not already exist.
1691         * attributes.cc (Attributes_section_data::Attributes_section_data):
1692         Don't crash if size is zero.
1694 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1695             Ian Lance Taylor  <iant@google.com>
1697         * gold.cc (queue_middle_tasks): If no input files were opened,
1698         exit.
1699         * workqueue.h (Task_function::Task_function): Assert that there is
1700         a blocker.
1702 2010-02-22  Doug Kwan  <dougkwan@google.com>
1704         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
1705         * icf.cc (get_section_contents): Cast snprintf arguments to long long
1706         types to avoid warnings due to different uint64_t implementations
1707         on different hosts.
1709 2010-02-21  Doug Kwan  <dougkwan@google.com>
1711         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
1712         handling of the maximum backward branch offset.
1713         (Arm_relocate_functions::thumb_branch_common): Ditto.
1714         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
1715         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
1716         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
1717         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
1718         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
1719         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
1720         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
1721         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
1722         thumb_bl_out_of_range thumb_bl_out_of_range.o,
1723         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
1724         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
1725         thumb2_bl_out_of_range.o): New rules.
1726         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
1727         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
1728         thumb2_bl_out_of_range
1729         * testsuite/Makefile.in: Regenerate.
1730         * testsuite/arm_bl_in_range.s: New file.
1731         * testsuite/arm_bl_out_of_range.s: Ditto.
1732         * testsuite/arm_branch_in_range.sh: Ditto.
1733         * testsuite/arm_branch_range.t: Ditto.
1734         * testsuite/thumb2_branch_range.t: Ditto.
1735         * testsuite/thumb_bl_in_range.s: Ditto.
1736         * testsuite/thumb_bl_out_of_range.s: Ditto.
1737         * testsuite/thumb_branch_range.t: Ditto.
1739 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
1741         * gc.h (gc_process_relocs): Change vectors to point to the new list.
1742         Add reloc offset information.
1743         * icf.cc (get_section_contents): Change iterators to point to the new
1744         vectors. Add reloc offset information to the contents.
1745         * icf.h (Icf::Sections_reachable_info): New typedef.
1746         (Icf::Sections_reachable_list): New typedef.
1747         (Icf::Offset_info): New typedef.
1748         (Icf::Reloc_info): New struct typedef.
1749         (Icf::Reloc_info_list): New typedef.
1750         (Icf::symbol_reloc_list): Delete method.
1751         (Icf::addend_reloc_list): Delete method.
1752         (Icf::section_reloc_list): Delete method.
1753         (Icf::reloc_info_list): New method.
1754         (Icf::reloc_info_list_): New member.
1756 2010-02-19  Doug Kwan  <dougkwan@google.com>
1758         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
1759         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
1760         * arm.cc (Arm_relocation_functions): New forward declaration.
1761         (Target_arm::Target_arm): Initialize new data members
1762         got_mod_index_offset_ and tls_base_symbol_defined_.
1763         (Target_arm::Relocate::relocate_tls): New method.
1764         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
1765          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
1766         New methods.
1767         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
1768         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
1769         (Target_arm::got_mod_index_offset_,
1770         Target_arm::tls_base_symbol_defined_): New data members.
1771         (Target_arm::Scan::local, Target::Scan::global,
1772         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
1773         relocations.
1775 2010-02-18  Doug Kwan  <dougkwan@google.com>
1777         * arm.cc (Arm_relobj::find_linked_text_section): New method.
1778         (Arm_relobj::make_exidx_input_section): Pass section index of linked
1779         text section as a parameter becuase some broken tools may not set
1780         the link in section header.
1781         (Target_arm::has_got_section): New method.
1782         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
1783         without any mapping symbol as data only.  Remove warning.
1784         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
1785         link in its section header, try to discover the link by inspecting the
1786         REL31 relocation at the beginning of the section.
1787         (Target_arm::Scan::check_non_pic): Report name of offending relocation
1788         in error message.
1789         (Target_arm::Scan::global): Treat any reference to the symbol
1790         _GLOBAL_OFFSET_TABLE_ as a GOT access.
1792 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
1794         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
1795         (Scan::global_reloc_may_be_function_pointer): New function.
1796         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1797         (Scan::global_reloc_may_be_function_pointer): New function.
1798         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1799         (Scan::global_reloc_may_be_function_pointer): New function.
1800         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
1801         (Scan::global_reloc_may_be_function_pointer): New function.
1802         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
1803         (Scan::global_reloc_may_be_function_pointer): New function.
1804         (Scan::possible_function_pointer_reloc): New function.
1805         (Target_x86_64::can_check_for_function_pointers): New function.
1806         * gc.h (gc_process_relocs): Scan relocation types to determine if
1807         function pointers were taken for targets that support it.
1808         * icf.cc (Icf::find_identical_sections): Include functions for
1809         folding in safe ICF whose pointer is not taken.
1810         * icf.h (Secn_fptr_taken_set): New typedef.
1811         (fptr_section_id_): New member.
1812         (section_has_function_pointers): New function.
1813         (set_section_has_function_pointers): New function.
1814         (check_section_for_function_pointers): New function.
1815         * options.h: Fix comment for safe ICF option.
1816         * target.h (can_check_for_function_pointers): New function.
1817         * testsuite/Makefile.am: Add icf_safe_so_test test case.
1818         Modify icf_safe_test for X86-64.
1819         * testsuite/Makefile.in: Regenerate.
1820         * testsuite/icf_safe_so_test.cc: New file.
1821         * testsuite/icf_safe_so_test.sh: New file.
1822         * testsuite/icf_safe_test.cc (kept_func_3): New function.
1823         (main): Change to take pointer to function kept_func_3.
1824         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
1825         folding is done correctly for X86-64.
1827 2010-02-12  David S. Miller  <davem@davemloft.net>
1829         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
1830         is_symbolless parameter.
1831         (Output_reloc<SHT_REL>::is_symbolless): New.
1832         (Output_reloc<SHT_REL>::is_symbolless_): New.
1833         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
1834         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
1835         (Output_reloc<SHT_RELA>::is_symbolless): New.
1836         (Output_data_reloc::add_global): Handle is_symbolless.
1837         (Output_data_reloc::add_global_relative): Likewise.
1838         (Output_data_reloc::add_local): Likewise.
1839         (Output_data_reloc::add_local_relative): Likewise.
1840         (Output_data_reloc::add_symbolless_global_addend): New.
1841         (Output_data_reloc::add_symbolless_local_addend): New.
1842         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
1843         is_symbolless.
1844         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
1845         instead of ->is_relative_
1846         (Output_reloc::write): Likewise.
1847         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
1848         (Output_reloc::write_rel): Simplify.
1850         * sparc.cc (Target_sparc::Scan::local): Use
1851         ->add_symbolless_local_addend as needed.
1852         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
1853         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
1854         based upon relocation offset.
1856 2010-02-11  Doug Kwan  <dougkwan@google.com>
1858         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
1859         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
1860         beginning of function.
1861         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
1862         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
1863         parameter is_32bit in calls to should_apply_static_reloc.
1864         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
1865         (check_DATA): Add arm_abs_global.stdout.
1866         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
1867         arm_abs_global.stdout): New rules.
1868         (MOSTLLYCLEANFILES): Add arm_abs_global
1869         * Makefile.in: Regenerate.
1870         * testsuite/arm_abs_global.s: New file.
1871         * testsuite/arm_abs_global.sh: Ditto.
1872         * testsuite/arm_abs_lib.s: Ditto.
1874 2010-02-11  Ian Lance Taylor  <iant@google.com>
1876         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
1877         Read_relocs task.
1878         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
1879         Allocate_commons_task first.
1880         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
1881         task, rather than symtab_lock_.
1882         (Gc_process_relocs::~Gc_process_relocs): New function.
1883         (Gc_process_relocs::is_runnable): Check this_blocker_.
1884         (Gc_process_relocs::locks): Use next_blocker_ rather than
1885         blocker_.
1886         (Scan_relocs::~Scan_relocs): New function.
1887         (Scan_relocs::is_runnable): Check this_blocker_ rather than
1888         symtab_lock_.
1889         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
1890         next_blocker_.
1891         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
1892         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
1893         constructor accordingly.
1894         (class Gc_process_relocs): Likewise.
1895         (class Scan_relocs): Likewise.
1896         * common.h (class Allocate_commons_task): Remove symtab_lock_
1897         field, and corresponding constructor parameter.
1898         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
1899         symtab_lock_.
1900         (Allocate_commons_task::locks): Likewise.
1902 2010-02-11  Ian Lance Taylor  <iant@google.com>
1904         * gold-threads.h (class Once): Define.
1905         (class Initialize_lock): Rewrite as child of Once.
1906         * gold-threads.cc (class Once_initialize): Define.
1907         (once_pointer_control): New static variable.
1908         (once_pointer, once_arg): New static variables.
1909         (c_run_once): New static function.
1910         (Once::Once, Once::run_once, Once::internal_run): New functions.
1911         (class Initialize_lock_once): Remove.
1912         (initialize_lock_control): Remove.
1913         (initialize_lock_pointer): Remove.
1914         (initialize_lock_once): Remove.
1915         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
1916         (Initialize_lock::initialize): Rewrite.
1917         (Initialize_lock::do_run_once): New function.
1918         * archive.cc (Archive::interpret_header): Only clear name if it is
1919         not already empty.
1920         * fileread.cc: Include "gold-threads.h"
1921         (file_counts_lock): New static variable.
1922         (file_counts_initialize_lock): Likewise.
1923         (File_read::release): Only increment counts when using --stats.
1924         Use a lock around the increment.
1925         * parameters.cc (class Set_parameters_target_once): Define.
1926         (set_parameters_target_once): New static variable.
1927         (Parameters::Parameters): Move here from parameters.h.
1928         (Parameters::set_target): Rewrite.
1929         (Parameters::set_target_once): New function.
1930         (Parameters::clear_target): Move here and rewrite.
1931         * parameters.h (class Parameters): Update declarations.  Add
1932         set_parameters_target_once_ field.
1933         (Parameters::Parameters): Move to parameters.cc.
1934         (Parameters::clear_target): Likewise.
1935         * readsyms.cc (Read_symbols::do_group): Create a Start_group
1936         task.
1937         (Start_group::~Start_group): New function.
1938         (Start_group::is_runnable): New function.
1939         (Start_group::locks, Start_group::run): New functions.
1940         (Finish_group::run): Change saw_undefined to size_t.
1941         * readsyms.h (class Start_group): Define.
1942         (class Finish_group): Change saw_undefined_ field to size_t.
1943         (Finish_group::Finish_group): Remove saw_undefined and
1944         this_blocker parameters.  Change all callers.
1945         (Finish_group::set_saw_undefined): New function.
1946         (Finish_group::set_blocker): New function.
1947         * symtab.h (class Symbol_table): Change saw_undefined to return
1948         size_t.  Change saw_undefined_ field to size_t.
1949         * target-select.cc (Set_target_once::do_run_once): New function.
1950         (Target_selector::Target_selector): Initialize set_target_once_
1951         field.  Don't initialize lock_ and initialize_lock_ fields.
1952         (Target_selector::instantiate_target): Rewrite.
1953         (Target_selector::set_target): New function.
1954         * target-select.h (class Set_target_once): Define.
1955         (class Target_selector): Update declarations.  Make
1956         Set_target_once a friend.  Remove lock_ and initialize_lock_
1957         fields.  Add set_target_once_ field.
1959 2010-02-10  Ian Lance Taylor  <iant@google.com>
1961         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
1962         queueing any tasks.
1963         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
1964         (queue_middle_tasks): Add all blockers before queueing any tasks.
1965         (queue_final_tasks): Likewise.
1966         * token.h (Task_token::add_blockers): New function.
1967         * object.h (Input_objects::number_of_relobjs): New function.
1969 2010-02-10  Ian Lance Taylor  <iant@google.com>
1971         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
1972         shared, not if not position independent.
1973         * x86_64.cc (Relocate::relocate_tls): Likewise.
1974         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
1975         (tls_pie_pic_test): New target.
1976         * testsuite/Makefile.in: Rebuild.
1978         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
1979         (tls_test_main_pie.o, tls_test_pie.o): New targets.
1980         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
1981         * testsuite/Makefile.in: Rebuild.
1983 2010-02-09  David S. Miller  <davem@davemloft.net>
1985         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
1986         R_SPARC_RELATIVE using ->add_local_relative().
1987         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
1989         * output.h (Output_data_dynamic::add_section_size): New method
1990         that takes two Output_data objects.
1991         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
1992         entry param.  Handle it in initializers.
1993         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
1994         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
1995         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
1996         arg.
1997         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
1998         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
1999         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
2000         for dynrel_includes_plt.
2001         * i386.cc (Target_i386::do_finalize_sections): Likewise.
2002         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2003         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
2004         before .rela.plt
2005         (Target_sparc::do_finalize_sections): Update to pass true for
2006         dynrel_includes_plt.
2007         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
2008         output before .rela.plt
2009         (Target_powerpc::do_finalize_sections): Update to pass true for
2010         dynrel_includes_plt when 32-bit.
2012 2010-02-08  Doug Kwan  <dougkwan@google.com>
2014         * arm.cc (Arm_relobj::simple_input_section_output_address): New
2015         method.
2016         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
2017         Arm_relobj::scan_section_for_cortex_a8_stubs,
2018         Arm_relobj::do_relocation_section): Instead of calling
2019         Output_section::output_address, use faster
2020         Arm_relobj::simple_input_section_output_address.
2022 2010-02-08  David S. Miller  <davem@davemloft.net>
2024         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
2025         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
2026         relocation helper function.
2028         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
2029         just like R_SPARC_GOT{10,13,22}.
2030         (Target_sparc::Scan::local): Likewise.
2031         (Target_sparc::Relocate:relocate): Likewise.
2033 2010-02-06  Ian Lance Taylor  <iant@google.com>
2035         * configure.ac: Rewrite targetobjs duplicate removal code to use
2036         only shell constructs.
2037         * configure: Rebuild.
2039 2010-02-05  Doug Kwan  <dougkwan@google.com>
2041         PR 11247
2042         * arm.cc (Arm_relobj::section_is_scannable): New method.
2043         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
2044         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
2046 2010-02-04  Doug Kwan  <dougkwan@google.com>
2048         PR 11247
2049         * arm-reloc-property.cc (cstdio): Include.
2050         * configure.ac (targetobjs): Remove duplicates.
2051         * configure: Regenerate.
2052         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
2053         big and little endian version for a given address size.
2055 2010-02-03  Doug Kwan  <dougkwan@google.com>
2057         * arm-reloc-property.cc
2058         (Arm_reloc_property_table::reloc_name_in_error_message): New method
2059         definition.
2060         * arm-reloc-property.h
2061         (Arm_reloc_property_table::get_implemented_static_reloc_property):
2062         New method definition.
2063         (Arm_reloc_property_table::reloc_name_in_error_message): New method
2064         declaration.
2065         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
2066         overflow to N.
2067         (GOT_PREL): Change implemented to Y.
2068         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
2069         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
2070         (Arm_relocate_functions::movw_abs_nc): Remove method.
2071         (Arm_relocate_functions::movt_abs): Ditto.
2072         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
2073         (Arm_relocate_functions::thm_movt_abs): Ditto.
2074         (Arm_relocate_functions::movw_rel_nc): Ditto.
2075         (Arm_relocate_functions::movw_rel): Ditto.
2076         (Arm_relocate_functions::movt_rel): Ditto.
2077         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
2078         (Arm_relocate_functions:thm_movw_rel): Ditto.
2079         (Arm_relocate_functions:thm_movt_rel): Ditto.
2080         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
2081         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
2082         New method definitions.
2083         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
2084         (Arm_relocation_functions::arm_grp_ldr): Ditto.
2085         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
2086         (Arm_relocation_functions::arm_grp_ldc): Ditto.
2087         (Target_arm::Relocate::relocate): Check for non-static or
2088         unimplemented relocation code and exit early.  Change calls to
2089         Target_arm::reloc_uses_thumb_bit and
2090         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
2091         instead.  Refactor code to handle similar relocations to increase
2092         code sharing.  Remove check for unsupported relocation code in switch
2093         statement.
2094         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
2095         relocation property table to find out size.  Change error message to
2096         print out the name of a relocation code instead of the numeric value.
2097         (Target_arm::scan_reloc_for_stub): Use relocation property table
2098         instead of calling Target_arm::reloc_uses_thumb_bit().
2100 2010-02-02  Doug Kwan  <dougkwan@google.com>
2102         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
2103         types of relaxed input section.
2105 2010-02-02  Doug Kwan  <dougkwan@google.com>
2107         * Makefile.am (HFILES): Add arm-reloc-property.h.
2108         (DEFFILES): New.
2109         (TARGETSOURCES): Add arm-reloc-property.cc
2110         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
2111         (libgold_a_SOURCES): $(DEFFILES)
2112         * Makefile.in: Regenerate.
2113         * arm-reloc-property.cc: New file.
2114         * arm-reloc-property.h: New file.
2115         * arm-reloc.def: New file.
2116         * arm.cc: Update comments.
2117         (arm-reloc-property.h): New included header.
2118         (arm_reloc_property_table): New global variable.
2119         (Target_arm::do_select_as_default_target): New method definition.
2120         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
2121         arm-reloc-property to targ_extra_obj.
2122         * parameters.cc (set_parameters_target): Call
2123         Target::select_as_default_target().
2124         * target.h (Target::select_as_default_target): New method definition.
2125         (Target::do_select_as_default_target): Same.
2127 2010-02-01  Doug Kwan  <dougkwan@google.com>
2129         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
2130         first_output_text_section_.
2131         (Arm_exidx_fixup::first_output_text_section): New method definition.
2132         (Arm_exidx_fixup::first_output_text_section_): New data member.
2133         (Arm_exidx_fixup::process_exidx_section): Record the first text
2134         output section seen.
2135         (Arm_output_section::fix_exidx_coverage): Set correct linked section
2136         and entsize in output section header.
2138 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2140         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
2141         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
2142         (Arm_relocate_functions::thm_alu11): New Method.
2143         (Arm_relocate_functions::thm_pc8): New Method.
2144         (Arm_relocate_functions::thm_pc12): New Method.
2145         (Target_arm::Scan::local): Handle the relocations.
2146         (Target_arm::Scan::global): Likewise.
2147         (Target_arm::Relocate::relocate): Likewise.
2148         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2150 2010-01-29  Doug Kwan  <dougkwan@google.com>
2152         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
2153         of relocation types as ld.
2155 2010-01-29  Doug Kwan  <dougkwan@google.com>
2157         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
2158         to public.
2159         (Arm_relocate_functions::thumb_branch_common): Ditto.
2160         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
2161         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
2162         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
2163         Arm_relocate_functions::jump24): Remove.
2164         (Target_arm::Relocate::relocate): Adjust code to call
2165         Arm_relocation_functions::arm_branch_common and
2166         Arm_relocation_functions::thumb_branch_common instead of their removed
2167         wrappers.  Merge switch-cases together to reduce source code size.
2169 2010-01-29  Doug Kwan  <dougkwan@google.com>
2171         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
2172         output_local_symbol_count_needs_update_.
2173         (Arm_relobj::output_local_symbol_count_needs_update,
2174          Arm_relobj::set_output_local_symbol_count_needs_update,
2175          Arm_relobj::update_output_local_symbol_count): New methods.
2176         (Arm_relobj::output_local_symbol_count_needs_update_): New data
2177         member.
2178         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
2179         of pointed function as in a R_ARM_PREL31 relocation.
2180         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
2181         for output local symbol count updating.
2182         (Target_arm::do_relax): Update output local symbol counts in objects
2183         if necessary.
2184         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
2186 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2188         * arm.cc: Added support for the ARM relocations:
2189         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
2190         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
2191         (Arm_relocate_functions::movw_rel_nc): Renamed (was
2192         movw_prel_nc).
2193         (Arm_relocate_functions::movw_rel): New method.
2194         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
2195         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
2196         thm_movw_prel_nc).
2197         (Arm_relocate_functions::thm_movw_rel): New method.
2198         (Arm_relocate_functions::thm_movt_rel): Renamed (was
2199         thm_movt_prel).
2200         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
2201         relocations.
2202         (Target_arm::Scan::global): Likewise.
2203         (Target_arm::Relocate::relocate): Likewise.
2204         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2205         Likewise.
2207 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2209         * arm.cc: Added support for ARM group relocations.
2210         (Target_arm::reloc_needs_sym_origin): New method.
2211         (Arm_relocate_functions::calc_grp_kn): New method.
2212         (Arm_relocate_functions::calc_grp_residual): New method.
2213         (Arm_relocate_functions::calc_grp_gn): New method.
2214         (Arm_relocate_functions::arm_grp_alu): New Method.
2215         (Arm_relocate_functions::arm_grp_ldr): New Method.
2216         (Arm_relocate_functions::arm_grp_ldrs): New Method.
2217         (Arm_relocate_functions::arm_grp_ldc): New Method.
2218         (Target_arm::Scan::local): Handle the ARM group relocations.
2219         (Target_arm::Scan::global): Likewise.
2220         (Target_arm::Relocate::relocate): Likewise.
2221         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2222         Likewise.
2224 2010-01-26  Doug Kwan  <dougkwan@google.com>
2226         * arm.cc (set): Include.
2227         (class Arm_exidx_fixup): Change type of last_input_section_ to const
2228         pointer type.
2229         (Arm_output_section::Text_section_list): New type.
2230         (Arm_output_section::append_text_sections_to_list): New method.
2231         (Arm_output_section::fix_exidx_coverage): Ditto.
2232         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2233         (Arm_relobj::convert_input_section_to_relaxed_section): Use
2234         Relobj::set_section_offset() instead of
2235         Sized_relobj::invalidate_section_offset().
2236         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2237         parameter for section headers. Ignore relocation sections for
2238         unallocated sections and EXIDX sections.
2239         (Target_arm::fix_exidx_coverage): New method.
2240         (Target_arm::output_section_address_less_than): New type.
2241         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
2242         linked text section instead of the EXIDX section.
2243         (Arm_output_section::create_stub_group): Add an assertion to check
2244         that this is not an EXIDX output section.
2245         (Arm_output_section::append_text_sections_to_list): New method.
2246         (Arm_output_section::fix_exidx_coverage): Ditto.
2247         (Arm_relobj::scan_sections_for_stubs): Adjust call to
2248         Arm_relobj::section_needs_reloc_stub_scanning.
2249         (Target_arm::do_relax): Fix EXIDX output section coverage in the
2250         first pass.
2251         (Target_arm::fix_exidx_coverage): New method.
2252         * object.h (Relobj::set_output_section): New method.
2253         (Sized_relobj::invalidate_section_offset): Remove method.
2254         (Sized_relobj::do_invalidate_section_offset): Remove method.
2255         (Sized_relobj::do_set_section_offset): Handle offset value -1.
2257 2010-01-25  Doug Kwan  <dougkwan@google.com>
2259         * arm.cc (Arm_exidx_merged_section::do_output_offset):
2260         Fix warning due to signed and unsigned comparison on a 32-bit host.
2262 2010-01-22  Doug Kwan  <dougkwan@google.com>
2264         * arm.cc (Target_arm::do_relax): Record an output section for section
2265         offset adjustment it contains any stub table that has changed.
2266         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
2267         offsets in an output section if necessary.
2268         * output.cc (Output_section::Output_section): Initialize
2269         section_offsets_need_adjustments_.
2270         (Output_section::add_input_section_for_script): Renamed to
2271         Output_section::add_simple_input_section.
2272         (Output_section::save_states): Add a comment.
2273         (Output_section::discard_states): New method defintion.
2274         (Output_section::adjust_section_offsets): Same.
2275         * output.h (Output_section::add_input_section_for_script): Renamed to
2276         Output_section::add_simple_input_section.
2277         (Output_section::discard_states): New method declaration.
2278         (Output_section::adjust_section_offsets): Same.
2279         (Output_section::section_offsets_need_adjustment,
2280         Output_section::set_section_offsets_need_adjustment): New method
2281         definitions.
2282         (Output_section::section_offsets_need_adjustment_): New data member.
2283         * script-sections.cc
2284         (Output_section_element_input::set_section_address): Adjust code for
2285         renaming of Output_section::add_input_section_for_script.
2286         (Orphan_output_section::set_section_address): Same.
2288 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2290         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
2291         Fix_v4bx enum values .
2292         * gold/options.h (General_options): New option definitions.
2293         (General_options::fix_v4bx): New method.
2294         (General_options::Fix_v4bx): New enum.
2295         * gold/options.cc (General_options::parse_fix_v4bx): New method.
2296         (General_options::parse_fix_v4bx_interworking): New method.
2298 2010-01-22  Doug Kwan  <dougkwan@google.com>
2300         * arm.cc (Arm_exidx_fixup): New class.
2302 2010-01-21  Doug Kwan  <dougkwan@google.com>
2304         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
2305         classes.
2306         (Arm_exidx_section_offset_map): New type.
2308 2010-01-21  Doug Kwan  <dougkwan@google.com>
2310         * arm.cc (Arm_exidx_input_section): New class.
2311         (Arm_relobj::exidx_input_section_by_link,
2312         Arm_relobj::exidx_input_section_by_shndx,
2313         Arm_relobj::make_exidx_input_section): New methods.
2314         (read_arm_attributes_section): Remove.
2315         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
2316         information about them.
2317         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
2318         to here.
2320 2010-01-20  Doug Kwan  <dougkwan@google.com>
2322         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
2323         Input_section_specifier to Section_id.
2324         (Target_arm::new_arm_input_section: Adjust code for change of key
2325         type.
2326         (Target_arm::find_arm_input_section): Ditto.
2327         * gc.h (object.h): Include for Section_id nand Section_id_hash.
2328         (Section_id): Remove.
2329         (Garbage_collection::Section_id_hash): Remove.
2330         * icf.h (object.h): Include for Section_id nand Section_id_hash.
2331         (Section_id): Remove.
2332         (Icf::Section_id_hash): Remove.
2333         * object.h (Section_id, Const_section_id, Section_id_hash,
2334         Const_section_id_hash): New type definitions.
2335         * output.cc (Output_section::add_relaxed_input_section): Change to
2336         use Const_section_id instead of Input_section_specifier as key type.
2337         (Output_section::add_merge_input_section): Ditto.
2338         (Output_section::build_relaxation_map): Change to use Section_id
2339         instead of Input_section_specifier as key type.
2340         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2341         Ditto.
2342         (Output_section::convert_input_sections_to_relaxed_sections): Change
2343         to use Const_section_id instead of Input_section_specifier as key type.
2344         (Output_section::find_merge_section): Ditto.
2345         (Output_section::find_relaxed_input_section): Ditto.
2346         * output.h (Input_section_specifier): Remove class.
2347         (Output_section::Output_section_data_by_input_section_map): Change
2348         key type to Const_section_id.
2349         (Output_section::Output_relaxed_input_section_by_input_section_map):
2350         Ditto.
2351         (Output_section::Relaxation_map): Change key type to Section_id.
2353 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2355         * gold/arm.cc: Added support for R_ARM_V4BX relocation
2356         (class Arm_v4bx_stub): New class.
2357         (DEF_STUBS): Updated definition to support v4_veneer_bx.
2358         (Stub_factory::make_arm_v4bx_stub): New method.
2359         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
2360         (Stub_table::empty): Handle v4bx stubs.
2361         (Stub_table::add_arm_v4bx_stub): New method.
2362         (Stub_table::find_arm_v4bx_stub): New method.
2363         (Arm_relocate_functions::v4bx): New method.
2364         (Target_arm::fix_v4bx): New method.
2365         (Target_arm::Target_arm): Handle R_ARM_V4BX.
2366         (Stub_table::relocate_stubs): Likewise.
2367         (Stub_table::do_write): Likewise.
2368         (Stub_table::update_data_size_and_addralign): Likewise.
2369         (Stub_table::finalize_stubs):  Likewise.
2370         (Target_arm::Scan::local): Likewise.
2371         (Target_arm::Scan::global): Likewise.
2372         (Target_arm::do_finalize_sections): Likewise.
2373         (Target_arm::Relocate::relocate): Likewise.
2374         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2375         Likewise.
2376         (Target_arm::scan_reloc_for_stub): Likewise.
2377         (Target_arm::scan_reloc_section_for_stubs): Likewise.
2379 2010-01-19  Ian Lance Taylor  <iant@google.com>
2381         * output.cc (Output_section_headers::do_sized_write): Write large
2382         segment count to sh_info field.
2383         (Output_file_header::do_sized_write): For large segment count,
2384         write PN_XNUM to e_phnum field.
2386 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2388         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
2389         (Arm_relocate_functions::thm_jump8): New function.
2390         (Arm_relocate_functions::thm_jump11): New function.
2391         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
2392         R_ARM_THM_JUMP11.
2393         (Target_arm::Scan::global): Likewise.
2394         (Target_arm::Relocate::relocate): Likewise.
2395         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2396         Likewise.
2398 2010-01-14  Doug Kwan  <dougkwan@google.com>
2400         * arm.cc (map, utility): Include headers.
2401         (Target_arm::apply_cortex_a8_workaround): New method.
2402         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
2403         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
2404         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
2405         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
2406         the --[no-]fix-cortex-a8 command line options.
2407         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
2408         (Target_arm::relocate_stub): Use addend in instruction template.
2409         * options.h (DEFINE_bool): Set the user-set flag.
2410         (General_options): Add --[no-]-fix-cortex options.
2411         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
2412         : Update fast look-up map after conversion.
2414 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
2416         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
2417         in the first pass of do_layout.
2419 2010-01-13  Doug Kwan  <dougkwan@google.com>
2421         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2422         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
2423         apparent compiler problem of not folding static constant integral
2424         data members of elfcpp::Elf_sizes<32>.
2426 2010-01-13  Doug Kwan  <dougkwan@google.com>
2428         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2429         Arm_relobj::section_needs_cortex_a8_stub_scanning,
2430         Arm_relobj::scan_section_for_cortex_a8_erratum,
2431         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
2432         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
2433         sections to scan for relocation stubs into a new method
2434         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
2435         relocation and Cortex-A8 stub scanning.
2436         (Target_arm::do_relax): Force stubs to be after stubbed sections
2437         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
2438         the beginning of a new relaxation pass.  Update a comment.
2439         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
2441 2010-01-12  Ian Lance Taylor  <iant@google.com>
2443         * target-reloc.h (visibility_error): New inline function.
2444         (relocate_section): Call visibility_error.
2445         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
2446         (MOSTLYCLEANFILES): Likewise.
2447         (protected_4_pic.o, protected_3.err): New targets.
2448         * testsuite/protected_4.cc: New file.
2450 2010-01-12  Doug Kwan  <dougkwan@google.com>
2452         * arm.cc (Cortex_a8_reloc): New class.
2453         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
2454         and cortex_a8_relocs_info_.
2455         (Target_arm::fix_cortex_a8): New method definition.
2456         (Target_arm::Cortex_a8_relocs_info): New type.
2457         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
2458         New data member declarations.
2459         (Target_arm::scan_reloc_for_stub): Record information about
2460         relocations for THUMB branches that might be exempted from the
2461         Cortex-A8 workaround.
2462         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
2463         at the beginning of a relaxation pass.
2465 2010-01-12  Doug Kwan  <dougkwan@google.com>
2467         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
2468         (Arm_relobj::Mapping_symbol_position,
2469          Arm_reloj::Mapping_symbol_position_less,
2470          Arm_relobj::Mapping_symbols_info): New types.
2471         (Target_arm::is_mapping_symbol_name): New method definition.
2472         (Arm_relobj::do_count_local_symbols): Save information about mapping
2473         symbols.
2475 2010-01-11  Doug Kwan  <dougkwan@google.com>
2477         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
2478         Arm_relocate_functions::thumb32_branch_upper,
2479         Arm_relocate_functions::thumb32_branch_lower,
2480         Arm_relocate_functions::thumb32_cond_branch_offset,
2481         Arm_relocate_functions::thumb32_cond_branch_upper,
2482         Arm_relocate_functions::thumb32_cond_branch_lower,
2483         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
2484         branch offset encoding.
2485         (Arm_relocate_functions::thumb_branch_common): Use new branch
2486         offset encoding methods to avoid code duplication.
2487         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
2488         (Stub_addend_reader::operator()): Use new branch encoding method
2489         to avoid code duplication.
2491 2010-01-11  Doug Kwan  <dougkwan@google.com>
2493         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
2494         (Target_arm::do_finalize_sections): Define special EXIDX section
2495         symbols only if referenced.
2496         * gc.h (Garbage_collection::add_reference): New method.
2497         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
2498         code duplication.
2500 2010-01-11  Ian Lance Taylor  <iant@google.com>
2502         * script.cc (Version_script_info::build_expression_list_lookup):
2503         Change complaing about duplicate wildcard match from error to
2504         warning.
2506         * script.cc (class Lazy_demangler): Recreate--revert part of patch
2507         of 2009-12-30.
2508         (Version_script_info::Version_script_info): Initialize globs_,
2509         default_version_, default_is_global_, and exact_.  Don't
2510         initialize globals_ or locals_.
2511         (Version_script_info::build_lookup_tables): Build local symbols
2512         first.
2513         (Version_script_info::unquote): New function.
2514         (Version_script_info::add_exact_match): New function.
2515         (Version_script_info::build_expression_list_lookup): Remove lookup
2516         parameter.  Add is_global parameter.  Change all callers.  Handle
2517         wildcard pattern specially.  Unquote pattern.  Call
2518         add_exact_match.
2519         (Version_script_info::get_name_to_match): New function.
2520         (Version_script_info::get_symbol_version): New function.
2521         (Version_script_info::get_symbol_version_helper): Remove.
2522         (Version_script_info::check_unmatched_names): Call unquote.
2523         * script.h (class Version_script_info): Change get_symbol_version
2524         to be non-inline and add is_global parameter; change all callers.
2525         Rewrite symbol_is_local.  Update declarations.  Define struct
2526         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
2527         Remove globals_ and locals_ members.  Add exact_, globs_,
2528         default_version_, is_global_.
2529         (Version_script_info::Glob): Remove pattern, add expression and
2530         is_global.  Update constructor.  Change all callers.
2531         * dynobj.cc (Versions::finalize): Mark the version symbol as the
2532         default version.
2533         (Versions::symbol_section_contents): If a symbol is undefined, or
2534         defined in a dynamic object, set the version index to
2535         VER_NDX_LOCAL.
2536         * symtab.cc (Symbol_table::add_from_relobj): Don't call
2537         symbol_is_local.
2538         (Symbol_table::add_from_pluginobj): Likewise.
2539         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
2541 2010-01-11  Doug Kwan  <dougkwan@google.com>
2543         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
2544         (incremental_dump_LDADD): Add linking option for libintl.
2545         * Makefile.in: Regenerate.
2547 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
2549         PR gold/11144
2550         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
2551         instead of -Ds.
2552         * testsuite/Makefile.in: Regenerated.
2554 2010-01-10  Doug Kwan  <dougkwan@google.com>
2556         * options.h (DEFINE_var): Use parentheses around argument varname__
2557         in macro body to avoid any unintended subsequent substitutions.
2559 2010-01-10  Ian Lance Taylor  <iant@google.com>
2561         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
2562         candidates before doing symbol resolution.
2564         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
2565         ODR candidates if only one is weak.
2567 2010-01-08  Ian Lance Taylor  <iant@google.com>
2569         * script.cc (Version_script_info::build_expression_list_lookup):
2570         Don't warn about ambiguous version, just record the ambiguity.
2571         (Version_script_info::get_symbol_version_helper): Give error if
2572         version is ambiguous.
2574 2010-01-08  Doug Kwan  <dougkwan@google.com>
2576         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
2577           prev_data_size_ and prev_addralign_.  Remove initializer for
2578           deleted data member has_been_changed_.
2579           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
2580           to determine if the table is empty.
2581           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
2582           Remove.
2583           (Stub_table::add_reloc_stub): Define method in class definition
2584           instead of just declaring it there.
2585           (Stub_table::add_cortex_a8_stub): New method definition.
2586           (Stub_table::update_data_size_and_addralign): Ditto.
2587           (Stub_table::finalize_stubs): Ditto.
2588           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
2589           (Stub_table::do_addralign_): Return address alignment in the
2590           (Stub_table::do_reset_address_and_file_offset): Define method in
2591           class definition instead of declaring it there.  Set current data
2592           size to be the data size of the previous pass.
2593           (Stub_table::set_final_data_size): Use current data size as the
2594           final data size.
2595           (Stub_table::relocate_stub): Change parameter type of stub from
2596           Reloc_stub pointer to Stub pointer.
2597           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
2598           (Stub_table::Cortex_a8_stub_list): New typedef.
2599           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
2600            Stub_table::prev_addralign_): New data member.
2601           (Arm_relobj::Arm_relobj): Initialize data member
2602           section_has_cortex_a8_workaround_.
2603           (Arm_relobj::section_has_cortex_a8_workaround,
2604            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
2605            definitions.
2606           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
2607           declarations.
2608           (Target_arm::relocate_stub): Change parameter type of stub from
2609           Reloc_stub pointer to Stub pointer.
2610           (Insn_template::size, Insn_template::alignment): Handle
2611           THUMB16_SPECIAL_TYPE.
2612           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
2613            Stub_table::update_data_size_and_addralign,
2614            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
2615           definitions.
2616           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
2617           (Stub_table::do_write): Ditto.
2618           (Target_arm::do_relax): Adjust code for changes in Stub_table.
2620 2010-01-08  Ian Lance Taylor  <iant@google.com>
2622         PR 11108
2623         * symtab.h (class Symbol): Remove fields is_target_special_ and
2624         has_plt_offset_.  Add field is_defined_in_discarded_section_.
2625         (Symbol::is_defined_in_discarded_section): New function.
2626         (Symbol::set_is_defined_in_discarded_section): New function.
2627         (Symbol::has_plt_offset): Rewrite.
2628         (Symbol::set_plt_offset): Verify that new offset is not -1U.
2629         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
2630         Don't initialize is_target_special_ or has_plt_offset_.
2631         Initialize is_defined_in_discarded_section_.
2632         (Symbol_table::add_from_relobj): If appropriate, set
2633         is_defined_in_discarded_section.
2634         * resolve.cc (Symbol::override_base_with_special): Don't test
2635         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
2636         * target-reloc.h (relocate_section): Do special handling for
2637         symbols defined in discarded sections for global symbols as well
2638         as local symbols.
2640 2010-01-08  Ian Lance Taylor  <iant@google.com>
2642         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
2643         the SHT_SYMTAB case.
2645 2010-01-08  Ian Lance Taylor  <iant@google.com>
2647         * object.cc (Sized_relobj::do_layout): Don't get confused if
2648         layout_eh_frame returns NULL.
2650 2010-01-08  Ian Lance Taylor  <iant@google.com>
2652         PR 11084
2653         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
2654         dynamic symbol table, use the normal symbol table.
2655         (Sized_dynobj::do_read_symbols): Remove assertion about type of
2656         symbol table.
2658 2010-01-08  Ian Lance Taylor  <iant@google.com>
2660         PR 11072
2661         * layout.cc (Layout::include_section): Remove .gnu_debuglink
2662         sections.
2664 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2666         * version.cc (print_version): Change to "Copyright 2010".
2668 2010-01-08  Ian Lance Taylor  <iant@google.com>
2670         PR 10287
2671         PR 11063
2672         * i386.cc (class Target_i386): Change return type of plt_section
2673         to be non-const.
2674         (class Output_data_plt_i386): Add tls_desc_rel_ field.
2675         (Output_data_plt_i386::Output_data_plt_i386): Initialize
2676         tls_desc_rel_ field.
2677         (Output_data_plt_i386::rel_tls_desc): New function.
2678         (Target_i386::rel_tls_desc_section): New function.
2679         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
2680         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
2681         R_386_TLS_DESC reloc in rel_tls_desc_section.
2682         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
2683         Define struct Tlsdesc_info.
2684         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
2685         (Target_x86_64::do_reloc_symbol_index): New function.
2686         (Target_x86_64::add_tlsdesc_info): New function.
2687         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
2688         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
2689         tlsdesc_rel_ field.
2690         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
2691         all callers.
2692         (Output_data_plt_x86_64::rela_tlsdesc): New function.
2693         (Target_x86_64::rela_tlsdesc_section): New function.
2694         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
2695         handling.
2696         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
2697         (Target_x86_64::do_reloc_addend): New function.
2698         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
2699         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
2700         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
2701         (Output_reloc::type): New function.
2702         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
2703         (Output_reloc::is_target_specific): New function.
2704         (Output_reloc::target_arg): New function.
2705         (class Output_reloc) [SHT_RELA]: Add four new constructors for
2706         absolute relocs and target specific relocs.
2707         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
2708         add_target_specific.
2709         (class Output_data_reloc) [SHT_RELA]: Likewise.
2710         * output.cc (Output_reloc::Output_reloc): Add four new versions
2711         for absolute relocs and target specific relocs.
2712         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
2713         (Output_reloc::get_symbol_index): Likewise.
2714         (Output_reloc::local_section_offset): Check that local_sym_index_
2715         is not TARGET_CODE or 0.
2716         (Output_reloc::symbol_value): Likewise.
2717         (Output_reloc::write) [SHT_RELA]: Call target for target specific
2718         reloc.
2719         * target.h (class Target): Add reloc_symbol_index and reloc_addend
2720         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
2721         functions.
2722         * layout.cc (add_target_dynamic_tags): Use output section for
2723         DT_PLTRELSZ and DT_JMPREL.
2725 2010-01-07  Ian Lance Taylor  <iant@google.com>
2727         PR 11061
2728         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
2729         function.
2730         (class Output_data_reloc_generic): Define.
2731         (class Output_data_reloc_base): Change base class to
2732         Output_data_reloc_generic.  Change add() method to call
2733         bump_relative_reloc_count for a relative reloc.  Remove
2734         sort_relocs_ field.
2735         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
2736         to sort_relocs().
2737         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
2738         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
2739         appropriate.
2740         * layout.h (class Layout): Update declaration.
2742 2010-01-07  Ian Lance Taylor  <iant@google.com>
2744         * output.h (class Output_data): Add const version of
2745         output_section and do_output_section.
2746         (class Output_section_data): Add const version of
2747         do_output_section.
2748         (class Output_section): Likewise.
2749         * layout.cc (Layout::add_target_dynamic_tags): New function.
2750         * layout.h (class Layout): Update declarations.
2751         * arm.cc (Target_arm::do_finalize_sections): Use
2752         add_target_dynamic_tags.
2753         * i386.cc (Target_i386::do_finalize_sections): Likewise.
2754         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2755         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2756         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2758 2010-01-07  Ian Lance Taylor  <iant@google.com>
2760         PR 11042
2761         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
2762         object as needed.
2764 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
2765             Ian Lance Taylor  <iant@google.com>
2767         PR 11019
2768         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
2769         Xindex::read_symtab_xindex.
2771 2010-01-07  Doug Kwan  <dougkwan@google.com>
2773         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
2774         (Insn_template::thumb16_bcond_insn): New method declaration.
2775         (Insn_template): Fix spelling.
2776         (Stub::thumb16_special): New method declaration.
2777         (Stub::do_write): Define virtual method which was previously pure
2778         virtual.
2779         (Stub::do_thumb16_special): New method declaration.
2780         (Stub::do_fixed_endian_write): New template member.
2781         (Reloc_stub::do_write): Remove.
2782         (Reloc_stub::do_fixed_endian_write): Remove.
2783         (Cortex_a8_stub): New class definition.
2784         (Stub_factory::make_cortex_a8_stub): New method definition.
2785         (Stub_factory::Stub_factory): Add missing static storage class
2786         qualifier for elf32_arm_stub_a8_veneer_blx.
2788 2010-01-07  Ian Lance Taylor  <iant@google.com>
2790         PR 10980
2791         * options.h (class General_options): Add --warn-unresolved-symbols
2792         and --error-unresolved-symbols.
2793         * errors.cc (Errors::undefined_symbol): Implement
2794         --warn-unresolved-symbols.
2796         * options.h (class General_options): Add -z text and -z textoff.
2797         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
2799 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
2801         * gc.h (Garbage_collection::Cident_section_map): New typedef.
2802         (Garbage_collection::cident_sections): New function.
2803         (Garbage_collection::add_cident_section): New function.
2804         (Garbage_collection::cident_sections_): New member.
2805         (gc_process_relocs): Add references to sections whose names are C
2806         identifiers.
2807         * gold.h (cident_section_start_prefix): New constant.
2808         (cident_section_stop_prefix): New constant.
2809         (is_cident): New function.
2810         * layout.cc (Layout::define_section_symbols): Replace string constants
2811         with the newly defined constants.
2812         * object.cc (Sized_relobj::do_layout): Track sections whose names are
2813         C identifiers.
2814         * testsuite/Makefile.am: Add gc_orphan_section_test.
2815         * testsuite/Makefile.in: Regenerate.
2816         * testsuite/gc_orphan_section_test.cc: New file.
2817         * testsuite/gc_orphan_section_test.sh: New file.
2819 2010-01-06  Ian Lance Taylor  <iant@google.com>
2821         PR 10980
2822         * options.h (class General_options): Add --warn-shared-textrel.
2823         * layout.cc (Layout::finish_dynamic_section): Implement
2824         --warn-shared-textrel.
2826         PR 10980
2827         * options.h (class General_options): Add --warn-multiple-gp.
2829 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2831         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
2832         $(THREADSLIB) and $(LIBDL).
2833         * Makefile.in: Rebuild.
2835 2010-01-06  Ian Lance Taylor  <iant@google.com>
2837         PR 10980
2838         * options.cc (General_options::parse_section_start): New function.
2839         (General_options::section_start): New function.
2840         (General_options::General_options): Initialize all members.
2841         * options.h: Include <map>
2842         (class General_options): Add --section-start.  Add section_starts_
2843         member.
2844         * layout.cc (Layout::attach_allocated_section_to_segment): If
2845         --section-start was used, set the address of the segment.  Remove
2846         local sort_sections.
2847         (Layout::relaxation_loop_body): If the address of the load segment
2848         has been set by --section-start, don't use it.
2849         * output.h (Output_segment::update_flags_for_output_section): New
2850         function.
2851         * output.cc (Output_segment::add_output_section): Call
2852         update_flags_for_output_section.
2854 2010-01-05  Ian Lance Taylor  <iant@google.com>
2856         PR 10980
2857         * options.h (class General_options): Add --undefined-version.
2858         * script.cc (struct Version_expression): Add was_matched_by_symbol
2859         field.
2860         (Version_script_info::matched_symbol): New function.
2861         (Version_script_info::get_symbol_version_helper): Call
2862         matched_symbol.
2863         (Version_script_info::check_unmatched_names): New function.
2864         * script.h (class Version_script_info): Update declarations.
2865         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
2867         * options.h (class General_options): Use DEFINE_bool_alias for
2868         allow_multiple_definition.
2869         * resolve.cc (Symbol_table::should_override): Don't test
2870         allow_multiple_definition.
2872         PR 10980
2873         * options.h (class General_options): Add --cref.
2874         * main.cc (main): Print cref table if --cref.  Don't close mapfile
2875         until after printing cref table.
2876         * cref.cc: Include "symtab.h".
2877         (class Cref_inputs): Define Cref_table_compare and Cref_table.
2878         (Cref_table_compare::operator()): New function.
2879         (Cref_inputs::gather_cref): New function.
2880         (filecol): New static const.
2881         (Cref_inputs::print_cref): New function.
2882         (Cref::print_cref): New function.
2883         * cref.h: Include <cstdio>.
2884         (class Cref): Update declarations.
2885         * mapfile.h (Mapfile::file): New function.
2886         * object.h (class Object): Define Symbols.  Declare virtual
2887         do_get_global_symbols.
2888         (Object::get_global_symbols): New function.
2889         * object.cc (Input_objects::add_object): Pass object to cref_ if
2890         --cref.
2891         (Input_objects::archive_start): Likewise.
2892         (Input_objects::archive_stop): Likewise.
2893         (Input_objects::print_cref): New function.
2894         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
2895         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
2896         --cref.
2897         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
2898         function.
2899         * plugin.h (class Sized_pluginobj): Update declarations.
2901 2010-01-05  Ian Lance Taylor  <iant@google.com>
2903         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
2904         to is_default_version.  Rename insdef to insdefault.
2905         (Symbol_table::add_from_relobj): Rename def to is_default_version
2906         and local to is_forced_local.
2907         (Symbol_table::add_from_pluginobj): Likewise.
2908         (Symbol_table::add_from_dynobj): Likewise.
2909         (Symbol_table::define_special_symbol): Rename insdef to
2910         insdefault.
2912 2010-01-04  Ian Lance Taylor  <iant@google.com>
2914         PR 10980
2915         * options.h (class General_options): Add
2916         --allow-multiple-definition and -z muldefs.
2917         * resolve.cc (Symbol_table::should_override): Don't warn about a
2918         multiple symbol definition if --allow-multiple-definition or -z
2919         muldefs.
2921         PR 10980
2922         * options.h (class General_options): Add --add-needed and
2923         --copy-dt-needed-entries.  Tweak --as-needed help entry.
2924         * object.cc (Input_objects::check_dynamic_dependencies): Give an
2925         error if --copy-dt-needed-entries aka --add-needed is used and
2926         would cause a change in behaviour.
2928         PR 10980
2929         * options.h (class General_options): Add -G as a short version of
2930         --shared.  Add no-op options -assert, -g, and -i.
2932 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
2934         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
2935         check for .text or .gnu.linkonce.t sections.
2936         * icf.cc (Icf::find_identical_sections): Ditto.
2937         Change the detection for mangled function name within the section
2938         name.
2939         * icf.h (is_section_foldable_candidate): New function.
2941 2009-12-30  Ian Lance Taylor  <iant@google.com>
2943         PR 10980
2944         * options.h (class General_options): Permit two dashes with
2945         --retain-symbols-file.
2947 2009-12-30  Ian Lance Taylor  <iant@google.com>
2949         PR 10979
2950         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
2951         don't put the file header and segment headers in the text
2952         segment.
2954         PR 10979
2955         * common.cc (Sort_commons::operator()): Stabilize sort when both
2956         entries are NULL.
2957         (Symbol_table::do_allocate_commons_list): When allocating common
2958         symbols, skip a symbol which is no longer common.
2959         * symtab.h (Symbol::is_common): Test whether the symbol comes from
2960         an object before checking its type.
2961         * testsuite/common_test_2.c: New file.
2962         * testsuite/common_test_3.c: New file.
2963         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
2964         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
2965         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
2966         (common_test_2_pic.o, common_test_2.so): New targets.
2967         (common_test_3_pic.o, common_test_3.so): New targets.
2968         * testsuite/Makefile.in: Rebuild.
2970         PR 10979
2971         * script.cc (read_input_script): If we see a new SECTIONS clause,
2972         and we have added an input section, give an error.
2973         * layout.h (class Layout): Add have_added_input_section function.
2974         Add have_added_input_section_ field.
2975         * layout.cc (Layout::Layout): Initialize
2976         have_added_input_section_.
2977         (Layout::layout): Set have_added_input_section_.
2978         (Layout::layout_eh_frame): Likewise.
2980 2009-12-30  Ian Lance Taylor  <iant@google.com>
2982         PR 10931
2983         * options.h (class General_options): Add --sort-common option.
2984         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
2985         * common.cc (Sort_common): Add sort_order parameter to
2986         constructor.  Add sort_order_ field.
2987         (Sort_commons::operator): Check sort_order_.
2988         (Symbol_table::allocate_commons): Determine the sort order.
2989         (Symbol_table::do_allocate_commons): Add sort_order parameter.
2990         Change all callers.
2991         (Symbol_table::do_allocate_commons_list): Likewise.
2993 2009-12-30  Ian Lance Taylor  <iant@google.com>
2995         PR 10916
2996         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
2997         symbols from this object, don't change the visibility of an
2998         undefined symbol.
2999         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
3001 2009-12-30  Ian Lance Taylor  <iant@google.com>
3003         PR 10861
3004         * script.h (class Version_script_info): Define Language enum.
3005         Update declarations.  Define Glob, Exact, and Lookup types.  Add
3006         new fields globals_, locals_, and is_finalized_.
3007         * script.cc: Various formatting fixes.
3008         (class Parser_closure): Change language_stack_ from a vector of
3009         std::string to one of Version_script_info::Language.  Adjust all
3010         uses accordingly.
3011         (class Lazy_demangler): Remove.
3012         (struct Version_expression): Change language from std::string to
3013         Version_script_info::Language.
3014         (Version_script_info::Version_script_info): New function.
3015         (Version_script_info::~Version_script_info): Don't call clear.
3016         (Version_script_info::finalize): New function.
3017         (Version_script_info::build_lookup_tables): New function.
3018         (Version_script_info::build_expression_list_lookup): New
3019         function.
3020         (Version_script_info::get_symbol_version_helper): Rewrite to use
3021         lookup tables.
3022         (Version_script_info::print_expression_list): Adjust to use
3023         Version_script_info::Language.
3024         (script_push_lex_into_version_mode): Check that the version script
3025         has not been finalized.
3026         (version_script_push_lang): Change language string to
3027         Version_script_info::Language.
3028         * options.cc (Command_line::version_script): New function.
3029         * options.h (class General_options): Add finalize_dynamic_list
3030         function.  Change version_script from declaration to definition.
3031         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
3032         * testsuite/version_script.map: Remove duplicate def of foo.
3033         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
3034         version_script.map.
3035         * testsuite/Makefile.in: Rebuild.
3037 2009-12-30  Ian Lance Taylor  <iant@google.com>
3039         PR 10843
3040         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
3041         if the input symbol index is 0, make the output symbol index 0.
3043 2009-12-30  Ian Lance Taylor  <iant@google.com>
3045         PR 10670
3046         * options.h (class General_options): Add -x/--discard-all.
3047         * object.cc (Sized_relobj::do_count_local_symbols): Handle
3048         --discard-all.  If the local symbol needs a dynamic entry, check
3049         that before handling --discard-locals.
3051 2009-12-30  Ian Lance Taylor  <iant@google.com>
3053         PR 10450
3054         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
3055         flags to PF_R.
3056         (Output_segment::add_output_section): Don't change the flags if
3057         the type is PT_TLS.
3059         PR 10450
3060         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
3061         GNU hash table if they need a dynamic value.  Otherwise, don't add
3062         them if they are defined in a dynamic object or are forced local.
3064 2009-12-29  Ian Lance Taylor  <iant@google.com>
3066         PR 10450
3067         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
3068         .gnu.hash table for a 32-bit target.
3070         PR 10450
3071         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
3072         regular and a dynamic object only needs a dynamic symbol table
3073         entry if it is externally visible.
3075         PR 10450
3076         * i386.cc (class Target_i386): Initialize global_offset_table_ in
3077         constructor.  Add global_offset_table_ field.
3078         (Target_i386::got_section): Set global_offset_table_.
3079         (Target_i386::do_finalize_sections): Set global_offset_table_
3080         size.
3081         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
3082         in constructor.  Add global_offset_table_ field.
3083         (Target_x86_64::got_section): Set global_offset_table_.
3084         (Target_x86_64::do_finalize_sections): Set global_offset_table_
3085         size.
3087         * layout.cc (Layout::Layout): Initialize increase_relro_.
3088         (Layout::get_output_section): Add is_relro, is_last_relro, and
3089         is_first_non_relro parameters.  Change all callers.
3090         (Layout::choose_output_section): Likewise.
3091         (Layout::add_output_section_data): Likewise.
3092         (Layout::make_output_section): Likewise.
3093         (Layout::set_segment_offsets): Clear increase_relro when using a
3094         linker script.
3095         * layout.h (class Layout): Add increase_relro method.  Add
3096         increase_relro_ field.  Update declarations.
3097         * output.cc (Output_section::Output_section): Initialize
3098         is_last_relro_ and is_first_non_relro_.
3099         (Output_segment::add_output_section): Group relro sections is
3100         do_sort is true.  Handle is_last_relro and is_first_non_relro.
3101         (Output_segment::maximum_alignment): Remove relro handling.
3102         (Output_segment::set_section_addresses): Add increase_relro
3103         parameter.  Change all callers.  Add initial alignment to align
3104         relro sections on separate page.  Remove old relro handling.
3105         (Output_segment::set_section_list_addresses): Remove in_relro
3106         parameter.  Change all callers.
3107         (Output_segment::set_offset): Add increase parameter.  Change all
3108         callers.  Remove old relro handling.
3109         * output.h (class Output_section): Add new methods: is_last_relro,
3110         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
3111         Add is_last_relro_ and is_first_non_relro_ fields.
3112         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
3113         Create separate .got.plt section.  Call increase_relro.
3114         * x86_64.cc (Target_x86_64::got_section): Likewise.
3115         * testsuite/relro_script_test.t: Add .got.plt.
3117         PR 10450
3118         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
3119         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
3120         (Layout::finalize): Call set_dynamic_symbol_size.
3121         (Layout::set_dynamic_symbol_size): New function.
3122         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
3123         set_dynamic_symbol_size.
3125         PR 10450
3126         * output.h (class Output_section): Add is_entsize_zero_ field.
3127         * output.cc (Output_section::Output_section): Initialize
3128         is_entsize_zero_.
3129         (Output_section::set_entsize): If two different entsizes are
3130         requested, force it to zero.
3131         (Output_section::add_input_section): Set flags for .debug_str
3132         before updating section flags.  Set entsize.
3133         (Output_section::update_flags_for_input_section): Set SHF_MERGE
3134         and SHF_STRING if all input sections have those flags.
3136 2009-12-29   Rafael Espindola  <espindola@google.com>
3138         * main.cc (main): Fix the sys time reporting.
3139         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
3140         reporting.
3142 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
3144         * options.cc (General_options::parse_version): Allow -v to exit
3145         without an error if there is nothing to link.
3147 2009-12-29  Ian Lance Taylor  <iant@google.com>
3149         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
3150         using a version of gcc before 4.1.
3151         * configure: Rebuild.
3153 2009-12-28  Chris Demetriou  <cgd@google.com>
3155         * attributes.cc (Output_attributes_section_data::do_write): Use
3156         std::vector::front rather than std::vector::data.
3158 2009-12-28  Ian Lance Taylor  <iant@google.com>
3160         * symtab.h (class Symbol_table): Add enum Defined.
3161         * resolve.cc (Symbol_table::should_override): Add defined
3162         parameter.  Change all callers.  Test whether object is NULL
3163         before calling a method on it.
3164         (Symbol_table::report_resolve_problem): Add defined parameter.
3165         Change all callers.
3166         (Symbol_table::should_override_with_special): Likewise.
3167         * symtab.cc (Symbol_table::define_in_output_data): Add defined
3168         parameter.  Change all callers.
3169         (Symbol_table::do_define_in_output_data): Likewise.
3170         (Symbol_table::define_in_output_segment): Likewise.
3171         (Symbol_table::do_define_in_output_segment): Likewise.
3172         (Symbol_table::define_as_constant): Likewise.
3173         (Symbol_table::do_define_as_constant): Likewise.
3174         * script.h (class Symbol_assignment): Add is_defsym parameter to
3175         constructor; change all callers.
3176         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
3177         parameter.  Change all callers.  Add is_defsym_ field.
3178         (class Parser_closure): Add parsing_defsym parameter to
3179         constructor; change all callers.  Add parsing_defsym accessor
3180         function.  Add parsing_defsym_ field.
3182 2009-12-28  Ian Lance Taylor  <iant@google.com>
3184         * gold.cc (queue_middle_tasks): Fix formatting.
3185         * object.cc (Relobj::is_section_name_included): Likewise.
3187 2009-12-23  Ian Lance Taylor  <iant@google.com>
3189         * i386.cc (Target_i386::do_calls_non_split): Recognize
3190         -fsplit-stack prologue for a function with a static chain.
3191         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
3192         -fsplit-stack prologue when using %r11.
3194 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
3196         * options.cc (General_options::parse_version): Make -v continue and do
3197         the link like GNU ld does.
3199 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
3201         * Makefile.am (CCFILES): Add timer.cc.
3202         (HFILES): Add timer.h.
3203         * configure.ac: Check for sysconf and times.
3204         * main.cc: include timer.h.
3205         (main): Use Timer instead of get_run_time.
3206         * timer.cc: New.
3207         * timer.h: New.
3208         * workqueue.cc: include timer.h.
3209         (Workqueue::find_and_run_task):
3210         Report user, sys and wall time.
3211         * Makefile.in: Regenerate.
3212         * config.in: Regenerate.
3213         * configure: Regenerate.
3215 2009-12-16  Doug Kwan  <dougkwan@google.com>
3217         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
3218         sections.
3219         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
3220         relaxed input sections.
3221         * output.cc (Output_section::find_relaxed_input_section): Change
3222         return type to Output_relaxed_input_section pointer.  Adjust code
3223         for new type of relaxed_input_section_map_.
3224         * output.h (Output_section::find_relaxed_input_section): Change
3225         return type to Output_relaxed_input_section pointer.
3226         (Output_section::Output_relaxed_input_section_by_input_section_map):
3227         New type.
3228         (Output_section::relaxed_input_section_map_): Change type to
3229         Output_section::Output_relaxed_input_section_by_input_section_map.
3230         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
3231         input section.
3233 2009-12-15  Ian Lance Taylor  <iant@google.com>
3235         * layout.cc (Layout::create_shstrtab): Only write out after input
3236         sections if we are compressing debug sections.
3238 2009-12-15  Ian Lance Taylor  <iant@google.com>
3240         * archive.cc (Archive::add_symbols): Only look up a symbol without
3241         a version if there is, in fact, a version.
3243 2009-12-14  Ian Lance Taylor  <iant@google.com>
3245         Revert -Wshadow changes, all changes from:
3246         2009-12-11  Doug Kwan  <dougkwan@google.com>
3247         2009-12-11  Nick Clifton  <nickc@redhat.com>
3248         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
3250 2009-12-11  Doug Kwan  <dougkwan@google.com>
3252         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
3253         due to -Wshadow.
3254         * attributes.cc (Object_attribute::size): Ditto.
3255         (Attributes_section_data::size): Ditto.
3256         (Attributes_section_data::Attributes_section_data): Ditto.
3257         (Output_attributes_section_data::do_write): Ditto.
3258         * attributes.h (Object_attribute::set_type): Ditto.
3259         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
3261 2009-12-11  Nick Clifton  <nickc@redhat.com>
3263         * archive.cc: Fix shadowed variable warnings.
3264         * arm.cc: Likewise.
3265         * compressed_output.cc: Likewise.
3266         * compressed_output.h: Likewise.
3267         * configure: Likewise.
3268         * dwarf_reader.cc: Likewise.
3269         * dynobj.cc: Likewise.
3270         * dynobj.h: Likewise.
3271         * ehframe.cc: Likewise.
3272         * ehframe.h: Likewise.
3273         * errors.cc: Likewise.
3274         * expression.cc: Likewise.
3275         * fileread.cc: Likewise.
3276         * fileread.h: Likewise.
3277         * freebsd.h: Likewise.
3278         * i386.cc: Likewise.
3279         * icf.cc: Likewise.
3280         * incremental.h: Likewise.
3281         * layout.cc: Likewise.
3282         * layout.h: Likewise.
3283         * mapfile.cc: Likewise.
3284         * merge.cc: Likewise.
3285         * merge.h: Likewise.
3286         * object.cc: Likewise.
3287         * object.h: Likewise.
3288         * options.h: Likewise.
3289         * output.cc: Likewise.
3290         * output.h: Likewise.
3291         * parameters.cc: Likewise.
3292         * plugin.cc: Likewise.
3293         * powerpc.cc: Likewise.
3294         * reduced_debug_output.cc: Likewise.
3295         * reduced_debug_output.h: Likewise.
3296         * reloc.cc: Likewise.
3297         * reloc.h: Likewise.
3298         * resolve.cc: Likewise.
3299         * script-sections.cc: Likewise.
3300         * script.cc: Likewise.
3301         * script.h: Likewise.
3302         * sparc.cc: Likewise.
3303         * symtab.cc: Likewise.
3304         * symtab.h: Likewise.
3305         * target-select.cc: Likewise.
3306         * target-select.h: Likewise.
3307         * token.h: Likewise.
3308         * workqueue.cc: Likewise.
3309         * workqueue.h: Likewise.
3310         * x86_64.cc: Likewise.
3312 2009-12-10  Doug Kwan  <dougkwan@google.com>
3314         * arm.cc (attributes.h): New include.
3315         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
3316         (Arm_relobj::~Arm_relobj): Delete object pointed by
3317         attributes_section_data_.
3318         (Arm_relobj::attributes_section_data): New method definition.
3319         (Arm_relobj::attributes_section_data_): New data member declaration.
3320         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
3321         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
3322         attributes_section_data_.
3323         (Arm_dynobj::attributes_section_data): New method definition.
3324         (Arm_dynobj::attributes_section_data_): New data member declaration.
3325         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
3326         initialization value of may_use_blx_ to false.
3327         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
3328         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
3329         object attributes to compute results instead of hard-coding.
3330         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
3331         Target_arm::get_secondary_compatible_arch,
3332         Target_arm::set_secondary_compatible_arch
3333         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3334         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
3335         New method declarations.
3336         (Target_arm::get_aeabi_object_attribute): New method definition.
3337         (Target_arm::attributes_section_data_): New data member declaration.
3338         (read_arm_attributes_section): New template definition.
3339         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
3340         (Arm_dynobj::do_read_symbols): Ditto.
3341         (Target_arm::do_finalize_sections): Merge attributes sections from
3342         input.  Check for BLX use after attributes section merging.
3343         Fix __exidx_start and __exidx_end visibility.  Create an
3344         .ARM.attributes section if necessary.
3345         (Target_arm::get_secondary_compatible_arch,
3346         Target_arm::set_secondary_compatible_arch,
3347         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3348         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
3349         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
3350         New method definitions.
3352 2009-12-09  Ian Lance Taylor  <iant@google.com>
3354         * plugin.cc (Plugin::load): Don't cast from void* to a function
3355         pointer.
3357 2009-12-09  Ian Lance Taylor  <iant@google.com>
3359         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
3360         information fields.
3362 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
3364         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
3365         Replace two_file_shared_1.so with two_file_shared_2.so.
3366         * testsuite/Makefile.in: Regenerated.
3368 2009-12-08  Doug Kwan  <dougkwan@google.com>
3370         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
3371         (HFILES): Add attributes.h and int_encoding.h.
3372         * Makefile.in: Regenerate.
3373         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
3374         function definitions to int_encoding.cc
3375         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
3376         prototypes to int_encoding.h
3377         * reduced_debug_output.cc (int_encoding.h): New include.
3378         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
3379         function definitions to int_encoding.cc
3380         (insert_into_vector, read_from_pointer): Move template definitions to
3381         int_encoding.h
3382         * attributes.cc: New file.
3383         * attributes.h: New file.
3384         * int_encoding.cc: New file.
3385         * int_encoding.h: New file.
3387 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
3389         PR gold/11055
3390         * incremental-dump.cc (dump_incremental_inputs): New.
3391         (main): Use dump_incremental_inputs.
3393 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
3395         PR gold/10893
3396         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
3397         checking elfcpp::STT_FUNC.
3398         (Target_i386::Relocate::relocate): Likewise.
3399         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3401         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
3402         symbols from shared libraries into normal FUNC symbols.
3404         * symtab.h (Symbol): Add is_func and use it.
3406 2009-12-05  Doug Kwan  <dougkwan@google.com>
3408         * arm.cc (Target_arm::arm_info): Initialize new fields
3409         attributes_section and attributes_vendor.
3410         * i386.cc (Target_i386::i386_info): Same.
3411         * object.cc (Sized_relobj::do_layout): Skip attribute section.
3412         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
3413         fields attributes_section and attributes_vendor.
3414         * sparc.cc (Target_sparc::sparc_info): Same.
3415         * target.h (Target::attributes_section, Target::attributes_vendor,
3416         Target::is_attributes_section, Target::attribute_arg_type,
3417         Target::attributes_order): New method definitions.
3418         (Target::Target_info::attributes_section,
3419         Target::Target_info::attributes_vendor): New fields.
3420         (Target::do_attribute_arg_type, Target::do_attributes_order): New
3421         virtual method definitions.
3422         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
3423         attributes_section and attributes_vendor.
3424         * testsuite/testfile.cc (Target_test::test_target_info): Same.
3426 2009-12-05  Doug Kwan  <dougkwan@google.com>
3428         * arm.cc: Update comments about interworking and stub generation.
3429         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
3430         considered as non-PIC.
3431         (Arm_relocate_functions::base_abs): Fix formatting.
3432         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
3433         of function to use GOT entry address instead of offset.
3434         (Target_arm::Scan::global): Issue an error if a symbol would need a
3435         PLT does not get one because it is untyped.  Remove code to create
3436         dynamic symbols for relative branches.
3437         (Target_arm::Relocate::relocate: Use 0 instead of false since function
3438         takes unsigned integer instead of boolean.
3440 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
3442         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
3443         (two_file_test_LDADD): Likewise.
3444         (common_test_1_LDADD): Likewise.
3445         (exception_test_LDADD) Likewise.
3446         (weak_test_LDADD): Likewise.
3447         (many_sections_test_LDADD): Likewise.
3448         (initpri1_LDADD): Likewise.
3449         (script_test_1_LDADD): Likewise.
3450         (script_test_2_LDADD): Likewise.
3451         (justsyms_LDADD): Likewise.
3452         (binary_test_LDADD): Likewise.
3453         (large_LDADD): Likewise.
3454         * testsuite/Makefile.in: Regenerated.
3456 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
3458         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
3459         (Symbol_table::override_with_special): Likewise.
3460         (Symbol_table::add_from_object): Likewise.
3462 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
3464         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3465         Don't set the data_offset twice.
3467 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
3469         * testsuite/Makefile.in: Regenerate.
3471 2009-12-03  Doug Kwan  <dougkwan@google.com>
3473         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
3474         (Target_arm::do_finalize_sections): Add parameter for symbol table
3475         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
3476         * i386.cc (Target_i386::do_finalize_sections): Add an additional
3477         parameter for symbol table pointer.
3478         * layout.cc (Layout::finalize): Call Target::finalize_sections with
3479         an additional parameter for a pointer to symbol table.
3480         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
3481         parameter for a symbol table pointer.
3482         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
3483         * target.h (Target::finalize_sections, Target::do_finalize_sections):
3484         Ditto.
3485         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
3486         parameter for a symbol table pointer.
3488 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
3490         * incremental.cc (Incremental_inputs_header)
3491         (Incremental_inputs_header_write, Incremental_inputs_entry)
3492         (Incremental_inputs_entry_write): Move ...
3493         * incremental.h (Incremental_inputs_header)
3494         (Incremental_inputs_header_write, Incremental_inputs_entry)
3495         (Incremental_inputs_entry_write): here.
3497 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3499         * incremental.cc (make_sized_incremental_binary): Set the target.
3500         Error if it is incompatible.
3501         * output.h (Output_file): Add filename method.
3503 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3505         * incremental.cc (Incremental_inputs_entry): Remove unused argument
3506         from the get_* methods.
3508 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3510         * incremental-dump.cc (main): Check that the offeset of a script is 0.
3511         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3512         Write 0 for the data_offset of scripts.
3514 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
3516         * testsuite/Makefile.am: Add the incremental_test.sh test.
3517         * testsuite/incremental_test.sh: New.
3518         * testsuite/incremental_test_1.c: New.
3519         * testsuite/incremental_test_2.c: New.
3521 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
3523        * incremental-dump.cc (main): Fix typos.
3525 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
3527         PR gold/11025
3528         * incremental-dump.cc (main): Use llu to print 64 bit values.
3530 2009-11-26  Per Ã˜yvind Karlsen <peroyvind@mandriva.org>
3531             H.J. Lu  <hongjiu.lu@intel.com>
3533         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
3534         $(LIBDL).
3535         (incremental_dump_LDADD): Likewise.
3536         * Makefile.in: Regenerated.
3538 2009-11-25  Doug Kwan  <dougkwan@google.com>
3540         Revert:
3542         2009-11-25  Doug Kwan  <dougkwan@google.com>
3544                 * arm.cc (Target_arm::Target_arm): Move method definition
3545                 outside of class definition.  Add code to handle
3546                 --target1-rel, --target1-abs and --target2= options.
3547                 (Target_arm::get_reloc_reloc_type): Change method to be
3548                 non-static and const.
3549                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
3550                 New data member declaration.
3551                 (Target_arm::Scan::local, Target_arm::Scan::global,
3552                 Target_arm::Relocate::relocate,
3553                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3554                 Adjust call to Target_arm::get_real_reloc_type.
3555                 (Target_arm::get_real_reloc_type): Use command line options
3556                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3557                 * options.h (--target1-rel, --target1-abs, --target2): New
3558                 ARM-only options.
3560 2009-11-25  Doug Kwan  <dougkwan@google.com>
3562         * arm.cc (Target_arm::Target_arm): Move method definition outside of
3563         class definition.  Add code to handle --target1-rel, --target1-abs
3564         and --target2= options.
3565         (Target_arm::get_reloc_reloc_type): Change method to be non-static
3566         and const.
3567         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
3568         member declaration.
3569         (Target_arm::Scan::local, Target_arm::Scan::global,
3570         Target_arm::Relocate::relocate,
3571         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
3572         call to Target_arm::get_real_reloc_type.
3573         (Target_arm::get_real_reloc_type): Use command line options to
3574         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3575         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
3576         options.
3578 2009-11-25  Doug Kwan  <dougkwan@google.com>
3580         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
3581         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
3582         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
3583         formatting.
3584         (Arm_relocate_functions::thm_call): Replace body with a call to
3585         Arm_relocate_functions::thumb_branch_common.
3586         (Arm_relocate_functions::thm_jump24,
3587         Arm_relocate_functions::thm_xpc22): New method definitions.
3588         (Arm_relocate_functions::thumb_branch_common): New method definition.
3589         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
3590         operator.
3591         (Target_arm::Relocate::relocate): Adjust call to thm_call.
3592         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
3594 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
3596         * Makefile.am: Build incremental-dump
3597         * Makefile.in: Regenerate.
3598         * incremental-dump.cc: New.
3599         * incremental.cc (Incremental_inputs_header_data,
3600         Incremental_inputs_entry_data): Move to incremental.h
3601         * incremental.h: (Incremental_inputs_header_data,
3602         Incremental_inputs_entry_data): Move from incremental.cc
3604 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
3606         * incremental.cc (Incremental_inputs_header,
3607         Incremental_inputs_header_write, Incremental_inputs_entry,
3608         Incremental_inputs_entry_write): Add a typedef with the data type.
3610 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
3612         * incremental.cc (Incremental_inputs_header,
3613         Incremental_inputs_header_write, Incremental_inputs_entry,
3614         Incremental_inputs_entry_write): Update comment about which
3615         type has the filed descriptions.
3617 2009-11-15  Doug Kwan  <dougkwan@google.com>
3619         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
3620         (Arm_relocate_functions::arm_branch_common): Change method defintion
3621         in class definition to a method declaration and update list of formal
3622         parameters.
3623         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
3624         Arm_relocation_functions::jump24): Adjust call to
3625         Arm_relocate_functions::arm_branch_common.  Update list of formal
3626         parameters.
3627         (Arm_relocate_functions::xpc25): New method definition.
3628         (Arm_relocate_functions::arm_branch_common): Move method defintion
3629         out from class definition.  Use stubs for mode-switching and extending
3630         branch ranges.
3631         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
3632         specially.  Change code to enable use of stubs in ARM branches.
3634 2009-11-10  Doug Kwan  <dougkwan@google.com>
3636         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
3637         in method declaration.
3638         (Target_arm::relocate_stub): New method declaration.
3639         (Target_arm::default_target): Change to return a pointer instead of
3640         a const reference.
3641         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
3642         Target_arm::default_target.
3643         (Arm_Relobj::do_relocate_sections): Remove options paramater in
3644         method definition.
3645         (Target_arm::relocate_section): Adjust view.
3646         (Target_arm::relocate_stub): New method definition.
3648 2009-11-10  Doug Kwan  <dougkwan@google.com>
3650         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
3651         a format warning.
3652         * incremental.cc (open_incremental_binary): Initialized local
3653         variables to avoid warnings.
3654         * object.cc (make_elf_object): Ditto.
3655         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
3656         a format warning.
3658 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
3660         PR gold/10930
3661         * testsuite/plugin_test.c: Include "config.h".
3663 2009-11-09  Doug Kwan  <dougkwan@google.com>
3665         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
3666         (arm_symbol_value): Remove.
3667         (Arm_relocate_functions::arm_branch_common,
3668         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
3669         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
3670         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
3671         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
3672         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
3673         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
3674         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
3675         Arm_relocate_functions::thm_mobw_abs_nc,
3676         Arm_relocate_functions::thm_mov_abs,
3677         Arm_relocate_functions::movw_prel_nc,
3678         Arm_relocate_functions::thm_movt_abs,
3679         Arm_relocate_functions::movt_prel,
3680         Arm_relocate_functions::thm_movw_prel_nc,
3681         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
3682         (Target_arm::Relocate::relocate): Only decompose address into two
3683         parts if relocation type uses the thumb-bit and pass the actual
3684         bit instead of a flag indicating that the thumb-bit is used.  Adjust
3685         calls to methods in Arm_relocate_functions for this change.
3687 2009-11-08  Ian Lance Taylor  <iant@google.com>
3689         PR 10925
3690         * reloc.cc: Instantiate
3691         Sized_relobj::initialize_input_to_output_maps and
3692         Sized_relobj:free_input_to_output_maps.
3694 2009-11-06  Ian Lance Taylor  <iant@google.com>
3696         PR 10876
3697         * defstd.cc (in_segment): Set only_if_ref true for "end".
3699 2009-11-06  Doug Kwan  <dougkwan@google.com>
3701         * arm.cc (class Reloc_stub): Correct a comment.
3702         (Target_arm::Target_arm): Initialize arm_input_section_map_.
3703         (Target_arm::scan_section_for_stubs): New method declaration.
3704         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
3705         Change methods from private to protected.
3706         (Target_arm::do_may_relax): New method definition.
3707         (Target_arm::do_relax, Target_arm::group_sections,
3708         Target_arm::scan_reloc_for_stub,
3709         Target_arm::scan_reloc_section_for_stubs): New method declarations.
3710         (Target_arm::arm_input_section_map_): New data member declaration.
3711         (Target_arm::scan_reloc_for_stub,
3712         Target_arm::scan_reloc_section_for_stubs,
3713         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
3714         Target_arm::do_relax): New method definitions.
3716 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
3718         * configure.ac: Check for (struct stat)::st_mtim
3719         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
3720         * config.in: Regenerate.
3721         * configure: Regenerate.
3723 2009-11-05  Ian Lance Taylor  <iant@google.com>
3725         PR 10910
3726         * output.cc (Output_segment::add_output_section): Add missing
3727         return statement.
3729 2009-11-04  Ian Lance Taylor  <iant@google.com>
3731         PR 10880
3732         * object.h (class Object): Add is_needed and set_is_needed
3733         methods.  Add is_needed_ field.  Make bool fields into bitfields.
3734         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
3735         defined in a dynamic object and referenced by a regular object,
3736         set is_needed for the dynamic object.
3737         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
3738         if the file is marked with as_needed and it is not needed.
3740 2009-11-04  Ian Lance Taylor  <iant@google.com>
3742         PR 10887
3743         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
3744         tags if data is discarded by linker script.
3745         * i386.cc (Target_i386::do_finalize_sections): Likewise.
3746         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3747         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3748         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3750 2009-11-04  Ian Lance Taylor  <iant@google.com>
3752         * layout.cc (Layout::get_output_section): Add is_interp and
3753         is_dynamic_linker_section parameters.  Change all callers.
3754         (Layout::choose_output_section): Likewise.
3755         (Layout::make_output_section): Likewise.
3756         (Layout::add_output_section_data): Add is_dynamic_linker_section
3757         parameter.  Change all callers.
3758         * layout.h (class Layout): Update declarations.
3759         * output.h (class Output_section): Add is_interp, set_is_interp,
3760         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
3761         Add is_interp_, is_dynamic_linker_section_ fields.  Change
3762         generate_code_fills_at_write_ to a bitfield.
3763         * output.cc (Output_section::Output_sections): Initialize new
3764         fields.
3765         (Output_segment::add_output_section): Add do_sort parameter.
3766         Change all callers.
3768 2009-11-03  Ian Lance Taylor  <iant@google.com>
3770         PR 10860
3771         * options.h (class General_options): Add --warn-common.
3772         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
3773         merging two common symbols.
3774         (Symbol_table::should_override): Handle --warn-common when merging
3775         a common symbol with a defined symbol.  Use report_resolve_problem
3776         for multiple definitions.
3777         (Symbol_table::report_resolve_problem): New function.
3778         * symtab.h (class Symbol_table): Declare report_resolve_problem.
3780 2009-11-03  Doug Kwan  <dougkwan@google.com>
3782         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
3783         stub_factory_.
3784         (Target_arm::stub_factory): New method definition.
3785         (Target_arm::new_arm_input_section,
3786         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
3787         Target_arm::reloc_uses_thumb_bit): New method declarations.
3788         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
3789         New type definitions.
3790         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
3791         member declarations.
3792         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
3793         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
3794         New method definitions.
3796 2009-11-03  Ian Lance Taylor  <iant@google.com>
3798         * options.h (class General_options): Add --warn_constructors.
3800 2009-11-03  Ian Lance Taylor  <iant@google.com>
3802         PR 10893
3803         * defstd.cc (in_section): Add entries for __rel_iplt_start,
3804         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
3806 2009-11-03  Ian Lance Taylor  <iant@google.com>
3808         PR 10895
3809         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
3810         --msgid-bugs-address.
3811         (install-pdf): New target.
3812         (install-data_yes): Look up one directory to find mkinstalldirs.
3814 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
3816         * po/Make-in (.po.gmo): Don't generate .gmo files in source
3817         tree.
3819 2009-10-30  Doug Kwan  <dougkwan@google.com>
3821         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
3823 2009-10-30  Doug Kwan  <dougkwan@google.com>
3825         * arm.cc (Stub_addend_reader): New struct template definition
3826         and partial specializations.
3827         (Stub_addend_reader::operator()): New method definition for a
3828         partially specialized template.
3830 2009-10-30  Doug Kwan  <dougkwan@google.com>
3832         * arm.cc (Arm_relobj::processor_specific_flags): New method
3833         definition.
3834         (Arm_relobj::do_read_symbols): New method declaration.
3835         (Arm_relobj::processor_specific_flags_): New data member declaration.
3836         (Arm_dynobj): New class definition.
3837         (Target_arm::do_finalize_sections): Add input_objects parameter.
3838         (Target_arm::do_adjust_elf_header): New method declaration.
3839         (Target_arm::are_eabi_versions_compatible,
3840         (Target_arm::merge_processor_specific_flags): New method declaration.
3841         (Target_arm::do_make_elf_object): New overloaded method definitions
3842         and declaration.
3843         (Arm_relobj::do_read_symbols): New method definition.
3844         (Arm_dynobj::do_read_symbols): Ditto.
3845         (Target_arm::do_finalize_sections): Add input_objects parameters.
3846         Merge processor-specific flags from all input objects.
3847         (Target_arm::are_eabi_versions_compatible,
3848         Target_arm::merge_processor_specific_flags,
3849         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
3850         New method definitions.
3851         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
3852         Input_objects pointer type parameter.
3853         * layout.cc (Layout::finalize): Pass input objects to target's.
3854         finalize_sections function.
3855         * output.cc (Output_file_header::do_sized_write): Set ELF file
3856         header's processor-specific flags.
3857         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
3858         Input_objects pointer type parameter.
3859         * sparc.cc (Target_sparc::do_finalize_sections): Same.
3860         * target.h (Input_objects): New forward class declaration.
3861         (Target::processor_specific_flags,
3862         Target::are_processor_specific_flags_sect): New method definitions.
3863         (Target::finalize_sections): Add input_objects parameter.
3864         (Target::Target): Initialize processor_specific_flags_ and
3865         are_processor_specific_flags_set_.
3866         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
3867         parameter.
3868         (Target::set_processor_specific_flags): New method definition.
3869         (Target::processor_specific_flags_,
3870         Target::are_processor_specific_flags_set_): New data member
3871         declarations.
3872         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
3873         Input_objects pointer type parameter.
3875 2009-10-30  Doug Kwan  <dougkwan@google.com>
3877         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
3879 2009-10-28  Ian Lance Taylor  <iant@google.com>
3881         * object.h (class Relobj): Drop options parameter from
3882         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
3883         do_scan_relocs, do_relocate.  Change all callers.
3884         (class Sized_relobj): Drop options parameters from
3885         do_gc_process_relocs, do_scan_relocs, do_relocate,
3886         do_relocate_sections, relocate_sections, emit_relocs_scan,
3887         emit_relocs_scan_reltype.  Change all callers.
3888         (struct Relocate_info): Remove options field and all references to
3889         it.
3890         * reloc.h (class Read_relocs): Remove options constructor
3891         parameter and options_ field.  Change all callers.
3892         (class Gc_process_relocs, class Scan_relocs): Likewise.
3893         (class Relocate_task): Likewise.
3894         * target-reloc.h (scan_relocs): Remove options parameter.  Change
3895         all callers.
3896         (scan_relocatable_relocs): Likewise.
3897         * target.h (class Sized_target): Remove options parameter from
3898         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
3899         all callers.
3900         * gc.h (gc_process_relocs): Remove options parameter.  Change all
3901         callers.
3902         * arm.cc: Update functions to remove options parameters.
3903         * i386.cc: Likewise.
3904         * powerpc.cc: Likewise.
3905         * sparc.cc: Likewise.
3906         * x86_64.cc: Likewise.
3907         * testsuite/testfile.cc: Likewise.
3909 2009-10-28  Doug Kwan  <dougkwan@google.com>
3911         * arm.cc (Arm_relobj): New class definition.
3912         (Arm_relobj::scan_sections_for_stubs,
3913         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
3914         New method definitions.
3916 2009-10-28  Cary Coutant  <ccoutant@google.com>
3918         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
3919         (Plugin::cleanup_done_): New member.
3920         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
3921         (Plugin_manager::cleanup_done_): Remove.
3922         (Plugin_manager::add_input_file): Edit error message.
3923         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
3924         (Plugin_manager::cleanup): Remove use of cleanup_done_.
3926 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
3928         * fileread.cc: (File_read::View::~View): Use the new
3929         data_ownership_ filed.
3930         (File_read::~File_read): Dispose the new whole_file_view_.
3931         (File_read::open): Mmap the whole file if needed.
3932         (File_read::open): Use whole_file_view_ instead of contents_.
3933         (File_read::find_view): Use whole_file_view_ if applicable.
3934         (File_read::do_read): Use whole_file_view_ instead of contents_.
3935         (File_read::make_view): Use whole_file_view_ instead of contents_,
3936         update File_read::View::View call.
3937         (File_read::find_or_make_view): Update File_read::View::View
3938         call.
3939         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
3940         remove contents_
3941         (File_read::View::Data_ownership): New enum.
3942         (File_read::View::View): Replace bool mapped_ with Data_ownership
3943         argument.
3944         (File_read::View::mapped_): Remove (replaced by data_ownership_).
3945         (File_read::View::data_ownership_): New field.
3946         (File_read::contents_): Remove (replaced by whole_file_view_).
3947         (File_read::whole_file_view_): New field.
3948         * options.h (class General_options): Add --keep-files-mapped.
3950 2009-10-27  Cary Coutant  <ccoutant@google.com>
3952         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
3953         * testsuite/Makefile.am (plugin_test_5): New test case.
3954         * testsuite/Makefile.in: Regenerate.
3956 2009-10-25  Doug Kwan  <dougkwan@google.com>
3958         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
3959         from private to protected to allow access by child class.
3960         (Sized_relobj::do_relocate_sections): New method declaration.
3961         (Sized_relobj::relocate_sections): Virtualize.
3962         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
3963         Sized_relobj::relocate_sections.  Instantiate template explicitly
3964         for different target sizes and endianity.
3966 2009-10-24  Doug Kwan  <dougkwan@google.com>
3968         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
3969         (Arm_input_section::as_arm_input_section): New method.
3970         (Arm_output_section): New class definition.
3971         (Arm_output_section::create_stub_group,
3972         Arm_output_section::group_sections): New method definitions.
3974 2009-10-22  Doug Kwan  <dougkwan@google.com>
3976         * arm.cc (Arm_input_section): New class definition.
3977         (Arm_input_section::init, Arm_input_section:do_write,
3978         Arm_input_section::set_final_data_size,
3979         Arm_input_section::do_reset_address_and_file_offset): New method
3980         definitions.
3982 2009-10-21  Doug Kwan  <dougkwan@google.com>
3984         * arm.cc (Stub_table, Arm_input_section): New forward class
3985         declarations.
3986         (Stub_table): New class defintion.
3987         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
3988         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
3989         New method definition.
3991 2009-10-21  Doug Kwan  <dougkwan@google.com>
3993         * arm.cc: Update copyright comments.
3994         (Target_arm): New forward class template declaration.
3995         (Arm_address): New type.
3996         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
3997         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
3998         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
3999         constants.
4000         (Insn_template): Same.
4001         (DEF_STUBS): New macro.
4002         (Stub_type): New enum type.
4003         (Stub_template): New class definition.
4004         (Stub): Same.
4005         (Reloc_stub): Same.
4006         (Stub_factory): Same.
4007         (Target_arm::Target_arm): Initialize may_use_blx_ and
4008         should_force_pic_veneer_.
4009         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
4010         Target_arm::should_force_pic_veneer,
4011         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
4012         Target_arm::using_thumb_only, Target_arm:;default_target): New
4013         method defintions.
4014         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
4015         New data member declarations.
4016         (Insn_template::size, Insn_template::alignment): New method defintions.
4017         (Stub_template::Stub_template): New method definition.
4018         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
4019         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
4020         (Stub_factory::Stub_factory): New method definition.
4021         * gold.h (string_hash): New template.
4022         * output.h (Input_section_specifier::hash_value): Use
4023         gold::string_hash.
4024         (Input_section_specifier::string_hash): Remove.
4025         * stringpool.cc (Stringpool_template::string_hash): Use
4026         gold::string_hash.
4028 2009-10-20  Doug Kwan  <dougkwan@google.com>
4030         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
4031         symbols of relaxed input sections.
4032         * output.h (Output_section::find_relaxed_input_section): Make
4033         method public.
4035 2009-10-16  Doug Kwan  <dougkwan@google.com>
4037         * dynobj.cc (Versions::Versions): Initialize version_script_.
4038         Only insert base version symbol definition for a shared object
4039         if version script defines any version versions.
4040         (Versions::define_base_version): New method definition.
4041         (Versions::add_def): Check that base version is not needed.
4042         (Versions::add_need): Define base version lazily.
4043         * dynobj.h (Versions::define_base_version): New method declaration.
4044         (Versions::needs_base_version_): New data member declaration.
4045         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
4046         (check_DATA): Add no_version_test.stdout.
4047         (libno_version_test.so, no_version_test.o no_version_test.stdout):
4048         New make rules.
4049         * testsuite/Makefile.in: Regenerate.
4050         * testsuite/no_version_test.c: New file.
4051         * testsuite/no_version_test.sh: Ditto.
4053 2009-10-16  Doug Kwan  <dougkwan@google.com>
4055         * expression.cc (class Segment_start_expression): New class definition.
4056         (Segment_start_expression::value): New method definition.
4057         (script_exp_function_segment_start): Return a new
4058         Segment_start_expression.
4059         * gold/script-c.h (script_saw_segment_start_expression): New function
4060         prototype.
4061         * script-sections.cc (Script_sections::Script_sections): Initialize
4062         SAW_SEGMENT_START_EXPRESSION_ to false.
4063         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
4064         and -Tbbs options to specify section addresses if given in
4065         command line and no SEGMENT_START expression is seen in a script.
4066         * script-sections.h (Script_sections::saw_segment_start_expression,
4067         Script_sections::set_saw_segment_start_expression): New method
4068         definition.
4069         (Script_sections::saw_segment_start_expression_): New data member
4070         declaration.
4071         * script.cc (script_saw_segment_start_expression): New function.
4072         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
4073         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
4074         script_test_7.sh and script_test_8.sh.
4075         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
4076         script_test_8.stdout.
4077         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
4078         (script_test_6, script_test_6.stdout, script_test_7,
4079         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
4080         * Makefile.in: Regenerate.
4081         * testsuite/script_test_6.sh: New file.
4082         * testsuite/script_test_6.t: Same.
4083         * testsuite/script_test_7.sh: Same.
4084         * testsuite/script_test_7.t: Same.
4085         * testsuite/script_test_8.sh: Same.
4087 2009-10-16  Doug Kwan  <dougkwan@google.com>
4089         * output.cc (Output_segment::set_section_list_address): Cast
4090         expressions to unsigned long long type to avoid format warnings.
4092 2009-10-15  Ian Lance Taylor  <iant@google.com>
4094         * script.cc (Script_options::add_symbol_assignment): Always add a
4095         dot assignment to script_sections_.
4096         * script-sections.cc (Script_sections::add_dot_assignment):
4097         Initialize if necessary.
4099         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
4100         program headers with no load segment if there is a linker script.
4102         * layout.cc (Layout::set_segment_offsets): Align the file offset
4103         to the segment aligment for -N or -n with no load segment.
4104         * output.cc (Output_segment::add_output_section): Don't crash if
4105         the first section is a TLS section.
4106         (Output_segment::set_section_list_addresses): Print an error
4107         message if the address moves backward in a linker script.
4108         * script-sections.cc
4109         (Output_section_element_input::set_section_addresses): Don't
4110         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
4111         (Orphan_output_section::set_section_addresses): Likewise.
4113 2009-10-15  Doug Kwan  <dougkwan@google.com>
4115         * layout.cc (Layout::finish_dynamic_section): Generate tags
4116         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
4117         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
4118         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
4120 2009-10-14  Ian Lance Taylor  <iant@google.com>
4122         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
4123         fields.
4124         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
4125         data_shdr fields of relinfo.
4126         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
4127         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
4128         R_386_TLS_LDO_32, adjust based on section flags.
4129         (Target_i386::Relocate::fix_up_ldo): Remove.
4131 2009-10-13  Ian Lance Taylor  <iant@google.com>
4133         Add support for -pie.
4134         * options.h (class General_options): Add -pie and
4135         --pic-executable.
4136         (General_options::output_is_position_independent): Test -pie.
4137         (General_options::output_is_executable): Return true if not shared
4138         and not relocatable.
4139         (General_options::output_is_pie): Remove.
4140         * options.cc (General_options::finalize): Reject incompatible uses
4141         of -pie.
4142         * gold.cc (queue_middle_tasks): A -pie link is not static.
4143         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
4144         * symtab.cc (Symbol::final_value_is_known): Return false if
4145         output_is_position_independent.
4146         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
4147         output_is_position_independent.
4148         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
4149         output_is_position_independent.
4150         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
4151         output_is_position_independent.
4152         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
4153         two_file_pie_test.
4154         (basic_pie_test.o, basic_pie_test): New targets.
4155         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
4156         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
4157         (two_file_pie_test): New target.
4158         * testsuite/Makefile.in: Rebuild.
4159         * README: Remove note saying that -pie is not supported.
4161 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
4163         * options.h (class General_options): Add -init and -fini.
4164         * layout.cc (Layout::finish_dynamic_section): Emit
4165         given init and fini functions.
4167 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
4169         * gc.h (gc_process_relocs): Check if icf is enabled using new
4170         function.
4171         * gold.cc (queue_initial_tasks): Likewise.
4172         (queue_middle_tasks): Likewise.
4173         * object.cc (do_layout): Likewise.
4174         * symtab.cc (is_section_folded): Likewise.
4175         * main.cc (main): Likewise.
4176         * reloc.cc (Read_relocs::run): Likewise.
4177         (Sized_relobj::do_scan_relocs): Likewise.
4178         * icf.cc (is_function_ctor_or_dtor): New function.
4179         (Icf::find_identical_sections): Check if function is ctor or dtor when
4180         safe icf is chosen.
4181         * options.h (General_options::icf): Change option to be an enum.
4182         (Icf_status): New enum.
4183         (icf_enabled): New method.
4184         (icf_safe_folding): New method.
4185         (set_icf_status): New method.
4186         (icf_status_): New variable.
4187         * (options.cc) (General_options::finalize): Set icf_status_.
4188         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
4189         icf_test and icf_keep_unique_test to use the --icf enum flag.
4190         * testsuite/icf_safe_test.sh: New file.
4191         * testsuite/icf_safe_test.cc: New file.
4193 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
4195         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
4196         includes to gc.h and icf.h.
4197         * arm.cc: Include gc.h.
4198         * gold.cc: Likewise.
4199         * i386.cc: Likewise.
4200         * powerpc.cc: Likewise.
4201         * sparc.cc: Likewise.
4202         * x86_64.cc: Likewise.
4203         * gc.h: Include icf.h.
4205 2009-10-11  Ian Lance Taylor  <iant@google.com>
4207         * plugin.cc: Include "gold.h" before other header files.
4209 2009-10-10  Chris Demetriou  <cgd@google.com>
4211         * options.h (Input_file_argument::Input_file_type): New enum.
4212         (Input_file_argument::is_lib_): Replace with...
4213         (Input_file_argument::type_): New member.
4214         (Input_file_argument::Input_file_argument): Take Input_file_type
4215         'type' rather than boolean 'is_lib' as second argument.
4216         (Input_file_argument::is_lib): Use type_.
4217         (Input_file_argument::is_searched_file): New function.
4218         (Input_file_argument::may_need_search): Handle is_searched_file.
4219         * options.cc (General_options::parse_library): Support -l:filename.
4220         (General_options::parse_just_symbols): Update for Input_file_argument
4221         changes.
4222         (Command_line::process): Likewise.
4223         * archive.cc (Archive::get_file_and_offset): Likewise.
4224         * plugin.cc (Plugin_manager::release_input_file): Likewise.
4225         * script.cc (read_script_file, script_add_file): Likewise.
4226         * fileread.cc (Input_file::Input_file): Likewise.
4227         (Input_file::will_search_for): Handle is_searched_file.
4228         (Input_file::open): Likewise.
4229         * readsyms.cc (Read_symbols::get_name): Likewise.
4230         * testsuite/Makefile.am (searched_file_test): New test.
4231         * testsuite/Makefile.in: Regenerate.
4232         * testsuite/searched_file_test.cc: New file.
4233         * testsuite/searched_file_test_lib.cc: New file.
4235 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4236             Ian Lance Taylor  <iant@google.com>
4238         * descriptor.cc: Include <cstdio> and "binary-io.h".
4239         (Descriptors::open): Open the files in binary mode always.
4240         * script.cc (Lex::get_token): Treat \r as whitespace.
4242 2009-10-09  Ian Lance Taylor  <iant@google.com>
4244         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
4246 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4247             Ian Lance Taylor  <iant@google.com>
4249         * configure.ac: Check for readv function also.
4250         * fileread.cc (readv): Define if not HAVE_READV.
4251         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
4252         does not exist.
4253         * config.in: Regenerate.
4254         * configure: Regenerate.
4256 2009-10-09  Doug Kwan  <dougkwan@google.com>
4258         * layout.cc (Layout::make_output_section): Call target hook to make
4259         ordinary output section.
4260         (Layout::finalize): Adjust parameter list of call the
4261         Target::may_relax().
4262         * layout.h (class Layout::section_list): New method.
4263         * merge.h (Output_merge_base::entsize): Change visibility to public.
4264         (Output_merge_base::is_string, Output_merge_base::do_is_string):
4265         New methods.
4266         (Output_merge_string::do_is_string): New method.
4267         * object.cc (Sized_relobj::do_setup): renamed from
4268         Sized_relobj::set_up.
4269         * object.h (Sized_relobj::adjust_shndx,
4270         Sized_relobj::initializ_input_to_output_maps,
4271         Sized_relobj::free_input_to_output_maps): Change visibilities to
4272         protected.
4273         (Sized_relobj::setup): Virtualize.
4274         (Sized_relobj::do_setup): New method declaration.
4275         (Sized_relobj::invalidate_section_offset,
4276         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
4277         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
4278         * options.cc (parse_int): New function.
4279         * options.h (parse_int): New declaration.
4280         (DEFINE_int): New macro.
4281         (stub_group_size): New option.
4282         * output.cc (Output_section::Output_section): Initialize memebers
4283         merge_section_map_, merge_section_by_properties_map_,
4284         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
4285         (Output_section::add_input_section): Handled deferred code-fill
4286         generation and remove an old comment.
4287         (Output_section::add_relaxed_input_section): New method definition.
4288         (Output_section::add_merge_input_section): Use merge section by
4289         properties map to speed to search.  Update merge section maps
4290         as appropriate.
4291         (Output_section::build_relaxation_map): New method definition.
4292         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4293         Same.
4294         (Output_section::relax_input_section): Renamed to
4295         Output_section::convert_input_sections_to_relaxed_sections and change
4296         interface to take a vector of pointers to relaxed sections.
4297         (Output_section::find_merge_section,
4298         Output_section::find_relaxed_input_section): New method definitions.
4299         (Output_section::is_input_address_mapped,
4300         Output_section::output_offset, Output_section::output_address):
4301         Use output section data maps to speed up searching.
4302         (Output_section::find_starting_output_address): Add comments.
4303         (Output_section::do_write,
4304         Output_section::write_to_postprocessing_buffer): Do code-fill
4305         generation as appropriate.
4306         (Output_section::get_input_sections): Invalidate relaxed input section
4307         map.
4308         (Output_section::restore_states): Adjust type of checkpoint .
4309         Invalidate relaxed input section map.
4310         * output.h (Output_merge_base): New class declaration.
4311         (Input_section_specifier): New class defintion.
4312         (class Output_relaxed_input_section) Change base class to
4313         Output_section_data_build.
4314         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
4315         base class initializer.
4316         (Output_section::add_relaxed_input_section): New method declaration.
4317         (Output_section::Input_section): Change visibility to protected.
4318         (Output_section::Input_section::relobj,
4319         Output_section::Input_section::shndx): Handle relaxed input sections.
4320         Output_section::input_sections) Change visibility to protected.  Also
4321         define overload to return a non-const pointer.
4322         (Output_section::Merge_section_properties): New class defintion.
4323         (Output_section::Merge_section_by_properties_map,
4324         Output_section::Output_section_data_by_input_section_map,
4325         Output_section::Relaxation_map): New types.
4326         (Output_section::relax_input_section): Rename method to
4327         Output_section::convert_input_sections_to_relaxed_sections and change
4328         interface to take a vector of relaxed section pointers.
4329         (Output_section::find_merge_section,
4330         Output_section::find_relaxed_input_section,
4331         Output_section::build_relaxation_map,
4332         Output_section::convert_input_sections_in_list_to_relaxed_sections):
4333         New method declarations.
4334         (Output_section::merge_section_map_
4335         Output_section::merge_section_by_properties_map_,
4336         Output_section::relaxed_input_section_map_,
4337         Output_section::is_relaxed_input_section_map_valid_,
4338         Output_section::generate_code_fills_at_write_): New data members.
4339         * script-sections.cc
4340         (Output_section_element_input::set_section_addresses): Call
4341         current_data_size and addralign methods of relaxed input sections.
4342         (Orphan_output_section::set_section_addresses): Call current_data_size
4343         and addralign methods of relaxed input sections.
4344         * symtab.cc (Symbol_table::compute_final_value): Extract template
4345         from the body of Symbol_table::sized_finalize_symbol.
4346         (Symbol_table::sized_finalized_symbol): Call
4347         Symbol_table::compute_final_value.
4348         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
4349         (Symbol_table::compute_final_value): New templated method declaration.
4350         * target.cc (Target::do_make_output_section): New method defintion.
4351         * target.h (Target::make_output_section): New method declaration.
4352         (Target::relax): Add more parameters for input objects, symbol table
4353         and layout.  Adjust call to do_relax.
4354         (Target::do_make_output_section): New method declaration.
4355         (Target::do_relax): Add parameters for input objects, symbol table
4356         and layout.
4358 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4360         * pread.c: Include stdio.h.
4362 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4364         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
4365         defined.
4367 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
4369         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4370         Change read_shndx type to unsigned int.
4371         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4372         int.
4373         (Sized_dwarf_line_info::read_line_mappings): Likewise.
4374         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
4375         Change read_shndx type to unsigned int.
4376         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4377         int.
4378         (Sized_dwarf_line_info::read_line_mappings): Likewise.
4379         * layout.cc (Layout::create_symtab_sections): Cast the result of
4380         local_symcount * symsize to off_t in the gold_assert.
4382 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4384         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
4385         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
4386         R_ARM_BASE_ABS.
4387         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
4388         (Arm_relocate_functions::thm_abs5): New function.
4389         (Arm_relocate_functions::abs12): New function.
4390         (Arm_relocate_functions::abs16): New function.
4391         (Arm_relocate_functions::base_abs): New function.
4392         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
4393         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
4394         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
4395         R_ARM_BASE_ABS.
4396         (Scan::global): Likewise.
4397         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
4398         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
4399         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
4400         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
4401         R_ARM_BASE_ABS.
4403 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4405         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
4406         (Arm_relocate_functions::movt_prel): New function.
4407         (Arm_relocate_functions::thm_movw_prel_nc): New function.
4408         (Arm_relocate_functions::thm_movt_prel): New function.
4409         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
4410         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
4411         (Scan::global, Relocate::relocate): Likewise.
4412         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4414 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
4416         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
4417         Incremental_checker.
4418         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
4419         unsigned int.
4420         (class Incremental_inputs_header): New class.
4421         (Incremental_inputs_header_writer): Edit comment.
4422         (Incremental_inputs_entry): New class.
4423         (Incremental_inputs_entry_writer): Edit comment.
4424         (Sized_incremental_binary::do_find_incremental_inputs_section):
4425         Add *strtab_shndx parameter, fill it.
4426         (Sized_incremental_binary::do_check_inputs): New method.
4427         (Incremental_checker::can_incrementally_link_output_file): Use
4428         Sized_incremental_binary::check_inputs.
4429         (Incremental_inputs::report_command_line): Save command line in
4430         command_line_.
4431         * incremental.h:
4432         (Incremental_binary::find_incremental_inputs_section): New
4433         method.
4434         (Incremental_binary::do_find_incremental_inputs_section): Add
4435         strtab_shndx parameter.
4436         (Incremental_binary::do_check_inputs): New pure virtual method.
4437         (Sized_incremental_binary::do_check_inputs): Declare.
4438         (Incremental_checker::Incremental_checker): Add incremental_inputs
4439         parameter, use it to initialize incremental_inputs_.
4440         (Incremental_checker::incremental_inputs_): New field.
4441         (Incremental_checker::command_line): New method.
4442         (Incremental_checker::inputs): New method.
4443         (Incremental_checker::command_line_): New field.
4445 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
4447         * incremental.cc: Include <cstdarg> and "target-select.h".
4448         (vexplain_no_incremental): New function.
4449         (explain_no_incremental): New function.
4450         (Incremental_binary::error): New method.
4451         (Sized_incremental_binary::do_find_incremental_inputs_section): New
4452         method.
4453         (make_sized_incremental_binary): New function.
4454         (open_incremental_binary): New function.
4455         (can_incrementally_link_file): Add checks if output is ELF and has
4456         inputs section.
4457         * incremental.h: Include "elfcpp_file.h" and "output.h".
4458         (Incremental_binary): New class.
4459         (Sized_incremental_binary): New class.
4460         (open_incremental_binary): Declare.
4461         * object.cc (is_elf_object): Use
4462         elfcpp::Elf_recognizer::is_elf_file.
4463         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
4464         * output.h (Output_file::filesize): New method.
4466 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4468         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
4469         New function.
4470         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
4471         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
4472         function.
4473         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
4474         function.
4475         (Arm_relocate_functions::movw_abs_nc): New function.
4476         (Arm_relocate_functions::movt_abs): New function.
4477         (Arm_relocate_functions::thm_movw_abs_nc): New function.
4478         (Arm_relocate_functions::thm_movt_abs): New function.
4479         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
4480         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
4481         (Scan::global): Likewise.
4482         (Relocate::relocate): Likewise.
4483         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4485 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4487         * arm.cc (Arm_relocate_functions::got_prel) New function.
4488         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
4489         (Relocate::relocate): Likewise.
4490         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4492 2009-10-06  Ian Lance Taylor  <iant@google.com>
4494         * options.h (class General_options): Define
4495         split_stack_adjust_size parameter.
4496         * object.h (class Object): Add uses_split_stack_ and
4497         has_no_split_stack_ fields.  Add uses_split_stack and
4498         has_no_split_stack accessor functions.  Declare
4499         handle_split_stack_section.
4500         (class Reloc_symbol_changes): Define.
4501         (class Sized_relobj): Define Function_offsets.  Declare
4502         split_stack_adjust, split_stack_adjust_reltype, and
4503         find_functions.
4504         * object.cc (Object::handle_split_stack_section): New function.
4505         (Sized_relobj::do_layout): Call handle_split_stack_section.
4506         * dynobj.cc (Sized_dynobj::do_layout): Call
4507         handle_split_stack_section.
4508         * reloc.cc (Sized_relobj::relocate_sections): Call
4509         split_stack_adjust for executable sections in split_stack
4510         objects.  Pass reloc_map to relocate_section.
4511         (Sized_relobj::split_stack_adjust): New function.
4512         (Sized_relobj::split_stack_adjust_reltype): New function.
4513         (Sized_relobj::find_functions): New function.
4514         * target-reloc.h: Include "object.h".
4515         (relocate_section): Add reloc_symbol_changes parameter.  Change
4516         all callers.
4517         * target.h (class Target): Add calls_non_split method.  Declare
4518         do_calls_non_split virtual method.  Declare match_view and
4519         set_view_to_nop.
4520         * target.cc: Include "elfcpp.h".
4521         (Target::do_calls_non_split): New function.
4522         (Target::match_view): New function.
4523         (Target::set_view_to_nop): New function.
4524         * gold.cc (queue_middle_tasks): Give an error if mixing
4525         split-stack and non-split-stack objects with -r.
4526         * i386.cc (Target_i386::relocate_section): Add
4527         reloc_symbol_changes parameter.
4528         (Target_i386::do_calls_non_split): New function.
4529         * x86_64.cc (Target_x86_64::relocate_section): Add
4530         reloc_symbol_changes parameter.
4531         (Target_x86_64::do_calls_non_split): New function.
4532         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
4533         parameter.
4534         * powerpc.cc (Target_powerpc::relocate_section): Add
4535         reloc_symbol_changes parameter.
4536         * sparc.cc (Target_sparc::relocate_section): Add
4537         reloc_symbol_changes parameter.
4538         * configure.ac: Call AM_CONDITIONAL for the default target.
4539         * configure: Rebuild.
4540         * testsuite/Makefile.am (TEST_AS): New variable.
4541         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
4542         (check_DATA): Add split_i386 and split_x86_64 files.
4543         (SPLIT_DEFSYMS): Define.
4544         (split_i386_[1234n].o): New targets.
4545         (split_i386_[124]): New targets.
4546         (split_i386_[1234r].stdout): New targets.
4547         (split_x86_64_[1234n].o): New targets.
4548         (split_x86_64_[124]): New targets.
4549         (split_x86_64_[1234r].stdout): New targets.
4550         (MOSTLYCLEANFILES): Add new executables.
4551         * testsuite/split_i386.sh: New file.
4552         * testsuite/split_x86_64.sh: New file.
4553         * testsuite/split_i386_1.s: New file.
4554         * testsuite/split_i386_2.s: New file.
4555         * testsuite/split_i386_3.s: New file.
4556         * testsuite/split_i386_4.s: New file.
4557         * testsuite/split_i386_n.s: New file.
4558         * testsuite/split_x86_64_1.s: New file.
4559         * testsuite/split_x86_64_2.s: New file.
4560         * testsuite/split_x86_64_3.s: New file.
4561         * testsuite/split_x86_64_4.s: New file.
4562         * testsuite/split_x86_64_n.s: New file.
4563         * testsuite/testfile.cc (Target_test): Update relocation_section
4564         function.
4565         * testsuite/Makefile.in: Rebuild.
4567 2009-10-06  Ian Lance Taylor  <iant@google.com>
4569         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
4570         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
4571         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
4572         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
4573         the address on ldo_addrs_.
4574         (Target_i386::Relocate::fix_up_ldo): New function.
4576 2009-10-06   Rafael Espindola  <espindola@google.com>
4578         * plugin.cc (add_input_library): New.
4579         (Plugin::load): Add add_input_library to tv.
4580         (Plugin_manager::add_input_file): Add the is_lib argument.
4581         (add_input_file): Update call to Plugin_manager::add_input_file.
4582         (add_input_library): New.
4583         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
4585 2009-09-30  Doug Kwan  <dougkwan@google.com>
4587         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
4588         symbol and call Symbol::may_need_copy_reloc to determine if
4589         a copy reloc is needed.
4590         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
4591         nocopyreloc is given in command line.
4592         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
4593         given in command line.
4594         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
4595         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
4596         of the removed Target_i386::may_need_copy_reloc.
4597         * options.h (copyreloc): New option with default value false.
4598         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4599         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
4600         instead of the removed Target_powerpc::may_need_copy_reloc.
4601         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4602         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
4603         instead of the removed Target_sparc::may_need_copy_reloc.
4604         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
4605         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
4606         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
4607         instead of the removed Target_x86_64::may_need_copy_reloc.
4609 2009-09-30  Ian Lance Taylor  <iant@google.com>
4611         * object.h (class Object): Remove target_ field, and target,
4612         sized_target, and set_target methods.
4613         (Object::sized_target): Remove.
4614         (class Sized_relobj): Update declarations.  Remove sized_target.
4615         * object.cc (Sized_relobj::setup): Remove target parameter.
4616         Change all callers.
4617         (Input_objects::add_object): Don't do anything with the target.
4618         (make_elf_sized_object): Add punconfigured parameter.  Change all
4619         callers.  Set or test parameter target.
4620         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
4621         Change all callers.
4622         * parameters.cc (Parameters::set_target): Change parameter type to
4623         be non-const.
4624         (Parameters::default_target): Remove.
4625         (set_parameters_target): Change parameter type to be non-const.
4626         (parameters_force_valid_target): New function.
4627         (parameters_clear_target): New function.
4628         * parameters.h (class Parameters): Update declarations.  Remove
4629         default_target method.  Add sized_target and clear_target
4630         methods.  Change target_ to be non-const.
4631         (set_parameters_target): Update declaration.
4632         (parameters_force_valid_target): Declare.
4633         (parameters_clear_target): Declare.
4634         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
4635         as NULL if we aren't searching.
4636         (Add_symbols::run): Don't check for compatible target.
4637         * fileread.cc (Input_file::open_binary): Call
4638         parameters_force_valid_target.
4639         * gold.cc (queue_middle_tasks): Likewise.
4640         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
4641         set_target on object.
4642         * dynobj.h (class Sized_dynobj): Update declarations.
4643         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
4644         make_elf_object returns NULL.
4645         (Archive::include_member): Don't check whether object target is
4646         compatible.
4647         * output.cc (Output_section::add_input_section): Get target from
4648         parameters.
4649         (Output_section::relax_input_section): Likewise.
4650         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
4651         parameters.
4652         (Sized_relobj::do_scan_relocs): Likewise.
4653         (Sized_relobj::relocate_sections): Likewise.
4654         * resolve.cc (Symbol_table::resolve): Likewise.
4655         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
4656         parameter.  Change all callers.
4657         (Symbol_table::add_from_object): Get target from parameters.
4658         (Symbol_table::add_from_relobj): Don't check object target.
4659         (Symbol_table::add_from_dynobj): Likewise.
4660         (Symbol_table::define_special_symbol): Get target from
4661         parameters.
4662         * symtab.h (class Symbol_table): Update declaration.
4663         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
4664         parameter.  Change all callers.  Clear parameter target.
4665         (Binary_test): Test target here.
4666         * testsuite/object_unittest.cc (gold_testsuite): Remove
4667         target_test_pointer parameter.  Change all callers.
4668         (Object_test): Test target here.
4670 2009-09-26  Ian Lance Taylor  <iant@google.com>
4672         * testsuite/initpri1.c: Don't try to use constructor priorities if
4673         compiling with gcc before 4.3.
4675 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
4677         * testsuite/retain_symbols_file_test.sh (check_present): Change
4678         output file name to retain_symbols_file_test.stdout.
4679         (check_absent): Likewise.
4681 2009-09-18  Craig Silverstein  <csilvers@google.com>
4683         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
4684         * options.cc: Include <cerrno> and <fstream>.
4685         (General_options::finalize): Parse -retain-symbols-file tag.
4686         * options.h: New flag.
4687         (General_options): New method should_retain_symbol, new
4688         variable symbols_to_retain.
4689         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
4690         should_retain_symbol map.
4691         * testsuite/Makefile.am (retain_symbols_file_test): New test.
4692         * testsuite/Makefile.in: Regenerate.
4693         * testsuite/retain_symbols_file_test.sh: New file.
4695 2009-09-18  Nick Clifton  <nickc@redhat.com>
4697         * po/es.po: Updated Spanish translation.
4699 2009-09-17  Doug Kwan  <dougkwan@google.com>
4701         * debug.h (DEBUG_RELAXATION): New constant.
4702         (DEBUG_ALL): Add DEBUG_RELAXATION.
4703         (debug_string_to_enum): Add relaxation debug option.
4704         * layout.cc
4705         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
4706         Layout::Relaxation_debug_check::read_sections,
4707         Layout::Relaxation_debug_check::read_sections): New method definitions.
4708         (Layout::Layout): Initialize data members
4709         record_output_section_data_from_scrips_,
4710         script_output_section_data_list_ and relaxation_debug_check_.
4711         (Layout::save_segments, Layout::restore_segments,
4712         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4713         Layout::relaxation_loop_body): New method definitions.
4714         (Layout::finalize): Support relaxation.  Move section layout code to
4715         Layout::relaxation_loop_body.
4716         (Layout::set_asection_address_from_script): Move code for orphan
4717         section placement out.
4718         (Layout::place_orphan_sections_in_script): New method definition.
4719         * layout.h (Output_segment_headers, Output_file_header):
4720         New forward class declarations.
4721         (Layout::~Layout): Define.
4722         (Layout::new_output_section_data_from_script): New method definition.
4723         (Layout::place_orphan_sections_in_script): New method declaration.
4724         (Layout::Segment_states): New type declaration.
4725         (Layout::save_segments, Layout::restore_segments,
4726         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4727         Layout::relaxation_loop_body): New method declarations.
4728         (Layout::Output_section_data_list): New type declaration.
4729         (Layout::Relaxation_debug_check): New class definition.
4730         (Layout::record_output_section_data_from_script_,
4731         Layout::script_output_section_data_list_, Layout::segment_states_,
4732         Layout::relaxation_debug_check_): New data members.
4733         * output.cc: (Output_section_headers::do_size): New method definition.
4734         (Output_section_headers::Output_section_headers): Move size
4735         computation to Output_section_headers::do_size.
4736         (Output_segment_headers::do_size): New method definition.
4737         (Output_file_header::Output_file_header): Move size computation to
4738         Output_file_header::do_size and call it.
4739         (Output_file_header::do_size): New method definition.
4740         (Output_data_group::Output_data_group): Adjust call to
4741         Output_section_data.
4742         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
4743         (Output_symtab_xindex::do_write): Add array bound check.
4744         (Output_section::Input_section::print_to_mapfile): Handle
4745         RELAXED_INPUT_SECTION_CODE.
4746         (Output_section::Output_section): Initialize data member checkpoint_.
4747         (Output_section::~Output_section): Delete checkpoint object pointed
4748         by checkpoint_.
4749         (Output_section::add_input_section): Always add an Input_section if
4750         relaxing.
4751         (Output_section::add_merge_input_section): Add assert.
4752         (Output_section::relax_input_section): New method definition.
4753         (Output_section::set_final_data_size): Set load address to zero for
4754         an unallocated section.
4755         (Output_section::do_address_and_file_offset_have_reset_values):
4756         New method definition.
4757         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
4758         Handle relaxed input section.
4759         (Output_section::sort_attached_input_sections): Checkpoint input
4760         section list lazily.
4761         (Output_section::get_input_sections): Change type of input_sections to
4762         list of Simple_input_section pointers.  Checkpoint input section list
4763         lazily.  Also handle relaxed input sections.
4764         (Output_section::add_input_section_for_script): Take a reference to
4765         a Simple_input_section object instead of Relobj pointer and section
4766         index as parameter.  Handle relaxed input sections.
4767         (Output_section::save_states, Output_section::restore_states): New
4768         method definitions.
4769         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
4770         (Output_data::is_data_size_fixed): New method definition.
4771         (Output_data::reset_addresss_and_file_offset): Do not reset data size
4772         if it is fixed.
4773         (Output_data::address_and_file_offset_have_reset_values): New method
4774         definition.
4775         (Output_data::do_address_and_file_offset_have_reset_values): New method
4776         definition.
4777         (Output_data::set_data_size): Check that data size is not fixed.
4778         (Output_data::fix_data_size): New method definition.
4779         (Output_data::is_data_size_fixed_): New data member.
4780         (Output_section_headers::set_final_data_size): New method definition.
4781         (Output_section_headers::do_size): New method declaration.
4782         (Output_segment_headers::set_final_data_size): New method definition.
4783         (Output_segment_headers::do_size): New method declaration.
4784         (Output_file_header::set_final_data_size)::New method definition.
4785         (Output_file_header::do_size)::New method declaration.
4786         (Output_section_data::Output_section_data): Add new parameter
4787         is_data_size_fixed and use it to fix data size.
4788         (Output_data_const::Output_data_const): Adjust call to base class
4789         constructor and fix data size.
4790         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
4791         base class constructor and fix data size.
4792         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
4793         base class constructor and fix data size.
4794         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
4795         class constructor and fix data size.
4796         (Output_data_group::set_final_data_size): New method definition.
4797         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
4798         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
4799         class constructor and fix data size.
4800         (Output_relaxed_input_section): New class definition.
4801         (Output_section::Simple_input_section): New class definition.
4802         (Output_section::get_input_sections): Adjust parameter list.
4803         (Output_section::add_input_section_for_script): Same.
4804         (Output_section::save_states, Output_section::restore_states,
4805         Output_section::do_address_and_file_offset_have_reset_values,
4806         (Output_section::Input_section::Input_section): Handle
4807         RELAXED_INPUT_SECTION_CODE.  Add new overload for
4808         Output_relaxed_input_section.
4809         (Output_section::Input_section::is_input_section,
4810         Output_section::Input_section::set_output_section): Handle relaxed
4811         input section.
4812         (Output_section::Input_section::is_relaxed_input_section,
4813         Output_section::Input_section::output_section_data,
4814         Output_section::Input_section::relaxed_input_section): New method
4815         definitions.
4816         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
4817         value.
4818         (Output_section::Input_section::u1_): Update comments.
4819         (Output_section::Input_section::u2_): Add new union member poris.
4820         (Output_section::Checkpoint_output_section): New classs definition.
4821         (Output_section::relax_input_section): New method declaration.
4822         (Output_section::checkpoint_): New data member.
4823         (Output_segment): Update comments.
4824         (Output_segment::Output_segment): Un-privatize copy constructor.
4825         (Output_segment::operator=): Un-privatize.
4826         * script-sections.cc (Output_section_element::Input_section_list):
4827         Change element type to Output_section::Simple_input_section.
4828         (Output_section_element_dot_assignment::set_section_addresses):
4829         Register output section data for relaxation clean up.
4830         (Output_data_exression::Output_data_expression): Adjust call to base
4831         constructor to fix data size.
4832         (Output_section_element_data::set_section_addresses): Register
4833         Output_data_expression object for relaxation clean up.
4834         (struct Input_section_info): Replace Relobj pointer and section index
4835         pair with Output_section::Simple_input_section and Convert struct to a
4836         class.
4837         (Input_section_sorter::operator()): Adjust access to
4838         Input_section_info data member to use accessors.
4839         (Output_section_element_input::set_section_addresses): Use layout
4840         parameter.  Adjust code to use Output_section::Simple_input_section
4841         and Input_secction_info classes.  Register filler for relaxation
4842         clean up.
4843         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
4844         and section index pair with Output_section::Simple_input_section
4845         class.  Adjust code accordingly.
4846         (Phdrs_element::release_segment): New method definition.
4847         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
4848         segment list.
4849         (Script_sections::release_segments): New method definition.
4850         * gold/script-sections.h (Script_sections::release_segments): New
4851         method declaration.
4852         * gold/target.h (Target::may_relax, Target::relax,
4853         Target::do_may_relax, Target::do_relax): New method definitions.
4855 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4857         * arm.cc (has_signed_unsigned_overflow): New function.
4858         (Arm_relocate_functions::abs8): New function.
4859         (Target_arm::Scan::local): Handle R_ARM_ABS8.
4860         (Target_arm::Scan::global): Likewise.
4861         (Target_arm::relocate::relocate): Likewise.
4862         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4863         Likewise.
4865 2009-09-16  Cary Coutant  <ccoutant@google.com>
4867         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
4868         * testsuite/Makefile.in: Regenerate.
4870 2009-09-11  Nick Clifton  <nickc@redhat.com>
4872         * po/gold.pot: Updated by the Translation project.
4874 2009-09-08  Cary Coutant  <ccoutant@google.com>
4876         * output.cc (Output_file::open): Add execute permission to empty file.
4877         * testsuite/Makefile.am (permission_test): New test.
4878         * testsuite/Makefile.in: Regenerate.
4880 2009-09-02  Ian Lance Taylor  <iant@google.com>
4882         * output.cc (Output_file::resize): Call map_no_anonymous rather
4883         than map.
4885 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
4887         * gold.cc: Include "incremental.h".
4888         (queue_initial_tasks): Call Incremental_checker methods.
4889         * incremental.cc: Include "output.h".
4890         (Incremental_checker::can_incrementally_link_output_file): New
4891         method.
4892         * incremental.h (Incremental_checker): New class.
4894         * output.cc (Output_file::open_for_modification): New method.
4895         (Output_file::map_anonymous): Changed return type to bool.  Record
4896         map in base_ field.
4897         (Output_file::map_no_anonymous): New method, broken out of map.
4898         (Output_file::map): Use map_no_anonymous and map_anonymous.
4899         * output.h (class Output_file): Update declarations.
4901 2009-08-24  Cary Coutant  <ccoutant@google.com>
4903         * options.h (Command_line::Pre_options): New class.
4904         (Command_line::pre_options): New member.
4905         * options.cc (gold::options::ready_to_register): New variable.
4906         (One_option::register_option): Do nothing if not registering options.
4907         Assert if same short option registered twice.
4908         (General_options::General_options): Turn off option registration when
4909         done constructing.
4910         (Command_line::Pre_options::Pre_options): New constructor.
4912 2009-08-24  Cary Coutant  <ccoutant@google.com>
4914         * options.h (General_options::no_keep_memory): Remove incorrect
4915         short option.
4917 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4919         * Makefile.am (am__skiplex, am__skipyacc): New.
4920         * Makefile.in: Regenerate.
4922 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4924         * Makefile.am (AM_CPPFLAGS): Renamed from ...
4925         (INCLUDES): ... this.
4926         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
4927         (AM_CPPFLAGS): Renamed from ...
4928         (INCLUDE): ... this.
4929         * Makefile.in, testsuite/Makefile.in: Regenerate.
4931         * Makefile.in: Regenerate.
4932         * aclocal.m4: Likewise.
4933         * config.in: Likewise.
4934         * configure: Likewise.
4935         * testsuite/Makefile.in: Likewise.
4937         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4938         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4939         * Makefile.in: Regenerate.
4940         * testsuite/Makefile.in: Regenerate.
4942 2009-08-19  Cary Coutant  <ccoutant@google.com>
4944         * resolve.cc (Symbol_table::resolve): Don't complain about defined
4945         symbols in shared libraries overridden by hidden or internal symbols
4946         in the main program.
4948 2009-08-19  Chris Demetriou  <cgd@google.com>
4950         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
4951         checking source file names in error messages.
4953 2009-08-18  Doug Kwan  <dougkwan@google.com>
4955         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
4956         an elcpp::Ehdr as parameter.  Adjust call to set_target.
4957         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
4958         an elfcpp::Ehdr as parameter.
4959         * object.cc (Object::set_target): Remove the version that looks up
4960         a target and sets it.
4961         (Sized_relobj::setup): Take a Target object instead of
4962         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
4963         (make_elf_sized_object): Find target and ask target to
4964         make an ELF object.
4965         * object.h: (Object::set_target): Remove the version that looks up
4966         a target and sets it.
4967         (Sized_relobj::setup): Take a Target object instead of
4968         an elfcpp:Ehdr as parameter.
4969         * target.cc: Include dynobj.h.
4970         (Target::do_make_elf_object_implementation): New.
4971         (Target::do_make_elf_object): New.
4972         * target.h (Target::make_elf_object): New template declaration.
4973         (Target::do_make_elf_object): New method declarations.
4974         (Target::do_make_elf_object_implementation): New template declaration.
4976 2009-08-14  Ian Lance Taylor  <iant@google.com>
4978         * gold.h (FUNCTION_NAME): Define.
4979         (gold_unreachable): Use FUNCTION_NAME.
4981 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
4983         * icf.cc (Icf::find_identical_sections): Issue a warning when a
4984         symbol in the --keep-unique list is not found.
4986 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
4988         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
4989         been maked as --keep-unique.
4990         (Icf::unfold_section): New function.
4991         * icf.h (Icf::unfold_section): New function.
4992         * options.h (General_options::keep_unique): New option.
4993         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
4994         * testsuite/Makefile.in: Regenerate.
4995         * testsuite/icf_keep_unique_test.sh: New file.
4996         * testsuite/icf_keep_unique_test.cc: New file.
4998 2009-08-12  Cary Coutant  <ccoutant@google.com>
5000         PR 10471
5001         * resolve.cc (Symbol_table::resolve): Check for references from
5002         dynamic objects to hidden and internal symbols.
5003         * testsuite/Makefile.am (hidden_test.sh): New test.
5004         * testsuite/Makefile.in: Regenerate.
5005         * testsuite/hidden_test.sh: New script.
5006         * testsuite/hidden_test_1.c: New test source.
5007         * testsuite/hidden_test_main.c: New test source.
5009 2009-08-11  Doug Kwan  <dougkwan@google.com>
5011         * arm.cc: Update comments.
5012         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
5013         segment to locate the .ARM.exidx section if present.
5015 2009-08-09  Doug Kwan  <dougkwan@google.com>
5017         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
5018         patch.
5020 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
5021         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
5022         compiler warnings.
5024 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
5026         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
5027         valid tls_segment only for non-debug-section relocations.
5028         * testsuite/Makefile.am: Add gc_tls_test.
5029         * testsuite/Makefile.in: Regenerate.
5030         * testsuite/gc_tls_test.cc: New file.
5031         * testsuite/gc_tls_test.sh: New file.
5033 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
5035         * icf.cc: New file.
5036         * icf.h: New file.
5037         * Makefile.am (CCFILES): Add icf.cc.
5038         (HFILES): Add icf.h
5039         * Makefile.in: Regenerate.
5040         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
5041         * gc.h (gc_process_relocs): Populate lists used by icf to contain
5042         section, symbol and addend information for the relocs.
5043         * gold.cc (queue_middle_tasks): Call identical code folding.
5044         * gold.h: Add defines for multimap.
5045         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
5046         to the call of finalize_local_symbols.
5047         * main.cc (main): Create object of class Icf.
5048         * object.cc (Sized_relobj::do_layout): Allow this function to be
5049         called twice during icf.
5050         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
5051         to sections marked as identical by icf.
5052         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
5053         when available.
5054         (Sized_relobj::do_section_entsize): New function.
5055         * object.h (Object::section_entsize): New function.
5056         (Object::do_section_entsize): New pure virtual function.
5057         (Relobj::finalize_local_symbols): Add new parameter.
5058         (Relobj::do_section_entsize): New function.
5059         * options.h (General_options::icf): New option.
5060         (General_options::icf_iterations): New option.
5061         (General_options::print_icf_sections): New option.
5062         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
5063         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
5064         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
5065         icf.
5066         * symtab.cc (Symbol_table::is_section_folded): New function.
5067         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
5068         to sections marked as identical by icf.
5069         * symtab.h (Symbol_table::set_icf): New function.
5070         (Symbol_table::icf): New function.
5071         (Symbol_table::is_section_folded): New function.
5072         (Symbol_table::icf_): New data member.
5073         * target-reloc.h (relocate_section): Ignore sections folded by icf.
5074         * testsuite/Makefile.am: Add commands to build icf_test.
5075         * testsuite/Makefile.in: Regenerate.
5076         * testsuite/icf_test.sh: New file.
5077         * testsuite/icf_test.cc: New file.
5079 2009-07-24  Chris Demetriou  <cgd@google.com>
5081         * layout.cc (is_compressible_debug_section): Fix incorrect
5082         comment about compressed section names.
5084 2009-07-20  Ian Lance Taylor  <ian@airs.com>
5086         PR 10419
5087         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
5089 2009-07-16  Ian Lance Taylor  <iant@google.com>
5091         PR 10400
5092         * layout.h: #include <map>.
5093         (class Kept_section): Change from struct to class.  Add accessors
5094         and setters.  Add section size to Comdat_group mapping.  Change
5095         Comdat_group to std::map.  Add is_comdat_ field.  Add
5096         linkonce_size field in union.
5097         (class Layout): Update declaration of find_or_add_kept_section.
5098         Don't declare find_kept_object.
5099         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
5100         parameter.  Add object, shndx, is_comdat, and is_group_name
5101         parameters.  Change all callers.  Adjust for new Kept_section.
5102         (Layout::find_kept_object): Remove.
5103         * object.cc (Sized_relobj::include_section_group): Update use of
5104         Kept_section.  Rename secnum to shndx.  Only record
5105         Kept_comdat_section if sections are the same size.
5106         (Sized_relobj::include_linkonce_section): Update use of
5107         Kept_section.  Only record Kept_comdat_section if sections are the
5108         same size.  Set size of linkonce section.
5109         (Sized_relobj::map_to_kept_section): Update call to
5110         get_kept_comdat_section.
5111         * object.h (class Sized_relobj): Rename fields in
5112         Kept_comdat_section to drop trailing underscores; change object
5113         field to Relobj*.  Change Kept_comdat_section_table to store
5114         struct rather than pointer.
5115         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
5116         Add kept_object and kept_shndx parameters.  Change all callers.
5117         (Sized_relobj::get_kept_comdat_section): Change return type to
5118         bool.  Add kept_object and kept_shndx parameters.  Change all
5119         callers.
5120         * plugin.cc (Pluginobj::include_comdat_group): Update call to
5121         Layout::find_or_add_kept_section.
5123 2009-07-09  Ian Lance Taylor  <iant@google.com>
5125         * merge.cc (Object_merge_map::initialize_input_to_output_map):
5126         Reserve space in the hash table.
5128 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
5130         * fileread.cc (File_read::get_mtime): New method.
5131         * fileread.h (Timespec): New structure.
5132         (File_read::get_mtime): New method.
5133         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
5134         Renamed from timestamp_nsec.
5135         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
5136         Elf_Xword.
5137         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
5138         timestamp_nsec.
5139         (Incremental_inputs::report_archive): Save mtime; style fix.
5140         (Incremental_inputs::report_obejct): Save mtime; style fix.
5141         (Incremental_inputs::report_script): Save mtime; style fix.
5142         (Incremental_inputs::finalize_inputs): Style fix.
5143         (Incremental_inputs::finalize): Style fix.
5144         (Incremental_inputs::create_input_section_data): Store inputs
5145         mtime.
5146         * incremental.h (Incremental_inputs::report_script): Add mtime
5147         argument.
5148         (Incremental_inputs::Input_info::Input_info): Intialize only one
5149         union member.
5150         (Incremental_inputs::Input_info::archive): Move to nameless
5151         union.
5152         (Incremental_inputs::Input_info::obejct): Move to nameless union.
5153         (Incremental_inputs::Input_info::script): Move to nameless union.
5154         (Incremental_inputs::mtime): New field.
5155         * script.cc (read_input_script): Pass file mtime to
5156         Incremental_input.
5157         * script.h (Script_info::inputs): Style fix.
5159 2009-07-01  Ian Lance Taylor  <ian@airs.com>
5161         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
5162         instead of 32.
5164 2009-06-24  Ian Lance Taylor  <iant@google.com>
5166         PR 10156
5167         * layout.cc (Layout::choose_output_section): If we find an
5168         existing section, update the flags.
5169         (Layout::create_notes): New function, broken out of
5170         Layout::finalize.
5171         (Layout::finalize): Don't create note sections.
5172         (Layout::create_note): Don't crash if linker script discards
5173         section.
5174         (Layout::create_gold_note): Likewise.
5175         (Layout::create_build_id): Likewise.  Don't set
5176         after_input_sections on the section.
5177         (Layout::create_executable_stack_info): Remove target parameter.
5178         Change caller.
5179         * layout.h (class Layout): Declare create_notes.  Update
5180         declaration of create_executable_stack_info.
5181         * gold.cc (queue_middle_tasks): Call create_notes.
5182         * output.cc (Output_section::update_flags_for_input_section): Move
5183         here from output.h.  If SHF_ALLOC flag is newly set, mark address
5184         invalid.
5185         * output.h (Output_data::mark_address_invalid): New function.
5186         (class Output_section): Only declare, not define,
5187         update_flags_for_input_section.  Remove set_flags.
5189 2009-06-24  Ian Lance Taylor  <iant@google.com>
5191         * script-sections.cc (Output_section_definition::
5192         set_section_addresses): Rename shadowing local load_address to
5193         laddr.
5195 2009-06-24  Ian Lance Taylor  <iant@google.com>
5197         PR 10244
5198         * reloc.cc (relocate_sections): Skip empty relocation sections.
5200 2009-06-23  Ian Lance Taylor  <iant@google.com>
5202         PR 10156
5203         * layout.cc (Layout::create_note): Use choose_output_section
5204         rather than make_output_section.
5206 2009-06-23  Ian Lance Taylor  <iant@google.com>
5208         PR 10237
5209         * options.cc (General_options::parse_V): Set printed_version_.
5210         (General_options::General_options): Initialize printed_version_.
5211         * options.h (class General_options): Add printed_version_ field.
5212         * gold.cc (queue_initial_tasks): If there are no input files,
5213         don't give a fatal error if we printed the version information.
5214         (queue_middle_tasks): If using -r with a shared object, give a
5215         fatal error rather than an ordinary error.
5217 2009-06-23  Ian Lance Taylor  <iant@google.com>
5219         PR 10219
5220         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
5221         (Layout::make_output_section): Set have_stabstr_section_ if we see
5222         a .stab*str section.
5223         (Layout::finalize): Call link_stabs_sections.
5224         (Layout::link_stabs_sections): New file.
5225         * layout.h (class Layout): Add have_stabstr_section_ field.
5226         Declare link_stabs_sections.
5228 2009-06-23  Doug Kwan  <dougkwan@google.com>
5230         * Makefile.am (libgold_a_LIBADD): New.
5231         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
5232         * Makefile.in: Regenerate.
5233         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
5234         * configure: Regenerate.
5235         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
5236         * fileread.cc: Include sys/state.h
5237         * gold.h: Declare memmem and strndup if found missing.
5238         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
5240 2009-06-23  Ian Lance Taylor  <iant@google.com>
5242         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
5243         * configure: Rebuild.
5245 2009-06-23  Ian Lance Taylor  <iant@google.com>
5247         PR 10147
5248         * object.cc (Object::section_contents): Don't try to get a view if
5249         the section has length zero.
5250         (Object::handle_gnu_warning_section): If the section is empty, use
5251         the name of the section as the warning.
5253 2009-06-23  Ian Lance Taylor  <iant@google.com>
5255         PR 10133
5256         * stringpool.h (class Stringpool_template): Add optimize_ field.
5257         (Stringpool_template::set_optimize): New function.
5258         * stringpool.cc (Stringpool_template::Stringpool_template):
5259         Initialize optimize_ field.
5260         (Stringpool_template::set_string_offsets): Test local optimize
5261         fild rather than parameter.
5262         * layout.cc (Layout::Layout): Call set_optimize on the section
5263         name stringpool.
5265 2009-06-22  Ian Lance Taylor  <iant@google.com>
5267         PR 10030
5268         * yyscript.y: Parse TARGET.
5269         * script.cc (script_set_target): New function.
5270         * script-c.h (script_set_target): Declare.
5271         * options.cc (General_options::string_to_object_format): Rename
5272         from string_to_object_format in anonymous namespace.  Change
5273         callers.
5274         * options.h (class General_options): Declare
5275         string_to_object_format.
5277 2009-06-22  Ian Lance Taylor  <iant@google.com>
5279         * script-sections.cc (Script_sections::create_segments): Don't put
5280         program headers in a PT_LOAD segment if -n or -N.
5282 2009-06-22  Ian Lance Taylor  <iant@google.com>
5284         PR 10141
5285         * options.h (class General_options): Add -z lazy and -z now.  Sort
5286         -z options into alphabetical order.
5287         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
5289 2009-06-21  Ian Lance Taylor  <iant@google.com>
5291         * layout.cc (Layout::make_output_section): Call
5292         Target::new_output_section.
5293         (Layout::attach_allocated_section_to_segment): Put large section
5294         sections in a separate load segment with the large segment flag
5295         set.
5296         (Layout::segment_precedes): Sort large data segments after other
5297         load segments.
5298         (align_file_offset): New static function.
5299         (Layout::set_segment_offsets): Use align_file_offset.
5300         * output.h (class Output_section): Add is_small_section_ and
5301         is_large_section_ fields.
5302         (Output_section::is_small_section): New function.
5303         (Output_section::set_is_small_section):  New function.
5304         (Output_section::is_large_section): New function.
5305         (Output_section::set_is_large_section): New function.
5306         (Output_section::is_large_data_section): New function.
5307         (class Output_segment): Add is_large_data_segment_ field.
5308         (Output_segment::is_large_data_segment): New function.
5309         (Output_segment::set_is_large_data_segment): New function.
5310         * output.cc (Output_section::Output_section): Initialize new
5311         fields.
5312         (Output_segment::Output_segment): Likewise.
5313         (Output_segment::add_output_section): Add assertion that large
5314         data sections always go in large data segments.  Force small data
5315         sections to the end of the list of data sections.  Force small BSS
5316         sections to the start of the list of BSS sections.  For large BSS
5317         sections to the end of the list of BSS sections.
5318         * symtab.h (class Symbol): Declare is_common_shndx.
5319         (Symbol::is_defined): Check Symbol::is_common_shndx.
5320         (Symbol::is_common): Likewise.
5321         (class Symbol_table): Define enum Commons_section_type.  Update
5322         declarations.  Add small_commons_ and large_commons_ fields.
5323         * symtab.cc (Symbol::is_common_shndx): New function.
5324         (Symbol_table::Symbol_table): Initialize new fields.
5325         (Symbol_table::add_from_object): Put small and large common
5326         symbols in the right list.
5327         (Symbol_table::sized_finalized_symbol): Check
5328         Symbol::is_common_shndx.
5329         (Symbol_table::sized_write_globals): Likewise.
5330         * common.cc (Symbol_table::do_allocate_commons): Allocate new
5331         common symbol lists.  Don't call do_allocate_commons_list if the
5332         list is empty.
5333         (Symbol_table::do_allocate_commons_list): Remove is_tls
5334         parameter.  Add comons_section_type parameter.  Change all
5335         callers.  Handle small and large common symbols.
5336         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
5337         Symbol::is_common_shndx.
5338         * resolve.cc (symbol_to_bits): Likewise.
5339         * target.h (Target::small_common_shndx): New function.
5340         (Target::small_common_section_flags): New function.
5341         (Target::large_common_shndx): New function.
5342         (Target::large_common_section_flags): New function.
5343         (Target::new_output_section): New function.
5344         (Target::Target_info): Add small_common_shndx, large_common_shndx,
5345         small_common_section_flags, and large_common_section_flags
5346         fields.
5347         (Target::do_new_output_section): New virtual function.
5348         * arm.cc (Target_arm::arm_info): Initialize new fields.
5349         * i386.cc (Target_i386::i386_info): Likewise.
5350         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5351         Likewise.
5352         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
5353         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5354         (Target_x86_64::do_new_output_section): New function.
5355         * configure.ac: Define conditional MCMODEL_MEDIUM.
5356         * testsuite/Makefile.am (check_PROGRAMS): Add large.
5357         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
5358         (large_LDFLAGS): Define.
5359         * testsuite/large.c: New file.
5360         * testsuite/testfile.cc (Target_test::test_target_info):
5361         Initialize new fields.
5362         * configure, testsuite/Makefile.in: Rebuild.
5364 2009-06-05  Doug Kwan  <dougkwan@google.com>
5366         * Makefile.am (CCFILES): Add target.cc.
5367         * Makefile.in: Regenerate.
5368         * i386.cc (class Target_i386): Define new virtual method to
5369         override do_is_local_label_name in parent.
5370         * object.cc (Sized_relobj::do_count_local_symbols): Discard
5371         local symbols if --discard-locals or -X is given.
5372         * options.h (class General_options): Declare new options
5373         '--discard-locals' and '-X' for discarding locals.
5374         * target.h (class Target): Define new methods is_local_label_name.
5375         Declare new virtual method do_is_local_label_name.
5376         * target.cc: New file.
5377         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
5378         (check_SCRIPTS): Add discard_locals_test.sh.
5379         (check_DATA): Add discard_local_tests.syms.
5380         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
5381         (discard_local_tests.syms, discard_locals_test.o): New make rules.
5382         * testsuite/Makefile.in: Regenerate.
5383         * testsuite/discard_locals_test.c: New file.
5384         * testsuite/discard_locals_test.sh: Same.
5386 2009-06-05  Doug Kwan  <dougkwan@google.com>
5388         * object.cc (Sized_relobj::Sized_relobj): Initialize
5389         discarded_eh_frame_shndx_ to -1U.
5390         (Sized_relobj::do_layout): Record index of a discard .eh_frame
5391         section.
5392         (Sized_relobj::do_count_local_symbols): Skip local symbols in
5393         a discarded .eh_frame section.
5394         (Sized_relobj::do_finalize_local_symbols): Ditto.
5395         * object.h (class Sized_relobj): Declare new member
5396         discarded_eh_frame_shndx_.
5397         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
5398         (local_labels_test.o, local_labels_test): New rules.
5399         * testsuite/Makefile.in: Regenerate.
5401 2009-06-04  Doug Kwan  <dougkwan@google.com>
5403         * layout.cc (Layout::section_name_mapping): Add mapping for
5404         special ARM sections.
5406 2009-06-03  Doug Kwan  <dougkwan@google.com>
5408         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
5409         (utils::has_overflow): Same.
5411 2009-06-03  Ian Lance Taylor  <iant@google.com>
5413         * layout.cc (Layout::section_name_mapping): New array, replacing
5414         Layout::linkonce_mapping.
5415         (Layout::section_name_mapping_count): New variable, replacing
5416         Layout::linkonce_mapping_count.
5417         (Layout::linkonce_output_name): Remove.
5418         (Layout::output_section_name): Rewrite.
5419         * layout.h (class Layout): Rename Linkonce_mapping to
5420         Section_name_mapping, linkonce_mapping to section_name_mapping,
5421         linkonce_mapping_count to section_name_mapping_count.  Don't
5422         declare linkonce_output_name.
5424 2009-06-03  Doug Kwan  <dougkwan@google.com>
5426         * gold/arm.cc (namespace utils): New.
5427         (Target_arm::reloc_is_non_pic): Define new method.
5428         (class Arm_relocate_functions): New.
5429         (Target_arm::Relocate::relocate): Handle relocation types used by
5430         Android.
5432 2009-06-03  Ian Lance Taylor  <iant@google.com>
5434         * arm.cc (Target_arm::scan::global): Use || instead of |.
5436 2009-06-02  Doug Kwan  <dougkwan@google.com>
5438         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
5439         issued_non_pic_error_.
5440         (class Target_arm::Scan): Declare new method check_non_pic.
5441         Define new method symbol_needs_plt_entry.
5442         Declare new data member issued_non_pic_error_.
5443         (class Target_arm::Relocate): Declare new method
5444         should_apply_static_reloc.
5445         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
5446         (Target_arm::Scan::check_non_pic): Define new method.
5447         (Target_arm::Scan::local): Handle a small subset of reloc types used
5448         by Android.
5449         (Target_arm::Scan::local): Same.
5450         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
5452 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
5454         * incremental.cc (Incremental_inputs::report_command_line): Filter
5455         out --incremental-* options.
5457 2009-05-29  Doug Kwan  <dougkwan@google.com>
5459         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
5460         template class.
5461         (class Target_arm): Update comment.
5462         (Target_arm::Target_arm): Initialize new data members GOT_,
5463         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
5464         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
5465         and Target_arm::rel_dyn_section.
5466         Declare new_enum Target_arm::Got_type.
5467         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
5468         and DYNBSS_.
5469         Update commments for member do_dynsym_value.
5470         (Target_arm::got_size, Target_arm::plt_section,
5471         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
5472         new methods inside class defintion.
5473         (Target_arm::got_section): Define new method.
5474         (Target_arm::rel_dyn_section): Same.
5475         (Output_data_plt_arm): New template class.
5476         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
5477         (Output_data_plt_arm:do_adjust_output_section): Define new method.
5478         (Output_data_plt_arm::add_entry): Same.
5479         (Output_data_plt_arm::first_plt_entry): Define new
5480         static data member for PLT instruction template.
5481         (Output_data_plt_arm::plt_entry): Same.
5482         (Output_data_plt_arm::do_write): Define new method.
5483         (Target_arm::make_plt_entry): Same.
5484         (Target_arm::do_finalize_sections): Same.
5485         (Target_arm::do_dynsym_value): Same.
5487 2009-05-28  Doug Kwan  <dougkwan@google.com>
5489         * Makefile.am (TARGETSOURCES): Add arm.cc.
5490         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
5491         * Makefile.in: Regenerate.
5492         * arm.cc: New file.
5493         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
5495 2009-05-26  Doug Kwan  <dougkwan@google.com>
5497         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
5498         (General_options::check_excluded_libs): Strip off directories in
5499         archive name before matching like GNU ld does.
5500         * testsuite/Makefile.am (MOSTLYCLEANFILES,
5501         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
5502         (exclude_libs_test_LDFLAGS): Add linker option
5503         -Wl,--exclude-libs,libexclude_libs_test_3
5504         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
5505         an explicit archive without using -l.
5506         (alt/libexclude_libs_test_3.a): New make rule.
5507         * testsuite/Makefile.in: Regenerate.
5508         * testsuite/exclude_libs_test.c : Declare lib3_default().
5509         (main): Call it.
5510         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
5511         * exclude_libs_test_3.c: New file.
5513 2009-05-26  Nick Clifton  <nickc@redhat.com>
5515         * po/id.po: New Indonesian translation.
5516         * po/gold.pot: Updated template file.
5518 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
5520         * testsuite/Makefile.am: Add -ffunction-sections to compile
5521         gc_comdat_test files.  Add -Wl,--gc-sections to build
5522         gc_comdat_test.
5523         * testsuite/Makefile.in: Regenerate.
5524         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
5526 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
5528         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
5529         kept comdat section was garbage collected.
5530         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
5531         * testsuite/Makefile.in: Regenerate.
5532         * testsuite/gc_comdat_test.sh: New file.
5533         * testsuite/gc_comdat_test_1.cc: New file.
5534         * testsuite/gc_comdat_test_2.cc: New file.
5536 2009-05-19  Doug Kwan  <dougkwan@google.com>
5538         * archive.cc (Archive::Archive): Move constructor from archive.h
5539         to here.  Initialize no_export_.
5540         (Archive::get_elf_object_for_member): Set no_export flag of object.
5541         * archive.h (Archive::Archive): Move constructor body to
5542         archive.cc.
5543         (Archive::no_export): New method.
5544         (Archive::no_export_): New field.
5545         * object.h (Object::Object): Initialize no_export_ to false.
5546         (Object::no_export, Object::set_no_export): New methods.
5547         (Object::no_export_): New field.
5548         * options.cc (General_options::parse_exclude_libs): New method.
5549         (General_options::check_excluded_libs) Same.
5550         * options.h (exclude_libs): New option.
5551         (General_options::check_excluded_libs): New method declaration.
5552         (General_options::excluded_libs_): New field.
5553         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
5554         default or protected visibility if an object has no-export flag set.
5555         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
5556         (check_SCRIPTS): Add exclude_libs_test.sh.
5557         (check_DATA): Add exclude_libs_test.syms.
5558         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
5559         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
5560         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
5561         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
5562         (exclude_libs_test.syms, libexclude_libs_test_1.a,
5563         libexclude_libs_test_2.a): New rules.
5564         * testsuite/Makefile.in: Regenerate.
5565         * testsuite/exclude_libs_test.c: New file.
5566         * testsuite/exclude_libs_test.sh: Ditto.
5567         * testsuite/exclude_libs_test_1.c: Ditto.
5568         * testsuite/exclude_libs_test_2.c: Ditto.
5570 2009-05-15  Ian Lance Taylor  <iant@google.com>
5572         * configure.ac: Check for declarations for cases where libiberty.h
5573         checks HAVE_DECL_xxx.
5574         * configure, config.in: Rebuild.
5576 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
5578         * gold.h (Incremental_argument_list): Remove (invalid) forward
5579         declaration.
5580         * incremental.cc (Incremental_inputs::report_achive): New method.
5581         (Incremental_inputs::report_object): New method.
5582         (Incremental_inputs::report_script): New method.
5583         (Incremental_inputs::finalize_inputs): New method.
5584         (Incremental_inputs::finalize): Call finalize_inputs().
5585         (Incremental_inputs::sized_create_incremental_inputs_section_data):
5586         Create inputs entries.
5587         * incremental.h (Incremental_input_type): New enum.
5588         (Incremental_inputs::Incremental_input): Initialize new fields.
5589         (Incremental_inputs::report_inputs): New method.
5590         (Incremental_inputs::report_achive): New method.
5591         (Incremental_inputs::report_object): New method.
5592         (Incremental_inputs::report_script): New method.
5593         (Incremental_inputs::finalize_inputs): New method.
5594         (Incremental_inputs::Input_info): New struct.
5595         (Incremental_inputs::Input_info_map): New typedef.
5596         (Incremental_inputs::lock_): New field.
5597         (Incremental_inputs::Inputs_): New field.
5598         (Incremental_inputs::Inputs_map): New field.
5599         * main.cc (main): Call Incremental_input::report_inputs.
5600         * options.h (Input_argument_list): Typedef moved from
5601         Input_arguments.
5602         (Input_file_group::Files): Remove, use ::Input_argument_list.
5603         (Input_file_group::Input_argument_list): Remove, use
5604         ::Input_argument_list.
5605         * plugin.cc (Plugin_manager::add_input_file): Add error in
5606         incremental build.
5607         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
5608         functions.
5609         * script.cc (read_input_script): Call
5610         Incremental_input::report_script.
5611         * script.h (Script_info): New class.
5613 2009-04-27  Ian Lance Taylor  <iant@google.com>
5615         * x86_64.cc (do_adjust_output_section): Set entsize to
5616         plt_entry_size.
5618 2009-04-23  Elliott Hughes  <enh@google.com>
5620         * output.cc (Output_file::close): After short writes, continue
5621         writing from the correct offset in the buffer being written.
5623 2009-04-23  Chris Demetriou  <cgd@google.com>
5625         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
5626         * configure: Regenerate.
5627         * config.in: Regenerate.
5628         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
5629         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
5631 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
5633         * incremental.cc (Incremental_inputs_header_data): Renamed from
5634         Incremental_input_header_data.
5635         (Incremental_inputs_header_data::data_size): New field.
5636         (Incremental_inputs_header_data::put_input_file_count): Renamed
5637         from input_file_count.
5638         (Incremental_inputs_header_data::put_command_line_offset): Renamed
5639         from command_line_offset.
5640         (Incremental_inputs_header_data::put_reserved): Renamed from
5641         put_reserved.
5642         (Incremental_inputs_entry_data): Renamed from
5643         Incremental_input_entry_data.
5644         (Incremental_inputs_entry_data::data_size): New field.
5645         (Incremental_inputs::report_command_line): New method.
5646         (Incremental_inputs::finalize): New method.
5647         (Incremental_inputs::create_incremental_inputs_data): New method.
5648         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
5649         * incremental.h: New file.
5650         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
5651        (Layout::finalize): Create incremental inputs section in
5652         incremental builds.
5653        (Layout::create_incremental_info_sections): New method.
5654         * layout.h (Layout::incremental_inputs): New method.
5655        (Layout::create_incremental_info_sections): New method.
5656        (Layout::incremental_inputs_): New field.
5657         * main.cc (main): Notify Incremental_input of the command line.
5659 2009-04-01  Ian Lance Taylor  <iant@google.com>
5660             Mikolaj Zalewski  <mikolajz@google.com>
5662         * gold.h (reserve_unordered_map): Define, three versions, one for
5663         each version of Unordered_map.
5664         * layout.cc (Layout::Layout): Remove options parameter.  Add
5665         number_of_input_files parameter.  Don't initialize options_.
5666         Initialize number_of_input_files_ and resized_signatures_.  Move
5667         sections_are_attached_.
5668         (Layout::layout_group): Reserve space for group_signatures_.
5669         (Layout::find_or_add_kept_section): Change name parameter to be a
5670         reference.  Resize signatures_ map when it gets large enough.
5671         (Layout::layout_eh_frame): Use parameters->options() instead of
5672         this->options_.
5673         (Layout::make_output_section): Likewise.
5674         (Layout::attach_allocated_section_to_segment): Likewise.
5675         (Layout::finalize, Layout::create_executable_stack): Likewise.
5676         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
5677         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
5678         * layout.h (class Layout): Update declarations.  Remove options_
5679         field.  Add number_of_input_files_ and resized_signatures_
5680         fields.  Move sections_are_attached_ field.
5681         * main.cc (main): Pass number of input files to Layout
5682         constructor.  Don't pass options.
5684 2009-03-30  Ian Lance Taylor  <iant@google.com>
5686         * ffsll.c (ffsll): Correct implementation.
5688 2009-03-27  Ian Lance Taylor  <iant@google.com>
5690         * ffsll.c: New file.
5691         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
5692         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
5693         * ftruncate.c (ftruncate): Declare before definition.
5694         * mremap.c (mremap): Likewise.
5695         * pread.c (pread): Likewise.
5696         * configure, Makefile.in, config.in: Rebuild.
5698         * mremap.c: New file.
5699         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
5700         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
5701         (mremap): Declare if HAVE_MREMAP is not defined.
5702         * configure, Makefile.in, config.in: Rebuild.
5704 2009-03-27  Cary Coutant  <ccoutant@google.com>
5706         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
5707         position independent.
5708         * sparc.cc (Target_sparc::check_non_pic): Likewise.
5709         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
5711 2009-03-24  Cary Coutant  <ccoutant@google.com>
5713         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
5714         an executable.
5715         (needs_dynamic_reloc): Likewise.
5717 2009-03-24  Ian Lance Taylor  <iant@google.com>
5719         * yyscript.y (file_cmd): Recognize EXTERN.
5720         (extern_name_list, extern_name_list_body): New nonterminals.
5721         * script.cc (script_add_extern): Define.
5722         * script-c.h (script_add_extern): Declare.
5724 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
5726         * object.cc (is_elf_object): Define.
5727         * object.h (is_elf_object): Declare.
5728         * archive.cc (Archive::get_elf_object_for_member): Call
5729         is_elf_object.
5730         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
5732 2009-03-24  Elliott Hughes  <enh@google.com>
5734         * output.cc (Output_file::map_anonymous): Define.
5735         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
5736         try an anonymous one.  Report the size if the mmap fails.
5737         * output.h (class Output_file): Declare map_anonymous.
5739 2009-03-24  Ian Lance Taylor  <iant@google.com>
5741         * target-select.cc (instantiate_target): Don't acquire the lock if
5742         the instantiated_target_ field has already been set.
5744 2009-03-23  Ian Lance Taylor  <iant@google.com>
5746         * gold-threads.h (class Initialize_lock): Define.
5747         * gold-threads.cc (class Initialize_lock_once): Define.
5748         (initialize_lock_control): New static variable.
5749         (initialize_lock_pointer): New static variable.
5750         (initialize_lock_once): New static function.
5751         (Initialize_lock::Initialize_lock): Define.
5752         (Initialize_lock::initialize): Define.
5753         * target-select.h: Include "gold-threads.h".
5754         (class Target_selector): Add lock_ and initialize_lock_ fields.
5755         Don't define instantiate_target, just declare it.
5756         * target-select.cc (Target_selector::Target_selector): Initialize
5757         new fields.
5758         (Target_selector::instantiate_target): Define.
5759         * descriptors.h: Include "gold-threads.h".
5760         (class Descriptors): Add initialize_lock_ field.
5761         * descriptors.cc (Descriptors::Descriptors): Initialize new
5762         field.
5763         (Descriptors::open): Use initialize_lock_ field
5764         * errors.h (class Errors): Add initialize_lock_ field.
5765         * errors.cc (Errors::Errors): Initialize new field.
5766         (Errors::initialize_lock): Use initialize_lock_ field.
5767         * powerpc.cc (class Target_selector_powerpc): Remove
5768         instantiated_target_ field.  In do_recognize call
5769         instantiate_target rather than do_instantiate_target.  In
5770         do_instantiate_target just allocate a new target.
5771         * sparc.cc (class Target_selector_sparc): Likewise.
5773         * freebsd.h: New file.
5774         * i386.cc: Include "freebsd.h".
5775         (Target_i386): Derive from Target_freebsd rather than
5776         Sized_target.
5777         (Target_selector_i386): Derive from Target_selector_freebsd rather
5778         than Target_selector.
5779         * x86_64.cc: Include "freebsd.h".
5780         (Target_x86_64): Derive from Target_freebsd rather than
5781         Sized_target.
5782         (Target_selector_x86_64): Derive from Target_selector_freebsd
5783         rather than Target_selector.
5784         * target.h (class Target): Add adjust_elf_header and
5785         do_adjust_elf_header.
5786         * output.cc (Output_file_header:: do_sized_write): Call target
5787         adjust_elf_header routine.
5788         * configure.tgt: Set targ_osabi.
5789         * configure.ac: Define GOLD_DEFAULT_OSABI.
5790         * parameters.cc (Parameters::default_target): Pass
5791         GOLD_DEFAULT_OSABI to select_target.
5792         * target-select.h (class Target_selector): Make instantiate_target
5793         protected rather than private.
5794         * Makefile.am (HFILES): Add freebsd.h.
5795         * configure, Makefile.in, config.in: Rebuild.
5797         * merge.cc (do_add_input_section): Correct pend value.  Change
5798         message about last entry not being null terminated from error to
5799         warning.
5801 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
5803         * incremental.cc: New file.
5804         * Makefile.am (CCFILES): Add incremental.cc.
5805         * Makefile.in: Rebuild.
5807 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
5809         * layout.cc (Layout::output_section_name): Preserve names
5810         of '.note.' sections.
5812 2009-03-19  Ian Lance Taylor  <iant@google.com>
5814         * descriptors.cc (Descriptors::open): Check that the options are
5815         valid before using them.
5817 2009-03-18  Ian Lance Taylor  <iant@google.com>
5819         * script-sections.h: Include <list>.
5820         (class Script_sections): Change Sections_elements from std::vector
5821         to std::list.  Typedef public Elements_iterator.  Add
5822         orphan_section_placement_, data_segment_align_start_, and
5823         saw_data_segment_align_ fields.  Remove data_segment_align_index_
5824         field.
5825         * script-sections.cc (class Orphan_section_placement): New class.
5826         (class Sections_element): Add virtual functions is_relro and
5827         orphan_section_init.  Remove virtual function place_orphan_here.
5828         (class Output_section_definition): Add is_relro and
5829         orphan_section_init.  Remove place_orphan_here.
5830         (class Orphan_output_section): Likewise.
5831         (Script_sections::Script_sections): Update for field changes.
5832         (Script_sections::data_segment_align): Set saw_data_segment_align_
5833         and data_segment_align_start_, not data_segment_align_index.
5834         (Script_sections::data_segment_relro_end): Check
5835         saw_data_segment_align_.  Use data_segment_align_start_ rather
5836         than data_segment_align_index_.
5837         (Script_sections::place_orphan): Rewrite to use
5838         Orphan_section_placement.
5840 2009-03-17  Ian Lance Taylor  <iant@google.com>
5842         * archive.cc (Archive::add_symbols): Check for a version attached
5843         to the symbol name in the archive map.
5844         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
5845         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
5846         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
5847         (ver_test_11.a): New target.
5848         * testsuite/Makefile.in: Rebuild.
5850         * configure.ac: Check for chsize and posix_fallocate.  Replace
5851         ftruncate.
5852         * ftruncate.c: New file, from gnulib.
5853         * output.cc (posix_fallocate): Define dummy version if not
5854         HAVE_POSIX_FALLOCATE.
5855         (Output_file::map): Call posix_fallocate rather than lseek and
5856         write.
5857         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
5858         * configure, Makefile.in, config.in: Rebuild.
5860 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
5862         * layout.h (Layout::create_note): Add section_name parameter.
5863         * layout.cc (Layout::create_note): Likewise.
5864         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
5866 2009-03-17  Ian Lance Taylor  <iant@google.com>
5868         * descriptors.cc: Include "options.h".
5869         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
5870         (Descriptors::open): Always use O_CLOEXEC when opening a new
5871         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
5872         then set FD_CLOEXEC.
5874         * sparc.cc (class Target_sparc): Add has_got_section.
5875         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
5876         make sure we have a GOT section.
5878         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
5879         (Target_sparc::Scan::local): Likewise.
5880         (Target_sparc::Scan::global): Likewise.
5881         (Target_sparc::Relocate::relocate): Likewise.
5882         (Target_sparc::Relocate::relocate_tls): Likewise.
5884         * symtab.cc (Symbol_table::define_default_version): New function,
5885         broken out of add_from_object.
5886         (Symbol_table::add_from_object): Call define_default_version.
5887         (Symbol_table::define_special_symbol): Add resolve_oldsym
5888         parameter.  Change all callers.  If the version for a symbol comes
5889         from a version script, resolve it with the symbol with the same
5890         name with no version.  Also add the symbol without a version if
5891         appropriate.
5892         (do_define_in_output_data): If resolving with oldsym, don't delete
5893         sym.
5894         (do_define_in_output_segment): Likewise.
5895         (do_define_as_constant): Likewise.
5896         * symtab.h (class Symbol_table): Update declarations.
5898 2009-03-13  Ian Lance Taylor  <iant@google.com>
5900         * readsyms.cc (Read_symbols::incompatible_warning): New function.
5901         (Read_symbols::requeue): New function.
5902         (Read_symbols::do_read_symbols): If make_elf_object fails because
5903         the target type is not configured, and the file was searched for,
5904         issue a warning and retry with the next directory.
5905         (Add_symbols::run): If the file has an incompatible format, and
5906         it was searched for, requeue the Read_symbols task.  On error,
5907         release the object.
5908         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
5909         dirindex parameter to constructor.  Change all callers.  Declare
5910         incompatible_warning and requeue.
5911         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
5912         input_argument_ and input_group_ fields.  Add them to
5913         constructor.  Change all callers.
5914         (class Read_script): Add dirindex_ field.  Add it to constructor.
5915         Change all callers.
5916         * archive.cc (Archive::setup): Remove input_objects parameter.
5917         Change all callers.
5918         (Archive::get_file_and_offset): Likewise.
5919         (Archive::read_all_symbols): Likewise.
5920         (Archive::read_symbols): Likewise.
5921         (Archive::get_elf_object_for_member): Remove input_objects
5922         parameter.  Add punconfigured parameter.  Change all callers.
5923         (Archive::add_symbols): Change return type to bool.  Check return
5924         value of include_member.
5925         (Archive::include_all_members): Likewise.
5926         (Archive::include_member): Change return type to bool.  Return
5927         false if first included object has incompatible target.  Set
5928         included_member_ field.
5929         (Add_archive_symbols::run): If add_symbols returns false, requeue
5930         Read_symbols task.
5931         * archive.h (class Archive): Add included_member_ field.
5932         Initialize it in constructor.  Add input_file and searched_for
5933         methods.  Update declarations.
5934         (class Add_archive_symbols): Add dirpath_, dirindex_, and
5935         input_argument_ fields.  Add them to constructor.  Change all
5936         callers.
5937         * script.cc: Include "target-select.h".
5938         (class Parser_closure): Add skip_on_incompatible_target_ and
5939         found_incompatible_target_ fields.  Add
5940         skip_on_incompatible_target parameter to constructor.  Change all
5941         callers.  Add methods skip_on_incompatible_target,
5942         clear_skip_on_incompatible_target, found_incompatible_target, and
5943         set_found_incompatible_target.
5944         (read_input_script): Add dirindex parameter.  Change all callers.
5945         If parser finds an incompatible target, requeue Read_symbols
5946         task.
5947         (script_set_symbol): Clear skip_on_incompatible_target in
5948         closure.
5949         (script_add_assertion, script_parse_option): Likewise.
5950         (script_start_sections, script_add_phdr): Likewise.
5951         (script_check_output_format): New function.
5952         * script.h (read_input_script): Update declaration.
5953         * script-c.h (script_check_output_format): Declare.
5954         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
5955         (ignore_cmd): Remove OUTPUT_FORMAT.
5956         * fileread.cc (Input_file::Input_file): Add explicit this.
5957         (Input_file::will_search_for): New function.
5958         (Input_file::open): Add pindex parameter.  Change all callers.
5959         * fileread.h (class Input_file): Add input_file_argument method.
5960         Declare will_search_for.  Update declarations.
5961         * object.cc (make_elf_object): Add punconfigured parameter.
5962         Change all callers.
5963         * object.h (class Object): Make input_file public.  Add
5964         searched_for method.
5965         (make_elf_object): Update declaration.
5966         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
5967         restart search.
5968         * dirsearch.h (class Dirsearch): Update declaration.
5969         * options.h (class General_options): Add --warn-search-mismatch.
5970         * parameters.cc (Parameters::is_compatible_target): New function.
5971         * parameters.h (class Parameters): Declare is_compatible_target.
5972         * workqueue.cc (Workqueue::add_blocker): New function.
5973         * workqueue.h (class Workqueue): Declare add_blocker.
5975         * fileread.cc (Input_file::open): Remove options parameter.
5976         Change all callers.
5977         (Input_file::open_binary): Likewise.
5978         * script.cc (read_input_script): Likewise.
5979         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
5980         options parameter from constructor.  Change all callers.
5981         (class Read_script): Likewise.
5982         * fileread.h (class Input_file): Update declarations.
5983         * script.h (read_input_script): Update declaration.
5985 2009-03-10  Nick Clifton  <nickc@redhat.com>
5987         * po/es.po: New Spanish translation.
5989 2009-03-06  Cary Coutant  <ccoutant@google.com>
5991         * options.cc (parse_short_option): Keep dash_z from registering itself.
5993 2009-03-03  Ian Lance Taylor  <iant@google.com>
5995         PR 9918
5996         * target-reloc.h (relocate_section): Pass output_section to
5997         relocate.
5998         * i386.cc (Target_i386::should_apply_static_reloc): Add
5999         output_section parameter.  Change all callers.
6000         (Target_i386::Relocate::relocate): Add output_section parameter.
6001         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6002         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
6003         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
6004         * testsuite/two_file_shared.sh: New script.
6005         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
6006         (check_DATA): Add two_file_shared.dbg.
6007         (two_file_shared.dbg): New target.
6008         * testsuite/Makefile.in: Rebuild.
6010 2009-03-01  Ian Lance Taylor  <iant@google.com>
6012         * configure.ac: Check for byteswap.h.
6013         * configure: Rebuild.
6014         * config.in: Rebuild.
6016 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
6018         * layout.cc (Layout::find_or_add_kept_section): New function.
6019         (Layout::add_comdat): Removed.
6020         * layout.h (struct Kept_section): Move out of class Layout.
6021         Remove trailing underscores from field names.  Add group_sections
6022         field.  Rename group_ field to is_group.  Change all uses.
6023         (class Layout): Declare find_or_add_kept_section, not add_comdat.
6024         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
6025         comdat_groups_ field.
6026         (Sized_relobj::include_section_group): Use
6027         find_or_add_kept_section and Kept_section::group_sections.
6028         (Sized_relobj::include_linkonce_section): Likewise.
6029         * object.cc (class Sized_relobj): Don't define Comdat_group or
6030         Comdat_group_table.  Remove find_comdat_group and
6031         add_comdat_group.  Remove comdat_groups_ field.
6032         * plugin.cc (include_comdat_group): Use
6033         Layout::find_or_add_kept_section.
6035 2009-02-28  Ian Lance Taylor  <iant@google.com>
6037         * README: --gc-sections and map files are now supported.  Document
6038         some build requirements.
6040         PR 6992
6041         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
6042         relocatable link set the value of the section symbol to zero.
6043         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
6044         relocatable link don't include the section address in the local
6045         symbol value.
6047 2009-02-27  Ian Lance Taylor  <iant@google.com>
6049         PR 6811
6050         * options.h (class Search_directory): Add is_system_directory.
6051         (class General_options): Declare is_in_system_directory.
6052         * options.cc (get_relative_sysroot): Make static.
6053         (get_default_sysroot): Make static.
6054         (General_optoins::is_in_system_directory): New function.
6055         * fileread.cc (Input_file::is_in_system_directory): New function.
6056         * fileread.h (class Input_file): Declare is_in_system_directory.
6057         * object.h (class Object): Add is_in_system_directory.
6058         (class Input_objects): Remove system_library_directory_ field.
6059         * object.cc (Input_objects::add_object): Don't set
6060         system_library_directory_.
6061         (input_objects::found_in_system_library_directory): Remove.
6062         * symtab.cc (Symbol_table::write_globals): Remove input_objects
6063         parameter.  Change all callers.
6064         (Symbol_table::sized_write_globals): Likewise.
6065         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
6066         Call Object::is_in_system_directory.
6067         * symtab.h (class Symbol_table): Update declarations.
6069         PR 5990
6070         * descriptors.h (Open_descriptor): Add is_on_stack field.
6071         * descriptors.cc (Descriptors::open): If the descriptor is on the
6072         top of the stack, remove it.  Initialize is_on_stack field.
6073         (Descriptors::release): Only add pod to stack if it is not on the
6074         stack already.
6075         (Descriptors::close_some_descriptor): Clear stack_next and
6076         is_on_stack fields.
6078         PR 7091
6079         * output.cc (Output_section::find_starting_output_address): Rename
6080         from starting_output_address; add PADDR parameter; change return
6081         type.
6082         * output.h (class Output_section): Declare
6083         find_starting_output_address instead of starting_output_address.
6084         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
6085         section symbol for which we can't find a merge section.
6087         PR 9836
6088         * symtab.cc (Symbol_table::add_from_object): If the visibility is
6089         hidden or internal, force the symbol to be local.
6090         * resolve.cc (Symbol::override_visibility): Define.
6091         (Symbol::override_base): Use override_visibility.
6092         (Symbol_table::resolve): Likewise.
6093         (Symbol::override_base_with_special): Likewise.
6094         (Symbol_table::override_with_special): If the visibility is hidden
6095         or internal, force the symbol to be local.
6096         * symtab.h (class Symbol): Add set_visibility and
6097         override_visibility.
6098         * testsuite/ver_test_1.sh: New file.
6099         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
6100         (check_DATA): Add ver_test_1.syms.
6101         (ver_test_1.syms): New target.
6102         * testsuite/Makefile.in: Rebuild.
6104 2009-02-25  Cary Coutant  <ccoutant@google.com>
6106         * layout.cc (Layout::choose_output_section): Don't rename sections
6107         when using a linker script that has a SECTIONS clause.
6108         * Makefile.in: Regenerate.
6110         * testsuite/Makefile.am (script_test_5.sh): New test case.
6111         * testsuite/Makefile.in: Regenerate.
6112         * testsuite/script_test_5.cc: New file.
6113         * testsuite/script_test_5.sh: New file.
6114         * testsuite/script_test_5.t: New file.
6116 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
6118         * archive.cc (Archive::include_member): Update calls to add_symbols.
6119         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
6120         the Layout argument.
6121         * dynobj.h (do_add_symbols): Add the Layout argument.
6122         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
6123         Layout argument.
6124         * object.h (Object::add_symbols): Add the Layout argument.
6125         (Object::do_add_symbols): Add the Layout argument.
6126         (Sized_relobj::do_add_symbols): Add the Layout argument.
6127         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
6128         Unify the two versions.
6129         (Add_plugin_symbols): Remove.
6130         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
6131         (Sized_pluginobj::do_add_symbols): Unify the two versions.
6132         (Add_plugin_symbols): Remove.
6133         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
6134         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
6135         (Add_symbols::run): Make it work with Pulginobj.
6137 2009-02-06  Ian Lance Taylor  <iant@google.com>
6139         * object.cc (Sized_relobj::do_layout): Make info message start
6140         with lower case letter.
6142 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
6144         * binary.cc: Fix file comment.
6146         * options.h (enum Incremental_disposition): Define.
6147         (class General_options): Add new options: --incremental,
6148         --incremental_changed, --incremental_unchanged,
6149         --incremental_unknown.  Add incremental_disposition_ and
6150         implicit_incremental_ fields.
6151         (General_options::incremental_disposition): New function.
6152         (class Position_dependent_options): Add incremental_disposition
6153         option.
6154         (Position_dependent_options::copy_from_options): Set incremental
6155         dispositions.
6156         * options.cc (General_options::parse_incremental_changed): New
6157         function.
6158         (General_options::parse_incremental_unchanged): New function.
6159         (General_options::parse_incremental_unknown): New function.
6160         (General_options::General_options): Initialize new fields
6161         incremental_disposition_ and implicit_incremental_.
6162         (General_options::finalize): Check for uasge of --incremental-*
6163         without --incremental.
6165 2009-02-06  Chris Demetriou  <cgd@google.com>
6167         * gold.h (gold_undefined_symbol): Change to take only a Symbol
6168         pointer and to report location as the file name associated with
6169         the symbol.
6170         (gold_undefined_symbol_at_location): New function to replace the
6171         old gold_undefined_symbol functionality.
6172         * target-reloc.h (relocate_section): Update to use
6173         gold_undefined_symbol_at_location.
6174         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6175         Call gold_undefined_symbol function rather than gold_error.
6176         * errors.h (Errors::undefined_symbol): Take location as a
6177         string, rather than calculating it from a relocation.
6178         * errors.cc (Errors::fatal): Print "fatal error:" before the
6179         formatted message.
6180         (Errors::error, Errors::error_at_location): Print "error: "
6181         before the formatted message.
6182         (Errors::undefined_symbol): Take location as a string, rather
6183         than calculating it from a relocation.
6184         (gold_undefined_symbol_at_location): New function akin to
6185         old gold_undefined_symbol, calculates location from relocation.
6186         (gold_undefined_symbol): Change to take only a Symbol pointer
6187         and to report location as the file name associated with the symbol.
6188         * testsuite/debug_msg.sh: Update for changed error messages.
6189         * testsuite/undef_symbol.sh: Likewise.
6191 2009-02-04  Duncan Sands  <baldrick@free.fr>
6193         PR 9812
6194         * reduced_debug_output.h
6195         (Output_reduced_debug_abbrev_section::failed): Use format for
6196         gold_warning.
6197         (Output_reduced_debug_info_section::faild): Likewise.
6199 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
6201         * script.cc (Lazy_demangler): New class.
6202         (Version_script_info::get_symbol_version_helper): Demangle a
6203         symbol only once.
6205 2009-01-29  Cary Coutant  <ccoutant@google.com>
6207         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
6208         to __tls_get_addr.
6209         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
6211 2009-01-28  Ian Lance Taylor  <iant@google.com>
6213         * version.cc (version_string): Bump to 1.9.
6215         * gold.h: Include <cstring> and <stdint.h>.
6216         * version.cc: Include <cstdio>.
6217         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
6218         warning.
6219         * reduced_debug_output.cc (insert_into_vector): Rename from
6220         Insert_into_vector; change all callers.  Use Swap_unaligned to
6221         avoid aliasing issue; remove union since it is unnecessary.
6223 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
6225         * Makefile.am (CCFILES): Add gc.cc.
6226         (HFILES): Add gc.h.
6227         * Makefile.in: Regenerate.
6228         * gold.cc (Gc_runner): New class.
6229         (queue_initial_tasks): Call garbage collection related tasks
6230         when corresponding options are invoked.
6231         (queue_middle_gc_tasks): New function.
6232         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
6233         processed early before laying out sections during garbage collection.
6234         * gold.h (queue_middle_gc_tasks): New function.
6235         (is_prefix_of): Move from "layout.cc".
6236         * i386.cc (Target_i386::gc_process_relocs): New function.
6237         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
6238         * main.cc (main): Create object of class "Garbage_collection".
6239         * object.cc (Relobj::copy_symbols_data): New function.
6240         (Relobj::is_section_name_included): New function.
6241         (Sized_relobj::do_layout): Allow this function to be called twice
6242         during garbage collection and defer layout of section during the
6243         first call.
6244         * object.h (Relobj::get_symbols_data): New function.
6245         (Relobj::is_section_name_included): New function.
6246         (Relobj::copy_symbols_data): New function.
6247         (Relobj::set_symbols_data): New function.
6248         (Relobj::get_relocs_data): New function.
6249         (Relobj::set_relocs_data): New function.
6250         (Relobj::is_output_section_offset_invalid): New pure virtual function.
6251         (Relobj::gc_process_relocs): New function.
6252         (Relobj::do_gc_process_relocs): New pure virtual function.
6253         (Relobj::sd_): New data member.
6254         (Sized_relobj::is_output_section_offset_invalid): New function.
6255         (Sized_relobj::do_gc_process_relocs): New function.
6256         * options.h (General_options::gc_sections): Modify to not be a no-op.
6257         (General_options::print_gc_sections): New option.
6258         * plugin.cc (Plugin_finish::run): Remove function call to
6259         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
6260         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
6261         * reloc.cc (Read_relocs::run): Add task to process relocs and
6262         determine unreferenced sections when doing garbage collection.
6263         (Gc_process_relocs): New class.
6264         (Sized_relobj::do_gc_process_relocs): New function.
6265         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
6266         sections that are garbage collected.
6267         * reloc.h (Gc_process_relocs): New class.
6268         * sparc.cc (Target_sparc::gc_process_relocs): New function.
6269         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
6270         symbols whose corresponding sections are garbage collected.
6271         (Symbol_table::Symbol_table): Add new parameter for the garbage
6272         collection object.
6273         (Symbol_table::gc_mark_undef_symbols): New function.
6274         (Symbol_table::gc_mark_symbol_for_shlib): New function.
6275         (Symbol_table::gc_mark_dyn_syms): New function.
6276         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
6277         as garbage.
6278         (Symbol_table::add_from_object): Likewise.
6279         (Symbol_table::add_from_relobj): When building shared objects, do not
6280         treat externally visible symbols as garbage.
6281         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
6282         table information for static and relocatable links.
6283         * symtab.h (Symbol_table::set_gc): New function.
6284         (Symbol_table::gc): New function.
6285         (Symbol_table::gc_mark_undef_symbols): New function.
6286         (Symbol_table::gc_mark_symbol_for_shlib): New function.
6287         (Symbol_table::gc_mark_dyn_syms): New function.
6288         (Symbol_table::gc_): New data member.
6289         * target.h (Sized_target::gc_process_relocs): New pure virtual
6290         function.
6291         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
6292         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
6294 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
6296         * options.h (General_options::gc_sections): Define as a no-op for now.
6297         (General_options::no_keep_memory): Ditto.
6298         (General_options::Bshareable): Define.
6299         * options.cc (General_options::finalize): Honor -Bshareable.
6301 2009-01-20  Andreas Schwab  <schwab@suse.de>
6303         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
6304         read the value in the contents, since we don't use it.  Use the
6305         template endianness when writing.
6306         (Relocate::relocate): Use it for R_PPC_REL16_HA.
6308 2009-01-19  Andreas Schwab  <schwab@suse.de>
6310         * configure.tgt (powerpc64-*): Fix targ_obj.
6312 2009-01-15  Ian Lance Taylor  <iant@google.com>
6314         * object.cc (Sized_relobj::write_local_symbols): Don't write out
6315         local symbols when stripping all symbols.
6317 2009-01-14  Cary Coutant  <ccoutant@google.com>
6319         * output.cc (Output_reloc): Add explicit instantiations.
6321 2009-01-14  Cary Coutant  <ccoutant@google.com>
6323         * archive.cc (Archive::get_elf_object_for_member): Remove call
6324         to File_read::claim_for_plugin.
6325         * descriptors.cc (Descriptors::open): Remove reference to
6326         is_claimed.
6327         (Descriptors::claim_for_plugin): Remove.
6328         * descriptors.h (Descriptors::claim_for_plugin): Remove.
6329         (Descriptors::is_claimed): Remove.
6330         (claim_descriptor_for_plugin): Remove.
6331         * fileread.cc (File_read::claim_for_plugin): Remove.
6332         * fileread.h (File_read::claim_for_plugin): Remove.
6333         (File_read::descriptor): Reopen descriptor if necessary.
6334         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
6335         (Plugin_manager::all_symbols_read): Add task parameter. Change
6336         all callers.
6337         (Plugin_manager::get_input_file): New function.
6338         (Plugin_manager::release_input_file): New function.
6339         (Pluginobj::Pluginobj): Add filesize parameter and initialize
6340         corresponding data member.
6341         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
6342         and pass to base constructor. Change all callers.
6343         (get_input_file, release_input_file): New functions.
6344         (make_sized_plugin_object): Add filesize parameter. Change all callers.
6345         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
6346         (Plugin_manager::all_symbols_read): Add task parameter.
6347         (Plugin_manager::get_input_file): New function.
6348         (Plugin_manager::release_input_file): New function.
6349         (Plugin_manager::task_): New data member.
6350         (Pluginobj::Pluginobj): Add filesize parameter.
6351         (Pluginobj::filename): New function.
6352         (Pluginobj::descriptor): New function.
6353         (Pluginobj::filesize): New function.
6354         (Pluginobj::filesize_): New data member.
6355         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
6356         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
6357         File_read::claim_for_plugin; use Object::unlock to unlock the file.
6359         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
6360         with archive libraries.
6361         * testsuite/Makefile.in: Regenerate.
6362         * testsuite/plugin_test.c (struct sym_info): New type.
6363         (get_input_file, release_input_file): New static variables.
6364         (onload): Capture new transfer vector entries.
6365         (claim_file_hook): Stop reading at end of file according to filesize.
6366         Factor out parsing of readelf output into separate function.
6367         (all_symbols_read_hook): Exercise get_input_file and release_input_file
6368         APIs and get the source file name from the symbol table.  Convert
6369         source file name to corresponding object file name.  Print info
6370         message when adding new input files.
6371         (parse_readelf_line): New function.
6372         * testsuite/plugin_test_1.sh: Add checks for new info messages.
6373         * testsuite/plugin_test_2.sh: Likewise.
6374         * testsuite/plugin_test_3.sh: Likewise.
6375         * testsuite/plugin_test_4.sh: New test case.
6377 2009-01-07  Ian Lance Taylor  <iant@google.com>
6379         * version.cc (version_string): Bump to 1.8.
6381 2008-12-23  Cary Coutant  <ccoutant@google.com>
6383         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
6384         * plugin.cc (Plugin_manager::finish): Rename as
6385         layout_deferred_objects.  Move cleanup to separate function.
6386         (Plugin_manager::cleanup): New function.
6387         (Plugin_finish::run): Call layout_deferred_objects and cleanup
6388         separately.
6389         * plugin.h (Plugin_manager::finish): Rename as
6390         layout_deferred_objects.
6391         (Plugin_manager::cleanup): New function.
6392         (Plugin_manager::cleanup_done): New field.
6394 2008-12-23  Cary Coutant  <ccoutant@google.com>
6396         * plugin.cc (is_visible_from_outside): New function.
6397         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
6398         so we don't return "IR only" status for exported symbols or -r links.
6400         * testsuite/Makefile.am (plugin_test_3): New test case.
6401         * testsuite/Makefile.in: Regenerate.
6402         * testsuite/plugin_test_3.sh: New file.
6404 2008-12-22  Cary Coutant  <ccoutant@google.com>
6406         * object.cc (Sized_relobj::layout_section): New function.
6407         (Sized_relobj::do_layout): Defer layout of input sections until after
6408         plugin has provided replacement files.
6409         (Sized_relobj::do_layout_deferred_sections): New function.
6410         * object.h (Relobj::set_section_offset): Remove virtual keyword.
6411         (Relobj::layout_deferred_sections): New function.
6412         (Relobj::do_layout_deferred_sections): New function.
6413         (Sized_relobj::do_layout_deferred_sections): New function.
6414         (Sized_relobj::layout_section): New function.
6415         (Sized_relobj::Deferred_layout): New structure.
6416         (Sized_relobj::deferred_layout_): New field.
6417         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
6418         Change all callers.  Layout deferred sections.
6419         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
6420         references.
6421         (Plugin_hook::run): Move code from do_plugin_hook inline.
6422         (Plugin_hook::do_plugin_hook): Remove.
6423         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
6424         (Plugin_manager::finish): Renamed, was cleanup.
6425         (Plugin_manager::should_defer_layout): New function.
6426         (Plugin_manager::add_deferred_layout_object): New function.
6427         (Plugin_manager::Deferred_layout_list): New type.
6428         (Plugin_manager::deferred_layout_objects_): New field.
6429         (Plugin_hook::do_plugin_hook): Remove.
6431 2008-12-17  Ian Lance Taylor  <iant@google.com>
6433         * options.h (class General_options): Add --no case for
6434         --export-dynamic.
6436 2008-12-16  Cary Coutant  <ccoutant@google.com>
6438         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
6439         vector.
6440         (Plugin_manager::claim_file): Create plugin object even if
6441         plugin did not call the add_symbols callback.
6442         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
6443         asking for more symbols than were added.
6444         * testsuite/Makefile.am (plugin_test_1): Add test case with
6445         no global symbols.
6446         (empty.syms): New target.
6447         * testsuite/Makefile.in: Regenerate.
6448         * testsuite/plugin_test.c (claim_file_hook): Add new debug
6449         message. Don't call add_symbols if no globals.
6450         (all_symbols_read_hook): Don't provide replacement for empty
6451         claimed file.
6453 2008-12-12  Ian Lance Taylor  <iant@google.com>
6455         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
6456         r_type == 0 for a local symbol with r_sym == 0.
6457         (scan_relocatable_relocs): Pass r_sym to
6458         local_non_section_strategy.
6459         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
6460         r_sym parameter.
6462         * configure.ac: Update test for TLS descriptors: they are
6463         supported as of glibc 2.9.
6464         * configure: Rebuild.
6466 2008-12-11  Ian Lance Taylor  <iant@google.com>
6468         PR 7091
6469         * target-reloc.h (Default_scan_relocatable_relocs): For each
6470         function, map r_type == 0 to RELOC_DISCARD.
6472 2008-12-10  Cary Coutant  <ccoutant@google.com>
6474         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
6475         object to override a kept COMDAT group from a plugin object.
6477 2008-12-09  Ian Lance Taylor  <iant@google.com>
6479         PR 7088
6480         * yyscript.y (file_cmd): Handle INPUT.
6482         * testsuite/initpri1.c: Change all declarations to be full
6483         prototypes by adding void, to avoid compiler warnings.
6485 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
6487         * options.cc (General_options::parse_plugin_opt): New.
6488         (General_options::add_plugin): The argument now is just the filename.
6489         (General_options::add_plugin_option): New.
6490         * options.h (plugin_opt): New.
6491         (add_plugin): Change argument name.
6492         (add_plugin_option): New.
6493         * plugin.cc (Plugin::load): Don't parse the plugin option.
6494         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
6495         (Plugin::add_option): New.
6496         (Plugin::args_): Change type.
6497         (Plugin::filename_): New.
6498         (Plugin_manager::add_plugin_option): New.
6499         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
6500         * testsuite/Makefile.in: Regenerate.
6502 2008-12-05  Cary Coutant  <ccoutant@google.com>
6504         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
6505         Handle --strip-lto-sections option.
6506         * options.h (strip_lto_sections): New option.
6508 2008-12-01  Cary Coutant  <ccoutant@google.com>
6510         * plugin.cc (ld_plugin_message): Change format parameter to const.
6511         Fix mismatch between new[] and delete.
6513 2008-11-14  Cary Coutant  <ccoutant@google.com>
6515         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
6516         instead of -1U.
6518 2008-11-05  Craig Silverstein  <csilvers@google.com>
6520         * options.cc (General_options::parse_dynamic_list): New function.
6521         * options.h (General_options): New flags dynamic_list,
6522         dynamic_list_data, dynamic_list_cpp_new, and
6523         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
6524         (General_options::in_dynamic_list): New function.
6525         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
6526         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
6527         (Lex::can_continue_name): Likewise.
6528         (yylex): Likewise.
6529         (read_script_file): New parameter script_options.
6530         (read_dynamic_list): New function.
6531         (Script_options::define_dynamic_list): New function.
6532         (dynamic_list_keyword_parsecodes): New variable.
6533         (dynamic_list_keywords): New variable.
6534         * script.h (Script_options::define_dynamic_list): New function
6535         prototype.
6536         (read_dynamic_list): New function prototype.
6537         * symtab.cc (strprefix): New macro.
6538         (Symbol::should_add_dynsym_entry): Support dynamic_list,
6539         dynamic_list_data, dynamic_list_cpp_new, and
6540         dynamic_list_cpp_typeinfo.
6541         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
6542         (dynamic_list_expr): New rule.
6543         (dynamic_list_nodes): Likewise.
6544         (dynamic_list_node): Likewise.
6545         * testsuite/Makefile.am (dynamic_list): New test.
6546         * testsuite/Makefile.in: Regenerated.
6547         * testsuite/dynamic_list.t: New file.
6548         * testsuite/dynamic_list.sh: New file.
6550 2008-11-05  Craig Silverstein  <csilvers@google.com>
6552         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
6553         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
6554         (t11_last): Likewise.
6555         * testsuite/ver_test_6.c (main): Likewise.
6557 2008-10-07  Cary Coutant  <ccoutant@google.com>
6559         * options.c (General_options::finalize): Add check for -static and
6560         -shared.
6561         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
6562         is not empty.
6564 2008-10-02  Cary Coutant  <ccoutant@google.com>
6566         * plugin.cc (make_sized_plugin_object): Fix conditional
6567         compilation to work when not all targets are enabled.
6569 2008-09-29  Cary Coutant  <ccoutant@google.com>
6571         * archive.cc (Archive::get_file_and_offset): Use filename instead
6572         of name to get library path.
6573         (Archive::include_member): Unlock external member of a thin archive.
6575         * testsuite/Makefile.am (TEST_AR): New variable.
6576         (thin_archive_test_1): New test.
6577         (thin_archive_test_2): New test.
6578         * testsuite/Makefile.in: Regenerate.
6579         * testsuite/thin_archive_main.cc: New file.
6580         * testsuite/thin_archive_test_1.cc: New file.
6581         * testsuite/thin_archive_test_2.cc: New file.
6582         * testsuite/thin_archive_test_3.cc: New file.
6583         * testsuite/thin_archive_test_4.cc: New file.
6585 2008-09-29  Cary Coutant  <ccoutant@google.com>
6587         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
6588         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
6589         instead of -1U.
6590         (Sized_relobj::do_finalize_local_symbols): Likewise.
6591         (Sized_relobj::map_to_kept_section): Likewise.
6592         * object.h (Sized_relobj::invalid_address): New constant.
6593         (Sized_relobj::do_output_section_offset): Check for invalid_address
6594         and return -1ULL.
6595         * output.cc (Output_reloc::local_section_offset): Use constant
6596         invalid_address instead of -1U.
6597         (Output_reloc::get_address): Likewise.
6598         (Output_section::output_address): Change -1U to -1ULL.
6599         * output.h (Output_reloc::invalid_address): New constant.
6600         * reloc.cc (Sized_relobj::write_sections): Use constant
6601         invalid_address instead of -1U.
6602         (Sized_relobj::relocate_sections): Likewise.
6603         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
6604         values for merge sections.
6605         * target-reloc.h (relocate_for_relocatable): Use constant
6606         invalid_address instead of -1U.
6608 2008-09-19  Cary Coutant  <ccoutant@google.com>
6610         Add plugin functionality for link-time optimization (LTO).
6611         * configure.ac (plugins): Add --enable-plugins option.
6612         * configure: Regenerate.
6613         * config.in: Regenerate.
6614         * Makefile.am (LIBDL): New variable.
6615         (CCFILES): Add plugin.cc.
6616         (HFILES): Add plugin.h.
6617         (ldadd_var): Add LIBDL.
6618         * Makefile.in: Regenerate.
6620         * archive.cc: Include "plugin.h".
6621         (Archive::setup): Don't preread archive symbols when using a plugin.
6622         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
6623         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
6624         files.
6625         (Archive::include_member): Add symbols from plugin objects.
6626         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
6627         * descriptors.cc (Descriptors::open): Check for file descriptors
6628         abandoned by plugins.
6629         (Descriptors::claim_for_plugin): New function.
6630         * descriptors.h (Descriptors::claim_for_plugin): New function.
6631         (Open_descriptor::is_claimed): New field.
6632         (claim_descriptor_for_plugin): New function.
6633         * fileread.cc (File_read::claim_for_plugin): New function.
6634         * fileread.h (File_read::claim_for_plugin): New function.
6635         (File_read::descriptor): New function.
6636         * gold.cc: Include "plugin.h".
6637         (queue_initial_tasks): Add task to call plugin hooks for generating
6638         new object files.
6639         * main.cc: Include "plugin.h".
6640         (main): Load plugin libraries.
6641         * object.h (Pluginobj): Declare.
6642         (Object::pluginobj): New function.
6643         (Object::do_pluginobj): New function.
6644         (Object::set_target): New function.
6645         * options.cc: Include "plugin.h".
6646         (General_options::parse_plugin): New function.
6647         (General_options::General_options): Initialize plugins_ field.
6648         (General_options::add_plugin): New function.
6649         * options.h (Plugin_manager): Declare.
6650         (General_options): Add --plugin option.
6651         (General_options::has_plugins): New function.
6652         (General_options::plugins): New function.
6653         (General_options::add_plugin): New function.
6654         (General_options::plugins_): New field.
6655         * plugin.cc: New file.
6656         * plugin.h: New file.
6657         * readsyms.cc: Include "plugin.h".
6658         (Read_symbols::do_read_symbols): Check for archive before checking
6659         for ELF file.  Call plugin hooks to claim files.
6660         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
6661         from a real object file; force override when processing replacement
6662         files.
6663         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
6664         (Symbol::init_base_object): Likewise.
6665         (Symbol::init_base_output_data): Likewise.
6666         (Symbol::init_base_output_segment): Likewise.
6667         (Symbol::init_base_constant): Likewise.
6668         (Symbol::init_base_undefined): Likewise.
6669         (Symbol::output_section): Assert that object is not a plugin.
6670         (Symbol_table::add_from_pluginobj): New function.
6671         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
6672         undefined.
6673         (Symbol_table::sized_write_globals): Likewise.
6674         (Symbol_table::add_from_pluginobj): Instantiate template.
6675         * symtab.h (Sized_pluginobj): Declare.
6676         (Symbol::in_real_elf): New function.
6677         (Symbol::set_in_real_elf): New function.
6678         (Symbol::in_real_elf_): New field.
6679         (Symbol_table::add_from_pluginobj): New function.
6681         * testsuite/Makefile.am (AM_CFLAGS): New variable.
6682         (LIBDL): New variable.
6683         (LDADD): Add LIBDL.
6684         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
6685         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
6686         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
6687         (MOSTLYCLEANFILES): Likewise.
6688         * testsuite/Makefile.in: Regenerate.
6689         * testsuite/plugin_test.c: New file.
6690         * testsuite/plugin_test_1.sh: New file.
6691         * testsuite/plugin_test_2.sh: New file.
6693 2008-09-16  Ian Lance Taylor  <iant@google.com>
6695         * target-reloc.h (relocate_section): Check whether a symbol is
6696         defined by the ABI before reporting an undefined symbol error.
6697         * target.h (Target::is_defined_by_abi): Make parameter const.
6698         (Target::do_is_defined_by_abi): Likewise.
6699         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
6700         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
6701         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
6702         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
6703         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
6704         * testsuite/Makefile.in: Rebuild.
6706         * fileread.cc (make_view): Add casts to avoid warning.
6708 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
6710         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
6711         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6713 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
6715         * options.h (General_options::output_is_executable): New.
6716         (General_options::output_is_pie): New.
6717         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
6718         for shared libraries.
6719         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6721 2008-09-11  Chris Demetriou  <cgd@google.com>
6723         * options.h (origin): New -z option.
6724         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
6725         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
6726         in DT_FLAGS_1.
6728 2008-09-05  Cary Coutant  <ccoutant@google.com>
6730         * fileread.cc (File_read::make_view): Add check for attempt to map
6731         beyond end of file.
6733 2008-09-05  Cary Coutant  <ccoutant@google.com>
6735         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
6736         explicit instantiations.
6738 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
6740         PR gold/6858
6741         * options.cc (General_options::finalize): Allow undefined symbols
6742         in shlibs if linking -shared.
6744         PR gold/6859
6745         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
6746         symbols as not needing a dynsym entry.
6748 2008-08-20  Craig Silverstein  <csilvers@google.com>
6750         * fileread.cc (File_read::open): Do not lock the file unless it
6751         was successfully opened.
6753 2008-08-14  Cary Coutant  <ccoutant@google.com>
6755         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
6756         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
6757         * testsuite/tls_test.cc (struct int128): 128-bit struct
6758         for testing TLS relocs with non-zero addend.
6759         (v12): New TLS variable.
6760         (t12): New test.
6761         (t_last): Add check for v12.
6762         * testsuite/tls_test.h (t12): New function.
6763         * testsuite/tls_test_main.cc (thread_routine): Call new test.
6765 2008-08-13  Ian Lance Taylor  <iant@google.com>
6767         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
6768         set tls_segment_ or relro_segment_.
6769         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
6770         when appropriate.
6771         * output.h (Output_section::clear_is_relro): New function.
6772         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
6773         sections specially even when output_data_ is empty.
6774         (Output_segment::maximum_alignment): When first section is relro,
6775         only force alignment for PT_LOAD segments.
6776         * script.cc (script_data_segment_align): New function.
6777         (script_data_segment_relro_end): New function.
6778         * script-c.h (script_data_segment_align): Declare.
6779         (script_data_segment_relro_end): Declare.
6780         * script-sections.h (class Script_sections): Declare
6781         data_segment_align and data_segment_relro_end.  Add fields
6782         segment_align_index_ and saw_relro_end_.
6783         * script-sections.cc (class Sections_element): Add set_is_relro
6784         virtual function.  Add new bool* parameter to place_orphan_here.
6785         Add get_output_section virtual function.
6786         (class Output_section_definition): Add set_is_relro.  Add new
6787         bool* parameter to place_orphan_here.  Add get_output_section.
6788         Add is_relro_ field.
6789         (Output_section_definition::Output_section_definition): Initialize
6790         evaluated_address_, evaluated_load_address, evaluated_addralign_,
6791         and is_relro_ fields.
6792         (Output_section_definition::place_orphan_here): Add is_relro
6793         parameter.
6794         (Output_section_definition::set_section_addresses): Set relro for
6795         output section.
6796         (Output_section_definition::alternate_constraint): Likewise.
6797         (class Orphan_output_section): Add new bool* parameter to
6798         place_orphan_here.  Add get_output_section.
6799         (Orphan_output_section::place_orphan_here): Add is_relro
6800         parameter.
6801         (Script_sections::Script_sections): Initialize
6802         data_segment_align_index_ and saw_relro_end_.
6803         (Script_sections::data_segment_align): New function.
6804         (Script_sections::data_segment_relro_end): New function.
6805         (Script_sections::place_orphan): Set or clear is_relro.
6806         (Script_sections::set_section_addresses): Force alignment of first
6807         TLS section.
6808         * yyscript.y (exp): Call script_data_segment_align and
6809         script_data_segment_relro_end.
6810         * testsuite/relro_script_test.t: New file.
6811         * testsuite/relro_test.cc (using_script): Declare.
6812         (t1, t2): Test using_script.
6813         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
6814         (relro_script_test_SOURCES): Define.
6815         (relro_script_test_DEPENDENCIES): Define.
6816         (relro_script_test_LDFLAGS): Define.
6817         (relro_script_test_LDADD): Define.
6818         (relro_script_test.so): New target.
6819         * testsuite/Makefile.in: Rebuild.
6821 2008-08-06  Cary Coutant <ccoutant@google.com>
6823         * archive.cc (Archive::total_archives, Archive::total_members)
6824         (Archive::total_members_loaded): New variables.
6825         (Archive::setup): Add parameter.  Add option to preread
6826         archive symbols.
6827         (Archive::read_armap): Add counter.
6828         (Archive::get_file_and_offset): New function.
6829         (Archive::get_elf_object_for_member): New function.
6830         (Archive::read_all_symbols): New function.
6831         (Archive::read_symbols): New function.
6832         (Archive::add_symbols): Add counters.
6833         (Archive::include_all_members): Use armap to find members if it's
6834         already built.
6835         (Archive::include_member): Skip reading symbols if already read.
6836         Factored code into Archive::get_file_and_offset and
6837         Archive::get_elf_object_for_member.  Changed call to
6838         Mapfile::report_include_archive_member.
6839         (Archive::print_stats): New function.
6840         * archive.h: Declare Object and Read_symbols_data classes.
6841         (Archive::Archive): Add initializers for new members.
6842         (Archive::setup): Add parameter.
6843         (Archive::print_stats): New function.
6844         (Archive::total_archives, Archive::total_members)
6845         (Archive::total_members_loaded): New variables.
6846         (Archive::get_file_and_offset): New function.
6847         (Archive::get_elf_object_for_member): New function.
6848         (Archive::read_all_symbols): New function.
6849         (Archive::read_symbols): New function.
6850         (Archive::Archive_member): New class.
6851         (Archive::members_): New member.
6852         (Archive::num_members_): New member.
6853         * main.cc: Include archive.h.
6854         (main): Call Archive::print_stats.
6855         * mapfile.cc (Mapfile::report_include_archive_member): Delete
6856         archive parameter; member_name is now the fully-decorated name.
6857         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
6858         * options.h: (General_options): Add --preread-archive-symbols option.
6859         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
6860         Archive::setup.
6862 2008-08-04  Ian Lance Taylor  <iant@google.com>
6864         * symtab.h (Symbol::use_plt_offset): New function.
6865         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
6866         * powerpc.cc (Relocate::relocate): Likewise.
6867         * sparc.cc (Relocate::relocate): Likewise.
6868         * x86_64.cc (Relocate::relocate): Likewise.
6869         * testsuite/weak_plt.sh: New test.
6870         * testsuite/weak_plt_main.cc: New test.
6871         * testsuite/weak_plt_shared.cc: New test.
6872         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
6873         (check_PROGRAMS): Add weak_plt.
6874         (check_DATA): Add weak_plt_shared.so.
6875         (weak_plt_main_pic.o, weak_plt): New targets.
6876         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
6877         * testsuite/Makefile.in: Rebuild.
6879         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
6880         gcctestdir/ld.
6881         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
6882         * testsuite/Makefile.in: Rebuild.
6884 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
6886         * Makefile.am (POTFILES.in): Set LC_ALL=C.
6887         * Makefile.in: Regenerate.
6888         * po/POTFILES.in: Regenerate.
6890 2008-07-29  Ian Lance Taylor  <iant@google.com>
6892         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
6893         symbols before other symbols.
6894         * testsuite/script_test_2.cc (test_addr): Declare.
6895         (test_addr_alias): Declare.
6896         (main): Check that test_addr and test_addr_alias have the right
6897         values.
6898         * testsuite/script_test_2.t: Define test_addr_alias and
6899         test_addr.
6901 2008-07-24  Ian Lance Taylor  <iant@google.com>
6903         PR 5990
6904         * descriptors.cc: New file.
6905         * descriptors.h: New file.
6906         * gold-threads.h (class Hold_optional_lock): New class.
6907         * fileread.cc: Include "descriptors.h".
6908         (File_read::~File_read): Release descriptor rather than closing
6909         it.
6910         (File_read::open) [file]: Call open_descriptor rather than open.
6911         Set is_descriptor_opened_.
6912         (File_read::open) [memory]: Assert that descriptor is not open.
6913         (File_read::reopen_descriptor): New function.
6914         (File_read::release): Release descriptor.
6915         (File_read::do_read): Make non-const.  Reopen descriptor.
6916         (File_read::read): Make non-const.
6917         (File_read::make_view): Reopen descriptor.
6918         (File_read::do_readv): Likewise.
6919         * fileread.h (class File_read): Add is_descriptor_opened_ field.
6920         Update declarations.
6921         * layout.cc: Include "descriptors.h".
6922         (Layout::create_build_id): Use open_descriptor rather than open.
6923         * output.cc: Include "descriptors.h".
6924         (Output_file::open): Use open_descriptor rather than open.
6925         * archive.cc (Archive::const_iterator): Change Archive to be
6926         non-const.
6927         (Archive::begin, Archive::end): Make non-const.
6928         (Archive::count_members): Likewise.
6929         * archive.h (class Archive): Update declarations.
6930         * object.h (Object::read): Make non-const.
6931         * Makefile.am (CCFILES): Add descriptors.cc.
6932         (HFILES): Add descriptors.h.
6933         * Makefile.in: Rebuild.
6935         PR 6716
6936         * gold.h: Always include <clocale>.  Add Solaris workarounds
6937         following code in binutils/sysdep.h.
6939         PR 6048
6940         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
6941         this->eh_frame_hdr_ is NULL before using it.
6943         * dynobj.cc (Versions::Versions): Update comment.
6945         * dynobj.cc (Versions::Versions): If there is an soname, use it as
6946         the base version name.
6948         * stringpool.cc (Stringpool_template::add_with_length): Set key to
6949         array size plus one.
6950         (Stringpool_template::set_string_offsets): Subtract one from key
6951         before using it as an array index.
6952         (Stringpool_template::get_offset_with_length): Likewise.
6953         (Stringpool_template::write_to_buffer): Likewise.
6954         * stringpool.h (Stringpool_template::get_offset_from_key):
6955         Likewise.
6957 2008-07-23  Ian Lance Taylor  <iant@google.com>
6959         PR 6658
6960         * object.h (Merged_symbol_value::value): Do our best to handle a
6961         negative addend.
6963         PR 6647
6964         * script.cc (Version_script_info::get_versions): Don't add empty
6965         version tag to return value.
6966         (Version_script_info::get_symbol_version_helper): Change return
6967         type to bool.  Add pversion parameter.  Change all callers.
6968         (script_register_vers_node): Don't require a non-NULL tag.
6969         * script.h (class Version_script_info): Update declarations.
6970         (Version_script_info::get_symbol_version): Change return type to
6971         bool.  Add version parameter.  Change all callers.
6972         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
6973         handling.  Handle an empty version from a version script.
6974         (Symbol_table::define_special_symbol): Likewise.
6975         * testsuite/ver_test_10.script: New file.
6976         * testsuite/ver_test_10.sh: New file.
6977         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
6978         (check_DATA): Add ver_test_10.syms.
6979         (ver_test_10.syms, ver_test_10.so): New target.
6980         * testsuite/Makefile.in: Rebuild.
6982 2008-07-23  Simon Baldwin  <simonb@google.com>
6984         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
6985         to zero for undefined symbols from dynamic libraries.
6987 2008-07-23  Ian Lance Taylor  <iant@google.com>
6989         * symtab.cc (Symbol_table::resolve): Remove version parameter.
6990         Change all callers.
6991         * symtab.h (class Symbol_table): Update declaration.
6992         * testsuite/ver_test_9.cc: New file.
6993         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
6994         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
6995         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
6996         (ver_test_9.so, ver_test_9.o): New targets.
6997         * testsuite/Makefile.in: Rebuild.
6999 2008-07-22  Ian Lance Taylor  <iant@google.com>
7001         * options.h (class General_options): Define --check-sections.
7002         * layout.cc (Layout::set_segment_offsets): Handle
7003         --check-sections.
7005         * options.h (class General_options): Define -n/--nmagic and
7006         -N/--omagic.
7007         * options.cc (General_options::finalize): For -n/--nmagic or
7008         -N/--omagic, set -static.
7009         * layout.cc (Layout::attach_allocated_section_to_segment): If
7010         -N/--omagic, don't put read-only and read-write sections in
7011         different segments.
7012         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
7013         finding a read-only segment.
7014         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
7015         don't set the minimum segment alignment to the common page size,
7016         and don't set the file offset to the address modulo the page size.
7017         * script-sections.cc (Script_sections::create_segments): If
7018         -n/--omagic, don't put read-only and read-write sections in
7019         different segments.
7021         * cref.cc: New file.
7022         * cref.h: New file.
7023         * options.h (class General_options): Add --print-symbol-counts.
7024         * main.cc (main): Issue defined symbol report if requested.
7025         * archive.cc (Archive::interpret_header): Make into a const member
7026         function.
7027         (Archive::add_symbols): Call Input_objects::archive_start and
7028         archive_stop.
7029         (Archive::const_iterator): Define new class.
7030         (Archive::begin, Archive::end): New functions.
7031         (Archive::include_all_members): Rewrite to use iterator.
7032         (Archive::count_members): New function.
7033         * archive.h (class Archive): Update declarations.
7034         (Archive::filename): New function.
7035         * object.cc: Include "cref.h".
7036         (Sized_relobj::Sized_relobj): Initialize defined_count_.
7037         (Sized_relobj::do_get_global_symbol_counts): New function.
7038         (Input_objects::add_object): Add object to cross-referencer.
7039         (Input_objects::archive_start): New function.
7040         (Input_objects::archive_stop): New function.
7041         (Input_objects::print_symbol_counts): New function.
7042         * object.h: Declare Cref and Archive.
7043         (Object::get_global_symbol_counts): New function.
7044         (Object::do_get_global_symbol_counts): New pure virtual function.
7045         (class Sized_relobj): Add defined_count_ field.  Update
7046         declarations.
7047         (class Input_objects): Add cref_ field.  Update constructor.
7048         Update declarations.
7049         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
7050         defined_count_.
7051         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
7052         symbol counts.
7053         (Sized_dynobj::do_get_global_symbol_counts): New function.
7054         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
7055         defined_count_.  Update declarations.  Define Symbols typedef.
7056         * symtab.cc (Symbol_table::add_from_relobj): Add defined
7057         parameter.  Change all callers.
7058         (Symbol_table::add_from_dynobj): Add sympointers and defined
7059         parameters.  Change all callers.
7060         * symtab.h (class Symbol_table): Update declarations.
7061         * Makefile.am (CCFILES): Add cref.cc.
7062         (HFILES): Add cref.h.
7063         * Makefile.in: Rebuild.
7065 2008-07-22  Simon Baldwin  <simonb@google.com>
7067         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
7068         to zero when writing undefined symbols.
7070 2008-07-22  Ian Lance Taylor  <iant@google.com>
7072         * output.cc (Output_section::add_input_section): Don't try to
7073         merge empty merge sections.
7075 2008-07-21  Craig Silverstein  <csilvers@google.com>
7077         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
7078         Include symbol version in error message.
7080 2008-07-20  Chris Demetriou  <cgd@google.com>
7082         * configure.ac (gold_cv_c_random_seed): New configured variable.
7083         (RANDOM_SEED_CFLAGS): New substituted variable.
7084         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
7085         * configure: Rebuild.
7086         * Makefile.in: Likewise.
7087         * testsuite/Makefile.in: Likewise.
7089 2008-07-18  Ian Lance Taylor  <iant@google.com>
7091         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
7092         where we see NAME/NULL and NAME/VERSION  as separate symbols.
7093         * testsuite/ver_test_main.cc (main): Call t4.
7094         (t4, t4_2a): Define.
7095         * testsuite/ver_test_2.cc (t4_2): Define.
7096         * testsuite/ver_test_2.script: Put t4_2a in VER2.
7097         * testsuite/ver_test_4.cc (t4_2a): Define.
7098         * testsuite/ver_test_4.script: Put t4_2a in VER2.
7099         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
7101 2008-07-17  Ian Lance Taylor  <iant@google.com>
7103         * dynobj.cc (Versions::add_def): If we give an error about a
7104         missing version, go ahead and create the version anyhow.
7106 2008-07-10  Ian Lance Taylor  <iant@google.com>
7108         Handle output sections with more than 0x7fffffff bytes.
7109         * object.h (class Relobj): Change map_to_output_ to
7110         output_sections_, and just keep a section pointer.  Change all
7111         uses.  Move comdat group support to Sized_relobj.
7112         (Relobj::is_section_specially_mapped): Remove.
7113         (Relobj::output_section): Remove poff parameter.  Change all
7114         callers.
7115         (Relobj::output_section_offset): New function.
7116         (Relobj::set_section_offset): Rewrite.
7117         (Relobj::map_to_output): Remove.
7118         (Relobj::output_sections): New function.
7119         (Relobj::do_output_section_offset): New pure virtual function.
7120         (Relobj::do_set_section_offset): Likewise.
7121         (class Sized_relobj): Add section_offsets_ field.  Add comdat
7122         group support from Relobj.  Update declarations.
7123         (Sized_relobj::get_output_section_offset): New function.
7124         (Sized_relobj::do_output_section_offset): New function.
7125         (Sized_relobj::do_set_section_offset): New function.
7126         * object.cc (Relobj::output_section_address): Remove.
7127         (Sized_relobj::Sized_relobj): Initialize new fields.
7128         (Sized_relobj::include_section_group): Cast find_kept_object to
7129         Sized_relobj.
7130         (Sized_relobj::include_linkonce_section): Likewise.
7131         (Sized_relobj::do_layout): Use separate arrays for output section
7132         and output offset.
7133         (Sized_relobj::do_count_local_symbols): Change map_to_output to
7134         output_sections.
7135         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
7136         output_sections and section_offsets.
7137         (Sized_relobj::write_local_symbols): Likewise.
7138         (map_to_kept_section): Compute output address directly.
7139         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
7140         output_sections and section_offsets.
7141         (Sized_relobj::write_sections): Likewise.
7142         (Sized_relobj::relocate_sections): Likewise.
7143         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
7144         * output.h (class Output_reloc): Update declarations.  Change
7145         u2_.relobj to Sized_relobj*.
7146         (class Output_data_reloc): Change add functions to use
7147         Sized_relobj*.
7148         * output.cc (Output_reloc::Output_reloc): Change relobj to
7149         Sized_relobj*.
7150         (Output_reloc::local_section_offset): Change return type to
7151         Elf_Addr.  Use get_output_section_offset.
7152         (Output_reloc::get_address): Likewise.
7153         (Output_section::is_input_address_mapped): Don't call
7154         is_section_specially_mapped.
7155         (Output_section::output_offset): Likewise.
7156         (Output_section::output_address): Likewise.
7157         (Output_section::starting_output_address): Likewise.
7158         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
7159         parameter to Sized_relobj*.
7160         (Copy_relocs::need_copy_reloc): Likewise.
7161         (Copy_relocs::save): Likewise.
7162         * copy-relocs.h (class Copy_relocs): Update declarations.
7163         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
7164         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
7165         * target-reloc.h (relocate_for_relocatable): Change
7166         offset_in_output_section type to Elf_Addr.  Change code that uses
7167         it as well.
7168         * layout.cc (Layout::layout): Always set *off.
7169         * mapfile.cc (Mapfile::print_input_section): Use
7170         output_section_offset.
7171         * i386.cc (Target_i386::copy_reloc): Change object parameter to
7172         Sized_relobj*.
7173         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
7174         * sparc.cc (Target_sparc::copy_reloc): Likewise.
7175         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
7177 2008-07-03  Ian Lance Taylor  <iant@google.com>
7179         * layout.cc (Layout::include_section): Do not discard unrecognized
7180         SHT_STRTAB sections.
7182 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
7184         * script.cc (Lex::can_continue_name): Make '?' allowable in
7185         version-script names.
7186         * testsuite/version_script.map: Change glob pattern to use '?'
7188 2008-06-30  Manish Singh  <yosh@gimp.org>
7190         PR 6585
7191         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
7192         Correct typo.
7194 2008-06-30  Ian Lance Taylor  <iant@google.com>
7196         PR 6660
7197         PR 6682
7198         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
7199         versions]: Don't try to read the value in the contents, since we
7200         don't use it.  Use the template endianness when writing.
7202 2008-06-25  Cary Coutant  <ccoutant@google.com>
7204         * fileread.cc (File_read::make_view): Assert on zero-length view.
7205         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
7206         symbol table when there are no symbols to read.
7208 2008-06-23  Craig Silverstein  <csilvers@google.com>
7210         * version.cc (version_string): Bump to 1.7
7212 2008-06-18  Craig Silverstein  <csilvers@google.com>
7214         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
7215         constant 0xFFFF to type Valtype.
7216         (Powerpc_relocate_functions::rel16_ha): Likewise.
7218 2008-06-17  Ian Lance Taylor  <iant@google.com>
7220         * output.h (Output_section::Input_section): Initialize p2align_ to
7221         zero for Output_section_data constructors.
7222         (Output_section::Input_section::addralign): If not an input
7223         section, return the alignment of the Output_section_data.
7224         * testsuite/copy_test.cc: New file.
7225         * testsuite/copy_test_1.cc: New file.
7226         * testsuite/copy_test_2.cc: New file.
7227         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
7228         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
7229         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
7230         (copy_test_1_pic.o, copy_test_1.so): New targets.
7231         (copy_test_2_pic.o, copy_test_2.so): New targets.
7232         * testsuite/Makefile.in: Rebuild.
7234         * script-sections.cc (Script_sections::place_orphan): Initialize
7235         local variable exact.
7237 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
7239         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
7241 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
7242             David S. Miller  <davem@davemloft.net>
7244         * powerpc.cc: New file.
7245         * Makefile.am (TARGETSOURCES): Add powerpc.cc
7246         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
7247         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
7248         * Makefile.in: Rebuild.
7250 2008-06-09  Ian Lance Taylor  <iant@google.com>
7252         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
7253         <exception>.
7254         (throwing, orig_terminate): New static variables.
7255         (terminate_handler): New static function.
7256         (t2): Set terminate handler.
7258 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
7260         PR 6584
7261         * binary.cc (Binary_to_elf::sized_convert): Fix .data
7262         alignment.
7264 2008-05-30  Cary Coutant  <ccoutant@google.com>
7266         * archive.cc (Archive::include_all_members) Correct to step
7267         over symbol table and extended name table in thin archives.
7269 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
7271         PR 6407
7272         * target-reloc.h (relocate_for_relocatable): Fix new_offset
7273         calculation.
7275 2008-05-28  Caleb Howe  <cshowe@google.com>
7277         * reduced_debug_output.cc: New file.
7278         * reduced_debug_output.h: New file.
7279         * options.h (class General_options): Add --strip-debug-non-line.
7280         * options.cc (General_options::finalize): Add strip_debug_non_line
7281         to the strip heirarchy.
7282         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
7283         fields.
7284         * layout.cc: Include "reduced_debug_output.h".
7285         (Layout::Layout): Initialize new fields.
7286         (line_only_debug_sections): New static array.
7287         (is_lines_only_debug_sections): New static inline function.
7288         (Layout::include_section): Handle --strip-debug-non-line.
7289         (Layout::make_output_section): If --strip-debug-non-line, build
7290         new output sections for .debug_abbrev and .debug_info.
7291         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
7292         gold.  Warn about possible overflow.
7293         (read_signed_LEB_128): Likewise.
7294         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
7295         (read_signed_LEB_128): Declare.
7296         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
7297         (HFILES): Add reduced_debug_output.h.
7298         * Makefile.in: Rebuild.
7300 2008-05-21  Ian Lance Taylor  <iant@google.com>
7302         * mapfile.cc: New file.
7303         * mapfile.h: New file.
7304         * options.h (class General_options): Add -M/--print-map and -Map.
7305         * options.cc (General_options::finalize): Make -M equivalent to
7306         -Map -.
7307         * main.cc: Include <cstdio> and "mapfile.h".
7308         (main): Open mapfile if requested.
7309         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
7310         constructor.  Change caller.
7311         (queue_initial_tasks): Add mapfile parameter.  Change caller.
7312         (queue_middle_tasks): Likewise.
7313         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
7314         declarations.
7315         * archive.cc: Include "mapfile.h".
7316         (Archive::add_symbols): Add mapfile parameter.  Change all
7317         callers.  Pass mapfile, symbol, and reason to include_member.
7318         (Archive::include_all_members): Add mapfile parameter.  Change all
7319         callers.
7320         (Archive::include_member): Add mapfile, sym, and why parameters.
7321         Change all callers.  Report inclusion to map file.
7322         * archive.h: Include "fileread.h".
7323         (class Archive): Update declarations.
7324         (Archive::file): New const method.
7325         (class Add_archive_symbols): Add mapfile_ field.  Update
7326         constructor.  Change all callers.
7327         * readsyms.h (class Read_symbols): Likewise.
7328         (class Finish_group): Likewise.
7329         (class Read_script): Likewise.
7330         * common.cc: Include "mapfile.h".
7331         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
7332         all callers.
7333         (Symbol_table::do_allocate_commons): Likewise.
7334         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
7335         symbol allocation to mapfile.
7336         * common.h (class Allocate_commons_task): Add mapfile_ field.
7337         Update constructor.  Change all callers.
7338         * symtab.h (class Symbol_table): Update declarations.
7339         * layout.cc: Include "mapfile.h".
7340         (Layout_task_runner::run): Print information to mapfile.
7341         (Layout::create_gold_note): Change Output_data_fixed_space to
7342         Output_data_zero_fill.
7343         (Layout::create_build_id): Likewise.
7344         (Layout::print_to_mapfile): New function.
7345         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
7346         constructor.  Change caller.
7347         (class Layout): Declare print_to_mapfile.
7348         * output.cc (Output_section::Input_section::print_to_mapfile): New
7349         function.
7350         (Output_section::add_input_section): If producing a map, always
7351         add to input_sections_ list.
7352         (Output_section::do_print_to_mapfile): New function.
7353         (Output_segment::print_sections_to_mapfile): New function.
7354         (Output_segment::print_section_list_to_mapfile): New function.
7355         * output.h: Include "mapfile.h".
7356         (Output_data::print_to_mapfile): New function.
7357         (Output_data::do_print_to_mapfile): New virtual function.
7358         (Output_segment_headers::do_print_to_mapfile): New function.
7359         (Output_file_header::do_print_to_mapfile): New function.
7360         (Output_data_const::do_print_to_mapfile): New function.
7361         (class Output_data_const_buffer): Add map_name_ field.  Update
7362         constructor.  Change all callers.  Add do_print_to_mapfile
7363         function.
7364         (class Output_data_fixed_space): Likewise.
7365         (class Output_data_space): Likewise.
7366         (class Output_data_zero_fill): New class.
7367         (Output_data_strtab::do_print_to_mapfile): New function.
7368         (Output_data_reloc_base::do_print_to_mapfile): New function.
7369         (Output_relocatable_relocs::do_print_to_mapfile): New function.
7370         (Output_data_group::do_print_to_mapfile): New function.
7371         (Output_data_got::do_print_to_mapfile): New function.
7372         (Output_data_dynamic::do_print_to_mapfile): New function.
7373         (Output_symtab_xindex::do_print_to_mapfile): New function.
7374         (class Output_section): Declare do_print_to_mapflie.  Declare
7375         print_to_mapfile in Input_section.
7376         (class Output_segment): Declare new functions.
7377         * object.h (Sized_relobj::symbol_count): New function.
7378         * script-sections.cc
7379         (Output_section_element_dot_assignment::set_section_addresses):
7380         Change Output_data_fixed_space to Output_data_zero_fill.
7381         (Output_data_expression::do_print_to_mapfile): New function.
7382         * script.cc (read_input_script): Add mapfile parameter.  Change
7383         all callers.
7384         * script.h (read_input_script): Update declaration.
7385         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
7386         (Eh_frame::do_print_to_mapfile): New function.
7387         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
7388         (Output_merge_string::do_print_to_mapfile): New function.
7389         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
7390         function.
7391         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
7392         function.
7393         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
7394         function.
7395         * Makefile.am (CCFILES): Add mapfile.cc.
7396         (HFILES): Add mapfile.h.
7397         * Makefile.in: Rebuild.
7399 2008-05-19  Ian Lance Taylor  <iant@google.com>
7401         * options.h (class General_options): Add -z relro.
7402         * layout.cc (Layout::Layout): Initialize relro_segment_.
7403         (Layout::add_output_section_data): Return the output section.
7404         (Layout::make_output_section): Rcognize relro sections and mark
7405         them appropriately.
7406         (Layout::attach_allocated_section_to_segment): Put relro sections
7407         in a PT_GNU_RELRO segment.
7408         (Layout::create_initial_dynamic_sections): Mark the .dynamic
7409         section as relro.
7410         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
7411         PT_TLS segments.
7412         (Layout::linkonce_mapping): Map d.rel.ro.local to
7413         .data.rel.ro.local.
7414         (Layout::output_section_name): Us .data.rel.ro.local for any
7415         section which begins with that.
7416         * layout.h (class Layout): Update add_output_section_data
7417         declaration.  Add relro_segment_ field.
7418         * output.cc (Output_section::Output_section): Initialize is_relro_
7419         and is_relro_local_ fields.
7420         (Output_segment::add_output_section): Group relro sections.
7421         (Output_segment::is_first_section_relro): New function.
7422         (Output_segment::maximum_alignment): If there is a relro section,
7423         align the segment to the common page size.
7424         (Output_segment::set_section_addresses): Track whether we are
7425         looking at relro sections.  If the last section is a relro
7426         section, align to the common page size.
7427         (Output_segment::set_section_list_addresses): Add in_relro
7428         parameter.  Change all callers.  Align to the page size when
7429         moving from relro to non-relro section.
7430         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
7431         segment.
7432         * output.h (class Output_section): Add is_relro_ and
7433         is_relro_local_ fields.
7434         (Output_section::is_relro): New function.
7435         (Output_section::set_is_relro): New function.
7436         (Output_section::is_relro_local): New function.
7437         (Output_section::set_is_relro_local): New function.
7438         (class Output_segment): Update declarations.
7439         * i386.cc (Target_i386::got_section): Mark .got section as relro.
7440         * sparc.cc (Target_sparc::got_section): Likewise.
7441         * x86_64.cc (Target_x86_64::got_section): Likewise.
7442         * testsuite/relro_test_main.cc: New file.
7443         * testsuite/relro_test.cc: New file.
7444         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
7445         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
7446         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
7447         (relro_test.so, relro_test_pic.o): New targets.
7448         * testsuite/Makefile.in: Rebuild.
7450 2008-05-16  Ian Lance Taylor  <iant@google.com>
7452         * output.cc (Output_segment::add_output_section): Remove front
7453         parameter.
7454         * output.h (class Output_segment): Remove
7455         add_initial_output_section and overloaded add_output_section.
7456         Update declaration of remaining add_output_section.
7457         * layout.cc (Layout::create_interp): Call add_output_section
7458         rather than add_initial_output_section.
7459         (Layout::finish_dynamic_section): Likewise.
7461         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
7462         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
7463         know the dynamic type.
7464         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
7465         field.  Initialize it in constructor.
7466         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
7467         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
7468         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
7469         reloc.
7471         * output.cc (Output_reloc::get_address): Change return type to
7472         Elf_Addr.
7473         * output.h (class Output_reloc): Update get_address declaration.
7474         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
7475         for section addresses.
7477 2008-05-09  Ian Lance Taylor  <iant@google.com>
7479         PR 6493
7480         * gold.cc (gold_nomem): Use return value of write.
7482 2008-05-08  Ian Lance Taylor  <iant@google.com>
7484         * symtab.c (Symbol::init_base_output_data): Add version
7485         parameter.  Change all callers.
7486         (Symbol::init_base_output_segment): Likewise.
7487         (Symbol::init_base_constant): Likewise.
7488         (Symbol::init_base_undefined): Likewise.
7489         (Sized_symbol::init_output_data): Likewise.
7490         (Sized_symbol::init_output_segment): Likewise.
7491         (Sized_symbol::init_constant): Likewise.
7492         (Sized_symbol::init_undefined): Likewise.
7493         (Symbol_table::do_define_in_output_data): If the new symbol has a
7494         version, mark it as the default.
7495         (Symbol_table::do_define_in_output_segment): Likewise.
7496         (Symbol_table::do_define_as_constant): Likewise.
7497         * symtab.h (class Symbol): Update declarations.
7498         (class Sized_symbol): Likewise.
7499         * resolve.cc (Symbol::override_version): New function.
7500         (Symbol::override_base): Call override_version.
7501         (Symbol::override_base_with_special): Likewise.
7502         * testsuite/ver_script_8.script: New file.
7503         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
7504         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
7505         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
7506         (ver_test_8_1.so, ver_test_8_2.so): New targets.
7508 2008-05-06  Ian Lance Taylor  <iant@google.com>
7510         PR 6049
7511         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
7512         functions.
7513         (class General_options): Remove existing --undefined, and add
7514         --no-undefined instead.  Add new --undefined as synonym for -u.
7515         * archive.cc (Archive::add_symbols): Check whether symbol was
7516         named with -u.
7517         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
7518         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
7519         all uses.  Add IS_UNDEFINED.  Update declarations to split
7520         different versions of init_base.  Declare init_base_undefined.
7521         (Symbol::is_defined): Handle IS_UNDEFINED.
7522         (Symbol::is_undefined): Likewise.
7523         (Symbol::is_weak_undefined): Call is_undefined.
7524         (Symbol::is_absolute): Handle IS_CONSTANT.
7525         (class Sized_symbol): Update declarations to split different
7526         versions of init.  Declare init_undefined.
7527         (class Symbol_table): Declare new functions.
7528         * symtab.cc (Symbol::init_base_object): Rename from init_base.
7529         Change all callers.
7530         (Symbol::init_base_output_data): Likewise.
7531         (Symbol::init_base_output_segment): Likewise.
7532         (Symbol::init_base_constant): Likewise.
7533         (Symbol::init_base_undefined): New function.
7534         (Sized_symbol::init_object): Rename from init.  Change all
7535         callers.
7536         (Sized_symbol::init_output_data): Likewise.
7537         (Sized_symbol::init_output_segment): Likewise.
7538         (Sized_symbol::init_constant): Likewise.
7539         (Sized_symbol::init_undefined): New function.
7540         (Symbol_table::add_undefined_symbols_from_command_line): New
7541         function.
7542         (Symbol_table::do_add_undefined_symbols_from_command_line): New
7543         function.
7544         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
7545         (Symbol::output_section): Likewise.
7546         (Symbol::set_output_section): Likewise.
7547         (Symbol_table::sized_finalize_symbol): Likewise.
7548         (Symbol_table::sized_write_globals): Likewise.
7549         * resolve.cc (Symbol_table::should_override): Likewise.
7550         (Symbol::override_base_with_special): Likewise.
7552         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
7553         symbol, change it to have default visibility.
7554         * testsuite/protected_1.cc: New file.
7555         * testsuite/protected_2.cc: New file.
7556         * testsuite/protected_3.cc: New file.
7557         * testsuite/protected_main_1.cc: New file.
7558         * testsuite/protected_main_2.cc: New file.
7559         * testsuite/protected_main_3.cc: New file.
7560         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
7561         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
7562         (protected_1_LDFLAGS, protected_1_LDADD): Define.
7563         (protected_1.so): New target.
7564         (protected_1_pic.o, protected_2_pic.o): New targets.
7565         (protected_3_pic.o): New target.
7566         (check_PROGRAMS): Add protected_2.
7567         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
7568         (protected_2_LDFLAGS, protected_2_LDADD): Define.
7569         * testsuite/Makefile.in: Rebuild.
7571         * options.h (DEFINE_var): Add set_user_set_##varname__.
7572         (DEFINE_bool_alias): New macro.
7573         (class General_options): Define -Bstatic using DEFINE_bool_alias
7574         rather than DEFINE_special.  Add --undefined as an alias for -z
7575         defs.
7576         * options.cc (General_options::parse_Bstatic): Remove.
7578         * options.h (class General_options): Add --fatal-warnings.
7579         * main.cc (main): Implement --fatal-warnings.
7580         * errors.h (Errors::warning_count): New function.
7582         * options.h (class General_options): Add -Bsymbolic-functions.
7583         * symtab.h (Symbol::is_preemptible): Check for
7584         -Bsymbolic-functions.
7586 2008-05-05  Ian Lance Taylor  <iant@google.com>
7588         * options.h (DEFINE_bool): For DASH_Z, create the negative option
7589         as noVARNAME rather than no-VARNAME.
7590         (class General_options): Add option -z combreloc.
7591         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
7592         get_address.
7593         (Output_reloc::sort_before) [SHT_REL]: New function.
7594         (Output_reloc::sort_before) [SHT_RELA]: New function.
7595         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
7596         Sort_relocs_comparison.
7597         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
7598         parameter.  Change all callers.
7599         (Output_data_reloc::Output_data_reloc) [both versions]: Add
7600         sort_relocs parameter.  Change all callers.
7601         * output.cc (Output_reloc::get_address): New function, broken out
7602         of write_rel.
7603         (Output_reloc::write_rel): Call it.
7604         (Output_reloc::compare): New function.
7605         (Output_data_reloc_base::do_write): Optionally sort relocs.
7607         * configure.ac: If targ_extra_obj is set, link it in.
7608         * configure.tgt: Initialize all variables.
7609         (x86_64*): Set targ_extra_obj and targ_extra_size.
7610         * configure: Rebuild.
7612         * object.cc (Sized_relobj::include_section_group): Adjust section
7613         indexes read from group data.  Build vector to pass to
7614         layout_group.
7615         * layout.cc (Layout::layout_group): Add flags and shndxes
7616         parameters.  Remove contents parameter.  Change caller.  Update
7617         explicit instantiations.
7618         * layout.h (class Layout): Update layout_group declaration.
7619         * output.cc (Output_data_group::Output_data_group): Add flags and
7620         input_shndxes parameters.  Remove contents parameter.  Change
7621         caller.
7622         (Output_data_group::do_write): Change input_sections_ to
7623         input_shndxes_.
7624         * output.h (class Output_data_group): Update constructor
7625         declaration.  Rename input_sections_ to input_shndxes_.
7626         * testsuite/many_sections_test.cc: Add template.
7628 2008-04-30  Cary Coutant  <ccoutant@google.com>
7630         * target-reloc.h (relocate_section): Fix dead-pointer bug.
7632         * layout.cc (Layout::include_section): Refactored check for debug
7633         info section.
7634         (Layout::add_comdat): Add new parameters.  Change type
7635         of signature parameter.  Add object and shndx to signatures table.
7636         (Layout::find_kept_object): New function.
7637         * layout.h: Include <cstring>.
7638         (Layout::is_debug_info_section): New function.
7639         (Layout::add_comdat): Add new parameters.
7640         (Layout::find_kept_object): New function.
7641         (Layout::Kept_section): New struct.
7642         (Layout::Signatures): Change type of map range.
7643         * object.cc (Relobj::output_section_address): New function.
7644         (Sized_relobj::include_section_group): Add new parameters.  Change
7645         calls to Layout::add_comdat.  Change to build table of kept comdat
7646         groups and table mapping discarded sections to kept sections.
7647         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
7648         (Sized_relobj::do_layout): Change calls to include_section_group and
7649         include_linkonce_section.
7650         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
7651         value to zero when section is discarded.
7652         (Sized_relobj::map_to_kept_section): New function.
7653         * object.h (Relobj::output_section_address): New function.
7654         (Relobj::Comdat_group): New type.
7655         (Relobj::find_comdat_group): New function.
7656         (Relobj::Comdat_group_table): New type.
7657         (Relobj::Kept_comdat_section): New type.
7658         (Relobj::Kept_comdat_section_table): New type.
7659         (Relobj::add_comdat_group): New function.
7660         (Relobj::set_kept_comdat_section): New function.
7661         (Relobj::get_kept_comdat_section): New function.
7662         (Relobj::comdat_groups_): New field.
7663         (Relobj::kept_comdat_sections_): New field.
7664         (Symbol_value::input_value): Update comment.
7665         (Sized_relobj::map_to_kept_section) New function.
7666         (Sized_relobj::include_linkonce_section): Add new parameter.
7667         * target-reloc.h (Comdat_behavior): New type.
7668         (get_comdat_behavior): New function.
7669         (relocate_section): Add code to map a discarded section to the
7670         corresponding kept section when applying a relocation.
7672 2008-04-30  Craig Silverstein  <csilvers@google.com>
7674         * dwarf_reader.cc (next_generation_count): New static var.
7675         (Addr2line_cache_entry): New struct.
7676         (addr2line_cache): New static var.
7677         (Dwarf_line_info::one_addr2line): Added caching.
7678         (Dwarf_line_info::clear_addr2line_cache): New function.
7679         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
7680         cache-size parameter.
7681         (Dwarf_line_info::one_addr2line_cache): New function.
7682         * symtab.cc (Symbol_table::detect_odr_violations): Pass
7683         new cache-size argument to one_addr2line(), and clear cache.
7685 2008-04-28  Cary Coutant  <ccoutant@google.com>
7687         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
7688         R_386_PC8 relocations.
7690 2008-04-23  Ian Lance Taylor  <iant@google.com>
7692         * object.cc (Sized_relobj::include_section_group): Check for
7693         invalid section group.
7695         * object.cc (make_elf_object): Correct test for 64-bit ELF file
7696         header size.
7698         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
7699         than read for file header.
7700         * archive.cc (Archive::include_member): Likewise.
7702 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
7704         * aclocal.m4: Regenerate.
7705         * configure: Regenerate.
7707 2008-04-19  Ian Lance Taylor  <iant@google.com>
7709         * version.cc (version_string): Bump to 1.6.
7711         * testsuite/Makefile.am (many_sections_r_test): New target.
7712         (many_sections_r_test_SOURCES): Remove.
7713         (many_sections_r_test_DEPENDENCIES): Remove.
7714         (many_sections_r_test_LDFLAGS): Remove.
7715         (many_sections_r_test_LDADD): Remove.
7717         * object.cc (Sized_relobj::do_add_symbols): Always pass
7718         local_symbol_count_ to add_from_relobj.
7720         * testsuite/Makefile.am (many_sections_check.h): Only check one in
7721         every thousand variables.
7722         * testsuite/Makefile.in: Rebuild.
7724         * object.cc (Xindex::initialize_symtab_xindex): New function.
7725         (Xindex::read_symtab_xindex): New function.
7726         (Xindex::sym_xindex_to_shndx): New function.
7727         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
7728         available.
7729         (Sized_relobj::do_initialize_xindex): New function.
7730         (Sized_relobj::do_read_symbols): Adjust section links.
7731         (Sized_relobj::symbol_section_and_value): Add is_ordinary
7732         parameter.  Change all callers.
7733         (Sized_relobj::include_section_group): Adjust section links and
7734         symbol section indexes.
7735         (Sized_relobj::do_layout): Adjust section links.
7736         (Sized_relobj::do_count_local_symbols): Adjust section links and
7737         symbol section indexes.
7738         (Sized_relobj::do_finalize_local_symbols): Distinguish between
7739         ordinary and special symbols.
7740         (Sized_relobj::write_local_symbols): Add symtab_xindex and
7741         dynsym_xindex parameters.  Change all callers.  Adjust section
7742         links.  Use SHN_XINDEX when needed.
7743         (Sized_relobj::get_symbol_location_info): Adjust section links.
7744         Don't get fooled by special symbols.
7745         * object.h (class Xindex): Define.
7746         (class Object): Add xindex_ parameter.  Declare virtual functoin
7747         do_initialize_xindex.
7748         (Object::adjust_sym_shndx): New function.
7749         (Object::set_xindex): New protected function.
7750         (class Symbol_value): Add is_ordinary_shndx_ field.
7751         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
7752         (Symbol_value::value): Assert ordinary section.
7753         (Symbol_value::initialize_input_to_output_map): Likewise.
7754         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
7755         Change all callers.
7756         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
7757         all callers.
7758         (class Sized_relobj): Update declarations.
7759         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
7760         parameter.  Change all callers.
7761         (Sized_relobj::adjust_shndx): New function.
7762         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
7763         field.
7764         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
7765         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
7766         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
7767         (Sized_dynobj::read_dynsym_section): Adjust section links.
7768         (Sized_dynobj::read_dynamic): Likewise.
7769         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
7770         section links.
7771         (Sized_dynobj::do_initialize_xindex): New function.
7772         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
7773         do_initialize_xindex.
7774         (Sized_dynobj::adjust_shndx): New function.
7775         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
7776         dynsym_xindex_ fields.
7777         (Layout::finalize): Add a call to set_section_indexes before
7778         creating the symtab sections.
7779         (Layout::set_section_indexes): Don't do anything if the section
7780         already has a section index.
7781         (Layout::create_symtab_sections): Add shnum parameter.  Change
7782         caller.  Create .symtab_shndx section if needed.
7783         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
7784         caller.
7785         (Layout::allocated_output_section_count): New function.
7786         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
7787         needed.
7788         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
7789         fields.  Update declarations.
7790         (Layout::symtab_xindex): New function.
7791         (Layout::dynsym_xindex): New function.
7792         (class Write_symbols_task): Add layout_ field.
7793         (Write_symbols_task::Write_symbols_task): Add layout parameter.
7794         Change caller.
7795         * output.cc (Output_section_headers::Output_section_headers): Add
7796         shstrtab_section parameter.  Change all callers.
7797         (Output_section_headers::do_sized_write): Store overflow values
7798         for section count and section string table section index in
7799         section header zero.
7800         (Output_file_header::do_sized_write): Check for overflow of
7801         section count and section string table section index.
7802         (Output_symtab_xindex::do_write): New function.
7803         (Output_symtab_xindex::endian_do_write): New function.
7804         * output.h (class Output_section_headers): Add shstrtab_section_.
7805         Update declarations.
7806         (class Output_symtab_xindex): Define.
7807         (Output_section::has_out_shndx): New function.
7808         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
7809         field.
7810         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
7811         Change all callers.
7812         (Sized_symbol::init): Likewise.
7813         (Symbol::output_section): Check for ordinary symbol.
7814         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
7815         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
7816         callers.
7817         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
7818         Change all callers.  Simplify handling of symbols from sections
7819         not included in the link.
7820         (Symbol_table::add_from_dynobj): Handle ordinary symbol
7821         distinction.
7822         (Weak_alias_sorter::operator()): Assert that symbols are
7823         ordinary.
7824         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
7825         distinction.
7826         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
7827         parameters.  Change all callers.
7828         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
7829         symbol distinction.  Use SHN_XINDEX when needed.
7830         (Symbol_table::write_section_symbol): Add symtab_xindex
7831         parameter.  Change all callers.
7832         (Symbol_table::sized_write_section_symbol): Likewise.  Use
7833         SHN_XINDEX when needed.
7834         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
7835         declarations.
7836         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
7837         (Symbol::is_defined): Check is_ordinary.
7838         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
7839         (Symbol::is_absolute, Symbol::is_common): Likewise.
7840         (class Sized_symbol): Update declarations.
7841         (class Symbol_table): Update declarations.
7842         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
7843         parameters.  Change all callers.
7844         (Sized_symbol::override): Likewise.
7845         (Symbol_table::override): Likewise.
7846         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
7847         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
7848         is_ordinary, and orig_st_shndx parameters.  Change all callers.
7849         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
7850         to be in an ordinary section.
7851         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
7852         object and is_ordinary parameters.  Change all callers.
7853         (Sized_dwarf_line_info::read_relocs): Add object parameter.
7854         Change all callers.  Don't add undefined or non-ordinary symbols
7855         to reloc_map_.
7856         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
7857         Change all callers.
7858         * dwarf_reader.h (class Sized_dwarf_line_info): Update
7859         declarations.
7860         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
7861         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
7862         (Sized_relobj::relocate_sections): Likewise.
7863         * target-reloc.h (scan_relocs): Adjust section symbol index.
7864         (scan_relocatable_relocs): Likewise.
7865         * i386.cc (Scan::local): Check for ordinary symbols.
7866         * sparc.cc (Scan::local): Likewise.
7867         * x86_64.cc (Scan::local): Likewise.
7868         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
7869         to symbol_section_and_value.
7870         * testsuite/many_sections_test.cc: New file.
7871         * testsuite/Makefile.am (BUILT_SOURCES): Define.
7872         (check_PROGRAMS): Add many_sections_test.
7873         (many_sections_test_SOURCES): Define.
7874         (many_sections_test_DEPENDENCIES): Define.
7875         (many_sections_test_LDFLAGS): Define.
7876         (BUILT_SOURCES): Add many_sections_define.h.
7877         (many_sections_define.h): New target.
7878         (BUILT_SOURCES): Add many_sections_check.h.
7879         (many_sections_check.h): New target.
7880         (check_PROGRAMS): Add many_sections_r_test.
7881         (many_sections_r_test_SOURCES): Define.
7882         (many_sections_r_test_DEPENDENCIES): Define.
7883         (many_sections_r_test_LDFLAGS): Define.
7884         (many_sections_r_test_LDADD): Define.
7885         (many_sections_r_test.o): New target.
7886         * testsuite/Makefile.in: Rebuild.
7888 2008-04-17  Cary Coutant  <ccoutant@google.com>
7890         * errors.cc (Errors::info): New function.
7891         (gold_info): New function.
7892         * errors.h (Errors::info): New function.
7893         * gold.h (gold_info): New function.
7894         * object.cc (Input_objects::add_object): Print trace output.
7895         * options.cc (options::parse_set): New function.
7896         (General_options::parse_wrap): Deleted.
7897         (General_options::General_options): Deleted initializer.
7898         * options.h (options::String_set): New typedef.
7899         (options::parse_set): New function.
7900         (DEFINE_set): New macro.
7901         (General_options::wrap): Changed to use DEFINE_set. Changed
7902         callers of any_wrap_symbols and is_wrap_symbol.
7903         (General_options::trace, General_options::trace_symbol):
7904         New options.
7905         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
7906         (General_options::wrap_symbols_): Deleted.
7907         * symtab.cc (Symbol_table::add_from_object): Print trace output.
7909 2008-04-17  David S. Miller  <davem@davemloft.net>
7911         * options.cc (General_options::parse_V): New function.
7912         * options.h: Add entries for -V and -Qy.
7914 2008-04-17  Ian Lance Taylor  <iant@google.com>
7916         * common.cc (Symbol_table::allocate_commons): Remove options
7917         parameter.  Change caller.
7918         (Symbol_table::do_allocate_commons): Remove options parameter.
7919         Change caller.  Just call do_allocate_commons_list twice.
7920         (Symbol_table::do_allocate_commons_list): New function, broken out
7921         of do_allocate_commons.
7922         * common.h (class Allocate_commons_task): Remove options_ field.
7923         Update constructor.
7924         * symtab.cc (Symbol_table::Symbol_table): Initialize
7925         tls_commons_.
7926         (Symbol_table::add_from_object): Put TLS common symbols on
7927         tls_commons_ list.
7928         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
7929         which are IN_OUTPUT_DATA.
7930         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
7931         allocate_commons and do_allocate_commons declarations.  Declare
7932         do_allocate_commons_list.
7933         * gold.cc (queue_middle_tasks): Update creation of
7934         Allocate_commons_task to not pass options.
7935         * testsuite/Makefile.am (INCLUDES): Add -I.. .
7936         (TLS_TEST_C_FLAGS): New variable.
7937         (tls_test_c_pic.o): New target.
7938         (tls_test_shared.so): Link in tls_test_c_pic.o.
7939         (tls_test_c_pic_ie.o): New target.
7940         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
7941         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
7942         (tls_test_c.o): New target.
7943         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
7944         (tls_pic_test_LDADD): Likewise.
7945         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
7946         (tls_shared_gd_to_ie_test_LDADD): Likewise.
7947         (tls_test_c_gnu2.o): New target.
7948         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
7949         tls_test_c_gnu2.o.
7950         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
7951         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
7952         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
7953         * testsuite/tls_test.cc: Include "config.h".
7954         (t_last): Call t11_last.
7955         * testsuite/tls_test.h (t11, t11_last): Declare.
7956         * testsuite/tls_test_c.c: New file.
7957         * testsuite/tls_test_main.cc (thread_routine): Call t11.
7958         * configure.ac: Check for OpenMP support.
7959         * configure, config.in, Makefile.in: Rebuild.
7960         * testsuite/Makefile.in: Rebuild.
7962 2008-04-16  Cary Coutant  <ccoutant@google.com>
7964         * i386.cc (Target_i386::define_tls_base_symbol): New function.
7965         (Target_i386::tls_base_symbol_defined_): New field.
7966         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7967         (Target_i386::Scan::global): Likewise.
7968         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
7969         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
7970         (Target_x86_64::tls_base_symbol_defined_): New field.
7971         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7972         (Target_x86_64::Scan::global): Likewise.
7974 2008-04-16  Cary Coutant  <ccoutant@google.com>
7976         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
7977         (Symbol::needs_plt_entry): Allow weak undefined symbols.
7978         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
7979         building shared libraries.
7980         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
7981         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
7982         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
7983         * testsuite/Makefile.in: Rebuild.
7984         * testsuite/weak_undef.h: New file.
7985         * testsuite/weak_undef_file1.cc: Add extra test cases.
7986         * testsuite/weak_undef_file2.cc: Likewise.
7987         * testsuite/weak_undef_test.cc: Likewise.
7989 2008-04-16  David S. Miller  <davem@davemloft.net>
7991         * sparc.cc (Target_sparc::Scan): Change from struct to class.
7992         Add issued_non_pic_error_ field.  Declare check_non_pic.
7993         (Target_sparc::Scan::check_non_pic): New function.
7994         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
7995         (Target_sparc::Scan::global): Likewise.
7997         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
7998         * configure: Rebuild.
8000         * options.h (DEFINE_enable): New macro.
8001         (new_dtags): New enable option.
8002         (initfirst, interpose, loadfltr, nodefaultlib,
8003         nodelete, nodlopen, nodump): New -z options.
8004         * layout.cc (Layout:finish_dynamic_section): If new
8005         dtags enabled, emit DT_RUNPATH.  Also, emit a
8006         DT_FLAGS_1 containing any specified -z flags.
8008 2008-04-16  Ian Lance Taylor  <iant@google.com>
8010         * copy-relocs.cc: New file.
8011         * copy-relocs.h: New file.
8012         * reloc.cc: Remove Copy_relocs code.
8013         * reloc.h: Likewise.
8014         * reloc-types.h (struct Reloc_types) [both versions]: Add
8015         get_reloc_addend_noerror.
8016         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
8017         variants of add_global which take an addend which must be zero.
8018         * i386.cc: Include "copy-relocs.h".
8019         (class Target_i386): Change type of copy_relocs_ to variable,
8020         update initializer.
8021         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
8022         Change all callers.
8023         (Target_i386::do_finalize_sections): Change handling of
8024         copy_relocs_.
8025         * sparc.cc: Include "copy-relocs.h".
8026         (class Target_sparc): Change type of copy_relocs_ to variable,
8027         update initializer.
8028         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
8029         Change all callers.
8030         (Target_sparc::do_finalize_sections): Change handling of
8031         copy_relocs_.
8032         * x86_64.cc: Include "copy-relocs.h".
8033         (class Target_x86_64): Change type of copy_relocs_ to variable,
8034         update initializer.
8035         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
8036         class.  Change all callers.
8037         (Target_x86_64::do_finalize_sections): Change handling of
8038         copy_relocs_.
8039         * Makefile.am (CCFILES): Add copy-relocs.cc.
8040         (HFILES): Add copy-relocs.h.
8042         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
8044         * testsuite/script_test_4.sh: Permit leading zeroes.
8046 2008-04-15  Ian Lance Taylor  <iant@google.com>
8048         * script-sections.cc (Script_sections::create_segments): Use
8049         header_size_adjustment even when there is enough room for the
8050         headers.
8051         * testsuite/script_test_4.sh: New file.
8052         * testsuite/script_test_4.t: New file.
8053         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
8054         (check_DATA): Add script_test_4.stdout.
8055         (MOSTLYCLEANFILES): Likewise.
8056         (script_test_4): New target.
8057         (script_test_4.stdout): New target.
8058         * testsuite/Makefile.in: Rebuild.
8060         * sparc.cc: Add definitions for Output_data_plt_sparc class
8061         constants.
8063 2008-04-14  David S. Miller  <davem@davemloft.net>
8065         * sparc.cc: New file.
8066         * Makefile.am (TARGETSOURCES): Add sparc.cc
8067         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
8068         * configure.tgt: Document targ_extra_size and
8069         targ_extra_big_endian.  Add entries for sparc-* and
8070         sparc64-*.
8071         * configure.ac: Handle targ_extra_size and
8072         targ_extra_big_endian.
8073         * Makefile.in: Rebuild.
8074         * configure: Likewise.
8075         * po/POTFILES.in: Likewise.
8076         * po/gold.pot: Likewise.
8078 2008-04-14  Ian Lance Taylor  <iant@google.com>
8080         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
8081         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
8082         in the name/type/flags to section mapping.  Don't call
8083         allocate_output_section.
8084         (Layout::choose_output_section): Change parameter from adjust_name
8085         to is_input_section.  Don't permit input sections after sections
8086         are attached to segments.  Don't call allocate_output_section.
8087         (Layout::layout_eh_frame): Call update_flags_for_input_section,
8088         not write_enable_output_section.
8089         (Layout::make_output_section): Don't push to
8090         unattached_section_list_ nor call attach_to_segment.  Call
8091         attach_section_to_segment if sections are attached.
8092         (Layout::attach_sections_to_segments): New function.
8093         (Layout::attach_section_to_segment): New function.
8094         (Layout::attach_allocated_section_to_segment): Rename from
8095         attach_to_segment.  Remove flags parameter.
8096         (Layout::allocate_output_section): Remove function.
8097         (Layout::write_enable_output_section): Remove function.
8098         * layout.h (class Layout): Update for above changes.  Add new
8099         field sections_are_attached_.
8100         * output.h (Output_section::update_flags_for_input_section): New
8101         function.
8102         * output.cc (Output_section::add_input_section): Call
8103         update_flags_for_input_section.
8104         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
8106 2008-04-11  Cary Coutant  <ccoutant@google.com>
8108         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
8109         thought unnecessary.
8110         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
8112 2008-04-11  Ian Lance Taylor  <iant@google.com>
8114         * output.h (class Output_section_data): Remove inline definition
8115         of set_addralign.
8116         * output.cc (Output_section_data::set_addralign): New function.
8118 2008-04-11  Cary Coutant  <ccoutant@google.com>
8120         Add support for TLS descriptors for i386 and x86_64.
8121         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
8122         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
8123         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
8124         GOT_TYPE_TLS_DESC.
8125         (Target_i386::got_mod_index_entry): Remove unnecessary code.
8126         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
8127         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
8128         relocations.
8129         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
8130         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
8131         Fix problem with initial-exec relocations.
8132         (Target_i386::Relocate::relocate_tls): Likewise.
8133         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
8134         relaxation.
8135         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
8136         support for section-plus-offset dynamic table entries.
8137         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
8138         (Output_data_dynamic::Dynamic_entry): Add support for
8139         section-plus-offset dynamic table entries.
8140         (Output_data_dynamic::Classification): Likewise.
8141         (Output_data_dynamic::classification_): Renamed offset_.
8142         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
8143         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
8144         (Target_x86_64::make_plt_section): New function.
8145         (Target_x86_64::reserve_tlsdesc_entries): New function.
8146         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
8147         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
8148         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
8149         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
8150         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
8151         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
8152         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
8153         add extra PLT entry for TLS descriptors.
8154         (Output_data_plt_x86_64::got_): New field.
8155         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
8156         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
8157         fields.
8158         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
8159         descriptors.
8160         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
8161         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
8162         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
8163         R_386_TLS_DESC_CALL relocations.
8164         (Target_x86_64::Scan::global): Likewise.
8165         (Target_x86_64::do_finalize_sections): Add dynamic table entries
8166         for TLS descriptors.
8167         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
8168         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
8169         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
8170         GD-to-IE relaxation.
8171         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
8172         and TLS_DESCRIPTORS.
8173         * Makefile.in: Rebuild.
8174         * configure: Rebuild.
8175         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
8176         (tls_test_shared2.so): New target.
8177         (tls_shared_gd_to_ie_test_SOURCES): New variable.
8178         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
8179         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
8180         (tls_shared_gd_to_ie_test_LDADD): New variable.
8181         (tls_shared_gnu2_gd_to_ie_test): New target.
8182         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
8183         New targets.
8184         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
8185         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
8186         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
8187         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
8188         (tls_shared_gnu2_test): New target.
8189         (tls_test_gnu2_shared.so): New target.
8190         (tls_shared_gnu2_test_SOURCES): New variable.
8191         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
8192         (tls_shared_gnu2_test_LDFLAGS): New variable.
8193         (tls_shared_gnu2_test_LDADD): New variable.
8194         * testsuite/Makefile.in: Rebuild.
8195         * testsuite/Makefile.
8197 2008-04-11  Ian Lance Taylor  <iant@google.com>
8199         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
8200         justsyms.t.
8201         * testsuite/Makefile.in: Rebuild.
8203         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
8204         long.
8205         * testsuite/script_test_2.cc (main): Adjust test.
8207 2008-04-11  David S. Miller  <davem@davemloft.net>
8208             Ian Lance Taylor  <iant@google.com>
8210         * options.h (General_options): Add entries for '-Y' and
8211         '-relax'.
8212         * options.cc (General_options:finalize): If -Y was used, add those
8213         entries to the library path instead of the default "/lib" and
8214         "/usr/lib".
8216 2008-04-11  David S. Miller  <davem@davemloft.net>
8218         * testsuite/justsyms.t: Start at 0x100.
8219         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
8220         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
8221         long.
8222         * testsuite/script_test_2.cc: Adjust string and section length
8223         checks.
8225 2008-04-09  Ian Lance Taylor  <iant@google.com>
8227         PR gold/5996
8228         * script-sections.cc (Sections_element::allocate_to_segment): Add
8229         orphan parameter.
8230         (Output_section_definition::allocate_to_segment): Likewise.
8231         (Orphan_output_section::allocate_to_segment): Likewise.
8232         (Script_sections::attach_sections_using_phdrs_clause): Don't
8233         propagate non-PT_LOAD segments to orphan sections.
8234         * testsuite/Makefile.am (script_test_3.stdout): Generate using
8235         readelf rather than objdump.
8236         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
8237         .interp section and PT_INTERP segment are the same size.
8238         * testsuite/Makefile.in: Rebuild.
8240         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
8241         aliases for symbols defined in the same object.
8242         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
8243         (weak_alias_test_SOURCES): New variable.
8244         (weak_alias_test_DEPENDENCIES): New variable.
8245         (weak_alias_test_LDFLAGS): New variable.
8246         (weak_alias_test_LDADD): New variable.
8247         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
8248         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
8249         (weak_alias_test_3.o): New target.
8250         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
8251         * testsuite/weak_alias_test_main.cc: New file.
8252         * testsuite/weak_alias_test_1.cc: New file.
8253         * testsuite/weak_alias_test_2.cc: New file.
8254         * testsuite/weak_alias_test_3.cc: New file.
8256 2008-04-08  Ian Lance Taylor  <iant@google.com>
8258         * options.h (class General_options): Add --noinhibit-exec option.
8259         * main.cc (main): Check --noinhibit-exec.
8261         * options.h (class General_options): Define --wrap as a special
8262         option.  Add wrap_symbols_ field.
8263         (General_options::any_wrap_symbols): New function.
8264         (General_options::is_wrap_symbol): New function.
8265         * options.cc (General_options::parse_wrap): New function.
8266         (General_options::General_options): Initialize wrap_symbols_.
8267         * symtab.cc (Symbol_table::wrap_symbol): New function.
8268         (Symbol_table::add_from_object): Handle --wrap.
8269         * symtab.h (class Symbol_table): Declare wrap_symbol.
8270         * target.h (Target::wrap_char): New function.
8271         (Target::Target_info): Add wrap_char field.
8272         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
8273         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8274         * testsuite/testfile.cc (Target_test::test_target_info):
8275         Likewise.
8277         * errors.cc (Errors::undefined_symbol): Mention symbol version if
8278         there is one.
8280         * layout.h (class Layout): Add added_eh_frame_data_ field.
8281         * layout.cc (Layout::Layout): Initialize new field.
8282         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
8283         output section until we find a section we merged successfully.
8284         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
8285         that the size be non-zero.
8287         * merge.cc (Object_merge_map::get_output_offset): Remove inline
8288         qualifier.
8290 2008-04-08  Craig Silverstein  <csilvers@google.com>
8292         * configure.ac: Export new conditional variable HAVE_ZLIB.
8293         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
8294         on HAVE_ZLIB.
8295         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
8296         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8298 2008-04-07  Ian Lance Taylor  <iant@google.com>
8300         * version.cc (version_string): Set to "1.5".
8302         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
8303         Add issued_non_pic_error_ field.  Declare check_non_pic.
8304         (Target_x86_64::Scan::check_non_pic): New function.
8305         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
8306         (Target_x86_64::Scan::global): Likewise.
8308         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
8309         addend parameter.  Change caller.  Handle merge sections.
8310         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
8311         Address to Addend.  Don't add in the result of
8312         local_section_offset, pass down the addend and use the returned
8313         value.
8314         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
8315         Update declarations of local_section_offset and symbol_value.
8316         * testsuite/two_file_test_1.cc (t18): New function.
8317         * testsuite/two_file_test_2.cc (f18): New function.
8318         * testsuite/two_file_test_main.cc (main): Call t18.
8319         * testsuite/two_file_test.h (t18, f18): Declare.
8321         * configure.ac: Don't test for objdump, c++filt, or readelf.
8322         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
8323         conditionals.
8324         (TEST_READELF): New variable.
8325         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
8326         (check_PROGRAMS): Add two_file_strip_test.
8327         (two_file_strip_test): New target.
8328         (check_PROGRAMS): Add two_file_same_shared_strip_test.
8329         (two_file_same_shared_strip_test_SOURCES): New variable.
8330         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
8331         (two_file_same_shared_strip_test_LDFLAGS): New variable.
8332         (two_file_same_shared_strip_test_LDADD): New variable.
8333         (two_file_shared_strip.so): New target.
8334         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
8335         (ver_test_5.syms, ver_test_7.syms): Likewise.
8336         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
8337         (strip_test_3.stdout): Use TEST_OBJDUMP.
8338         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8340 2008-04-04  Cary Coutant  <ccoutant@google.com>
8342         * symtab.h (Symbol::is_weak_undefined): New function.
8343         (Symbol::is_strong_undefined): New function.
8344         (Symbol::is_absolute): New function.
8345         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
8346         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
8347         absolute symbols.
8348         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
8349         (weak_undef_test): New target.
8350         * testsuite/Makefile.in: Rebuild.
8351         * testsuite/weak_undef_file1.cc: New file.
8352         * testsuite/weak_undef_file2.cc: New file.
8353         * testsuite/weak_undef_test.cc: New file.
8355 2008-04-03  Craig Silverstein  <csilvers@google.com>
8357         * compressed_output.h (class Output_compressed_section): Use
8358         unsigned buffer.
8359         * compressed_output.cc (zlib_compress): Use unsigned buffers,
8360         add zlib header.
8361         (zlib_compressed_suffix): Removed.
8362         (Output_compressed_section::set_final_data_size): Use unsigned
8363         buffers.
8364         * testsuite/Makefile.am (flagstest_compress_debug_sections):
8365         Fix linker invocation.
8366         (flagstest_o_specialfile_and_compress_debug_sections):
8367         Likewise.
8368         * testsuite/Makefile.in: Regenerated.
8370 2008-04-02  David S. Miller  <davem@davemloft.net>
8372         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
8373         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
8375 2008-04-02  Craig Silverstein  <csilvers@google.com>
8377         * TODO: New file.
8379 2008-04-02  Ian Lance Taylor  <iant@google.com>
8381         * fileread.cc (File_read::find_view): Add byteshift and vshifted
8382         parameters.  Update for new key type to views_.  Change all
8383         callers.
8384         (File_read::read): Adjust for byteshift in returned view.
8385         (File_read::add_view): New function, broken out of
8386         find_and_make_view.
8387         (File_read::make_view): New function, broken out of
8388         find_and_make_view.
8389         (File_read::find_or_make_view): Add offset and aligned
8390         parameters.  Rewrite accordingly.  Change all callers.
8391         (File_read::get_view): Add offset and aligned parameters.  Adjust
8392         for byteshift in return value.
8393         (File_read::get_lasting_view): Likewise.
8394         * fileread.h (class File_read): Update declarations.
8395         (class File_read::View): Add byteshift_ field.  Add byteshift to
8396         constructor.  Add byteshift method.
8397         * archive.h (Archive::clear_uncached_views): New function.
8398         (Archive::get_view): Add aligned parameter.  Change all callers.
8399         * object.h (Object::get_view): Add aligned parameter.  Change all
8400         callers.
8401         (Object::get_lasting_view): Likewise.
8403         * fileread.cc (File_read::release): Don't call clear_views if
8404         there are multiple objects.
8405         * fileread.h (File_read::clear_uncached_views): New function.
8406         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
8407         on the archive.
8409 2008-03-31  Cary Coutant  <ccoutant@google.com>
8411         Add thin archive support.
8412         * archive.cc (Archive::armagt): New const.
8413         (Archive::setup): Remove task parameter and calls to unlock.
8414         (Archive::unlock_nested_archives): New function.
8415         (Archive::read_header): Add nested_off parameter. Change
8416         all callers.
8417         (Archive::interpret_header): Likewise.
8418         (Archive::include_all_members): Change to handle thin
8419         archives.
8420         (Archive::include_member): Likewise.
8421         * archive.h (Archive::Archive): Add new parameters and
8422         initializers.
8423         (Archive::armagt): New const.
8424         (Archive::setup): Remove task parameter.
8425         (Archive::unlock_nested_archives): New function.
8426         (Archive::read_header): Add nested_off parameter.
8427         (Archive::interpret_header): Likewise.
8428         (Archive::Nested_archive_table): New typedef.
8429         (Archive::is_thin_archive_): New field.
8430         (Archive::nested_archives_): New field.
8431         (Archive::options_): New field.
8432         (Archive::dirpath_): New field.
8433         (Archive::task_): New field.
8434         * readsyms.cc (Read_symbols::do_read_symbols): Add check
8435         for thin archives.  Pass additional parameters to
8436         Archive::Archive.  Unlock the archive file after calling
8437         Archive::setup.
8439 2008-03-29  Ian Lance Taylor  <iant@google.com>
8441         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
8442         version symbol to be local.
8443         * testsuite/ver_test_4.sh: New file.
8444         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
8445         (check_DATA): Add ver_test_4.syms.
8446         (ver_test_4.syms): New target.
8447         * testsuite/Makefile.in: Rebuild.
8449         * output.cc
8450         (Output_section::Input_section_sort_entry::has_priority): New
8451         function.
8452         (Output_section::Input_section_sort_entry::match_file_name): New
8453         function.
8454         (Output_section::Input_section_sort_entry::match_section_name):
8455         Remove.
8456         (Output_section::Input_section_sort_entry::match_section_name_prefix):
8457         Remove.
8458         (Output_section::Input_section_sort_entry::match_section_file):
8459         Remove.
8460         (Output_section::Input_section_sort_compare::operator()): Rewrite
8461         using new Input_section_sort_entry functions.  Sort crtbegin and
8462         crtend first.  Sort sections with no priority before sections with
8463         a priority.
8464         * testsuite/initpri1.c (d3): Check j != 4.
8465         (cd5): New constructor/destructor function.
8466         (main): Check j != 2.
8468         * symtab.cc (Symbol_table::add_from_object): If we don't use the
8469         new symbol when resolving, don't call set_is_default.
8470         * testsuite/ver_test_7.cc: New file.
8471         * testsuite/ver_test_7.sh: New file.
8472         * testsuite/Makefile.am (ver_test_7.so): New target.
8473         (ver_test_7.o): New target.
8474         (check_SCRIPTS): Add ver_test_7.sh.
8475         (check_DATA): Add ver_test_7.syms.
8476         (ver_test_7.syms): New target.
8478 2008-03-28  Ian Lance Taylor  <iant@google.com>
8480         * layout.cc (Layout::layout): If we see an input section with a
8481         name that needs sorting, set the must_sort flag for the output
8482         section.
8483         (Layout::make_output_section): If the name of the output section
8484         indicates that it might require sorting, set the may_sort flag.
8485         * output.h (Output_section::may_sort_attached_input_sections): New
8486         function.
8487         (Output_section::set_may_sort_attached_input_sections): New
8488         function.
8489         (Output_section::must_sort_attached_input_sections): New
8490         function.
8491         (Output_section::set_must_sort_attached_input_sections): New
8492         function.
8493         (class Output_section): Declare Input_section_sort_entry.  Define
8494         Input_section_sort_compare.  Declare
8495         sort_attached_input_sections.  Add new fields:
8496         may_sort_attached_input_sections_,
8497         must_sort_attached_input_sections_,
8498         attached_input_sections_are_sorted_.
8499         * output.cc (Output_section::Output_section): Initialize new
8500         fields.
8501         (Output_section::add_input_section): Add an entry to
8502         input_sections_ if may_sort or must_sort are true.
8503         (Output_section::set_final_data_size): Call
8504         sort_attached_input_sections if necessary.
8505         (Output_section::Input_section_sort_entry): Define new class.
8506         (Output_section::Input_section_sort_compare::operator()): New
8507         function.
8508         (Output_section::sort_attached_input_sections): New function.
8509         * configure.ac: Check whether the compiler supports constructor
8510         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
8511         * testsuite/initpri1.c: New file.
8512         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
8513         CONSTRUCTOR_PRIORITY.
8514         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
8515         (initpri1_LDFLAGS): New variable.
8516         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8518 2008-03-27  Ian Lance Taylor  <iant@google.com>
8520         * common.cc (Sort_commons::operator): Correct sorting algorithm.
8521         * testsuite/common_test_1.c: New file.
8522         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
8523         (common_test_1_SOURCES): New variable.
8524         (common_test_1_DEPENDENCIES): New variable.
8525         (common_test_1_LDFLAGS): New variable.
8527         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
8528         and commons_ correctly when NAME/VERSION does not override
8529         NAME/NULL.
8530         * testsuite/ver_test_6.c: New file.
8531         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
8532         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
8533         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
8535 2008-03-26  Ian Lance Taylor  <iant@google.com>
8537         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
8538         of an undefined symbol from a version script.
8539         * testsuite/Makefile.am (ver_test_5.so): New target.
8540         (ver_test_5.o): New target.
8541         (check_SCRIPTS): Add ver_test_5.sh.
8542         (check_DATA): Add ver_test_5.syms.
8543         (ver_test_5.syms): New target.
8544         * testsuite/ver_test_5.cc: New file.
8545         * testsuite/ver_test_5.script: New file.
8546         * testsuite/ver_test_5.sh: New file.
8547         * Makefile.in, testsuite/Makefile.in: Rebuild.
8549         PR gold/5986
8550         Fix problems building gold with gcc 4.3.0.
8551         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
8552         (gold_error_at_location, gold_warning_at_location): Use it.
8553         * configure.ac: Check whether we can compile and use a template
8554         function with a printf attribute.
8555         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
8556         when jumping over bytes.
8557         * object.cc: Instantiate Object::read_section_data.
8558         * debug.h: Include <cstring>
8559         * dwarf_reader.cc: Include <algorithm>
8560         * main.cc: Include <cstring>.
8561         * options.cc: Include <cstring>.
8562         * output.cc: Include <cstring>.
8563         * script.cc: Include <cstring>.
8564         * script.h: Include <string>.
8565         * symtab.cc: Include <cstring> and <algorithm>.
8566         * target-select.cc: Include <cstring>.
8567         * version.cc: Include <string>.
8568         * testsuite/testmain.cc: Include <cstdlib>.
8569         * configure, config.in: Rebuild.
8571 2008-03-25  Ian Lance Taylor  <iant@google.com>
8573         * options.cc: Include "../bfd/bfdver.h".
8574         (options::help): Print bug reporting address.
8576         * version.cc (print_version): Adjust output for current value of
8577         BFD_VERSION_STRING.
8579         * NEWS: New file.
8581         * options.cc (options::help): Print list of supported targets.
8582         * target-select.h: Include <vector>.
8583         (class Target_selector): Make machine_, size_, and is_big_endian_
8584         fields const.  Add bfd_name_ and instantiated_target_ fields.
8585         (Target_selector::Target_selector): Add bfd_name parameter.
8586         (Target_selector::recognize): Make non-virtual, call
8587         do_recognize.
8588         (Target_selector::recognize_by_name): Make non-virtual, call
8589         do_recognize_by_name.
8590         (Target_selector::supported_names): New function.
8591         (Target_selector::bfd_name): New function.
8592         (Target_selector::do_instantiate_target): New pure virtual
8593         function.
8594         (Target_selector::do_recognize): New virtual function.
8595         (Target_selector::do_recognize_by_name): New virtual function.
8596         (Target_selector::instantiate_target): New private function.
8597         (supported_target_names): Declare.
8598         * target-select.cc (Target_selector::Target_selector): Update for
8599         new parameter and fields.
8600         (select_target_by_name): Check that the name matches before
8601         calling recognize_by_name.
8602         (supported_target_names): New function.
8603         * i386.cc (class Target_selector_i386): Update Target_selector
8604         constructor call.  Remove recognize and recognize_by_name.  Add
8605         do_instantiate_target.
8606         * x86_64.cc (class Target_selector_x86_64): Likewise.
8607         * testsuite/testfile.cc (class Target_selector_test): Update for
8608         changes to Target_selector.
8610         * README: Rewrite, with some notes on unsupported features.
8612 2008-03-24  Cary Coutant  <ccoutant@google.com>
8614         * i386.cc (Target_i386::Got_type): New enum declaration.
8615         (Target_i386::Scan::local): Updated callers of Output_data_got
8616         member functions.
8617         (Target_i386::Scan::global): Likewise.
8618         (Target_i386::Relocate::relocate): Likewise.
8619         (Target_i386::Relocate::relocate_tls): Likewise.
8620         * object.h (Got_offset_list): New class.
8621         (Sized_relobj::local_has_got_offset): Added got_type parameter.
8622         (Sized_relobj::local_got_offset): Likewise.
8623         (Sized_relobj::set_local_got_offset): Likewise.
8624         (Sized_relobj::local_has_tls_got_offset): Removed.
8625         (Sized_relobj::local_tls_got_offset): Removed.
8626         (Sized_relobj::set_local_tls_got_offset): Removed.
8627         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
8628         * output.cc (Output_data_got::add_global): Added got_type parameter.
8629         (Output_data_got::add_global_with_rel): Likewise.
8630         (Output_data_got::add_global_with_rela): Likewise.
8631         (Output_data_got::add_global_pair_with_rel): New function.
8632         (Output_data_got::add_global_pair_with_rela): New function.
8633         (Output_data_got::add_local): Added got_type parameter.
8634         (Output_data_got::add_local_with_rel): Likewise.
8635         (Output_data_got::add_local_with_rela): Likewise.
8636         (Output_data_got::add_local_pair_with_rel): New function.
8637         (Output_data_got::add_local_pair_with_rela): New function.
8638         (Output_data_got::add_global_tls): Removed.
8639         (Output_data_got::add_global_tls_with_rel): Removed.
8640         (Output_data_got::add_global_tls_with_rela): Removed.
8641         (Output_data_got::add_local_tls): Removed.
8642         (Output_data_got::add_local_tls_with_rel): Removed.
8643         (Output_data_got::add_local_tls_with_rela): Removed.
8644         * output.h (Output_data_got::add_global): Added got_type parameter.
8645         (Output_data_got::add_global_with_rel): Likewise.
8646         (Output_data_got::add_global_with_rela): Likewise.
8647         (Output_data_got::add_global_pair_with_rel): New function.
8648         (Output_data_got::add_global_pair_with_rela): New function.
8649         (Output_data_got::add_local): Added got_type parameter.
8650         (Output_data_got::add_local_with_rel): Likewise.
8651         (Output_data_got::add_local_with_rela): Likewise.
8652         (Output_data_got::add_local_pair_with_rel): New function.
8653         (Output_data_got::add_local_pair_with_rela): New function.
8654         (Output_data_got::add_global_tls): Removed.
8655         (Output_data_got::add_global_tls_with_rel): Removed.
8656         (Output_data_got::add_global_tls_with_rela): Removed.
8657         (Output_data_got::add_local_tls): Removed.
8658         (Output_data_got::add_local_tls_with_rel): Removed.
8659         (Output_data_got::add_local_tls_with_rela): Removed.
8660         * resolve.cc (Symbol::override_base_with_special): Removed
8661         reference to has_got_offset_ field.
8662         * symtab.cc (Symbol::init_fields): Replaced initialization
8663         of got_offset_ with got_offsets_.  Removed initialization
8664         of has_got_offset_
8665         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
8666         (Symbol::got_offset): Likewise.
8667         (Symbol::set_got_offset): Likewise.
8668         (Symbol::has_tls_got_offset): Removed.
8669         (Symbol::tls_got_offset): Removed.
8670         (Symbol::set_tls_got_offset): Removed.
8671         (Symbol::got_offset_): Removed.
8672         (Symbol::tls_mod_got_offset_): Removed.
8673         (Symbol::tls_pair_got_offset_): Removed.
8674         (Symbol::got_offsets_): New field.
8675         (Symbol::has_got_offset): Removed.
8676         (Symbol::has_tls_mod_got_offset): Removed.
8677         (Symbol::has_tls_pair_got_offset): Removed.
8678         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
8679         (Target_x86_64::Scan::local): Updated callers of Output_data_got
8680         member functions.
8681         (Target_x86_64::Scan::global): Likewise.
8682         (Target_x86_64::Relocate::relocate): Likewise.
8683         (Target_x86_64::Relocate::relocate_tls): Likewise.
8685 2008-03-25  Ben Elliston  <bje@au.ibm.com>
8687         * yyscript.y: Fix spelling error in comment.
8689 2008-03-24  Ian Lance Taylor  <iant@google.com>
8691         * options.h (class General_options): Define build_id option.
8692         * layout.h (class Layout): Declare write_build_id, create_note,
8693         create_build_id.  Add build_id_note_ member.
8694         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
8695         "libiberty.h", "md5.h", "sha1.h".
8696         (Layout::Layout): Initialize eh_frame_data_,
8697         eh_frame_hdr_section_, and build_id_note_.
8698         (Layout::finalize): Call create_build_id.
8699         (Layout::create_note): New function, broken out of
8700         Layout::create_gold_note.
8701         (Layout::create_gold_note): Call create_note.
8702         (Layout::create_build_id): New function.
8703         (Layout::write_build_id): New function.
8704         (Close_task_runner::run): Call write_build_id.
8706         * x86_64.cc: Correct license to GPLv3.
8708 2008-03-23  Ian Lance Taylor  <iant@google.com>
8710         * options.cc: Include "demangle.h".
8711         (parse_optional_string): New function.
8712         (parse_long_option): Handle takes_optional_argument.
8713         (parse_short_option): Update dash_z initializer.  Handle
8714         takes_optional_argument.
8715         (General_options::General_options): Initialize do_demangle_.
8716         (General_options::finalize): Set do_demangle_.  Handle demangling
8717         style.
8718         * options.h (parse_optional_string): Declare.
8719         (struct One_option): Add optional_arg field.  Update constructor.
8720         Update call constructor calls.  Add takes_optional_argument
8721         function.
8722         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
8723         (DEFINE_optional_string): Define.
8724         (General_options::demangle): Change from DEFINE_bool to
8725         DEFINE_optional_string.
8726         (General_options::no_demangle): New function.
8727         (General_options::do_demangle): New function.
8728         (General_options::set_do_demangle): New function.
8729         (General_options::execstack_status_): Move definition to end of
8730         class definition.
8731         (General_options::static_): Likewise.
8732         (General_options::do_demangle_): New field.
8733         * object.cc (big_endian>::get_symbol_location_info): Call
8734         Options::do_demangle, not Options::demangle.
8735         * symtab.cc (demangle): Likewise.
8737 2008-03-22  Ian Lance Taylor  <iant@google.com>
8739         * gold.h: Include <cstddef> and <sys/types.h>
8740         * options.h: Include <cstring>.
8742 2008-03-21  Ian Lance Taylor  <iant@google.com>
8744         * Added source code to GNU binutils.