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