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