1 2010-05-19 Rafael Espindola <espindola@google.com>
3 * script-sections.cc (Output_section_definition::allocate_to_segment):
4 Update the phdrs_list even when the output section is NULL.
5 * testsuite/Makefile.am: Add test.
6 * testsuite/Makefile.in: Regenerate.
7 * testsuite/script_test_9.cc: New.
8 * testsuite/script_test_9.sh: New.
9 * testsuite/script_test_9.t: New.
11 2010-05-19 Doug Kwan <dougkwan@google.com>
13 * arm.cc (Arm_input_section::original_size): New method.
14 (Arm_input_section::do_addralign): Add a cast.
15 (Arm_input_section::do_output_offset): Remove static cast.
16 (Arm_input_section::original_addralign,
17 Arm_input_section::original_size_): Change type to uint32_t.
18 (Arm_input_section::init): Add safe casts for section alignment
20 (Arm_input_section::set_final_data_size): Do not set address and
22 (Arm_output_section::fix_exidx_coverage): Change use of of
23 Output_section::Simple_input_section to that of
24 Output_section::Input_section.
25 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
26 except for the first pass.
27 * output.cc (Output_section::get_input_sections): Change type of
28 input_sections to std::list<Input_section>.
29 (Output_section::add_script_input_section): Rename from
30 Output_section::add_simple_input_section. Change type of SIS
31 parameter from Simple_input_section to Input_section.
32 * output.h (Output_section::Simple_input_section): Remove class.
33 (Output_section::Input_section): Change class visibility to public.
34 (Output_section::Input_section::addralign): Use stored alignments
35 for special input sections if set.
36 (Output_section::Input_section::set_addralign): New method.
37 (Output_section::get_input_sections): Change parameter type from
38 list of Simple_input_section to list of Input_section.
39 (Output_section::add_script_input_section): Rename from
40 Output_section::add_simple_input_section. Change first parameter's
41 type from Simple_input_section to Input_section and remove the
42 second and third parameters.
43 * script-sections.cc (Input_section::Input_section_list): Change
44 type to list of Output_section::Input_section/
45 (Input_section_info::Input_section_info): Change parameter type of
46 INPUT_SECTION to Output_section::Input_section.
47 (Input_section_info::input_section): Change return type.
48 (Input_section_info::input_section_): Change type to
49 Output_section::Input_section.
50 (Output_section_element_input::set_section_addresses): Adjust code
51 to use Output_section::Input_section instead of
52 Output_section::Simple_input_section. Adjust code for renaming
53 of Output_section::add_simple_input_section.
54 (Orphan_output_section::set_section_addresses): Ditto.
56 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
58 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
59 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
61 2010-05-18 Rafael Espindola <espindola@google.com>
63 * options.cc (General_options::finalize): Handle -nostdlib.
64 * options.h (nostdlib): New option.
65 * script.cc (script_add_search_dir): Handle -nostdlib.
67 2010-05-12 Doug Kwan <dougkwan@google.com>
69 * arm.cc (Target_arm::do_finalize_sections): Create an empty
70 attributes section only if there no attributes section after merging.
71 (Target_arm::merge_object_attributes): Move value of
72 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
73 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
74 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
75 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
76 and arm_attr_merge_7.stdout.
77 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
78 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
79 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
80 arm_attr_merge_7b.o): New rules.
81 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
83 * testsuite/Makefile.in: Regenerate.
84 * testsuite/arm_attr_merge.sh: New file.
85 * testsuite/arm_attr_merge_[67][ab].s: Same.
87 2010-05-05 Nick Clifton <nickc@redhat.com>
89 * po/es.po: Updated Spanish translation.
91 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
93 * Makefile.am (install-exec-local): Properly install gold as
95 * Makefile.in: Regenerated.
97 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
98 Nick Clifton <nickc@redhat.com>
100 * configure.ac (install_as_default): Define and set to false
101 unless --enable-gold or --enable-gold=both/gold has been
103 * configure: Regenerate.
105 * Makefile.am (install-exec-local): Install the executable as
106 'ld.gold'. If install_as_default is true then also install it as
108 * Makefile.in: Regenerated.
110 2010-04-24 Ian Lance Taylor <iant@google.com>
112 * layout.cc (Layout::layout_reloc): In relocatable link don't
113 combine reloc sections for grouped sections.
115 2010-04-23 Sriraman Tallam <tmsriram@google.com>
117 * gc.h (gc_process_relocs): Pass information on relocs pointing to
118 sections that are not ordinary to icf.
119 * icf.cc (get_section_contents): Handle relocation pointing to section
120 with no object or shndx information.
121 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
122 * testsuite/Makefile.in: Regenerate.
123 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
124 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
126 2010-04-22 Ian Lance Taylor <iant@google.com>
128 * expression.cc (Expression::Expression_eval_info): Add
129 result_alignment_pointer field.
130 (Expression::eval_with_dot): Add result_alignment_pointer
131 parameter. Change all callers.
132 (Expression::eval_maybe_dot): Likewise.
133 (class Binary_expression): Add alignment_pointer parameter to
134 left_value and right_value. Change all callers.
135 (BINARY_EXPRESSION): Set result alignment.
136 (class Trinary_expression): Add alignment_pointer parameter to
137 arg2_value and arg3_value. Change all callers.
138 (Trinary_cond::value): Set result alignment.
139 (Max_expression::value, Min_expression::value): Likewise.
140 (Align_expression::value): Likewise.
141 * script-sections.cc (class Sections_element): Add dot_alignment
142 parameter to set_section_addresses virtual function. Update
144 (class Output_section_element): Likewise.
145 (Script_sections::create_segments): Add dot_alignment parameter.
147 (Script_sections::create_segments_from_phdrs_clause): Likewise.
148 (Script_sections::set_phdrs_clause_addresses): Likewise.
149 * script-sections.h: Update declarations.
150 * script.h: Update declarations.
151 * output.h (Output_segment::set_minimum_p_align): Don't decrease
153 * testsuite/script_test_3.t: Set large alignment.
154 * testsuite/script_test_3.sh: Make sure that at least one LOAD
155 segment has expected alignment.
157 2010-04-22 Nick Clifton <nickc@redhat.com>
159 * po/gold.pot: Updated by the Translation project.
160 * po/vi.po: Updated Vietnamese translation.
162 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
164 * testsuite/Makefile.am (check_PROGRAMS): Add
165 icf_virtual_function_folding_test.
166 * testsuite/Makefile.in: Regenerated.
168 2010-04-15 Andrew Haley <aph@redhat.com>
170 * options.h (merge_exidx_entries): New option.
171 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
172 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
173 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
174 (Target_arm::merge_exidx_entries): New function.
175 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
176 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
177 to Arm_exidx_fixup constructor.
178 Add new arg, merge_exidx_entries.
179 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
180 Arm_output_section::fix_exidx_coverage.
182 2010-04-18 Sriraman Tallam <tmsriram@google.com>
184 * icf.cc (get_section_contents): Check for preemptible functions.
185 Ignore addend when appropriate.
186 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
188 (add_from_relobj): Check for section folded.
189 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
190 * symtab.h (should_add_dynsym_entry): Add new parameter.
191 * target-reloc.h (scan_relocs): Check for section folded.
192 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
193 Check reloc types for function pointers in shared objects.
194 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
196 (icf_preemptible_functions_test): New test case.
197 (icf_string_merge_test): New test case.
198 * testsuite.Makefile.in: Regenerate.
199 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
200 bar_glob. Refactor code.
201 * testsuite/icf_preemptible_functions_test.cc: New file.
202 * testsuite/icf_preemptible_functions_test.sh: New file.
203 * testsuite/icf_string_merge_test.cc: New file.
204 * testsuite/icf_string_merge_test.sh: New file.
205 * testsuite/icf_virtual_function_folding_test.cc: New file.
206 * testsuite/icf_virtual_function_folding_test.sh: New file.
208 2010-04-14 Doug Kwan <dougkwan@google.com>
210 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
211 for local symbol recounting if we remove a section due to ICF.
212 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
213 there are no regular objects in input.
215 2010-04-13 Doug Kwan <dougkwan@google.com>
217 * arm.cc (Arm_input_section::set_final_data_size): Compute
218 accurate final data size instead of using current data size.
220 2010-04-09 Doug Kwan <dougkwan@google.com>
222 * layout.cc (Layout::choose_output_section): Handle script section
224 (Layout::make_output_section_for_script): Add section type parameter.
225 Handle script section types.
226 * layout.h (Layout::make_output_section_for_script): Add section
228 * output.cc (Output_section::Output_section): Initialize data member
230 (Output_section::do_reset_address_and_file_offset): Do not set address
231 to 0 if section is a NOLOAD section.
232 * output.h (Output_section::is_noload): New method.
233 (Output_section::set_is_noload): Ditto.
234 (Output_section::is_noload_): New data member.
235 * script-c.h (Script_section_type): New enum type.
236 (struct Parser_output_section_header): Add new file section_type.
237 * script-sections.cc (Sections_element::output_section_name): Add
238 parameter for returning script section type.
239 (Output_section_definition::output_section_name): Ditto.
240 (Output_section_definition::section_type)P; New method.
241 (Output_section_definiton::script_section_type_name): Ditto.
242 (Output_section_definition::script_section_type_): New data member.
243 (Output_section_definition::Output_section_definition): Initialize
244 data member Output_section_definition::script_section_type_.
245 (Output_section_definition::create_sections): Pass script section type
246 to Layout::make_output_section_for_script.
247 (Output_section_definition::output_section_name): Return script
248 section type to caller.
249 (Output_section_definition::set_section_address): Do not advance
250 dot value and load address if section type is NOLOAD. Set address
251 of NOLOAD sections regardless of section flags.
252 (Output_section_definition::print): Print section type if it is
253 not SCRIPT_SECTION_TYPE_NONE.
254 (Output_section_definition::section_type): New method.
255 (Output_section_definition::script_section_type_name): Ditto.
256 (Script_sections::output_section_name): Add new parameter
257 PSECTION_TYPE for returning script section type. Pass it to
258 section elements. Handle discard sections.
259 (Sort_output_sections::operator()): Handle NOLOAD sections.
260 * script-sections.h (Script_sections::Section_type): New enum type.
261 (Script_sections::output_section_name): Add a new parameter for
262 returning script section type.
263 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
265 * yyscript.y (union): Add new field SECTION_TYPE.
266 (COPY, DSECT, INFO, NOLOAD): New tokens.
267 (opt_address_and_section_type): Change type to output_section_header.
268 (section_type): New non-terminal
269 (section_header): Handle section type.
270 (opt_address_and_section_type): Return section type value.
272 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
274 * testsuite/plugin_common_test_1.c (foo): Add prototype.
275 * testsuite/plugin_common_test_2.c (foo): Likewise.
277 2010-04-08 Doug Kwan <dougkwan@google.com>
279 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
281 * output.cc (Output_section::add_merge_input_section): Simplify
282 code and return status of Output_merge_base::add_input_section.
283 Update merge section map only if Output_merge_base::add_input_section
286 2010-04-07 Doug Kwan <dougkwan@google.com>
288 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
289 if section is marked as containing instructions but has no mapping
291 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
292 correct section index.
293 (Arm_relobj::find_linked_text_section): Ditto.
295 2010-04-07 Cary Coutant <ccoutant@google.com>
297 * archive.cc (include_member): Destroy Read_symbols_data object before
299 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
300 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
301 (Read_symbols_data::~Read_symbols_data) New destructor.
302 (Section_relocs::Section_relocs) New constructor.
303 (Section_relocs::~Section_relocs) New destructor.
304 (Read_relocs_data::Read_relocs_data) New constructor.
305 (Read_relocs_data::~Read_relocs_data) New destructor.
306 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
307 pointers to NULL after deleting.
309 2010-04-07 Doug Kwan <dougkwan@google.com>
311 * arm.cc: Replace "endianity" with "endianness" in comments.
312 (Arm_exidx_cantunwind): Ditto.
313 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
314 (Arm_relobj::merge_flags_and_attributes): New method.
315 (Arm_relobj::merge_flags_and_attributes_): New data member.
316 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
317 (Arm_relobj::scan_sections_for_stubs): Ditto.
318 (Arm_relobj::do_read_symbols): Check to see if we really want to
319 merge processor-specific flags and attributes. Exit early if
320 an object is empty except for section names and the undefined symbol.
321 (Target_arm::do_finalize_sections): Move check for ELF format to
322 Arm_relobj::do_read_symbols. Merge processor specific flags and
323 attributes from a regular object only when we have determined that
324 it is aapropriate. Do not create an .ARM.attributes section in
325 output if there is no regular input object.
326 (Target_arm::merge_processor_specific_flags): Check
327 --warn-mismatch before printing any error.
328 (Target_arm::merge_object_attributes): Ditto.
329 * gold.cc (queue_middle_tasks): Handle the case in which there is
330 no regular object in input.
331 * options.cc (General_options::parse_EB): New method.
332 (General_options::parse_EL): Same.
333 (General_options::General_options): Initialize endianness_.
334 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
336 (General_options::Endianness): New enum.
337 (General_options::endianness): New method.
338 (General_options::endianness_): New data member.
339 * parameters.cc (Parameters::set_options): Check target endianness.
340 (Parameters::set_target_once): Ditto.
341 (Parameters::check_target_endianness): New method.
342 (parameters_force_valid_target): If either -EL or -EB is specified,
343 use it to define endianness of default target.
344 * parameters.h (Parameters::check_target_endianness): New method
346 * target.h (class Target): Change "endianity" to "endianness"
349 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
351 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
352 * configure: Regenerate.
353 * Makefile.in: Regenerate.
354 * testsuite/Makefile.in: Regenerate.
356 2010-04-06 Cary Coutant <ccoutant@google.com>
359 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
360 prevailing definitions of common symbols.
361 * testsuite/plugin_test_6.sh: New test case.
362 * testsuite/plugin_common_test_1.c: New test case.
363 * testsuite/plugin_common_test_2.c: New test case.
364 * testsuite/Makefile.am (plugin_test_6): New test case.
365 * testsuite/Makefile.in: Regenerate.
367 2010-04-06 Nick Clifton <nickc@redhat.com>
369 * po/vi.po: New Vietnamese translation.
371 2010-03-30 Doug Kwan <dougkwan@google.com>
373 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
375 2010-03-25 Doug Kwan <dougkwan@google.com>
377 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
378 to avoid a conversion warning on a 32-bit host.
380 2010-03-24 Ian Lance Taylor <iant@google.com>
382 * testsuite/script_test_3.t: Add a TLS segment.
383 * testsuite/Makefile.am (check_PROGRAMS): Add
384 tls_phdrs_script_test.
385 (tls_phdrs_script_test_SOURCES): Define.
386 (tls_phdrs_script_test_DEPENDENCIES): Define.
387 (tls_phdrs_script_test_LDFLAGS): Define.
388 (tls_phdrs_script_test_LDADD): Define.
389 * testsuite/Makefile.in: Rebuild.
391 2010-03-23 Cary Coutant <ccoutant@google.com>
393 * fileread.cc (find_or_make_view): Fix comment.
395 2010-03-23 Ian Lance Taylor <iant@google.com>
397 * script-sections.cc (class Orphan_section_placement): Define
398 PLACE_TLS and PLACE_TLS_BSS.
399 (Orphan_section_placement::Orphan_section_placement): Initialize
401 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
402 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
403 (tls_script_test_SOURCES): Define.
404 (tls_script_test_DEPENDENCIES): Define.
405 (tls_script_test_LDFLAGS): Define.
406 (tls_script_test_LDADD): Define.
407 * testsuite/Makefile.in: Rebuild.
409 2010-03-22 Doug Kwan <dougkwan@google.com>
411 * arm.cc (Arm_relocate_functions::abs8,
412 Arm_relocate_functions::abs16): Use correct check for overflow
413 specified in the ARM ELF specs.
414 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
415 target of a BLX instruction specially.
416 (Reloc_stub::stub_type_for_reloc): Ditto.
417 (Relocate::relocate): Use symbolic names instead of numeric relocation
418 codes to report error.
419 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
421 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
422 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
423 thumb2_blx_out_of_range.stdout
424 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
425 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
426 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
427 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
428 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
429 thumb2_blx_in_range, thumb2_blx_in_range.o,
430 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
431 thumb2_blx_out_of_range.o): New rules.
432 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
433 thumb2_blx_in_range and thumb2_blx_out_of_range.
434 * testsuite/Makefile.in: Regenerate.
435 * arm_branch_in_range.sh: Add tests for THUMB BLX.
436 * testsuite/thumb_blx_in_range.s: New file.
437 * testsuite/thumb_blx_out_of_range.s: New file.
439 2010-03-22 Rafael Espindola <espindola@google.com>
441 * archive.cc (Should_include): Move to archive.h.
442 (should_include_member): Make it a member of Archive.
444 (Add_lib_group_symbols): New.
445 * archive.h: Include options.h.
446 (Archive_member): Moved from Archive.
447 (Should_include): Moved from archive.cc.
449 (Add_lib_group_symbols): New.
450 * dynobj.cc (do_should_include_member): New.
451 * dynobj.h (do_should_include_member): New.
452 * gold.cc (queue_initial_tasks): Update call to queue.
453 * main.cc (main): Print lib group stats.
454 * object.cc (do_should_include_member): New.
455 * object.h: Include archive.h.
456 (Object::should_include_member): New.
457 (Object::do_should_include_member): New.
458 (Sized_relobj::do_should_include_member): New.
459 * options.cc (General_options::parse_start_lib): New.
460 (General_options::parse_end_lib): New.
461 (Input_arguments::add_file): Handle lib groups.
462 (Input_arguments::start_group): Check we are not in a lib.
463 (Input_arguments::start_lib): New.
464 (Input_arguments::end_lib): New.
465 * options.h (General_options): Add start_lib and end_lib.
466 (Input_argument::lib_): New.
467 (Input_argument::lib): New.
468 (Input_argument::is_lib): New.
469 (Input_file_lib): New.
470 (Input_arguments::in_lib_): New.
471 (Input_arguments::in_lib): New.
472 (Input_arguments::start_lib): New.
473 (Input_arguments::end_lib_): New.
474 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
475 in unused members as preempted.
476 (Sized_pluginobj::do_should_include_member): New.
477 * plugin.h (Sized_pluginobj::do_should_include_member): New.
478 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
480 (Read_symbols::do_whole_lib_group): New.
481 (Read_symbols::do_lib_group): New.
482 (Read_symbols::do_read_symbols): Handle lib groups.
483 (Read_symbols::get_name): Handle lib groups.
484 * readsyms.h (Read_symbols): Add an archive member pointer.
485 (Read_symbols::do_whole_lib_group): New.
486 (Read_symbols::do_lib_group): New.
487 (Read_symbols::member_): New.
488 * script.cc (read_input_script): Update call to queue_soon.
490 2010-03-19 Doug Kwan <dougkwan@google.com>
492 * arm.cc (Stub_table::Stub_table): Initialize new data members
493 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
494 (Stub_table::add_reloc_stub): Assign stub offset and update
495 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
496 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
498 (Stub_table::update_data_size_and_addralign): Use
499 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
500 instead of going over all reloc stubs.
501 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
502 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
503 Stringpool_template::offset_ to size of Stringpool_char.
504 (Stringpool_template::new_key_offset): Remove code to initialize
505 Stringpool_template::offset_.
506 * stringpool.h (Stringpool_template::set_no_zero_null): Set
507 Stringpool_template::offset_ to zero.
509 2010-03-15 Doug Kwan <dougkwan@google.com>
511 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
513 (Stringpool_template::new_key_offset): New method.
514 (Stringpool_template::add_string): Assign offsets when adding new
516 (Stringpool_template::set_string_offsets): Do not set string offsets
518 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
520 (Chunked_vector::clear): Clear size_.
521 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
522 (Chunked_vector::size): Return size_.
523 (Chunked_vector::push_back): Use size_ to find insert position.
524 (Chunked_vector::size_): New data member.
525 (Stringpool_template::set_no_zero_null): Assert string set is empty.
526 (Stringpool_template::new_key_offset): New method declaration.
527 (Stringpool_template::offset_): New data member.
529 2010-03-15 Rafael Espindola <espindola@google.com>
531 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
532 Add_symbols' constructor.
533 * readsyms.h (Add_symbols): Remove the input_group member.
535 2010-03-10 Ian Lance Taylor <iant@google.com>
537 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
538 target to ask whether a reference to a symbol requires a stack
540 * target.h (Target::is_call_to_non_split): New function.
541 (Target::do_is_call_to_non_split): Declare virtual function.
542 * target.cc: Include "symtab.h".
543 (Target::do_is_call_to_non_split): New function.
544 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
546 2010-03-10 Cary Coutant <ccoutant@google.com>
548 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
549 (File_read::open[1]): Remove initial mapping of whole_file_view_.
550 (File_read::open[2]): Add whole_file_view_ to list of views.
551 (File_read::make_view): Remove test of whole_file_view_.
552 (File_read::find_or_make_view): Create whole_file_view_ if
554 (File_read::clear_views): Replace bool parameter with enum;
555 adjust all callers. Don't delete views with permanent data;
556 do delete cached views and views from archives if
557 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
558 if clearing the corresponding view.
559 * fileread.h (File_read::Clear_views_mode): New enum.
560 (File_read::View::is_permanent_view): New method.
561 (File_read::clear_views): Replace bool parameter
562 with enum; adjust all callers.
563 * options.h (General_options): Change keep_files_mapped option;
565 * readsyms.cc (Add_symbols::run): Delete sd_ object before
567 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
570 2010-03-10 David S. Miller <davem@davemloft.net>
572 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
574 2010-03-09 Sriraman Tallam <tmsriram@google.com>
576 * icf.cc (get_section_contents): Add '@' marker after processing the
579 2010-03-08 Doug Kwan <dougkwan@google.com>
581 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
582 due to a conversion warning.
583 (Arm_relobj::update_output_local_symbol_count): Check for local
584 symbol with unset output index.
586 2010-03-05 Ian Lance Taylor <iant@google.com>
588 * options.h (class General_options): Add --spare-dynamic-tags.
589 * output.cc (Output_data_dynamic::set_final_data_size): Implement
590 --spare-dynamic-tags.
592 2010-03-05 Ian Lance Taylor <iant@google.com>
594 * incremental.cc: Include "libiberty.h".
596 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
598 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
599 function, is_info_ member.
600 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
601 (Versions::Versions): Update caller.
602 (Versions::define_base_version): Likewise.
603 (Versions::add_def): Likewise.
605 2010-03-03 Sriraman Tallam <tmsriram@google.com>
607 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
608 (Scan::possible_function_pointer_reloc): New function.
609 (Scan::local_reloc_may_be_function_pointer): Change to call
610 possible_function_pointer_reloc.
611 (Scan::global_reloc_may_be_function_pointer): Ditto.
612 * icf.h (Icf::check_section_for_function_pointers): Change to reject
613 relocations in ".data.rel.ro._ZTV" section.
614 * testsuite/icf_safe_so_test.sh: Change to pass i386.
615 * testsuite/icf_safe_so_test.cc: Ditto.
616 * testsuite/icf_safe_test.cc: Ditto.
617 * testsuite/icf_safe_test.sh: Ditto.
619 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
620 Ian Lance Taylor <iant@google.com>
622 * target-reloc.h (relocate_section): Check the symbol table index
623 for -1U before setting the local symbol index.
624 (scan_relocatable_relocs): If copying the relocation, record that
625 the local symbol is required.
626 * object.h (Symbol_value::is_output_symtab_index_set): New
628 (Symbol_value::may_be_discarded_from_output_symtab): New
630 (Symbol_value::has_output_symtab_entry): New function.
631 (Symbol_value::needs_output_symtab_entry): Remove.
632 (Symbol_value::output_symtab_index): Make sure the symbol index is
634 (Symbol_value::set_output_symtab_index): Make sure the symbol
635 index is not set. Make sure the new index is valid.
636 (Symbol_value::set_must_have_output_symtab_entry): New function.
637 (Symbol_value::has_output_dynsym_entry): New function.
638 (Symbol_value::set_output_dynsym_index): Make sure the new index
640 (Sized_relobj::set_must_have_output_symtab_entry): New function.
641 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
642 local symbol if permitted.
643 (Sized_relobj::do_finalize_local_symbols): Call
644 is_output_symtab_index_set rather than needs_output_symtab_entry.
645 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
646 rather than needs_output_symtab_entry. Call
647 has_output_dynsym_entry rather than needs_output_dynsym_entry.
648 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
649 is_output_symtab_index_set rather than needs_output_symtab_entry.
650 * testsuite/discard_locals_relocatable_test.c: New file.
651 * testsuite/discard_locals_test.sh: Test -r.
652 * testsuite/Makefile.am (check_DATA): Add
653 discard_locals_relocatable_test1.syms,
654 discard_local_relocatable_test2.syms.
655 (MOSTLYCLEANFILES): Likewise. Also add
656 discard_locals_relocatable_test1.lout and
657 discard_locals_relocatable_test2.out.
658 (discard_locals_relocatable_test1.syms): New target.
659 (discard_locals_relocatable_test.o): New target.
660 (discard_locals_relocatable_test1.out): New target.
661 (discard_locals_relocatable_test2.syms): New target.
662 (discard_locals_relocatable_test2.out): New target.
663 (various): Add missing ../ld-new dependencies.
664 * testsuite/Makefile.in: Rebuild.
666 2010-03-03 Nick Clifton <nickc@redhat.com>
668 * po/fi.po: New Finnish translation.
670 2010-03-01 Doug Kwan <dougkwan@google.com>
672 * layout.cc (Layout::Layout): Force section types of .init_array*,
673 .preinit_array* and .fini_array* sections.
674 * output.cc (Output_section::Input_section_sort_entry::has_priority):
675 Fix check of return value of std::string::find.().
676 (Output_section::Input_section_sort_compare::operator()): Remove
677 comment about .init_array.
678 (Output_section::Input_section_sort_init_fini_compare::operator()):
680 (Output_section::sort_attached_input_sections): Handle .init_array
681 and .fini_array specially.
682 * output.h (Output_section::Inut_section_sort_compare): Update
684 (Output_section::Input_section_sort_init_fini_compare): New struct.
686 2010-02-26 Doug Kwan <dougkwan@google.com>
688 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
689 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
690 * testsuite/debug_msg.sh: Avoid matching source line number for
691 use of global variable undef_int.
693 2010-02-26 Doug Kwan <dougkwan@google.com>
695 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
696 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
697 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
698 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
699 * options.cc (General_options::General_options): Initialize member
701 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
702 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
703 and rm_no_fix_v4bx.stdout
704 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
705 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
706 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
707 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
709 * Makefile.in: Regenerate.
710 * testsuite/arm_fix_v4bx.s: New file.
711 * testsuite/arm_fix_v4bx.sh: Ditto.
713 2010-02-24 Doug Kwan <dougkwan@google.com>
715 * arm.cc (Target_arm::got_section): Make the .got section the first
716 non RELRO section in the data segment.
717 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
718 suffixes of section names.
720 2010-02-24 Doug Kwan <dougkwan@google.com>
722 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
723 flags and attributes merging if an input file is a binary file.
724 * fileread.cc (Input_file::open): Record format of original file.
725 * fileread.h (Input_file::Format): New enum type.
726 (Input_file::Input_file): Initialize data member format_.
727 (Input_file::format): New method definition.
728 (Input_file::format_):: New data member.
730 2010-02-24 Doug Kwan <dougkwan@google.com>
732 * arm.cc (Arm_output_data_got): New class.
733 (ARM_TCB_SIZE): New constant
734 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
735 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
736 If user uses a script with a SECTIONS clause, issue only a warning
737 for a misplaced EXIDX input section. Otherwise, issue an error.
738 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
740 (Target_arm::got_mode_index_entry): Handle static linking.
741 (Target_arm::Scan::local): Ditto.
742 (Target_arm::Scan::global): Ditto.
743 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
744 all incorrectly implemented relocations.
745 (Target_arm::fix_exidx_coverage): Pass layout to
746 Arm_output_section::fix_exidx_coverage.
747 * layout.cc (Layout::section_name_mapping): Remove trailing dots
748 from ".ARM.exidx." and ".ARM.extab.".
750 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
752 * arm.cc (Target_arm::do_finalize_sections): Create attribute
753 section if it does not already exist.
754 * attributes.cc (Attributes_section_data::Attributes_section_data):
755 Don't crash if size is zero.
757 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
758 Ian Lance Taylor <iant@google.com>
760 * gold.cc (queue_middle_tasks): If no input files were opened,
762 * workqueue.h (Task_function::Task_function): Assert that there is
765 2010-02-22 Doug Kwan <dougkwan@google.com>
767 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
768 * icf.cc (get_section_contents): Cast snprintf arguments to long long
769 types to avoid warnings due to different uint64_t implementations
772 2010-02-21 Doug Kwan <dougkwan@google.com>
774 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
775 handling of the maximum backward branch offset.
776 (Arm_relocate_functions::thumb_branch_common): Ditto.
777 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
778 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
779 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
780 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
781 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
782 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
783 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
784 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
785 thumb_bl_out_of_range thumb_bl_out_of_range.o,
786 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
787 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
788 thumb2_bl_out_of_range.o): New rules.
789 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
790 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
791 thumb2_bl_out_of_range
792 * testsuite/Makefile.in: Regenerate.
793 * testsuite/arm_bl_in_range.s: New file.
794 * testsuite/arm_bl_out_of_range.s: Ditto.
795 * testsuite/arm_branch_in_range.sh: Ditto.
796 * testsuite/arm_branch_range.t: Ditto.
797 * testsuite/thumb2_branch_range.t: Ditto.
798 * testsuite/thumb_bl_in_range.s: Ditto.
799 * testsuite/thumb_bl_out_of_range.s: Ditto.
800 * testsuite/thumb_branch_range.t: Ditto.
802 2010-02-20 Sriraman Tallam <tmsriram@google.com>
804 * gc.h (gc_process_relocs): Change vectors to point to the new list.
805 Add reloc offset information.
806 * icf.cc (get_section_contents): Change iterators to point to the new
807 vectors. Add reloc offset information to the contents.
808 * icf.h (Icf::Sections_reachable_info): New typedef.
809 (Icf::Sections_reachable_list): New typedef.
810 (Icf::Offset_info): New typedef.
811 (Icf::Reloc_info): New struct typedef.
812 (Icf::Reloc_info_list): New typedef.
813 (Icf::symbol_reloc_list): Delete method.
814 (Icf::addend_reloc_list): Delete method.
815 (Icf::section_reloc_list): Delete method.
816 (Icf::reloc_info_list): New method.
817 (Icf::reloc_info_list_): New member.
819 2010-02-19 Doug Kwan <dougkwan@google.com>
821 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
822 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
823 * arm.cc (Arm_relocation_functions): New forward declaration.
824 (Target_arm::Target_arm): Initialize new data members
825 got_mod_index_offset_ and tls_base_symbol_defined_.
826 (Target_arm::Relocate::relocate_tls): New method.
827 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
828 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
830 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
831 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
832 (Target_arm::got_mod_index_offset_,
833 Target_arm::tls_base_symbol_defined_): New data members.
834 (Target_arm::Scan::local, Target::Scan::global,
835 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
838 2010-02-18 Doug Kwan <dougkwan@google.com>
840 * arm.cc (Arm_relobj::find_linked_text_section): New method.
841 (Arm_relobj::make_exidx_input_section): Pass section index of linked
842 text section as a parameter becuase some broken tools may not set
843 the link in section header.
844 (Target_arm::has_got_section): New method.
845 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
846 without any mapping symbol as data only. Remove warning.
847 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
848 link in its section header, try to discover the link by inspecting the
849 REL31 relocation at the beginning of the section.
850 (Target_arm::Scan::check_non_pic): Report name of offending relocation
852 (Target_arm::Scan::global): Treat any reference to the symbol
853 _GLOBAL_OFFSET_TABLE_ as a GOT access.
855 2010-02-12 Sriraman Tallam <tmsriram@google.com>
857 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
858 (Scan::global_reloc_may_be_function_pointer): New function.
859 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
860 (Scan::global_reloc_may_be_function_pointer): New function.
861 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
862 (Scan::global_reloc_may_be_function_pointer): New function.
863 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
864 (Scan::global_reloc_may_be_function_pointer): New function.
865 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
866 (Scan::global_reloc_may_be_function_pointer): New function.
867 (Scan::possible_function_pointer_reloc): New function.
868 (Target_x86_64::can_check_for_function_pointers): New function.
869 * gc.h (gc_process_relocs): Scan relocation types to determine if
870 function pointers were taken for targets that support it.
871 * icf.cc (Icf::find_identical_sections): Include functions for
872 folding in safe ICF whose pointer is not taken.
873 * icf.h (Secn_fptr_taken_set): New typedef.
874 (fptr_section_id_): New member.
875 (section_has_function_pointers): New function.
876 (set_section_has_function_pointers): New function.
877 (check_section_for_function_pointers): New function.
878 * options.h: Fix comment for safe ICF option.
879 * target.h (can_check_for_function_pointers): New function.
880 * testsuite/Makefile.am: Add icf_safe_so_test test case.
881 Modify icf_safe_test for X86-64.
882 * testsuite/Makefile.in: Regenerate.
883 * testsuite/icf_safe_so_test.cc: New file.
884 * testsuite/icf_safe_so_test.sh: New file.
885 * testsuite/icf_safe_test.cc (kept_func_3): New function.
886 (main): Change to take pointer to function kept_func_3.
887 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
888 folding is done correctly for X86-64.
890 2010-02-12 David S. Miller <davem@davemloft.net>
892 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
893 is_symbolless parameter.
894 (Output_reloc<SHT_REL>::is_symbolless): New.
895 (Output_reloc<SHT_REL>::is_symbolless_): New.
896 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
897 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
898 (Output_reloc<SHT_RELA>::is_symbolless): New.
899 (Output_data_reloc::add_global): Handle is_symbolless.
900 (Output_data_reloc::add_global_relative): Likewise.
901 (Output_data_reloc::add_local): Likewise.
902 (Output_data_reloc::add_local_relative): Likewise.
903 (Output_data_reloc::add_symbolless_global_addend): New.
904 (Output_data_reloc::add_symbolless_local_addend): New.
905 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
907 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
908 instead of ->is_relative_
909 (Output_reloc::write): Likewise.
910 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
911 (Output_reloc::write_rel): Simplify.
913 * sparc.cc (Target_sparc::Scan::local): Use
914 ->add_symbolless_local_addend as needed.
915 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
916 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
917 based upon relocation offset.
919 2010-02-11 Doug Kwan <dougkwan@google.com>
921 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
922 (Target_arm::Scan::global): Ditto. Also remove a comment before the
923 beginning of function.
924 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
925 and MOVT_ABS relocations. Those are non issued in scanning. Fix
926 parameter is_32bit in calls to should_apply_static_reloc.
927 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
928 (check_DATA): Add arm_abs_global.stdout.
929 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
930 arm_abs_global.stdout): New rules.
931 (MOSTLLYCLEANFILES): Add arm_abs_global
932 * Makefile.in: Regenerate.
933 * testsuite/arm_abs_global.s: New file.
934 * testsuite/arm_abs_global.sh: Ditto.
935 * testsuite/arm_abs_lib.s: Ditto.
937 2010-02-11 Ian Lance Taylor <iant@google.com>
939 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
941 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
942 Allocate_commons_task first.
943 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
944 task, rather than symtab_lock_.
945 (Gc_process_relocs::~Gc_process_relocs): New function.
946 (Gc_process_relocs::is_runnable): Check this_blocker_.
947 (Gc_process_relocs::locks): Use next_blocker_ rather than
949 (Scan_relocs::~Scan_relocs): New function.
950 (Scan_relocs::is_runnable): Check this_blocker_ rather than
952 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
954 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
955 fields. Add this_blocker_ and next_blocker_ fields. Adjust
956 constructor accordingly.
957 (class Gc_process_relocs): Likewise.
958 (class Scan_relocs): Likewise.
959 * common.h (class Allocate_commons_task): Remove symtab_lock_
960 field, and corresponding constructor parameter.
961 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
963 (Allocate_commons_task::locks): Likewise.
965 2010-02-11 Ian Lance Taylor <iant@google.com>
967 * gold-threads.h (class Once): Define.
968 (class Initialize_lock): Rewrite as child of Once.
969 * gold-threads.cc (class Once_initialize): Define.
970 (once_pointer_control): New static variable.
971 (once_pointer, once_arg): New static variables.
972 (c_run_once): New static function.
973 (Once::Once, Once::run_once, Once::internal_run): New functions.
974 (class Initialize_lock_once): Remove.
975 (initialize_lock_control): Remove.
976 (initialize_lock_pointer): Remove.
977 (initialize_lock_once): Remove.
978 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
979 (Initialize_lock::initialize): Rewrite.
980 (Initialize_lock::do_run_once): New function.
981 * archive.cc (Archive::interpret_header): Only clear name if it is
983 * fileread.cc: Include "gold-threads.h"
984 (file_counts_lock): New static variable.
985 (file_counts_initialize_lock): Likewise.
986 (File_read::release): Only increment counts when using --stats.
987 Use a lock around the increment.
988 * parameters.cc (class Set_parameters_target_once): Define.
989 (set_parameters_target_once): New static variable.
990 (Parameters::Parameters): Move here from parameters.h.
991 (Parameters::set_target): Rewrite.
992 (Parameters::set_target_once): New function.
993 (Parameters::clear_target): Move here and rewrite.
994 * parameters.h (class Parameters): Update declarations. Add
995 set_parameters_target_once_ field.
996 (Parameters::Parameters): Move to parameters.cc.
997 (Parameters::clear_target): Likewise.
998 * readsyms.cc (Read_symbols::do_group): Create a Start_group
1000 (Start_group::~Start_group): New function.
1001 (Start_group::is_runnable): New function.
1002 (Start_group::locks, Start_group::run): New functions.
1003 (Finish_group::run): Change saw_undefined to size_t.
1004 * readsyms.h (class Start_group): Define.
1005 (class Finish_group): Change saw_undefined_ field to size_t.
1006 (Finish_group::Finish_group): Remove saw_undefined and
1007 this_blocker parameters. Change all callers.
1008 (Finish_group::set_saw_undefined): New function.
1009 (Finish_group::set_blocker): New function.
1010 * symtab.h (class Symbol_table): Change saw_undefined to return
1011 size_t. Change saw_undefined_ field to size_t.
1012 * target-select.cc (Set_target_once::do_run_once): New function.
1013 (Target_selector::Target_selector): Initialize set_target_once_
1014 field. Don't initialize lock_ and initialize_lock_ fields.
1015 (Target_selector::instantiate_target): Rewrite.
1016 (Target_selector::set_target): New function.
1017 * target-select.h (class Set_target_once): Define.
1018 (class Target_selector): Update declarations. Make
1019 Set_target_once a friend. Remove lock_ and initialize_lock_
1020 fields. Add set_target_once_ field.
1022 2010-02-10 Ian Lance Taylor <iant@google.com>
1024 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
1026 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
1027 (queue_middle_tasks): Add all blockers before queueing any tasks.
1028 (queue_final_tasks): Likewise.
1029 * token.h (Task_token::add_blockers): New function.
1030 * object.h (Input_objects::number_of_relobjs): New function.
1032 2010-02-10 Ian Lance Taylor <iant@google.com>
1034 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
1035 shared, not if not position independent.
1036 * x86_64.cc (Relocate::relocate_tls): Likewise.
1037 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
1038 (tls_pie_pic_test): New target.
1039 * testsuite/Makefile.in: Rebuild.
1041 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
1042 (tls_test_main_pie.o, tls_test_pie.o): New targets.
1043 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
1044 * testsuite/Makefile.in: Rebuild.
1046 2010-02-09 David S. Miller <davem@davemloft.net>
1048 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
1049 R_SPARC_RELATIVE using ->add_local_relative().
1050 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
1052 * output.h (Output_data_dynamic::add_section_size): New method
1053 that takes two Output_data objects.
1054 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
1055 entry param. Handle it in initializers.
1056 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
1057 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
1058 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
1060 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
1061 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
1062 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
1063 for dynrel_includes_plt.
1064 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1065 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1066 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
1068 (Target_sparc::do_finalize_sections): Update to pass true for
1069 dynrel_includes_plt.
1070 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
1071 output before .rela.plt
1072 (Target_powerpc::do_finalize_sections): Update to pass true for
1073 dynrel_includes_plt when 32-bit.
1075 2010-02-08 Doug Kwan <dougkwan@google.com>
1077 * arm.cc (Arm_relobj::simple_input_section_output_address): New
1079 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
1080 Arm_relobj::scan_section_for_cortex_a8_stubs,
1081 Arm_relobj::do_relocation_section): Instead of calling
1082 Output_section::output_address, use faster
1083 Arm_relobj::simple_input_section_output_address.
1085 2010-02-08 David S. Miller <davem@davemloft.net>
1087 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
1088 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
1089 relocation helper function.
1091 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
1092 just like R_SPARC_GOT{10,13,22}.
1093 (Target_sparc::Scan::local): Likewise.
1094 (Target_sparc::Relocate:relocate): Likewise.
1096 2010-02-06 Ian Lance Taylor <iant@google.com>
1098 * configure.ac: Rewrite targetobjs duplicate removal code to use
1099 only shell constructs.
1100 * configure: Rebuild.
1102 2010-02-05 Doug Kwan <dougkwan@google.com>
1105 * arm.cc (Arm_relobj::section_is_scannable): New method.
1106 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
1107 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
1109 2010-02-04 Doug Kwan <dougkwan@google.com>
1112 * arm-reloc-property.cc (cstdio): Include.
1113 * configure.ac (targetobjs): Remove duplicates.
1114 * configure: Regenerate.
1115 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
1116 big and little endian version for a given address size.
1118 2010-02-03 Doug Kwan <dougkwan@google.com>
1120 * arm-reloc-property.cc
1121 (Arm_reloc_property_table::reloc_name_in_error_message): New method
1123 * arm-reloc-property.h
1124 (Arm_reloc_property_table::get_implemented_static_reloc_property):
1125 New method definition.
1126 (Arm_reloc_property_table::reloc_name_in_error_message): New method
1128 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
1130 (GOT_PREL): Change implemented to Y.
1131 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
1132 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
1133 (Arm_relocate_functions::movw_abs_nc): Remove method.
1134 (Arm_relocate_functions::movt_abs): Ditto.
1135 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
1136 (Arm_relocate_functions::thm_movt_abs): Ditto.
1137 (Arm_relocate_functions::movw_rel_nc): Ditto.
1138 (Arm_relocate_functions::movw_rel): Ditto.
1139 (Arm_relocate_functions::movt_rel): Ditto.
1140 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
1141 (Arm_relocate_functions:thm_movw_rel): Ditto.
1142 (Arm_relocate_functions:thm_movt_rel): Ditto.
1143 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
1144 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
1145 New method definitions.
1146 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
1147 (Arm_relocation_functions::arm_grp_ldr): Ditto.
1148 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
1149 (Arm_relocation_functions::arm_grp_ldc): Ditto.
1150 (Target_arm::Relocate::relocate): Check for non-static or
1151 unimplemented relocation code and exit early. Change calls to
1152 Target_arm::reloc_uses_thumb_bit and
1153 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
1154 instead. Refactor code to handle similar relocations to increase
1155 code sharing. Remove check for unsupported relocation code in switch
1157 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
1158 relocation property table to find out size. Change error message to
1159 print out the name of a relocation code instead of the numeric value.
1160 (Target_arm::scan_reloc_for_stub): Use relocation property table
1161 instead of calling Target_arm::reloc_uses_thumb_bit().
1163 2010-02-02 Doug Kwan <dougkwan@google.com>
1165 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
1166 types of relaxed input section.
1168 2010-02-02 Doug Kwan <dougkwan@google.com>
1170 * Makefile.am (HFILES): Add arm-reloc-property.h.
1172 (TARGETSOURCES): Add arm-reloc-property.cc
1173 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
1174 (libgold_a_SOURCES): $(DEFFILES)
1175 * Makefile.in: Regenerate.
1176 * arm-reloc-property.cc: New file.
1177 * arm-reloc-property.h: New file.
1178 * arm-reloc.def: New file.
1179 * arm.cc: Update comments.
1180 (arm-reloc-property.h): New included header.
1181 (arm_reloc_property_table): New global variable.
1182 (Target_arm::do_select_as_default_target): New method definition.
1183 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
1184 arm-reloc-property to targ_extra_obj.
1185 * parameters.cc (set_parameters_target): Call
1186 Target::select_as_default_target().
1187 * target.h (Target::select_as_default_target): New method definition.
1188 (Target::do_select_as_default_target): Same.
1190 2010-02-01 Doug Kwan <dougkwan@google.com>
1192 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
1193 first_output_text_section_.
1194 (Arm_exidx_fixup::first_output_text_section): New method definition.
1195 (Arm_exidx_fixup::first_output_text_section_): New data member.
1196 (Arm_exidx_fixup::process_exidx_section): Record the first text
1197 output section seen.
1198 (Arm_output_section::fix_exidx_coverage): Set correct linked section
1199 and entsize in output section header.
1201 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1203 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
1204 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
1205 (Arm_relocate_functions::thm_alu11): New Method.
1206 (Arm_relocate_functions::thm_pc8): New Method.
1207 (Arm_relocate_functions::thm_pc12): New Method.
1208 (Target_arm::Scan::local): Handle the relocations.
1209 (Target_arm::Scan::global): Likewise.
1210 (Target_arm::Relocate::relocate): Likewise.
1211 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1213 2010-01-29 Doug Kwan <dougkwan@google.com>
1215 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
1216 of relocation types as ld.
1218 2010-01-29 Doug Kwan <dougkwan@google.com>
1220 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
1222 (Arm_relocate_functions::thumb_branch_common): Ditto.
1223 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
1224 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
1225 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
1226 Arm_relocate_functions::jump24): Remove.
1227 (Target_arm::Relocate::relocate): Adjust code to call
1228 Arm_relocation_functions::arm_branch_common and
1229 Arm_relocation_functions::thumb_branch_common instead of their removed
1230 wrappers. Merge switch-cases together to reduce source code size.
1232 2010-01-29 Doug Kwan <dougkwan@google.com>
1234 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
1235 output_local_symbol_count_needs_update_.
1236 (Arm_relobj::output_local_symbol_count_needs_update,
1237 Arm_relobj::set_output_local_symbol_count_needs_update,
1238 Arm_relobj::update_output_local_symbol_count): New methods.
1239 (Arm_relobj::output_local_symbol_count_needs_update_): New data
1241 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
1242 of pointed function as in a R_ARM_PREL31 relocation.
1243 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
1244 for output local symbol count updating.
1245 (Target_arm::do_relax): Update output local symbol counts in objects
1247 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
1249 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1251 * arm.cc: Added support for the ARM relocations:
1252 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
1253 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
1254 (Arm_relocate_functions::movw_rel_nc): Renamed (was
1256 (Arm_relocate_functions::movw_rel): New method.
1257 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
1258 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
1260 (Arm_relocate_functions::thm_movw_rel): New method.
1261 (Arm_relocate_functions::thm_movt_rel): Renamed (was
1263 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
1265 (Target_arm::Scan::global): Likewise.
1266 (Target_arm::Relocate::relocate): Likewise.
1267 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1270 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1272 * arm.cc: Added support for ARM group relocations.
1273 (Target_arm::reloc_needs_sym_origin): New method.
1274 (Arm_relocate_functions::calc_grp_kn): New method.
1275 (Arm_relocate_functions::calc_grp_residual): New method.
1276 (Arm_relocate_functions::calc_grp_gn): New method.
1277 (Arm_relocate_functions::arm_grp_alu): New Method.
1278 (Arm_relocate_functions::arm_grp_ldr): New Method.
1279 (Arm_relocate_functions::arm_grp_ldrs): New Method.
1280 (Arm_relocate_functions::arm_grp_ldc): New Method.
1281 (Target_arm::Scan::local): Handle the ARM group relocations.
1282 (Target_arm::Scan::global): Likewise.
1283 (Target_arm::Relocate::relocate): Likewise.
1284 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1287 2010-01-26 Doug Kwan <dougkwan@google.com>
1289 * arm.cc (set): Include.
1290 (class Arm_exidx_fixup): Change type of last_input_section_ to const
1292 (Arm_output_section::Text_section_list): New type.
1293 (Arm_output_section::append_text_sections_to_list): New method.
1294 (Arm_output_section::fix_exidx_coverage): Ditto.
1295 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
1296 (Arm_relobj::convert_input_section_to_relaxed_section): Use
1297 Relobj::set_section_offset() instead of
1298 Sized_relobj::invalidate_section_offset().
1299 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
1300 parameter for section headers. Ignore relocation sections for
1301 unallocated sections and EXIDX sections.
1302 (Target_arm::fix_exidx_coverage): New method.
1303 (Target_arm::output_section_address_less_than): New type.
1304 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
1305 linked text section instead of the EXIDX section.
1306 (Arm_output_section::create_stub_group): Add an assertion to check
1307 that this is not an EXIDX output section.
1308 (Arm_output_section::append_text_sections_to_list): New method.
1309 (Arm_output_section::fix_exidx_coverage): Ditto.
1310 (Arm_relobj::scan_sections_for_stubs): Adjust call to
1311 Arm_relobj::section_needs_reloc_stub_scanning.
1312 (Target_arm::do_relax): Fix EXIDX output section coverage in the
1314 (Target_arm::fix_exidx_coverage): New method.
1315 * object.h (Relobj::set_output_section): New method.
1316 (Sized_relobj::invalidate_section_offset): Remove method.
1317 (Sized_relobj::do_invalidate_section_offset): Remove method.
1318 (Sized_relobj::do_set_section_offset): Handle offset value -1.
1320 2010-01-25 Doug Kwan <dougkwan@google.com>
1322 * arm.cc (Arm_exidx_merged_section::do_output_offset):
1323 Fix warning due to signed and unsigned comparison on a 32-bit host.
1325 2010-01-22 Doug Kwan <dougkwan@google.com>
1327 * arm.cc (Target_arm::do_relax): Record an output section for section
1328 offset adjustment it contains any stub table that has changed.
1329 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
1330 offsets in an output section if necessary.
1331 * output.cc (Output_section::Output_section): Initialize
1332 section_offsets_need_adjustments_.
1333 (Output_section::add_input_section_for_script): Renamed to
1334 Output_section::add_simple_input_section.
1335 (Output_section::save_states): Add a comment.
1336 (Output_section::discard_states): New method defintion.
1337 (Output_section::adjust_section_offsets): Same.
1338 * output.h (Output_section::add_input_section_for_script): Renamed to
1339 Output_section::add_simple_input_section.
1340 (Output_section::discard_states): New method declaration.
1341 (Output_section::adjust_section_offsets): Same.
1342 (Output_section::section_offsets_need_adjustment,
1343 Output_section::set_section_offsets_need_adjustment): New method
1345 (Output_section::section_offsets_need_adjustment_): New data member.
1346 * script-sections.cc
1347 (Output_section_element_input::set_section_address): Adjust code for
1348 renaming of Output_section::add_input_section_for_script.
1349 (Orphan_output_section::set_section_address): Same.
1351 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1353 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
1354 Fix_v4bx enum values .
1355 * gold/options.h (General_options): New option definitions.
1356 (General_options::fix_v4bx): New method.
1357 (General_options::Fix_v4bx): New enum.
1358 * gold/options.cc (General_options::parse_fix_v4bx): New method.
1359 (General_options::parse_fix_v4bx_interworking): New method.
1361 2010-01-22 Doug Kwan <dougkwan@google.com>
1363 * arm.cc (Arm_exidx_fixup): New class.
1365 2010-01-21 Doug Kwan <dougkwan@google.com>
1367 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
1369 (Arm_exidx_section_offset_map): New type.
1371 2010-01-21 Doug Kwan <dougkwan@google.com>
1373 * arm.cc (Arm_exidx_input_section): New class.
1374 (Arm_relobj::exidx_input_section_by_link,
1375 Arm_relobj::exidx_input_section_by_shndx,
1376 Arm_relobj::make_exidx_input_section): New methods.
1377 (read_arm_attributes_section): Remove.
1378 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
1379 information about them.
1380 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
1383 2010-01-20 Doug Kwan <dougkwan@google.com>
1385 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
1386 Input_section_specifier to Section_id.
1387 (Target_arm::new_arm_input_section: Adjust code for change of key
1389 (Target_arm::find_arm_input_section): Ditto.
1390 * gc.h (object.h): Include for Section_id nand Section_id_hash.
1391 (Section_id): Remove.
1392 (Garbage_collection::Section_id_hash): Remove.
1393 * icf.h (object.h): Include for Section_id nand Section_id_hash.
1394 (Section_id): Remove.
1395 (Icf::Section_id_hash): Remove.
1396 * object.h (Section_id, Const_section_id, Section_id_hash,
1397 Const_section_id_hash): New type definitions.
1398 * output.cc (Output_section::add_relaxed_input_section): Change to
1399 use Const_section_id instead of Input_section_specifier as key type.
1400 (Output_section::add_merge_input_section): Ditto.
1401 (Output_section::build_relaxation_map): Change to use Section_id
1402 instead of Input_section_specifier as key type.
1403 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1405 (Output_section::convert_input_sections_to_relaxed_sections): Change
1406 to use Const_section_id instead of Input_section_specifier as key type.
1407 (Output_section::find_merge_section): Ditto.
1408 (Output_section::find_relaxed_input_section): Ditto.
1409 * output.h (Input_section_specifier): Remove class.
1410 (Output_section::Output_section_data_by_input_section_map): Change
1411 key type to Const_section_id.
1412 (Output_section::Output_relaxed_input_section_by_input_section_map):
1414 (Output_section::Relaxation_map): Change key type to Section_id.
1416 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1418 * gold/arm.cc: Added support for R_ARM_V4BX relocation
1419 (class Arm_v4bx_stub): New class.
1420 (DEF_STUBS): Updated definition to support v4_veneer_bx.
1421 (Stub_factory::make_arm_v4bx_stub): New method.
1422 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
1423 (Stub_table::empty): Handle v4bx stubs.
1424 (Stub_table::add_arm_v4bx_stub): New method.
1425 (Stub_table::find_arm_v4bx_stub): New method.
1426 (Arm_relocate_functions::v4bx): New method.
1427 (Target_arm::fix_v4bx): New method.
1428 (Target_arm::Target_arm): Handle R_ARM_V4BX.
1429 (Stub_table::relocate_stubs): Likewise.
1430 (Stub_table::do_write): Likewise.
1431 (Stub_table::update_data_size_and_addralign): Likewise.
1432 (Stub_table::finalize_stubs): Likewise.
1433 (Target_arm::Scan::local): Likewise.
1434 (Target_arm::Scan::global): Likewise.
1435 (Target_arm::do_finalize_sections): Likewise.
1436 (Target_arm::Relocate::relocate): Likewise.
1437 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1439 (Target_arm::scan_reloc_for_stub): Likewise.
1440 (Target_arm::scan_reloc_section_for_stubs): Likewise.
1442 2010-01-19 Ian Lance Taylor <iant@google.com>
1444 * output.cc (Output_section_headers::do_sized_write): Write large
1445 segment count to sh_info field.
1446 (Output_file_header::do_sized_write): For large segment count,
1447 write PN_XNUM to e_phnum field.
1449 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1451 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
1452 (Arm_relocate_functions::thm_jump8): New function.
1453 (Arm_relocate_functions::thm_jump11): New function.
1454 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
1456 (Target_arm::Scan::global): Likewise.
1457 (Target_arm::Relocate::relocate): Likewise.
1458 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1461 2010-01-14 Doug Kwan <dougkwan@google.com>
1463 * arm.cc (map, utility): Include headers.
1464 (Target_arm::apply_cortex_a8_workaround): New method.
1465 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
1466 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
1467 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
1468 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
1469 the --[no-]fix-cortex-a8 command line options.
1470 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
1471 (Target_arm::relocate_stub): Use addend in instruction template.
1472 * options.h (DEFINE_bool): Set the user-set flag.
1473 (General_options): Add --[no-]-fix-cortex options.
1474 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
1475 : Update fast look-up map after conversion.
1477 2010-01-14 Sriraman Tallam <tmsriram@google.com>
1479 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
1480 in the first pass of do_layout.
1482 2010-01-13 Doug Kwan <dougkwan@google.com>
1484 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
1485 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
1486 apparent compiler problem of not folding static constant integral
1487 data members of elfcpp::Elf_sizes<32>.
1489 2010-01-13 Doug Kwan <dougkwan@google.com>
1491 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
1492 Arm_relobj::section_needs_cortex_a8_stub_scanning,
1493 Arm_relobj::scan_section_for_cortex_a8_erratum,
1494 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
1495 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
1496 sections to scan for relocation stubs into a new method
1497 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
1498 relocation and Cortex-A8 stub scanning.
1499 (Target_arm::do_relax): Force stubs to be after stubbed sections
1500 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
1501 the beginning of a new relaxation pass. Update a comment.
1502 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
1504 2010-01-12 Ian Lance Taylor <iant@google.com>
1506 * target-reloc.h (visibility_error): New inline function.
1507 (relocate_section): Call visibility_error.
1508 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
1509 (MOSTLYCLEANFILES): Likewise.
1510 (protected_4_pic.o, protected_3.err): New targets.
1511 * testsuite/protected_4.cc: New file.
1513 2010-01-12 Doug Kwan <dougkwan@google.com>
1515 * arm.cc (Cortex_a8_reloc): New class.
1516 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
1517 and cortex_a8_relocs_info_.
1518 (Target_arm::fix_cortex_a8): New method definition.
1519 (Target_arm::Cortex_a8_relocs_info): New type.
1520 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
1521 New data member declarations.
1522 (Target_arm::scan_reloc_for_stub): Record information about
1523 relocations for THUMB branches that might be exempted from the
1524 Cortex-A8 workaround.
1525 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
1526 at the beginning of a relaxation pass.
1528 2010-01-12 Doug Kwan <dougkwan@google.com>
1530 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
1531 (Arm_relobj::Mapping_symbol_position,
1532 Arm_reloj::Mapping_symbol_position_less,
1533 Arm_relobj::Mapping_symbols_info): New types.
1534 (Target_arm::is_mapping_symbol_name): New method definition.
1535 (Arm_relobj::do_count_local_symbols): Save information about mapping
1538 2010-01-11 Doug Kwan <dougkwan@google.com>
1540 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
1541 Arm_relocate_functions::thumb32_branch_upper,
1542 Arm_relocate_functions::thumb32_branch_lower,
1543 Arm_relocate_functions::thumb32_cond_branch_offset,
1544 Arm_relocate_functions::thumb32_cond_branch_upper,
1545 Arm_relocate_functions::thumb32_cond_branch_lower,
1546 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
1547 branch offset encoding.
1548 (Arm_relocate_functions::thumb_branch_common): Use new branch
1549 offset encoding methods to avoid code duplication.
1550 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
1551 (Stub_addend_reader::operator()): Use new branch encoding method
1552 to avoid code duplication.
1554 2010-01-11 Doug Kwan <dougkwan@google.com>
1556 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
1557 (Target_arm::do_finalize_sections): Define special EXIDX section
1558 symbols only if referenced.
1559 * gc.h (Garbage_collection::add_reference): New method.
1560 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
1563 2010-01-11 Ian Lance Taylor <iant@google.com>
1565 * script.cc (Version_script_info::build_expression_list_lookup):
1566 Change complaing about duplicate wildcard match from error to
1569 * script.cc (class Lazy_demangler): Recreate--revert part of patch
1571 (Version_script_info::Version_script_info): Initialize globs_,
1572 default_version_, default_is_global_, and exact_. Don't
1573 initialize globals_ or locals_.
1574 (Version_script_info::build_lookup_tables): Build local symbols
1576 (Version_script_info::unquote): New function.
1577 (Version_script_info::add_exact_match): New function.
1578 (Version_script_info::build_expression_list_lookup): Remove lookup
1579 parameter. Add is_global parameter. Change all callers. Handle
1580 wildcard pattern specially. Unquote pattern. Call
1582 (Version_script_info::get_name_to_match): New function.
1583 (Version_script_info::get_symbol_version): New function.
1584 (Version_script_info::get_symbol_version_helper): Remove.
1585 (Version_script_info::check_unmatched_names): Call unquote.
1586 * script.h (class Version_script_info): Change get_symbol_version
1587 to be non-inline and add is_global parameter; change all callers.
1588 Rewrite symbol_is_local. Update declarations. Define struct
1589 Version_tree_match, Exact, Globs. Don't define struct Lookup.
1590 Remove globals_ and locals_ members. Add exact_, globs_,
1591 default_version_, is_global_.
1592 (Version_script_info::Glob): Remove pattern, add expression and
1593 is_global. Update constructor. Change all callers.
1594 * dynobj.cc (Versions::finalize): Mark the version symbol as the
1596 (Versions::symbol_section_contents): If a symbol is undefined, or
1597 defined in a dynamic object, set the version index to
1599 * symtab.cc (Symbol_table::add_from_relobj): Don't call
1601 (Symbol_table::add_from_pluginobj): Likewise.
1602 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
1604 2010-01-11 Doug Kwan <dougkwan@google.com>
1606 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
1607 (incremental_dump_LDADD): Add linking option for libintl.
1608 * Makefile.in: Regenerate.
1610 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
1613 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
1615 * testsuite/Makefile.in: Regenerated.
1617 2010-01-10 Doug Kwan <dougkwan@google.com>
1619 * options.h (DEFINE_var): Use parentheses around argument varname__
1620 in macro body to avoid any unintended subsequent substitutions.
1622 2010-01-10 Ian Lance Taylor <iant@google.com>
1624 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
1625 candidates before doing symbol resolution.
1627 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
1628 ODR candidates if only one is weak.
1630 2010-01-08 Ian Lance Taylor <iant@google.com>
1632 * script.cc (Version_script_info::build_expression_list_lookup):
1633 Don't warn about ambiguous version, just record the ambiguity.
1634 (Version_script_info::get_symbol_version_helper): Give error if
1635 version is ambiguous.
1637 2010-01-08 Doug Kwan <dougkwan@google.com>
1639 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
1640 prev_data_size_ and prev_addralign_. Remove initializer for
1641 deleted data member has_been_changed_.
1642 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
1643 to determine if the table is empty.
1644 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
1646 (Stub_table::add_reloc_stub): Define method in class definition
1647 instead of just declaring it there.
1648 (Stub_table::add_cortex_a8_stub): New method definition.
1649 (Stub_table::update_data_size_and_addralign): Ditto.
1650 (Stub_table::finalize_stubs): Ditto.
1651 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
1652 (Stub_table::do_addralign_): Return address alignment in the
1653 (Stub_table::do_reset_address_and_file_offset): Define method in
1654 class definition instead of declaring it there. Set current data
1655 size to be the data size of the previous pass.
1656 (Stub_table::set_final_data_size): Use current data size as the
1658 (Stub_table::relocate_stub): Change parameter type of stub from
1659 Reloc_stub pointer to Stub pointer.
1660 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
1661 (Stub_table::Cortex_a8_stub_list): New typedef.
1662 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
1663 Stub_table::prev_addralign_): New data member.
1664 (Arm_relobj::Arm_relobj): Initialize data member
1665 section_has_cortex_a8_workaround_.
1666 (Arm_relobj::section_has_cortex_a8_workaround,
1667 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
1669 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
1671 (Target_arm::relocate_stub): Change parameter type of stub from
1672 Reloc_stub pointer to Stub pointer.
1673 (Insn_template::size, Insn_template::alignment): Handle
1674 THUMB16_SPECIAL_TYPE.
1675 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
1676 Stub_table::update_data_size_and_addralign,
1677 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
1679 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
1680 (Stub_table::do_write): Ditto.
1681 (Target_arm::do_relax): Adjust code for changes in Stub_table.
1683 2010-01-08 Ian Lance Taylor <iant@google.com>
1686 * symtab.h (class Symbol): Remove fields is_target_special_ and
1687 has_plt_offset_. Add field is_defined_in_discarded_section_.
1688 (Symbol::is_defined_in_discarded_section): New function.
1689 (Symbol::set_is_defined_in_discarded_section): New function.
1690 (Symbol::has_plt_offset): Rewrite.
1691 (Symbol::set_plt_offset): Verify that new offset is not -1U.
1692 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
1693 Don't initialize is_target_special_ or has_plt_offset_.
1694 Initialize is_defined_in_discarded_section_.
1695 (Symbol_table::add_from_relobj): If appropriate, set
1696 is_defined_in_discarded_section.
1697 * resolve.cc (Symbol::override_base_with_special): Don't test
1698 is_target_special_. Change has_plt_offset_ to has_plt_offset().
1699 * target-reloc.h (relocate_section): Do special handling for
1700 symbols defined in discarded sections for global symbols as well
1703 2010-01-08 Ian Lance Taylor <iant@google.com>
1705 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
1706 the SHT_SYMTAB case.
1708 2010-01-08 Ian Lance Taylor <iant@google.com>
1710 * object.cc (Sized_relobj::do_layout): Don't get confused if
1711 layout_eh_frame returns NULL.
1713 2010-01-08 Ian Lance Taylor <iant@google.com>
1716 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
1717 dynamic symbol table, use the normal symbol table.
1718 (Sized_dynobj::do_read_symbols): Remove assertion about type of
1721 2010-01-08 Ian Lance Taylor <iant@google.com>
1724 * layout.cc (Layout::include_section): Remove .gnu_debuglink
1727 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
1729 * version.cc (print_version): Change to "Copyright 2010".
1731 2010-01-08 Ian Lance Taylor <iant@google.com>
1735 * i386.cc (class Target_i386): Change return type of plt_section
1737 (class Output_data_plt_i386): Add tls_desc_rel_ field.
1738 (Output_data_plt_i386::Output_data_plt_i386): Initialize
1739 tls_desc_rel_ field.
1740 (Output_data_plt_i386::rel_tls_desc): New function.
1741 (Target_i386::rel_tls_desc_section): New function.
1742 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
1743 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
1744 R_386_TLS_DESC reloc in rel_tls_desc_section.
1745 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
1746 Define struct Tlsdesc_info.
1747 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
1748 (Target_x86_64::do_reloc_symbol_index): New function.
1749 (Target_x86_64::add_tlsdesc_info): New function.
1750 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
1751 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
1753 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
1755 (Output_data_plt_x86_64::rela_tlsdesc): New function.
1756 (Target_x86_64::rela_tlsdesc_section): New function.
1757 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
1759 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
1760 (Target_x86_64::do_reloc_addend): New function.
1761 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
1762 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
1763 declarations. Define TARGET_CODE. Add arg field to u1_ union.
1764 (Output_reloc::type): New function.
1765 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
1766 (Output_reloc::is_target_specific): New function.
1767 (Output_reloc::target_arg): New function.
1768 (class Output_reloc) [SHT_RELA]: Add four new constructors for
1769 absolute relocs and target specific relocs.
1770 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
1771 add_target_specific.
1772 (class Output_data_reloc) [SHT_RELA]: Likewise.
1773 * output.cc (Output_reloc::Output_reloc): Add four new versions
1774 for absolute relocs and target specific relocs.
1775 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
1776 (Output_reloc::get_symbol_index): Likewise.
1777 (Output_reloc::local_section_offset): Check that local_sym_index_
1778 is not TARGET_CODE or 0.
1779 (Output_reloc::symbol_value): Likewise.
1780 (Output_reloc::write) [SHT_RELA]: Call target for target specific
1782 * target.h (class Target): Add reloc_symbol_index and reloc_addend
1783 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
1785 * layout.cc (add_target_dynamic_tags): Use output section for
1786 DT_PLTRELSZ and DT_JMPREL.
1788 2010-01-07 Ian Lance Taylor <iant@google.com>
1791 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
1793 (class Output_data_reloc_generic): Define.
1794 (class Output_data_reloc_base): Change base class to
1795 Output_data_reloc_generic. Change add() method to call
1796 bump_relative_reloc_count for a relative reloc. Remove
1798 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
1800 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
1801 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
1803 * layout.h (class Layout): Update declaration.
1805 2010-01-07 Ian Lance Taylor <iant@google.com>
1807 * output.h (class Output_data): Add const version of
1808 output_section and do_output_section.
1809 (class Output_section_data): Add const version of
1811 (class Output_section): Likewise.
1812 * layout.cc (Layout::add_target_dynamic_tags): New function.
1813 * layout.h (class Layout): Update declarations.
1814 * arm.cc (Target_arm::do_finalize_sections): Use
1815 add_target_dynamic_tags.
1816 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1817 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1818 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1819 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1821 2010-01-07 Ian Lance Taylor <iant@google.com>
1824 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
1827 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
1828 Ian Lance Taylor <iant@google.com>
1831 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
1832 Xindex::read_symtab_xindex.
1834 2010-01-07 Doug Kwan <dougkwan@google.com>
1836 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
1837 (Insn_template::thumb16_bcond_insn): New method declaration.
1838 (Insn_template): Fix spelling.
1839 (Stub::thumb16_special): New method declaration.
1840 (Stub::do_write): Define virtual method which was previously pure
1842 (Stub::do_thumb16_special): New method declaration.
1843 (Stub::do_fixed_endian_write): New template member.
1844 (Reloc_stub::do_write): Remove.
1845 (Reloc_stub::do_fixed_endian_write): Remove.
1846 (Cortex_a8_stub): New class definition.
1847 (Stub_factory::make_cortex_a8_stub): New method definition.
1848 (Stub_factory::Stub_factory): Add missing static storage class
1849 qualifier for elf32_arm_stub_a8_veneer_blx.
1851 2010-01-07 Ian Lance Taylor <iant@google.com>
1854 * options.h (class General_options): Add --warn-unresolved-symbols
1855 and --error-unresolved-symbols.
1856 * errors.cc (Errors::undefined_symbol): Implement
1857 --warn-unresolved-symbols.
1859 * options.h (class General_options): Add -z text and -z textoff.
1860 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
1862 2010-01-06 Sriraman Tallam <tmsriram@google.com>
1864 * gc.h (Garbage_collection::Cident_section_map): New typedef.
1865 (Garbage_collection::cident_sections): New function.
1866 (Garbage_collection::add_cident_section): New function.
1867 (Garbage_collection::cident_sections_): New member.
1868 (gc_process_relocs): Add references to sections whose names are C
1870 * gold.h (cident_section_start_prefix): New constant.
1871 (cident_section_stop_prefix): New constant.
1872 (is_cident): New function.
1873 * layout.cc (Layout::define_section_symbols): Replace string constants
1874 with the newly defined constants.
1875 * object.cc (Sized_relobj::do_layout): Track sections whose names are
1877 * testsuite/Makefile.am: Add gc_orphan_section_test.
1878 * testsuite/Makefile.in: Regenerate.
1879 * testsuite/gc_orphan_section_test.cc: New file.
1880 * testsuite/gc_orphan_section_test.sh: New file.
1882 2010-01-06 Ian Lance Taylor <iant@google.com>
1885 * options.h (class General_options): Add --warn-shared-textrel.
1886 * layout.cc (Layout::finish_dynamic_section): Implement
1887 --warn-shared-textrel.
1890 * options.h (class General_options): Add --warn-multiple-gp.
1892 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1894 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
1895 $(THREADSLIB) and $(LIBDL).
1896 * Makefile.in: Rebuild.
1898 2010-01-06 Ian Lance Taylor <iant@google.com>
1901 * options.cc (General_options::parse_section_start): New function.
1902 (General_options::section_start): New function.
1903 (General_options::General_options): Initialize all members.
1904 * options.h: Include <map>
1905 (class General_options): Add --section-start. Add section_starts_
1907 * layout.cc (Layout::attach_allocated_section_to_segment): If
1908 --section-start was used, set the address of the segment. Remove
1909 local sort_sections.
1910 (Layout::relaxation_loop_body): If the address of the load segment
1911 has been set by --section-start, don't use it.
1912 * output.h (Output_segment::update_flags_for_output_section): New
1914 * output.cc (Output_segment::add_output_section): Call
1915 update_flags_for_output_section.
1917 2010-01-05 Ian Lance Taylor <iant@google.com>
1920 * options.h (class General_options): Add --undefined-version.
1921 * script.cc (struct Version_expression): Add was_matched_by_symbol
1923 (Version_script_info::matched_symbol): New function.
1924 (Version_script_info::get_symbol_version_helper): Call
1926 (Version_script_info::check_unmatched_names): New function.
1927 * script.h (class Version_script_info): Update declarations.
1928 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
1930 * options.h (class General_options): Use DEFINE_bool_alias for
1931 allow_multiple_definition.
1932 * resolve.cc (Symbol_table::should_override): Don't test
1933 allow_multiple_definition.
1936 * options.h (class General_options): Add --cref.
1937 * main.cc (main): Print cref table if --cref. Don't close mapfile
1938 until after printing cref table.
1939 * cref.cc: Include "symtab.h".
1940 (class Cref_inputs): Define Cref_table_compare and Cref_table.
1941 (Cref_table_compare::operator()): New function.
1942 (Cref_inputs::gather_cref): New function.
1943 (filecol): New static const.
1944 (Cref_inputs::print_cref): New function.
1945 (Cref::print_cref): New function.
1946 * cref.h: Include <cstdio>.
1947 (class Cref): Update declarations.
1948 * mapfile.h (Mapfile::file): New function.
1949 * object.h (class Object): Define Symbols. Declare virtual
1950 do_get_global_symbols.
1951 (Object::get_global_symbols): New function.
1952 * object.cc (Input_objects::add_object): Pass object to cref_ if
1954 (Input_objects::archive_start): Likewise.
1955 (Input_objects::archive_stop): Likewise.
1956 (Input_objects::print_cref): New function.
1957 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
1958 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
1960 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
1962 * plugin.h (class Sized_pluginobj): Update declarations.
1964 2010-01-05 Ian Lance Taylor <iant@google.com>
1966 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
1967 to is_default_version. Rename insdef to insdefault.
1968 (Symbol_table::add_from_relobj): Rename def to is_default_version
1969 and local to is_forced_local.
1970 (Symbol_table::add_from_pluginobj): Likewise.
1971 (Symbol_table::add_from_dynobj): Likewise.
1972 (Symbol_table::define_special_symbol): Rename insdef to
1975 2010-01-04 Ian Lance Taylor <iant@google.com>
1978 * options.h (class General_options): Add
1979 --allow-multiple-definition and -z muldefs.
1980 * resolve.cc (Symbol_table::should_override): Don't warn about a
1981 multiple symbol definition if --allow-multiple-definition or -z
1985 * options.h (class General_options): Add --add-needed and
1986 --copy-dt-needed-entries. Tweak --as-needed help entry.
1987 * object.cc (Input_objects::check_dynamic_dependencies): Give an
1988 error if --copy-dt-needed-entries aka --add-needed is used and
1989 would cause a change in behaviour.
1992 * options.h (class General_options): Add -G as a short version of
1993 --shared. Add no-op options -assert, -g, and -i.
1995 2010-01-04 Sriraman Tallam <tmsriram@google.com>
1997 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
1998 check for .text or .gnu.linkonce.t sections.
1999 * icf.cc (Icf::find_identical_sections): Ditto.
2000 Change the detection for mangled function name within the section
2002 * icf.h (is_section_foldable_candidate): New function.
2004 2009-12-30 Ian Lance Taylor <iant@google.com>
2007 * options.h (class General_options): Permit two dashes with
2008 --retain-symbols-file.
2010 2009-12-30 Ian Lance Taylor <iant@google.com>
2013 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
2014 don't put the file header and segment headers in the text
2018 * common.cc (Sort_commons::operator()): Stabilize sort when both
2020 (Symbol_table::do_allocate_commons_list): When allocating common
2021 symbols, skip a symbol which is no longer common.
2022 * symtab.h (Symbol::is_common): Test whether the symbol comes from
2023 an object before checking its type.
2024 * testsuite/common_test_2.c: New file.
2025 * testsuite/common_test_3.c: New file.
2026 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
2027 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
2028 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
2029 (common_test_2_pic.o, common_test_2.so): New targets.
2030 (common_test_3_pic.o, common_test_3.so): New targets.
2031 * testsuite/Makefile.in: Rebuild.
2034 * script.cc (read_input_script): If we see a new SECTIONS clause,
2035 and we have added an input section, give an error.
2036 * layout.h (class Layout): Add have_added_input_section function.
2037 Add have_added_input_section_ field.
2038 * layout.cc (Layout::Layout): Initialize
2039 have_added_input_section_.
2040 (Layout::layout): Set have_added_input_section_.
2041 (Layout::layout_eh_frame): Likewise.
2043 2009-12-30 Ian Lance Taylor <iant@google.com>
2046 * options.h (class General_options): Add --sort-common option.
2047 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
2048 * common.cc (Sort_common): Add sort_order parameter to
2049 constructor. Add sort_order_ field.
2050 (Sort_commons::operator): Check sort_order_.
2051 (Symbol_table::allocate_commons): Determine the sort order.
2052 (Symbol_table::do_allocate_commons): Add sort_order parameter.
2054 (Symbol_table::do_allocate_commons_list): Likewise.
2056 2009-12-30 Ian Lance Taylor <iant@google.com>
2059 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
2060 symbols from this object, don't change the visibility of an
2062 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
2064 2009-12-30 Ian Lance Taylor <iant@google.com>
2067 * script.h (class Version_script_info): Define Language enum.
2068 Update declarations. Define Glob, Exact, and Lookup types. Add
2069 new fields globals_, locals_, and is_finalized_.
2070 * script.cc: Various formatting fixes.
2071 (class Parser_closure): Change language_stack_ from a vector of
2072 std::string to one of Version_script_info::Language. Adjust all
2074 (class Lazy_demangler): Remove.
2075 (struct Version_expression): Change language from std::string to
2076 Version_script_info::Language.
2077 (Version_script_info::Version_script_info): New function.
2078 (Version_script_info::~Version_script_info): Don't call clear.
2079 (Version_script_info::finalize): New function.
2080 (Version_script_info::build_lookup_tables): New function.
2081 (Version_script_info::build_expression_list_lookup): New
2083 (Version_script_info::get_symbol_version_helper): Rewrite to use
2085 (Version_script_info::print_expression_list): Adjust to use
2086 Version_script_info::Language.
2087 (script_push_lex_into_version_mode): Check that the version script
2088 has not been finalized.
2089 (version_script_push_lang): Change language string to
2090 Version_script_info::Language.
2091 * options.cc (Command_line::version_script): New function.
2092 * options.h (class General_options): Add finalize_dynamic_list
2093 function. Change version_script from declaration to definition.
2094 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
2095 * testsuite/version_script.map: Remove duplicate def of foo.
2096 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
2098 * testsuite/Makefile.in: Rebuild.
2100 2009-12-30 Ian Lance Taylor <iant@google.com>
2103 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
2104 if the input symbol index is 0, make the output symbol index 0.
2106 2009-12-30 Ian Lance Taylor <iant@google.com>
2109 * options.h (class General_options): Add -x/--discard-all.
2110 * object.cc (Sized_relobj::do_count_local_symbols): Handle
2111 --discard-all. If the local symbol needs a dynamic entry, check
2112 that before handling --discard-locals.
2114 2009-12-30 Ian Lance Taylor <iant@google.com>
2117 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
2119 (Output_segment::add_output_section): Don't change the flags if
2123 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
2124 GNU hash table if they need a dynamic value. Otherwise, don't add
2125 them if they are defined in a dynamic object or are forced local.
2127 2009-12-29 Ian Lance Taylor <iant@google.com>
2130 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
2131 .gnu.hash table for a 32-bit target.
2134 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
2135 regular and a dynamic object only needs a dynamic symbol table
2136 entry if it is externally visible.
2139 * i386.cc (class Target_i386): Initialize global_offset_table_ in
2140 constructor. Add global_offset_table_ field.
2141 (Target_i386::got_section): Set global_offset_table_.
2142 (Target_i386::do_finalize_sections): Set global_offset_table_
2144 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
2145 in constructor. Add global_offset_table_ field.
2146 (Target_x86_64::got_section): Set global_offset_table_.
2147 (Target_x86_64::do_finalize_sections): Set global_offset_table_
2150 * layout.cc (Layout::Layout): Initialize increase_relro_.
2151 (Layout::get_output_section): Add is_relro, is_last_relro, and
2152 is_first_non_relro parameters. Change all callers.
2153 (Layout::choose_output_section): Likewise.
2154 (Layout::add_output_section_data): Likewise.
2155 (Layout::make_output_section): Likewise.
2156 (Layout::set_segment_offsets): Clear increase_relro when using a
2158 * layout.h (class Layout): Add increase_relro method. Add
2159 increase_relro_ field. Update declarations.
2160 * output.cc (Output_section::Output_section): Initialize
2161 is_last_relro_ and is_first_non_relro_.
2162 (Output_segment::add_output_section): Group relro sections is
2163 do_sort is true. Handle is_last_relro and is_first_non_relro.
2164 (Output_segment::maximum_alignment): Remove relro handling.
2165 (Output_segment::set_section_addresses): Add increase_relro
2166 parameter. Change all callers. Add initial alignment to align
2167 relro sections on separate page. Remove old relro handling.
2168 (Output_segment::set_section_list_addresses): Remove in_relro
2169 parameter. Change all callers.
2170 (Output_segment::set_offset): Add increase parameter. Change all
2171 callers. Remove old relro handling.
2172 * output.h (class Output_section): Add new methods: is_last_relro,
2173 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
2174 Add is_last_relro_ and is_first_non_relro_ fields.
2175 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
2176 Create separate .got.plt section. Call increase_relro.
2177 * x86_64.cc (Target_x86_64::got_section): Likewise.
2178 * testsuite/relro_script_test.t: Add .got.plt.
2181 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
2182 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
2183 (Layout::finalize): Call set_dynamic_symbol_size.
2184 (Layout::set_dynamic_symbol_size): New function.
2185 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
2186 set_dynamic_symbol_size.
2189 * output.h (class Output_section): Add is_entsize_zero_ field.
2190 * output.cc (Output_section::Output_section): Initialize
2192 (Output_section::set_entsize): If two different entsizes are
2193 requested, force it to zero.
2194 (Output_section::add_input_section): Set flags for .debug_str
2195 before updating section flags. Set entsize.
2196 (Output_section::update_flags_for_input_section): Set SHF_MERGE
2197 and SHF_STRING if all input sections have those flags.
2199 2009-12-29 Rafael Espindola <espindola@google.com>
2201 * main.cc (main): Fix the sys time reporting.
2202 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
2205 2009-12-29 Sriraman Tallam <tmsriram@google.com>
2207 * options.cc (General_options::parse_version): Allow -v to exit
2208 without an error if there is nothing to link.
2210 2009-12-29 Ian Lance Taylor <iant@google.com>
2212 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
2213 using a version of gcc before 4.1.
2214 * configure: Rebuild.
2216 2009-12-28 Chris Demetriou <cgd@google.com>
2218 * attributes.cc (Output_attributes_section_data::do_write): Use
2219 std::vector::front rather than std::vector::data.
2221 2009-12-28 Ian Lance Taylor <iant@google.com>
2223 * symtab.h (class Symbol_table): Add enum Defined.
2224 * resolve.cc (Symbol_table::should_override): Add defined
2225 parameter. Change all callers. Test whether object is NULL
2226 before calling a method on it.
2227 (Symbol_table::report_resolve_problem): Add defined parameter.
2229 (Symbol_table::should_override_with_special): Likewise.
2230 * symtab.cc (Symbol_table::define_in_output_data): Add defined
2231 parameter. Change all callers.
2232 (Symbol_table::do_define_in_output_data): Likewise.
2233 (Symbol_table::define_in_output_segment): Likewise.
2234 (Symbol_table::do_define_in_output_segment): Likewise.
2235 (Symbol_table::define_as_constant): Likewise.
2236 (Symbol_table::do_define_as_constant): Likewise.
2237 * script.h (class Symbol_assignment): Add is_defsym parameter to
2238 constructor; change all callers.
2239 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
2240 parameter. Change all callers. Add is_defsym_ field.
2241 (class Parser_closure): Add parsing_defsym parameter to
2242 constructor; change all callers. Add parsing_defsym accessor
2243 function. Add parsing_defsym_ field.
2245 2009-12-28 Ian Lance Taylor <iant@google.com>
2247 * gold.cc (queue_middle_tasks): Fix formatting.
2248 * object.cc (Relobj::is_section_name_included): Likewise.
2250 2009-12-23 Ian Lance Taylor <iant@google.com>
2252 * i386.cc (Target_i386::do_calls_non_split): Recognize
2253 -fsplit-stack prologue for a function with a static chain.
2254 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
2255 -fsplit-stack prologue when using %r11.
2257 2009-12-21 Sriraman Tallam <tmsriram@google.com>
2259 * options.cc (General_options::parse_version): Make -v continue and do
2260 the link like GNU ld does.
2262 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
2264 * Makefile.am (CCFILES): Add timer.cc.
2265 (HFILES): Add timer.h.
2266 * configure.ac: Check for sysconf and times.
2267 * main.cc: include timer.h.
2268 (main): Use Timer instead of get_run_time.
2271 * workqueue.cc: include timer.h.
2272 (Workqueue::find_and_run_task):
2273 Report user, sys and wall time.
2274 * Makefile.in: Regenerate.
2275 * config.in: Regenerate.
2276 * configure: Regenerate.
2278 2009-12-16 Doug Kwan <dougkwan@google.com>
2280 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
2282 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
2283 relaxed input sections.
2284 * output.cc (Output_section::find_relaxed_input_section): Change
2285 return type to Output_relaxed_input_section pointer. Adjust code
2286 for new type of relaxed_input_section_map_.
2287 * output.h (Output_section::find_relaxed_input_section): Change
2288 return type to Output_relaxed_input_section pointer.
2289 (Output_section::Output_relaxed_input_section_by_input_section_map):
2291 (Output_section::relaxed_input_section_map_): Change type to
2292 Output_section::Output_relaxed_input_section_by_input_section_map.
2293 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
2296 2009-12-15 Ian Lance Taylor <iant@google.com>
2298 * layout.cc (Layout::create_shstrtab): Only write out after input
2299 sections if we are compressing debug sections.
2301 2009-12-15 Ian Lance Taylor <iant@google.com>
2303 * archive.cc (Archive::add_symbols): Only look up a symbol without
2304 a version if there is, in fact, a version.
2306 2009-12-14 Ian Lance Taylor <iant@google.com>
2308 Revert -Wshadow changes, all changes from:
2309 2009-12-11 Doug Kwan <dougkwan@google.com>
2310 2009-12-11 Nick Clifton <nickc@redhat.com>
2311 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
2313 2009-12-11 Doug Kwan <dougkwan@google.com>
2315 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
2317 * attributes.cc (Object_attribute::size): Ditto.
2318 (Attributes_section_data::size): Ditto.
2319 (Attributes_section_data::Attributes_section_data): Ditto.
2320 (Output_attributes_section_data::do_write): Ditto.
2321 * attributes.h (Object_attribute::set_type): Ditto.
2322 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
2324 2009-12-11 Nick Clifton <nickc@redhat.com>
2326 * archive.cc: Fix shadowed variable warnings.
2328 * compressed_output.cc: Likewise.
2329 * compressed_output.h: Likewise.
2330 * configure: Likewise.
2331 * dwarf_reader.cc: Likewise.
2332 * dynobj.cc: Likewise.
2333 * dynobj.h: Likewise.
2334 * ehframe.cc: Likewise.
2335 * ehframe.h: Likewise.
2336 * errors.cc: Likewise.
2337 * expression.cc: Likewise.
2338 * fileread.cc: Likewise.
2339 * fileread.h: Likewise.
2340 * freebsd.h: Likewise.
2341 * i386.cc: Likewise.
2343 * incremental.h: Likewise.
2344 * layout.cc: Likewise.
2345 * layout.h: Likewise.
2346 * mapfile.cc: Likewise.
2347 * merge.cc: Likewise.
2348 * merge.h: Likewise.
2349 * object.cc: Likewise.
2350 * object.h: Likewise.
2351 * options.h: Likewise.
2352 * output.cc: Likewise.
2353 * output.h: Likewise.
2354 * parameters.cc: Likewise.
2355 * plugin.cc: Likewise.
2356 * powerpc.cc: Likewise.
2357 * reduced_debug_output.cc: Likewise.
2358 * reduced_debug_output.h: Likewise.
2359 * reloc.cc: Likewise.
2360 * reloc.h: Likewise.
2361 * resolve.cc: Likewise.
2362 * script-sections.cc: Likewise.
2363 * script.cc: Likewise.
2364 * script.h: Likewise.
2365 * sparc.cc: Likewise.
2366 * symtab.cc: Likewise.
2367 * symtab.h: Likewise.
2368 * target-select.cc: Likewise.
2369 * target-select.h: Likewise.
2370 * token.h: Likewise.
2371 * workqueue.cc: Likewise.
2372 * workqueue.h: Likewise.
2373 * x86_64.cc: Likewise.
2375 2009-12-10 Doug Kwan <dougkwan@google.com>
2377 * arm.cc (attributes.h): New include.
2378 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
2379 (Arm_relobj::~Arm_relobj): Delete object pointed by
2380 attributes_section_data_.
2381 (Arm_relobj::attributes_section_data): New method definition.
2382 (Arm_relobj::attributes_section_data_): New data member declaration.
2383 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
2384 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
2385 attributes_section_data_.
2386 (Arm_dynobj::attributes_section_data): New method definition.
2387 (Arm_dynobj::attributes_section_data_): New data member declaration.
2388 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
2389 initialization value of may_use_blx_ to false.
2390 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
2391 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
2392 object attributes to compute results instead of hard-coding.
2393 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
2394 Target_arm::get_secondary_compatible_arch,
2395 Target_arm::set_secondary_compatible_arch
2396 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
2397 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
2398 New method declarations.
2399 (Target_arm::get_aeabi_object_attribute): New method definition.
2400 (Target_arm::attributes_section_data_): New data member declaration.
2401 (read_arm_attributes_section): New template definition.
2402 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
2403 (Arm_dynobj::do_read_symbols): Ditto.
2404 (Target_arm::do_finalize_sections): Merge attributes sections from
2405 input. Check for BLX use after attributes section merging.
2406 Fix __exidx_start and __exidx_end visibility. Create an
2407 .ARM.attributes section if necessary.
2408 (Target_arm::get_secondary_compatible_arch,
2409 Target_arm::set_secondary_compatible_arch,
2410 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
2411 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
2412 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
2413 New method definitions.
2415 2009-12-09 Ian Lance Taylor <iant@google.com>
2417 * plugin.cc (Plugin::load): Don't cast from void* to a function
2420 2009-12-09 Ian Lance Taylor <iant@google.com>
2422 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
2425 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
2427 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
2428 Replace two_file_shared_1.so with two_file_shared_2.so.
2429 * testsuite/Makefile.in: Regenerated.
2431 2009-12-08 Doug Kwan <dougkwan@google.com>
2433 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
2434 (HFILES): Add attributes.h and int_encoding.h.
2435 * Makefile.in: Regenerate.
2436 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
2437 function definitions to int_encoding.cc
2438 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
2439 prototypes to int_encoding.h
2440 * reduced_debug_output.cc (int_encoding.h): New include.
2441 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
2442 function definitions to int_encoding.cc
2443 (insert_into_vector, read_from_pointer): Move template definitions to
2445 * attributes.cc: New file.
2446 * attributes.h: New file.
2447 * int_encoding.cc: New file.
2448 * int_encoding.h: New file.
2450 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
2453 * incremental-dump.cc (dump_incremental_inputs): New.
2454 (main): Use dump_incremental_inputs.
2456 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
2459 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
2460 checking elfcpp::STT_FUNC.
2461 (Target_i386::Relocate::relocate): Likewise.
2462 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2464 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
2465 symbols from shared libraries into normal FUNC symbols.
2467 * symtab.h (Symbol): Add is_func and use it.
2469 2009-12-05 Doug Kwan <dougkwan@google.com>
2471 * arm.cc (Target_arm::arm_info): Initialize new fields
2472 attributes_section and attributes_vendor.
2473 * i386.cc (Target_i386::i386_info): Same.
2474 * object.cc (Sized_relobj::do_layout): Skip attribute section.
2475 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
2476 fields attributes_section and attributes_vendor.
2477 * sparc.cc (Target_sparc::sparc_info): Same.
2478 * target.h (Target::attributes_section, Target::attributes_vendor,
2479 Target::is_attributes_section, Target::attribute_arg_type,
2480 Target::attributes_order): New method definitions.
2481 (Target::Target_info::attributes_section,
2482 Target::Target_info::attributes_vendor): New fields.
2483 (Target::do_attribute_arg_type, Target::do_attributes_order): New
2484 virtual method definitions.
2485 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
2486 attributes_section and attributes_vendor.
2487 * testsuite/testfile.cc (Target_test::test_target_info): Same.
2489 2009-12-05 Doug Kwan <dougkwan@google.com>
2491 * arm.cc: Update comments about interworking and stub generation.
2492 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
2493 considered as non-PIC.
2494 (Arm_relocate_functions::base_abs): Fix formatting.
2495 (Arm_relocate_functions::got_prel): Fix comment. Change interface
2496 of function to use GOT entry address instead of offset.
2497 (Target_arm::Scan::global): Issue an error if a symbol would need a
2498 PLT does not get one because it is untyped. Remove code to create
2499 dynamic symbols for relative branches.
2500 (Target_arm::Relocate::relocate: Use 0 instead of false since function
2501 takes unsigned integer instead of boolean.
2503 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
2505 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
2506 (two_file_test_LDADD): Likewise.
2507 (common_test_1_LDADD): Likewise.
2508 (exception_test_LDADD) Likewise.
2509 (weak_test_LDADD): Likewise.
2510 (many_sections_test_LDADD): Likewise.
2511 (initpri1_LDADD): Likewise.
2512 (script_test_1_LDADD): Likewise.
2513 (script_test_2_LDADD): Likewise.
2514 (justsyms_LDADD): Likewise.
2515 (binary_test_LDADD): Likewise.
2516 (large_LDADD): Likewise.
2517 * testsuite/Makefile.in: Regenerated.
2519 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
2521 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
2522 (Symbol_table::override_with_special): Likewise.
2523 (Symbol_table::add_from_object): Likewise.
2525 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
2527 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
2528 Don't set the data_offset twice.
2530 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
2532 * testsuite/Makefile.in: Regenerate.
2534 2009-12-03 Doug Kwan <dougkwan@google.com>
2536 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
2537 (Target_arm::do_finalize_sections): Add parameter for symbol table
2538 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
2539 * i386.cc (Target_i386::do_finalize_sections): Add an additional
2540 parameter for symbol table pointer.
2541 * layout.cc (Layout::finalize): Call Target::finalize_sections with
2542 an additional parameter for a pointer to symbol table.
2543 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
2544 parameter for a symbol table pointer.
2545 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
2546 * target.h (Target::finalize_sections, Target::do_finalize_sections):
2548 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
2549 parameter for a symbol table pointer.
2551 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
2553 * incremental.cc (Incremental_inputs_header)
2554 (Incremental_inputs_header_write, Incremental_inputs_entry)
2555 (Incremental_inputs_entry_write): Move ...
2556 * incremental.h (Incremental_inputs_header)
2557 (Incremental_inputs_header_write, Incremental_inputs_entry)
2558 (Incremental_inputs_entry_write): here.
2560 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
2562 * incremental.cc (make_sized_incremental_binary): Set the target.
2563 Error if it is incompatible.
2564 * output.h (Output_file): Add filename method.
2566 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
2568 * incremental.cc (Incremental_inputs_entry): Remove unused argument
2569 from the get_* methods.
2571 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
2573 * incremental-dump.cc (main): Check that the offeset of a script is 0.
2574 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
2575 Write 0 for the data_offset of scripts.
2577 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
2579 * testsuite/Makefile.am: Add the incremental_test.sh test.
2580 * testsuite/incremental_test.sh: New.
2581 * testsuite/incremental_test_1.c: New.
2582 * testsuite/incremental_test_2.c: New.
2584 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
2586 * incremental-dump.cc (main): Fix typos.
2588 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
2591 * incremental-dump.cc (main): Use llu to print 64 bit values.
2593 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
2594 H.J. Lu <hongjiu.lu@intel.com>
2596 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
2598 (incremental_dump_LDADD): Likewise.
2599 * Makefile.in: Regenerated.
2601 2009-11-25 Doug Kwan <dougkwan@google.com>
2605 2009-11-25 Doug Kwan <dougkwan@google.com>
2607 * arm.cc (Target_arm::Target_arm): Move method definition
2608 outside of class definition. Add code to handle
2609 --target1-rel, --target1-abs and --target2= options.
2610 (Target_arm::get_reloc_reloc_type): Change method to be
2611 non-static and const.
2612 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
2613 New data member declaration.
2614 (Target_arm::Scan::local, Target_arm::Scan::global,
2615 Target_arm::Relocate::relocate,
2616 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2617 Adjust call to Target_arm::get_real_reloc_type.
2618 (Target_arm::get_real_reloc_type): Use command line options
2619 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
2620 * options.h (--target1-rel, --target1-abs, --target2): New
2623 2009-11-25 Doug Kwan <dougkwan@google.com>
2625 * arm.cc (Target_arm::Target_arm): Move method definition outside of
2626 class definition. Add code to handle --target1-rel, --target1-abs
2627 and --target2= options.
2628 (Target_arm::get_reloc_reloc_type): Change method to be non-static
2630 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
2632 (Target_arm::Scan::local, Target_arm::Scan::global,
2633 Target_arm::Relocate::relocate,
2634 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
2635 call to Target_arm::get_real_reloc_type.
2636 (Target_arm::get_real_reloc_type): Use command line options to
2637 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
2638 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
2641 2009-11-25 Doug Kwan <dougkwan@google.com>
2643 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
2644 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
2645 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
2647 (Arm_relocate_functions::thm_call): Replace body with a call to
2648 Arm_relocate_functions::thumb_branch_common.
2649 (Arm_relocate_functions::thm_jump24,
2650 Arm_relocate_functions::thm_xpc22): New method definitions.
2651 (Arm_relocate_functions::thumb_branch_common): New method definition.
2652 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
2654 (Target_arm::Relocate::relocate): Adjust call to thm_call.
2655 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
2657 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2659 * Makefile.am: Build incremental-dump
2660 * Makefile.in: Regenerate.
2661 * incremental-dump.cc: New.
2662 * incremental.cc (Incremental_inputs_header_data,
2663 Incremental_inputs_entry_data): Move to incremental.h
2664 * incremental.h: (Incremental_inputs_header_data,
2665 Incremental_inputs_entry_data): Move from incremental.cc
2667 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2669 * incremental.cc (Incremental_inputs_header,
2670 Incremental_inputs_header_write, Incremental_inputs_entry,
2671 Incremental_inputs_entry_write): Add a typedef with the data type.
2673 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
2675 * incremental.cc (Incremental_inputs_header,
2676 Incremental_inputs_header_write, Incremental_inputs_entry,
2677 Incremental_inputs_entry_write): Update comment about which
2678 type has the filed descriptions.
2680 2009-11-15 Doug Kwan <dougkwan@google.com>
2682 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
2683 (Arm_relocate_functions::arm_branch_common): Change method defintion
2684 in class definition to a method declaration and update list of formal
2686 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
2687 Arm_relocation_functions::jump24): Adjust call to
2688 Arm_relocate_functions::arm_branch_common. Update list of formal
2690 (Arm_relocate_functions::xpc25): New method definition.
2691 (Arm_relocate_functions::arm_branch_common): Move method defintion
2692 out from class definition. Use stubs for mode-switching and extending
2694 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
2695 specially. Change code to enable use of stubs in ARM branches.
2697 2009-11-10 Doug Kwan <dougkwan@google.com>
2699 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
2700 in method declaration.
2701 (Target_arm::relocate_stub): New method declaration.
2702 (Target_arm::default_target): Change to return a pointer instead of
2704 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
2705 Target_arm::default_target.
2706 (Arm_Relobj::do_relocate_sections): Remove options paramater in
2708 (Target_arm::relocate_section): Adjust view.
2709 (Target_arm::relocate_stub): New method definition.
2711 2009-11-10 Doug Kwan <dougkwan@google.com>
2713 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
2715 * incremental.cc (open_incremental_binary): Initialized local
2716 variables to avoid warnings.
2717 * object.cc (make_elf_object): Ditto.
2718 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
2721 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
2724 * testsuite/plugin_test.c: Include "config.h".
2726 2009-11-09 Doug Kwan <dougkwan@google.com>
2728 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
2729 (arm_symbol_value): Remove.
2730 (Arm_relocate_functions::arm_branch_common,
2731 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
2732 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
2733 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
2734 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
2735 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
2736 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
2737 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
2738 Arm_relocate_functions::thm_mobw_abs_nc,
2739 Arm_relocate_functions::thm_mov_abs,
2740 Arm_relocate_functions::movw_prel_nc,
2741 Arm_relocate_functions::thm_movt_abs,
2742 Arm_relocate_functions::movt_prel,
2743 Arm_relocate_functions::thm_movw_prel_nc,
2744 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
2745 (Target_arm::Relocate::relocate): Only decompose address into two
2746 parts if relocation type uses the thumb-bit and pass the actual
2747 bit instead of a flag indicating that the thumb-bit is used. Adjust
2748 calls to methods in Arm_relocate_functions for this change.
2750 2009-11-08 Ian Lance Taylor <iant@google.com>
2753 * reloc.cc: Instantiate
2754 Sized_relobj::initialize_input_to_output_maps and
2755 Sized_relobj:free_input_to_output_maps.
2757 2009-11-06 Ian Lance Taylor <iant@google.com>
2760 * defstd.cc (in_segment): Set only_if_ref true for "end".
2762 2009-11-06 Doug Kwan <dougkwan@google.com>
2764 * arm.cc (class Reloc_stub): Correct a comment.
2765 (Target_arm::Target_arm): Initialize arm_input_section_map_.
2766 (Target_arm::scan_section_for_stubs): New method declaration.
2767 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
2768 Change methods from private to protected.
2769 (Target_arm::do_may_relax): New method definition.
2770 (Target_arm::do_relax, Target_arm::group_sections,
2771 Target_arm::scan_reloc_for_stub,
2772 Target_arm::scan_reloc_section_for_stubs): New method declarations.
2773 (Target_arm::arm_input_section_map_): New data member declaration.
2774 (Target_arm::scan_reloc_for_stub,
2775 Target_arm::scan_reloc_section_for_stubs,
2776 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
2777 Target_arm::do_relax): New method definitions.
2779 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
2781 * configure.ac: Check for (struct stat)::st_mtim
2782 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
2783 * config.in: Regenerate.
2784 * configure: Regenerate.
2786 2009-11-05 Ian Lance Taylor <iant@google.com>
2789 * output.cc (Output_segment::add_output_section): Add missing
2792 2009-11-04 Ian Lance Taylor <iant@google.com>
2795 * object.h (class Object): Add is_needed and set_is_needed
2796 methods. Add is_needed_ field. Make bool fields into bitfields.
2797 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
2798 defined in a dynamic object and referenced by a regular object,
2799 set is_needed for the dynamic object.
2800 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
2801 if the file is marked with as_needed and it is not needed.
2803 2009-11-04 Ian Lance Taylor <iant@google.com>
2806 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
2807 tags if data is discarded by linker script.
2808 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2809 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2810 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2811 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2813 2009-11-04 Ian Lance Taylor <iant@google.com>
2815 * layout.cc (Layout::get_output_section): Add is_interp and
2816 is_dynamic_linker_section parameters. Change all callers.
2817 (Layout::choose_output_section): Likewise.
2818 (Layout::make_output_section): Likewise.
2819 (Layout::add_output_section_data): Add is_dynamic_linker_section
2820 parameter. Change all callers.
2821 * layout.h (class Layout): Update declarations.
2822 * output.h (class Output_section): Add is_interp, set_is_interp,
2823 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
2824 Add is_interp_, is_dynamic_linker_section_ fields. Change
2825 generate_code_fills_at_write_ to a bitfield.
2826 * output.cc (Output_section::Output_sections): Initialize new
2828 (Output_segment::add_output_section): Add do_sort parameter.
2831 2009-11-03 Ian Lance Taylor <iant@google.com>
2834 * options.h (class General_options): Add --warn-common.
2835 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
2836 merging two common symbols.
2837 (Symbol_table::should_override): Handle --warn-common when merging
2838 a common symbol with a defined symbol. Use report_resolve_problem
2839 for multiple definitions.
2840 (Symbol_table::report_resolve_problem): New function.
2841 * symtab.h (class Symbol_table): Declare report_resolve_problem.
2843 2009-11-03 Doug Kwan <dougkwan@google.com>
2845 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
2847 (Target_arm::stub_factory): New method definition.
2848 (Target_arm::new_arm_input_section,
2849 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
2850 Target_arm::reloc_uses_thumb_bit): New method declarations.
2851 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
2852 New type definitions.
2853 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
2854 member declarations.
2855 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
2856 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
2857 New method definitions.
2859 2009-11-03 Ian Lance Taylor <iant@google.com>
2861 * options.h (class General_options): Add --warn_constructors.
2863 2009-11-03 Ian Lance Taylor <iant@google.com>
2866 * defstd.cc (in_section): Add entries for __rel_iplt_start,
2867 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
2869 2009-11-03 Ian Lance Taylor <iant@google.com>
2872 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
2873 --msgid-bugs-address.
2874 (install-pdf): New target.
2875 (install-data_yes): Look up one directory to find mkinstalldirs.
2877 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
2879 * po/Make-in (.po.gmo): Don't generate .gmo files in source
2882 2009-10-30 Doug Kwan <dougkwan@google.com>
2884 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
2886 2009-10-30 Doug Kwan <dougkwan@google.com>
2888 * arm.cc (Stub_addend_reader): New struct template definition
2889 and partial specializations.
2890 (Stub_addend_reader::operator()): New method definition for a
2891 partially specialized template.
2893 2009-10-30 Doug Kwan <dougkwan@google.com>
2895 * arm.cc (Arm_relobj::processor_specific_flags): New method
2897 (Arm_relobj::do_read_symbols): New method declaration.
2898 (Arm_relobj::processor_specific_flags_): New data member declaration.
2899 (Arm_dynobj): New class definition.
2900 (Target_arm::do_finalize_sections): Add input_objects parameter.
2901 (Target_arm::do_adjust_elf_header): New method declaration.
2902 (Target_arm::are_eabi_versions_compatible,
2903 (Target_arm::merge_processor_specific_flags): New method declaration.
2904 (Target_arm::do_make_elf_object): New overloaded method definitions
2906 (Arm_relobj::do_read_symbols): New method definition.
2907 (Arm_dynobj::do_read_symbols): Ditto.
2908 (Target_arm::do_finalize_sections): Add input_objects parameters.
2909 Merge processor-specific flags from all input objects.
2910 (Target_arm::are_eabi_versions_compatible,
2911 Target_arm::merge_processor_specific_flags,
2912 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
2913 New method definitions.
2914 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
2915 Input_objects pointer type parameter.
2916 * layout.cc (Layout::finalize): Pass input objects to target's.
2917 finalize_sections function.
2918 * output.cc (Output_file_header::do_sized_write): Set ELF file
2919 header's processor-specific flags.
2920 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
2921 Input_objects pointer type parameter.
2922 * sparc.cc (Target_sparc::do_finalize_sections): Same.
2923 * target.h (Input_objects): New forward class declaration.
2924 (Target::processor_specific_flags,
2925 Target::are_processor_specific_flags_sect): New method definitions.
2926 (Target::finalize_sections): Add input_objects parameter.
2927 (Target::Target): Initialize processor_specific_flags_ and
2928 are_processor_specific_flags_set_.
2929 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
2931 (Target::set_processor_specific_flags): New method definition.
2932 (Target::processor_specific_flags_,
2933 Target::are_processor_specific_flags_set_): New data member
2935 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
2936 Input_objects pointer type parameter.
2938 2009-10-30 Doug Kwan <dougkwan@google.com>
2940 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2942 2009-10-28 Ian Lance Taylor <iant@google.com>
2944 * object.h (class Relobj): Drop options parameter from
2945 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
2946 do_scan_relocs, do_relocate. Change all callers.
2947 (class Sized_relobj): Drop options parameters from
2948 do_gc_process_relocs, do_scan_relocs, do_relocate,
2949 do_relocate_sections, relocate_sections, emit_relocs_scan,
2950 emit_relocs_scan_reltype. Change all callers.
2951 (struct Relocate_info): Remove options field and all references to
2953 * reloc.h (class Read_relocs): Remove options constructor
2954 parameter and options_ field. Change all callers.
2955 (class Gc_process_relocs, class Scan_relocs): Likewise.
2956 (class Relocate_task): Likewise.
2957 * target-reloc.h (scan_relocs): Remove options parameter. Change
2959 (scan_relocatable_relocs): Likewise.
2960 * target.h (class Sized_target): Remove options parameter from
2961 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
2963 * gc.h (gc_process_relocs): Remove options parameter. Change all
2965 * arm.cc: Update functions to remove options parameters.
2966 * i386.cc: Likewise.
2967 * powerpc.cc: Likewise.
2968 * sparc.cc: Likewise.
2969 * x86_64.cc: Likewise.
2970 * testsuite/testfile.cc: Likewise.
2972 2009-10-28 Doug Kwan <dougkwan@google.com>
2974 * arm.cc (Arm_relobj): New class definition.
2975 (Arm_relobj::scan_sections_for_stubs,
2976 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
2977 New method definitions.
2979 2009-10-28 Cary Coutant <ccoutant@google.com>
2981 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
2982 (Plugin::cleanup_done_): New member.
2983 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
2984 (Plugin_manager::cleanup_done_): Remove.
2985 (Plugin_manager::add_input_file): Edit error message.
2986 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
2987 (Plugin_manager::cleanup): Remove use of cleanup_done_.
2989 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
2991 * fileread.cc: (File_read::View::~View): Use the new
2992 data_ownership_ filed.
2993 (File_read::~File_read): Dispose the new whole_file_view_.
2994 (File_read::open): Mmap the whole file if needed.
2995 (File_read::open): Use whole_file_view_ instead of contents_.
2996 (File_read::find_view): Use whole_file_view_ if applicable.
2997 (File_read::do_read): Use whole_file_view_ instead of contents_.
2998 (File_read::make_view): Use whole_file_view_ instead of contents_,
2999 update File_read::View::View call.
3000 (File_read::find_or_make_view): Update File_read::View::View
3002 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
3004 (File_read::View::Data_ownership): New enum.
3005 (File_read::View::View): Replace bool mapped_ with Data_ownership
3007 (File_read::View::mapped_): Remove (replaced by data_ownership_).
3008 (File_read::View::data_ownership_): New field.
3009 (File_read::contents_): Remove (replaced by whole_file_view_).
3010 (File_read::whole_file_view_): New field.
3011 * options.h (class General_options): Add --keep-files-mapped.
3013 2009-10-27 Cary Coutant <ccoutant@google.com>
3015 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
3016 * testsuite/Makefile.am (plugin_test_5): New test case.
3017 * testsuite/Makefile.in: Regenerate.
3019 2009-10-25 Doug Kwan <dougkwan@google.com>
3021 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
3022 from private to protected to allow access by child class.
3023 (Sized_relobj::do_relocate_sections): New method declaration.
3024 (Sized_relobj::relocate_sections): Virtualize.
3025 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
3026 Sized_relobj::relocate_sections. Instantiate template explicitly
3027 for different target sizes and endianity.
3029 2009-10-24 Doug Kwan <dougkwan@google.com>
3031 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
3032 (Arm_input_section::as_arm_input_section): New method.
3033 (Arm_output_section): New class definition.
3034 (Arm_output_section::create_stub_group,
3035 Arm_output_section::group_sections): New method definitions.
3037 2009-10-22 Doug Kwan <dougkwan@google.com>
3039 * arm.cc (Arm_input_section): New class definition.
3040 (Arm_input_section::init, Arm_input_section:do_write,
3041 Arm_input_section::set_final_data_size,
3042 Arm_input_section::do_reset_address_and_file_offset): New method
3045 2009-10-21 Doug Kwan <dougkwan@google.com>
3047 * arm.cc (Stub_table, Arm_input_section): New forward class
3049 (Stub_table): New class defintion.
3050 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
3051 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
3052 New method definition.
3054 2009-10-21 Doug Kwan <dougkwan@google.com>
3056 * arm.cc: Update copyright comments.
3057 (Target_arm): New forward class template declaration.
3058 (Arm_address): New type.
3059 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
3060 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
3061 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
3063 (Insn_template): Same.
3064 (DEF_STUBS): New macro.
3065 (Stub_type): New enum type.
3066 (Stub_template): New class definition.
3069 (Stub_factory): Same.
3070 (Target_arm::Target_arm): Initialize may_use_blx_ and
3071 should_force_pic_veneer_.
3072 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
3073 Target_arm::should_force_pic_veneer,
3074 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
3075 Target_arm::using_thumb_only, Target_arm:;default_target): New
3077 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
3078 New data member declarations.
3079 (Insn_template::size, Insn_template::alignment): New method defintions.
3080 (Stub_template::Stub_template): New method definition.
3081 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
3082 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
3083 (Stub_factory::Stub_factory): New method definition.
3084 * gold.h (string_hash): New template.
3085 * output.h (Input_section_specifier::hash_value): Use
3087 (Input_section_specifier::string_hash): Remove.
3088 * stringpool.cc (Stringpool_template::string_hash): Use
3091 2009-10-20 Doug Kwan <dougkwan@google.com>
3093 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
3094 symbols of relaxed input sections.
3095 * output.h (Output_section::find_relaxed_input_section): Make
3098 2009-10-16 Doug Kwan <dougkwan@google.com>
3100 * dynobj.cc (Versions::Versions): Initialize version_script_.
3101 Only insert base version symbol definition for a shared object
3102 if version script defines any version versions.
3103 (Versions::define_base_version): New method definition.
3104 (Versions::add_def): Check that base version is not needed.
3105 (Versions::add_need): Define base version lazily.
3106 * dynobj.h (Versions::define_base_version): New method declaration.
3107 (Versions::needs_base_version_): New data member declaration.
3108 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
3109 (check_DATA): Add no_version_test.stdout.
3110 (libno_version_test.so, no_version_test.o no_version_test.stdout):
3112 * testsuite/Makefile.in: Regenerate.
3113 * testsuite/no_version_test.c: New file.
3114 * testsuite/no_version_test.sh: Ditto.
3116 2009-10-16 Doug Kwan <dougkwan@google.com>
3118 * expression.cc (class Segment_start_expression): New class definition.
3119 (Segment_start_expression::value): New method definition.
3120 (script_exp_function_segment_start): Return a new
3121 Segment_start_expression.
3122 * gold/script-c.h (script_saw_segment_start_expression): New function
3124 * script-sections.cc (Script_sections::Script_sections): Initialize
3125 SAW_SEGMENT_START_EXPRESSION_ to false.
3126 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
3127 and -Tbbs options to specify section addresses if given in
3128 command line and no SEGMENT_START expression is seen in a script.
3129 * script-sections.h (Script_sections::saw_segment_start_expression,
3130 Script_sections::set_saw_segment_start_expression): New method
3132 (Script_sections::saw_segment_start_expression_): New data member
3134 * script.cc (script_saw_segment_start_expression): New function.
3135 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
3136 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
3137 script_test_7.sh and script_test_8.sh.
3138 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
3139 script_test_8.stdout.
3140 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
3141 (script_test_6, script_test_6.stdout, script_test_7,
3142 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
3143 * Makefile.in: Regenerate.
3144 * testsuite/script_test_6.sh: New file.
3145 * testsuite/script_test_6.t: Same.
3146 * testsuite/script_test_7.sh: Same.
3147 * testsuite/script_test_7.t: Same.
3148 * testsuite/script_test_8.sh: Same.
3150 2009-10-16 Doug Kwan <dougkwan@google.com>
3152 * output.cc (Output_segment::set_section_list_address): Cast
3153 expressions to unsigned long long type to avoid format warnings.
3155 2009-10-15 Ian Lance Taylor <iant@google.com>
3157 * script.cc (Script_options::add_symbol_assignment): Always add a
3158 dot assignment to script_sections_.
3159 * script-sections.cc (Script_sections::add_dot_assignment):
3160 Initialize if necessary.
3162 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
3163 program headers with no load segment if there is a linker script.
3165 * layout.cc (Layout::set_segment_offsets): Align the file offset
3166 to the segment aligment for -N or -n with no load segment.
3167 * output.cc (Output_segment::add_output_section): Don't crash if
3168 the first section is a TLS section.
3169 (Output_segment::set_section_list_addresses): Print an error
3170 message if the address moves backward in a linker script.
3171 * script-sections.cc
3172 (Output_section_element_input::set_section_addresses): Don't
3173 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
3174 (Orphan_output_section::set_section_addresses): Likewise.
3176 2009-10-15 Doug Kwan <dougkwan@google.com>
3178 * layout.cc (Layout::finish_dynamic_section): Generate tags
3179 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
3180 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
3181 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
3183 2009-10-14 Ian Lance Taylor <iant@google.com>
3185 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
3187 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
3188 data_shdr fields of relinfo.
3189 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
3190 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
3191 R_386_TLS_LDO_32, adjust based on section flags.
3192 (Target_i386::Relocate::fix_up_ldo): Remove.
3194 2009-10-13 Ian Lance Taylor <iant@google.com>
3196 Add support for -pie.
3197 * options.h (class General_options): Add -pie and
3199 (General_options::output_is_position_independent): Test -pie.
3200 (General_options::output_is_executable): Return true if not shared
3201 and not relocatable.
3202 (General_options::output_is_pie): Remove.
3203 * options.cc (General_options::finalize): Reject incompatible uses
3205 * gold.cc (queue_middle_tasks): A -pie link is not static.
3206 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
3207 * symtab.cc (Symbol::final_value_is_known): Return false if
3208 output_is_position_independent.
3209 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
3210 output_is_position_independent.
3211 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
3212 output_is_position_independent.
3213 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
3214 output_is_position_independent.
3215 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
3217 (basic_pie_test.o, basic_pie_test): New targets.
3218 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
3219 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
3220 (two_file_pie_test): New target.
3221 * testsuite/Makefile.in: Rebuild.
3222 * README: Remove note saying that -pie is not supported.
3224 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
3226 * options.h (class General_options): Add -init and -fini.
3227 * layout.cc (Layout::finish_dynamic_section): Emit
3228 given init and fini functions.
3230 2009-10-13 Sriraman Tallam <tmsriram@google.com>
3232 * gc.h (gc_process_relocs): Check if icf is enabled using new
3234 * gold.cc (queue_initial_tasks): Likewise.
3235 (queue_middle_tasks): Likewise.
3236 * object.cc (do_layout): Likewise.
3237 * symtab.cc (is_section_folded): Likewise.
3238 * main.cc (main): Likewise.
3239 * reloc.cc (Read_relocs::run): Likewise.
3240 (Sized_relobj::do_scan_relocs): Likewise.
3241 * icf.cc (is_function_ctor_or_dtor): New function.
3242 (Icf::find_identical_sections): Check if function is ctor or dtor when
3244 * options.h (General_options::icf): Change option to be an enum.
3245 (Icf_status): New enum.
3246 (icf_enabled): New method.
3247 (icf_safe_folding): New method.
3248 (set_icf_status): New method.
3249 (icf_status_): New variable.
3250 * (options.cc) (General_options::finalize): Set icf_status_.
3251 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
3252 icf_test and icf_keep_unique_test to use the --icf enum flag.
3253 * testsuite/icf_safe_test.sh: New file.
3254 * testsuite/icf_safe_test.cc: New file.
3256 2009-10-12 Sriraman Tallam <tmsriram@google.com>
3258 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
3259 includes to gc.h and icf.h.
3260 * arm.cc: Include gc.h.
3261 * gold.cc: Likewise.
3262 * i386.cc: Likewise.
3263 * powerpc.cc: Likewise.
3264 * sparc.cc: Likewise.
3265 * x86_64.cc: Likewise.
3266 * gc.h: Include icf.h.
3268 2009-10-11 Ian Lance Taylor <iant@google.com>
3270 * plugin.cc: Include "gold.h" before other header files.
3272 2009-10-10 Chris Demetriou <cgd@google.com>
3274 * options.h (Input_file_argument::Input_file_type): New enum.
3275 (Input_file_argument::is_lib_): Replace with...
3276 (Input_file_argument::type_): New member.
3277 (Input_file_argument::Input_file_argument): Take Input_file_type
3278 'type' rather than boolean 'is_lib' as second argument.
3279 (Input_file_argument::is_lib): Use type_.
3280 (Input_file_argument::is_searched_file): New function.
3281 (Input_file_argument::may_need_search): Handle is_searched_file.
3282 * options.cc (General_options::parse_library): Support -l:filename.
3283 (General_options::parse_just_symbols): Update for Input_file_argument
3285 (Command_line::process): Likewise.
3286 * archive.cc (Archive::get_file_and_offset): Likewise.
3287 * plugin.cc (Plugin_manager::release_input_file): Likewise.
3288 * script.cc (read_script_file, script_add_file): Likewise.
3289 * fileread.cc (Input_file::Input_file): Likewise.
3290 (Input_file::will_search_for): Handle is_searched_file.
3291 (Input_file::open): Likewise.
3292 * readsyms.cc (Read_symbols::get_name): Likewise.
3293 * testsuite/Makefile.am (searched_file_test): New test.
3294 * testsuite/Makefile.in: Regenerate.
3295 * testsuite/searched_file_test.cc: New file.
3296 * testsuite/searched_file_test_lib.cc: New file.
3298 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3299 Ian Lance Taylor <iant@google.com>
3301 * descriptor.cc: Include <cstdio> and "binary-io.h".
3302 (Descriptors::open): Open the files in binary mode always.
3303 * script.cc (Lex::get_token): Treat \r as whitespace.
3305 2009-10-09 Ian Lance Taylor <iant@google.com>
3307 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
3309 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3310 Ian Lance Taylor <iant@google.com>
3312 * configure.ac: Check for readv function also.
3313 * fileread.cc (readv): Define if not HAVE_READV.
3314 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
3316 * config.in: Regenerate.
3317 * configure: Regenerate.
3319 2009-10-09 Doug Kwan <dougkwan@google.com>
3321 * layout.cc (Layout::make_output_section): Call target hook to make
3322 ordinary output section.
3323 (Layout::finalize): Adjust parameter list of call the
3324 Target::may_relax().
3325 * layout.h (class Layout::section_list): New method.
3326 * merge.h (Output_merge_base::entsize): Change visibility to public.
3327 (Output_merge_base::is_string, Output_merge_base::do_is_string):
3329 (Output_merge_string::do_is_string): New method.
3330 * object.cc (Sized_relobj::do_setup): renamed from
3331 Sized_relobj::set_up.
3332 * object.h (Sized_relobj::adjust_shndx,
3333 Sized_relobj::initializ_input_to_output_maps,
3334 Sized_relobj::free_input_to_output_maps): Change visibilities to
3336 (Sized_relobj::setup): Virtualize.
3337 (Sized_relobj::do_setup): New method declaration.
3338 (Sized_relobj::invalidate_section_offset,
3339 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
3340 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
3341 * options.cc (parse_int): New function.
3342 * options.h (parse_int): New declaration.
3343 (DEFINE_int): New macro.
3344 (stub_group_size): New option.
3345 * output.cc (Output_section::Output_section): Initialize memebers
3346 merge_section_map_, merge_section_by_properties_map_,
3347 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
3348 (Output_section::add_input_section): Handled deferred code-fill
3349 generation and remove an old comment.
3350 (Output_section::add_relaxed_input_section): New method definition.
3351 (Output_section::add_merge_input_section): Use merge section by
3352 properties map to speed to search. Update merge section maps
3354 (Output_section::build_relaxation_map): New method definition.
3355 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3357 (Output_section::relax_input_section): Renamed to
3358 Output_section::convert_input_sections_to_relaxed_sections and change
3359 interface to take a vector of pointers to relaxed sections.
3360 (Output_section::find_merge_section,
3361 Output_section::find_relaxed_input_section): New method definitions.
3362 (Output_section::is_input_address_mapped,
3363 Output_section::output_offset, Output_section::output_address):
3364 Use output section data maps to speed up searching.
3365 (Output_section::find_starting_output_address): Add comments.
3366 (Output_section::do_write,
3367 Output_section::write_to_postprocessing_buffer): Do code-fill
3368 generation as appropriate.
3369 (Output_section::get_input_sections): Invalidate relaxed input section
3371 (Output_section::restore_states): Adjust type of checkpoint .
3372 Invalidate relaxed input section map.
3373 * output.h (Output_merge_base): New class declaration.
3374 (Input_section_specifier): New class defintion.
3375 (class Output_relaxed_input_section) Change base class to
3376 Output_section_data_build.
3377 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
3378 base class initializer.
3379 (Output_section::add_relaxed_input_section): New method declaration.
3380 (Output_section::Input_section): Change visibility to protected.
3381 (Output_section::Input_section::relobj,
3382 Output_section::Input_section::shndx): Handle relaxed input sections.
3383 Output_section::input_sections) Change visibility to protected. Also
3384 define overload to return a non-const pointer.
3385 (Output_section::Merge_section_properties): New class defintion.
3386 (Output_section::Merge_section_by_properties_map,
3387 Output_section::Output_section_data_by_input_section_map,
3388 Output_section::Relaxation_map): New types.
3389 (Output_section::relax_input_section): Rename method to
3390 Output_section::convert_input_sections_to_relaxed_sections and change
3391 interface to take a vector of relaxed section pointers.
3392 (Output_section::find_merge_section,
3393 Output_section::find_relaxed_input_section,
3394 Output_section::build_relaxation_map,
3395 Output_section::convert_input_sections_in_list_to_relaxed_sections):
3396 New method declarations.
3397 (Output_section::merge_section_map_
3398 Output_section::merge_section_by_properties_map_,
3399 Output_section::relaxed_input_section_map_,
3400 Output_section::is_relaxed_input_section_map_valid_,
3401 Output_section::generate_code_fills_at_write_): New data members.
3402 * script-sections.cc
3403 (Output_section_element_input::set_section_addresses): Call
3404 current_data_size and addralign methods of relaxed input sections.
3405 (Orphan_output_section::set_section_addresses): Call current_data_size
3406 and addralign methods of relaxed input sections.
3407 * symtab.cc (Symbol_table::compute_final_value): Extract template
3408 from the body of Symbol_table::sized_finalize_symbol.
3409 (Symbol_table::sized_finalized_symbol): Call
3410 Symbol_table::compute_final_value.
3411 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
3412 (Symbol_table::compute_final_value): New templated method declaration.
3413 * target.cc (Target::do_make_output_section): New method defintion.
3414 * target.h (Target::make_output_section): New method declaration.
3415 (Target::relax): Add more parameters for input objects, symbol table
3416 and layout. Adjust call to do_relax.
3417 (Target::do_make_output_section): New method declaration.
3418 (Target::do_relax): Add parameters for input objects, symbol table
3421 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3423 * pread.c: Include stdio.h.
3425 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3427 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
3430 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3432 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3433 Change read_shndx type to unsigned int.
3434 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
3436 (Sized_dwarf_line_info::read_line_mappings): Likewise.
3437 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
3438 Change read_shndx type to unsigned int.
3439 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
3441 (Sized_dwarf_line_info::read_line_mappings): Likewise.
3442 * layout.cc (Layout::create_symtab_sections): Cast the result of
3443 local_symcount * symsize to off_t in the gold_assert.
3445 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3447 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
3448 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
3450 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
3451 (Arm_relocate_functions::thm_abs5): New function.
3452 (Arm_relocate_functions::abs12): New function.
3453 (Arm_relocate_functions::abs16): New function.
3454 (Arm_relocate_functions::base_abs): New function.
3455 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
3456 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
3457 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
3459 (Scan::global): Likewise.
3460 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
3461 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
3462 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
3463 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
3466 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3468 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
3469 (Arm_relocate_functions::movt_prel): New function.
3470 (Arm_relocate_functions::thm_movw_prel_nc): New function.
3471 (Arm_relocate_functions::thm_movt_prel): New function.
3472 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
3473 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
3474 (Scan::global, Relocate::relocate): Likewise.
3475 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3477 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
3479 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
3480 Incremental_checker.
3481 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
3483 (class Incremental_inputs_header): New class.
3484 (Incremental_inputs_header_writer): Edit comment.
3485 (Incremental_inputs_entry): New class.
3486 (Incremental_inputs_entry_writer): Edit comment.
3487 (Sized_incremental_binary::do_find_incremental_inputs_section):
3488 Add *strtab_shndx parameter, fill it.
3489 (Sized_incremental_binary::do_check_inputs): New method.
3490 (Incremental_checker::can_incrementally_link_output_file): Use
3491 Sized_incremental_binary::check_inputs.
3492 (Incremental_inputs::report_command_line): Save command line in
3495 (Incremental_binary::find_incremental_inputs_section): New
3497 (Incremental_binary::do_find_incremental_inputs_section): Add
3498 strtab_shndx parameter.
3499 (Incremental_binary::do_check_inputs): New pure virtual method.
3500 (Sized_incremental_binary::do_check_inputs): Declare.
3501 (Incremental_checker::Incremental_checker): Add incremental_inputs
3502 parameter, use it to initialize incremental_inputs_.
3503 (Incremental_checker::incremental_inputs_): New field.
3504 (Incremental_checker::command_line): New method.
3505 (Incremental_checker::inputs): New method.
3506 (Incremental_checker::command_line_): New field.
3508 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
3510 * incremental.cc: Include <cstdarg> and "target-select.h".
3511 (vexplain_no_incremental): New function.
3512 (explain_no_incremental): New function.
3513 (Incremental_binary::error): New method.
3514 (Sized_incremental_binary::do_find_incremental_inputs_section): New
3516 (make_sized_incremental_binary): New function.
3517 (open_incremental_binary): New function.
3518 (can_incrementally_link_file): Add checks if output is ELF and has
3520 * incremental.h: Include "elfcpp_file.h" and "output.h".
3521 (Incremental_binary): New class.
3522 (Sized_incremental_binary): New class.
3523 (open_incremental_binary): Declare.
3524 * object.cc (is_elf_object): Use
3525 elfcpp::Elf_recognizer::is_elf_file.
3526 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
3527 * output.h (Output_file::filesize): New method.
3529 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3531 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
3533 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
3534 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
3536 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
3538 (Arm_relocate_functions::movw_abs_nc): New function.
3539 (Arm_relocate_functions::movt_abs): New function.
3540 (Arm_relocate_functions::thm_movw_abs_nc): New function.
3541 (Arm_relocate_functions::thm_movt_abs): New function.
3542 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
3543 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
3544 (Scan::global): Likewise.
3545 (Relocate::relocate): Likewise.
3546 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3548 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3550 * arm.cc (Arm_relocate_functions::got_prel) New function.
3551 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
3552 (Relocate::relocate): Likewise.
3553 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
3555 2009-10-06 Ian Lance Taylor <iant@google.com>
3557 * options.h (class General_options): Define
3558 split_stack_adjust_size parameter.
3559 * object.h (class Object): Add uses_split_stack_ and
3560 has_no_split_stack_ fields. Add uses_split_stack and
3561 has_no_split_stack accessor functions. Declare
3562 handle_split_stack_section.
3563 (class Reloc_symbol_changes): Define.
3564 (class Sized_relobj): Define Function_offsets. Declare
3565 split_stack_adjust, split_stack_adjust_reltype, and
3567 * object.cc (Object::handle_split_stack_section): New function.
3568 (Sized_relobj::do_layout): Call handle_split_stack_section.
3569 * dynobj.cc (Sized_dynobj::do_layout): Call
3570 handle_split_stack_section.
3571 * reloc.cc (Sized_relobj::relocate_sections): Call
3572 split_stack_adjust for executable sections in split_stack
3573 objects. Pass reloc_map to relocate_section.
3574 (Sized_relobj::split_stack_adjust): New function.
3575 (Sized_relobj::split_stack_adjust_reltype): New function.
3576 (Sized_relobj::find_functions): New function.
3577 * target-reloc.h: Include "object.h".
3578 (relocate_section): Add reloc_symbol_changes parameter. Change
3580 * target.h (class Target): Add calls_non_split method. Declare
3581 do_calls_non_split virtual method. Declare match_view and
3583 * target.cc: Include "elfcpp.h".
3584 (Target::do_calls_non_split): New function.
3585 (Target::match_view): New function.
3586 (Target::set_view_to_nop): New function.
3587 * gold.cc (queue_middle_tasks): Give an error if mixing
3588 split-stack and non-split-stack objects with -r.
3589 * i386.cc (Target_i386::relocate_section): Add
3590 reloc_symbol_changes parameter.
3591 (Target_i386::do_calls_non_split): New function.
3592 * x86_64.cc (Target_x86_64::relocate_section): Add
3593 reloc_symbol_changes parameter.
3594 (Target_x86_64::do_calls_non_split): New function.
3595 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
3597 * powerpc.cc (Target_powerpc::relocate_section): Add
3598 reloc_symbol_changes parameter.
3599 * sparc.cc (Target_sparc::relocate_section): Add
3600 reloc_symbol_changes parameter.
3601 * configure.ac: Call AM_CONDITIONAL for the default target.
3602 * configure: Rebuild.
3603 * testsuite/Makefile.am (TEST_AS): New variable.
3604 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
3605 (check_DATA): Add split_i386 and split_x86_64 files.
3606 (SPLIT_DEFSYMS): Define.
3607 (split_i386_[1234n].o): New targets.
3608 (split_i386_[124]): New targets.
3609 (split_i386_[1234r].stdout): New targets.
3610 (split_x86_64_[1234n].o): New targets.
3611 (split_x86_64_[124]): New targets.
3612 (split_x86_64_[1234r].stdout): New targets.
3613 (MOSTLYCLEANFILES): Add new executables.
3614 * testsuite/split_i386.sh: New file.
3615 * testsuite/split_x86_64.sh: New file.
3616 * testsuite/split_i386_1.s: New file.
3617 * testsuite/split_i386_2.s: New file.
3618 * testsuite/split_i386_3.s: New file.
3619 * testsuite/split_i386_4.s: New file.
3620 * testsuite/split_i386_n.s: New file.
3621 * testsuite/split_x86_64_1.s: New file.
3622 * testsuite/split_x86_64_2.s: New file.
3623 * testsuite/split_x86_64_3.s: New file.
3624 * testsuite/split_x86_64_4.s: New file.
3625 * testsuite/split_x86_64_n.s: New file.
3626 * testsuite/testfile.cc (Target_test): Update relocation_section
3628 * testsuite/Makefile.in: Rebuild.
3630 2009-10-06 Ian Lance Taylor <iant@google.com>
3632 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
3633 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
3634 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
3635 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
3636 the address on ldo_addrs_.
3637 (Target_i386::Relocate::fix_up_ldo): New function.
3639 2009-10-06 Rafael Espindola <espindola@google.com>
3641 * plugin.cc (add_input_library): New.
3642 (Plugin::load): Add add_input_library to tv.
3643 (Plugin_manager::add_input_file): Add the is_lib argument.
3644 (add_input_file): Update call to Plugin_manager::add_input_file.
3645 (add_input_library): New.
3646 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
3648 2009-09-30 Doug Kwan <dougkwan@google.com>
3650 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
3651 symbol and call Symbol::may_need_copy_reloc to determine if
3652 a copy reloc is needed.
3653 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
3654 nocopyreloc is given in command line.
3655 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
3656 given in command line.
3657 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
3658 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
3659 of the removed Target_i386::may_need_copy_reloc.
3660 * options.h (copyreloc): New option with default value false.
3661 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
3662 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
3663 instead of the removed Target_powerpc::may_need_copy_reloc.
3664 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
3665 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
3666 instead of the removed Target_sparc::may_need_copy_reloc.
3667 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
3668 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
3669 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
3670 instead of the removed Target_x86_64::may_need_copy_reloc.
3672 2009-09-30 Ian Lance Taylor <iant@google.com>
3674 * object.h (class Object): Remove target_ field, and target,
3675 sized_target, and set_target methods.
3676 (Object::sized_target): Remove.
3677 (class Sized_relobj): Update declarations. Remove sized_target.
3678 * object.cc (Sized_relobj::setup): Remove target parameter.
3680 (Input_objects::add_object): Don't do anything with the target.
3681 (make_elf_sized_object): Add punconfigured parameter. Change all
3682 callers. Set or test parameter target.
3683 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
3685 * parameters.cc (Parameters::set_target): Change parameter type to
3687 (Parameters::default_target): Remove.
3688 (set_parameters_target): Change parameter type to be non-const.
3689 (parameters_force_valid_target): New function.
3690 (parameters_clear_target): New function.
3691 * parameters.h (class Parameters): Update declarations. Remove
3692 default_target method. Add sized_target and clear_target
3693 methods. Change target_ to be non-const.
3694 (set_parameters_target): Update declaration.
3695 (parameters_force_valid_target): Declare.
3696 (parameters_clear_target): Declare.
3697 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
3698 as NULL if we aren't searching.
3699 (Add_symbols::run): Don't check for compatible target.
3700 * fileread.cc (Input_file::open_binary): Call
3701 parameters_force_valid_target.
3702 * gold.cc (queue_middle_tasks): Likewise.
3703 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
3704 set_target on object.
3705 * dynobj.h (class Sized_dynobj): Update declarations.
3706 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
3707 make_elf_object returns NULL.
3708 (Archive::include_member): Don't check whether object target is
3710 * output.cc (Output_section::add_input_section): Get target from
3712 (Output_section::relax_input_section): Likewise.
3713 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
3715 (Sized_relobj::do_scan_relocs): Likewise.
3716 (Sized_relobj::relocate_sections): Likewise.
3717 * resolve.cc (Symbol_table::resolve): Likewise.
3718 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
3719 parameter. Change all callers.
3720 (Symbol_table::add_from_object): Get target from parameters.
3721 (Symbol_table::add_from_relobj): Don't check object target.
3722 (Symbol_table::add_from_dynobj): Likewise.
3723 (Symbol_table::define_special_symbol): Get target from
3725 * symtab.h (class Symbol_table): Update declaration.
3726 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
3727 parameter. Change all callers. Clear parameter target.
3728 (Binary_test): Test target here.
3729 * testsuite/object_unittest.cc (gold_testsuite): Remove
3730 target_test_pointer parameter. Change all callers.
3731 (Object_test): Test target here.
3733 2009-09-26 Ian Lance Taylor <iant@google.com>
3735 * testsuite/initpri1.c: Don't try to use constructor priorities if
3736 compiling with gcc before 4.3.
3738 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
3740 * testsuite/retain_symbols_file_test.sh (check_present): Change
3741 output file name to retain_symbols_file_test.stdout.
3742 (check_absent): Likewise.
3744 2009-09-18 Craig Silverstein <csilvers@google.com>
3746 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
3747 * options.cc: Include <cerrno> and <fstream>.
3748 (General_options::finalize): Parse -retain-symbols-file tag.
3749 * options.h: New flag.
3750 (General_options): New method should_retain_symbol, new
3751 variable symbols_to_retain.
3752 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
3753 should_retain_symbol map.
3754 * testsuite/Makefile.am (retain_symbols_file_test): New test.
3755 * testsuite/Makefile.in: Regenerate.
3756 * testsuite/retain_symbols_file_test.sh: New file.
3758 2009-09-18 Nick Clifton <nickc@redhat.com>
3760 * po/es.po: Updated Spanish translation.
3762 2009-09-17 Doug Kwan <dougkwan@google.com>
3764 * debug.h (DEBUG_RELAXATION): New constant.
3765 (DEBUG_ALL): Add DEBUG_RELAXATION.
3766 (debug_string_to_enum): Add relaxation debug option.
3768 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
3769 Layout::Relaxation_debug_check::read_sections,
3770 Layout::Relaxation_debug_check::read_sections): New method definitions.
3771 (Layout::Layout): Initialize data members
3772 record_output_section_data_from_scrips_,
3773 script_output_section_data_list_ and relaxation_debug_check_.
3774 (Layout::save_segments, Layout::restore_segments,
3775 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3776 Layout::relaxation_loop_body): New method definitions.
3777 (Layout::finalize): Support relaxation. Move section layout code to
3778 Layout::relaxation_loop_body.
3779 (Layout::set_asection_address_from_script): Move code for orphan
3780 section placement out.
3781 (Layout::place_orphan_sections_in_script): New method definition.
3782 * layout.h (Output_segment_headers, Output_file_header):
3783 New forward class declarations.
3784 (Layout::~Layout): Define.
3785 (Layout::new_output_section_data_from_script): New method definition.
3786 (Layout::place_orphan_sections_in_script): New method declaration.
3787 (Layout::Segment_states): New type declaration.
3788 (Layout::save_segments, Layout::restore_segments,
3789 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
3790 Layout::relaxation_loop_body): New method declarations.
3791 (Layout::Output_section_data_list): New type declaration.
3792 (Layout::Relaxation_debug_check): New class definition.
3793 (Layout::record_output_section_data_from_script_,
3794 Layout::script_output_section_data_list_, Layout::segment_states_,
3795 Layout::relaxation_debug_check_): New data members.
3796 * output.cc: (Output_section_headers::do_size): New method definition.
3797 (Output_section_headers::Output_section_headers): Move size
3798 computation to Output_section_headers::do_size.
3799 (Output_segment_headers::do_size): New method definition.
3800 (Output_file_header::Output_file_header): Move size computation to
3801 Output_file_header::do_size and call it.
3802 (Output_file_header::do_size): New method definition.
3803 (Output_data_group::Output_data_group): Adjust call to
3804 Output_section_data.
3805 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
3806 (Output_symtab_xindex::do_write): Add array bound check.
3807 (Output_section::Input_section::print_to_mapfile): Handle
3808 RELAXED_INPUT_SECTION_CODE.
3809 (Output_section::Output_section): Initialize data member checkpoint_.
3810 (Output_section::~Output_section): Delete checkpoint object pointed
3812 (Output_section::add_input_section): Always add an Input_section if
3814 (Output_section::add_merge_input_section): Add assert.
3815 (Output_section::relax_input_section): New method definition.
3816 (Output_section::set_final_data_size): Set load address to zero for
3817 an unallocated section.
3818 (Output_section::do_address_and_file_offset_have_reset_values):
3819 New method definition.
3820 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
3821 Handle relaxed input section.
3822 (Output_section::sort_attached_input_sections): Checkpoint input
3823 section list lazily.
3824 (Output_section::get_input_sections): Change type of input_sections to
3825 list of Simple_input_section pointers. Checkpoint input section list
3826 lazily. Also handle relaxed input sections.
3827 (Output_section::add_input_section_for_script): Take a reference to
3828 a Simple_input_section object instead of Relobj pointer and section
3829 index as parameter. Handle relaxed input sections.
3830 (Output_section::save_states, Output_section::restore_states): New
3832 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
3833 (Output_data::is_data_size_fixed): New method definition.
3834 (Output_data::reset_addresss_and_file_offset): Do not reset data size
3836 (Output_data::address_and_file_offset_have_reset_values): New method
3838 (Output_data::do_address_and_file_offset_have_reset_values): New method
3840 (Output_data::set_data_size): Check that data size is not fixed.
3841 (Output_data::fix_data_size): New method definition.
3842 (Output_data::is_data_size_fixed_): New data member.
3843 (Output_section_headers::set_final_data_size): New method definition.
3844 (Output_section_headers::do_size): New method declaration.
3845 (Output_segment_headers::set_final_data_size): New method definition.
3846 (Output_segment_headers::do_size): New method declaration.
3847 (Output_file_header::set_final_data_size)::New method definition.
3848 (Output_file_header::do_size)::New method declaration.
3849 (Output_section_data::Output_section_data): Add new parameter
3850 is_data_size_fixed and use it to fix data size.
3851 (Output_data_const::Output_data_const): Adjust call to base class
3852 constructor and fix data size.
3853 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
3854 base class constructor and fix data size.
3855 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
3856 base class constructor and fix data size.
3857 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
3858 class constructor and fix data size.
3859 (Output_data_group::set_final_data_size): New method definition.
3860 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
3861 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
3862 class constructor and fix data size.
3863 (Output_relaxed_input_section): New class definition.
3864 (Output_section::Simple_input_section): New class definition.
3865 (Output_section::get_input_sections): Adjust parameter list.
3866 (Output_section::add_input_section_for_script): Same.
3867 (Output_section::save_states, Output_section::restore_states,
3868 Output_section::do_address_and_file_offset_have_reset_values,
3869 (Output_section::Input_section::Input_section): Handle
3870 RELAXED_INPUT_SECTION_CODE. Add new overload for
3871 Output_relaxed_input_section.
3872 (Output_section::Input_section::is_input_section,
3873 Output_section::Input_section::set_output_section): Handle relaxed
3875 (Output_section::Input_section::is_relaxed_input_section,
3876 Output_section::Input_section::output_section_data,
3877 Output_section::Input_section::relaxed_input_section): New method
3879 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
3881 (Output_section::Input_section::u1_): Update comments.
3882 (Output_section::Input_section::u2_): Add new union member poris.
3883 (Output_section::Checkpoint_output_section): New classs definition.
3884 (Output_section::relax_input_section): New method declaration.
3885 (Output_section::checkpoint_): New data member.
3886 (Output_segment): Update comments.
3887 (Output_segment::Output_segment): Un-privatize copy constructor.
3888 (Output_segment::operator=): Un-privatize.
3889 * script-sections.cc (Output_section_element::Input_section_list):
3890 Change element type to Output_section::Simple_input_section.
3891 (Output_section_element_dot_assignment::set_section_addresses):
3892 Register output section data for relaxation clean up.
3893 (Output_data_exression::Output_data_expression): Adjust call to base
3894 constructor to fix data size.
3895 (Output_section_element_data::set_section_addresses): Register
3896 Output_data_expression object for relaxation clean up.
3897 (struct Input_section_info): Replace Relobj pointer and section index
3898 pair with Output_section::Simple_input_section and Convert struct to a
3900 (Input_section_sorter::operator()): Adjust access to
3901 Input_section_info data member to use accessors.
3902 (Output_section_element_input::set_section_addresses): Use layout
3903 parameter. Adjust code to use Output_section::Simple_input_section
3904 and Input_secction_info classes. Register filler for relaxation
3906 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
3907 and section index pair with Output_section::Simple_input_section
3908 class. Adjust code accordingly.
3909 (Phdrs_element::release_segment): New method definition.
3910 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
3912 (Script_sections::release_segments): New method definition.
3913 * gold/script-sections.h (Script_sections::release_segments): New
3915 * gold/target.h (Target::may_relax, Target::relax,
3916 Target::do_may_relax, Target::do_relax): New method definitions.
3918 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3920 * arm.cc (has_signed_unsigned_overflow): New function.
3921 (Arm_relocate_functions::abs8): New function.
3922 (Target_arm::Scan::local): Handle R_ARM_ABS8.
3923 (Target_arm::Scan::global): Likewise.
3924 (Target_arm::relocate::relocate): Likewise.
3925 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3928 2009-09-16 Cary Coutant <ccoutant@google.com>
3930 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
3931 * testsuite/Makefile.in: Regenerate.
3933 2009-09-11 Nick Clifton <nickc@redhat.com>
3935 * po/gold.pot: Updated by the Translation project.
3937 2009-09-08 Cary Coutant <ccoutant@google.com>
3939 * output.cc (Output_file::open): Add execute permission to empty file.
3940 * testsuite/Makefile.am (permission_test): New test.
3941 * testsuite/Makefile.in: Regenerate.
3943 2009-09-02 Ian Lance Taylor <iant@google.com>
3945 * output.cc (Output_file::resize): Call map_no_anonymous rather
3948 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
3950 * gold.cc: Include "incremental.h".
3951 (queue_initial_tasks): Call Incremental_checker methods.
3952 * incremental.cc: Include "output.h".
3953 (Incremental_checker::can_incrementally_link_output_file): New
3955 * incremental.h (Incremental_checker): New class.
3957 * output.cc (Output_file::open_for_modification): New method.
3958 (Output_file::map_anonymous): Changed return type to bool. Record
3960 (Output_file::map_no_anonymous): New method, broken out of map.
3961 (Output_file::map): Use map_no_anonymous and map_anonymous.
3962 * output.h (class Output_file): Update declarations.
3964 2009-08-24 Cary Coutant <ccoutant@google.com>
3966 * options.h (Command_line::Pre_options): New class.
3967 (Command_line::pre_options): New member.
3968 * options.cc (gold::options::ready_to_register): New variable.
3969 (One_option::register_option): Do nothing if not registering options.
3970 Assert if same short option registered twice.
3971 (General_options::General_options): Turn off option registration when
3973 (Command_line::Pre_options::Pre_options): New constructor.
3975 2009-08-24 Cary Coutant <ccoutant@google.com>
3977 * options.h (General_options::no_keep_memory): Remove incorrect
3980 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3982 * Makefile.am (am__skiplex, am__skipyacc): New.
3983 * Makefile.in: Regenerate.
3985 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3987 * Makefile.am (AM_CPPFLAGS): Renamed from ...
3988 (INCLUDES): ... this.
3989 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
3990 (AM_CPPFLAGS): Renamed from ...
3991 (INCLUDE): ... this.
3992 * Makefile.in, testsuite/Makefile.in: Regenerate.
3994 * Makefile.in: Regenerate.
3995 * aclocal.m4: Likewise.
3996 * config.in: Likewise.
3997 * configure: Likewise.
3998 * testsuite/Makefile.in: Likewise.
4000 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4001 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4002 * Makefile.in: Regenerate.
4003 * testsuite/Makefile.in: Regenerate.
4005 2009-08-19 Cary Coutant <ccoutant@google.com>
4007 * resolve.cc (Symbol_table::resolve): Don't complain about defined
4008 symbols in shared libraries overridden by hidden or internal symbols
4009 in the main program.
4011 2009-08-19 Chris Demetriou <cgd@google.com>
4013 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
4014 checking source file names in error messages.
4016 2009-08-18 Doug Kwan <dougkwan@google.com>
4018 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
4019 an elcpp::Ehdr as parameter. Adjust call to set_target.
4020 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
4021 an elfcpp::Ehdr as parameter.
4022 * object.cc (Object::set_target): Remove the version that looks up
4023 a target and sets it.
4024 (Sized_relobj::setup): Take a Target object instead of
4025 an elfcpp::Ehdr as parameter. Adjust call to set_target.
4026 (make_elf_sized_object): Find target and ask target to
4028 * object.h: (Object::set_target): Remove the version that looks up
4029 a target and sets it.
4030 (Sized_relobj::setup): Take a Target object instead of
4031 an elfcpp:Ehdr as parameter.
4032 * target.cc: Include dynobj.h.
4033 (Target::do_make_elf_object_implementation): New.
4034 (Target::do_make_elf_object): New.
4035 * target.h (Target::make_elf_object): New template declaration.
4036 (Target::do_make_elf_object): New method declarations.
4037 (Target::do_make_elf_object_implementation): New template declaration.
4039 2009-08-14 Ian Lance Taylor <iant@google.com>
4041 * gold.h (FUNCTION_NAME): Define.
4042 (gold_unreachable): Use FUNCTION_NAME.
4044 2009-08-12 Sriraman Tallam <tmsriram@google.com>
4046 * icf.cc (Icf::find_identical_sections): Issue a warning when a
4047 symbol in the --keep-unique list is not found.
4049 2009-08-12 Sriraman Tallam <tmsriram@google.com>
4051 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
4052 been maked as --keep-unique.
4053 (Icf::unfold_section): New function.
4054 * icf.h (Icf::unfold_section): New function.
4055 * options.h (General_options::keep_unique): New option.
4056 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
4057 * testsuite/Makefile.in: Regenerate.
4058 * testsuite/icf_keep_unique_test.sh: New file.
4059 * testsuite/icf_keep_unique_test.cc: New file.
4061 2009-08-12 Cary Coutant <ccoutant@google.com>
4064 * resolve.cc (Symbol_table::resolve): Check for references from
4065 dynamic objects to hidden and internal symbols.
4066 * testsuite/Makefile.am (hidden_test.sh): New test.
4067 * testsuite/Makefile.in: Regenerate.
4068 * testsuite/hidden_test.sh: New script.
4069 * testsuite/hidden_test_1.c: New test source.
4070 * testsuite/hidden_test_main.c: New test source.
4072 2009-08-11 Doug Kwan <dougkwan@google.com>
4074 * arm.cc: Update comments.
4075 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
4076 segment to locate the .ARM.exidx section if present.
4078 2009-08-09 Doug Kwan <dougkwan@google.com>
4080 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
4083 2009-08-07 Sriraman Tallam <tmsriram@google.com>
4084 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
4087 2009-08-06 Sriraman Tallam <tmsriram@google.com>
4089 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
4090 valid tls_segment only for non-debug-section relocations.
4091 * testsuite/Makefile.am: Add gc_tls_test.
4092 * testsuite/Makefile.in: Regenerate.
4093 * testsuite/gc_tls_test.cc: New file.
4094 * testsuite/gc_tls_test.sh: New file.
4096 2009-08-05 Sriraman Tallam <tmsriram@google.com>
4100 * Makefile.am (CCFILES): Add icf.cc.
4102 * Makefile.in: Regenerate.
4103 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
4104 * gc.h (gc_process_relocs): Populate lists used by icf to contain
4105 section, symbol and addend information for the relocs.
4106 * gold.cc (queue_middle_tasks): Call identical code folding.
4107 * gold.h: Add defines for multimap.
4108 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
4109 to the call of finalize_local_symbols.
4110 * main.cc (main): Create object of class Icf.
4111 * object.cc (Sized_relobj::do_layout): Allow this function to be
4112 called twice during icf.
4113 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
4114 to sections marked as identical by icf.
4115 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
4117 (Sized_relobj::do_section_entsize): New function.
4118 * object.h (Object::section_entsize): New function.
4119 (Object::do_section_entsize): New pure virtual function.
4120 (Relobj::finalize_local_symbols): Add new parameter.
4121 (Relobj::do_section_entsize): New function.
4122 * options.h (General_options::icf): New option.
4123 (General_options::icf_iterations): New option.
4124 (General_options::print_icf_sections): New option.
4125 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
4126 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
4127 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
4129 * symtab.cc (Symbol_table::is_section_folded): New function.
4130 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
4131 to sections marked as identical by icf.
4132 * symtab.h (Symbol_table::set_icf): New function.
4133 (Symbol_table::icf): New function.
4134 (Symbol_table::is_section_folded): New function.
4135 (Symbol_table::icf_): New data member.
4136 * target-reloc.h (relocate_section): Ignore sections folded by icf.
4137 * testsuite/Makefile.am: Add commands to build icf_test.
4138 * testsuite/Makefile.in: Regenerate.
4139 * testsuite/icf_test.sh: New file.
4140 * testsuite/icf_test.cc: New file.
4142 2009-07-24 Chris Demetriou <cgd@google.com>
4144 * layout.cc (is_compressible_debug_section): Fix incorrect
4145 comment about compressed section names.
4147 2009-07-20 Ian Lance Taylor <ian@airs.com>
4150 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
4152 2009-07-16 Ian Lance Taylor <iant@google.com>
4155 * layout.h: #include <map>.
4156 (class Kept_section): Change from struct to class. Add accessors
4157 and setters. Add section size to Comdat_group mapping. Change
4158 Comdat_group to std::map. Add is_comdat_ field. Add
4159 linkonce_size field in union.
4160 (class Layout): Update declaration of find_or_add_kept_section.
4161 Don't declare find_kept_object.
4162 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
4163 parameter. Add object, shndx, is_comdat, and is_group_name
4164 parameters. Change all callers. Adjust for new Kept_section.
4165 (Layout::find_kept_object): Remove.
4166 * object.cc (Sized_relobj::include_section_group): Update use of
4167 Kept_section. Rename secnum to shndx. Only record
4168 Kept_comdat_section if sections are the same size.
4169 (Sized_relobj::include_linkonce_section): Update use of
4170 Kept_section. Only record Kept_comdat_section if sections are the
4171 same size. Set size of linkonce section.
4172 (Sized_relobj::map_to_kept_section): Update call to
4173 get_kept_comdat_section.
4174 * object.h (class Sized_relobj): Rename fields in
4175 Kept_comdat_section to drop trailing underscores; change object
4176 field to Relobj*. Change Kept_comdat_section_table to store
4177 struct rather than pointer.
4178 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
4179 Add kept_object and kept_shndx parameters. Change all callers.
4180 (Sized_relobj::get_kept_comdat_section): Change return type to
4181 bool. Add kept_object and kept_shndx parameters. Change all
4183 * plugin.cc (Pluginobj::include_comdat_group): Update call to
4184 Layout::find_or_add_kept_section.
4186 2009-07-09 Ian Lance Taylor <iant@google.com>
4188 * merge.cc (Object_merge_map::initialize_input_to_output_map):
4189 Reserve space in the hash table.
4191 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
4193 * fileread.cc (File_read::get_mtime): New method.
4194 * fileread.h (Timespec): New structure.
4195 (File_read::get_mtime): New method.
4196 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
4197 Renamed from timestamp_nsec.
4198 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
4200 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
4202 (Incremental_inputs::report_archive): Save mtime; style fix.
4203 (Incremental_inputs::report_obejct): Save mtime; style fix.
4204 (Incremental_inputs::report_script): Save mtime; style fix.
4205 (Incremental_inputs::finalize_inputs): Style fix.
4206 (Incremental_inputs::finalize): Style fix.
4207 (Incremental_inputs::create_input_section_data): Store inputs
4209 * incremental.h (Incremental_inputs::report_script): Add mtime
4211 (Incremental_inputs::Input_info::Input_info): Intialize only one
4213 (Incremental_inputs::Input_info::archive): Move to nameless
4215 (Incremental_inputs::Input_info::obejct): Move to nameless union.
4216 (Incremental_inputs::Input_info::script): Move to nameless union.
4217 (Incremental_inputs::mtime): New field.
4218 * script.cc (read_input_script): Pass file mtime to
4220 * script.h (Script_info::inputs): Style fix.
4222 2009-07-01 Ian Lance Taylor <ian@airs.com>
4224 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
4227 2009-06-24 Ian Lance Taylor <iant@google.com>
4230 * layout.cc (Layout::choose_output_section): If we find an
4231 existing section, update the flags.
4232 (Layout::create_notes): New function, broken out of
4234 (Layout::finalize): Don't create note sections.
4235 (Layout::create_note): Don't crash if linker script discards
4237 (Layout::create_gold_note): Likewise.
4238 (Layout::create_build_id): Likewise. Don't set
4239 after_input_sections on the section.
4240 (Layout::create_executable_stack_info): Remove target parameter.
4242 * layout.h (class Layout): Declare create_notes. Update
4243 declaration of create_executable_stack_info.
4244 * gold.cc (queue_middle_tasks): Call create_notes.
4245 * output.cc (Output_section::update_flags_for_input_section): Move
4246 here from output.h. If SHF_ALLOC flag is newly set, mark address
4248 * output.h (Output_data::mark_address_invalid): New function.
4249 (class Output_section): Only declare, not define,
4250 update_flags_for_input_section. Remove set_flags.
4252 2009-06-24 Ian Lance Taylor <iant@google.com>
4254 * script-sections.cc (Output_section_definition::
4255 set_section_addresses): Rename shadowing local load_address to
4258 2009-06-24 Ian Lance Taylor <iant@google.com>
4261 * reloc.cc (relocate_sections): Skip empty relocation sections.
4263 2009-06-23 Ian Lance Taylor <iant@google.com>
4266 * layout.cc (Layout::create_note): Use choose_output_section
4267 rather than make_output_section.
4269 2009-06-23 Ian Lance Taylor <iant@google.com>
4272 * options.cc (General_options::parse_V): Set printed_version_.
4273 (General_options::General_options): Initialize printed_version_.
4274 * options.h (class General_options): Add printed_version_ field.
4275 * gold.cc (queue_initial_tasks): If there are no input files,
4276 don't give a fatal error if we printed the version information.
4277 (queue_middle_tasks): If using -r with a shared object, give a
4278 fatal error rather than an ordinary error.
4280 2009-06-23 Ian Lance Taylor <iant@google.com>
4283 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
4284 (Layout::make_output_section): Set have_stabstr_section_ if we see
4285 a .stab*str section.
4286 (Layout::finalize): Call link_stabs_sections.
4287 (Layout::link_stabs_sections): New file.
4288 * layout.h (class Layout): Add have_stabstr_section_ field.
4289 Declare link_stabs_sections.
4291 2009-06-23 Doug Kwan <dougkwan@google.com>
4293 * Makefile.am (libgold_a_LIBADD): New.
4294 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
4295 * Makefile.in: Regenerate.
4296 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
4297 * configure: Regenerate.
4298 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
4299 * fileread.cc: Include sys/state.h
4300 * gold.h: Declare memmem and strndup if found missing.
4301 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
4303 2009-06-23 Ian Lance Taylor <iant@google.com>
4305 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
4306 * configure: Rebuild.
4308 2009-06-23 Ian Lance Taylor <iant@google.com>
4311 * object.cc (Object::section_contents): Don't try to get a view if
4312 the section has length zero.
4313 (Object::handle_gnu_warning_section): If the section is empty, use
4314 the name of the section as the warning.
4316 2009-06-23 Ian Lance Taylor <iant@google.com>
4319 * stringpool.h (class Stringpool_template): Add optimize_ field.
4320 (Stringpool_template::set_optimize): New function.
4321 * stringpool.cc (Stringpool_template::Stringpool_template):
4322 Initialize optimize_ field.
4323 (Stringpool_template::set_string_offsets): Test local optimize
4324 fild rather than parameter.
4325 * layout.cc (Layout::Layout): Call set_optimize on the section
4328 2009-06-22 Ian Lance Taylor <iant@google.com>
4331 * yyscript.y: Parse TARGET.
4332 * script.cc (script_set_target): New function.
4333 * script-c.h (script_set_target): Declare.
4334 * options.cc (General_options::string_to_object_format): Rename
4335 from string_to_object_format in anonymous namespace. Change
4337 * options.h (class General_options): Declare
4338 string_to_object_format.
4340 2009-06-22 Ian Lance Taylor <iant@google.com>
4342 * script-sections.cc (Script_sections::create_segments): Don't put
4343 program headers in a PT_LOAD segment if -n or -N.
4345 2009-06-22 Ian Lance Taylor <iant@google.com>
4348 * options.h (class General_options): Add -z lazy and -z now. Sort
4349 -z options into alphabetical order.
4350 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
4352 2009-06-21 Ian Lance Taylor <iant@google.com>
4354 * layout.cc (Layout::make_output_section): Call
4355 Target::new_output_section.
4356 (Layout::attach_allocated_section_to_segment): Put large section
4357 sections in a separate load segment with the large segment flag
4359 (Layout::segment_precedes): Sort large data segments after other
4361 (align_file_offset): New static function.
4362 (Layout::set_segment_offsets): Use align_file_offset.
4363 * output.h (class Output_section): Add is_small_section_ and
4364 is_large_section_ fields.
4365 (Output_section::is_small_section): New function.
4366 (Output_section::set_is_small_section): New function.
4367 (Output_section::is_large_section): New function.
4368 (Output_section::set_is_large_section): New function.
4369 (Output_section::is_large_data_section): New function.
4370 (class Output_segment): Add is_large_data_segment_ field.
4371 (Output_segment::is_large_data_segment): New function.
4372 (Output_segment::set_is_large_data_segment): New function.
4373 * output.cc (Output_section::Output_section): Initialize new
4375 (Output_segment::Output_segment): Likewise.
4376 (Output_segment::add_output_section): Add assertion that large
4377 data sections always go in large data segments. Force small data
4378 sections to the end of the list of data sections. Force small BSS
4379 sections to the start of the list of BSS sections. For large BSS
4380 sections to the end of the list of BSS sections.
4381 * symtab.h (class Symbol): Declare is_common_shndx.
4382 (Symbol::is_defined): Check Symbol::is_common_shndx.
4383 (Symbol::is_common): Likewise.
4384 (class Symbol_table): Define enum Commons_section_type. Update
4385 declarations. Add small_commons_ and large_commons_ fields.
4386 * symtab.cc (Symbol::is_common_shndx): New function.
4387 (Symbol_table::Symbol_table): Initialize new fields.
4388 (Symbol_table::add_from_object): Put small and large common
4389 symbols in the right list.
4390 (Symbol_table::sized_finalized_symbol): Check
4391 Symbol::is_common_shndx.
4392 (Symbol_table::sized_write_globals): Likewise.
4393 * common.cc (Symbol_table::do_allocate_commons): Allocate new
4394 common symbol lists. Don't call do_allocate_commons_list if the
4396 (Symbol_table::do_allocate_commons_list): Remove is_tls
4397 parameter. Add comons_section_type parameter. Change all
4398 callers. Handle small and large common symbols.
4399 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
4400 Symbol::is_common_shndx.
4401 * resolve.cc (symbol_to_bits): Likewise.
4402 * target.h (Target::small_common_shndx): New function.
4403 (Target::small_common_section_flags): New function.
4404 (Target::large_common_shndx): New function.
4405 (Target::large_common_section_flags): New function.
4406 (Target::new_output_section): New function.
4407 (Target::Target_info): Add small_common_shndx, large_common_shndx,
4408 small_common_section_flags, and large_common_section_flags
4410 (Target::do_new_output_section): New virtual function.
4411 * arm.cc (Target_arm::arm_info): Initialize new fields.
4412 * i386.cc (Target_i386::i386_info): Likewise.
4413 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4415 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
4416 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4417 (Target_x86_64::do_new_output_section): New function.
4418 * configure.ac: Define conditional MCMODEL_MEDIUM.
4419 * testsuite/Makefile.am (check_PROGRAMS): Add large.
4420 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
4421 (large_LDFLAGS): Define.
4422 * testsuite/large.c: New file.
4423 * testsuite/testfile.cc (Target_test::test_target_info):
4424 Initialize new fields.
4425 * configure, testsuite/Makefile.in: Rebuild.
4427 2009-06-05 Doug Kwan <dougkwan@google.com>
4429 * Makefile.am (CCFILES): Add target.cc.
4430 * Makefile.in: Regenerate.
4431 * i386.cc (class Target_i386): Define new virtual method to
4432 override do_is_local_label_name in parent.
4433 * object.cc (Sized_relobj::do_count_local_symbols): Discard
4434 local symbols if --discard-locals or -X is given.
4435 * options.h (class General_options): Declare new options
4436 '--discard-locals' and '-X' for discarding locals.
4437 * target.h (class Target): Define new methods is_local_label_name.
4438 Declare new virtual method do_is_local_label_name.
4439 * target.cc: New file.
4440 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
4441 (check_SCRIPTS): Add discard_locals_test.sh.
4442 (check_DATA): Add discard_local_tests.syms.
4443 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
4444 (discard_local_tests.syms, discard_locals_test.o): New make rules.
4445 * testsuite/Makefile.in: Regenerate.
4446 * testsuite/discard_locals_test.c: New file.
4447 * testsuite/discard_locals_test.sh: Same.
4449 2009-06-05 Doug Kwan <dougkwan@google.com>
4451 * object.cc (Sized_relobj::Sized_relobj): Initialize
4452 discarded_eh_frame_shndx_ to -1U.
4453 (Sized_relobj::do_layout): Record index of a discard .eh_frame
4455 (Sized_relobj::do_count_local_symbols): Skip local symbols in
4456 a discarded .eh_frame section.
4457 (Sized_relobj::do_finalize_local_symbols): Ditto.
4458 * object.h (class Sized_relobj): Declare new member
4459 discarded_eh_frame_shndx_.
4460 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
4461 (local_labels_test.o, local_labels_test): New rules.
4462 * testsuite/Makefile.in: Regenerate.
4464 2009-06-04 Doug Kwan <dougkwan@google.com>
4466 * layout.cc (Layout::section_name_mapping): Add mapping for
4467 special ARM sections.
4469 2009-06-03 Doug Kwan <dougkwan@google.com>
4471 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
4472 (utils::has_overflow): Same.
4474 2009-06-03 Ian Lance Taylor <iant@google.com>
4476 * layout.cc (Layout::section_name_mapping): New array, replacing
4477 Layout::linkonce_mapping.
4478 (Layout::section_name_mapping_count): New variable, replacing
4479 Layout::linkonce_mapping_count.
4480 (Layout::linkonce_output_name): Remove.
4481 (Layout::output_section_name): Rewrite.
4482 * layout.h (class Layout): Rename Linkonce_mapping to
4483 Section_name_mapping, linkonce_mapping to section_name_mapping,
4484 linkonce_mapping_count to section_name_mapping_count. Don't
4485 declare linkonce_output_name.
4487 2009-06-03 Doug Kwan <dougkwan@google.com>
4489 * gold/arm.cc (namespace utils): New.
4490 (Target_arm::reloc_is_non_pic): Define new method.
4491 (class Arm_relocate_functions): New.
4492 (Target_arm::Relocate::relocate): Handle relocation types used by
4495 2009-06-03 Ian Lance Taylor <iant@google.com>
4497 * arm.cc (Target_arm::scan::global): Use || instead of |.
4499 2009-06-02 Doug Kwan <dougkwan@google.com>
4501 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
4502 issued_non_pic_error_.
4503 (class Target_arm::Scan): Declare new method check_non_pic.
4504 Define new method symbol_needs_plt_entry.
4505 Declare new data member issued_non_pic_error_.
4506 (class Target_arm::Relocate): Declare new method
4507 should_apply_static_reloc.
4508 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
4509 (Target_arm::Scan::check_non_pic): Define new method.
4510 (Target_arm::Scan::local): Handle a small subset of reloc types used
4512 (Target_arm::Scan::local): Same.
4513 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
4515 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
4517 * incremental.cc (Incremental_inputs::report_command_line): Filter
4518 out --incremental-* options.
4520 2009-05-29 Doug Kwan <dougkwan@google.com>
4522 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
4524 (class Target_arm): Update comment.
4525 (Target_arm::Target_arm): Initialize new data members GOT_,
4526 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
4527 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
4528 and Target_arm::rel_dyn_section.
4529 Declare new_enum Target_arm::Got_type.
4530 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
4532 Update commments for member do_dynsym_value.
4533 (Target_arm::got_size, Target_arm::plt_section,
4534 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
4535 new methods inside class defintion.
4536 (Target_arm::got_section): Define new method.
4537 (Target_arm::rel_dyn_section): Same.
4538 (Output_data_plt_arm): New template class.
4539 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
4540 (Output_data_plt_arm:do_adjust_output_section): Define new method.
4541 (Output_data_plt_arm::add_entry): Same.
4542 (Output_data_plt_arm::first_plt_entry): Define new
4543 static data member for PLT instruction template.
4544 (Output_data_plt_arm::plt_entry): Same.
4545 (Output_data_plt_arm::do_write): Define new method.
4546 (Target_arm::make_plt_entry): Same.
4547 (Target_arm::do_finalize_sections): Same.
4548 (Target_arm::do_dynsym_value): Same.
4550 2009-05-28 Doug Kwan <dougkwan@google.com>
4552 * Makefile.am (TARGETSOURCES): Add arm.cc.
4553 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
4554 * Makefile.in: Regenerate.
4556 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
4558 2009-05-26 Doug Kwan <dougkwan@google.com>
4560 * options.cc (General_options::parse_exclude_libs). Fix a comment.
4561 (General_options::check_excluded_libs): Strip off directories in
4562 archive name before matching like GNU ld does.
4563 * testsuite/Makefile.am (MOSTLYCLEANFILES,
4564 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
4565 (exclude_libs_test_LDFLAGS): Add linker option
4566 -Wl,--exclude-libs,libexclude_libs_test_3
4567 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
4568 an explicit archive without using -l.
4569 (alt/libexclude_libs_test_3.a): New make rule.
4570 * testsuite/Makefile.in: Regenerate.
4571 * testsuite/exclude_libs_test.c : Declare lib3_default().
4573 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
4574 * exclude_libs_test_3.c: New file.
4576 2009-05-26 Nick Clifton <nickc@redhat.com>
4578 * po/id.po: New Indonesian translation.
4579 * po/gold.pot: Updated template file.
4581 2009-05-22 Sriraman Tallam <tmsriram@google.com>
4583 * testsuite/Makefile.am: Add -ffunction-sections to compile
4584 gc_comdat_test files. Add -Wl,--gc-sections to build
4586 * testsuite/Makefile.in: Regenerate.
4587 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
4589 2009-05-21 Sriraman Tallam <tmsriram@google.com>
4591 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
4592 kept comdat section was garbage collected.
4593 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
4594 * testsuite/Makefile.in: Regenerate.
4595 * testsuite/gc_comdat_test.sh: New file.
4596 * testsuite/gc_comdat_test_1.cc: New file.
4597 * testsuite/gc_comdat_test_2.cc: New file.
4599 2009-05-19 Doug Kwan <dougkwan@google.com>
4601 * archive.cc (Archive::Archive): Move constructor from archive.h
4602 to here. Initialize no_export_.
4603 (Archive::get_elf_object_for_member): Set no_export flag of object.
4604 * archive.h (Archive::Archive): Move constructor body to
4606 (Archive::no_export): New method.
4607 (Archive::no_export_): New field.
4608 * object.h (Object::Object): Initialize no_export_ to false.
4609 (Object::no_export, Object::set_no_export): New methods.
4610 (Object::no_export_): New field.
4611 * options.cc (General_options::parse_exclude_libs): New method.
4612 (General_options::check_excluded_libs) Same.
4613 * options.h (exclude_libs): New option.
4614 (General_options::check_excluded_libs): New method declaration.
4615 (General_options::excluded_libs_): New field.
4616 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
4617 default or protected visibility if an object has no-export flag set.
4618 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
4619 (check_SCRIPTS): Add exclude_libs_test.sh.
4620 (check_DATA): Add exclude_libs_test.syms.
4621 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
4622 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
4623 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
4624 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
4625 (exclude_libs_test.syms, libexclude_libs_test_1.a,
4626 libexclude_libs_test_2.a): New rules.
4627 * testsuite/Makefile.in: Regenerate.
4628 * testsuite/exclude_libs_test.c: New file.
4629 * testsuite/exclude_libs_test.sh: Ditto.
4630 * testsuite/exclude_libs_test_1.c: Ditto.
4631 * testsuite/exclude_libs_test_2.c: Ditto.
4633 2009-05-15 Ian Lance Taylor <iant@google.com>
4635 * configure.ac: Check for declarations for cases where libiberty.h
4636 checks HAVE_DECL_xxx.
4637 * configure, config.in: Rebuild.
4639 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
4641 * gold.h (Incremental_argument_list): Remove (invalid) forward
4643 * incremental.cc (Incremental_inputs::report_achive): New method.
4644 (Incremental_inputs::report_object): New method.
4645 (Incremental_inputs::report_script): New method.
4646 (Incremental_inputs::finalize_inputs): New method.
4647 (Incremental_inputs::finalize): Call finalize_inputs().
4648 (Incremental_inputs::sized_create_incremental_inputs_section_data):
4649 Create inputs entries.
4650 * incremental.h (Incremental_input_type): New enum.
4651 (Incremental_inputs::Incremental_input): Initialize new fields.
4652 (Incremental_inputs::report_inputs): New method.
4653 (Incremental_inputs::report_achive): New method.
4654 (Incremental_inputs::report_object): New method.
4655 (Incremental_inputs::report_script): New method.
4656 (Incremental_inputs::finalize_inputs): New method.
4657 (Incremental_inputs::Input_info): New struct.
4658 (Incremental_inputs::Input_info_map): New typedef.
4659 (Incremental_inputs::lock_): New field.
4660 (Incremental_inputs::Inputs_): New field.
4661 (Incremental_inputs::Inputs_map): New field.
4662 * main.cc (main): Call Incremental_input::report_inputs.
4663 * options.h (Input_argument_list): Typedef moved from
4665 (Input_file_group::Files): Remove, use ::Input_argument_list.
4666 (Input_file_group::Input_argument_list): Remove, use
4667 ::Input_argument_list.
4668 * plugin.cc (Plugin_manager::add_input_file): Add error in
4670 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
4672 * script.cc (read_input_script): Call
4673 Incremental_input::report_script.
4674 * script.h (Script_info): New class.
4676 2009-04-27 Ian Lance Taylor <iant@google.com>
4678 * x86_64.cc (do_adjust_output_section): Set entsize to
4681 2009-04-23 Elliott Hughes <enh@google.com>
4683 * output.cc (Output_file::close): After short writes, continue
4684 writing from the correct offset in the buffer being written.
4686 2009-04-23 Chris Demetriou <cgd@google.com>
4688 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
4689 * configure: Regenerate.
4690 * config.in: Regenerate.
4691 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
4692 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
4694 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
4696 * incremental.cc (Incremental_inputs_header_data): Renamed from
4697 Incremental_input_header_data.
4698 (Incremental_inputs_header_data::data_size): New field.
4699 (Incremental_inputs_header_data::put_input_file_count): Renamed
4700 from input_file_count.
4701 (Incremental_inputs_header_data::put_command_line_offset): Renamed
4702 from command_line_offset.
4703 (Incremental_inputs_header_data::put_reserved): Renamed from
4705 (Incremental_inputs_entry_data): Renamed from
4706 Incremental_input_entry_data.
4707 (Incremental_inputs_entry_data::data_size): New field.
4708 (Incremental_inputs::report_command_line): New method.
4709 (Incremental_inputs::finalize): New method.
4710 (Incremental_inputs::create_incremental_inputs_data): New method.
4711 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
4712 * incremental.h: New file.
4713 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
4714 (Layout::finalize): Create incremental inputs section in
4716 (Layout::create_incremental_info_sections): New method.
4717 * layout.h (Layout::incremental_inputs): New method.
4718 (Layout::create_incremental_info_sections): New method.
4719 (Layout::incremental_inputs_): New field.
4720 * main.cc (main): Notify Incremental_input of the command line.
4722 2009-04-01 Ian Lance Taylor <iant@google.com>
4723 Mikolaj Zalewski <mikolajz@google.com>
4725 * gold.h (reserve_unordered_map): Define, three versions, one for
4726 each version of Unordered_map.
4727 * layout.cc (Layout::Layout): Remove options parameter. Add
4728 number_of_input_files parameter. Don't initialize options_.
4729 Initialize number_of_input_files_ and resized_signatures_. Move
4730 sections_are_attached_.
4731 (Layout::layout_group): Reserve space for group_signatures_.
4732 (Layout::find_or_add_kept_section): Change name parameter to be a
4733 reference. Resize signatures_ map when it gets large enough.
4734 (Layout::layout_eh_frame): Use parameters->options() instead of
4736 (Layout::make_output_section): Likewise.
4737 (Layout::attach_allocated_section_to_segment): Likewise.
4738 (Layout::finalize, Layout::create_executable_stack): Likewise.
4739 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
4740 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
4741 * layout.h (class Layout): Update declarations. Remove options_
4742 field. Add number_of_input_files_ and resized_signatures_
4743 fields. Move sections_are_attached_ field.
4744 * main.cc (main): Pass number of input files to Layout
4745 constructor. Don't pass options.
4747 2009-03-30 Ian Lance Taylor <iant@google.com>
4749 * ffsll.c (ffsll): Correct implementation.
4751 2009-03-27 Ian Lance Taylor <iant@google.com>
4753 * ffsll.c: New file.
4754 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
4755 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
4756 * ftruncate.c (ftruncate): Declare before definition.
4757 * mremap.c (mremap): Likewise.
4758 * pread.c (pread): Likewise.
4759 * configure, Makefile.in, config.in: Rebuild.
4761 * mremap.c: New file.
4762 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
4763 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
4764 (mremap): Declare if HAVE_MREMAP is not defined.
4765 * configure, Makefile.in, config.in: Rebuild.
4767 2009-03-27 Cary Coutant <ccoutant@google.com>
4769 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
4770 position independent.
4771 * sparc.cc (Target_sparc::check_non_pic): Likewise.
4772 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
4774 2009-03-24 Cary Coutant <ccoutant@google.com>
4776 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
4778 (needs_dynamic_reloc): Likewise.
4780 2009-03-24 Ian Lance Taylor <iant@google.com>
4782 * yyscript.y (file_cmd): Recognize EXTERN.
4783 (extern_name_list, extern_name_list_body): New nonterminals.
4784 * script.cc (script_add_extern): Define.
4785 * script-c.h (script_add_extern): Declare.
4787 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
4789 * object.cc (is_elf_object): Define.
4790 * object.h (is_elf_object): Declare.
4791 * archive.cc (Archive::get_elf_object_for_member): Call
4793 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
4795 2009-03-24 Elliott Hughes <enh@google.com>
4797 * output.cc (Output_file::map_anonymous): Define.
4798 (Output_file::map): Use map_anonymous. If the regular mmap fails,
4799 try an anonymous one. Report the size if the mmap fails.
4800 * output.h (class Output_file): Declare map_anonymous.
4802 2009-03-24 Ian Lance Taylor <iant@google.com>
4804 * target-select.cc (instantiate_target): Don't acquire the lock if
4805 the instantiated_target_ field has already been set.
4807 2009-03-23 Ian Lance Taylor <iant@google.com>
4809 * gold-threads.h (class Initialize_lock): Define.
4810 * gold-threads.cc (class Initialize_lock_once): Define.
4811 (initialize_lock_control): New static variable.
4812 (initialize_lock_pointer): New static variable.
4813 (initialize_lock_once): New static function.
4814 (Initialize_lock::Initialize_lock): Define.
4815 (Initialize_lock::initialize): Define.
4816 * target-select.h: Include "gold-threads.h".
4817 (class Target_selector): Add lock_ and initialize_lock_ fields.
4818 Don't define instantiate_target, just declare it.
4819 * target-select.cc (Target_selector::Target_selector): Initialize
4821 (Target_selector::instantiate_target): Define.
4822 * descriptors.h: Include "gold-threads.h".
4823 (class Descriptors): Add initialize_lock_ field.
4824 * descriptors.cc (Descriptors::Descriptors): Initialize new
4826 (Descriptors::open): Use initialize_lock_ field
4827 * errors.h (class Errors): Add initialize_lock_ field.
4828 * errors.cc (Errors::Errors): Initialize new field.
4829 (Errors::initialize_lock): Use initialize_lock_ field.
4830 * powerpc.cc (class Target_selector_powerpc): Remove
4831 instantiated_target_ field. In do_recognize call
4832 instantiate_target rather than do_instantiate_target. In
4833 do_instantiate_target just allocate a new target.
4834 * sparc.cc (class Target_selector_sparc): Likewise.
4836 * freebsd.h: New file.
4837 * i386.cc: Include "freebsd.h".
4838 (Target_i386): Derive from Target_freebsd rather than
4840 (Target_selector_i386): Derive from Target_selector_freebsd rather
4841 than Target_selector.
4842 * x86_64.cc: Include "freebsd.h".
4843 (Target_x86_64): Derive from Target_freebsd rather than
4845 (Target_selector_x86_64): Derive from Target_selector_freebsd
4846 rather than Target_selector.
4847 * target.h (class Target): Add adjust_elf_header and
4848 do_adjust_elf_header.
4849 * output.cc (Output_file_header:: do_sized_write): Call target
4850 adjust_elf_header routine.
4851 * configure.tgt: Set targ_osabi.
4852 * configure.ac: Define GOLD_DEFAULT_OSABI.
4853 * parameters.cc (Parameters::default_target): Pass
4854 GOLD_DEFAULT_OSABI to select_target.
4855 * target-select.h (class Target_selector): Make instantiate_target
4856 protected rather than private.
4857 * Makefile.am (HFILES): Add freebsd.h.
4858 * configure, Makefile.in, config.in: Rebuild.
4860 * merge.cc (do_add_input_section): Correct pend value. Change
4861 message about last entry not being null terminated from error to
4864 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
4866 * incremental.cc: New file.
4867 * Makefile.am (CCFILES): Add incremental.cc.
4868 * Makefile.in: Rebuild.
4870 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
4872 * layout.cc (Layout::output_section_name): Preserve names
4873 of '.note.' sections.
4875 2009-03-19 Ian Lance Taylor <iant@google.com>
4877 * descriptors.cc (Descriptors::open): Check that the options are
4878 valid before using them.
4880 2009-03-18 Ian Lance Taylor <iant@google.com>
4882 * script-sections.h: Include <list>.
4883 (class Script_sections): Change Sections_elements from std::vector
4884 to std::list. Typedef public Elements_iterator. Add
4885 orphan_section_placement_, data_segment_align_start_, and
4886 saw_data_segment_align_ fields. Remove data_segment_align_index_
4888 * script-sections.cc (class Orphan_section_placement): New class.
4889 (class Sections_element): Add virtual functions is_relro and
4890 orphan_section_init. Remove virtual function place_orphan_here.
4891 (class Output_section_definition): Add is_relro and
4892 orphan_section_init. Remove place_orphan_here.
4893 (class Orphan_output_section): Likewise.
4894 (Script_sections::Script_sections): Update for field changes.
4895 (Script_sections::data_segment_align): Set saw_data_segment_align_
4896 and data_segment_align_start_, not data_segment_align_index.
4897 (Script_sections::data_segment_relro_end): Check
4898 saw_data_segment_align_. Use data_segment_align_start_ rather
4899 than data_segment_align_index_.
4900 (Script_sections::place_orphan): Rewrite to use
4901 Orphan_section_placement.
4903 2009-03-17 Ian Lance Taylor <iant@google.com>
4905 * archive.cc (Archive::add_symbols): Check for a version attached
4906 to the symbol name in the archive map.
4907 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
4908 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
4909 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
4910 (ver_test_11.a): New target.
4911 * testsuite/Makefile.in: Rebuild.
4913 * configure.ac: Check for chsize and posix_fallocate. Replace
4915 * ftruncate.c: New file, from gnulib.
4916 * output.cc (posix_fallocate): Define dummy version if not
4917 HAVE_POSIX_FALLOCATE.
4918 (Output_file::map): Call posix_fallocate rather than lseek and
4920 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
4921 * configure, Makefile.in, config.in: Rebuild.
4923 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
4925 * layout.h (Layout::create_note): Add section_name parameter.
4926 * layout.cc (Layout::create_note): Likewise.
4927 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
4929 2009-03-17 Ian Lance Taylor <iant@google.com>
4931 * descriptors.cc: Include "options.h".
4932 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
4933 (Descriptors::open): Always use O_CLOEXEC when opening a new
4934 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
4935 then set FD_CLOEXEC.
4937 * sparc.cc (class Target_sparc): Add has_got_section.
4938 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
4939 make sure we have a GOT section.
4941 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
4942 (Target_sparc::Scan::local): Likewise.
4943 (Target_sparc::Scan::global): Likewise.
4944 (Target_sparc::Relocate::relocate): Likewise.
4945 (Target_sparc::Relocate::relocate_tls): Likewise.
4947 * symtab.cc (Symbol_table::define_default_version): New function,
4948 broken out of add_from_object.
4949 (Symbol_table::add_from_object): Call define_default_version.
4950 (Symbol_table::define_special_symbol): Add resolve_oldsym
4951 parameter. Change all callers. If the version for a symbol comes
4952 from a version script, resolve it with the symbol with the same
4953 name with no version. Also add the symbol without a version if
4955 (do_define_in_output_data): If resolving with oldsym, don't delete
4957 (do_define_in_output_segment): Likewise.
4958 (do_define_as_constant): Likewise.
4959 * symtab.h (class Symbol_table): Update declarations.
4961 2009-03-13 Ian Lance Taylor <iant@google.com>
4963 * readsyms.cc (Read_symbols::incompatible_warning): New function.
4964 (Read_symbols::requeue): New function.
4965 (Read_symbols::do_read_symbols): If make_elf_object fails because
4966 the target type is not configured, and the file was searched for,
4967 issue a warning and retry with the next directory.
4968 (Add_symbols::run): If the file has an incompatible format, and
4969 it was searched for, requeue the Read_symbols task. On error,
4971 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
4972 dirindex parameter to constructor. Change all callers. Declare
4973 incompatible_warning and requeue.
4974 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
4975 input_argument_ and input_group_ fields. Add them to
4976 constructor. Change all callers.
4977 (class Read_script): Add dirindex_ field. Add it to constructor.
4979 * archive.cc (Archive::setup): Remove input_objects parameter.
4981 (Archive::get_file_and_offset): Likewise.
4982 (Archive::read_all_symbols): Likewise.
4983 (Archive::read_symbols): Likewise.
4984 (Archive::get_elf_object_for_member): Remove input_objects
4985 parameter. Add punconfigured parameter. Change all callers.
4986 (Archive::add_symbols): Change return type to bool. Check return
4987 value of include_member.
4988 (Archive::include_all_members): Likewise.
4989 (Archive::include_member): Change return type to bool. Return
4990 false if first included object has incompatible target. Set
4991 included_member_ field.
4992 (Add_archive_symbols::run): If add_symbols returns false, requeue
4994 * archive.h (class Archive): Add included_member_ field.
4995 Initialize it in constructor. Add input_file and searched_for
4996 methods. Update declarations.
4997 (class Add_archive_symbols): Add dirpath_, dirindex_, and
4998 input_argument_ fields. Add them to constructor. Change all
5000 * script.cc: Include "target-select.h".
5001 (class Parser_closure): Add skip_on_incompatible_target_ and
5002 found_incompatible_target_ fields. Add
5003 skip_on_incompatible_target parameter to constructor. Change all
5004 callers. Add methods skip_on_incompatible_target,
5005 clear_skip_on_incompatible_target, found_incompatible_target, and
5006 set_found_incompatible_target.
5007 (read_input_script): Add dirindex parameter. Change all callers.
5008 If parser finds an incompatible target, requeue Read_symbols
5010 (script_set_symbol): Clear skip_on_incompatible_target in
5012 (script_add_assertion, script_parse_option): Likewise.
5013 (script_start_sections, script_add_phdr): Likewise.
5014 (script_check_output_format): New function.
5015 * script.h (read_input_script): Update declaration.
5016 * script-c.h (script_check_output_format): Declare.
5017 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
5018 (ignore_cmd): Remove OUTPUT_FORMAT.
5019 * fileread.cc (Input_file::Input_file): Add explicit this.
5020 (Input_file::will_search_for): New function.
5021 (Input_file::open): Add pindex parameter. Change all callers.
5022 * fileread.h (class Input_file): Add input_file_argument method.
5023 Declare will_search_for. Update declarations.
5024 * object.cc (make_elf_object): Add punconfigured parameter.
5026 * object.h (class Object): Make input_file public. Add
5027 searched_for method.
5028 (make_elf_object): Update declaration.
5029 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
5031 * dirsearch.h (class Dirsearch): Update declaration.
5032 * options.h (class General_options): Add --warn-search-mismatch.
5033 * parameters.cc (Parameters::is_compatible_target): New function.
5034 * parameters.h (class Parameters): Declare is_compatible_target.
5035 * workqueue.cc (Workqueue::add_blocker): New function.
5036 * workqueue.h (class Workqueue): Declare add_blocker.
5038 * fileread.cc (Input_file::open): Remove options parameter.
5040 (Input_file::open_binary): Likewise.
5041 * script.cc (read_input_script): Likewise.
5042 * readsyms.h (class Read_symbols): Remove options_ field. Remove
5043 options parameter from constructor. Change all callers.
5044 (class Read_script): Likewise.
5045 * fileread.h (class Input_file): Update declarations.
5046 * script.h (read_input_script): Update declaration.
5048 2009-03-10 Nick Clifton <nickc@redhat.com>
5050 * po/es.po: New Spanish translation.
5052 2009-03-06 Cary Coutant <ccoutant@google.com>
5054 * options.cc (parse_short_option): Keep dash_z from registering itself.
5056 2009-03-03 Ian Lance Taylor <iant@google.com>
5059 * target-reloc.h (relocate_section): Pass output_section to
5061 * i386.cc (Target_i386::should_apply_static_reloc): Add
5062 output_section parameter. Change all callers.
5063 (Target_i386::Relocate::relocate): Add output_section parameter.
5064 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
5065 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
5066 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
5067 * testsuite/two_file_shared.sh: New script.
5068 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
5069 (check_DATA): Add two_file_shared.dbg.
5070 (two_file_shared.dbg): New target.
5071 * testsuite/Makefile.in: Rebuild.
5073 2009-03-01 Ian Lance Taylor <iant@google.com>
5075 * configure.ac: Check for byteswap.h.
5076 * configure: Rebuild.
5077 * config.in: Rebuild.
5079 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
5081 * layout.cc (Layout::find_or_add_kept_section): New function.
5082 (Layout::add_comdat): Removed.
5083 * layout.h (struct Kept_section): Move out of class Layout.
5084 Remove trailing underscores from field names. Add group_sections
5085 field. Rename group_ field to is_group. Change all uses.
5086 (class Layout): Declare find_or_add_kept_section, not add_comdat.
5087 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
5088 comdat_groups_ field.
5089 (Sized_relobj::include_section_group): Use
5090 find_or_add_kept_section and Kept_section::group_sections.
5091 (Sized_relobj::include_linkonce_section): Likewise.
5092 * object.cc (class Sized_relobj): Don't define Comdat_group or
5093 Comdat_group_table. Remove find_comdat_group and
5094 add_comdat_group. Remove comdat_groups_ field.
5095 * plugin.cc (include_comdat_group): Use
5096 Layout::find_or_add_kept_section.
5098 2009-02-28 Ian Lance Taylor <iant@google.com>
5100 * README: --gc-sections and map files are now supported. Document
5101 some build requirements.
5104 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
5105 relocatable link set the value of the section symbol to zero.
5106 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
5107 relocatable link don't include the section address in the local
5110 2009-02-27 Ian Lance Taylor <iant@google.com>
5113 * options.h (class Search_directory): Add is_system_directory.
5114 (class General_options): Declare is_in_system_directory.
5115 * options.cc (get_relative_sysroot): Make static.
5116 (get_default_sysroot): Make static.
5117 (General_optoins::is_in_system_directory): New function.
5118 * fileread.cc (Input_file::is_in_system_directory): New function.
5119 * fileread.h (class Input_file): Declare is_in_system_directory.
5120 * object.h (class Object): Add is_in_system_directory.
5121 (class Input_objects): Remove system_library_directory_ field.
5122 * object.cc (Input_objects::add_object): Don't set
5123 system_library_directory_.
5124 (input_objects::found_in_system_library_directory): Remove.
5125 * symtab.cc (Symbol_table::write_globals): Remove input_objects
5126 parameter. Change all callers.
5127 (Symbol_table::sized_write_globals): Likewise.
5128 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
5129 Call Object::is_in_system_directory.
5130 * symtab.h (class Symbol_table): Update declarations.
5133 * descriptors.h (Open_descriptor): Add is_on_stack field.
5134 * descriptors.cc (Descriptors::open): If the descriptor is on the
5135 top of the stack, remove it. Initialize is_on_stack field.
5136 (Descriptors::release): Only add pod to stack if it is not on the
5138 (Descriptors::close_some_descriptor): Clear stack_next and
5142 * output.cc (Output_section::find_starting_output_address): Rename
5143 from starting_output_address; add PADDR parameter; change return
5145 * output.h (class Output_section): Declare
5146 find_starting_output_address instead of starting_output_address.
5147 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
5148 section symbol for which we can't find a merge section.
5151 * symtab.cc (Symbol_table::add_from_object): If the visibility is
5152 hidden or internal, force the symbol to be local.
5153 * resolve.cc (Symbol::override_visibility): Define.
5154 (Symbol::override_base): Use override_visibility.
5155 (Symbol_table::resolve): Likewise.
5156 (Symbol::override_base_with_special): Likewise.
5157 (Symbol_table::override_with_special): If the visibility is hidden
5158 or internal, force the symbol to be local.
5159 * symtab.h (class Symbol): Add set_visibility and
5160 override_visibility.
5161 * testsuite/ver_test_1.sh: New file.
5162 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
5163 (check_DATA): Add ver_test_1.syms.
5164 (ver_test_1.syms): New target.
5165 * testsuite/Makefile.in: Rebuild.
5167 2009-02-25 Cary Coutant <ccoutant@google.com>
5169 * layout.cc (Layout::choose_output_section): Don't rename sections
5170 when using a linker script that has a SECTIONS clause.
5171 * Makefile.in: Regenerate.
5173 * testsuite/Makefile.am (script_test_5.sh): New test case.
5174 * testsuite/Makefile.in: Regenerate.
5175 * testsuite/script_test_5.cc: New file.
5176 * testsuite/script_test_5.sh: New file.
5177 * testsuite/script_test_5.t: New file.
5179 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
5181 * archive.cc (Archive::include_member): Update calls to add_symbols.
5182 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
5183 the Layout argument.
5184 * dynobj.h (do_add_symbols): Add the Layout argument.
5185 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
5187 * object.h (Object::add_symbols): Add the Layout argument.
5188 (Object::do_add_symbols): Add the Layout argument.
5189 (Sized_relobj::do_add_symbols): Add the Layout argument.
5190 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
5191 Unify the two versions.
5192 (Add_plugin_symbols): Remove.
5193 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
5194 (Sized_pluginobj::do_add_symbols): Unify the two versions.
5195 (Add_plugin_symbols): Remove.
5196 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
5197 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
5198 (Add_symbols::run): Make it work with Pulginobj.
5200 2009-02-06 Ian Lance Taylor <iant@google.com>
5202 * object.cc (Sized_relobj::do_layout): Make info message start
5203 with lower case letter.
5205 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
5207 * binary.cc: Fix file comment.
5209 * options.h (enum Incremental_disposition): Define.
5210 (class General_options): Add new options: --incremental,
5211 --incremental_changed, --incremental_unchanged,
5212 --incremental_unknown. Add incremental_disposition_ and
5213 implicit_incremental_ fields.
5214 (General_options::incremental_disposition): New function.
5215 (class Position_dependent_options): Add incremental_disposition
5217 (Position_dependent_options::copy_from_options): Set incremental
5219 * options.cc (General_options::parse_incremental_changed): New
5221 (General_options::parse_incremental_unchanged): New function.
5222 (General_options::parse_incremental_unknown): New function.
5223 (General_options::General_options): Initialize new fields
5224 incremental_disposition_ and implicit_incremental_.
5225 (General_options::finalize): Check for uasge of --incremental-*
5226 without --incremental.
5228 2009-02-06 Chris Demetriou <cgd@google.com>
5230 * gold.h (gold_undefined_symbol): Change to take only a Symbol
5231 pointer and to report location as the file name associated with
5233 (gold_undefined_symbol_at_location): New function to replace the
5234 old gold_undefined_symbol functionality.
5235 * target-reloc.h (relocate_section): Update to use
5236 gold_undefined_symbol_at_location.
5237 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5238 Call gold_undefined_symbol function rather than gold_error.
5239 * errors.h (Errors::undefined_symbol): Take location as a
5240 string, rather than calculating it from a relocation.
5241 * errors.cc (Errors::fatal): Print "fatal error:" before the
5243 (Errors::error, Errors::error_at_location): Print "error: "
5244 before the formatted message.
5245 (Errors::undefined_symbol): Take location as a string, rather
5246 than calculating it from a relocation.
5247 (gold_undefined_symbol_at_location): New function akin to
5248 old gold_undefined_symbol, calculates location from relocation.
5249 (gold_undefined_symbol): Change to take only a Symbol pointer
5250 and to report location as the file name associated with the symbol.
5251 * testsuite/debug_msg.sh: Update for changed error messages.
5252 * testsuite/undef_symbol.sh: Likewise.
5254 2009-02-04 Duncan Sands <baldrick@free.fr>
5257 * reduced_debug_output.h
5258 (Output_reduced_debug_abbrev_section::failed): Use format for
5260 (Output_reduced_debug_info_section::faild): Likewise.
5262 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
5264 * script.cc (Lazy_demangler): New class.
5265 (Version_script_info::get_symbol_version_helper): Demangle a
5268 2009-01-29 Cary Coutant <ccoutant@google.com>
5270 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
5272 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
5274 2009-01-28 Ian Lance Taylor <iant@google.com>
5276 * version.cc (version_string): Bump to 1.9.
5278 * gold.h: Include <cstring> and <stdint.h>.
5279 * version.cc: Include <cstdio>.
5280 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
5282 * reduced_debug_output.cc (insert_into_vector): Rename from
5283 Insert_into_vector; change all callers. Use Swap_unaligned to
5284 avoid aliasing issue; remove union since it is unnecessary.
5286 2009-01-27 Sriraman Tallam <tmsriram@google.com>
5288 * Makefile.am (CCFILES): Add gc.cc.
5290 * Makefile.in: Regenerate.
5291 * gold.cc (Gc_runner): New class.
5292 (queue_initial_tasks): Call garbage collection related tasks
5293 when corresponding options are invoked.
5294 (queue_middle_gc_tasks): New function.
5295 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
5296 processed early before laying out sections during garbage collection.
5297 * gold.h (queue_middle_gc_tasks): New function.
5298 (is_prefix_of): Move from "layout.cc".
5299 * i386.cc (Target_i386::gc_process_relocs): New function.
5300 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
5301 * main.cc (main): Create object of class "Garbage_collection".
5302 * object.cc (Relobj::copy_symbols_data): New function.
5303 (Relobj::is_section_name_included): New function.
5304 (Sized_relobj::do_layout): Allow this function to be called twice
5305 during garbage collection and defer layout of section during the
5307 * object.h (Relobj::get_symbols_data): New function.
5308 (Relobj::is_section_name_included): New function.
5309 (Relobj::copy_symbols_data): New function.
5310 (Relobj::set_symbols_data): New function.
5311 (Relobj::get_relocs_data): New function.
5312 (Relobj::set_relocs_data): New function.
5313 (Relobj::is_output_section_offset_invalid): New pure virtual function.
5314 (Relobj::gc_process_relocs): New function.
5315 (Relobj::do_gc_process_relocs): New pure virtual function.
5316 (Relobj::sd_): New data member.
5317 (Sized_relobj::is_output_section_offset_invalid): New function.
5318 (Sized_relobj::do_gc_process_relocs): New function.
5319 * options.h (General_options::gc_sections): Modify to not be a no-op.
5320 (General_options::print_gc_sections): New option.
5321 * plugin.cc (Plugin_finish::run): Remove function call to
5322 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
5323 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
5324 * reloc.cc (Read_relocs::run): Add task to process relocs and
5325 determine unreferenced sections when doing garbage collection.
5326 (Gc_process_relocs): New class.
5327 (Sized_relobj::do_gc_process_relocs): New function.
5328 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
5329 sections that are garbage collected.
5330 * reloc.h (Gc_process_relocs): New class.
5331 * sparc.cc (Target_sparc::gc_process_relocs): New function.
5332 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
5333 symbols whose corresponding sections are garbage collected.
5334 (Symbol_table::Symbol_table): Add new parameter for the garbage
5336 (Symbol_table::gc_mark_undef_symbols): New function.
5337 (Symbol_table::gc_mark_symbol_for_shlib): New function.
5338 (Symbol_table::gc_mark_dyn_syms): New function.
5339 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
5341 (Symbol_table::add_from_object): Likewise.
5342 (Symbol_table::add_from_relobj): When building shared objects, do not
5343 treat externally visible symbols as garbage.
5344 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
5345 table information for static and relocatable links.
5346 * symtab.h (Symbol_table::set_gc): New function.
5347 (Symbol_table::gc): New function.
5348 (Symbol_table::gc_mark_undef_symbols): New function.
5349 (Symbol_table::gc_mark_symbol_for_shlib): New function.
5350 (Symbol_table::gc_mark_dyn_syms): New function.
5351 (Symbol_table::gc_): New data member.
5352 * target.h (Sized_target::gc_process_relocs): New pure virtual
5354 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
5355 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
5357 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
5359 * options.h (General_options::gc_sections): Define as a no-op for now.
5360 (General_options::no_keep_memory): Ditto.
5361 (General_options::Bshareable): Define.
5362 * options.cc (General_options::finalize): Honor -Bshareable.
5364 2009-01-20 Andreas Schwab <schwab@suse.de>
5366 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
5367 read the value in the contents, since we don't use it. Use the
5368 template endianness when writing.
5369 (Relocate::relocate): Use it for R_PPC_REL16_HA.
5371 2009-01-19 Andreas Schwab <schwab@suse.de>
5373 * configure.tgt (powerpc64-*): Fix targ_obj.
5375 2009-01-15 Ian Lance Taylor <iant@google.com>
5377 * object.cc (Sized_relobj::write_local_symbols): Don't write out
5378 local symbols when stripping all symbols.
5380 2009-01-14 Cary Coutant <ccoutant@google.com>
5382 * output.cc (Output_reloc): Add explicit instantiations.
5384 2009-01-14 Cary Coutant <ccoutant@google.com>
5386 * archive.cc (Archive::get_elf_object_for_member): Remove call
5387 to File_read::claim_for_plugin.
5388 * descriptors.cc (Descriptors::open): Remove reference to
5390 (Descriptors::claim_for_plugin): Remove.
5391 * descriptors.h (Descriptors::claim_for_plugin): Remove.
5392 (Descriptors::is_claimed): Remove.
5393 (claim_descriptor_for_plugin): Remove.
5394 * fileread.cc (File_read::claim_for_plugin): Remove.
5395 * fileread.h (File_read::claim_for_plugin): Remove.
5396 (File_read::descriptor): Reopen descriptor if necessary.
5397 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
5398 (Plugin_manager::all_symbols_read): Add task parameter. Change
5400 (Plugin_manager::get_input_file): New function.
5401 (Plugin_manager::release_input_file): New function.
5402 (Pluginobj::Pluginobj): Add filesize parameter and initialize
5403 corresponding data member.
5404 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
5405 and pass to base constructor. Change all callers.
5406 (get_input_file, release_input_file): New functions.
5407 (make_sized_plugin_object): Add filesize parameter. Change all callers.
5408 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
5409 (Plugin_manager::all_symbols_read): Add task parameter.
5410 (Plugin_manager::get_input_file): New function.
5411 (Plugin_manager::release_input_file): New function.
5412 (Plugin_manager::task_): New data member.
5413 (Pluginobj::Pluginobj): Add filesize parameter.
5414 (Pluginobj::filename): New function.
5415 (Pluginobj::descriptor): New function.
5416 (Pluginobj::filesize): New function.
5417 (Pluginobj::filesize_): New data member.
5418 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
5419 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
5420 File_read::claim_for_plugin; use Object::unlock to unlock the file.
5422 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
5423 with archive libraries.
5424 * testsuite/Makefile.in: Regenerate.
5425 * testsuite/plugin_test.c (struct sym_info): New type.
5426 (get_input_file, release_input_file): New static variables.
5427 (onload): Capture new transfer vector entries.
5428 (claim_file_hook): Stop reading at end of file according to filesize.
5429 Factor out parsing of readelf output into separate function.
5430 (all_symbols_read_hook): Exercise get_input_file and release_input_file
5431 APIs and get the source file name from the symbol table. Convert
5432 source file name to corresponding object file name. Print info
5433 message when adding new input files.
5434 (parse_readelf_line): New function.
5435 * testsuite/plugin_test_1.sh: Add checks for new info messages.
5436 * testsuite/plugin_test_2.sh: Likewise.
5437 * testsuite/plugin_test_3.sh: Likewise.
5438 * testsuite/plugin_test_4.sh: New test case.
5440 2009-01-07 Ian Lance Taylor <iant@google.com>
5442 * version.cc (version_string): Bump to 1.8.
5444 2008-12-23 Cary Coutant <ccoutant@google.com>
5446 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
5447 * plugin.cc (Plugin_manager::finish): Rename as
5448 layout_deferred_objects. Move cleanup to separate function.
5449 (Plugin_manager::cleanup): New function.
5450 (Plugin_finish::run): Call layout_deferred_objects and cleanup
5452 * plugin.h (Plugin_manager::finish): Rename as
5453 layout_deferred_objects.
5454 (Plugin_manager::cleanup): New function.
5455 (Plugin_manager::cleanup_done): New field.
5457 2008-12-23 Cary Coutant <ccoutant@google.com>
5459 * plugin.cc (is_visible_from_outside): New function.
5460 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
5461 so we don't return "IR only" status for exported symbols or -r links.
5463 * testsuite/Makefile.am (plugin_test_3): New test case.
5464 * testsuite/Makefile.in: Regenerate.
5465 * testsuite/plugin_test_3.sh: New file.
5467 2008-12-22 Cary Coutant <ccoutant@google.com>
5469 * object.cc (Sized_relobj::layout_section): New function.
5470 (Sized_relobj::do_layout): Defer layout of input sections until after
5471 plugin has provided replacement files.
5472 (Sized_relobj::do_layout_deferred_sections): New function.
5473 * object.h (Relobj::set_section_offset): Remove virtual keyword.
5474 (Relobj::layout_deferred_sections): New function.
5475 (Relobj::do_layout_deferred_sections): New function.
5476 (Sized_relobj::do_layout_deferred_sections): New function.
5477 (Sized_relobj::layout_section): New function.
5478 (Sized_relobj::Deferred_layout): New structure.
5479 (Sized_relobj::deferred_layout_): New field.
5480 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
5481 Change all callers. Layout deferred sections.
5482 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
5484 (Plugin_hook::run): Move code from do_plugin_hook inline.
5485 (Plugin_hook::do_plugin_hook): Remove.
5486 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
5487 (Plugin_manager::finish): Renamed, was cleanup.
5488 (Plugin_manager::should_defer_layout): New function.
5489 (Plugin_manager::add_deferred_layout_object): New function.
5490 (Plugin_manager::Deferred_layout_list): New type.
5491 (Plugin_manager::deferred_layout_objects_): New field.
5492 (Plugin_hook::do_plugin_hook): Remove.
5494 2008-12-17 Ian Lance Taylor <iant@google.com>
5496 * options.h (class General_options): Add --no case for
5499 2008-12-16 Cary Coutant <ccoutant@google.com>
5501 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
5503 (Plugin_manager::claim_file): Create plugin object even if
5504 plugin did not call the add_symbols callback.
5505 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
5506 asking for more symbols than were added.
5507 * testsuite/Makefile.am (plugin_test_1): Add test case with
5509 (empty.syms): New target.
5510 * testsuite/Makefile.in: Regenerate.
5511 * testsuite/plugin_test.c (claim_file_hook): Add new debug
5512 message. Don't call add_symbols if no globals.
5513 (all_symbols_read_hook): Don't provide replacement for empty
5516 2008-12-12 Ian Lance Taylor <iant@google.com>
5518 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
5519 r_type == 0 for a local symbol with r_sym == 0.
5520 (scan_relocatable_relocs): Pass r_sym to
5521 local_non_section_strategy.
5522 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
5525 * configure.ac: Update test for TLS descriptors: they are
5526 supported as of glibc 2.9.
5527 * configure: Rebuild.
5529 2008-12-11 Ian Lance Taylor <iant@google.com>
5532 * target-reloc.h (Default_scan_relocatable_relocs): For each
5533 function, map r_type == 0 to RELOC_DISCARD.
5535 2008-12-10 Cary Coutant <ccoutant@google.com>
5537 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
5538 object to override a kept COMDAT group from a plugin object.
5540 2008-12-09 Ian Lance Taylor <iant@google.com>
5543 * yyscript.y (file_cmd): Handle INPUT.
5545 * testsuite/initpri1.c: Change all declarations to be full
5546 prototypes by adding void, to avoid compiler warnings.
5548 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
5550 * options.cc (General_options::parse_plugin_opt): New.
5551 (General_options::add_plugin): The argument now is just the filename.
5552 (General_options::add_plugin_option): New.
5553 * options.h (plugin_opt): New.
5554 (add_plugin): Change argument name.
5555 (add_plugin_option): New.
5556 * plugin.cc (Plugin::load): Don't parse the plugin option.
5557 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
5558 (Plugin::add_option): New.
5559 (Plugin::args_): Change type.
5560 (Plugin::filename_): New.
5561 (Plugin_manager::add_plugin_option): New.
5562 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
5563 * testsuite/Makefile.in: Regenerate.
5565 2008-12-05 Cary Coutant <ccoutant@google.com>
5567 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
5568 Handle --strip-lto-sections option.
5569 * options.h (strip_lto_sections): New option.
5571 2008-12-01 Cary Coutant <ccoutant@google.com>
5573 * plugin.cc (ld_plugin_message): Change format parameter to const.
5574 Fix mismatch between new[] and delete.
5576 2008-11-14 Cary Coutant <ccoutant@google.com>
5578 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
5581 2008-11-05 Craig Silverstein <csilvers@google.com>
5583 * options.cc (General_options::parse_dynamic_list): New function.
5584 * options.h (General_options): New flags dynamic_list,
5585 dynamic_list_data, dynamic_list_cpp_new, and
5586 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
5587 (General_options::in_dynamic_list): New function.
5588 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
5589 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
5590 (Lex::can_continue_name): Likewise.
5592 (read_script_file): New parameter script_options.
5593 (read_dynamic_list): New function.
5594 (Script_options::define_dynamic_list): New function.
5595 (dynamic_list_keyword_parsecodes): New variable.
5596 (dynamic_list_keywords): New variable.
5597 * script.h (Script_options::define_dynamic_list): New function
5599 (read_dynamic_list): New function prototype.
5600 * symtab.cc (strprefix): New macro.
5601 (Symbol::should_add_dynsym_entry): Support dynamic_list,
5602 dynamic_list_data, dynamic_list_cpp_new, and
5603 dynamic_list_cpp_typeinfo.
5604 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
5605 (dynamic_list_expr): New rule.
5606 (dynamic_list_nodes): Likewise.
5607 (dynamic_list_node): Likewise.
5608 * testsuite/Makefile.am (dynamic_list): New test.
5609 * testsuite/Makefile.in: Regenerated.
5610 * testsuite/dynamic_list.t: New file.
5611 * testsuite/dynamic_list.sh: New file.
5613 2008-11-05 Craig Silverstein <csilvers@google.com>
5615 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
5616 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
5617 (t11_last): Likewise.
5618 * testsuite/ver_test_6.c (main): Likewise.
5620 2008-10-07 Cary Coutant <ccoutant@google.com>
5622 * options.c (General_options::finalize): Add check for -static and
5624 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
5627 2008-10-02 Cary Coutant <ccoutant@google.com>
5629 * plugin.cc (make_sized_plugin_object): Fix conditional
5630 compilation to work when not all targets are enabled.
5632 2008-09-29 Cary Coutant <ccoutant@google.com>
5634 * archive.cc (Archive::get_file_and_offset): Use filename instead
5635 of name to get library path.
5636 (Archive::include_member): Unlock external member of a thin archive.
5638 * testsuite/Makefile.am (TEST_AR): New variable.
5639 (thin_archive_test_1): New test.
5640 (thin_archive_test_2): New test.
5641 * testsuite/Makefile.in: Regenerate.
5642 * testsuite/thin_archive_main.cc: New file.
5643 * testsuite/thin_archive_test_1.cc: New file.
5644 * testsuite/thin_archive_test_2.cc: New file.
5645 * testsuite/thin_archive_test_3.cc: New file.
5646 * testsuite/thin_archive_test_4.cc: New file.
5648 2008-09-29 Cary Coutant <ccoutant@google.com>
5650 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
5651 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
5653 (Sized_relobj::do_finalize_local_symbols): Likewise.
5654 (Sized_relobj::map_to_kept_section): Likewise.
5655 * object.h (Sized_relobj::invalid_address): New constant.
5656 (Sized_relobj::do_output_section_offset): Check for invalid_address
5658 * output.cc (Output_reloc::local_section_offset): Use constant
5659 invalid_address instead of -1U.
5660 (Output_reloc::get_address): Likewise.
5661 (Output_section::output_address): Change -1U to -1ULL.
5662 * output.h (Output_reloc::invalid_address): New constant.
5663 * reloc.cc (Sized_relobj::write_sections): Use constant
5664 invalid_address instead of -1U.
5665 (Sized_relobj::relocate_sections): Likewise.
5666 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
5667 values for merge sections.
5668 * target-reloc.h (relocate_for_relocatable): Use constant
5669 invalid_address instead of -1U.
5671 2008-09-19 Cary Coutant <ccoutant@google.com>
5673 Add plugin functionality for link-time optimization (LTO).
5674 * configure.ac (plugins): Add --enable-plugins option.
5675 * configure: Regenerate.
5676 * config.in: Regenerate.
5677 * Makefile.am (LIBDL): New variable.
5678 (CCFILES): Add plugin.cc.
5679 (HFILES): Add plugin.h.
5680 (ldadd_var): Add LIBDL.
5681 * Makefile.in: Regenerate.
5683 * archive.cc: Include "plugin.h".
5684 (Archive::setup): Don't preread archive symbols when using a plugin.
5685 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
5686 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
5688 (Archive::include_member): Add symbols from plugin objects.
5689 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
5690 * descriptors.cc (Descriptors::open): Check for file descriptors
5691 abandoned by plugins.
5692 (Descriptors::claim_for_plugin): New function.
5693 * descriptors.h (Descriptors::claim_for_plugin): New function.
5694 (Open_descriptor::is_claimed): New field.
5695 (claim_descriptor_for_plugin): New function.
5696 * fileread.cc (File_read::claim_for_plugin): New function.
5697 * fileread.h (File_read::claim_for_plugin): New function.
5698 (File_read::descriptor): New function.
5699 * gold.cc: Include "plugin.h".
5700 (queue_initial_tasks): Add task to call plugin hooks for generating
5702 * main.cc: Include "plugin.h".
5703 (main): Load plugin libraries.
5704 * object.h (Pluginobj): Declare.
5705 (Object::pluginobj): New function.
5706 (Object::do_pluginobj): New function.
5707 (Object::set_target): New function.
5708 * options.cc: Include "plugin.h".
5709 (General_options::parse_plugin): New function.
5710 (General_options::General_options): Initialize plugins_ field.
5711 (General_options::add_plugin): New function.
5712 * options.h (Plugin_manager): Declare.
5713 (General_options): Add --plugin option.
5714 (General_options::has_plugins): New function.
5715 (General_options::plugins): New function.
5716 (General_options::add_plugin): New function.
5717 (General_options::plugins_): New field.
5718 * plugin.cc: New file.
5719 * plugin.h: New file.
5720 * readsyms.cc: Include "plugin.h".
5721 (Read_symbols::do_read_symbols): Check for archive before checking
5722 for ELF file. Call plugin hooks to claim files.
5723 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
5724 from a real object file; force override when processing replacement
5726 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
5727 (Symbol::init_base_object): Likewise.
5728 (Symbol::init_base_output_data): Likewise.
5729 (Symbol::init_base_output_segment): Likewise.
5730 (Symbol::init_base_constant): Likewise.
5731 (Symbol::init_base_undefined): Likewise.
5732 (Symbol::output_section): Assert that object is not a plugin.
5733 (Symbol_table::add_from_pluginobj): New function.
5734 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
5736 (Symbol_table::sized_write_globals): Likewise.
5737 (Symbol_table::add_from_pluginobj): Instantiate template.
5738 * symtab.h (Sized_pluginobj): Declare.
5739 (Symbol::in_real_elf): New function.
5740 (Symbol::set_in_real_elf): New function.
5741 (Symbol::in_real_elf_): New field.
5742 (Symbol_table::add_from_pluginobj): New function.
5744 * testsuite/Makefile.am (AM_CFLAGS): New variable.
5745 (LIBDL): New variable.
5747 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
5748 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
5749 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
5750 (MOSTLYCLEANFILES): Likewise.
5751 * testsuite/Makefile.in: Regenerate.
5752 * testsuite/plugin_test.c: New file.
5753 * testsuite/plugin_test_1.sh: New file.
5754 * testsuite/plugin_test_2.sh: New file.
5756 2008-09-16 Ian Lance Taylor <iant@google.com>
5758 * target-reloc.h (relocate_section): Check whether a symbol is
5759 defined by the ABI before reporting an undefined symbol error.
5760 * target.h (Target::is_defined_by_abi): Make parameter const.
5761 (Target::do_is_defined_by_abi): Likewise.
5762 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
5763 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
5764 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
5765 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
5766 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
5767 * testsuite/Makefile.in: Rebuild.
5769 * fileread.cc (make_view): Add casts to avoid warning.
5771 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
5773 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
5774 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5776 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
5778 * options.h (General_options::output_is_executable): New.
5779 (General_options::output_is_pie): New.
5780 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
5781 for shared libraries.
5782 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
5784 2008-09-11 Chris Demetriou <cgd@google.com>
5786 * options.h (origin): New -z option.
5787 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
5788 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
5791 2008-09-05 Cary Coutant <ccoutant@google.com>
5793 * fileread.cc (File_read::make_view): Add check for attempt to map
5796 2008-09-05 Cary Coutant <ccoutant@google.com>
5798 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
5799 explicit instantiations.
5801 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
5804 * options.cc (General_options::finalize): Allow undefined symbols
5805 in shlibs if linking -shared.
5808 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
5809 symbols as not needing a dynsym entry.
5811 2008-08-20 Craig Silverstein <csilvers@google.com>
5813 * fileread.cc (File_read::open): Do not lock the file unless it
5814 was successfully opened.
5816 2008-08-14 Cary Coutant <ccoutant@google.com>
5818 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
5819 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
5820 * testsuite/tls_test.cc (struct int128): 128-bit struct
5821 for testing TLS relocs with non-zero addend.
5822 (v12): New TLS variable.
5824 (t_last): Add check for v12.
5825 * testsuite/tls_test.h (t12): New function.
5826 * testsuite/tls_test_main.cc (thread_routine): Call new test.
5828 2008-08-13 Ian Lance Taylor <iant@google.com>
5830 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
5831 set tls_segment_ or relro_segment_.
5832 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
5834 * output.h (Output_section::clear_is_relro): New function.
5835 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
5836 sections specially even when output_data_ is empty.
5837 (Output_segment::maximum_alignment): When first section is relro,
5838 only force alignment for PT_LOAD segments.
5839 * script.cc (script_data_segment_align): New function.
5840 (script_data_segment_relro_end): New function.
5841 * script-c.h (script_data_segment_align): Declare.
5842 (script_data_segment_relro_end): Declare.
5843 * script-sections.h (class Script_sections): Declare
5844 data_segment_align and data_segment_relro_end. Add fields
5845 segment_align_index_ and saw_relro_end_.
5846 * script-sections.cc (class Sections_element): Add set_is_relro
5847 virtual function. Add new bool* parameter to place_orphan_here.
5848 Add get_output_section virtual function.
5849 (class Output_section_definition): Add set_is_relro. Add new
5850 bool* parameter to place_orphan_here. Add get_output_section.
5851 Add is_relro_ field.
5852 (Output_section_definition::Output_section_definition): Initialize
5853 evaluated_address_, evaluated_load_address, evaluated_addralign_,
5854 and is_relro_ fields.
5855 (Output_section_definition::place_orphan_here): Add is_relro
5857 (Output_section_definition::set_section_addresses): Set relro for
5859 (Output_section_definition::alternate_constraint): Likewise.
5860 (class Orphan_output_section): Add new bool* parameter to
5861 place_orphan_here. Add get_output_section.
5862 (Orphan_output_section::place_orphan_here): Add is_relro
5864 (Script_sections::Script_sections): Initialize
5865 data_segment_align_index_ and saw_relro_end_.
5866 (Script_sections::data_segment_align): New function.
5867 (Script_sections::data_segment_relro_end): New function.
5868 (Script_sections::place_orphan): Set or clear is_relro.
5869 (Script_sections::set_section_addresses): Force alignment of first
5871 * yyscript.y (exp): Call script_data_segment_align and
5872 script_data_segment_relro_end.
5873 * testsuite/relro_script_test.t: New file.
5874 * testsuite/relro_test.cc (using_script): Declare.
5875 (t1, t2): Test using_script.
5876 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
5877 (relro_script_test_SOURCES): Define.
5878 (relro_script_test_DEPENDENCIES): Define.
5879 (relro_script_test_LDFLAGS): Define.
5880 (relro_script_test_LDADD): Define.
5881 (relro_script_test.so): New target.
5882 * testsuite/Makefile.in: Rebuild.
5884 2008-08-06 Cary Coutant <ccoutant@google.com>
5886 * archive.cc (Archive::total_archives, Archive::total_members)
5887 (Archive::total_members_loaded): New variables.
5888 (Archive::setup): Add parameter. Add option to preread
5890 (Archive::read_armap): Add counter.
5891 (Archive::get_file_and_offset): New function.
5892 (Archive::get_elf_object_for_member): New function.
5893 (Archive::read_all_symbols): New function.
5894 (Archive::read_symbols): New function.
5895 (Archive::add_symbols): Add counters.
5896 (Archive::include_all_members): Use armap to find members if it's
5898 (Archive::include_member): Skip reading symbols if already read.
5899 Factored code into Archive::get_file_and_offset and
5900 Archive::get_elf_object_for_member. Changed call to
5901 Mapfile::report_include_archive_member.
5902 (Archive::print_stats): New function.
5903 * archive.h: Declare Object and Read_symbols_data classes.
5904 (Archive::Archive): Add initializers for new members.
5905 (Archive::setup): Add parameter.
5906 (Archive::print_stats): New function.
5907 (Archive::total_archives, Archive::total_members)
5908 (Archive::total_members_loaded): New variables.
5909 (Archive::get_file_and_offset): New function.
5910 (Archive::get_elf_object_for_member): New function.
5911 (Archive::read_all_symbols): New function.
5912 (Archive::read_symbols): New function.
5913 (Archive::Archive_member): New class.
5914 (Archive::members_): New member.
5915 (Archive::num_members_): New member.
5916 * main.cc: Include archive.h.
5917 (main): Call Archive::print_stats.
5918 * mapfile.cc (Mapfile::report_include_archive_member): Delete
5919 archive parameter; member_name is now the fully-decorated name.
5920 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
5921 * options.h: (General_options): Add --preread-archive-symbols option.
5922 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
5925 2008-08-04 Ian Lance Taylor <iant@google.com>
5927 * symtab.h (Symbol::use_plt_offset): New function.
5928 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
5929 * powerpc.cc (Relocate::relocate): Likewise.
5930 * sparc.cc (Relocate::relocate): Likewise.
5931 * x86_64.cc (Relocate::relocate): Likewise.
5932 * testsuite/weak_plt.sh: New test.
5933 * testsuite/weak_plt_main.cc: New test.
5934 * testsuite/weak_plt_shared.cc: New test.
5935 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
5936 (check_PROGRAMS): Add weak_plt.
5937 (check_DATA): Add weak_plt_shared.so.
5938 (weak_plt_main_pic.o, weak_plt): New targets.
5939 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
5940 * testsuite/Makefile.in: Rebuild.
5942 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
5944 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
5945 * testsuite/Makefile.in: Rebuild.
5947 2008-08-04 Alan Modra <amodra@bigpond.net.au>
5949 * Makefile.am (POTFILES.in): Set LC_ALL=C.
5950 * Makefile.in: Regenerate.
5951 * po/POTFILES.in: Regenerate.
5953 2008-07-29 Ian Lance Taylor <iant@google.com>
5955 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
5956 symbols before other symbols.
5957 * testsuite/script_test_2.cc (test_addr): Declare.
5958 (test_addr_alias): Declare.
5959 (main): Check that test_addr and test_addr_alias have the right
5961 * testsuite/script_test_2.t: Define test_addr_alias and
5964 2008-07-24 Ian Lance Taylor <iant@google.com>
5967 * descriptors.cc: New file.
5968 * descriptors.h: New file.
5969 * gold-threads.h (class Hold_optional_lock): New class.
5970 * fileread.cc: Include "descriptors.h".
5971 (File_read::~File_read): Release descriptor rather than closing
5973 (File_read::open) [file]: Call open_descriptor rather than open.
5974 Set is_descriptor_opened_.
5975 (File_read::open) [memory]: Assert that descriptor is not open.
5976 (File_read::reopen_descriptor): New function.
5977 (File_read::release): Release descriptor.
5978 (File_read::do_read): Make non-const. Reopen descriptor.
5979 (File_read::read): Make non-const.
5980 (File_read::make_view): Reopen descriptor.
5981 (File_read::do_readv): Likewise.
5982 * fileread.h (class File_read): Add is_descriptor_opened_ field.
5983 Update declarations.
5984 * layout.cc: Include "descriptors.h".
5985 (Layout::create_build_id): Use open_descriptor rather than open.
5986 * output.cc: Include "descriptors.h".
5987 (Output_file::open): Use open_descriptor rather than open.
5988 * archive.cc (Archive::const_iterator): Change Archive to be
5990 (Archive::begin, Archive::end): Make non-const.
5991 (Archive::count_members): Likewise.
5992 * archive.h (class Archive): Update declarations.
5993 * object.h (Object::read): Make non-const.
5994 * Makefile.am (CCFILES): Add descriptors.cc.
5995 (HFILES): Add descriptors.h.
5996 * Makefile.in: Rebuild.
5999 * gold.h: Always include <clocale>. Add Solaris workarounds
6000 following code in binutils/sysdep.h.
6003 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
6004 this->eh_frame_hdr_ is NULL before using it.
6006 * dynobj.cc (Versions::Versions): Update comment.
6008 * dynobj.cc (Versions::Versions): If there is an soname, use it as
6009 the base version name.
6011 * stringpool.cc (Stringpool_template::add_with_length): Set key to
6012 array size plus one.
6013 (Stringpool_template::set_string_offsets): Subtract one from key
6014 before using it as an array index.
6015 (Stringpool_template::get_offset_with_length): Likewise.
6016 (Stringpool_template::write_to_buffer): Likewise.
6017 * stringpool.h (Stringpool_template::get_offset_from_key):
6020 2008-07-23 Ian Lance Taylor <iant@google.com>
6023 * object.h (Merged_symbol_value::value): Do our best to handle a
6027 * script.cc (Version_script_info::get_versions): Don't add empty
6028 version tag to return value.
6029 (Version_script_info::get_symbol_version_helper): Change return
6030 type to bool. Add pversion parameter. Change all callers.
6031 (script_register_vers_node): Don't require a non-NULL tag.
6032 * script.h (class Version_script_info): Update declarations.
6033 (Version_script_info::get_symbol_version): Change return type to
6034 bool. Add version parameter. Change all callers.
6035 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
6036 handling. Handle an empty version from a version script.
6037 (Symbol_table::define_special_symbol): Likewise.
6038 * testsuite/ver_test_10.script: New file.
6039 * testsuite/ver_test_10.sh: New file.
6040 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
6041 (check_DATA): Add ver_test_10.syms.
6042 (ver_test_10.syms, ver_test_10.so): New target.
6043 * testsuite/Makefile.in: Rebuild.
6045 2008-07-23 Simon Baldwin <simonb@google.com>
6047 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
6048 to zero for undefined symbols from dynamic libraries.
6050 2008-07-23 Ian Lance Taylor <iant@google.com>
6052 * symtab.cc (Symbol_table::resolve): Remove version parameter.
6054 * symtab.h (class Symbol_table): Update declaration.
6055 * testsuite/ver_test_9.cc: New file.
6056 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
6057 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
6058 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
6059 (ver_test_9.so, ver_test_9.o): New targets.
6060 * testsuite/Makefile.in: Rebuild.
6062 2008-07-22 Ian Lance Taylor <iant@google.com>
6064 * options.h (class General_options): Define --check-sections.
6065 * layout.cc (Layout::set_segment_offsets): Handle
6068 * options.h (class General_options): Define -n/--nmagic and
6070 * options.cc (General_options::finalize): For -n/--nmagic or
6071 -N/--omagic, set -static.
6072 * layout.cc (Layout::attach_allocated_section_to_segment): If
6073 -N/--omagic, don't put read-only and read-write sections in
6075 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
6076 finding a read-only segment.
6077 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
6078 don't set the minimum segment alignment to the common page size,
6079 and don't set the file offset to the address modulo the page size.
6080 * script-sections.cc (Script_sections::create_segments): If
6081 -n/--omagic, don't put read-only and read-write sections in
6084 * cref.cc: New file.
6086 * options.h (class General_options): Add --print-symbol-counts.
6087 * main.cc (main): Issue defined symbol report if requested.
6088 * archive.cc (Archive::interpret_header): Make into a const member
6090 (Archive::add_symbols): Call Input_objects::archive_start and
6092 (Archive::const_iterator): Define new class.
6093 (Archive::begin, Archive::end): New functions.
6094 (Archive::include_all_members): Rewrite to use iterator.
6095 (Archive::count_members): New function.
6096 * archive.h (class Archive): Update declarations.
6097 (Archive::filename): New function.
6098 * object.cc: Include "cref.h".
6099 (Sized_relobj::Sized_relobj): Initialize defined_count_.
6100 (Sized_relobj::do_get_global_symbol_counts): New function.
6101 (Input_objects::add_object): Add object to cross-referencer.
6102 (Input_objects::archive_start): New function.
6103 (Input_objects::archive_stop): New function.
6104 (Input_objects::print_symbol_counts): New function.
6105 * object.h: Declare Cref and Archive.
6106 (Object::get_global_symbol_counts): New function.
6107 (Object::do_get_global_symbol_counts): New pure virtual function.
6108 (class Sized_relobj): Add defined_count_ field. Update
6110 (class Input_objects): Add cref_ field. Update constructor.
6111 Update declarations.
6112 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
6114 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
6116 (Sized_dynobj::do_get_global_symbol_counts): New function.
6117 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
6118 defined_count_. Update declarations. Define Symbols typedef.
6119 * symtab.cc (Symbol_table::add_from_relobj): Add defined
6120 parameter. Change all callers.
6121 (Symbol_table::add_from_dynobj): Add sympointers and defined
6122 parameters. Change all callers.
6123 * symtab.h (class Symbol_table): Update declarations.
6124 * Makefile.am (CCFILES): Add cref.cc.
6125 (HFILES): Add cref.h.
6126 * Makefile.in: Rebuild.
6128 2008-07-22 Simon Baldwin <simonb@google.com>
6130 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
6131 to zero when writing undefined symbols.
6133 2008-07-22 Ian Lance Taylor <iant@google.com>
6135 * output.cc (Output_section::add_input_section): Don't try to
6136 merge empty merge sections.
6138 2008-07-21 Craig Silverstein <csilvers@google.com>
6140 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6141 Include symbol version in error message.
6143 2008-07-20 Chris Demetriou <cgd@google.com>
6145 * configure.ac (gold_cv_c_random_seed): New configured variable.
6146 (RANDOM_SEED_CFLAGS): New substituted variable.
6147 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
6148 * configure: Rebuild.
6149 * Makefile.in: Likewise.
6150 * testsuite/Makefile.in: Likewise.
6152 2008-07-18 Ian Lance Taylor <iant@google.com>
6154 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
6155 where we see NAME/NULL and NAME/VERSION as separate symbols.
6156 * testsuite/ver_test_main.cc (main): Call t4.
6157 (t4, t4_2a): Define.
6158 * testsuite/ver_test_2.cc (t4_2): Define.
6159 * testsuite/ver_test_2.script: Put t4_2a in VER2.
6160 * testsuite/ver_test_4.cc (t4_2a): Define.
6161 * testsuite/ver_test_4.script: Put t4_2a in VER2.
6162 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
6164 2008-07-17 Ian Lance Taylor <iant@google.com>
6166 * dynobj.cc (Versions::add_def): If we give an error about a
6167 missing version, go ahead and create the version anyhow.
6169 2008-07-10 Ian Lance Taylor <iant@google.com>
6171 Handle output sections with more than 0x7fffffff bytes.
6172 * object.h (class Relobj): Change map_to_output_ to
6173 output_sections_, and just keep a section pointer. Change all
6174 uses. Move comdat group support to Sized_relobj.
6175 (Relobj::is_section_specially_mapped): Remove.
6176 (Relobj::output_section): Remove poff parameter. Change all
6178 (Relobj::output_section_offset): New function.
6179 (Relobj::set_section_offset): Rewrite.
6180 (Relobj::map_to_output): Remove.
6181 (Relobj::output_sections): New function.
6182 (Relobj::do_output_section_offset): New pure virtual function.
6183 (Relobj::do_set_section_offset): Likewise.
6184 (class Sized_relobj): Add section_offsets_ field. Add comdat
6185 group support from Relobj. Update declarations.
6186 (Sized_relobj::get_output_section_offset): New function.
6187 (Sized_relobj::do_output_section_offset): New function.
6188 (Sized_relobj::do_set_section_offset): New function.
6189 * object.cc (Relobj::output_section_address): Remove.
6190 (Sized_relobj::Sized_relobj): Initialize new fields.
6191 (Sized_relobj::include_section_group): Cast find_kept_object to
6193 (Sized_relobj::include_linkonce_section): Likewise.
6194 (Sized_relobj::do_layout): Use separate arrays for output section
6196 (Sized_relobj::do_count_local_symbols): Change map_to_output to
6198 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
6199 output_sections and section_offsets.
6200 (Sized_relobj::write_local_symbols): Likewise.
6201 (map_to_kept_section): Compute output address directly.
6202 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
6203 output_sections and section_offsets.
6204 (Sized_relobj::write_sections): Likewise.
6205 (Sized_relobj::relocate_sections): Likewise.
6206 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
6207 * output.h (class Output_reloc): Update declarations. Change
6208 u2_.relobj to Sized_relobj*.
6209 (class Output_data_reloc): Change add functions to use
6211 * output.cc (Output_reloc::Output_reloc): Change relobj to
6213 (Output_reloc::local_section_offset): Change return type to
6214 Elf_Addr. Use get_output_section_offset.
6215 (Output_reloc::get_address): Likewise.
6216 (Output_section::is_input_address_mapped): Don't call
6217 is_section_specially_mapped.
6218 (Output_section::output_offset): Likewise.
6219 (Output_section::output_address): Likewise.
6220 (Output_section::starting_output_address): Likewise.
6221 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
6222 parameter to Sized_relobj*.
6223 (Copy_relocs::need_copy_reloc): Likewise.
6224 (Copy_relocs::save): Likewise.
6225 * copy-relocs.h (class Copy_relocs): Update declarations.
6226 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
6227 Sized_relobj*. Change relobj_ field to Sized_relobj*.
6228 * target-reloc.h (relocate_for_relocatable): Change
6229 offset_in_output_section type to Elf_Addr. Change code that uses
6231 * layout.cc (Layout::layout): Always set *off.
6232 * mapfile.cc (Mapfile::print_input_section): Use
6233 output_section_offset.
6234 * i386.cc (Target_i386::copy_reloc): Change object parameter to
6236 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
6237 * sparc.cc (Target_sparc::copy_reloc): Likewise.
6238 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
6240 2008-07-03 Ian Lance Taylor <iant@google.com>
6242 * layout.cc (Layout::include_section): Do not discard unrecognized
6243 SHT_STRTAB sections.
6245 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
6247 * script.cc (Lex::can_continue_name): Make '?' allowable in
6248 version-script names.
6249 * testsuite/version_script.map: Change glob pattern to use '?'
6251 2008-06-30 Manish Singh <yosh@gimp.org>
6254 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
6257 2008-06-30 Ian Lance Taylor <iant@google.com>
6261 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
6262 versions]: Don't try to read the value in the contents, since we
6263 don't use it. Use the template endianness when writing.
6265 2008-06-25 Cary Coutant <ccoutant@google.com>
6267 * fileread.cc (File_read::make_view): Assert on zero-length view.
6268 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
6269 symbol table when there are no symbols to read.
6271 2008-06-23 Craig Silverstein <csilvers@google.com>
6273 * version.cc (version_string): Bump to 1.7
6275 2008-06-18 Craig Silverstein <csilvers@google.com>
6277 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
6278 constant 0xFFFF to type Valtype.
6279 (Powerpc_relocate_functions::rel16_ha): Likewise.
6281 2008-06-17 Ian Lance Taylor <iant@google.com>
6283 * output.h (Output_section::Input_section): Initialize p2align_ to
6284 zero for Output_section_data constructors.
6285 (Output_section::Input_section::addralign): If not an input
6286 section, return the alignment of the Output_section_data.
6287 * testsuite/copy_test.cc: New file.
6288 * testsuite/copy_test_1.cc: New file.
6289 * testsuite/copy_test_2.cc: New file.
6290 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
6291 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
6292 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
6293 (copy_test_1_pic.o, copy_test_1.so): New targets.
6294 (copy_test_2_pic.o, copy_test_2.so): New targets.
6295 * testsuite/Makefile.in: Rebuild.
6297 * script-sections.cc (Script_sections::place_orphan): Initialize
6298 local variable exact.
6300 2008-06-13 David Edelsohn <edelsohn@gnu.org>
6302 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
6304 2008-06-12 David Edelsohn <edelsohn@gnu.org>
6305 David S. Miller <davem@davemloft.net>
6307 * powerpc.cc: New file.
6308 * Makefile.am (TARGETSOURCES): Add powerpc.cc
6309 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
6310 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
6311 * Makefile.in: Rebuild.
6313 2008-06-09 Ian Lance Taylor <iant@google.com>
6315 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
6317 (throwing, orig_terminate): New static variables.
6318 (terminate_handler): New static function.
6319 (t2): Set terminate handler.
6321 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
6324 * binary.cc (Binary_to_elf::sized_convert): Fix .data
6327 2008-05-30 Cary Coutant <ccoutant@google.com>
6329 * archive.cc (Archive::include_all_members) Correct to step
6330 over symbol table and extended name table in thin archives.
6332 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
6335 * target-reloc.h (relocate_for_relocatable): Fix new_offset
6338 2008-05-28 Caleb Howe <cshowe@google.com>
6340 * reduced_debug_output.cc: New file.
6341 * reduced_debug_output.h: New file.
6342 * options.h (class General_options): Add --strip-debug-non-line.
6343 * options.cc (General_options::finalize): Add strip_debug_non_line
6344 to the strip heirarchy.
6345 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
6347 * layout.cc: Include "reduced_debug_output.h".
6348 (Layout::Layout): Initialize new fields.
6349 (line_only_debug_sections): New static array.
6350 (is_lines_only_debug_sections): New static inline function.
6351 (Layout::include_section): Handle --strip-debug-non-line.
6352 (Layout::make_output_section): If --strip-debug-non-line, build
6353 new output sections for .debug_abbrev and .debug_info.
6354 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
6355 gold. Warn about possible overflow.
6356 (read_signed_LEB_128): Likewise.
6357 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
6358 (read_signed_LEB_128): Declare.
6359 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
6360 (HFILES): Add reduced_debug_output.h.
6361 * Makefile.in: Rebuild.
6363 2008-05-21 Ian Lance Taylor <iant@google.com>
6365 * mapfile.cc: New file.
6366 * mapfile.h: New file.
6367 * options.h (class General_options): Add -M/--print-map and -Map.
6368 * options.cc (General_options::finalize): Make -M equivalent to
6370 * main.cc: Include <cstdio> and "mapfile.h".
6371 (main): Open mapfile if requested.
6372 * gold.cc (class Middle_runner): Add mapfile_ field. Update
6373 constructor. Change caller.
6374 (queue_initial_tasks): Add mapfile parameter. Change caller.
6375 (queue_middle_tasks): Likewise.
6376 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
6378 * archive.cc: Include "mapfile.h".
6379 (Archive::add_symbols): Add mapfile parameter. Change all
6380 callers. Pass mapfile, symbol, and reason to include_member.
6381 (Archive::include_all_members): Add mapfile parameter. Change all
6383 (Archive::include_member): Add mapfile, sym, and why parameters.
6384 Change all callers. Report inclusion to map file.
6385 * archive.h: Include "fileread.h".
6386 (class Archive): Update declarations.
6387 (Archive::file): New const method.
6388 (class Add_archive_symbols): Add mapfile_ field. Update
6389 constructor. Change all callers.
6390 * readsyms.h (class Read_symbols): Likewise.
6391 (class Finish_group): Likewise.
6392 (class Read_script): Likewise.
6393 * common.cc: Include "mapfile.h".
6394 (Symbol_table::allocate_commons): Add mapfile parameter. Change
6396 (Symbol_table::do_allocate_commons): Likewise.
6397 (Symbol_table::do_allocate_commons_list): Likewise. Report common
6398 symbol allocation to mapfile.
6399 * common.h (class Allocate_commons_task): Add mapfile_ field.
6400 Update constructor. Change all callers.
6401 * symtab.h (class Symbol_table): Update declarations.
6402 * layout.cc: Include "mapfile.h".
6403 (Layout_task_runner::run): Print information to mapfile.
6404 (Layout::create_gold_note): Change Output_data_fixed_space to
6405 Output_data_zero_fill.
6406 (Layout::create_build_id): Likewise.
6407 (Layout::print_to_mapfile): New function.
6408 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
6409 constructor. Change caller.
6410 (class Layout): Declare print_to_mapfile.
6411 * output.cc (Output_section::Input_section::print_to_mapfile): New
6413 (Output_section::add_input_section): If producing a map, always
6414 add to input_sections_ list.
6415 (Output_section::do_print_to_mapfile): New function.
6416 (Output_segment::print_sections_to_mapfile): New function.
6417 (Output_segment::print_section_list_to_mapfile): New function.
6418 * output.h: Include "mapfile.h".
6419 (Output_data::print_to_mapfile): New function.
6420 (Output_data::do_print_to_mapfile): New virtual function.
6421 (Output_segment_headers::do_print_to_mapfile): New function.
6422 (Output_file_header::do_print_to_mapfile): New function.
6423 (Output_data_const::do_print_to_mapfile): New function.
6424 (class Output_data_const_buffer): Add map_name_ field. Update
6425 constructor. Change all callers. Add do_print_to_mapfile
6427 (class Output_data_fixed_space): Likewise.
6428 (class Output_data_space): Likewise.
6429 (class Output_data_zero_fill): New class.
6430 (Output_data_strtab::do_print_to_mapfile): New function.
6431 (Output_data_reloc_base::do_print_to_mapfile): New function.
6432 (Output_relocatable_relocs::do_print_to_mapfile): New function.
6433 (Output_data_group::do_print_to_mapfile): New function.
6434 (Output_data_got::do_print_to_mapfile): New function.
6435 (Output_data_dynamic::do_print_to_mapfile): New function.
6436 (Output_symtab_xindex::do_print_to_mapfile): New function.
6437 (class Output_section): Declare do_print_to_mapflie. Declare
6438 print_to_mapfile in Input_section.
6439 (class Output_segment): Declare new functions.
6440 * object.h (Sized_relobj::symbol_count): New function.
6441 * script-sections.cc
6442 (Output_section_element_dot_assignment::set_section_addresses):
6443 Change Output_data_fixed_space to Output_data_zero_fill.
6444 (Output_data_expression::do_print_to_mapfile): New function.
6445 * script.cc (read_input_script): Add mapfile parameter. Change
6447 * script.h (read_input_script): Update declaration.
6448 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
6449 (Eh_frame::do_print_to_mapfile): New function.
6450 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
6451 (Output_merge_string::do_print_to_mapfile): New function.
6452 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
6454 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
6456 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
6458 * Makefile.am (CCFILES): Add mapfile.cc.
6459 (HFILES): Add mapfile.h.
6460 * Makefile.in: Rebuild.
6462 2008-05-19 Ian Lance Taylor <iant@google.com>
6464 * options.h (class General_options): Add -z relro.
6465 * layout.cc (Layout::Layout): Initialize relro_segment_.
6466 (Layout::add_output_section_data): Return the output section.
6467 (Layout::make_output_section): Rcognize relro sections and mark
6469 (Layout::attach_allocated_section_to_segment): Put relro sections
6470 in a PT_GNU_RELRO segment.
6471 (Layout::create_initial_dynamic_sections): Mark the .dynamic
6473 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
6475 (Layout::linkonce_mapping): Map d.rel.ro.local to
6477 (Layout::output_section_name): Us .data.rel.ro.local for any
6478 section which begins with that.
6479 * layout.h (class Layout): Update add_output_section_data
6480 declaration. Add relro_segment_ field.
6481 * output.cc (Output_section::Output_section): Initialize is_relro_
6482 and is_relro_local_ fields.
6483 (Output_segment::add_output_section): Group relro sections.
6484 (Output_segment::is_first_section_relro): New function.
6485 (Output_segment::maximum_alignment): If there is a relro section,
6486 align the segment to the common page size.
6487 (Output_segment::set_section_addresses): Track whether we are
6488 looking at relro sections. If the last section is a relro
6489 section, align to the common page size.
6490 (Output_segment::set_section_list_addresses): Add in_relro
6491 parameter. Change all callers. Align to the page size when
6492 moving from relro to non-relro section.
6493 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
6495 * output.h (class Output_section): Add is_relro_ and
6496 is_relro_local_ fields.
6497 (Output_section::is_relro): New function.
6498 (Output_section::set_is_relro): New function.
6499 (Output_section::is_relro_local): New function.
6500 (Output_section::set_is_relro_local): New function.
6501 (class Output_segment): Update declarations.
6502 * i386.cc (Target_i386::got_section): Mark .got section as relro.
6503 * sparc.cc (Target_sparc::got_section): Likewise.
6504 * x86_64.cc (Target_x86_64::got_section): Likewise.
6505 * testsuite/relro_test_main.cc: New file.
6506 * testsuite/relro_test.cc: New file.
6507 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
6508 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
6509 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
6510 (relro_test.so, relro_test_pic.o): New targets.
6511 * testsuite/Makefile.in: Rebuild.
6513 2008-05-16 Ian Lance Taylor <iant@google.com>
6515 * output.cc (Output_segment::add_output_section): Remove front
6517 * output.h (class Output_segment): Remove
6518 add_initial_output_section and overloaded add_output_section.
6519 Update declaration of remaining add_output_section.
6520 * layout.cc (Layout::create_interp): Call add_output_section
6521 rather than add_initial_output_section.
6522 (Layout::finish_dynamic_section): Likewise.
6524 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
6525 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
6526 know the dynamic type.
6527 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
6528 field. Initialize it in constructor.
6529 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
6530 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
6531 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
6534 * output.cc (Output_reloc::get_address): Change return type to
6536 * output.h (class Output_reloc): Update get_address declaration.
6537 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
6538 for section addresses.
6540 2008-05-09 Ian Lance Taylor <iant@google.com>
6543 * gold.cc (gold_nomem): Use return value of write.
6545 2008-05-08 Ian Lance Taylor <iant@google.com>
6547 * symtab.c (Symbol::init_base_output_data): Add version
6548 parameter. Change all callers.
6549 (Symbol::init_base_output_segment): Likewise.
6550 (Symbol::init_base_constant): Likewise.
6551 (Symbol::init_base_undefined): Likewise.
6552 (Sized_symbol::init_output_data): Likewise.
6553 (Sized_symbol::init_output_segment): Likewise.
6554 (Sized_symbol::init_constant): Likewise.
6555 (Sized_symbol::init_undefined): Likewise.
6556 (Symbol_table::do_define_in_output_data): If the new symbol has a
6557 version, mark it as the default.
6558 (Symbol_table::do_define_in_output_segment): Likewise.
6559 (Symbol_table::do_define_as_constant): Likewise.
6560 * symtab.h (class Symbol): Update declarations.
6561 (class Sized_symbol): Likewise.
6562 * resolve.cc (Symbol::override_version): New function.
6563 (Symbol::override_base): Call override_version.
6564 (Symbol::override_base_with_special): Likewise.
6565 * testsuite/ver_script_8.script: New file.
6566 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
6567 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
6568 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
6569 (ver_test_8_1.so, ver_test_8_2.so): New targets.
6571 2008-05-06 Ian Lance Taylor <iant@google.com>
6574 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
6576 (class General_options): Remove existing --undefined, and add
6577 --no-undefined instead. Add new --undefined as synonym for -u.
6578 * archive.cc (Archive::add_symbols): Check whether symbol was
6580 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
6581 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
6582 all uses. Add IS_UNDEFINED. Update declarations to split
6583 different versions of init_base. Declare init_base_undefined.
6584 (Symbol::is_defined): Handle IS_UNDEFINED.
6585 (Symbol::is_undefined): Likewise.
6586 (Symbol::is_weak_undefined): Call is_undefined.
6587 (Symbol::is_absolute): Handle IS_CONSTANT.
6588 (class Sized_symbol): Update declarations to split different
6589 versions of init. Declare init_undefined.
6590 (class Symbol_table): Declare new functions.
6591 * symtab.cc (Symbol::init_base_object): Rename from init_base.
6593 (Symbol::init_base_output_data): Likewise.
6594 (Symbol::init_base_output_segment): Likewise.
6595 (Symbol::init_base_constant): Likewise.
6596 (Symbol::init_base_undefined): New function.
6597 (Sized_symbol::init_object): Rename from init. Change all
6599 (Sized_symbol::init_output_data): Likewise.
6600 (Sized_symbol::init_output_segment): Likewise.
6601 (Sized_symbol::init_constant): Likewise.
6602 (Sized_symbol::init_undefined): New function.
6603 (Symbol_table::add_undefined_symbols_from_command_line): New
6605 (Symbol_table::do_add_undefined_symbols_from_command_line): New
6607 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
6608 (Symbol::output_section): Likewise.
6609 (Symbol::set_output_section): Likewise.
6610 (Symbol_table::sized_finalize_symbol): Likewise.
6611 (Symbol_table::sized_write_globals): Likewise.
6612 * resolve.cc (Symbol_table::should_override): Likewise.
6613 (Symbol::override_base_with_special): Likewise.
6615 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
6616 symbol, change it to have default visibility.
6617 * testsuite/protected_1.cc: New file.
6618 * testsuite/protected_2.cc: New file.
6619 * testsuite/protected_3.cc: New file.
6620 * testsuite/protected_main_1.cc: New file.
6621 * testsuite/protected_main_2.cc: New file.
6622 * testsuite/protected_main_3.cc: New file.
6623 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
6624 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
6625 (protected_1_LDFLAGS, protected_1_LDADD): Define.
6626 (protected_1.so): New target.
6627 (protected_1_pic.o, protected_2_pic.o): New targets.
6628 (protected_3_pic.o): New target.
6629 (check_PROGRAMS): Add protected_2.
6630 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
6631 (protected_2_LDFLAGS, protected_2_LDADD): Define.
6632 * testsuite/Makefile.in: Rebuild.
6634 * options.h (DEFINE_var): Add set_user_set_##varname__.
6635 (DEFINE_bool_alias): New macro.
6636 (class General_options): Define -Bstatic using DEFINE_bool_alias
6637 rather than DEFINE_special. Add --undefined as an alias for -z
6639 * options.cc (General_options::parse_Bstatic): Remove.
6641 * options.h (class General_options): Add --fatal-warnings.
6642 * main.cc (main): Implement --fatal-warnings.
6643 * errors.h (Errors::warning_count): New function.
6645 * options.h (class General_options): Add -Bsymbolic-functions.
6646 * symtab.h (Symbol::is_preemptible): Check for
6647 -Bsymbolic-functions.
6649 2008-05-05 Ian Lance Taylor <iant@google.com>
6651 * options.h (DEFINE_bool): For DASH_Z, create the negative option
6652 as noVARNAME rather than no-VARNAME.
6653 (class General_options): Add option -z combreloc.
6654 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
6656 (Output_reloc::sort_before) [SHT_REL]: New function.
6657 (Output_reloc::sort_before) [SHT_RELA]: New function.
6658 (class Output_data_reloc_base): Add sort_relocs_ field. Define
6659 Sort_relocs_comparison.
6660 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
6661 parameter. Change all callers.
6662 (Output_data_reloc::Output_data_reloc) [both versions]: Add
6663 sort_relocs parameter. Change all callers.
6664 * output.cc (Output_reloc::get_address): New function, broken out
6666 (Output_reloc::write_rel): Call it.
6667 (Output_reloc::compare): New function.
6668 (Output_data_reloc_base::do_write): Optionally sort relocs.
6670 * configure.ac: If targ_extra_obj is set, link it in.
6671 * configure.tgt: Initialize all variables.
6672 (x86_64*): Set targ_extra_obj and targ_extra_size.
6673 * configure: Rebuild.
6675 * object.cc (Sized_relobj::include_section_group): Adjust section
6676 indexes read from group data. Build vector to pass to
6678 * layout.cc (Layout::layout_group): Add flags and shndxes
6679 parameters. Remove contents parameter. Change caller. Update
6680 explicit instantiations.
6681 * layout.h (class Layout): Update layout_group declaration.
6682 * output.cc (Output_data_group::Output_data_group): Add flags and
6683 input_shndxes parameters. Remove contents parameter. Change
6685 (Output_data_group::do_write): Change input_sections_ to
6687 * output.h (class Output_data_group): Update constructor
6688 declaration. Rename input_sections_ to input_shndxes_.
6689 * testsuite/many_sections_test.cc: Add template.
6691 2008-04-30 Cary Coutant <ccoutant@google.com>
6693 * target-reloc.h (relocate_section): Fix dead-pointer bug.
6695 * layout.cc (Layout::include_section): Refactored check for debug
6697 (Layout::add_comdat): Add new parameters. Change type
6698 of signature parameter. Add object and shndx to signatures table.
6699 (Layout::find_kept_object): New function.
6700 * layout.h: Include <cstring>.
6701 (Layout::is_debug_info_section): New function.
6702 (Layout::add_comdat): Add new parameters.
6703 (Layout::find_kept_object): New function.
6704 (Layout::Kept_section): New struct.
6705 (Layout::Signatures): Change type of map range.
6706 * object.cc (Relobj::output_section_address): New function.
6707 (Sized_relobj::include_section_group): Add new parameters. Change
6708 calls to Layout::add_comdat. Change to build table of kept comdat
6709 groups and table mapping discarded sections to kept sections.
6710 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
6711 (Sized_relobj::do_layout): Change calls to include_section_group and
6712 include_linkonce_section.
6713 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
6714 value to zero when section is discarded.
6715 (Sized_relobj::map_to_kept_section): New function.
6716 * object.h (Relobj::output_section_address): New function.
6717 (Relobj::Comdat_group): New type.
6718 (Relobj::find_comdat_group): New function.
6719 (Relobj::Comdat_group_table): New type.
6720 (Relobj::Kept_comdat_section): New type.
6721 (Relobj::Kept_comdat_section_table): New type.
6722 (Relobj::add_comdat_group): New function.
6723 (Relobj::set_kept_comdat_section): New function.
6724 (Relobj::get_kept_comdat_section): New function.
6725 (Relobj::comdat_groups_): New field.
6726 (Relobj::kept_comdat_sections_): New field.
6727 (Symbol_value::input_value): Update comment.
6728 (Sized_relobj::map_to_kept_section) New function.
6729 (Sized_relobj::include_linkonce_section): Add new parameter.
6730 * target-reloc.h (Comdat_behavior): New type.
6731 (get_comdat_behavior): New function.
6732 (relocate_section): Add code to map a discarded section to the
6733 corresponding kept section when applying a relocation.
6735 2008-04-30 Craig Silverstein <csilvers@google.com>
6737 * dwarf_reader.cc (next_generation_count): New static var.
6738 (Addr2line_cache_entry): New struct.
6739 (addr2line_cache): New static var.
6740 (Dwarf_line_info::one_addr2line): Added caching.
6741 (Dwarf_line_info::clear_addr2line_cache): New function.
6742 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
6743 cache-size parameter.
6744 (Dwarf_line_info::one_addr2line_cache): New function.
6745 * symtab.cc (Symbol_table::detect_odr_violations): Pass
6746 new cache-size argument to one_addr2line(), and clear cache.
6748 2008-04-28 Cary Coutant <ccoutant@google.com>
6750 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
6751 R_386_PC8 relocations.
6753 2008-04-23 Ian Lance Taylor <iant@google.com>
6755 * object.cc (Sized_relobj::include_section_group): Check for
6756 invalid section group.
6758 * object.cc (make_elf_object): Correct test for 64-bit ELF file
6761 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
6762 than read for file header.
6763 * archive.cc (Archive::include_member): Likewise.
6765 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
6767 * aclocal.m4: Regenerate.
6768 * configure: Regenerate.
6770 2008-04-19 Ian Lance Taylor <iant@google.com>
6772 * version.cc (version_string): Bump to 1.6.
6774 * testsuite/Makefile.am (many_sections_r_test): New target.
6775 (many_sections_r_test_SOURCES): Remove.
6776 (many_sections_r_test_DEPENDENCIES): Remove.
6777 (many_sections_r_test_LDFLAGS): Remove.
6778 (many_sections_r_test_LDADD): Remove.
6780 * object.cc (Sized_relobj::do_add_symbols): Always pass
6781 local_symbol_count_ to add_from_relobj.
6783 * testsuite/Makefile.am (many_sections_check.h): Only check one in
6784 every thousand variables.
6785 * testsuite/Makefile.in: Rebuild.
6787 * object.cc (Xindex::initialize_symtab_xindex): New function.
6788 (Xindex::read_symtab_xindex): New function.
6789 (Xindex::sym_xindex_to_shndx): New function.
6790 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
6792 (Sized_relobj::do_initialize_xindex): New function.
6793 (Sized_relobj::do_read_symbols): Adjust section links.
6794 (Sized_relobj::symbol_section_and_value): Add is_ordinary
6795 parameter. Change all callers.
6796 (Sized_relobj::include_section_group): Adjust section links and
6797 symbol section indexes.
6798 (Sized_relobj::do_layout): Adjust section links.
6799 (Sized_relobj::do_count_local_symbols): Adjust section links and
6800 symbol section indexes.
6801 (Sized_relobj::do_finalize_local_symbols): Distinguish between
6802 ordinary and special symbols.
6803 (Sized_relobj::write_local_symbols): Add symtab_xindex and
6804 dynsym_xindex parameters. Change all callers. Adjust section
6805 links. Use SHN_XINDEX when needed.
6806 (Sized_relobj::get_symbol_location_info): Adjust section links.
6807 Don't get fooled by special symbols.
6808 * object.h (class Xindex): Define.
6809 (class Object): Add xindex_ parameter. Declare virtual functoin
6810 do_initialize_xindex.
6811 (Object::adjust_sym_shndx): New function.
6812 (Object::set_xindex): New protected function.
6813 (class Symbol_value): Add is_ordinary_shndx_ field.
6814 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
6815 (Symbol_value::value): Assert ordinary section.
6816 (Symbol_value::initialize_input_to_output_map): Likewise.
6817 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
6819 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
6821 (class Sized_relobj): Update declarations.
6822 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
6823 parameter. Change all callers.
6824 (Sized_relobj::adjust_shndx): New function.
6825 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
6827 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
6828 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
6829 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
6830 (Sized_dynobj::read_dynsym_section): Adjust section links.
6831 (Sized_dynobj::read_dynamic): Likewise.
6832 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
6834 (Sized_dynobj::do_initialize_xindex): New function.
6835 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
6836 do_initialize_xindex.
6837 (Sized_dynobj::adjust_shndx): New function.
6838 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
6839 dynsym_xindex_ fields.
6840 (Layout::finalize): Add a call to set_section_indexes before
6841 creating the symtab sections.
6842 (Layout::set_section_indexes): Don't do anything if the section
6843 already has a section index.
6844 (Layout::create_symtab_sections): Add shnum parameter. Change
6845 caller. Create .symtab_shndx section if needed.
6846 (Layout::create_shdrs): Add shstrtab_section parameter. Change
6848 (Layout::allocated_output_section_count): New function.
6849 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
6851 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
6852 fields. Update declarations.
6853 (Layout::symtab_xindex): New function.
6854 (Layout::dynsym_xindex): New function.
6855 (class Write_symbols_task): Add layout_ field.
6856 (Write_symbols_task::Write_symbols_task): Add layout parameter.
6858 * output.cc (Output_section_headers::Output_section_headers): Add
6859 shstrtab_section parameter. Change all callers.
6860 (Output_section_headers::do_sized_write): Store overflow values
6861 for section count and section string table section index in
6862 section header zero.
6863 (Output_file_header::do_sized_write): Check for overflow of
6864 section count and section string table section index.
6865 (Output_symtab_xindex::do_write): New function.
6866 (Output_symtab_xindex::endian_do_write): New function.
6867 * output.h (class Output_section_headers): Add shstrtab_section_.
6868 Update declarations.
6869 (class Output_symtab_xindex): Define.
6870 (Output_section::has_out_shndx): New function.
6871 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
6873 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
6875 (Sized_symbol::init): Likewise.
6876 (Symbol::output_section): Check for ordinary symbol.
6877 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
6878 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
6880 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
6881 Change all callers. Simplify handling of symbols from sections
6882 not included in the link.
6883 (Symbol_table::add_from_dynobj): Handle ordinary symbol
6885 (Weak_alias_sorter::operator()): Assert that symbols are
6887 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
6889 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
6890 parameters. Change all callers.
6891 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
6892 symbol distinction. Use SHN_XINDEX when needed.
6893 (Symbol_table::write_section_symbol): Add symtab_xindex
6894 parameter. Change all callers.
6895 (Symbol_table::sized_write_section_symbol): Likewise. Use
6896 SHN_XINDEX when needed.
6897 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
6899 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
6900 (Symbol::is_defined): Check is_ordinary.
6901 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
6902 (Symbol::is_absolute, Symbol::is_common): Likewise.
6903 (class Sized_symbol): Update declarations.
6904 (class Symbol_table): Update declarations.
6905 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
6906 parameters. Change all callers.
6907 (Sized_symbol::override): Likewise.
6908 (Symbol_table::override): Likewise.
6909 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
6910 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
6911 is_ordinary, and orig_st_shndx parameters. Change all callers.
6912 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
6913 to be in an ordinary section.
6914 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
6915 object and is_ordinary parameters. Change all callers.
6916 (Sized_dwarf_line_info::read_relocs): Add object parameter.
6917 Change all callers. Don't add undefined or non-ordinary symbols
6919 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
6921 * dwarf_reader.h (class Sized_dwarf_line_info): Update
6923 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
6924 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
6925 (Sized_relobj::relocate_sections): Likewise.
6926 * target-reloc.h (scan_relocs): Adjust section symbol index.
6927 (scan_relocatable_relocs): Likewise.
6928 * i386.cc (Scan::local): Check for ordinary symbols.
6929 * sparc.cc (Scan::local): Likewise.
6930 * x86_64.cc (Scan::local): Likewise.
6931 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
6932 to symbol_section_and_value.
6933 * testsuite/many_sections_test.cc: New file.
6934 * testsuite/Makefile.am (BUILT_SOURCES): Define.
6935 (check_PROGRAMS): Add many_sections_test.
6936 (many_sections_test_SOURCES): Define.
6937 (many_sections_test_DEPENDENCIES): Define.
6938 (many_sections_test_LDFLAGS): Define.
6939 (BUILT_SOURCES): Add many_sections_define.h.
6940 (many_sections_define.h): New target.
6941 (BUILT_SOURCES): Add many_sections_check.h.
6942 (many_sections_check.h): New target.
6943 (check_PROGRAMS): Add many_sections_r_test.
6944 (many_sections_r_test_SOURCES): Define.
6945 (many_sections_r_test_DEPENDENCIES): Define.
6946 (many_sections_r_test_LDFLAGS): Define.
6947 (many_sections_r_test_LDADD): Define.
6948 (many_sections_r_test.o): New target.
6949 * testsuite/Makefile.in: Rebuild.
6951 2008-04-17 Cary Coutant <ccoutant@google.com>
6953 * errors.cc (Errors::info): New function.
6954 (gold_info): New function.
6955 * errors.h (Errors::info): New function.
6956 * gold.h (gold_info): New function.
6957 * object.cc (Input_objects::add_object): Print trace output.
6958 * options.cc (options::parse_set): New function.
6959 (General_options::parse_wrap): Deleted.
6960 (General_options::General_options): Deleted initializer.
6961 * options.h (options::String_set): New typedef.
6962 (options::parse_set): New function.
6963 (DEFINE_set): New macro.
6964 (General_options::wrap): Changed to use DEFINE_set. Changed
6965 callers of any_wrap_symbols and is_wrap_symbol.
6966 (General_options::trace, General_options::trace_symbol):
6968 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
6969 (General_options::wrap_symbols_): Deleted.
6970 * symtab.cc (Symbol_table::add_from_object): Print trace output.
6972 2008-04-17 David S. Miller <davem@davemloft.net>
6974 * options.cc (General_options::parse_V): New function.
6975 * options.h: Add entries for -V and -Qy.
6977 2008-04-17 Ian Lance Taylor <iant@google.com>
6979 * common.cc (Symbol_table::allocate_commons): Remove options
6980 parameter. Change caller.
6981 (Symbol_table::do_allocate_commons): Remove options parameter.
6982 Change caller. Just call do_allocate_commons_list twice.
6983 (Symbol_table::do_allocate_commons_list): New function, broken out
6984 of do_allocate_commons.
6985 * common.h (class Allocate_commons_task): Remove options_ field.
6987 * symtab.cc (Symbol_table::Symbol_table): Initialize
6989 (Symbol_table::add_from_object): Put TLS common symbols on
6991 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
6992 which are IN_OUTPUT_DATA.
6993 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
6994 allocate_commons and do_allocate_commons declarations. Declare
6995 do_allocate_commons_list.
6996 * gold.cc (queue_middle_tasks): Update creation of
6997 Allocate_commons_task to not pass options.
6998 * testsuite/Makefile.am (INCLUDES): Add -I.. .
6999 (TLS_TEST_C_FLAGS): New variable.
7000 (tls_test_c_pic.o): New target.
7001 (tls_test_shared.so): Link in tls_test_c_pic.o.
7002 (tls_test_c_pic_ie.o): New target.
7003 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
7004 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
7005 (tls_test_c.o): New target.
7006 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
7007 (tls_pic_test_LDADD): Likewise.
7008 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
7009 (tls_shared_gd_to_ie_test_LDADD): Likewise.
7010 (tls_test_c_gnu2.o): New target.
7011 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
7013 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
7014 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
7015 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
7016 * testsuite/tls_test.cc: Include "config.h".
7017 (t_last): Call t11_last.
7018 * testsuite/tls_test.h (t11, t11_last): Declare.
7019 * testsuite/tls_test_c.c: New file.
7020 * testsuite/tls_test_main.cc (thread_routine): Call t11.
7021 * configure.ac: Check for OpenMP support.
7022 * configure, config.in, Makefile.in: Rebuild.
7023 * testsuite/Makefile.in: Rebuild.
7025 2008-04-16 Cary Coutant <ccoutant@google.com>
7027 * i386.cc (Target_i386::define_tls_base_symbol): New function.
7028 (Target_i386::tls_base_symbol_defined_): New field.
7029 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7030 (Target_i386::Scan::global): Likewise.
7031 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
7032 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
7033 (Target_x86_64::tls_base_symbol_defined_): New field.
7034 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7035 (Target_x86_64::Scan::global): Likewise.
7037 2008-04-16 Cary Coutant <ccoutant@google.com>
7039 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
7040 (Symbol::needs_plt_entry): Allow weak undefined symbols.
7041 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
7042 building shared libraries.
7043 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
7044 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
7045 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
7046 * testsuite/Makefile.in: Rebuild.
7047 * testsuite/weak_undef.h: New file.
7048 * testsuite/weak_undef_file1.cc: Add extra test cases.
7049 * testsuite/weak_undef_file2.cc: Likewise.
7050 * testsuite/weak_undef_test.cc: Likewise.
7052 2008-04-16 David S. Miller <davem@davemloft.net>
7054 * sparc.cc (Target_sparc::Scan): Change from struct to class.
7055 Add issued_non_pic_error_ field. Declare check_non_pic.
7056 (Target_sparc::Scan::check_non_pic): New function.
7057 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
7058 (Target_sparc::Scan::global): Likewise.
7060 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
7061 * configure: Rebuild.
7063 * options.h (DEFINE_enable): New macro.
7064 (new_dtags): New enable option.
7065 (initfirst, interpose, loadfltr, nodefaultlib,
7066 nodelete, nodlopen, nodump): New -z options.
7067 * layout.cc (Layout:finish_dynamic_section): If new
7068 dtags enabled, emit DT_RUNPATH. Also, emit a
7069 DT_FLAGS_1 containing any specified -z flags.
7071 2008-04-16 Ian Lance Taylor <iant@google.com>
7073 * copy-relocs.cc: New file.
7074 * copy-relocs.h: New file.
7075 * reloc.cc: Remove Copy_relocs code.
7076 * reloc.h: Likewise.
7077 * reloc-types.h (struct Reloc_types) [both versions]: Add
7078 get_reloc_addend_noerror.
7079 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
7080 variants of add_global which take an addend which must be zero.
7081 * i386.cc: Include "copy-relocs.h".
7082 (class Target_i386): Change type of copy_relocs_ to variable,
7084 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
7086 (Target_i386::do_finalize_sections): Change handling of
7088 * sparc.cc: Include "copy-relocs.h".
7089 (class Target_sparc): Change type of copy_relocs_ to variable,
7091 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
7093 (Target_sparc::do_finalize_sections): Change handling of
7095 * x86_64.cc: Include "copy-relocs.h".
7096 (class Target_x86_64): Change type of copy_relocs_ to variable,
7098 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
7099 class. Change all callers.
7100 (Target_x86_64::do_finalize_sections): Change handling of
7102 * Makefile.am (CCFILES): Add copy-relocs.cc.
7103 (HFILES): Add copy-relocs.h.
7105 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
7107 * testsuite/script_test_4.sh: Permit leading zeroes.
7109 2008-04-15 Ian Lance Taylor <iant@google.com>
7111 * script-sections.cc (Script_sections::create_segments): Use
7112 header_size_adjustment even when there is enough room for the
7114 * testsuite/script_test_4.sh: New file.
7115 * testsuite/script_test_4.t: New file.
7116 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
7117 (check_DATA): Add script_test_4.stdout.
7118 (MOSTLYCLEANFILES): Likewise.
7119 (script_test_4): New target.
7120 (script_test_4.stdout): New target.
7121 * testsuite/Makefile.in: Rebuild.
7123 * sparc.cc: Add definitions for Output_data_plt_sparc class
7126 2008-04-14 David S. Miller <davem@davemloft.net>
7128 * sparc.cc: New file.
7129 * Makefile.am (TARGETSOURCES): Add sparc.cc
7130 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
7131 * configure.tgt: Document targ_extra_size and
7132 targ_extra_big_endian. Add entries for sparc-* and
7134 * configure.ac: Handle targ_extra_size and
7135 targ_extra_big_endian.
7136 * Makefile.in: Rebuild.
7137 * configure: Likewise.
7138 * po/POTFILES.in: Likewise.
7139 * po/gold.pot: Likewise.
7141 2008-04-14 Ian Lance Taylor <iant@google.com>
7143 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
7144 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
7145 in the name/type/flags to section mapping. Don't call
7146 allocate_output_section.
7147 (Layout::choose_output_section): Change parameter from adjust_name
7148 to is_input_section. Don't permit input sections after sections
7149 are attached to segments. Don't call allocate_output_section.
7150 (Layout::layout_eh_frame): Call update_flags_for_input_section,
7151 not write_enable_output_section.
7152 (Layout::make_output_section): Don't push to
7153 unattached_section_list_ nor call attach_to_segment. Call
7154 attach_section_to_segment if sections are attached.
7155 (Layout::attach_sections_to_segments): New function.
7156 (Layout::attach_section_to_segment): New function.
7157 (Layout::attach_allocated_section_to_segment): Rename from
7158 attach_to_segment. Remove flags parameter.
7159 (Layout::allocate_output_section): Remove function.
7160 (Layout::write_enable_output_section): Remove function.
7161 * layout.h (class Layout): Update for above changes. Add new
7162 field sections_are_attached_.
7163 * output.h (Output_section::update_flags_for_input_section): New
7165 * output.cc (Output_section::add_input_section): Call
7166 update_flags_for_input_section.
7167 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
7169 2008-04-11 Cary Coutant <ccoutant@google.com>
7171 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
7172 thought unnecessary.
7173 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
7175 2008-04-11 Ian Lance Taylor <iant@google.com>
7177 * output.h (class Output_section_data): Remove inline definition
7179 * output.cc (Output_section_data::set_addralign): New function.
7181 2008-04-11 Cary Coutant <ccoutant@google.com>
7183 Add support for TLS descriptors for i386 and x86_64.
7184 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
7185 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
7186 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
7188 (Target_i386::got_mod_index_entry): Remove unnecessary code.
7189 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
7190 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
7192 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
7193 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
7194 Fix problem with initial-exec relocations.
7195 (Target_i386::Relocate::relocate_tls): Likewise.
7196 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
7198 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
7199 support for section-plus-offset dynamic table entries.
7200 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
7201 (Output_data_dynamic::Dynamic_entry): Add support for
7202 section-plus-offset dynamic table entries.
7203 (Output_data_dynamic::Classification): Likewise.
7204 (Output_data_dynamic::classification_): Renamed offset_.
7205 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
7206 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
7207 (Target_x86_64::make_plt_section): New function.
7208 (Target_x86_64::reserve_tlsdesc_entries): New function.
7209 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
7210 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
7211 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
7212 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
7213 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
7214 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
7215 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
7216 add extra PLT entry for TLS descriptors.
7217 (Output_data_plt_x86_64::got_): New field.
7218 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
7219 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
7221 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
7223 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
7224 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
7225 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
7226 R_386_TLS_DESC_CALL relocations.
7227 (Target_x86_64::Scan::global): Likewise.
7228 (Target_x86_64::do_finalize_sections): Add dynamic table entries
7229 for TLS descriptors.
7230 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
7231 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
7232 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
7233 GD-to-IE relaxation.
7234 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
7235 and TLS_DESCRIPTORS.
7236 * Makefile.in: Rebuild.
7237 * configure: Rebuild.
7238 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
7239 (tls_test_shared2.so): New target.
7240 (tls_shared_gd_to_ie_test_SOURCES): New variable.
7241 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
7242 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
7243 (tls_shared_gd_to_ie_test_LDADD): New variable.
7244 (tls_shared_gnu2_gd_to_ie_test): New target.
7245 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
7247 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
7248 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
7249 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
7250 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
7251 (tls_shared_gnu2_test): New target.
7252 (tls_test_gnu2_shared.so): New target.
7253 (tls_shared_gnu2_test_SOURCES): New variable.
7254 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
7255 (tls_shared_gnu2_test_LDFLAGS): New variable.
7256 (tls_shared_gnu2_test_LDADD): New variable.
7257 * testsuite/Makefile.in: Rebuild.
7258 * testsuite/Makefile.
7260 2008-04-11 Ian Lance Taylor <iant@google.com>
7262 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
7264 * testsuite/Makefile.in: Rebuild.
7266 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
7268 * testsuite/script_test_2.cc (main): Adjust test.
7270 2008-04-11 David S. Miller <davem@davemloft.net>
7271 Ian Lance Taylor <iant@google.com>
7273 * options.h (General_options): Add entries for '-Y' and
7275 * options.cc (General_options:finalize): If -Y was used, add those
7276 entries to the library path instead of the default "/lib" and
7279 2008-04-11 David S. Miller <davem@davemloft.net>
7281 * testsuite/justsyms.t: Start at 0x100.
7282 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
7283 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
7285 * testsuite/script_test_2.cc: Adjust string and section length
7288 2008-04-09 Ian Lance Taylor <iant@google.com>
7291 * script-sections.cc (Sections_element::allocate_to_segment): Add
7293 (Output_section_definition::allocate_to_segment): Likewise.
7294 (Orphan_output_section::allocate_to_segment): Likewise.
7295 (Script_sections::attach_sections_using_phdrs_clause): Don't
7296 propagate non-PT_LOAD segments to orphan sections.
7297 * testsuite/Makefile.am (script_test_3.stdout): Generate using
7298 readelf rather than objdump.
7299 * testsuite/script_test_3.sh: Adjust accordingly. Test that
7300 .interp section and PT_INTERP segment are the same size.
7301 * testsuite/Makefile.in: Rebuild.
7303 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
7304 aliases for symbols defined in the same object.
7305 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
7306 (weak_alias_test_SOURCES): New variable.
7307 (weak_alias_test_DEPENDENCIES): New variable.
7308 (weak_alias_test_LDFLAGS): New variable.
7309 (weak_alias_test_LDADD): New variable.
7310 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
7311 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
7312 (weak_alias_test_3.o): New target.
7313 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
7314 * testsuite/weak_alias_test_main.cc: New file.
7315 * testsuite/weak_alias_test_1.cc: New file.
7316 * testsuite/weak_alias_test_2.cc: New file.
7317 * testsuite/weak_alias_test_3.cc: New file.
7319 2008-04-08 Ian Lance Taylor <iant@google.com>
7321 * options.h (class General_options): Add --noinhibit-exec option.
7322 * main.cc (main): Check --noinhibit-exec.
7324 * options.h (class General_options): Define --wrap as a special
7325 option. Add wrap_symbols_ field.
7326 (General_options::any_wrap_symbols): New function.
7327 (General_options::is_wrap_symbol): New function.
7328 * options.cc (General_options::parse_wrap): New function.
7329 (General_options::General_options): Initialize wrap_symbols_.
7330 * symtab.cc (Symbol_table::wrap_symbol): New function.
7331 (Symbol_table::add_from_object): Handle --wrap.
7332 * symtab.h (class Symbol_table): Declare wrap_symbol.
7333 * target.h (Target::wrap_char): New function.
7334 (Target::Target_info): Add wrap_char field.
7335 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
7336 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7337 * testsuite/testfile.cc (Target_test::test_target_info):
7340 * errors.cc (Errors::undefined_symbol): Mention symbol version if
7343 * layout.h (class Layout): Add added_eh_frame_data_ field.
7344 * layout.cc (Layout::Layout): Initialize new field.
7345 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
7346 output section until we find a section we merged successfully.
7347 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
7348 that the size be non-zero.
7350 * merge.cc (Object_merge_map::get_output_offset): Remove inline
7353 2008-04-08 Craig Silverstein <csilvers@google.com>
7355 * configure.ac: Export new conditional variable HAVE_ZLIB.
7356 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
7358 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
7359 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
7361 2008-04-07 Ian Lance Taylor <iant@google.com>
7363 * version.cc (version_string): Set to "1.5".
7365 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
7366 Add issued_non_pic_error_ field. Declare check_non_pic.
7367 (Target_x86_64::Scan::check_non_pic): New function.
7368 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
7369 (Target_x86_64::Scan::global): Likewise.
7371 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
7372 addend parameter. Change caller. Handle merge sections.
7373 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
7374 Address to Addend. Don't add in the result of
7375 local_section_offset, pass down the addend and use the returned
7377 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
7378 Update declarations of local_section_offset and symbol_value.
7379 * testsuite/two_file_test_1.cc (t18): New function.
7380 * testsuite/two_file_test_2.cc (f18): New function.
7381 * testsuite/two_file_test_main.cc (main): Call t18.
7382 * testsuite/two_file_test.h (t18, f18): Declare.
7384 * configure.ac: Don't test for objdump, c++filt, or readelf.
7385 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
7387 (TEST_READELF): New variable.
7388 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
7389 (check_PROGRAMS): Add two_file_strip_test.
7390 (two_file_strip_test): New target.
7391 (check_PROGRAMS): Add two_file_same_shared_strip_test.
7392 (two_file_same_shared_strip_test_SOURCES): New variable.
7393 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
7394 (two_file_same_shared_strip_test_LDFLAGS): New variable.
7395 (two_file_same_shared_strip_test_LDADD): New variable.
7396 (two_file_shared_strip.so): New target.
7397 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
7398 (ver_test_5.syms, ver_test_7.syms): Likewise.
7399 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
7400 (strip_test_3.stdout): Use TEST_OBJDUMP.
7401 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
7403 2008-04-04 Cary Coutant <ccoutant@google.com>
7405 * symtab.h (Symbol::is_weak_undefined): New function.
7406 (Symbol::is_strong_undefined): New function.
7407 (Symbol::is_absolute): New function.
7408 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
7409 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
7411 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
7412 (weak_undef_test): New target.
7413 * testsuite/Makefile.in: Rebuild.
7414 * testsuite/weak_undef_file1.cc: New file.
7415 * testsuite/weak_undef_file2.cc: New file.
7416 * testsuite/weak_undef_test.cc: New file.
7418 2008-04-03 Craig Silverstein <csilvers@google.com>
7420 * compressed_output.h (class Output_compressed_section): Use
7422 * compressed_output.cc (zlib_compress): Use unsigned buffers,
7424 (zlib_compressed_suffix): Removed.
7425 (Output_compressed_section::set_final_data_size): Use unsigned
7427 * testsuite/Makefile.am (flagstest_compress_debug_sections):
7428 Fix linker invocation.
7429 (flagstest_o_specialfile_and_compress_debug_sections):
7431 * testsuite/Makefile.in: Regenerated.
7433 2008-04-02 David S. Miller <davem@davemloft.net>
7435 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
7436 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
7438 2008-04-02 Craig Silverstein <csilvers@google.com>
7442 2008-04-02 Ian Lance Taylor <iant@google.com>
7444 * fileread.cc (File_read::find_view): Add byteshift and vshifted
7445 parameters. Update for new key type to views_. Change all
7447 (File_read::read): Adjust for byteshift in returned view.
7448 (File_read::add_view): New function, broken out of
7450 (File_read::make_view): New function, broken out of
7452 (File_read::find_or_make_view): Add offset and aligned
7453 parameters. Rewrite accordingly. Change all callers.
7454 (File_read::get_view): Add offset and aligned parameters. Adjust
7455 for byteshift in return value.
7456 (File_read::get_lasting_view): Likewise.
7457 * fileread.h (class File_read): Update declarations.
7458 (class File_read::View): Add byteshift_ field. Add byteshift to
7459 constructor. Add byteshift method.
7460 * archive.h (Archive::clear_uncached_views): New function.
7461 (Archive::get_view): Add aligned parameter. Change all callers.
7462 * object.h (Object::get_view): Add aligned parameter. Change all
7464 (Object::get_lasting_view): Likewise.
7466 * fileread.cc (File_read::release): Don't call clear_views if
7467 there are multiple objects.
7468 * fileread.h (File_read::clear_uncached_views): New function.
7469 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
7472 2008-03-31 Cary Coutant <ccoutant@google.com>
7474 Add thin archive support.
7475 * archive.cc (Archive::armagt): New const.
7476 (Archive::setup): Remove task parameter and calls to unlock.
7477 (Archive::unlock_nested_archives): New function.
7478 (Archive::read_header): Add nested_off parameter. Change
7480 (Archive::interpret_header): Likewise.
7481 (Archive::include_all_members): Change to handle thin
7483 (Archive::include_member): Likewise.
7484 * archive.h (Archive::Archive): Add new parameters and
7486 (Archive::armagt): New const.
7487 (Archive::setup): Remove task parameter.
7488 (Archive::unlock_nested_archives): New function.
7489 (Archive::read_header): Add nested_off parameter.
7490 (Archive::interpret_header): Likewise.
7491 (Archive::Nested_archive_table): New typedef.
7492 (Archive::is_thin_archive_): New field.
7493 (Archive::nested_archives_): New field.
7494 (Archive::options_): New field.
7495 (Archive::dirpath_): New field.
7496 (Archive::task_): New field.
7497 * readsyms.cc (Read_symbols::do_read_symbols): Add check
7498 for thin archives. Pass additional parameters to
7499 Archive::Archive. Unlock the archive file after calling
7502 2008-03-29 Ian Lance Taylor <iant@google.com>
7504 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
7505 version symbol to be local.
7506 * testsuite/ver_test_4.sh: New file.
7507 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
7508 (check_DATA): Add ver_test_4.syms.
7509 (ver_test_4.syms): New target.
7510 * testsuite/Makefile.in: Rebuild.
7513 (Output_section::Input_section_sort_entry::has_priority): New
7515 (Output_section::Input_section_sort_entry::match_file_name): New
7517 (Output_section::Input_section_sort_entry::match_section_name):
7519 (Output_section::Input_section_sort_entry::match_section_name_prefix):
7521 (Output_section::Input_section_sort_entry::match_section_file):
7523 (Output_section::Input_section_sort_compare::operator()): Rewrite
7524 using new Input_section_sort_entry functions. Sort crtbegin and
7525 crtend first. Sort sections with no priority before sections with
7527 * testsuite/initpri1.c (d3): Check j != 4.
7528 (cd5): New constructor/destructor function.
7529 (main): Check j != 2.
7531 * symtab.cc (Symbol_table::add_from_object): If we don't use the
7532 new symbol when resolving, don't call set_is_default.
7533 * testsuite/ver_test_7.cc: New file.
7534 * testsuite/ver_test_7.sh: New file.
7535 * testsuite/Makefile.am (ver_test_7.so): New target.
7536 (ver_test_7.o): New target.
7537 (check_SCRIPTS): Add ver_test_7.sh.
7538 (check_DATA): Add ver_test_7.syms.
7539 (ver_test_7.syms): New target.
7541 2008-03-28 Ian Lance Taylor <iant@google.com>
7543 * layout.cc (Layout::layout): If we see an input section with a
7544 name that needs sorting, set the must_sort flag for the output
7546 (Layout::make_output_section): If the name of the output section
7547 indicates that it might require sorting, set the may_sort flag.
7548 * output.h (Output_section::may_sort_attached_input_sections): New
7550 (Output_section::set_may_sort_attached_input_sections): New
7552 (Output_section::must_sort_attached_input_sections): New
7554 (Output_section::set_must_sort_attached_input_sections): New
7556 (class Output_section): Declare Input_section_sort_entry. Define
7557 Input_section_sort_compare. Declare
7558 sort_attached_input_sections. Add new fields:
7559 may_sort_attached_input_sections_,
7560 must_sort_attached_input_sections_,
7561 attached_input_sections_are_sorted_.
7562 * output.cc (Output_section::Output_section): Initialize new
7564 (Output_section::add_input_section): Add an entry to
7565 input_sections_ if may_sort or must_sort are true.
7566 (Output_section::set_final_data_size): Call
7567 sort_attached_input_sections if necessary.
7568 (Output_section::Input_section_sort_entry): Define new class.
7569 (Output_section::Input_section_sort_compare::operator()): New
7571 (Output_section::sort_attached_input_sections): New function.
7572 * configure.ac: Check whether the compiler supports constructor
7573 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
7574 * testsuite/initpri1.c: New file.
7575 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
7576 CONSTRUCTOR_PRIORITY.
7577 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
7578 (initpri1_LDFLAGS): New variable.
7579 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
7581 2008-03-27 Ian Lance Taylor <iant@google.com>
7583 * common.cc (Sort_commons::operator): Correct sorting algorithm.
7584 * testsuite/common_test_1.c: New file.
7585 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
7586 (common_test_1_SOURCES): New variable.
7587 (common_test_1_DEPENDENCIES): New variable.
7588 (common_test_1_LDFLAGS): New variable.
7590 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
7591 and commons_ correctly when NAME/VERSION does not override
7593 * testsuite/ver_test_6.c: New file.
7594 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
7595 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
7596 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
7598 2008-03-26 Ian Lance Taylor <iant@google.com>
7600 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
7601 of an undefined symbol from a version script.
7602 * testsuite/Makefile.am (ver_test_5.so): New target.
7603 (ver_test_5.o): New target.
7604 (check_SCRIPTS): Add ver_test_5.sh.
7605 (check_DATA): Add ver_test_5.syms.
7606 (ver_test_5.syms): New target.
7607 * testsuite/ver_test_5.cc: New file.
7608 * testsuite/ver_test_5.script: New file.
7609 * testsuite/ver_test_5.sh: New file.
7610 * Makefile.in, testsuite/Makefile.in: Rebuild.
7613 Fix problems building gold with gcc 4.3.0.
7614 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
7615 (gold_error_at_location, gold_warning_at_location): Use it.
7616 * configure.ac: Check whether we can compile and use a template
7617 function with a printf attribute.
7618 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
7619 when jumping over bytes.
7620 * object.cc: Instantiate Object::read_section_data.
7621 * debug.h: Include <cstring>
7622 * dwarf_reader.cc: Include <algorithm>
7623 * main.cc: Include <cstring>.
7624 * options.cc: Include <cstring>.
7625 * output.cc: Include <cstring>.
7626 * script.cc: Include <cstring>.
7627 * script.h: Include <string>.
7628 * symtab.cc: Include <cstring> and <algorithm>.
7629 * target-select.cc: Include <cstring>.
7630 * version.cc: Include <string>.
7631 * testsuite/testmain.cc: Include <cstdlib>.
7632 * configure, config.in: Rebuild.
7634 2008-03-25 Ian Lance Taylor <iant@google.com>
7636 * options.cc: Include "../bfd/bfdver.h".
7637 (options::help): Print bug reporting address.
7639 * version.cc (print_version): Adjust output for current value of
7644 * options.cc (options::help): Print list of supported targets.
7645 * target-select.h: Include <vector>.
7646 (class Target_selector): Make machine_, size_, and is_big_endian_
7647 fields const. Add bfd_name_ and instantiated_target_ fields.
7648 (Target_selector::Target_selector): Add bfd_name parameter.
7649 (Target_selector::recognize): Make non-virtual, call
7651 (Target_selector::recognize_by_name): Make non-virtual, call
7652 do_recognize_by_name.
7653 (Target_selector::supported_names): New function.
7654 (Target_selector::bfd_name): New function.
7655 (Target_selector::do_instantiate_target): New pure virtual
7657 (Target_selector::do_recognize): New virtual function.
7658 (Target_selector::do_recognize_by_name): New virtual function.
7659 (Target_selector::instantiate_target): New private function.
7660 (supported_target_names): Declare.
7661 * target-select.cc (Target_selector::Target_selector): Update for
7662 new parameter and fields.
7663 (select_target_by_name): Check that the name matches before
7664 calling recognize_by_name.
7665 (supported_target_names): New function.
7666 * i386.cc (class Target_selector_i386): Update Target_selector
7667 constructor call. Remove recognize and recognize_by_name. Add
7668 do_instantiate_target.
7669 * x86_64.cc (class Target_selector_x86_64): Likewise.
7670 * testsuite/testfile.cc (class Target_selector_test): Update for
7671 changes to Target_selector.
7673 * README: Rewrite, with some notes on unsupported features.
7675 2008-03-24 Cary Coutant <ccoutant@google.com>
7677 * i386.cc (Target_i386::Got_type): New enum declaration.
7678 (Target_i386::Scan::local): Updated callers of Output_data_got
7680 (Target_i386::Scan::global): Likewise.
7681 (Target_i386::Relocate::relocate): Likewise.
7682 (Target_i386::Relocate::relocate_tls): Likewise.
7683 * object.h (Got_offset_list): New class.
7684 (Sized_relobj::local_has_got_offset): Added got_type parameter.
7685 (Sized_relobj::local_got_offset): Likewise.
7686 (Sized_relobj::set_local_got_offset): Likewise.
7687 (Sized_relobj::local_has_tls_got_offset): Removed.
7688 (Sized_relobj::local_tls_got_offset): Removed.
7689 (Sized_relobj::set_local_tls_got_offset): Removed.
7690 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
7691 * output.cc (Output_data_got::add_global): Added got_type parameter.
7692 (Output_data_got::add_global_with_rel): Likewise.
7693 (Output_data_got::add_global_with_rela): Likewise.
7694 (Output_data_got::add_global_pair_with_rel): New function.
7695 (Output_data_got::add_global_pair_with_rela): New function.
7696 (Output_data_got::add_local): Added got_type parameter.
7697 (Output_data_got::add_local_with_rel): Likewise.
7698 (Output_data_got::add_local_with_rela): Likewise.
7699 (Output_data_got::add_local_pair_with_rel): New function.
7700 (Output_data_got::add_local_pair_with_rela): New function.
7701 (Output_data_got::add_global_tls): Removed.
7702 (Output_data_got::add_global_tls_with_rel): Removed.
7703 (Output_data_got::add_global_tls_with_rela): Removed.
7704 (Output_data_got::add_local_tls): Removed.
7705 (Output_data_got::add_local_tls_with_rel): Removed.
7706 (Output_data_got::add_local_tls_with_rela): Removed.
7707 * output.h (Output_data_got::add_global): Added got_type parameter.
7708 (Output_data_got::add_global_with_rel): Likewise.
7709 (Output_data_got::add_global_with_rela): Likewise.
7710 (Output_data_got::add_global_pair_with_rel): New function.
7711 (Output_data_got::add_global_pair_with_rela): New function.
7712 (Output_data_got::add_local): Added got_type parameter.
7713 (Output_data_got::add_local_with_rel): Likewise.
7714 (Output_data_got::add_local_with_rela): Likewise.
7715 (Output_data_got::add_local_pair_with_rel): New function.
7716 (Output_data_got::add_local_pair_with_rela): New function.
7717 (Output_data_got::add_global_tls): Removed.
7718 (Output_data_got::add_global_tls_with_rel): Removed.
7719 (Output_data_got::add_global_tls_with_rela): Removed.
7720 (Output_data_got::add_local_tls): Removed.
7721 (Output_data_got::add_local_tls_with_rel): Removed.
7722 (Output_data_got::add_local_tls_with_rela): Removed.
7723 * resolve.cc (Symbol::override_base_with_special): Removed
7724 reference to has_got_offset_ field.
7725 * symtab.cc (Symbol::init_fields): Replaced initialization
7726 of got_offset_ with got_offsets_. Removed initialization
7728 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
7729 (Symbol::got_offset): Likewise.
7730 (Symbol::set_got_offset): Likewise.
7731 (Symbol::has_tls_got_offset): Removed.
7732 (Symbol::tls_got_offset): Removed.
7733 (Symbol::set_tls_got_offset): Removed.
7734 (Symbol::got_offset_): Removed.
7735 (Symbol::tls_mod_got_offset_): Removed.
7736 (Symbol::tls_pair_got_offset_): Removed.
7737 (Symbol::got_offsets_): New field.
7738 (Symbol::has_got_offset): Removed.
7739 (Symbol::has_tls_mod_got_offset): Removed.
7740 (Symbol::has_tls_pair_got_offset): Removed.
7741 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
7742 (Target_x86_64::Scan::local): Updated callers of Output_data_got
7744 (Target_x86_64::Scan::global): Likewise.
7745 (Target_x86_64::Relocate::relocate): Likewise.
7746 (Target_x86_64::Relocate::relocate_tls): Likewise.
7748 2008-03-25 Ben Elliston <bje@au.ibm.com>
7750 * yyscript.y: Fix spelling error in comment.
7752 2008-03-24 Ian Lance Taylor <iant@google.com>
7754 * options.h (class General_options): Define build_id option.
7755 * layout.h (class Layout): Declare write_build_id, create_note,
7756 create_build_id. Add build_id_note_ member.
7757 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
7758 "libiberty.h", "md5.h", "sha1.h".
7759 (Layout::Layout): Initialize eh_frame_data_,
7760 eh_frame_hdr_section_, and build_id_note_.
7761 (Layout::finalize): Call create_build_id.
7762 (Layout::create_note): New function, broken out of
7763 Layout::create_gold_note.
7764 (Layout::create_gold_note): Call create_note.
7765 (Layout::create_build_id): New function.
7766 (Layout::write_build_id): New function.
7767 (Close_task_runner::run): Call write_build_id.
7769 * x86_64.cc: Correct license to GPLv3.
7771 2008-03-23 Ian Lance Taylor <iant@google.com>
7773 * options.cc: Include "demangle.h".
7774 (parse_optional_string): New function.
7775 (parse_long_option): Handle takes_optional_argument.
7776 (parse_short_option): Update dash_z initializer. Handle
7777 takes_optional_argument.
7778 (General_options::General_options): Initialize do_demangle_.
7779 (General_options::finalize): Set do_demangle_. Handle demangling
7781 * options.h (parse_optional_string): Declare.
7782 (struct One_option): Add optional_arg field. Update constructor.
7783 Update call constructor calls. Add takes_optional_argument
7785 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
7786 (DEFINE_optional_string): Define.
7787 (General_options::demangle): Change from DEFINE_bool to
7788 DEFINE_optional_string.
7789 (General_options::no_demangle): New function.
7790 (General_options::do_demangle): New function.
7791 (General_options::set_do_demangle): New function.
7792 (General_options::execstack_status_): Move definition to end of
7794 (General_options::static_): Likewise.
7795 (General_options::do_demangle_): New field.
7796 * object.cc (big_endian>::get_symbol_location_info): Call
7797 Options::do_demangle, not Options::demangle.
7798 * symtab.cc (demangle): Likewise.
7800 2008-03-22 Ian Lance Taylor <iant@google.com>
7802 * gold.h: Include <cstddef> and <sys/types.h>
7803 * options.h: Include <cstring>.
7805 2008-03-21 Ian Lance Taylor <iant@google.com>
7807 * Added source code to GNU binutils.