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