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