1 2010-01-14 Sriraman Tallam <tmsriram@google.com>
3 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
4 in the first pass of do_layout.
6 2010-01-13 Doug Kwan <dougkwan@google.com>
8 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10 apparent compiler problem of not folding static constant integral
11 data members of elfcpp::Elf_sizes<32>.
13 2010-01-13 Doug Kwan <dougkwan@google.com>
15 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
16 Arm_relobj::section_needs_cortex_a8_stub_scanning,
17 Arm_relobj::scan_section_for_cortex_a8_erratum,
18 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
19 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
20 sections to scan for relocation stubs into a new method
21 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
22 relocation and Cortex-A8 stub scanning.
23 (Target_arm::do_relax): Force stubs to be after stubbed sections
24 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
25 the beginning of a new relaxation pass. Update a comment.
26 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
28 2010-01-12 Ian Lance Taylor <iant@google.com>
30 * target-reloc.h (visibility_error): New inline function.
31 (relocate_section): Call visibility_error.
32 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
33 (MOSTLYCLEANFILES): Likewise.
34 (protected_4_pic.o, protected_3.err): New targets.
35 * testsuite/protected_4.cc: New file.
37 2010-01-12 Doug Kwan <dougkwan@google.com>
39 * arm.cc (Cortex_a8_reloc): New class.
40 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
41 and cortex_a8_relocs_info_.
42 (Target_arm::fix_cortex_a8): New method definition.
43 (Target_arm::Cortex_a8_relocs_info): New type.
44 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
45 New data member declarations.
46 (Target_arm::scan_reloc_for_stub): Record information about
47 relocations for THUMB branches that might be exempted from the
49 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
50 at the beginning of a relaxation pass.
52 2010-01-12 Doug Kwan <dougkwan@google.com>
54 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
55 (Arm_relobj::Mapping_symbol_position,
56 Arm_reloj::Mapping_symbol_position_less,
57 Arm_relobj::Mapping_symbols_info): New types.
58 (Target_arm::is_mapping_symbol_name): New method definition.
59 (Arm_relobj::do_count_local_symbols): Save information about mapping
62 2010-01-11 Doug Kwan <dougkwan@google.com>
64 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
65 Arm_relocate_functions::thumb32_branch_upper,
66 Arm_relocate_functions::thumb32_branch_lower,
67 Arm_relocate_functions::thumb32_cond_branch_offset,
68 Arm_relocate_functions::thumb32_cond_branch_upper,
69 Arm_relocate_functions::thumb32_cond_branch_lower,
70 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
71 branch offset encoding.
72 (Arm_relocate_functions::thumb_branch_common): Use new branch
73 offset encoding methods to avoid code duplication.
74 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
75 (Stub_addend_reader::operator()): Use new branch encoding method
76 to avoid code duplication.
78 2010-01-11 Doug Kwan <dougkwan@google.com>
80 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
81 (Target_arm::do_finalize_sections): Define special EXIDX section
82 symbols only if referenced.
83 * gc.h (Garbage_collection::add_reference): New method.
84 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
87 2010-01-11 Ian Lance Taylor <iant@google.com>
89 * script.cc (Version_script_info::build_expression_list_lookup):
90 Change complaing about duplicate wildcard match from error to
93 * script.cc (class Lazy_demangler): Recreate--revert part of patch
95 (Version_script_info::Version_script_info): Initialize globs_,
96 default_version_, default_is_global_, and exact_. Don't
97 initialize globals_ or locals_.
98 (Version_script_info::build_lookup_tables): Build local symbols
100 (Version_script_info::unquote): New function.
101 (Version_script_info::add_exact_match): New function.
102 (Version_script_info::build_expression_list_lookup): Remove lookup
103 parameter. Add is_global parameter. Change all callers. Handle
104 wildcard pattern specially. Unquote pattern. Call
106 (Version_script_info::get_name_to_match): New function.
107 (Version_script_info::get_symbol_version): New function.
108 (Version_script_info::get_symbol_version_helper): Remove.
109 (Version_script_info::check_unmatched_names): Call unquote.
110 * script.h (class Version_script_info): Change get_symbol_version
111 to be non-inline and add is_global parameter; change all callers.
112 Rewrite symbol_is_local. Update declarations. Define struct
113 Version_tree_match, Exact, Globs. Don't define struct Lookup.
114 Remove globals_ and locals_ members. Add exact_, globs_,
115 default_version_, is_global_.
116 (Version_script_info::Glob): Remove pattern, add expression and
117 is_global. Update constructor. Change all callers.
118 * dynobj.cc (Versions::finalize): Mark the version symbol as the
120 (Versions::symbol_section_contents): If a symbol is undefined, or
121 defined in a dynamic object, set the version index to
123 * symtab.cc (Symbol_table::add_from_relobj): Don't call
125 (Symbol_table::add_from_pluginobj): Likewise.
126 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
128 2010-01-11 Doug Kwan <dougkwan@google.com>
130 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
131 (incremental_dump_LDADD): Add linking option for libintl.
132 * Makefile.in: Regenerate.
134 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
137 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
139 * testsuite/Makefile.in: Regenerated.
141 2010-01-10 Doug Kwan <dougkwan@google.com>
143 * options.h (DEFINE_var): Use parentheses around argument varname__
144 in macro body to avoid any unintended subsequent substitutions.
146 2010-01-10 Ian Lance Taylor <iant@google.com>
148 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
149 candidates before doing symbol resolution.
151 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
152 ODR candidates if only one is weak.
154 2010-01-08 Ian Lance Taylor <iant@google.com>
156 * script.cc (Version_script_info::build_expression_list_lookup):
157 Don't warn about ambiguous version, just record the ambiguity.
158 (Version_script_info::get_symbol_version_helper): Give error if
159 version is ambiguous.
161 2010-01-08 Doug Kwan <dougkwan@google.com>
163 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
164 prev_data_size_ and prev_addralign_. Remove initializer for
165 deleted data member has_been_changed_.
166 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
167 to determine if the table is empty.
168 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
170 (Stub_table::add_reloc_stub): Define method in class definition
171 instead of just declaring it there.
172 (Stub_table::add_cortex_a8_stub): New method definition.
173 (Stub_table::update_data_size_and_addralign): Ditto.
174 (Stub_table::finalize_stubs): Ditto.
175 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
176 (Stub_table::do_addralign_): Return address alignment in the
177 (Stub_table::do_reset_address_and_file_offset): Define method in
178 class definition instead of declaring it there. Set current data
179 size to be the data size of the previous pass.
180 (Stub_table::set_final_data_size): Use current data size as the
182 (Stub_table::relocate_stub): Change parameter type of stub from
183 Reloc_stub pointer to Stub pointer.
184 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
185 (Stub_table::Cortex_a8_stub_list): New typedef.
186 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
187 Stub_table::prev_addralign_): New data member.
188 (Arm_relobj::Arm_relobj): Initialize data member
189 section_has_cortex_a8_workaround_.
190 (Arm_relobj::section_has_cortex_a8_workaround,
191 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
193 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
195 (Target_arm::relocate_stub): Change parameter type of stub from
196 Reloc_stub pointer to Stub pointer.
197 (Insn_template::size, Insn_template::alignment): Handle
198 THUMB16_SPECIAL_TYPE.
199 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
200 Stub_table::update_data_size_and_addralign,
201 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
203 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
204 (Stub_table::do_write): Ditto.
205 (Target_arm::do_relax): Adjust code for changes in Stub_table.
207 2010-01-08 Ian Lance Taylor <iant@google.com>
210 * symtab.h (class Symbol): Remove fields is_target_special_ and
211 has_plt_offset_. Add field is_defined_in_discarded_section_.
212 (Symbol::is_defined_in_discarded_section): New function.
213 (Symbol::set_is_defined_in_discarded_section): New function.
214 (Symbol::has_plt_offset): Rewrite.
215 (Symbol::set_plt_offset): Verify that new offset is not -1U.
216 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
217 Don't initialize is_target_special_ or has_plt_offset_.
218 Initialize is_defined_in_discarded_section_.
219 (Symbol_table::add_from_relobj): If appropriate, set
220 is_defined_in_discarded_section.
221 * resolve.cc (Symbol::override_base_with_special): Don't test
222 is_target_special_. Change has_plt_offset_ to has_plt_offset().
223 * target-reloc.h (relocate_section): Do special handling for
224 symbols defined in discarded sections for global symbols as well
227 2010-01-08 Ian Lance Taylor <iant@google.com>
229 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
232 2010-01-08 Ian Lance Taylor <iant@google.com>
234 * object.cc (Sized_relobj::do_layout): Don't get confused if
235 layout_eh_frame returns NULL.
237 2010-01-08 Ian Lance Taylor <iant@google.com>
240 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
241 dynamic symbol table, use the normal symbol table.
242 (Sized_dynobj::do_read_symbols): Remove assertion about type of
245 2010-01-08 Ian Lance Taylor <iant@google.com>
248 * layout.cc (Layout::include_section): Remove .gnu_debuglink
251 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
253 * version.cc (print_version): Change to "Copyright 2010".
255 2010-01-08 Ian Lance Taylor <iant@google.com>
259 * i386.cc (class Target_i386): Change return type of plt_section
261 (class Output_data_plt_i386): Add tls_desc_rel_ field.
262 (Output_data_plt_i386::Output_data_plt_i386): Initialize
264 (Output_data_plt_i386::rel_tls_desc): New function.
265 (Target_i386::rel_tls_desc_section): New function.
266 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
267 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
268 R_386_TLS_DESC reloc in rel_tls_desc_section.
269 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
270 Define struct Tlsdesc_info.
271 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
272 (Target_x86_64::do_reloc_symbol_index): New function.
273 (Target_x86_64::add_tlsdesc_info): New function.
274 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
275 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
277 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
279 (Output_data_plt_x86_64::rela_tlsdesc): New function.
280 (Target_x86_64::rela_tlsdesc_section): New function.
281 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
283 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
284 (Target_x86_64::do_reloc_addend): New function.
285 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
286 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
287 declarations. Define TARGET_CODE. Add arg field to u1_ union.
288 (Output_reloc::type): New function.
289 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
290 (Output_reloc::is_target_specific): New function.
291 (Output_reloc::target_arg): New function.
292 (class Output_reloc) [SHT_RELA]: Add four new constructors for
293 absolute relocs and target specific relocs.
294 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
296 (class Output_data_reloc) [SHT_RELA]: Likewise.
297 * output.cc (Output_reloc::Output_reloc): Add four new versions
298 for absolute relocs and target specific relocs.
299 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
300 (Output_reloc::get_symbol_index): Likewise.
301 (Output_reloc::local_section_offset): Check that local_sym_index_
302 is not TARGET_CODE or 0.
303 (Output_reloc::symbol_value): Likewise.
304 (Output_reloc::write) [SHT_RELA]: Call target for target specific
306 * target.h (class Target): Add reloc_symbol_index and reloc_addend
307 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
309 * layout.cc (add_target_dynamic_tags): Use output section for
310 DT_PLTRELSZ and DT_JMPREL.
312 2010-01-07 Ian Lance Taylor <iant@google.com>
315 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
317 (class Output_data_reloc_generic): Define.
318 (class Output_data_reloc_base): Change base class to
319 Output_data_reloc_generic. Change add() method to call
320 bump_relative_reloc_count for a relative reloc. Remove
322 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
324 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
325 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
327 * layout.h (class Layout): Update declaration.
329 2010-01-07 Ian Lance Taylor <iant@google.com>
331 * output.h (class Output_data): Add const version of
332 output_section and do_output_section.
333 (class Output_section_data): Add const version of
335 (class Output_section): Likewise.
336 * layout.cc (Layout::add_target_dynamic_tags): New function.
337 * layout.h (class Layout): Update declarations.
338 * arm.cc (Target_arm::do_finalize_sections): Use
339 add_target_dynamic_tags.
340 * i386.cc (Target_i386::do_finalize_sections): Likewise.
341 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
342 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
343 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
345 2010-01-07 Ian Lance Taylor <iant@google.com>
348 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
351 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
352 Ian Lance Taylor <iant@google.com>
355 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
356 Xindex::read_symtab_xindex.
358 2010-01-07 Doug Kwan <dougkwan@google.com>
360 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
361 (Insn_template::thumb16_bcond_insn): New method declaration.
362 (Insn_template): Fix spelling.
363 (Stub::thumb16_special): New method declaration.
364 (Stub::do_write): Define virtual method which was previously pure
366 (Stub::do_thumb16_special): New method declaration.
367 (Stub::do_fixed_endian_write): New template member.
368 (Reloc_stub::do_write): Remove.
369 (Reloc_stub::do_fixed_endian_write): Remove.
370 (Cortex_a8_stub): New class definition.
371 (Stub_factory::make_cortex_a8_stub): New method definition.
372 (Stub_factory::Stub_factory): Add missing static storage class
373 qualifier for elf32_arm_stub_a8_veneer_blx.
375 2010-01-07 Ian Lance Taylor <iant@google.com>
378 * options.h (class General_options): Add --warn-unresolved-symbols
379 and --error-unresolved-symbols.
380 * errors.cc (Errors::undefined_symbol): Implement
381 --warn-unresolved-symbols.
383 * options.h (class General_options): Add -z text and -z textoff.
384 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
386 2010-01-06 Sriraman Tallam <tmsriram@google.com>
388 * gc.h (Garbage_collection::Cident_section_map): New typedef.
389 (Garbage_collection::cident_sections): New function.
390 (Garbage_collection::add_cident_section): New function.
391 (Garbage_collection::cident_sections_): New member.
392 (gc_process_relocs): Add references to sections whose names are C
394 * gold.h (cident_section_start_prefix): New constant.
395 (cident_section_stop_prefix): New constant.
396 (is_cident): New function.
397 * layout.cc (Layout::define_section_symbols): Replace string constants
398 with the newly defined constants.
399 * object.cc (Sized_relobj::do_layout): Track sections whose names are
401 * testsuite/Makefile.am: Add gc_orphan_section_test.
402 * testsuite/Makefile.in: Regenerate.
403 * testsuite/gc_orphan_section_test.cc: New file.
404 * testsuite/gc_orphan_section_test.sh: New file.
406 2010-01-06 Ian Lance Taylor <iant@google.com>
409 * options.h (class General_options): Add --warn-shared-textrel.
410 * layout.cc (Layout::finish_dynamic_section): Implement
411 --warn-shared-textrel.
414 * options.h (class General_options): Add --warn-multiple-gp.
416 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
418 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
419 $(THREADSLIB) and $(LIBDL).
420 * Makefile.in: Rebuild.
422 2010-01-06 Ian Lance Taylor <iant@google.com>
425 * options.cc (General_options::parse_section_start): New function.
426 (General_options::section_start): New function.
427 (General_options::General_options): Initialize all members.
428 * options.h: Include <map>
429 (class General_options): Add --section-start. Add section_starts_
431 * layout.cc (Layout::attach_allocated_section_to_segment): If
432 --section-start was used, set the address of the segment. Remove
434 (Layout::relaxation_loop_body): If the address of the load segment
435 has been set by --section-start, don't use it.
436 * output.h (Output_segment::update_flags_for_output_section): New
438 * output.cc (Output_segment::add_output_section): Call
439 update_flags_for_output_section.
441 2010-01-05 Ian Lance Taylor <iant@google.com>
444 * options.h (class General_options): Add --undefined-version.
445 * script.cc (struct Version_expression): Add was_matched_by_symbol
447 (Version_script_info::matched_symbol): New function.
448 (Version_script_info::get_symbol_version_helper): Call
450 (Version_script_info::check_unmatched_names): New function.
451 * script.h (class Version_script_info): Update declarations.
452 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
454 * options.h (class General_options): Use DEFINE_bool_alias for
455 allow_multiple_definition.
456 * resolve.cc (Symbol_table::should_override): Don't test
457 allow_multiple_definition.
460 * options.h (class General_options): Add --cref.
461 * main.cc (main): Print cref table if --cref. Don't close mapfile
462 until after printing cref table.
463 * cref.cc: Include "symtab.h".
464 (class Cref_inputs): Define Cref_table_compare and Cref_table.
465 (Cref_table_compare::operator()): New function.
466 (Cref_inputs::gather_cref): New function.
467 (filecol): New static const.
468 (Cref_inputs::print_cref): New function.
469 (Cref::print_cref): New function.
470 * cref.h: Include <cstdio>.
471 (class Cref): Update declarations.
472 * mapfile.h (Mapfile::file): New function.
473 * object.h (class Object): Define Symbols. Declare virtual
474 do_get_global_symbols.
475 (Object::get_global_symbols): New function.
476 * object.cc (Input_objects::add_object): Pass object to cref_ if
478 (Input_objects::archive_start): Likewise.
479 (Input_objects::archive_stop): Likewise.
480 (Input_objects::print_cref): New function.
481 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
482 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
484 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
486 * plugin.h (class Sized_pluginobj): Update declarations.
488 2010-01-05 Ian Lance Taylor <iant@google.com>
490 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
491 to is_default_version. Rename insdef to insdefault.
492 (Symbol_table::add_from_relobj): Rename def to is_default_version
493 and local to is_forced_local.
494 (Symbol_table::add_from_pluginobj): Likewise.
495 (Symbol_table::add_from_dynobj): Likewise.
496 (Symbol_table::define_special_symbol): Rename insdef to
499 2010-01-04 Ian Lance Taylor <iant@google.com>
502 * options.h (class General_options): Add
503 --allow-multiple-definition and -z muldefs.
504 * resolve.cc (Symbol_table::should_override): Don't warn about a
505 multiple symbol definition if --allow-multiple-definition or -z
509 * options.h (class General_options): Add --add-needed and
510 --copy-dt-needed-entries. Tweak --as-needed help entry.
511 * object.cc (Input_objects::check_dynamic_dependencies): Give an
512 error if --copy-dt-needed-entries aka --add-needed is used and
513 would cause a change in behaviour.
516 * options.h (class General_options): Add -G as a short version of
517 --shared. Add no-op options -assert, -g, and -i.
519 2010-01-04 Sriraman Tallam <tmsriram@google.com>
521 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
522 check for .text or .gnu.linkonce.t sections.
523 * icf.cc (Icf::find_identical_sections): Ditto.
524 Change the detection for mangled function name within the section
526 * icf.h (is_section_foldable_candidate): New function.
528 2009-12-30 Ian Lance Taylor <iant@google.com>
531 * options.h (class General_options): Permit two dashes with
532 --retain-symbols-file.
534 2009-12-30 Ian Lance Taylor <iant@google.com>
537 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
538 don't put the file header and segment headers in the text
542 * common.cc (Sort_commons::operator()): Stabilize sort when both
544 (Symbol_table::do_allocate_commons_list): When allocating common
545 symbols, skip a symbol which is no longer common.
546 * symtab.h (Symbol::is_common): Test whether the symbol comes from
547 an object before checking its type.
548 * testsuite/common_test_2.c: New file.
549 * testsuite/common_test_3.c: New file.
550 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
551 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
552 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
553 (common_test_2_pic.o, common_test_2.so): New targets.
554 (common_test_3_pic.o, common_test_3.so): New targets.
555 * testsuite/Makefile.in: Rebuild.
558 * script.cc (read_input_script): If we see a new SECTIONS clause,
559 and we have added an input section, give an error.
560 * layout.h (class Layout): Add have_added_input_section function.
561 Add have_added_input_section_ field.
562 * layout.cc (Layout::Layout): Initialize
563 have_added_input_section_.
564 (Layout::layout): Set have_added_input_section_.
565 (Layout::layout_eh_frame): Likewise.
567 2009-12-30 Ian Lance Taylor <iant@google.com>
570 * options.h (class General_options): Add --sort-common option.
571 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
572 * common.cc (Sort_common): Add sort_order parameter to
573 constructor. Add sort_order_ field.
574 (Sort_commons::operator): Check sort_order_.
575 (Symbol_table::allocate_commons): Determine the sort order.
576 (Symbol_table::do_allocate_commons): Add sort_order parameter.
578 (Symbol_table::do_allocate_commons_list): Likewise.
580 2009-12-30 Ian Lance Taylor <iant@google.com>
583 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
584 symbols from this object, don't change the visibility of an
586 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
588 2009-12-30 Ian Lance Taylor <iant@google.com>
591 * script.h (class Version_script_info): Define Language enum.
592 Update declarations. Define Glob, Exact, and Lookup types. Add
593 new fields globals_, locals_, and is_finalized_.
594 * script.cc: Various formatting fixes.
595 (class Parser_closure): Change language_stack_ from a vector of
596 std::string to one of Version_script_info::Language. Adjust all
598 (class Lazy_demangler): Remove.
599 (struct Version_expression): Change language from std::string to
600 Version_script_info::Language.
601 (Version_script_info::Version_script_info): New function.
602 (Version_script_info::~Version_script_info): Don't call clear.
603 (Version_script_info::finalize): New function.
604 (Version_script_info::build_lookup_tables): New function.
605 (Version_script_info::build_expression_list_lookup): New
607 (Version_script_info::get_symbol_version_helper): Rewrite to use
609 (Version_script_info::print_expression_list): Adjust to use
610 Version_script_info::Language.
611 (script_push_lex_into_version_mode): Check that the version script
612 has not been finalized.
613 (version_script_push_lang): Change language string to
614 Version_script_info::Language.
615 * options.cc (Command_line::version_script): New function.
616 * options.h (class General_options): Add finalize_dynamic_list
617 function. Change version_script from declaration to definition.
618 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
619 * testsuite/version_script.map: Remove duplicate def of foo.
620 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
622 * testsuite/Makefile.in: Rebuild.
624 2009-12-30 Ian Lance Taylor <iant@google.com>
627 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
628 if the input symbol index is 0, make the output symbol index 0.
630 2009-12-30 Ian Lance Taylor <iant@google.com>
633 * options.h (class General_options): Add -x/--discard-all.
634 * object.cc (Sized_relobj::do_count_local_symbols): Handle
635 --discard-all. If the local symbol needs a dynamic entry, check
636 that before handling --discard-locals.
638 2009-12-30 Ian Lance Taylor <iant@google.com>
641 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
643 (Output_segment::add_output_section): Don't change the flags if
647 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
648 GNU hash table if they need a dynamic value. Otherwise, don't add
649 them if they are defined in a dynamic object or are forced local.
651 2009-12-29 Ian Lance Taylor <iant@google.com>
654 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
655 .gnu.hash table for a 32-bit target.
658 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
659 regular and a dynamic object only needs a dynamic symbol table
660 entry if it is externally visible.
663 * i386.cc (class Target_i386): Initialize global_offset_table_ in
664 constructor. Add global_offset_table_ field.
665 (Target_i386::got_section): Set global_offset_table_.
666 (Target_i386::do_finalize_sections): Set global_offset_table_
668 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
669 in constructor. Add global_offset_table_ field.
670 (Target_x86_64::got_section): Set global_offset_table_.
671 (Target_x86_64::do_finalize_sections): Set global_offset_table_
674 * layout.cc (Layout::Layout): Initialize increase_relro_.
675 (Layout::get_output_section): Add is_relro, is_last_relro, and
676 is_first_non_relro parameters. Change all callers.
677 (Layout::choose_output_section): Likewise.
678 (Layout::add_output_section_data): Likewise.
679 (Layout::make_output_section): Likewise.
680 (Layout::set_segment_offsets): Clear increase_relro when using a
682 * layout.h (class Layout): Add increase_relro method. Add
683 increase_relro_ field. Update declarations.
684 * output.cc (Output_section::Output_section): Initialize
685 is_last_relro_ and is_first_non_relro_.
686 (Output_segment::add_output_section): Group relro sections is
687 do_sort is true. Handle is_last_relro and is_first_non_relro.
688 (Output_segment::maximum_alignment): Remove relro handling.
689 (Output_segment::set_section_addresses): Add increase_relro
690 parameter. Change all callers. Add initial alignment to align
691 relro sections on separate page. Remove old relro handling.
692 (Output_segment::set_section_list_addresses): Remove in_relro
693 parameter. Change all callers.
694 (Output_segment::set_offset): Add increase parameter. Change all
695 callers. Remove old relro handling.
696 * output.h (class Output_section): Add new methods: is_last_relro,
697 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
698 Add is_last_relro_ and is_first_non_relro_ fields.
699 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
700 Create separate .got.plt section. Call increase_relro.
701 * x86_64.cc (Target_x86_64::got_section): Likewise.
702 * testsuite/relro_script_test.t: Add .got.plt.
705 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
706 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
707 (Layout::finalize): Call set_dynamic_symbol_size.
708 (Layout::set_dynamic_symbol_size): New function.
709 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
710 set_dynamic_symbol_size.
713 * output.h (class Output_section): Add is_entsize_zero_ field.
714 * output.cc (Output_section::Output_section): Initialize
716 (Output_section::set_entsize): If two different entsizes are
717 requested, force it to zero.
718 (Output_section::add_input_section): Set flags for .debug_str
719 before updating section flags. Set entsize.
720 (Output_section::update_flags_for_input_section): Set SHF_MERGE
721 and SHF_STRING if all input sections have those flags.
723 2009-12-29 Rafael Espindola <espindola@google.com>
725 * main.cc (main): Fix the sys time reporting.
726 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
729 2009-12-29 Sriraman Tallam <tmsriram@google.com>
731 * options.cc (General_options::parse_version): Allow -v to exit
732 without an error if there is nothing to link.
734 2009-12-29 Ian Lance Taylor <iant@google.com>
736 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
737 using a version of gcc before 4.1.
738 * configure: Rebuild.
740 2009-12-28 Chris Demetriou <cgd@google.com>
742 * attributes.cc (Output_attributes_section_data::do_write): Use
743 std::vector::front rather than std::vector::data.
745 2009-12-28 Ian Lance Taylor <iant@google.com>
747 * symtab.h (class Symbol_table): Add enum Defined.
748 * resolve.cc (Symbol_table::should_override): Add defined
749 parameter. Change all callers. Test whether object is NULL
750 before calling a method on it.
751 (Symbol_table::report_resolve_problem): Add defined parameter.
753 (Symbol_table::should_override_with_special): Likewise.
754 * symtab.cc (Symbol_table::define_in_output_data): Add defined
755 parameter. Change all callers.
756 (Symbol_table::do_define_in_output_data): Likewise.
757 (Symbol_table::define_in_output_segment): Likewise.
758 (Symbol_table::do_define_in_output_segment): Likewise.
759 (Symbol_table::define_as_constant): Likewise.
760 (Symbol_table::do_define_as_constant): Likewise.
761 * script.h (class Symbol_assignment): Add is_defsym parameter to
762 constructor; change all callers.
763 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
764 parameter. Change all callers. Add is_defsym_ field.
765 (class Parser_closure): Add parsing_defsym parameter to
766 constructor; change all callers. Add parsing_defsym accessor
767 function. Add parsing_defsym_ field.
769 2009-12-28 Ian Lance Taylor <iant@google.com>
771 * gold.cc (queue_middle_tasks): Fix formatting.
772 * object.cc (Relobj::is_section_name_included): Likewise.
774 2009-12-23 Ian Lance Taylor <iant@google.com>
776 * i386.cc (Target_i386::do_calls_non_split): Recognize
777 -fsplit-stack prologue for a function with a static chain.
778 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
779 -fsplit-stack prologue when using %r11.
781 2009-12-21 Sriraman Tallam <tmsriram@google.com>
783 * options.cc (General_options::parse_version): Make -v continue and do
784 the link like GNU ld does.
786 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
788 * Makefile.am (CCFILES): Add timer.cc.
789 (HFILES): Add timer.h.
790 * configure.ac: Check for sysconf and times.
791 * main.cc: include timer.h.
792 (main): Use Timer instead of get_run_time.
795 * workqueue.cc: include timer.h.
796 (Workqueue::find_and_run_task):
797 Report user, sys and wall time.
798 * Makefile.in: Regenerate.
799 * config.in: Regenerate.
800 * configure: Regenerate.
802 2009-12-16 Doug Kwan <dougkwan@google.com>
804 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
806 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
807 relaxed input sections.
808 * output.cc (Output_section::find_relaxed_input_section): Change
809 return type to Output_relaxed_input_section pointer. Adjust code
810 for new type of relaxed_input_section_map_.
811 * output.h (Output_section::find_relaxed_input_section): Change
812 return type to Output_relaxed_input_section pointer.
813 (Output_section::Output_relaxed_input_section_by_input_section_map):
815 (Output_section::relaxed_input_section_map_): Change type to
816 Output_section::Output_relaxed_input_section_by_input_section_map.
817 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
820 2009-12-15 Ian Lance Taylor <iant@google.com>
822 * layout.cc (Layout::create_shstrtab): Only write out after input
823 sections if we are compressing debug sections.
825 2009-12-15 Ian Lance Taylor <iant@google.com>
827 * archive.cc (Archive::add_symbols): Only look up a symbol without
828 a version if there is, in fact, a version.
830 2009-12-14 Ian Lance Taylor <iant@google.com>
832 Revert -Wshadow changes, all changes from:
833 2009-12-11 Doug Kwan <dougkwan@google.com>
834 2009-12-11 Nick Clifton <nickc@redhat.com>
835 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
837 2009-12-11 Doug Kwan <dougkwan@google.com>
839 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
841 * attributes.cc (Object_attribute::size): Ditto.
842 (Attributes_section_data::size): Ditto.
843 (Attributes_section_data::Attributes_section_data): Ditto.
844 (Output_attributes_section_data::do_write): Ditto.
845 * attributes.h (Object_attribute::set_type): Ditto.
846 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
848 2009-12-11 Nick Clifton <nickc@redhat.com>
850 * archive.cc: Fix shadowed variable warnings.
852 * compressed_output.cc: Likewise.
853 * compressed_output.h: Likewise.
854 * configure: Likewise.
855 * dwarf_reader.cc: Likewise.
856 * dynobj.cc: Likewise.
857 * dynobj.h: Likewise.
858 * ehframe.cc: Likewise.
859 * ehframe.h: Likewise.
860 * errors.cc: Likewise.
861 * expression.cc: Likewise.
862 * fileread.cc: Likewise.
863 * fileread.h: Likewise.
864 * freebsd.h: Likewise.
867 * incremental.h: Likewise.
868 * layout.cc: Likewise.
869 * layout.h: Likewise.
870 * mapfile.cc: Likewise.
871 * merge.cc: Likewise.
873 * object.cc: Likewise.
874 * object.h: Likewise.
875 * options.h: Likewise.
876 * output.cc: Likewise.
877 * output.h: Likewise.
878 * parameters.cc: Likewise.
879 * plugin.cc: Likewise.
880 * powerpc.cc: Likewise.
881 * reduced_debug_output.cc: Likewise.
882 * reduced_debug_output.h: Likewise.
883 * reloc.cc: Likewise.
885 * resolve.cc: Likewise.
886 * script-sections.cc: Likewise.
887 * script.cc: Likewise.
888 * script.h: Likewise.
889 * sparc.cc: Likewise.
890 * symtab.cc: Likewise.
891 * symtab.h: Likewise.
892 * target-select.cc: Likewise.
893 * target-select.h: Likewise.
895 * workqueue.cc: Likewise.
896 * workqueue.h: Likewise.
897 * x86_64.cc: Likewise.
899 2009-12-10 Doug Kwan <dougkwan@google.com>
901 * arm.cc (attributes.h): New include.
902 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
903 (Arm_relobj::~Arm_relobj): Delete object pointed by
904 attributes_section_data_.
905 (Arm_relobj::attributes_section_data): New method definition.
906 (Arm_relobj::attributes_section_data_): New data member declaration.
907 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
908 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
909 attributes_section_data_.
910 (Arm_dynobj::attributes_section_data): New method definition.
911 (Arm_dynobj::attributes_section_data_): New data member declaration.
912 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
913 initialization value of may_use_blx_ to false.
914 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
915 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
916 object attributes to compute results instead of hard-coding.
917 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
918 Target_arm::get_secondary_compatible_arch,
919 Target_arm::set_secondary_compatible_arch
920 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
921 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
922 New method declarations.
923 (Target_arm::get_aeabi_object_attribute): New method definition.
924 (Target_arm::attributes_section_data_): New data member declaration.
925 (read_arm_attributes_section): New template definition.
926 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
927 (Arm_dynobj::do_read_symbols): Ditto.
928 (Target_arm::do_finalize_sections): Merge attributes sections from
929 input. Check for BLX use after attributes section merging.
930 Fix __exidx_start and __exidx_end visibility. Create an
931 .ARM.attributes section if necessary.
932 (Target_arm::get_secondary_compatible_arch,
933 Target_arm::set_secondary_compatible_arch,
934 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
935 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
936 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
937 New method definitions.
939 2009-12-09 Ian Lance Taylor <iant@google.com>
941 * plugin.cc (Plugin::load): Don't cast from void* to a function
944 2009-12-09 Ian Lance Taylor <iant@google.com>
946 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
949 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
951 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
952 Replace two_file_shared_1.so with two_file_shared_2.so.
953 * testsuite/Makefile.in: Regenerated.
955 2009-12-08 Doug Kwan <dougkwan@google.com>
957 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
958 (HFILES): Add attributes.h and int_encoding.h.
959 * Makefile.in: Regenerate.
960 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
961 function definitions to int_encoding.cc
962 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
963 prototypes to int_encoding.h
964 * reduced_debug_output.cc (int_encoding.h): New include.
965 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
966 function definitions to int_encoding.cc
967 (insert_into_vector, read_from_pointer): Move template definitions to
969 * attributes.cc: New file.
970 * attributes.h: New file.
971 * int_encoding.cc: New file.
972 * int_encoding.h: New file.
974 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
977 * incremental-dump.cc (dump_incremental_inputs): New.
978 (main): Use dump_incremental_inputs.
980 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
983 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
984 checking elfcpp::STT_FUNC.
985 (Target_i386::Relocate::relocate): Likewise.
986 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
988 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
989 symbols from shared libraries into normal FUNC symbols.
991 * symtab.h (Symbol): Add is_func and use it.
993 2009-12-05 Doug Kwan <dougkwan@google.com>
995 * arm.cc (Target_arm::arm_info): Initialize new fields
996 attributes_section and attributes_vendor.
997 * i386.cc (Target_i386::i386_info): Same.
998 * object.cc (Sized_relobj::do_layout): Skip attribute section.
999 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
1000 fields attributes_section and attributes_vendor.
1001 * sparc.cc (Target_sparc::sparc_info): Same.
1002 * target.h (Target::attributes_section, Target::attributes_vendor,
1003 Target::is_attributes_section, Target::attribute_arg_type,
1004 Target::attributes_order): New method definitions.
1005 (Target::Target_info::attributes_section,
1006 Target::Target_info::attributes_vendor): New fields.
1007 (Target::do_attribute_arg_type, Target::do_attributes_order): New
1008 virtual method definitions.
1009 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
1010 attributes_section and attributes_vendor.
1011 * testsuite/testfile.cc (Target_test::test_target_info): Same.
1013 2009-12-05 Doug Kwan <dougkwan@google.com>
1015 * arm.cc: Update comments about interworking and stub generation.
1016 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
1017 considered as non-PIC.
1018 (Arm_relocate_functions::base_abs): Fix formatting.
1019 (Arm_relocate_functions::got_prel): Fix comment. Change interface
1020 of function to use GOT entry address instead of offset.
1021 (Target_arm::Scan::global): Issue an error if a symbol would need a
1022 PLT does not get one because it is untyped. Remove code to create
1023 dynamic symbols for relative branches.
1024 (Target_arm::Relocate::relocate: Use 0 instead of false since function
1025 takes unsigned integer instead of boolean.
1027 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
1029 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1030 (two_file_test_LDADD): Likewise.
1031 (common_test_1_LDADD): Likewise.
1032 (exception_test_LDADD) Likewise.
1033 (weak_test_LDADD): Likewise.
1034 (many_sections_test_LDADD): Likewise.
1035 (initpri1_LDADD): Likewise.
1036 (script_test_1_LDADD): Likewise.
1037 (script_test_2_LDADD): Likewise.
1038 (justsyms_LDADD): Likewise.
1039 (binary_test_LDADD): Likewise.
1040 (large_LDADD): Likewise.
1041 * testsuite/Makefile.in: Regenerated.
1043 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1045 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1046 (Symbol_table::override_with_special): Likewise.
1047 (Symbol_table::add_from_object): Likewise.
1049 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1051 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1052 Don't set the data_offset twice.
1054 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
1056 * testsuite/Makefile.in: Regenerate.
1058 2009-12-03 Doug Kwan <dougkwan@google.com>
1060 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1061 (Target_arm::do_finalize_sections): Add parameter for symbol table
1062 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
1063 * i386.cc (Target_i386::do_finalize_sections): Add an additional
1064 parameter for symbol table pointer.
1065 * layout.cc (Layout::finalize): Call Target::finalize_sections with
1066 an additional parameter for a pointer to symbol table.
1067 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1068 parameter for a symbol table pointer.
1069 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1070 * target.h (Target::finalize_sections, Target::do_finalize_sections):
1072 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1073 parameter for a symbol table pointer.
1075 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
1077 * incremental.cc (Incremental_inputs_header)
1078 (Incremental_inputs_header_write, Incremental_inputs_entry)
1079 (Incremental_inputs_entry_write): Move ...
1080 * incremental.h (Incremental_inputs_header)
1081 (Incremental_inputs_header_write, Incremental_inputs_entry)
1082 (Incremental_inputs_entry_write): here.
1084 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1086 * incremental.cc (make_sized_incremental_binary): Set the target.
1087 Error if it is incompatible.
1088 * output.h (Output_file): Add filename method.
1090 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1092 * incremental.cc (Incremental_inputs_entry): Remove unused argument
1093 from the get_* methods.
1095 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1097 * incremental-dump.cc (main): Check that the offeset of a script is 0.
1098 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1099 Write 0 for the data_offset of scripts.
1101 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
1103 * testsuite/Makefile.am: Add the incremental_test.sh test.
1104 * testsuite/incremental_test.sh: New.
1105 * testsuite/incremental_test_1.c: New.
1106 * testsuite/incremental_test_2.c: New.
1108 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
1110 * incremental-dump.cc (main): Fix typos.
1112 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
1115 * incremental-dump.cc (main): Use llu to print 64 bit values.
1117 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
1118 H.J. Lu <hongjiu.lu@intel.com>
1120 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1122 (incremental_dump_LDADD): Likewise.
1123 * Makefile.in: Regenerated.
1125 2009-11-25 Doug Kwan <dougkwan@google.com>
1129 2009-11-25 Doug Kwan <dougkwan@google.com>
1131 * arm.cc (Target_arm::Target_arm): Move method definition
1132 outside of class definition. Add code to handle
1133 --target1-rel, --target1-abs and --target2= options.
1134 (Target_arm::get_reloc_reloc_type): Change method to be
1135 non-static and const.
1136 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1137 New data member declaration.
1138 (Target_arm::Scan::local, Target_arm::Scan::global,
1139 Target_arm::Relocate::relocate,
1140 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1141 Adjust call to Target_arm::get_real_reloc_type.
1142 (Target_arm::get_real_reloc_type): Use command line options
1143 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1144 * options.h (--target1-rel, --target1-abs, --target2): New
1147 2009-11-25 Doug Kwan <dougkwan@google.com>
1149 * arm.cc (Target_arm::Target_arm): Move method definition outside of
1150 class definition. Add code to handle --target1-rel, --target1-abs
1151 and --target2= options.
1152 (Target_arm::get_reloc_reloc_type): Change method to be non-static
1154 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1156 (Target_arm::Scan::local, Target_arm::Scan::global,
1157 Target_arm::Relocate::relocate,
1158 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1159 call to Target_arm::get_real_reloc_type.
1160 (Target_arm::get_real_reloc_type): Use command line options to
1161 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1162 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1165 2009-11-25 Doug Kwan <dougkwan@google.com>
1167 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1168 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1169 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1171 (Arm_relocate_functions::thm_call): Replace body with a call to
1172 Arm_relocate_functions::thumb_branch_common.
1173 (Arm_relocate_functions::thm_jump24,
1174 Arm_relocate_functions::thm_xpc22): New method definitions.
1175 (Arm_relocate_functions::thumb_branch_common): New method definition.
1176 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1178 (Target_arm::Relocate::relocate): Adjust call to thm_call.
1179 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1181 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1183 * Makefile.am: Build incremental-dump
1184 * Makefile.in: Regenerate.
1185 * incremental-dump.cc: New.
1186 * incremental.cc (Incremental_inputs_header_data,
1187 Incremental_inputs_entry_data): Move to incremental.h
1188 * incremental.h: (Incremental_inputs_header_data,
1189 Incremental_inputs_entry_data): Move from incremental.cc
1191 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1193 * incremental.cc (Incremental_inputs_header,
1194 Incremental_inputs_header_write, Incremental_inputs_entry,
1195 Incremental_inputs_entry_write): Add a typedef with the data type.
1197 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
1199 * incremental.cc (Incremental_inputs_header,
1200 Incremental_inputs_header_write, Incremental_inputs_entry,
1201 Incremental_inputs_entry_write): Update comment about which
1202 type has the filed descriptions.
1204 2009-11-15 Doug Kwan <dougkwan@google.com>
1206 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1207 (Arm_relocate_functions::arm_branch_common): Change method defintion
1208 in class definition to a method declaration and update list of formal
1210 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1211 Arm_relocation_functions::jump24): Adjust call to
1212 Arm_relocate_functions::arm_branch_common. Update list of formal
1214 (Arm_relocate_functions::xpc25): New method definition.
1215 (Arm_relocate_functions::arm_branch_common): Move method defintion
1216 out from class definition. Use stubs for mode-switching and extending
1218 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1219 specially. Change code to enable use of stubs in ARM branches.
1221 2009-11-10 Doug Kwan <dougkwan@google.com>
1223 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1224 in method declaration.
1225 (Target_arm::relocate_stub): New method declaration.
1226 (Target_arm::default_target): Change to return a pointer instead of
1228 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1229 Target_arm::default_target.
1230 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1232 (Target_arm::relocate_section): Adjust view.
1233 (Target_arm::relocate_stub): New method definition.
1235 2009-11-10 Doug Kwan <dougkwan@google.com>
1237 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1239 * incremental.cc (open_incremental_binary): Initialized local
1240 variables to avoid warnings.
1241 * object.cc (make_elf_object): Ditto.
1242 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1245 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1248 * testsuite/plugin_test.c: Include "config.h".
1250 2009-11-09 Doug Kwan <dougkwan@google.com>
1252 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1253 (arm_symbol_value): Remove.
1254 (Arm_relocate_functions::arm_branch_common,
1255 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1256 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1257 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1258 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1259 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1260 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1261 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1262 Arm_relocate_functions::thm_mobw_abs_nc,
1263 Arm_relocate_functions::thm_mov_abs,
1264 Arm_relocate_functions::movw_prel_nc,
1265 Arm_relocate_functions::thm_movt_abs,
1266 Arm_relocate_functions::movt_prel,
1267 Arm_relocate_functions::thm_movw_prel_nc,
1268 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1269 (Target_arm::Relocate::relocate): Only decompose address into two
1270 parts if relocation type uses the thumb-bit and pass the actual
1271 bit instead of a flag indicating that the thumb-bit is used. Adjust
1272 calls to methods in Arm_relocate_functions for this change.
1274 2009-11-08 Ian Lance Taylor <iant@google.com>
1277 * reloc.cc: Instantiate
1278 Sized_relobj::initialize_input_to_output_maps and
1279 Sized_relobj:free_input_to_output_maps.
1281 2009-11-06 Ian Lance Taylor <iant@google.com>
1284 * defstd.cc (in_segment): Set only_if_ref true for "end".
1286 2009-11-06 Doug Kwan <dougkwan@google.com>
1288 * arm.cc (class Reloc_stub): Correct a comment.
1289 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1290 (Target_arm::scan_section_for_stubs): New method declaration.
1291 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1292 Change methods from private to protected.
1293 (Target_arm::do_may_relax): New method definition.
1294 (Target_arm::do_relax, Target_arm::group_sections,
1295 Target_arm::scan_reloc_for_stub,
1296 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1297 (Target_arm::arm_input_section_map_): New data member declaration.
1298 (Target_arm::scan_reloc_for_stub,
1299 Target_arm::scan_reloc_section_for_stubs,
1300 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1301 Target_arm::do_relax): New method definitions.
1303 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1305 * configure.ac: Check for (struct stat)::st_mtim
1306 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1307 * config.in: Regenerate.
1308 * configure: Regenerate.
1310 2009-11-05 Ian Lance Taylor <iant@google.com>
1313 * output.cc (Output_segment::add_output_section): Add missing
1316 2009-11-04 Ian Lance Taylor <iant@google.com>
1319 * object.h (class Object): Add is_needed and set_is_needed
1320 methods. Add is_needed_ field. Make bool fields into bitfields.
1321 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1322 defined in a dynamic object and referenced by a regular object,
1323 set is_needed for the dynamic object.
1324 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1325 if the file is marked with as_needed and it is not needed.
1327 2009-11-04 Ian Lance Taylor <iant@google.com>
1330 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1331 tags if data is discarded by linker script.
1332 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1333 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1334 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1335 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1337 2009-11-04 Ian Lance Taylor <iant@google.com>
1339 * layout.cc (Layout::get_output_section): Add is_interp and
1340 is_dynamic_linker_section parameters. Change all callers.
1341 (Layout::choose_output_section): Likewise.
1342 (Layout::make_output_section): Likewise.
1343 (Layout::add_output_section_data): Add is_dynamic_linker_section
1344 parameter. Change all callers.
1345 * layout.h (class Layout): Update declarations.
1346 * output.h (class Output_section): Add is_interp, set_is_interp,
1347 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1348 Add is_interp_, is_dynamic_linker_section_ fields. Change
1349 generate_code_fills_at_write_ to a bitfield.
1350 * output.cc (Output_section::Output_sections): Initialize new
1352 (Output_segment::add_output_section): Add do_sort parameter.
1355 2009-11-03 Ian Lance Taylor <iant@google.com>
1358 * options.h (class General_options): Add --warn-common.
1359 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1360 merging two common symbols.
1361 (Symbol_table::should_override): Handle --warn-common when merging
1362 a common symbol with a defined symbol. Use report_resolve_problem
1363 for multiple definitions.
1364 (Symbol_table::report_resolve_problem): New function.
1365 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1367 2009-11-03 Doug Kwan <dougkwan@google.com>
1369 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1371 (Target_arm::stub_factory): New method definition.
1372 (Target_arm::new_arm_input_section,
1373 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1374 Target_arm::reloc_uses_thumb_bit): New method declarations.
1375 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1376 New type definitions.
1377 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1378 member declarations.
1379 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1380 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1381 New method definitions.
1383 2009-11-03 Ian Lance Taylor <iant@google.com>
1385 * options.h (class General_options): Add --warn_constructors.
1387 2009-11-03 Ian Lance Taylor <iant@google.com>
1390 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1391 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1393 2009-11-03 Ian Lance Taylor <iant@google.com>
1396 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1397 --msgid-bugs-address.
1398 (install-pdf): New target.
1399 (install-data_yes): Look up one directory to find mkinstalldirs.
1401 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1403 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1406 2009-10-30 Doug Kwan <dougkwan@google.com>
1408 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1410 2009-10-30 Doug Kwan <dougkwan@google.com>
1412 * arm.cc (Stub_addend_reader): New struct template definition
1413 and partial specializations.
1414 (Stub_addend_reader::operator()): New method definition for a
1415 partially specialized template.
1417 2009-10-30 Doug Kwan <dougkwan@google.com>
1419 * arm.cc (Arm_relobj::processor_specific_flags): New method
1421 (Arm_relobj::do_read_symbols): New method declaration.
1422 (Arm_relobj::processor_specific_flags_): New data member declaration.
1423 (Arm_dynobj): New class definition.
1424 (Target_arm::do_finalize_sections): Add input_objects parameter.
1425 (Target_arm::do_adjust_elf_header): New method declaration.
1426 (Target_arm::are_eabi_versions_compatible,
1427 (Target_arm::merge_processor_specific_flags): New method declaration.
1428 (Target_arm::do_make_elf_object): New overloaded method definitions
1430 (Arm_relobj::do_read_symbols): New method definition.
1431 (Arm_dynobj::do_read_symbols): Ditto.
1432 (Target_arm::do_finalize_sections): Add input_objects parameters.
1433 Merge processor-specific flags from all input objects.
1434 (Target_arm::are_eabi_versions_compatible,
1435 Target_arm::merge_processor_specific_flags,
1436 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1437 New method definitions.
1438 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1439 Input_objects pointer type parameter.
1440 * layout.cc (Layout::finalize): Pass input objects to target's.
1441 finalize_sections function.
1442 * output.cc (Output_file_header::do_sized_write): Set ELF file
1443 header's processor-specific flags.
1444 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1445 Input_objects pointer type parameter.
1446 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1447 * target.h (Input_objects): New forward class declaration.
1448 (Target::processor_specific_flags,
1449 Target::are_processor_specific_flags_sect): New method definitions.
1450 (Target::finalize_sections): Add input_objects parameter.
1451 (Target::Target): Initialize processor_specific_flags_ and
1452 are_processor_specific_flags_set_.
1453 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1455 (Target::set_processor_specific_flags): New method definition.
1456 (Target::processor_specific_flags_,
1457 Target::are_processor_specific_flags_set_): New data member
1459 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1460 Input_objects pointer type parameter.
1462 2009-10-30 Doug Kwan <dougkwan@google.com>
1464 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1466 2009-10-28 Ian Lance Taylor <iant@google.com>
1468 * object.h (class Relobj): Drop options parameter from
1469 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1470 do_scan_relocs, do_relocate. Change all callers.
1471 (class Sized_relobj): Drop options parameters from
1472 do_gc_process_relocs, do_scan_relocs, do_relocate,
1473 do_relocate_sections, relocate_sections, emit_relocs_scan,
1474 emit_relocs_scan_reltype. Change all callers.
1475 (struct Relocate_info): Remove options field and all references to
1477 * reloc.h (class Read_relocs): Remove options constructor
1478 parameter and options_ field. Change all callers.
1479 (class Gc_process_relocs, class Scan_relocs): Likewise.
1480 (class Relocate_task): Likewise.
1481 * target-reloc.h (scan_relocs): Remove options parameter. Change
1483 (scan_relocatable_relocs): Likewise.
1484 * target.h (class Sized_target): Remove options parameter from
1485 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1487 * gc.h (gc_process_relocs): Remove options parameter. Change all
1489 * arm.cc: Update functions to remove options parameters.
1490 * i386.cc: Likewise.
1491 * powerpc.cc: Likewise.
1492 * sparc.cc: Likewise.
1493 * x86_64.cc: Likewise.
1494 * testsuite/testfile.cc: Likewise.
1496 2009-10-28 Doug Kwan <dougkwan@google.com>
1498 * arm.cc (Arm_relobj): New class definition.
1499 (Arm_relobj::scan_sections_for_stubs,
1500 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1501 New method definitions.
1503 2009-10-28 Cary Coutant <ccoutant@google.com>
1505 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1506 (Plugin::cleanup_done_): New member.
1507 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1508 (Plugin_manager::cleanup_done_): Remove.
1509 (Plugin_manager::add_input_file): Edit error message.
1510 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1511 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1513 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1515 * fileread.cc: (File_read::View::~View): Use the new
1516 data_ownership_ filed.
1517 (File_read::~File_read): Dispose the new whole_file_view_.
1518 (File_read::open): Mmap the whole file if needed.
1519 (File_read::open): Use whole_file_view_ instead of contents_.
1520 (File_read::find_view): Use whole_file_view_ if applicable.
1521 (File_read::do_read): Use whole_file_view_ instead of contents_.
1522 (File_read::make_view): Use whole_file_view_ instead of contents_,
1523 update File_read::View::View call.
1524 (File_read::find_or_make_view): Update File_read::View::View
1526 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1528 (File_read::View::Data_ownership): New enum.
1529 (File_read::View::View): Replace bool mapped_ with Data_ownership
1531 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1532 (File_read::View::data_ownership_): New field.
1533 (File_read::contents_): Remove (replaced by whole_file_view_).
1534 (File_read::whole_file_view_): New field.
1535 * options.h (class General_options): Add --keep-files-mapped.
1537 2009-10-27 Cary Coutant <ccoutant@google.com>
1539 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1540 * testsuite/Makefile.am (plugin_test_5): New test case.
1541 * testsuite/Makefile.in: Regenerate.
1543 2009-10-25 Doug Kwan <dougkwan@google.com>
1545 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1546 from private to protected to allow access by child class.
1547 (Sized_relobj::do_relocate_sections): New method declaration.
1548 (Sized_relobj::relocate_sections): Virtualize.
1549 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1550 Sized_relobj::relocate_sections. Instantiate template explicitly
1551 for different target sizes and endianity.
1553 2009-10-24 Doug Kwan <dougkwan@google.com>
1555 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1556 (Arm_input_section::as_arm_input_section): New method.
1557 (Arm_output_section): New class definition.
1558 (Arm_output_section::create_stub_group,
1559 Arm_output_section::group_sections): New method definitions.
1561 2009-10-22 Doug Kwan <dougkwan@google.com>
1563 * arm.cc (Arm_input_section): New class definition.
1564 (Arm_input_section::init, Arm_input_section:do_write,
1565 Arm_input_section::set_final_data_size,
1566 Arm_input_section::do_reset_address_and_file_offset): New method
1569 2009-10-21 Doug Kwan <dougkwan@google.com>
1571 * arm.cc (Stub_table, Arm_input_section): New forward class
1573 (Stub_table): New class defintion.
1574 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1575 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1576 New method definition.
1578 2009-10-21 Doug Kwan <dougkwan@google.com>
1580 * arm.cc: Update copyright comments.
1581 (Target_arm): New forward class template declaration.
1582 (Arm_address): New type.
1583 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1584 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1585 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1587 (Insn_template): Same.
1588 (DEF_STUBS): New macro.
1589 (Stub_type): New enum type.
1590 (Stub_template): New class definition.
1593 (Stub_factory): Same.
1594 (Target_arm::Target_arm): Initialize may_use_blx_ and
1595 should_force_pic_veneer_.
1596 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1597 Target_arm::should_force_pic_veneer,
1598 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1599 Target_arm::using_thumb_only, Target_arm:;default_target): New
1601 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1602 New data member declarations.
1603 (Insn_template::size, Insn_template::alignment): New method defintions.
1604 (Stub_template::Stub_template): New method definition.
1605 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1606 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1607 (Stub_factory::Stub_factory): New method definition.
1608 * gold.h (string_hash): New template.
1609 * output.h (Input_section_specifier::hash_value): Use
1611 (Input_section_specifier::string_hash): Remove.
1612 * stringpool.cc (Stringpool_template::string_hash): Use
1615 2009-10-20 Doug Kwan <dougkwan@google.com>
1617 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1618 symbols of relaxed input sections.
1619 * output.h (Output_section::find_relaxed_input_section): Make
1622 2009-10-16 Doug Kwan <dougkwan@google.com>
1624 * dynobj.cc (Versions::Versions): Initialize version_script_.
1625 Only insert base version symbol definition for a shared object
1626 if version script defines any version versions.
1627 (Versions::define_base_version): New method definition.
1628 (Versions::add_def): Check that base version is not needed.
1629 (Versions::add_need): Define base version lazily.
1630 * dynobj.h (Versions::define_base_version): New method declaration.
1631 (Versions::needs_base_version_): New data member declaration.
1632 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1633 (check_DATA): Add no_version_test.stdout.
1634 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1636 * testsuite/Makefile.in: Regenerate.
1637 * testsuite/no_version_test.c: New file.
1638 * testsuite/no_version_test.sh: Ditto.
1640 2009-10-16 Doug Kwan <dougkwan@google.com>
1642 * expression.cc (class Segment_start_expression): New class definition.
1643 (Segment_start_expression::value): New method definition.
1644 (script_exp_function_segment_start): Return a new
1645 Segment_start_expression.
1646 * gold/script-c.h (script_saw_segment_start_expression): New function
1648 * script-sections.cc (Script_sections::Script_sections): Initialize
1649 SAW_SEGMENT_START_EXPRESSION_ to false.
1650 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1651 and -Tbbs options to specify section addresses if given in
1652 command line and no SEGMENT_START expression is seen in a script.
1653 * script-sections.h (Script_sections::saw_segment_start_expression,
1654 Script_sections::set_saw_segment_start_expression): New method
1656 (Script_sections::saw_segment_start_expression_): New data member
1658 * script.cc (script_saw_segment_start_expression): New function.
1659 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1660 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1661 script_test_7.sh and script_test_8.sh.
1662 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1663 script_test_8.stdout.
1664 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1665 (script_test_6, script_test_6.stdout, script_test_7,
1666 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1667 * Makefile.in: Regenerate.
1668 * testsuite/script_test_6.sh: New file.
1669 * testsuite/script_test_6.t: Same.
1670 * testsuite/script_test_7.sh: Same.
1671 * testsuite/script_test_7.t: Same.
1672 * testsuite/script_test_8.sh: Same.
1674 2009-10-16 Doug Kwan <dougkwan@google.com>
1676 * output.cc (Output_segment::set_section_list_address): Cast
1677 expressions to unsigned long long type to avoid format warnings.
1679 2009-10-15 Ian Lance Taylor <iant@google.com>
1681 * script.cc (Script_options::add_symbol_assignment): Always add a
1682 dot assignment to script_sections_.
1683 * script-sections.cc (Script_sections::add_dot_assignment):
1684 Initialize if necessary.
1686 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1687 program headers with no load segment if there is a linker script.
1689 * layout.cc (Layout::set_segment_offsets): Align the file offset
1690 to the segment aligment for -N or -n with no load segment.
1691 * output.cc (Output_segment::add_output_section): Don't crash if
1692 the first section is a TLS section.
1693 (Output_segment::set_section_list_addresses): Print an error
1694 message if the address moves backward in a linker script.
1695 * script-sections.cc
1696 (Output_section_element_input::set_section_addresses): Don't
1697 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1698 (Orphan_output_section::set_section_addresses): Likewise.
1700 2009-10-15 Doug Kwan <dougkwan@google.com>
1702 * layout.cc (Layout::finish_dynamic_section): Generate tags
1703 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1704 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1705 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1707 2009-10-14 Ian Lance Taylor <iant@google.com>
1709 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1711 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1712 data_shdr fields of relinfo.
1713 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1714 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
1715 R_386_TLS_LDO_32, adjust based on section flags.
1716 (Target_i386::Relocate::fix_up_ldo): Remove.
1718 2009-10-13 Ian Lance Taylor <iant@google.com>
1720 Add support for -pie.
1721 * options.h (class General_options): Add -pie and
1723 (General_options::output_is_position_independent): Test -pie.
1724 (General_options::output_is_executable): Return true if not shared
1725 and not relocatable.
1726 (General_options::output_is_pie): Remove.
1727 * options.cc (General_options::finalize): Reject incompatible uses
1729 * gold.cc (queue_middle_tasks): A -pie link is not static.
1730 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1731 * symtab.cc (Symbol::final_value_is_known): Return false if
1732 output_is_position_independent.
1733 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1734 output_is_position_independent.
1735 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1736 output_is_position_independent.
1737 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1738 output_is_position_independent.
1739 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1741 (basic_pie_test.o, basic_pie_test): New targets.
1742 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1743 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1744 (two_file_pie_test): New target.
1745 * testsuite/Makefile.in: Rebuild.
1746 * README: Remove note saying that -pie is not supported.
1748 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
1750 * options.h (class General_options): Add -init and -fini.
1751 * layout.cc (Layout::finish_dynamic_section): Emit
1752 given init and fini functions.
1754 2009-10-13 Sriraman Tallam <tmsriram@google.com>
1756 * gc.h (gc_process_relocs): Check if icf is enabled using new
1758 * gold.cc (queue_initial_tasks): Likewise.
1759 (queue_middle_tasks): Likewise.
1760 * object.cc (do_layout): Likewise.
1761 * symtab.cc (is_section_folded): Likewise.
1762 * main.cc (main): Likewise.
1763 * reloc.cc (Read_relocs::run): Likewise.
1764 (Sized_relobj::do_scan_relocs): Likewise.
1765 * icf.cc (is_function_ctor_or_dtor): New function.
1766 (Icf::find_identical_sections): Check if function is ctor or dtor when
1768 * options.h (General_options::icf): Change option to be an enum.
1769 (Icf_status): New enum.
1770 (icf_enabled): New method.
1771 (icf_safe_folding): New method.
1772 (set_icf_status): New method.
1773 (icf_status_): New variable.
1774 * (options.cc) (General_options::finalize): Set icf_status_.
1775 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
1776 icf_test and icf_keep_unique_test to use the --icf enum flag.
1777 * testsuite/icf_safe_test.sh: New file.
1778 * testsuite/icf_safe_test.cc: New file.
1780 2009-10-12 Sriraman Tallam <tmsriram@google.com>
1782 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
1783 includes to gc.h and icf.h.
1784 * arm.cc: Include gc.h.
1785 * gold.cc: Likewise.
1786 * i386.cc: Likewise.
1787 * powerpc.cc: Likewise.
1788 * sparc.cc: Likewise.
1789 * x86_64.cc: Likewise.
1790 * gc.h: Include icf.h.
1792 2009-10-11 Ian Lance Taylor <iant@google.com>
1794 * plugin.cc: Include "gold.h" before other header files.
1796 2009-10-10 Chris Demetriou <cgd@google.com>
1798 * options.h (Input_file_argument::Input_file_type): New enum.
1799 (Input_file_argument::is_lib_): Replace with...
1800 (Input_file_argument::type_): New member.
1801 (Input_file_argument::Input_file_argument): Take Input_file_type
1802 'type' rather than boolean 'is_lib' as second argument.
1803 (Input_file_argument::is_lib): Use type_.
1804 (Input_file_argument::is_searched_file): New function.
1805 (Input_file_argument::may_need_search): Handle is_searched_file.
1806 * options.cc (General_options::parse_library): Support -l:filename.
1807 (General_options::parse_just_symbols): Update for Input_file_argument
1809 (Command_line::process): Likewise.
1810 * archive.cc (Archive::get_file_and_offset): Likewise.
1811 * plugin.cc (Plugin_manager::release_input_file): Likewise.
1812 * script.cc (read_script_file, script_add_file): Likewise.
1813 * fileread.cc (Input_file::Input_file): Likewise.
1814 (Input_file::will_search_for): Handle is_searched_file.
1815 (Input_file::open): Likewise.
1816 * readsyms.cc (Read_symbols::get_name): Likewise.
1817 * testsuite/Makefile.am (searched_file_test): New test.
1818 * testsuite/Makefile.in: Regenerate.
1819 * testsuite/searched_file_test.cc: New file.
1820 * testsuite/searched_file_test_lib.cc: New file.
1822 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1823 Ian Lance Taylor <iant@google.com>
1825 * descriptor.cc: Include <cstdio> and "binary-io.h".
1826 (Descriptors::open): Open the files in binary mode always.
1827 * script.cc (Lex::get_token): Treat \r as whitespace.
1829 2009-10-09 Ian Lance Taylor <iant@google.com>
1831 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1833 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1834 Ian Lance Taylor <iant@google.com>
1836 * configure.ac: Check for readv function also.
1837 * fileread.cc (readv): Define if not HAVE_READV.
1838 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1840 * config.in: Regenerate.
1841 * configure: Regenerate.
1843 2009-10-09 Doug Kwan <dougkwan@google.com>
1845 * layout.cc (Layout::make_output_section): Call target hook to make
1846 ordinary output section.
1847 (Layout::finalize): Adjust parameter list of call the
1848 Target::may_relax().
1849 * layout.h (class Layout::section_list): New method.
1850 * merge.h (Output_merge_base::entsize): Change visibility to public.
1851 (Output_merge_base::is_string, Output_merge_base::do_is_string):
1853 (Output_merge_string::do_is_string): New method.
1854 * object.cc (Sized_relobj::do_setup): renamed from
1855 Sized_relobj::set_up.
1856 * object.h (Sized_relobj::adjust_shndx,
1857 Sized_relobj::initializ_input_to_output_maps,
1858 Sized_relobj::free_input_to_output_maps): Change visibilities to
1860 (Sized_relobj::setup): Virtualize.
1861 (Sized_relobj::do_setup): New method declaration.
1862 (Sized_relobj::invalidate_section_offset,
1863 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
1864 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
1865 * options.cc (parse_int): New function.
1866 * options.h (parse_int): New declaration.
1867 (DEFINE_int): New macro.
1868 (stub_group_size): New option.
1869 * output.cc (Output_section::Output_section): Initialize memebers
1870 merge_section_map_, merge_section_by_properties_map_,
1871 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
1872 (Output_section::add_input_section): Handled deferred code-fill
1873 generation and remove an old comment.
1874 (Output_section::add_relaxed_input_section): New method definition.
1875 (Output_section::add_merge_input_section): Use merge section by
1876 properties map to speed to search. Update merge section maps
1878 (Output_section::build_relaxation_map): New method definition.
1879 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1881 (Output_section::relax_input_section): Renamed to
1882 Output_section::convert_input_sections_to_relaxed_sections and change
1883 interface to take a vector of pointers to relaxed sections.
1884 (Output_section::find_merge_section,
1885 Output_section::find_relaxed_input_section): New method definitions.
1886 (Output_section::is_input_address_mapped,
1887 Output_section::output_offset, Output_section::output_address):
1888 Use output section data maps to speed up searching.
1889 (Output_section::find_starting_output_address): Add comments.
1890 (Output_section::do_write,
1891 Output_section::write_to_postprocessing_buffer): Do code-fill
1892 generation as appropriate.
1893 (Output_section::get_input_sections): Invalidate relaxed input section
1895 (Output_section::restore_states): Adjust type of checkpoint .
1896 Invalidate relaxed input section map.
1897 * output.h (Output_merge_base): New class declaration.
1898 (Input_section_specifier): New class defintion.
1899 (class Output_relaxed_input_section) Change base class to
1900 Output_section_data_build.
1901 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1902 base class initializer.
1903 (Output_section::add_relaxed_input_section): New method declaration.
1904 (Output_section::Input_section): Change visibility to protected.
1905 (Output_section::Input_section::relobj,
1906 Output_section::Input_section::shndx): Handle relaxed input sections.
1907 Output_section::input_sections) Change visibility to protected. Also
1908 define overload to return a non-const pointer.
1909 (Output_section::Merge_section_properties): New class defintion.
1910 (Output_section::Merge_section_by_properties_map,
1911 Output_section::Output_section_data_by_input_section_map,
1912 Output_section::Relaxation_map): New types.
1913 (Output_section::relax_input_section): Rename method to
1914 Output_section::convert_input_sections_to_relaxed_sections and change
1915 interface to take a vector of relaxed section pointers.
1916 (Output_section::find_merge_section,
1917 Output_section::find_relaxed_input_section,
1918 Output_section::build_relaxation_map,
1919 Output_section::convert_input_sections_in_list_to_relaxed_sections):
1920 New method declarations.
1921 (Output_section::merge_section_map_
1922 Output_section::merge_section_by_properties_map_,
1923 Output_section::relaxed_input_section_map_,
1924 Output_section::is_relaxed_input_section_map_valid_,
1925 Output_section::generate_code_fills_at_write_): New data members.
1926 * script-sections.cc
1927 (Output_section_element_input::set_section_addresses): Call
1928 current_data_size and addralign methods of relaxed input sections.
1929 (Orphan_output_section::set_section_addresses): Call current_data_size
1930 and addralign methods of relaxed input sections.
1931 * symtab.cc (Symbol_table::compute_final_value): Extract template
1932 from the body of Symbol_table::sized_finalize_symbol.
1933 (Symbol_table::sized_finalized_symbol): Call
1934 Symbol_table::compute_final_value.
1935 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1936 (Symbol_table::compute_final_value): New templated method declaration.
1937 * target.cc (Target::do_make_output_section): New method defintion.
1938 * target.h (Target::make_output_section): New method declaration.
1939 (Target::relax): Add more parameters for input objects, symbol table
1940 and layout. Adjust call to do_relax.
1941 (Target::do_make_output_section): New method declaration.
1942 (Target::do_relax): Add parameters for input objects, symbol table
1945 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1947 * pread.c: Include stdio.h.
1949 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1951 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1954 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1956 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1957 Change read_shndx type to unsigned int.
1958 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1960 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1961 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1962 Change read_shndx type to unsigned int.
1963 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1965 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1966 * layout.cc (Layout::create_symtab_sections): Cast the result of
1967 local_symcount * symsize to off_t in the gold_assert.
1969 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1971 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1972 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1974 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1975 (Arm_relocate_functions::thm_abs5): New function.
1976 (Arm_relocate_functions::abs12): New function.
1977 (Arm_relocate_functions::abs16): New function.
1978 (Arm_relocate_functions::base_abs): New function.
1979 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1980 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1981 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1983 (Scan::global): Likewise.
1984 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1985 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1986 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1987 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1990 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1992 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1993 (Arm_relocate_functions::movt_prel): New function.
1994 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1995 (Arm_relocate_functions::thm_movt_prel): New function.
1996 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1997 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1998 (Scan::global, Relocate::relocate): Likewise.
1999 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2001 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2003 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
2004 Incremental_checker.
2005 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
2007 (class Incremental_inputs_header): New class.
2008 (Incremental_inputs_header_writer): Edit comment.
2009 (Incremental_inputs_entry): New class.
2010 (Incremental_inputs_entry_writer): Edit comment.
2011 (Sized_incremental_binary::do_find_incremental_inputs_section):
2012 Add *strtab_shndx parameter, fill it.
2013 (Sized_incremental_binary::do_check_inputs): New method.
2014 (Incremental_checker::can_incrementally_link_output_file): Use
2015 Sized_incremental_binary::check_inputs.
2016 (Incremental_inputs::report_command_line): Save command line in
2019 (Incremental_binary::find_incremental_inputs_section): New
2021 (Incremental_binary::do_find_incremental_inputs_section): Add
2022 strtab_shndx parameter.
2023 (Incremental_binary::do_check_inputs): New pure virtual method.
2024 (Sized_incremental_binary::do_check_inputs): Declare.
2025 (Incremental_checker::Incremental_checker): Add incremental_inputs
2026 parameter, use it to initialize incremental_inputs_.
2027 (Incremental_checker::incremental_inputs_): New field.
2028 (Incremental_checker::command_line): New method.
2029 (Incremental_checker::inputs): New method.
2030 (Incremental_checker::command_line_): New field.
2032 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
2034 * incremental.cc: Include <cstdarg> and "target-select.h".
2035 (vexplain_no_incremental): New function.
2036 (explain_no_incremental): New function.
2037 (Incremental_binary::error): New method.
2038 (Sized_incremental_binary::do_find_incremental_inputs_section): New
2040 (make_sized_incremental_binary): New function.
2041 (open_incremental_binary): New function.
2042 (can_incrementally_link_file): Add checks if output is ELF and has
2044 * incremental.h: Include "elfcpp_file.h" and "output.h".
2045 (Incremental_binary): New class.
2046 (Sized_incremental_binary): New class.
2047 (open_incremental_binary): Declare.
2048 * object.cc (is_elf_object): Use
2049 elfcpp::Elf_recognizer::is_elf_file.
2050 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2051 * output.h (Output_file::filesize): New method.
2053 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2055 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2057 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2058 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2060 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2062 (Arm_relocate_functions::movw_abs_nc): New function.
2063 (Arm_relocate_functions::movt_abs): New function.
2064 (Arm_relocate_functions::thm_movw_abs_nc): New function.
2065 (Arm_relocate_functions::thm_movt_abs): New function.
2066 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2067 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2068 (Scan::global): Likewise.
2069 (Relocate::relocate): Likewise.
2070 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2072 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2074 * arm.cc (Arm_relocate_functions::got_prel) New function.
2075 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2076 (Relocate::relocate): Likewise.
2077 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2079 2009-10-06 Ian Lance Taylor <iant@google.com>
2081 * options.h (class General_options): Define
2082 split_stack_adjust_size parameter.
2083 * object.h (class Object): Add uses_split_stack_ and
2084 has_no_split_stack_ fields. Add uses_split_stack and
2085 has_no_split_stack accessor functions. Declare
2086 handle_split_stack_section.
2087 (class Reloc_symbol_changes): Define.
2088 (class Sized_relobj): Define Function_offsets. Declare
2089 split_stack_adjust, split_stack_adjust_reltype, and
2091 * object.cc (Object::handle_split_stack_section): New function.
2092 (Sized_relobj::do_layout): Call handle_split_stack_section.
2093 * dynobj.cc (Sized_dynobj::do_layout): Call
2094 handle_split_stack_section.
2095 * reloc.cc (Sized_relobj::relocate_sections): Call
2096 split_stack_adjust for executable sections in split_stack
2097 objects. Pass reloc_map to relocate_section.
2098 (Sized_relobj::split_stack_adjust): New function.
2099 (Sized_relobj::split_stack_adjust_reltype): New function.
2100 (Sized_relobj::find_functions): New function.
2101 * target-reloc.h: Include "object.h".
2102 (relocate_section): Add reloc_symbol_changes parameter. Change
2104 * target.h (class Target): Add calls_non_split method. Declare
2105 do_calls_non_split virtual method. Declare match_view and
2107 * target.cc: Include "elfcpp.h".
2108 (Target::do_calls_non_split): New function.
2109 (Target::match_view): New function.
2110 (Target::set_view_to_nop): New function.
2111 * gold.cc (queue_middle_tasks): Give an error if mixing
2112 split-stack and non-split-stack objects with -r.
2113 * i386.cc (Target_i386::relocate_section): Add
2114 reloc_symbol_changes parameter.
2115 (Target_i386::do_calls_non_split): New function.
2116 * x86_64.cc (Target_x86_64::relocate_section): Add
2117 reloc_symbol_changes parameter.
2118 (Target_x86_64::do_calls_non_split): New function.
2119 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2121 * powerpc.cc (Target_powerpc::relocate_section): Add
2122 reloc_symbol_changes parameter.
2123 * sparc.cc (Target_sparc::relocate_section): Add
2124 reloc_symbol_changes parameter.
2125 * configure.ac: Call AM_CONDITIONAL for the default target.
2126 * configure: Rebuild.
2127 * testsuite/Makefile.am (TEST_AS): New variable.
2128 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2129 (check_DATA): Add split_i386 and split_x86_64 files.
2130 (SPLIT_DEFSYMS): Define.
2131 (split_i386_[1234n].o): New targets.
2132 (split_i386_[124]): New targets.
2133 (split_i386_[1234r].stdout): New targets.
2134 (split_x86_64_[1234n].o): New targets.
2135 (split_x86_64_[124]): New targets.
2136 (split_x86_64_[1234r].stdout): New targets.
2137 (MOSTLYCLEANFILES): Add new executables.
2138 * testsuite/split_i386.sh: New file.
2139 * testsuite/split_x86_64.sh: New file.
2140 * testsuite/split_i386_1.s: New file.
2141 * testsuite/split_i386_2.s: New file.
2142 * testsuite/split_i386_3.s: New file.
2143 * testsuite/split_i386_4.s: New file.
2144 * testsuite/split_i386_n.s: New file.
2145 * testsuite/split_x86_64_1.s: New file.
2146 * testsuite/split_x86_64_2.s: New file.
2147 * testsuite/split_x86_64_3.s: New file.
2148 * testsuite/split_x86_64_4.s: New file.
2149 * testsuite/split_x86_64_n.s: New file.
2150 * testsuite/testfile.cc (Target_test): Update relocation_section
2152 * testsuite/Makefile.in: Rebuild.
2154 2009-10-06 Ian Lance Taylor <iant@google.com>
2156 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2157 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2158 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
2159 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2160 the address on ldo_addrs_.
2161 (Target_i386::Relocate::fix_up_ldo): New function.
2163 2009-10-06 Rafael Espindola <espindola@google.com>
2165 * plugin.cc (add_input_library): New.
2166 (Plugin::load): Add add_input_library to tv.
2167 (Plugin_manager::add_input_file): Add the is_lib argument.
2168 (add_input_file): Update call to Plugin_manager::add_input_file.
2169 (add_input_library): New.
2170 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2172 2009-09-30 Doug Kwan <dougkwan@google.com>
2174 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2175 symbol and call Symbol::may_need_copy_reloc to determine if
2176 a copy reloc is needed.
2177 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2178 nocopyreloc is given in command line.
2179 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2180 given in command line.
2181 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2182 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2183 of the removed Target_i386::may_need_copy_reloc.
2184 * options.h (copyreloc): New option with default value false.
2185 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2186 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2187 instead of the removed Target_powerpc::may_need_copy_reloc.
2188 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2189 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2190 instead of the removed Target_sparc::may_need_copy_reloc.
2191 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2192 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2193 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2194 instead of the removed Target_x86_64::may_need_copy_reloc.
2196 2009-09-30 Ian Lance Taylor <iant@google.com>
2198 * object.h (class Object): Remove target_ field, and target,
2199 sized_target, and set_target methods.
2200 (Object::sized_target): Remove.
2201 (class Sized_relobj): Update declarations. Remove sized_target.
2202 * object.cc (Sized_relobj::setup): Remove target parameter.
2204 (Input_objects::add_object): Don't do anything with the target.
2205 (make_elf_sized_object): Add punconfigured parameter. Change all
2206 callers. Set or test parameter target.
2207 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2209 * parameters.cc (Parameters::set_target): Change parameter type to
2211 (Parameters::default_target): Remove.
2212 (set_parameters_target): Change parameter type to be non-const.
2213 (parameters_force_valid_target): New function.
2214 (parameters_clear_target): New function.
2215 * parameters.h (class Parameters): Update declarations. Remove
2216 default_target method. Add sized_target and clear_target
2217 methods. Change target_ to be non-const.
2218 (set_parameters_target): Update declaration.
2219 (parameters_force_valid_target): Declare.
2220 (parameters_clear_target): Declare.
2221 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2222 as NULL if we aren't searching.
2223 (Add_symbols::run): Don't check for compatible target.
2224 * fileread.cc (Input_file::open_binary): Call
2225 parameters_force_valid_target.
2226 * gold.cc (queue_middle_tasks): Likewise.
2227 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
2228 set_target on object.
2229 * dynobj.h (class Sized_dynobj): Update declarations.
2230 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2231 make_elf_object returns NULL.
2232 (Archive::include_member): Don't check whether object target is
2234 * output.cc (Output_section::add_input_section): Get target from
2236 (Output_section::relax_input_section): Likewise.
2237 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2239 (Sized_relobj::do_scan_relocs): Likewise.
2240 (Sized_relobj::relocate_sections): Likewise.
2241 * resolve.cc (Symbol_table::resolve): Likewise.
2242 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2243 parameter. Change all callers.
2244 (Symbol_table::add_from_object): Get target from parameters.
2245 (Symbol_table::add_from_relobj): Don't check object target.
2246 (Symbol_table::add_from_dynobj): Likewise.
2247 (Symbol_table::define_special_symbol): Get target from
2249 * symtab.h (class Symbol_table): Update declaration.
2250 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2251 parameter. Change all callers. Clear parameter target.
2252 (Binary_test): Test target here.
2253 * testsuite/object_unittest.cc (gold_testsuite): Remove
2254 target_test_pointer parameter. Change all callers.
2255 (Object_test): Test target here.
2257 2009-09-26 Ian Lance Taylor <iant@google.com>
2259 * testsuite/initpri1.c: Don't try to use constructor priorities if
2260 compiling with gcc before 4.3.
2262 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2264 * testsuite/retain_symbols_file_test.sh (check_present): Change
2265 output file name to retain_symbols_file_test.stdout.
2266 (check_absent): Likewise.
2268 2009-09-18 Craig Silverstein <csilvers@google.com>
2270 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2271 * options.cc: Include <cerrno> and <fstream>.
2272 (General_options::finalize): Parse -retain-symbols-file tag.
2273 * options.h: New flag.
2274 (General_options): New method should_retain_symbol, new
2275 variable symbols_to_retain.
2276 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2277 should_retain_symbol map.
2278 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2279 * testsuite/Makefile.in: Regenerate.
2280 * testsuite/retain_symbols_file_test.sh: New file.
2282 2009-09-18 Nick Clifton <nickc@redhat.com>
2284 * po/es.po: Updated Spanish translation.
2286 2009-09-17 Doug Kwan <dougkwan@google.com>
2288 * debug.h (DEBUG_RELAXATION): New constant.
2289 (DEBUG_ALL): Add DEBUG_RELAXATION.
2290 (debug_string_to_enum): Add relaxation debug option.
2292 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2293 Layout::Relaxation_debug_check::read_sections,
2294 Layout::Relaxation_debug_check::read_sections): New method definitions.
2295 (Layout::Layout): Initialize data members
2296 record_output_section_data_from_scrips_,
2297 script_output_section_data_list_ and relaxation_debug_check_.
2298 (Layout::save_segments, Layout::restore_segments,
2299 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2300 Layout::relaxation_loop_body): New method definitions.
2301 (Layout::finalize): Support relaxation. Move section layout code to
2302 Layout::relaxation_loop_body.
2303 (Layout::set_asection_address_from_script): Move code for orphan
2304 section placement out.
2305 (Layout::place_orphan_sections_in_script): New method definition.
2306 * layout.h (Output_segment_headers, Output_file_header):
2307 New forward class declarations.
2308 (Layout::~Layout): Define.
2309 (Layout::new_output_section_data_from_script): New method definition.
2310 (Layout::place_orphan_sections_in_script): New method declaration.
2311 (Layout::Segment_states): New type declaration.
2312 (Layout::save_segments, Layout::restore_segments,
2313 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2314 Layout::relaxation_loop_body): New method declarations.
2315 (Layout::Output_section_data_list): New type declaration.
2316 (Layout::Relaxation_debug_check): New class definition.
2317 (Layout::record_output_section_data_from_script_,
2318 Layout::script_output_section_data_list_, Layout::segment_states_,
2319 Layout::relaxation_debug_check_): New data members.
2320 * output.cc: (Output_section_headers::do_size): New method definition.
2321 (Output_section_headers::Output_section_headers): Move size
2322 computation to Output_section_headers::do_size.
2323 (Output_segment_headers::do_size): New method definition.
2324 (Output_file_header::Output_file_header): Move size computation to
2325 Output_file_header::do_size and call it.
2326 (Output_file_header::do_size): New method definition.
2327 (Output_data_group::Output_data_group): Adjust call to
2328 Output_section_data.
2329 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2330 (Output_symtab_xindex::do_write): Add array bound check.
2331 (Output_section::Input_section::print_to_mapfile): Handle
2332 RELAXED_INPUT_SECTION_CODE.
2333 (Output_section::Output_section): Initialize data member checkpoint_.
2334 (Output_section::~Output_section): Delete checkpoint object pointed
2336 (Output_section::add_input_section): Always add an Input_section if
2338 (Output_section::add_merge_input_section): Add assert.
2339 (Output_section::relax_input_section): New method definition.
2340 (Output_section::set_final_data_size): Set load address to zero for
2341 an unallocated section.
2342 (Output_section::do_address_and_file_offset_have_reset_values):
2343 New method definition.
2344 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2345 Handle relaxed input section.
2346 (Output_section::sort_attached_input_sections): Checkpoint input
2347 section list lazily.
2348 (Output_section::get_input_sections): Change type of input_sections to
2349 list of Simple_input_section pointers. Checkpoint input section list
2350 lazily. Also handle relaxed input sections.
2351 (Output_section::add_input_section_for_script): Take a reference to
2352 a Simple_input_section object instead of Relobj pointer and section
2353 index as parameter. Handle relaxed input sections.
2354 (Output_section::save_states, Output_section::restore_states): New
2356 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2357 (Output_data::is_data_size_fixed): New method definition.
2358 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2360 (Output_data::address_and_file_offset_have_reset_values): New method
2362 (Output_data::do_address_and_file_offset_have_reset_values): New method
2364 (Output_data::set_data_size): Check that data size is not fixed.
2365 (Output_data::fix_data_size): New method definition.
2366 (Output_data::is_data_size_fixed_): New data member.
2367 (Output_section_headers::set_final_data_size): New method definition.
2368 (Output_section_headers::do_size): New method declaration.
2369 (Output_segment_headers::set_final_data_size): New method definition.
2370 (Output_segment_headers::do_size): New method declaration.
2371 (Output_file_header::set_final_data_size)::New method definition.
2372 (Output_file_header::do_size)::New method declaration.
2373 (Output_section_data::Output_section_data): Add new parameter
2374 is_data_size_fixed and use it to fix data size.
2375 (Output_data_const::Output_data_const): Adjust call to base class
2376 constructor and fix data size.
2377 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2378 base class constructor and fix data size.
2379 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2380 base class constructor and fix data size.
2381 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2382 class constructor and fix data size.
2383 (Output_data_group::set_final_data_size): New method definition.
2384 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2385 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2386 class constructor and fix data size.
2387 (Output_relaxed_input_section): New class definition.
2388 (Output_section::Simple_input_section): New class definition.
2389 (Output_section::get_input_sections): Adjust parameter list.
2390 (Output_section::add_input_section_for_script): Same.
2391 (Output_section::save_states, Output_section::restore_states,
2392 Output_section::do_address_and_file_offset_have_reset_values,
2393 (Output_section::Input_section::Input_section): Handle
2394 RELAXED_INPUT_SECTION_CODE. Add new overload for
2395 Output_relaxed_input_section.
2396 (Output_section::Input_section::is_input_section,
2397 Output_section::Input_section::set_output_section): Handle relaxed
2399 (Output_section::Input_section::is_relaxed_input_section,
2400 Output_section::Input_section::output_section_data,
2401 Output_section::Input_section::relaxed_input_section): New method
2403 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2405 (Output_section::Input_section::u1_): Update comments.
2406 (Output_section::Input_section::u2_): Add new union member poris.
2407 (Output_section::Checkpoint_output_section): New classs definition.
2408 (Output_section::relax_input_section): New method declaration.
2409 (Output_section::checkpoint_): New data member.
2410 (Output_segment): Update comments.
2411 (Output_segment::Output_segment): Un-privatize copy constructor.
2412 (Output_segment::operator=): Un-privatize.
2413 * script-sections.cc (Output_section_element::Input_section_list):
2414 Change element type to Output_section::Simple_input_section.
2415 (Output_section_element_dot_assignment::set_section_addresses):
2416 Register output section data for relaxation clean up.
2417 (Output_data_exression::Output_data_expression): Adjust call to base
2418 constructor to fix data size.
2419 (Output_section_element_data::set_section_addresses): Register
2420 Output_data_expression object for relaxation clean up.
2421 (struct Input_section_info): Replace Relobj pointer and section index
2422 pair with Output_section::Simple_input_section and Convert struct to a
2424 (Input_section_sorter::operator()): Adjust access to
2425 Input_section_info data member to use accessors.
2426 (Output_section_element_input::set_section_addresses): Use layout
2427 parameter. Adjust code to use Output_section::Simple_input_section
2428 and Input_secction_info classes. Register filler for relaxation
2430 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2431 and section index pair with Output_section::Simple_input_section
2432 class. Adjust code accordingly.
2433 (Phdrs_element::release_segment): New method definition.
2434 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2436 (Script_sections::release_segments): New method definition.
2437 * gold/script-sections.h (Script_sections::release_segments): New
2439 * gold/target.h (Target::may_relax, Target::relax,
2440 Target::do_may_relax, Target::do_relax): New method definitions.
2442 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2444 * arm.cc (has_signed_unsigned_overflow): New function.
2445 (Arm_relocate_functions::abs8): New function.
2446 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2447 (Target_arm::Scan::global): Likewise.
2448 (Target_arm::relocate::relocate): Likewise.
2449 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2452 2009-09-16 Cary Coutant <ccoutant@google.com>
2454 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2455 * testsuite/Makefile.in: Regenerate.
2457 2009-09-11 Nick Clifton <nickc@redhat.com>
2459 * po/gold.pot: Updated by the Translation project.
2461 2009-09-08 Cary Coutant <ccoutant@google.com>
2463 * output.cc (Output_file::open): Add execute permission to empty file.
2464 * testsuite/Makefile.am (permission_test): New test.
2465 * testsuite/Makefile.in: Regenerate.
2467 2009-09-02 Ian Lance Taylor <iant@google.com>
2469 * output.cc (Output_file::resize): Call map_no_anonymous rather
2472 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2474 * gold.cc: Include "incremental.h".
2475 (queue_initial_tasks): Call Incremental_checker methods.
2476 * incremental.cc: Include "output.h".
2477 (Incremental_checker::can_incrementally_link_output_file): New
2479 * incremental.h (Incremental_checker): New class.
2481 * output.cc (Output_file::open_for_modification): New method.
2482 (Output_file::map_anonymous): Changed return type to bool. Record
2484 (Output_file::map_no_anonymous): New method, broken out of map.
2485 (Output_file::map): Use map_no_anonymous and map_anonymous.
2486 * output.h (class Output_file): Update declarations.
2488 2009-08-24 Cary Coutant <ccoutant@google.com>
2490 * options.h (Command_line::Pre_options): New class.
2491 (Command_line::pre_options): New member.
2492 * options.cc (gold::options::ready_to_register): New variable.
2493 (One_option::register_option): Do nothing if not registering options.
2494 Assert if same short option registered twice.
2495 (General_options::General_options): Turn off option registration when
2497 (Command_line::Pre_options::Pre_options): New constructor.
2499 2009-08-24 Cary Coutant <ccoutant@google.com>
2501 * options.h (General_options::no_keep_memory): Remove incorrect
2504 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2506 * Makefile.am (am__skiplex, am__skipyacc): New.
2507 * Makefile.in: Regenerate.
2509 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2511 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2512 (INCLUDES): ... this.
2513 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2514 (AM_CPPFLAGS): Renamed from ...
2515 (INCLUDE): ... this.
2516 * Makefile.in, testsuite/Makefile.in: Regenerate.
2518 * Makefile.in: Regenerate.
2519 * aclocal.m4: Likewise.
2520 * config.in: Likewise.
2521 * configure: Likewise.
2522 * testsuite/Makefile.in: Likewise.
2524 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2525 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2526 * Makefile.in: Regenerate.
2527 * testsuite/Makefile.in: Regenerate.
2529 2009-08-19 Cary Coutant <ccoutant@google.com>
2531 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2532 symbols in shared libraries overridden by hidden or internal symbols
2533 in the main program.
2535 2009-08-19 Chris Demetriou <cgd@google.com>
2537 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2538 checking source file names in error messages.
2540 2009-08-18 Doug Kwan <dougkwan@google.com>
2542 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2543 an elcpp::Ehdr as parameter. Adjust call to set_target.
2544 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2545 an elfcpp::Ehdr as parameter.
2546 * object.cc (Object::set_target): Remove the version that looks up
2547 a target and sets it.
2548 (Sized_relobj::setup): Take a Target object instead of
2549 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2550 (make_elf_sized_object): Find target and ask target to
2552 * object.h: (Object::set_target): Remove the version that looks up
2553 a target and sets it.
2554 (Sized_relobj::setup): Take a Target object instead of
2555 an elfcpp:Ehdr as parameter.
2556 * target.cc: Include dynobj.h.
2557 (Target::do_make_elf_object_implementation): New.
2558 (Target::do_make_elf_object): New.
2559 * target.h (Target::make_elf_object): New template declaration.
2560 (Target::do_make_elf_object): New method declarations.
2561 (Target::do_make_elf_object_implementation): New template declaration.
2563 2009-08-14 Ian Lance Taylor <iant@google.com>
2565 * gold.h (FUNCTION_NAME): Define.
2566 (gold_unreachable): Use FUNCTION_NAME.
2568 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2570 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2571 symbol in the --keep-unique list is not found.
2573 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2575 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2576 been maked as --keep-unique.
2577 (Icf::unfold_section): New function.
2578 * icf.h (Icf::unfold_section): New function.
2579 * options.h (General_options::keep_unique): New option.
2580 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2581 * testsuite/Makefile.in: Regenerate.
2582 * testsuite/icf_keep_unique_test.sh: New file.
2583 * testsuite/icf_keep_unique_test.cc: New file.
2585 2009-08-12 Cary Coutant <ccoutant@google.com>
2588 * resolve.cc (Symbol_table::resolve): Check for references from
2589 dynamic objects to hidden and internal symbols.
2590 * testsuite/Makefile.am (hidden_test.sh): New test.
2591 * testsuite/Makefile.in: Regenerate.
2592 * testsuite/hidden_test.sh: New script.
2593 * testsuite/hidden_test_1.c: New test source.
2594 * testsuite/hidden_test_main.c: New test source.
2596 2009-08-11 Doug Kwan <dougkwan@google.com>
2598 * arm.cc: Update comments.
2599 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2600 segment to locate the .ARM.exidx section if present.
2602 2009-08-09 Doug Kwan <dougkwan@google.com>
2604 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2607 2009-08-07 Sriraman Tallam <tmsriram@google.com>
2608 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2611 2009-08-06 Sriraman Tallam <tmsriram@google.com>
2613 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2614 valid tls_segment only for non-debug-section relocations.
2615 * testsuite/Makefile.am: Add gc_tls_test.
2616 * testsuite/Makefile.in: Regenerate.
2617 * testsuite/gc_tls_test.cc: New file.
2618 * testsuite/gc_tls_test.sh: New file.
2620 2009-08-05 Sriraman Tallam <tmsriram@google.com>
2624 * Makefile.am (CCFILES): Add icf.cc.
2626 * Makefile.in: Regenerate.
2627 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2628 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2629 section, symbol and addend information for the relocs.
2630 * gold.cc (queue_middle_tasks): Call identical code folding.
2631 * gold.h: Add defines for multimap.
2632 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2633 to the call of finalize_local_symbols.
2634 * main.cc (main): Create object of class Icf.
2635 * object.cc (Sized_relobj::do_layout): Allow this function to be
2636 called twice during icf.
2637 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2638 to sections marked as identical by icf.
2639 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2641 (Sized_relobj::do_section_entsize): New function.
2642 * object.h (Object::section_entsize): New function.
2643 (Object::do_section_entsize): New pure virtual function.
2644 (Relobj::finalize_local_symbols): Add new parameter.
2645 (Relobj::do_section_entsize): New function.
2646 * options.h (General_options::icf): New option.
2647 (General_options::icf_iterations): New option.
2648 (General_options::print_icf_sections): New option.
2649 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2650 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2651 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2653 * symtab.cc (Symbol_table::is_section_folded): New function.
2654 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2655 to sections marked as identical by icf.
2656 * symtab.h (Symbol_table::set_icf): New function.
2657 (Symbol_table::icf): New function.
2658 (Symbol_table::is_section_folded): New function.
2659 (Symbol_table::icf_): New data member.
2660 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2661 * testsuite/Makefile.am: Add commands to build icf_test.
2662 * testsuite/Makefile.in: Regenerate.
2663 * testsuite/icf_test.sh: New file.
2664 * testsuite/icf_test.cc: New file.
2666 2009-07-24 Chris Demetriou <cgd@google.com>
2668 * layout.cc (is_compressible_debug_section): Fix incorrect
2669 comment about compressed section names.
2671 2009-07-20 Ian Lance Taylor <ian@airs.com>
2674 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2676 2009-07-16 Ian Lance Taylor <iant@google.com>
2679 * layout.h: #include <map>.
2680 (class Kept_section): Change from struct to class. Add accessors
2681 and setters. Add section size to Comdat_group mapping. Change
2682 Comdat_group to std::map. Add is_comdat_ field. Add
2683 linkonce_size field in union.
2684 (class Layout): Update declaration of find_or_add_kept_section.
2685 Don't declare find_kept_object.
2686 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2687 parameter. Add object, shndx, is_comdat, and is_group_name
2688 parameters. Change all callers. Adjust for new Kept_section.
2689 (Layout::find_kept_object): Remove.
2690 * object.cc (Sized_relobj::include_section_group): Update use of
2691 Kept_section. Rename secnum to shndx. Only record
2692 Kept_comdat_section if sections are the same size.
2693 (Sized_relobj::include_linkonce_section): Update use of
2694 Kept_section. Only record Kept_comdat_section if sections are the
2695 same size. Set size of linkonce section.
2696 (Sized_relobj::map_to_kept_section): Update call to
2697 get_kept_comdat_section.
2698 * object.h (class Sized_relobj): Rename fields in
2699 Kept_comdat_section to drop trailing underscores; change object
2700 field to Relobj*. Change Kept_comdat_section_table to store
2701 struct rather than pointer.
2702 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2703 Add kept_object and kept_shndx parameters. Change all callers.
2704 (Sized_relobj::get_kept_comdat_section): Change return type to
2705 bool. Add kept_object and kept_shndx parameters. Change all
2707 * plugin.cc (Pluginobj::include_comdat_group): Update call to
2708 Layout::find_or_add_kept_section.
2710 2009-07-09 Ian Lance Taylor <iant@google.com>
2712 * merge.cc (Object_merge_map::initialize_input_to_output_map):
2713 Reserve space in the hash table.
2715 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
2717 * fileread.cc (File_read::get_mtime): New method.
2718 * fileread.h (Timespec): New structure.
2719 (File_read::get_mtime): New method.
2720 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2721 Renamed from timestamp_nsec.
2722 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2724 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
2726 (Incremental_inputs::report_archive): Save mtime; style fix.
2727 (Incremental_inputs::report_obejct): Save mtime; style fix.
2728 (Incremental_inputs::report_script): Save mtime; style fix.
2729 (Incremental_inputs::finalize_inputs): Style fix.
2730 (Incremental_inputs::finalize): Style fix.
2731 (Incremental_inputs::create_input_section_data): Store inputs
2733 * incremental.h (Incremental_inputs::report_script): Add mtime
2735 (Incremental_inputs::Input_info::Input_info): Intialize only one
2737 (Incremental_inputs::Input_info::archive): Move to nameless
2739 (Incremental_inputs::Input_info::obejct): Move to nameless union.
2740 (Incremental_inputs::Input_info::script): Move to nameless union.
2741 (Incremental_inputs::mtime): New field.
2742 * script.cc (read_input_script): Pass file mtime to
2744 * script.h (Script_info::inputs): Style fix.
2746 2009-07-01 Ian Lance Taylor <ian@airs.com>
2748 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2751 2009-06-24 Ian Lance Taylor <iant@google.com>
2754 * layout.cc (Layout::choose_output_section): If we find an
2755 existing section, update the flags.
2756 (Layout::create_notes): New function, broken out of
2758 (Layout::finalize): Don't create note sections.
2759 (Layout::create_note): Don't crash if linker script discards
2761 (Layout::create_gold_note): Likewise.
2762 (Layout::create_build_id): Likewise. Don't set
2763 after_input_sections on the section.
2764 (Layout::create_executable_stack_info): Remove target parameter.
2766 * layout.h (class Layout): Declare create_notes. Update
2767 declaration of create_executable_stack_info.
2768 * gold.cc (queue_middle_tasks): Call create_notes.
2769 * output.cc (Output_section::update_flags_for_input_section): Move
2770 here from output.h. If SHF_ALLOC flag is newly set, mark address
2772 * output.h (Output_data::mark_address_invalid): New function.
2773 (class Output_section): Only declare, not define,
2774 update_flags_for_input_section. Remove set_flags.
2776 2009-06-24 Ian Lance Taylor <iant@google.com>
2778 * script-sections.cc (Output_section_definition::
2779 set_section_addresses): Rename shadowing local load_address to
2782 2009-06-24 Ian Lance Taylor <iant@google.com>
2785 * reloc.cc (relocate_sections): Skip empty relocation sections.
2787 2009-06-23 Ian Lance Taylor <iant@google.com>
2790 * layout.cc (Layout::create_note): Use choose_output_section
2791 rather than make_output_section.
2793 2009-06-23 Ian Lance Taylor <iant@google.com>
2796 * options.cc (General_options::parse_V): Set printed_version_.
2797 (General_options::General_options): Initialize printed_version_.
2798 * options.h (class General_options): Add printed_version_ field.
2799 * gold.cc (queue_initial_tasks): If there are no input files,
2800 don't give a fatal error if we printed the version information.
2801 (queue_middle_tasks): If using -r with a shared object, give a
2802 fatal error rather than an ordinary error.
2804 2009-06-23 Ian Lance Taylor <iant@google.com>
2807 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
2808 (Layout::make_output_section): Set have_stabstr_section_ if we see
2809 a .stab*str section.
2810 (Layout::finalize): Call link_stabs_sections.
2811 (Layout::link_stabs_sections): New file.
2812 * layout.h (class Layout): Add have_stabstr_section_ field.
2813 Declare link_stabs_sections.
2815 2009-06-23 Doug Kwan <dougkwan@google.com>
2817 * Makefile.am (libgold_a_LIBADD): New.
2818 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2819 * Makefile.in: Regenerate.
2820 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
2821 * configure: Regenerate.
2822 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
2823 * fileread.cc: Include sys/state.h
2824 * gold.h: Declare memmem and strndup if found missing.
2825 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2827 2009-06-23 Ian Lance Taylor <iant@google.com>
2829 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2830 * configure: Rebuild.
2832 2009-06-23 Ian Lance Taylor <iant@google.com>
2835 * object.cc (Object::section_contents): Don't try to get a view if
2836 the section has length zero.
2837 (Object::handle_gnu_warning_section): If the section is empty, use
2838 the name of the section as the warning.
2840 2009-06-23 Ian Lance Taylor <iant@google.com>
2843 * stringpool.h (class Stringpool_template): Add optimize_ field.
2844 (Stringpool_template::set_optimize): New function.
2845 * stringpool.cc (Stringpool_template::Stringpool_template):
2846 Initialize optimize_ field.
2847 (Stringpool_template::set_string_offsets): Test local optimize
2848 fild rather than parameter.
2849 * layout.cc (Layout::Layout): Call set_optimize on the section
2852 2009-06-22 Ian Lance Taylor <iant@google.com>
2855 * yyscript.y: Parse TARGET.
2856 * script.cc (script_set_target): New function.
2857 * script-c.h (script_set_target): Declare.
2858 * options.cc (General_options::string_to_object_format): Rename
2859 from string_to_object_format in anonymous namespace. Change
2861 * options.h (class General_options): Declare
2862 string_to_object_format.
2864 2009-06-22 Ian Lance Taylor <iant@google.com>
2866 * script-sections.cc (Script_sections::create_segments): Don't put
2867 program headers in a PT_LOAD segment if -n or -N.
2869 2009-06-22 Ian Lance Taylor <iant@google.com>
2872 * options.h (class General_options): Add -z lazy and -z now. Sort
2873 -z options into alphabetical order.
2874 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
2876 2009-06-21 Ian Lance Taylor <iant@google.com>
2878 * layout.cc (Layout::make_output_section): Call
2879 Target::new_output_section.
2880 (Layout::attach_allocated_section_to_segment): Put large section
2881 sections in a separate load segment with the large segment flag
2883 (Layout::segment_precedes): Sort large data segments after other
2885 (align_file_offset): New static function.
2886 (Layout::set_segment_offsets): Use align_file_offset.
2887 * output.h (class Output_section): Add is_small_section_ and
2888 is_large_section_ fields.
2889 (Output_section::is_small_section): New function.
2890 (Output_section::set_is_small_section): New function.
2891 (Output_section::is_large_section): New function.
2892 (Output_section::set_is_large_section): New function.
2893 (Output_section::is_large_data_section): New function.
2894 (class Output_segment): Add is_large_data_segment_ field.
2895 (Output_segment::is_large_data_segment): New function.
2896 (Output_segment::set_is_large_data_segment): New function.
2897 * output.cc (Output_section::Output_section): Initialize new
2899 (Output_segment::Output_segment): Likewise.
2900 (Output_segment::add_output_section): Add assertion that large
2901 data sections always go in large data segments. Force small data
2902 sections to the end of the list of data sections. Force small BSS
2903 sections to the start of the list of BSS sections. For large BSS
2904 sections to the end of the list of BSS sections.
2905 * symtab.h (class Symbol): Declare is_common_shndx.
2906 (Symbol::is_defined): Check Symbol::is_common_shndx.
2907 (Symbol::is_common): Likewise.
2908 (class Symbol_table): Define enum Commons_section_type. Update
2909 declarations. Add small_commons_ and large_commons_ fields.
2910 * symtab.cc (Symbol::is_common_shndx): New function.
2911 (Symbol_table::Symbol_table): Initialize new fields.
2912 (Symbol_table::add_from_object): Put small and large common
2913 symbols in the right list.
2914 (Symbol_table::sized_finalized_symbol): Check
2915 Symbol::is_common_shndx.
2916 (Symbol_table::sized_write_globals): Likewise.
2917 * common.cc (Symbol_table::do_allocate_commons): Allocate new
2918 common symbol lists. Don't call do_allocate_commons_list if the
2920 (Symbol_table::do_allocate_commons_list): Remove is_tls
2921 parameter. Add comons_section_type parameter. Change all
2922 callers. Handle small and large common symbols.
2923 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2924 Symbol::is_common_shndx.
2925 * resolve.cc (symbol_to_bits): Likewise.
2926 * target.h (Target::small_common_shndx): New function.
2927 (Target::small_common_section_flags): New function.
2928 (Target::large_common_shndx): New function.
2929 (Target::large_common_section_flags): New function.
2930 (Target::new_output_section): New function.
2931 (Target::Target_info): Add small_common_shndx, large_common_shndx,
2932 small_common_section_flags, and large_common_section_flags
2934 (Target::do_new_output_section): New virtual function.
2935 * arm.cc (Target_arm::arm_info): Initialize new fields.
2936 * i386.cc (Target_i386::i386_info): Likewise.
2937 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2939 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2940 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2941 (Target_x86_64::do_new_output_section): New function.
2942 * configure.ac: Define conditional MCMODEL_MEDIUM.
2943 * testsuite/Makefile.am (check_PROGRAMS): Add large.
2944 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2945 (large_LDFLAGS): Define.
2946 * testsuite/large.c: New file.
2947 * testsuite/testfile.cc (Target_test::test_target_info):
2948 Initialize new fields.
2949 * configure, testsuite/Makefile.in: Rebuild.
2951 2009-06-05 Doug Kwan <dougkwan@google.com>
2953 * Makefile.am (CCFILES): Add target.cc.
2954 * Makefile.in: Regenerate.
2955 * i386.cc (class Target_i386): Define new virtual method to
2956 override do_is_local_label_name in parent.
2957 * object.cc (Sized_relobj::do_count_local_symbols): Discard
2958 local symbols if --discard-locals or -X is given.
2959 * options.h (class General_options): Declare new options
2960 '--discard-locals' and '-X' for discarding locals.
2961 * target.h (class Target): Define new methods is_local_label_name.
2962 Declare new virtual method do_is_local_label_name.
2963 * target.cc: New file.
2964 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2965 (check_SCRIPTS): Add discard_locals_test.sh.
2966 (check_DATA): Add discard_local_tests.syms.
2967 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2968 (discard_local_tests.syms, discard_locals_test.o): New make rules.
2969 * testsuite/Makefile.in: Regenerate.
2970 * testsuite/discard_locals_test.c: New file.
2971 * testsuite/discard_locals_test.sh: Same.
2973 2009-06-05 Doug Kwan <dougkwan@google.com>
2975 * object.cc (Sized_relobj::Sized_relobj): Initialize
2976 discarded_eh_frame_shndx_ to -1U.
2977 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2979 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2980 a discarded .eh_frame section.
2981 (Sized_relobj::do_finalize_local_symbols): Ditto.
2982 * object.h (class Sized_relobj): Declare new member
2983 discarded_eh_frame_shndx_.
2984 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2985 (local_labels_test.o, local_labels_test): New rules.
2986 * testsuite/Makefile.in: Regenerate.
2988 2009-06-04 Doug Kwan <dougkwan@google.com>
2990 * layout.cc (Layout::section_name_mapping): Add mapping for
2991 special ARM sections.
2993 2009-06-03 Doug Kwan <dougkwan@google.com>
2995 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2996 (utils::has_overflow): Same.
2998 2009-06-03 Ian Lance Taylor <iant@google.com>
3000 * layout.cc (Layout::section_name_mapping): New array, replacing
3001 Layout::linkonce_mapping.
3002 (Layout::section_name_mapping_count): New variable, replacing
3003 Layout::linkonce_mapping_count.
3004 (Layout::linkonce_output_name): Remove.
3005 (Layout::output_section_name): Rewrite.
3006 * layout.h (class Layout): Rename Linkonce_mapping to
3007 Section_name_mapping, linkonce_mapping to section_name_mapping,
3008 linkonce_mapping_count to section_name_mapping_count. Don't
3009 declare linkonce_output_name.
3011 2009-06-03 Doug Kwan <dougkwan@google.com>
3013 * gold/arm.cc (namespace utils): New.
3014 (Target_arm::reloc_is_non_pic): Define new method.
3015 (class Arm_relocate_functions): New.
3016 (Target_arm::Relocate::relocate): Handle relocation types used by
3019 2009-06-03 Ian Lance Taylor <iant@google.com>
3021 * arm.cc (Target_arm::scan::global): Use || instead of |.
3023 2009-06-02 Doug Kwan <dougkwan@google.com>
3025 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
3026 issued_non_pic_error_.
3027 (class Target_arm::Scan): Declare new method check_non_pic.
3028 Define new method symbol_needs_plt_entry.
3029 Declare new data member issued_non_pic_error_.
3030 (class Target_arm::Relocate): Declare new method
3031 should_apply_static_reloc.
3032 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3033 (Target_arm::Scan::check_non_pic): Define new method.
3034 (Target_arm::Scan::local): Handle a small subset of reloc types used
3036 (Target_arm::Scan::local): Same.
3037 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3039 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
3041 * incremental.cc (Incremental_inputs::report_command_line): Filter
3042 out --incremental-* options.
3044 2009-05-29 Doug Kwan <dougkwan@google.com>
3046 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3048 (class Target_arm): Update comment.
3049 (Target_arm::Target_arm): Initialize new data members GOT_,
3050 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3051 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3052 and Target_arm::rel_dyn_section.
3053 Declare new_enum Target_arm::Got_type.
3054 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3056 Update commments for member do_dynsym_value.
3057 (Target_arm::got_size, Target_arm::plt_section,
3058 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3059 new methods inside class defintion.
3060 (Target_arm::got_section): Define new method.
3061 (Target_arm::rel_dyn_section): Same.
3062 (Output_data_plt_arm): New template class.
3063 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3064 (Output_data_plt_arm:do_adjust_output_section): Define new method.
3065 (Output_data_plt_arm::add_entry): Same.
3066 (Output_data_plt_arm::first_plt_entry): Define new
3067 static data member for PLT instruction template.
3068 (Output_data_plt_arm::plt_entry): Same.
3069 (Output_data_plt_arm::do_write): Define new method.
3070 (Target_arm::make_plt_entry): Same.
3071 (Target_arm::do_finalize_sections): Same.
3072 (Target_arm::do_dynsym_value): Same.
3074 2009-05-28 Doug Kwan <dougkwan@google.com>
3076 * Makefile.am (TARGETSOURCES): Add arm.cc.
3077 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3078 * Makefile.in: Regenerate.
3080 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3082 2009-05-26 Doug Kwan <dougkwan@google.com>
3084 * options.cc (General_options::parse_exclude_libs). Fix a comment.
3085 (General_options::check_excluded_libs): Strip off directories in
3086 archive name before matching like GNU ld does.
3087 * testsuite/Makefile.am (MOSTLYCLEANFILES,
3088 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3089 (exclude_libs_test_LDFLAGS): Add linker option
3090 -Wl,--exclude-libs,libexclude_libs_test_3
3091 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3092 an explicit archive without using -l.
3093 (alt/libexclude_libs_test_3.a): New make rule.
3094 * testsuite/Makefile.in: Regenerate.
3095 * testsuite/exclude_libs_test.c : Declare lib3_default().
3097 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3098 * exclude_libs_test_3.c: New file.
3100 2009-05-26 Nick Clifton <nickc@redhat.com>
3102 * po/id.po: New Indonesian translation.
3103 * po/gold.pot: Updated template file.
3105 2009-05-22 Sriraman Tallam <tmsriram@google.com>
3107 * testsuite/Makefile.am: Add -ffunction-sections to compile
3108 gc_comdat_test files. Add -Wl,--gc-sections to build
3110 * testsuite/Makefile.in: Regenerate.
3111 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3113 2009-05-21 Sriraman Tallam <tmsriram@google.com>
3115 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3116 kept comdat section was garbage collected.
3117 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3118 * testsuite/Makefile.in: Regenerate.
3119 * testsuite/gc_comdat_test.sh: New file.
3120 * testsuite/gc_comdat_test_1.cc: New file.
3121 * testsuite/gc_comdat_test_2.cc: New file.
3123 2009-05-19 Doug Kwan <dougkwan@google.com>
3125 * archive.cc (Archive::Archive): Move constructor from archive.h
3126 to here. Initialize no_export_.
3127 (Archive::get_elf_object_for_member): Set no_export flag of object.
3128 * archive.h (Archive::Archive): Move constructor body to
3130 (Archive::no_export): New method.
3131 (Archive::no_export_): New field.
3132 * object.h (Object::Object): Initialize no_export_ to false.
3133 (Object::no_export, Object::set_no_export): New methods.
3134 (Object::no_export_): New field.
3135 * options.cc (General_options::parse_exclude_libs): New method.
3136 (General_options::check_excluded_libs) Same.
3137 * options.h (exclude_libs): New option.
3138 (General_options::check_excluded_libs): New method declaration.
3139 (General_options::excluded_libs_): New field.
3140 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3141 default or protected visibility if an object has no-export flag set.
3142 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3143 (check_SCRIPTS): Add exclude_libs_test.sh.
3144 (check_DATA): Add exclude_libs_test.syms.
3145 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3146 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3147 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3148 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3149 (exclude_libs_test.syms, libexclude_libs_test_1.a,
3150 libexclude_libs_test_2.a): New rules.
3151 * testsuite/Makefile.in: Regenerate.
3152 * testsuite/exclude_libs_test.c: New file.
3153 * testsuite/exclude_libs_test.sh: Ditto.
3154 * testsuite/exclude_libs_test_1.c: Ditto.
3155 * testsuite/exclude_libs_test_2.c: Ditto.
3157 2009-05-15 Ian Lance Taylor <iant@google.com>
3159 * configure.ac: Check for declarations for cases where libiberty.h
3160 checks HAVE_DECL_xxx.
3161 * configure, config.in: Rebuild.
3163 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
3165 * gold.h (Incremental_argument_list): Remove (invalid) forward
3167 * incremental.cc (Incremental_inputs::report_achive): New method.
3168 (Incremental_inputs::report_object): New method.
3169 (Incremental_inputs::report_script): New method.
3170 (Incremental_inputs::finalize_inputs): New method.
3171 (Incremental_inputs::finalize): Call finalize_inputs().
3172 (Incremental_inputs::sized_create_incremental_inputs_section_data):
3173 Create inputs entries.
3174 * incremental.h (Incremental_input_type): New enum.
3175 (Incremental_inputs::Incremental_input): Initialize new fields.
3176 (Incremental_inputs::report_inputs): New method.
3177 (Incremental_inputs::report_achive): New method.
3178 (Incremental_inputs::report_object): New method.
3179 (Incremental_inputs::report_script): New method.
3180 (Incremental_inputs::finalize_inputs): New method.
3181 (Incremental_inputs::Input_info): New struct.
3182 (Incremental_inputs::Input_info_map): New typedef.
3183 (Incremental_inputs::lock_): New field.
3184 (Incremental_inputs::Inputs_): New field.
3185 (Incremental_inputs::Inputs_map): New field.
3186 * main.cc (main): Call Incremental_input::report_inputs.
3187 * options.h (Input_argument_list): Typedef moved from
3189 (Input_file_group::Files): Remove, use ::Input_argument_list.
3190 (Input_file_group::Input_argument_list): Remove, use
3191 ::Input_argument_list.
3192 * plugin.cc (Plugin_manager::add_input_file): Add error in
3194 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3196 * script.cc (read_input_script): Call
3197 Incremental_input::report_script.
3198 * script.h (Script_info): New class.
3200 2009-04-27 Ian Lance Taylor <iant@google.com>
3202 * x86_64.cc (do_adjust_output_section): Set entsize to
3205 2009-04-23 Elliott Hughes <enh@google.com>
3207 * output.cc (Output_file::close): After short writes, continue
3208 writing from the correct offset in the buffer being written.
3210 2009-04-23 Chris Demetriou <cgd@google.com>
3212 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3213 * configure: Regenerate.
3214 * config.in: Regenerate.
3215 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3216 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3218 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
3220 * incremental.cc (Incremental_inputs_header_data): Renamed from
3221 Incremental_input_header_data.
3222 (Incremental_inputs_header_data::data_size): New field.
3223 (Incremental_inputs_header_data::put_input_file_count): Renamed
3224 from input_file_count.
3225 (Incremental_inputs_header_data::put_command_line_offset): Renamed
3226 from command_line_offset.
3227 (Incremental_inputs_header_data::put_reserved): Renamed from
3229 (Incremental_inputs_entry_data): Renamed from
3230 Incremental_input_entry_data.
3231 (Incremental_inputs_entry_data::data_size): New field.
3232 (Incremental_inputs::report_command_line): New method.
3233 (Incremental_inputs::finalize): New method.
3234 (Incremental_inputs::create_incremental_inputs_data): New method.
3235 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3236 * incremental.h: New file.
3237 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3238 (Layout::finalize): Create incremental inputs section in
3240 (Layout::create_incremental_info_sections): New method.
3241 * layout.h (Layout::incremental_inputs): New method.
3242 (Layout::create_incremental_info_sections): New method.
3243 (Layout::incremental_inputs_): New field.
3244 * main.cc (main): Notify Incremental_input of the command line.
3246 2009-04-01 Ian Lance Taylor <iant@google.com>
3247 Mikolaj Zalewski <mikolajz@google.com>
3249 * gold.h (reserve_unordered_map): Define, three versions, one for
3250 each version of Unordered_map.
3251 * layout.cc (Layout::Layout): Remove options parameter. Add
3252 number_of_input_files parameter. Don't initialize options_.
3253 Initialize number_of_input_files_ and resized_signatures_. Move
3254 sections_are_attached_.
3255 (Layout::layout_group): Reserve space for group_signatures_.
3256 (Layout::find_or_add_kept_section): Change name parameter to be a
3257 reference. Resize signatures_ map when it gets large enough.
3258 (Layout::layout_eh_frame): Use parameters->options() instead of
3260 (Layout::make_output_section): Likewise.
3261 (Layout::attach_allocated_section_to_segment): Likewise.
3262 (Layout::finalize, Layout::create_executable_stack): Likewise.
3263 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3264 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3265 * layout.h (class Layout): Update declarations. Remove options_
3266 field. Add number_of_input_files_ and resized_signatures_
3267 fields. Move sections_are_attached_ field.
3268 * main.cc (main): Pass number of input files to Layout
3269 constructor. Don't pass options.
3271 2009-03-30 Ian Lance Taylor <iant@google.com>
3273 * ffsll.c (ffsll): Correct implementation.
3275 2009-03-27 Ian Lance Taylor <iant@google.com>
3277 * ffsll.c: New file.
3278 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3279 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3280 * ftruncate.c (ftruncate): Declare before definition.
3281 * mremap.c (mremap): Likewise.
3282 * pread.c (pread): Likewise.
3283 * configure, Makefile.in, config.in: Rebuild.
3285 * mremap.c: New file.
3286 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3287 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3288 (mremap): Declare if HAVE_MREMAP is not defined.
3289 * configure, Makefile.in, config.in: Rebuild.
3291 2009-03-27 Cary Coutant <ccoutant@google.com>
3293 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3294 position independent.
3295 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3296 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3298 2009-03-24 Cary Coutant <ccoutant@google.com>
3300 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3302 (needs_dynamic_reloc): Likewise.
3304 2009-03-24 Ian Lance Taylor <iant@google.com>
3306 * yyscript.y (file_cmd): Recognize EXTERN.
3307 (extern_name_list, extern_name_list_body): New nonterminals.
3308 * script.cc (script_add_extern): Define.
3309 * script-c.h (script_add_extern): Declare.
3311 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
3313 * object.cc (is_elf_object): Define.
3314 * object.h (is_elf_object): Declare.
3315 * archive.cc (Archive::get_elf_object_for_member): Call
3317 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3319 2009-03-24 Elliott Hughes <enh@google.com>
3321 * output.cc (Output_file::map_anonymous): Define.
3322 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3323 try an anonymous one. Report the size if the mmap fails.
3324 * output.h (class Output_file): Declare map_anonymous.
3326 2009-03-24 Ian Lance Taylor <iant@google.com>
3328 * target-select.cc (instantiate_target): Don't acquire the lock if
3329 the instantiated_target_ field has already been set.
3331 2009-03-23 Ian Lance Taylor <iant@google.com>
3333 * gold-threads.h (class Initialize_lock): Define.
3334 * gold-threads.cc (class Initialize_lock_once): Define.
3335 (initialize_lock_control): New static variable.
3336 (initialize_lock_pointer): New static variable.
3337 (initialize_lock_once): New static function.
3338 (Initialize_lock::Initialize_lock): Define.
3339 (Initialize_lock::initialize): Define.
3340 * target-select.h: Include "gold-threads.h".
3341 (class Target_selector): Add lock_ and initialize_lock_ fields.
3342 Don't define instantiate_target, just declare it.
3343 * target-select.cc (Target_selector::Target_selector): Initialize
3345 (Target_selector::instantiate_target): Define.
3346 * descriptors.h: Include "gold-threads.h".
3347 (class Descriptors): Add initialize_lock_ field.
3348 * descriptors.cc (Descriptors::Descriptors): Initialize new
3350 (Descriptors::open): Use initialize_lock_ field
3351 * errors.h (class Errors): Add initialize_lock_ field.
3352 * errors.cc (Errors::Errors): Initialize new field.
3353 (Errors::initialize_lock): Use initialize_lock_ field.
3354 * powerpc.cc (class Target_selector_powerpc): Remove
3355 instantiated_target_ field. In do_recognize call
3356 instantiate_target rather than do_instantiate_target. In
3357 do_instantiate_target just allocate a new target.
3358 * sparc.cc (class Target_selector_sparc): Likewise.
3360 * freebsd.h: New file.
3361 * i386.cc: Include "freebsd.h".
3362 (Target_i386): Derive from Target_freebsd rather than
3364 (Target_selector_i386): Derive from Target_selector_freebsd rather
3365 than Target_selector.
3366 * x86_64.cc: Include "freebsd.h".
3367 (Target_x86_64): Derive from Target_freebsd rather than
3369 (Target_selector_x86_64): Derive from Target_selector_freebsd
3370 rather than Target_selector.
3371 * target.h (class Target): Add adjust_elf_header and
3372 do_adjust_elf_header.
3373 * output.cc (Output_file_header:: do_sized_write): Call target
3374 adjust_elf_header routine.
3375 * configure.tgt: Set targ_osabi.
3376 * configure.ac: Define GOLD_DEFAULT_OSABI.
3377 * parameters.cc (Parameters::default_target): Pass
3378 GOLD_DEFAULT_OSABI to select_target.
3379 * target-select.h (class Target_selector): Make instantiate_target
3380 protected rather than private.
3381 * Makefile.am (HFILES): Add freebsd.h.
3382 * configure, Makefile.in, config.in: Rebuild.
3384 * merge.cc (do_add_input_section): Correct pend value. Change
3385 message about last entry not being null terminated from error to
3388 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3390 * incremental.cc: New file.
3391 * Makefile.am (CCFILES): Add incremental.cc.
3392 * Makefile.in: Rebuild.
3394 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3396 * layout.cc (Layout::output_section_name): Preserve names
3397 of '.note.' sections.
3399 2009-03-19 Ian Lance Taylor <iant@google.com>
3401 * descriptors.cc (Descriptors::open): Check that the options are
3402 valid before using them.
3404 2009-03-18 Ian Lance Taylor <iant@google.com>
3406 * script-sections.h: Include <list>.
3407 (class Script_sections): Change Sections_elements from std::vector
3408 to std::list. Typedef public Elements_iterator. Add
3409 orphan_section_placement_, data_segment_align_start_, and
3410 saw_data_segment_align_ fields. Remove data_segment_align_index_
3412 * script-sections.cc (class Orphan_section_placement): New class.
3413 (class Sections_element): Add virtual functions is_relro and
3414 orphan_section_init. Remove virtual function place_orphan_here.
3415 (class Output_section_definition): Add is_relro and
3416 orphan_section_init. Remove place_orphan_here.
3417 (class Orphan_output_section): Likewise.
3418 (Script_sections::Script_sections): Update for field changes.
3419 (Script_sections::data_segment_align): Set saw_data_segment_align_
3420 and data_segment_align_start_, not data_segment_align_index.
3421 (Script_sections::data_segment_relro_end): Check
3422 saw_data_segment_align_. Use data_segment_align_start_ rather
3423 than data_segment_align_index_.
3424 (Script_sections::place_orphan): Rewrite to use
3425 Orphan_section_placement.
3427 2009-03-17 Ian Lance Taylor <iant@google.com>
3429 * archive.cc (Archive::add_symbols): Check for a version attached
3430 to the symbol name in the archive map.
3431 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3432 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3433 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3434 (ver_test_11.a): New target.
3435 * testsuite/Makefile.in: Rebuild.
3437 * configure.ac: Check for chsize and posix_fallocate. Replace
3439 * ftruncate.c: New file, from gnulib.
3440 * output.cc (posix_fallocate): Define dummy version if not
3441 HAVE_POSIX_FALLOCATE.
3442 (Output_file::map): Call posix_fallocate rather than lseek and
3444 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3445 * configure, Makefile.in, config.in: Rebuild.
3447 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3449 * layout.h (Layout::create_note): Add section_name parameter.
3450 * layout.cc (Layout::create_note): Likewise.
3451 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3453 2009-03-17 Ian Lance Taylor <iant@google.com>
3455 * descriptors.cc: Include "options.h".
3456 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3457 (Descriptors::open): Always use O_CLOEXEC when opening a new
3458 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3459 then set FD_CLOEXEC.
3461 * sparc.cc (class Target_sparc): Add has_got_section.
3462 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3463 make sure we have a GOT section.
3465 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3466 (Target_sparc::Scan::local): Likewise.
3467 (Target_sparc::Scan::global): Likewise.
3468 (Target_sparc::Relocate::relocate): Likewise.
3469 (Target_sparc::Relocate::relocate_tls): Likewise.
3471 * symtab.cc (Symbol_table::define_default_version): New function,
3472 broken out of add_from_object.
3473 (Symbol_table::add_from_object): Call define_default_version.
3474 (Symbol_table::define_special_symbol): Add resolve_oldsym
3475 parameter. Change all callers. If the version for a symbol comes
3476 from a version script, resolve it with the symbol with the same
3477 name with no version. Also add the symbol without a version if
3479 (do_define_in_output_data): If resolving with oldsym, don't delete
3481 (do_define_in_output_segment): Likewise.
3482 (do_define_as_constant): Likewise.
3483 * symtab.h (class Symbol_table): Update declarations.
3485 2009-03-13 Ian Lance Taylor <iant@google.com>
3487 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3488 (Read_symbols::requeue): New function.
3489 (Read_symbols::do_read_symbols): If make_elf_object fails because
3490 the target type is not configured, and the file was searched for,
3491 issue a warning and retry with the next directory.
3492 (Add_symbols::run): If the file has an incompatible format, and
3493 it was searched for, requeue the Read_symbols task. On error,
3495 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3496 dirindex parameter to constructor. Change all callers. Declare
3497 incompatible_warning and requeue.
3498 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3499 input_argument_ and input_group_ fields. Add them to
3500 constructor. Change all callers.
3501 (class Read_script): Add dirindex_ field. Add it to constructor.
3503 * archive.cc (Archive::setup): Remove input_objects parameter.
3505 (Archive::get_file_and_offset): Likewise.
3506 (Archive::read_all_symbols): Likewise.
3507 (Archive::read_symbols): Likewise.
3508 (Archive::get_elf_object_for_member): Remove input_objects
3509 parameter. Add punconfigured parameter. Change all callers.
3510 (Archive::add_symbols): Change return type to bool. Check return
3511 value of include_member.
3512 (Archive::include_all_members): Likewise.
3513 (Archive::include_member): Change return type to bool. Return
3514 false if first included object has incompatible target. Set
3515 included_member_ field.
3516 (Add_archive_symbols::run): If add_symbols returns false, requeue
3518 * archive.h (class Archive): Add included_member_ field.
3519 Initialize it in constructor. Add input_file and searched_for
3520 methods. Update declarations.
3521 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3522 input_argument_ fields. Add them to constructor. Change all
3524 * script.cc: Include "target-select.h".
3525 (class Parser_closure): Add skip_on_incompatible_target_ and
3526 found_incompatible_target_ fields. Add
3527 skip_on_incompatible_target parameter to constructor. Change all
3528 callers. Add methods skip_on_incompatible_target,
3529 clear_skip_on_incompatible_target, found_incompatible_target, and
3530 set_found_incompatible_target.
3531 (read_input_script): Add dirindex parameter. Change all callers.
3532 If parser finds an incompatible target, requeue Read_symbols
3534 (script_set_symbol): Clear skip_on_incompatible_target in
3536 (script_add_assertion, script_parse_option): Likewise.
3537 (script_start_sections, script_add_phdr): Likewise.
3538 (script_check_output_format): New function.
3539 * script.h (read_input_script): Update declaration.
3540 * script-c.h (script_check_output_format): Declare.
3541 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3542 (ignore_cmd): Remove OUTPUT_FORMAT.
3543 * fileread.cc (Input_file::Input_file): Add explicit this.
3544 (Input_file::will_search_for): New function.
3545 (Input_file::open): Add pindex parameter. Change all callers.
3546 * fileread.h (class Input_file): Add input_file_argument method.
3547 Declare will_search_for. Update declarations.
3548 * object.cc (make_elf_object): Add punconfigured parameter.
3550 * object.h (class Object): Make input_file public. Add
3551 searched_for method.
3552 (make_elf_object): Update declaration.
3553 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3555 * dirsearch.h (class Dirsearch): Update declaration.
3556 * options.h (class General_options): Add --warn-search-mismatch.
3557 * parameters.cc (Parameters::is_compatible_target): New function.
3558 * parameters.h (class Parameters): Declare is_compatible_target.
3559 * workqueue.cc (Workqueue::add_blocker): New function.
3560 * workqueue.h (class Workqueue): Declare add_blocker.
3562 * fileread.cc (Input_file::open): Remove options parameter.
3564 (Input_file::open_binary): Likewise.
3565 * script.cc (read_input_script): Likewise.
3566 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3567 options parameter from constructor. Change all callers.
3568 (class Read_script): Likewise.
3569 * fileread.h (class Input_file): Update declarations.
3570 * script.h (read_input_script): Update declaration.
3572 2009-03-10 Nick Clifton <nickc@redhat.com>
3574 * po/es.po: New Spanish translation.
3576 2009-03-06 Cary Coutant <ccoutant@google.com>
3578 * options.cc (parse_short_option): Keep dash_z from registering itself.
3580 2009-03-03 Ian Lance Taylor <iant@google.com>
3583 * target-reloc.h (relocate_section): Pass output_section to
3585 * i386.cc (Target_i386::should_apply_static_reloc): Add
3586 output_section parameter. Change all callers.
3587 (Target_i386::Relocate::relocate): Add output_section parameter.
3588 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3589 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3590 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3591 * testsuite/two_file_shared.sh: New script.
3592 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3593 (check_DATA): Add two_file_shared.dbg.
3594 (two_file_shared.dbg): New target.
3595 * testsuite/Makefile.in: Rebuild.
3597 2009-03-01 Ian Lance Taylor <iant@google.com>
3599 * configure.ac: Check for byteswap.h.
3600 * configure: Rebuild.
3601 * config.in: Rebuild.
3603 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3605 * layout.cc (Layout::find_or_add_kept_section): New function.
3606 (Layout::add_comdat): Removed.
3607 * layout.h (struct Kept_section): Move out of class Layout.
3608 Remove trailing underscores from field names. Add group_sections
3609 field. Rename group_ field to is_group. Change all uses.
3610 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3611 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3612 comdat_groups_ field.
3613 (Sized_relobj::include_section_group): Use
3614 find_or_add_kept_section and Kept_section::group_sections.
3615 (Sized_relobj::include_linkonce_section): Likewise.
3616 * object.cc (class Sized_relobj): Don't define Comdat_group or
3617 Comdat_group_table. Remove find_comdat_group and
3618 add_comdat_group. Remove comdat_groups_ field.
3619 * plugin.cc (include_comdat_group): Use
3620 Layout::find_or_add_kept_section.
3622 2009-02-28 Ian Lance Taylor <iant@google.com>
3624 * README: --gc-sections and map files are now supported. Document
3625 some build requirements.
3628 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3629 relocatable link set the value of the section symbol to zero.
3630 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3631 relocatable link don't include the section address in the local
3634 2009-02-27 Ian Lance Taylor <iant@google.com>
3637 * options.h (class Search_directory): Add is_system_directory.
3638 (class General_options): Declare is_in_system_directory.
3639 * options.cc (get_relative_sysroot): Make static.
3640 (get_default_sysroot): Make static.
3641 (General_optoins::is_in_system_directory): New function.
3642 * fileread.cc (Input_file::is_in_system_directory): New function.
3643 * fileread.h (class Input_file): Declare is_in_system_directory.
3644 * object.h (class Object): Add is_in_system_directory.
3645 (class Input_objects): Remove system_library_directory_ field.
3646 * object.cc (Input_objects::add_object): Don't set
3647 system_library_directory_.
3648 (input_objects::found_in_system_library_directory): Remove.
3649 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3650 parameter. Change all callers.
3651 (Symbol_table::sized_write_globals): Likewise.
3652 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3653 Call Object::is_in_system_directory.
3654 * symtab.h (class Symbol_table): Update declarations.
3657 * descriptors.h (Open_descriptor): Add is_on_stack field.
3658 * descriptors.cc (Descriptors::open): If the descriptor is on the
3659 top of the stack, remove it. Initialize is_on_stack field.
3660 (Descriptors::release): Only add pod to stack if it is not on the
3662 (Descriptors::close_some_descriptor): Clear stack_next and
3666 * output.cc (Output_section::find_starting_output_address): Rename
3667 from starting_output_address; add PADDR parameter; change return
3669 * output.h (class Output_section): Declare
3670 find_starting_output_address instead of starting_output_address.
3671 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3672 section symbol for which we can't find a merge section.
3675 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3676 hidden or internal, force the symbol to be local.
3677 * resolve.cc (Symbol::override_visibility): Define.
3678 (Symbol::override_base): Use override_visibility.
3679 (Symbol_table::resolve): Likewise.
3680 (Symbol::override_base_with_special): Likewise.
3681 (Symbol_table::override_with_special): If the visibility is hidden
3682 or internal, force the symbol to be local.
3683 * symtab.h (class Symbol): Add set_visibility and
3684 override_visibility.
3685 * testsuite/ver_test_1.sh: New file.
3686 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3687 (check_DATA): Add ver_test_1.syms.
3688 (ver_test_1.syms): New target.
3689 * testsuite/Makefile.in: Rebuild.
3691 2009-02-25 Cary Coutant <ccoutant@google.com>
3693 * layout.cc (Layout::choose_output_section): Don't rename sections
3694 when using a linker script that has a SECTIONS clause.
3695 * Makefile.in: Regenerate.
3697 * testsuite/Makefile.am (script_test_5.sh): New test case.
3698 * testsuite/Makefile.in: Regenerate.
3699 * testsuite/script_test_5.cc: New file.
3700 * testsuite/script_test_5.sh: New file.
3701 * testsuite/script_test_5.t: New file.
3703 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
3705 * archive.cc (Archive::include_member): Update calls to add_symbols.
3706 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3707 the Layout argument.
3708 * dynobj.h (do_add_symbols): Add the Layout argument.
3709 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3711 * object.h (Object::add_symbols): Add the Layout argument.
3712 (Object::do_add_symbols): Add the Layout argument.
3713 (Sized_relobj::do_add_symbols): Add the Layout argument.
3714 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3715 Unify the two versions.
3716 (Add_plugin_symbols): Remove.
3717 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3718 (Sized_pluginobj::do_add_symbols): Unify the two versions.
3719 (Add_plugin_symbols): Remove.
3720 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3721 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3722 (Add_symbols::run): Make it work with Pulginobj.
3724 2009-02-06 Ian Lance Taylor <iant@google.com>
3726 * object.cc (Sized_relobj::do_layout): Make info message start
3727 with lower case letter.
3729 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
3731 * binary.cc: Fix file comment.
3733 * options.h (enum Incremental_disposition): Define.
3734 (class General_options): Add new options: --incremental,
3735 --incremental_changed, --incremental_unchanged,
3736 --incremental_unknown. Add incremental_disposition_ and
3737 implicit_incremental_ fields.
3738 (General_options::incremental_disposition): New function.
3739 (class Position_dependent_options): Add incremental_disposition
3741 (Position_dependent_options::copy_from_options): Set incremental
3743 * options.cc (General_options::parse_incremental_changed): New
3745 (General_options::parse_incremental_unchanged): New function.
3746 (General_options::parse_incremental_unknown): New function.
3747 (General_options::General_options): Initialize new fields
3748 incremental_disposition_ and implicit_incremental_.
3749 (General_options::finalize): Check for uasge of --incremental-*
3750 without --incremental.
3752 2009-02-06 Chris Demetriou <cgd@google.com>
3754 * gold.h (gold_undefined_symbol): Change to take only a Symbol
3755 pointer and to report location as the file name associated with
3757 (gold_undefined_symbol_at_location): New function to replace the
3758 old gold_undefined_symbol functionality.
3759 * target-reloc.h (relocate_section): Update to use
3760 gold_undefined_symbol_at_location.
3761 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3762 Call gold_undefined_symbol function rather than gold_error.
3763 * errors.h (Errors::undefined_symbol): Take location as a
3764 string, rather than calculating it from a relocation.
3765 * errors.cc (Errors::fatal): Print "fatal error:" before the
3767 (Errors::error, Errors::error_at_location): Print "error: "
3768 before the formatted message.
3769 (Errors::undefined_symbol): Take location as a string, rather
3770 than calculating it from a relocation.
3771 (gold_undefined_symbol_at_location): New function akin to
3772 old gold_undefined_symbol, calculates location from relocation.
3773 (gold_undefined_symbol): Change to take only a Symbol pointer
3774 and to report location as the file name associated with the symbol.
3775 * testsuite/debug_msg.sh: Update for changed error messages.
3776 * testsuite/undef_symbol.sh: Likewise.
3778 2009-02-04 Duncan Sands <baldrick@free.fr>
3781 * reduced_debug_output.h
3782 (Output_reduced_debug_abbrev_section::failed): Use format for
3784 (Output_reduced_debug_info_section::faild): Likewise.
3786 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
3788 * script.cc (Lazy_demangler): New class.
3789 (Version_script_info::get_symbol_version_helper): Demangle a
3792 2009-01-29 Cary Coutant <ccoutant@google.com>
3794 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
3796 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3798 2009-01-28 Ian Lance Taylor <iant@google.com>
3800 * version.cc (version_string): Bump to 1.9.
3802 * gold.h: Include <cstring> and <stdint.h>.
3803 * version.cc: Include <cstdio>.
3804 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
3806 * reduced_debug_output.cc (insert_into_vector): Rename from
3807 Insert_into_vector; change all callers. Use Swap_unaligned to
3808 avoid aliasing issue; remove union since it is unnecessary.
3810 2009-01-27 Sriraman Tallam <tmsriram@google.com>
3812 * Makefile.am (CCFILES): Add gc.cc.
3814 * Makefile.in: Regenerate.
3815 * gold.cc (Gc_runner): New class.
3816 (queue_initial_tasks): Call garbage collection related tasks
3817 when corresponding options are invoked.
3818 (queue_middle_gc_tasks): New function.
3819 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
3820 processed early before laying out sections during garbage collection.
3821 * gold.h (queue_middle_gc_tasks): New function.
3822 (is_prefix_of): Move from "layout.cc".
3823 * i386.cc (Target_i386::gc_process_relocs): New function.
3824 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
3825 * main.cc (main): Create object of class "Garbage_collection".
3826 * object.cc (Relobj::copy_symbols_data): New function.
3827 (Relobj::is_section_name_included): New function.
3828 (Sized_relobj::do_layout): Allow this function to be called twice
3829 during garbage collection and defer layout of section during the
3831 * object.h (Relobj::get_symbols_data): New function.
3832 (Relobj::is_section_name_included): New function.
3833 (Relobj::copy_symbols_data): New function.
3834 (Relobj::set_symbols_data): New function.
3835 (Relobj::get_relocs_data): New function.
3836 (Relobj::set_relocs_data): New function.
3837 (Relobj::is_output_section_offset_invalid): New pure virtual function.
3838 (Relobj::gc_process_relocs): New function.
3839 (Relobj::do_gc_process_relocs): New pure virtual function.
3840 (Relobj::sd_): New data member.
3841 (Sized_relobj::is_output_section_offset_invalid): New function.
3842 (Sized_relobj::do_gc_process_relocs): New function.
3843 * options.h (General_options::gc_sections): Modify to not be a no-op.
3844 (General_options::print_gc_sections): New option.
3845 * plugin.cc (Plugin_finish::run): Remove function call to
3846 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
3847 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
3848 * reloc.cc (Read_relocs::run): Add task to process relocs and
3849 determine unreferenced sections when doing garbage collection.
3850 (Gc_process_relocs): New class.
3851 (Sized_relobj::do_gc_process_relocs): New function.
3852 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
3853 sections that are garbage collected.
3854 * reloc.h (Gc_process_relocs): New class.
3855 * sparc.cc (Target_sparc::gc_process_relocs): New function.
3856 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
3857 symbols whose corresponding sections are garbage collected.
3858 (Symbol_table::Symbol_table): Add new parameter for the garbage
3860 (Symbol_table::gc_mark_undef_symbols): New function.
3861 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3862 (Symbol_table::gc_mark_dyn_syms): New function.
3863 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
3865 (Symbol_table::add_from_object): Likewise.
3866 (Symbol_table::add_from_relobj): When building shared objects, do not
3867 treat externally visible symbols as garbage.
3868 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
3869 table information for static and relocatable links.
3870 * symtab.h (Symbol_table::set_gc): New function.
3871 (Symbol_table::gc): New function.
3872 (Symbol_table::gc_mark_undef_symbols): New function.
3873 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3874 (Symbol_table::gc_mark_dyn_syms): New function.
3875 (Symbol_table::gc_): New data member.
3876 * target.h (Sized_target::gc_process_relocs): New pure virtual
3878 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
3879 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
3881 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
3883 * options.h (General_options::gc_sections): Define as a no-op for now.
3884 (General_options::no_keep_memory): Ditto.
3885 (General_options::Bshareable): Define.
3886 * options.cc (General_options::finalize): Honor -Bshareable.
3888 2009-01-20 Andreas Schwab <schwab@suse.de>
3890 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
3891 read the value in the contents, since we don't use it. Use the
3892 template endianness when writing.
3893 (Relocate::relocate): Use it for R_PPC_REL16_HA.
3895 2009-01-19 Andreas Schwab <schwab@suse.de>
3897 * configure.tgt (powerpc64-*): Fix targ_obj.
3899 2009-01-15 Ian Lance Taylor <iant@google.com>
3901 * object.cc (Sized_relobj::write_local_symbols): Don't write out
3902 local symbols when stripping all symbols.
3904 2009-01-14 Cary Coutant <ccoutant@google.com>
3906 * output.cc (Output_reloc): Add explicit instantiations.
3908 2009-01-14 Cary Coutant <ccoutant@google.com>
3910 * archive.cc (Archive::get_elf_object_for_member): Remove call
3911 to File_read::claim_for_plugin.
3912 * descriptors.cc (Descriptors::open): Remove reference to
3914 (Descriptors::claim_for_plugin): Remove.
3915 * descriptors.h (Descriptors::claim_for_plugin): Remove.
3916 (Descriptors::is_claimed): Remove.
3917 (claim_descriptor_for_plugin): Remove.
3918 * fileread.cc (File_read::claim_for_plugin): Remove.
3919 * fileread.h (File_read::claim_for_plugin): Remove.
3920 (File_read::descriptor): Reopen descriptor if necessary.
3921 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
3922 (Plugin_manager::all_symbols_read): Add task parameter. Change
3924 (Plugin_manager::get_input_file): New function.
3925 (Plugin_manager::release_input_file): New function.
3926 (Pluginobj::Pluginobj): Add filesize parameter and initialize
3927 corresponding data member.
3928 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3929 and pass to base constructor. Change all callers.
3930 (get_input_file, release_input_file): New functions.
3931 (make_sized_plugin_object): Add filesize parameter. Change all callers.
3932 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3933 (Plugin_manager::all_symbols_read): Add task parameter.
3934 (Plugin_manager::get_input_file): New function.
3935 (Plugin_manager::release_input_file): New function.
3936 (Plugin_manager::task_): New data member.
3937 (Pluginobj::Pluginobj): Add filesize parameter.
3938 (Pluginobj::filename): New function.
3939 (Pluginobj::descriptor): New function.
3940 (Pluginobj::filesize): New function.
3941 (Pluginobj::filesize_): New data member.
3942 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3943 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3944 File_read::claim_for_plugin; use Object::unlock to unlock the file.
3946 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3947 with archive libraries.
3948 * testsuite/Makefile.in: Regenerate.
3949 * testsuite/plugin_test.c (struct sym_info): New type.
3950 (get_input_file, release_input_file): New static variables.
3951 (onload): Capture new transfer vector entries.
3952 (claim_file_hook): Stop reading at end of file according to filesize.
3953 Factor out parsing of readelf output into separate function.
3954 (all_symbols_read_hook): Exercise get_input_file and release_input_file
3955 APIs and get the source file name from the symbol table. Convert
3956 source file name to corresponding object file name. Print info
3957 message when adding new input files.
3958 (parse_readelf_line): New function.
3959 * testsuite/plugin_test_1.sh: Add checks for new info messages.
3960 * testsuite/plugin_test_2.sh: Likewise.
3961 * testsuite/plugin_test_3.sh: Likewise.
3962 * testsuite/plugin_test_4.sh: New test case.
3964 2009-01-07 Ian Lance Taylor <iant@google.com>
3966 * version.cc (version_string): Bump to 1.8.
3968 2008-12-23 Cary Coutant <ccoutant@google.com>
3970 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3971 * plugin.cc (Plugin_manager::finish): Rename as
3972 layout_deferred_objects. Move cleanup to separate function.
3973 (Plugin_manager::cleanup): New function.
3974 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3976 * plugin.h (Plugin_manager::finish): Rename as
3977 layout_deferred_objects.
3978 (Plugin_manager::cleanup): New function.
3979 (Plugin_manager::cleanup_done): New field.
3981 2008-12-23 Cary Coutant <ccoutant@google.com>
3983 * plugin.cc (is_visible_from_outside): New function.
3984 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3985 so we don't return "IR only" status for exported symbols or -r links.
3987 * testsuite/Makefile.am (plugin_test_3): New test case.
3988 * testsuite/Makefile.in: Regenerate.
3989 * testsuite/plugin_test_3.sh: New file.
3991 2008-12-22 Cary Coutant <ccoutant@google.com>
3993 * object.cc (Sized_relobj::layout_section): New function.
3994 (Sized_relobj::do_layout): Defer layout of input sections until after
3995 plugin has provided replacement files.
3996 (Sized_relobj::do_layout_deferred_sections): New function.
3997 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3998 (Relobj::layout_deferred_sections): New function.
3999 (Relobj::do_layout_deferred_sections): New function.
4000 (Sized_relobj::do_layout_deferred_sections): New function.
4001 (Sized_relobj::layout_section): New function.
4002 (Sized_relobj::Deferred_layout): New structure.
4003 (Sized_relobj::deferred_layout_): New field.
4004 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
4005 Change all callers. Layout deferred sections.
4006 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
4008 (Plugin_hook::run): Move code from do_plugin_hook inline.
4009 (Plugin_hook::do_plugin_hook): Remove.
4010 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
4011 (Plugin_manager::finish): Renamed, was cleanup.
4012 (Plugin_manager::should_defer_layout): New function.
4013 (Plugin_manager::add_deferred_layout_object): New function.
4014 (Plugin_manager::Deferred_layout_list): New type.
4015 (Plugin_manager::deferred_layout_objects_): New field.
4016 (Plugin_hook::do_plugin_hook): Remove.
4018 2008-12-17 Ian Lance Taylor <iant@google.com>
4020 * options.h (class General_options): Add --no case for
4023 2008-12-16 Cary Coutant <ccoutant@google.com>
4025 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
4027 (Plugin_manager::claim_file): Create plugin object even if
4028 plugin did not call the add_symbols callback.
4029 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4030 asking for more symbols than were added.
4031 * testsuite/Makefile.am (plugin_test_1): Add test case with
4033 (empty.syms): New target.
4034 * testsuite/Makefile.in: Regenerate.
4035 * testsuite/plugin_test.c (claim_file_hook): Add new debug
4036 message. Don't call add_symbols if no globals.
4037 (all_symbols_read_hook): Don't provide replacement for empty
4040 2008-12-12 Ian Lance Taylor <iant@google.com>
4042 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4043 r_type == 0 for a local symbol with r_sym == 0.
4044 (scan_relocatable_relocs): Pass r_sym to
4045 local_non_section_strategy.
4046 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4049 * configure.ac: Update test for TLS descriptors: they are
4050 supported as of glibc 2.9.
4051 * configure: Rebuild.
4053 2008-12-11 Ian Lance Taylor <iant@google.com>
4056 * target-reloc.h (Default_scan_relocatable_relocs): For each
4057 function, map r_type == 0 to RELOC_DISCARD.
4059 2008-12-10 Cary Coutant <ccoutant@google.com>
4061 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4062 object to override a kept COMDAT group from a plugin object.
4064 2008-12-09 Ian Lance Taylor <iant@google.com>
4067 * yyscript.y (file_cmd): Handle INPUT.
4069 * testsuite/initpri1.c: Change all declarations to be full
4070 prototypes by adding void, to avoid compiler warnings.
4072 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
4074 * options.cc (General_options::parse_plugin_opt): New.
4075 (General_options::add_plugin): The argument now is just the filename.
4076 (General_options::add_plugin_option): New.
4077 * options.h (plugin_opt): New.
4078 (add_plugin): Change argument name.
4079 (add_plugin_option): New.
4080 * plugin.cc (Plugin::load): Don't parse the plugin option.
4081 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4082 (Plugin::add_option): New.
4083 (Plugin::args_): Change type.
4084 (Plugin::filename_): New.
4085 (Plugin_manager::add_plugin_option): New.
4086 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4087 * testsuite/Makefile.in: Regenerate.
4089 2008-12-05 Cary Coutant <ccoutant@google.com>
4091 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4092 Handle --strip-lto-sections option.
4093 * options.h (strip_lto_sections): New option.
4095 2008-12-01 Cary Coutant <ccoutant@google.com>
4097 * plugin.cc (ld_plugin_message): Change format parameter to const.
4098 Fix mismatch between new[] and delete.
4100 2008-11-14 Cary Coutant <ccoutant@google.com>
4102 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4105 2008-11-05 Craig Silverstein <csilvers@google.com>
4107 * options.cc (General_options::parse_dynamic_list): New function.
4108 * options.h (General_options): New flags dynamic_list,
4109 dynamic_list_data, dynamic_list_cpp_new, and
4110 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
4111 (General_options::in_dynamic_list): New function.
4112 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4113 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4114 (Lex::can_continue_name): Likewise.
4116 (read_script_file): New parameter script_options.
4117 (read_dynamic_list): New function.
4118 (Script_options::define_dynamic_list): New function.
4119 (dynamic_list_keyword_parsecodes): New variable.
4120 (dynamic_list_keywords): New variable.
4121 * script.h (Script_options::define_dynamic_list): New function
4123 (read_dynamic_list): New function prototype.
4124 * symtab.cc (strprefix): New macro.
4125 (Symbol::should_add_dynsym_entry): Support dynamic_list,
4126 dynamic_list_data, dynamic_list_cpp_new, and
4127 dynamic_list_cpp_typeinfo.
4128 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4129 (dynamic_list_expr): New rule.
4130 (dynamic_list_nodes): Likewise.
4131 (dynamic_list_node): Likewise.
4132 * testsuite/Makefile.am (dynamic_list): New test.
4133 * testsuite/Makefile.in: Regenerated.
4134 * testsuite/dynamic_list.t: New file.
4135 * testsuite/dynamic_list.sh: New file.
4137 2008-11-05 Craig Silverstein <csilvers@google.com>
4139 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4140 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4141 (t11_last): Likewise.
4142 * testsuite/ver_test_6.c (main): Likewise.
4144 2008-10-07 Cary Coutant <ccoutant@google.com>
4146 * options.c (General_options::finalize): Add check for -static and
4148 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4151 2008-10-02 Cary Coutant <ccoutant@google.com>
4153 * plugin.cc (make_sized_plugin_object): Fix conditional
4154 compilation to work when not all targets are enabled.
4156 2008-09-29 Cary Coutant <ccoutant@google.com>
4158 * archive.cc (Archive::get_file_and_offset): Use filename instead
4159 of name to get library path.
4160 (Archive::include_member): Unlock external member of a thin archive.
4162 * testsuite/Makefile.am (TEST_AR): New variable.
4163 (thin_archive_test_1): New test.
4164 (thin_archive_test_2): New test.
4165 * testsuite/Makefile.in: Regenerate.
4166 * testsuite/thin_archive_main.cc: New file.
4167 * testsuite/thin_archive_test_1.cc: New file.
4168 * testsuite/thin_archive_test_2.cc: New file.
4169 * testsuite/thin_archive_test_3.cc: New file.
4170 * testsuite/thin_archive_test_4.cc: New file.
4172 2008-09-29 Cary Coutant <ccoutant@google.com>
4174 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4175 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4177 (Sized_relobj::do_finalize_local_symbols): Likewise.
4178 (Sized_relobj::map_to_kept_section): Likewise.
4179 * object.h (Sized_relobj::invalid_address): New constant.
4180 (Sized_relobj::do_output_section_offset): Check for invalid_address
4182 * output.cc (Output_reloc::local_section_offset): Use constant
4183 invalid_address instead of -1U.
4184 (Output_reloc::get_address): Likewise.
4185 (Output_section::output_address): Change -1U to -1ULL.
4186 * output.h (Output_reloc::invalid_address): New constant.
4187 * reloc.cc (Sized_relobj::write_sections): Use constant
4188 invalid_address instead of -1U.
4189 (Sized_relobj::relocate_sections): Likewise.
4190 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4191 values for merge sections.
4192 * target-reloc.h (relocate_for_relocatable): Use constant
4193 invalid_address instead of -1U.
4195 2008-09-19 Cary Coutant <ccoutant@google.com>
4197 Add plugin functionality for link-time optimization (LTO).
4198 * configure.ac (plugins): Add --enable-plugins option.
4199 * configure: Regenerate.
4200 * config.in: Regenerate.
4201 * Makefile.am (LIBDL): New variable.
4202 (CCFILES): Add plugin.cc.
4203 (HFILES): Add plugin.h.
4204 (ldadd_var): Add LIBDL.
4205 * Makefile.in: Regenerate.
4207 * archive.cc: Include "plugin.h".
4208 (Archive::setup): Don't preread archive symbols when using a plugin.
4209 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
4210 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4212 (Archive::include_member): Add symbols from plugin objects.
4213 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4214 * descriptors.cc (Descriptors::open): Check for file descriptors
4215 abandoned by plugins.
4216 (Descriptors::claim_for_plugin): New function.
4217 * descriptors.h (Descriptors::claim_for_plugin): New function.
4218 (Open_descriptor::is_claimed): New field.
4219 (claim_descriptor_for_plugin): New function.
4220 * fileread.cc (File_read::claim_for_plugin): New function.
4221 * fileread.h (File_read::claim_for_plugin): New function.
4222 (File_read::descriptor): New function.
4223 * gold.cc: Include "plugin.h".
4224 (queue_initial_tasks): Add task to call plugin hooks for generating
4226 * main.cc: Include "plugin.h".
4227 (main): Load plugin libraries.
4228 * object.h (Pluginobj): Declare.
4229 (Object::pluginobj): New function.
4230 (Object::do_pluginobj): New function.
4231 (Object::set_target): New function.
4232 * options.cc: Include "plugin.h".
4233 (General_options::parse_plugin): New function.
4234 (General_options::General_options): Initialize plugins_ field.
4235 (General_options::add_plugin): New function.
4236 * options.h (Plugin_manager): Declare.
4237 (General_options): Add --plugin option.
4238 (General_options::has_plugins): New function.
4239 (General_options::plugins): New function.
4240 (General_options::add_plugin): New function.
4241 (General_options::plugins_): New field.
4242 * plugin.cc: New file.
4243 * plugin.h: New file.
4244 * readsyms.cc: Include "plugin.h".
4245 (Read_symbols::do_read_symbols): Check for archive before checking
4246 for ELF file. Call plugin hooks to claim files.
4247 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4248 from a real object file; force override when processing replacement
4250 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4251 (Symbol::init_base_object): Likewise.
4252 (Symbol::init_base_output_data): Likewise.
4253 (Symbol::init_base_output_segment): Likewise.
4254 (Symbol::init_base_constant): Likewise.
4255 (Symbol::init_base_undefined): Likewise.
4256 (Symbol::output_section): Assert that object is not a plugin.
4257 (Symbol_table::add_from_pluginobj): New function.
4258 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4260 (Symbol_table::sized_write_globals): Likewise.
4261 (Symbol_table::add_from_pluginobj): Instantiate template.
4262 * symtab.h (Sized_pluginobj): Declare.
4263 (Symbol::in_real_elf): New function.
4264 (Symbol::set_in_real_elf): New function.
4265 (Symbol::in_real_elf_): New field.
4266 (Symbol_table::add_from_pluginobj): New function.
4268 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4269 (LIBDL): New variable.
4271 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4272 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4273 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4274 (MOSTLYCLEANFILES): Likewise.
4275 * testsuite/Makefile.in: Regenerate.
4276 * testsuite/plugin_test.c: New file.
4277 * testsuite/plugin_test_1.sh: New file.
4278 * testsuite/plugin_test_2.sh: New file.
4280 2008-09-16 Ian Lance Taylor <iant@google.com>
4282 * target-reloc.h (relocate_section): Check whether a symbol is
4283 defined by the ABI before reporting an undefined symbol error.
4284 * target.h (Target::is_defined_by_abi): Make parameter const.
4285 (Target::do_is_defined_by_abi): Likewise.
4286 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4287 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4288 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4289 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4290 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4291 * testsuite/Makefile.in: Rebuild.
4293 * fileread.cc (make_view): Add casts to avoid warning.
4295 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4297 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4298 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4300 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4302 * options.h (General_options::output_is_executable): New.
4303 (General_options::output_is_pie): New.
4304 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4305 for shared libraries.
4306 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4308 2008-09-11 Chris Demetriou <cgd@google.com>
4310 * options.h (origin): New -z option.
4311 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4312 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4315 2008-09-05 Cary Coutant <ccoutant@google.com>
4317 * fileread.cc (File_read::make_view): Add check for attempt to map
4320 2008-09-05 Cary Coutant <ccoutant@google.com>
4322 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4323 explicit instantiations.
4325 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4328 * options.cc (General_options::finalize): Allow undefined symbols
4329 in shlibs if linking -shared.
4332 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4333 symbols as not needing a dynsym entry.
4335 2008-08-20 Craig Silverstein <csilvers@google.com>
4337 * fileread.cc (File_read::open): Do not lock the file unless it
4338 was successfully opened.
4340 2008-08-14 Cary Coutant <ccoutant@google.com>
4342 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4343 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4344 * testsuite/tls_test.cc (struct int128): 128-bit struct
4345 for testing TLS relocs with non-zero addend.
4346 (v12): New TLS variable.
4348 (t_last): Add check for v12.
4349 * testsuite/tls_test.h (t12): New function.
4350 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4352 2008-08-13 Ian Lance Taylor <iant@google.com>
4354 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4355 set tls_segment_ or relro_segment_.
4356 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4358 * output.h (Output_section::clear_is_relro): New function.
4359 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4360 sections specially even when output_data_ is empty.
4361 (Output_segment::maximum_alignment): When first section is relro,
4362 only force alignment for PT_LOAD segments.
4363 * script.cc (script_data_segment_align): New function.
4364 (script_data_segment_relro_end): New function.
4365 * script-c.h (script_data_segment_align): Declare.
4366 (script_data_segment_relro_end): Declare.
4367 * script-sections.h (class Script_sections): Declare
4368 data_segment_align and data_segment_relro_end. Add fields
4369 segment_align_index_ and saw_relro_end_.
4370 * script-sections.cc (class Sections_element): Add set_is_relro
4371 virtual function. Add new bool* parameter to place_orphan_here.
4372 Add get_output_section virtual function.
4373 (class Output_section_definition): Add set_is_relro. Add new
4374 bool* parameter to place_orphan_here. Add get_output_section.
4375 Add is_relro_ field.
4376 (Output_section_definition::Output_section_definition): Initialize
4377 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4378 and is_relro_ fields.
4379 (Output_section_definition::place_orphan_here): Add is_relro
4381 (Output_section_definition::set_section_addresses): Set relro for
4383 (Output_section_definition::alternate_constraint): Likewise.
4384 (class Orphan_output_section): Add new bool* parameter to
4385 place_orphan_here. Add get_output_section.
4386 (Orphan_output_section::place_orphan_here): Add is_relro
4388 (Script_sections::Script_sections): Initialize
4389 data_segment_align_index_ and saw_relro_end_.
4390 (Script_sections::data_segment_align): New function.
4391 (Script_sections::data_segment_relro_end): New function.
4392 (Script_sections::place_orphan): Set or clear is_relro.
4393 (Script_sections::set_section_addresses): Force alignment of first
4395 * yyscript.y (exp): Call script_data_segment_align and
4396 script_data_segment_relro_end.
4397 * testsuite/relro_script_test.t: New file.
4398 * testsuite/relro_test.cc (using_script): Declare.
4399 (t1, t2): Test using_script.
4400 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4401 (relro_script_test_SOURCES): Define.
4402 (relro_script_test_DEPENDENCIES): Define.
4403 (relro_script_test_LDFLAGS): Define.
4404 (relro_script_test_LDADD): Define.
4405 (relro_script_test.so): New target.
4406 * testsuite/Makefile.in: Rebuild.
4408 2008-08-06 Cary Coutant <ccoutant@google.com>
4410 * archive.cc (Archive::total_archives, Archive::total_members)
4411 (Archive::total_members_loaded): New variables.
4412 (Archive::setup): Add parameter. Add option to preread
4414 (Archive::read_armap): Add counter.
4415 (Archive::get_file_and_offset): New function.
4416 (Archive::get_elf_object_for_member): New function.
4417 (Archive::read_all_symbols): New function.
4418 (Archive::read_symbols): New function.
4419 (Archive::add_symbols): Add counters.
4420 (Archive::include_all_members): Use armap to find members if it's
4422 (Archive::include_member): Skip reading symbols if already read.
4423 Factored code into Archive::get_file_and_offset and
4424 Archive::get_elf_object_for_member. Changed call to
4425 Mapfile::report_include_archive_member.
4426 (Archive::print_stats): New function.
4427 * archive.h: Declare Object and Read_symbols_data classes.
4428 (Archive::Archive): Add initializers for new members.
4429 (Archive::setup): Add parameter.
4430 (Archive::print_stats): New function.
4431 (Archive::total_archives, Archive::total_members)
4432 (Archive::total_members_loaded): New variables.
4433 (Archive::get_file_and_offset): New function.
4434 (Archive::get_elf_object_for_member): New function.
4435 (Archive::read_all_symbols): New function.
4436 (Archive::read_symbols): New function.
4437 (Archive::Archive_member): New class.
4438 (Archive::members_): New member.
4439 (Archive::num_members_): New member.
4440 * main.cc: Include archive.h.
4441 (main): Call Archive::print_stats.
4442 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4443 archive parameter; member_name is now the fully-decorated name.
4444 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4445 * options.h: (General_options): Add --preread-archive-symbols option.
4446 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4449 2008-08-04 Ian Lance Taylor <iant@google.com>
4451 * symtab.h (Symbol::use_plt_offset): New function.
4452 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4453 * powerpc.cc (Relocate::relocate): Likewise.
4454 * sparc.cc (Relocate::relocate): Likewise.
4455 * x86_64.cc (Relocate::relocate): Likewise.
4456 * testsuite/weak_plt.sh: New test.
4457 * testsuite/weak_plt_main.cc: New test.
4458 * testsuite/weak_plt_shared.cc: New test.
4459 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4460 (check_PROGRAMS): Add weak_plt.
4461 (check_DATA): Add weak_plt_shared.so.
4462 (weak_plt_main_pic.o, weak_plt): New targets.
4463 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4464 * testsuite/Makefile.in: Rebuild.
4466 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4468 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4469 * testsuite/Makefile.in: Rebuild.
4471 2008-08-04 Alan Modra <amodra@bigpond.net.au>
4473 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4474 * Makefile.in: Regenerate.
4475 * po/POTFILES.in: Regenerate.
4477 2008-07-29 Ian Lance Taylor <iant@google.com>
4479 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4480 symbols before other symbols.
4481 * testsuite/script_test_2.cc (test_addr): Declare.
4482 (test_addr_alias): Declare.
4483 (main): Check that test_addr and test_addr_alias have the right
4485 * testsuite/script_test_2.t: Define test_addr_alias and
4488 2008-07-24 Ian Lance Taylor <iant@google.com>
4491 * descriptors.cc: New file.
4492 * descriptors.h: New file.
4493 * gold-threads.h (class Hold_optional_lock): New class.
4494 * fileread.cc: Include "descriptors.h".
4495 (File_read::~File_read): Release descriptor rather than closing
4497 (File_read::open) [file]: Call open_descriptor rather than open.
4498 Set is_descriptor_opened_.
4499 (File_read::open) [memory]: Assert that descriptor is not open.
4500 (File_read::reopen_descriptor): New function.
4501 (File_read::release): Release descriptor.
4502 (File_read::do_read): Make non-const. Reopen descriptor.
4503 (File_read::read): Make non-const.
4504 (File_read::make_view): Reopen descriptor.
4505 (File_read::do_readv): Likewise.
4506 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4507 Update declarations.
4508 * layout.cc: Include "descriptors.h".
4509 (Layout::create_build_id): Use open_descriptor rather than open.
4510 * output.cc: Include "descriptors.h".
4511 (Output_file::open): Use open_descriptor rather than open.
4512 * archive.cc (Archive::const_iterator): Change Archive to be
4514 (Archive::begin, Archive::end): Make non-const.
4515 (Archive::count_members): Likewise.
4516 * archive.h (class Archive): Update declarations.
4517 * object.h (Object::read): Make non-const.
4518 * Makefile.am (CCFILES): Add descriptors.cc.
4519 (HFILES): Add descriptors.h.
4520 * Makefile.in: Rebuild.
4523 * gold.h: Always include <clocale>. Add Solaris workarounds
4524 following code in binutils/sysdep.h.
4527 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4528 this->eh_frame_hdr_ is NULL before using it.
4530 * dynobj.cc (Versions::Versions): Update comment.
4532 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4533 the base version name.
4535 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4536 array size plus one.
4537 (Stringpool_template::set_string_offsets): Subtract one from key
4538 before using it as an array index.
4539 (Stringpool_template::get_offset_with_length): Likewise.
4540 (Stringpool_template::write_to_buffer): Likewise.
4541 * stringpool.h (Stringpool_template::get_offset_from_key):
4544 2008-07-23 Ian Lance Taylor <iant@google.com>
4547 * object.h (Merged_symbol_value::value): Do our best to handle a
4551 * script.cc (Version_script_info::get_versions): Don't add empty
4552 version tag to return value.
4553 (Version_script_info::get_symbol_version_helper): Change return
4554 type to bool. Add pversion parameter. Change all callers.
4555 (script_register_vers_node): Don't require a non-NULL tag.
4556 * script.h (class Version_script_info): Update declarations.
4557 (Version_script_info::get_symbol_version): Change return type to
4558 bool. Add version parameter. Change all callers.
4559 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4560 handling. Handle an empty version from a version script.
4561 (Symbol_table::define_special_symbol): Likewise.
4562 * testsuite/ver_test_10.script: New file.
4563 * testsuite/ver_test_10.sh: New file.
4564 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4565 (check_DATA): Add ver_test_10.syms.
4566 (ver_test_10.syms, ver_test_10.so): New target.
4567 * testsuite/Makefile.in: Rebuild.
4569 2008-07-23 Simon Baldwin <simonb@google.com>
4571 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4572 to zero for undefined symbols from dynamic libraries.
4574 2008-07-23 Ian Lance Taylor <iant@google.com>
4576 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4578 * symtab.h (class Symbol_table): Update declaration.
4579 * testsuite/ver_test_9.cc: New file.
4580 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4581 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4582 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4583 (ver_test_9.so, ver_test_9.o): New targets.
4584 * testsuite/Makefile.in: Rebuild.
4586 2008-07-22 Ian Lance Taylor <iant@google.com>
4588 * options.h (class General_options): Define --check-sections.
4589 * layout.cc (Layout::set_segment_offsets): Handle
4592 * options.h (class General_options): Define -n/--nmagic and
4594 * options.cc (General_options::finalize): For -n/--nmagic or
4595 -N/--omagic, set -static.
4596 * layout.cc (Layout::attach_allocated_section_to_segment): If
4597 -N/--omagic, don't put read-only and read-write sections in
4599 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4600 finding a read-only segment.
4601 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4602 don't set the minimum segment alignment to the common page size,
4603 and don't set the file offset to the address modulo the page size.
4604 * script-sections.cc (Script_sections::create_segments): If
4605 -n/--omagic, don't put read-only and read-write sections in
4608 * cref.cc: New file.
4610 * options.h (class General_options): Add --print-symbol-counts.
4611 * main.cc (main): Issue defined symbol report if requested.
4612 * archive.cc (Archive::interpret_header): Make into a const member
4614 (Archive::add_symbols): Call Input_objects::archive_start and
4616 (Archive::const_iterator): Define new class.
4617 (Archive::begin, Archive::end): New functions.
4618 (Archive::include_all_members): Rewrite to use iterator.
4619 (Archive::count_members): New function.
4620 * archive.h (class Archive): Update declarations.
4621 (Archive::filename): New function.
4622 * object.cc: Include "cref.h".
4623 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4624 (Sized_relobj::do_get_global_symbol_counts): New function.
4625 (Input_objects::add_object): Add object to cross-referencer.
4626 (Input_objects::archive_start): New function.
4627 (Input_objects::archive_stop): New function.
4628 (Input_objects::print_symbol_counts): New function.
4629 * object.h: Declare Cref and Archive.
4630 (Object::get_global_symbol_counts): New function.
4631 (Object::do_get_global_symbol_counts): New pure virtual function.
4632 (class Sized_relobj): Add defined_count_ field. Update
4634 (class Input_objects): Add cref_ field. Update constructor.
4635 Update declarations.
4636 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4638 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4640 (Sized_dynobj::do_get_global_symbol_counts): New function.
4641 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4642 defined_count_. Update declarations. Define Symbols typedef.
4643 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4644 parameter. Change all callers.
4645 (Symbol_table::add_from_dynobj): Add sympointers and defined
4646 parameters. Change all callers.
4647 * symtab.h (class Symbol_table): Update declarations.
4648 * Makefile.am (CCFILES): Add cref.cc.
4649 (HFILES): Add cref.h.
4650 * Makefile.in: Rebuild.
4652 2008-07-22 Simon Baldwin <simonb@google.com>
4654 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4655 to zero when writing undefined symbols.
4657 2008-07-22 Ian Lance Taylor <iant@google.com>
4659 * output.cc (Output_section::add_input_section): Don't try to
4660 merge empty merge sections.
4662 2008-07-21 Craig Silverstein <csilvers@google.com>
4664 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4665 Include symbol version in error message.
4667 2008-07-20 Chris Demetriou <cgd@google.com>
4669 * configure.ac (gold_cv_c_random_seed): New configured variable.
4670 (RANDOM_SEED_CFLAGS): New substituted variable.
4671 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4672 * configure: Rebuild.
4673 * Makefile.in: Likewise.
4674 * testsuite/Makefile.in: Likewise.
4676 2008-07-18 Ian Lance Taylor <iant@google.com>
4678 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4679 where we see NAME/NULL and NAME/VERSION as separate symbols.
4680 * testsuite/ver_test_main.cc (main): Call t4.
4681 (t4, t4_2a): Define.
4682 * testsuite/ver_test_2.cc (t4_2): Define.
4683 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4684 * testsuite/ver_test_4.cc (t4_2a): Define.
4685 * testsuite/ver_test_4.script: Put t4_2a in VER2.
4686 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4688 2008-07-17 Ian Lance Taylor <iant@google.com>
4690 * dynobj.cc (Versions::add_def): If we give an error about a
4691 missing version, go ahead and create the version anyhow.
4693 2008-07-10 Ian Lance Taylor <iant@google.com>
4695 Handle output sections with more than 0x7fffffff bytes.
4696 * object.h (class Relobj): Change map_to_output_ to
4697 output_sections_, and just keep a section pointer. Change all
4698 uses. Move comdat group support to Sized_relobj.
4699 (Relobj::is_section_specially_mapped): Remove.
4700 (Relobj::output_section): Remove poff parameter. Change all
4702 (Relobj::output_section_offset): New function.
4703 (Relobj::set_section_offset): Rewrite.
4704 (Relobj::map_to_output): Remove.
4705 (Relobj::output_sections): New function.
4706 (Relobj::do_output_section_offset): New pure virtual function.
4707 (Relobj::do_set_section_offset): Likewise.
4708 (class Sized_relobj): Add section_offsets_ field. Add comdat
4709 group support from Relobj. Update declarations.
4710 (Sized_relobj::get_output_section_offset): New function.
4711 (Sized_relobj::do_output_section_offset): New function.
4712 (Sized_relobj::do_set_section_offset): New function.
4713 * object.cc (Relobj::output_section_address): Remove.
4714 (Sized_relobj::Sized_relobj): Initialize new fields.
4715 (Sized_relobj::include_section_group): Cast find_kept_object to
4717 (Sized_relobj::include_linkonce_section): Likewise.
4718 (Sized_relobj::do_layout): Use separate arrays for output section
4720 (Sized_relobj::do_count_local_symbols): Change map_to_output to
4722 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4723 output_sections and section_offsets.
4724 (Sized_relobj::write_local_symbols): Likewise.
4725 (map_to_kept_section): Compute output address directly.
4726 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4727 output_sections and section_offsets.
4728 (Sized_relobj::write_sections): Likewise.
4729 (Sized_relobj::relocate_sections): Likewise.
4730 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4731 * output.h (class Output_reloc): Update declarations. Change
4732 u2_.relobj to Sized_relobj*.
4733 (class Output_data_reloc): Change add functions to use
4735 * output.cc (Output_reloc::Output_reloc): Change relobj to
4737 (Output_reloc::local_section_offset): Change return type to
4738 Elf_Addr. Use get_output_section_offset.
4739 (Output_reloc::get_address): Likewise.
4740 (Output_section::is_input_address_mapped): Don't call
4741 is_section_specially_mapped.
4742 (Output_section::output_offset): Likewise.
4743 (Output_section::output_address): Likewise.
4744 (Output_section::starting_output_address): Likewise.
4745 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4746 parameter to Sized_relobj*.
4747 (Copy_relocs::need_copy_reloc): Likewise.
4748 (Copy_relocs::save): Likewise.
4749 * copy-relocs.h (class Copy_relocs): Update declarations.
4750 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4751 Sized_relobj*. Change relobj_ field to Sized_relobj*.
4752 * target-reloc.h (relocate_for_relocatable): Change
4753 offset_in_output_section type to Elf_Addr. Change code that uses
4755 * layout.cc (Layout::layout): Always set *off.
4756 * mapfile.cc (Mapfile::print_input_section): Use
4757 output_section_offset.
4758 * i386.cc (Target_i386::copy_reloc): Change object parameter to
4760 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
4761 * sparc.cc (Target_sparc::copy_reloc): Likewise.
4762 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
4764 2008-07-03 Ian Lance Taylor <iant@google.com>
4766 * layout.cc (Layout::include_section): Do not discard unrecognized
4767 SHT_STRTAB sections.
4769 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
4771 * script.cc (Lex::can_continue_name): Make '?' allowable in
4772 version-script names.
4773 * testsuite/version_script.map: Change glob pattern to use '?'
4775 2008-06-30 Manish Singh <yosh@gimp.org>
4778 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
4781 2008-06-30 Ian Lance Taylor <iant@google.com>
4785 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
4786 versions]: Don't try to read the value in the contents, since we
4787 don't use it. Use the template endianness when writing.
4789 2008-06-25 Cary Coutant <ccoutant@google.com>
4791 * fileread.cc (File_read::make_view): Assert on zero-length view.
4792 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
4793 symbol table when there are no symbols to read.
4795 2008-06-23 Craig Silverstein <csilvers@google.com>
4797 * version.cc (version_string): Bump to 1.7
4799 2008-06-18 Craig Silverstein <csilvers@google.com>
4801 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4802 constant 0xFFFF to type Valtype.
4803 (Powerpc_relocate_functions::rel16_ha): Likewise.
4805 2008-06-17 Ian Lance Taylor <iant@google.com>
4807 * output.h (Output_section::Input_section): Initialize p2align_ to
4808 zero for Output_section_data constructors.
4809 (Output_section::Input_section::addralign): If not an input
4810 section, return the alignment of the Output_section_data.
4811 * testsuite/copy_test.cc: New file.
4812 * testsuite/copy_test_1.cc: New file.
4813 * testsuite/copy_test_2.cc: New file.
4814 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
4815 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
4816 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
4817 (copy_test_1_pic.o, copy_test_1.so): New targets.
4818 (copy_test_2_pic.o, copy_test_2.so): New targets.
4819 * testsuite/Makefile.in: Rebuild.
4821 * script-sections.cc (Script_sections::place_orphan): Initialize
4822 local variable exact.
4824 2008-06-13 David Edelsohn <edelsohn@gnu.org>
4826 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
4828 2008-06-12 David Edelsohn <edelsohn@gnu.org>
4829 David S. Miller <davem@davemloft.net>
4831 * powerpc.cc: New file.
4832 * Makefile.am (TARGETSOURCES): Add powerpc.cc
4833 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4834 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4835 * Makefile.in: Rebuild.
4837 2008-06-09 Ian Lance Taylor <iant@google.com>
4839 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4841 (throwing, orig_terminate): New static variables.
4842 (terminate_handler): New static function.
4843 (t2): Set terminate handler.
4845 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
4848 * binary.cc (Binary_to_elf::sized_convert): Fix .data
4851 2008-05-30 Cary Coutant <ccoutant@google.com>
4853 * archive.cc (Archive::include_all_members) Correct to step
4854 over symbol table and extended name table in thin archives.
4856 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
4859 * target-reloc.h (relocate_for_relocatable): Fix new_offset
4862 2008-05-28 Caleb Howe <cshowe@google.com>
4864 * reduced_debug_output.cc: New file.
4865 * reduced_debug_output.h: New file.
4866 * options.h (class General_options): Add --strip-debug-non-line.
4867 * options.cc (General_options::finalize): Add strip_debug_non_line
4868 to the strip heirarchy.
4869 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
4871 * layout.cc: Include "reduced_debug_output.h".
4872 (Layout::Layout): Initialize new fields.
4873 (line_only_debug_sections): New static array.
4874 (is_lines_only_debug_sections): New static inline function.
4875 (Layout::include_section): Handle --strip-debug-non-line.
4876 (Layout::make_output_section): If --strip-debug-non-line, build
4877 new output sections for .debug_abbrev and .debug_info.
4878 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
4879 gold. Warn about possible overflow.
4880 (read_signed_LEB_128): Likewise.
4881 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
4882 (read_signed_LEB_128): Declare.
4883 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
4884 (HFILES): Add reduced_debug_output.h.
4885 * Makefile.in: Rebuild.
4887 2008-05-21 Ian Lance Taylor <iant@google.com>
4889 * mapfile.cc: New file.
4890 * mapfile.h: New file.
4891 * options.h (class General_options): Add -M/--print-map and -Map.
4892 * options.cc (General_options::finalize): Make -M equivalent to
4894 * main.cc: Include <cstdio> and "mapfile.h".
4895 (main): Open mapfile if requested.
4896 * gold.cc (class Middle_runner): Add mapfile_ field. Update
4897 constructor. Change caller.
4898 (queue_initial_tasks): Add mapfile parameter. Change caller.
4899 (queue_middle_tasks): Likewise.
4900 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4902 * archive.cc: Include "mapfile.h".
4903 (Archive::add_symbols): Add mapfile parameter. Change all
4904 callers. Pass mapfile, symbol, and reason to include_member.
4905 (Archive::include_all_members): Add mapfile parameter. Change all
4907 (Archive::include_member): Add mapfile, sym, and why parameters.
4908 Change all callers. Report inclusion to map file.
4909 * archive.h: Include "fileread.h".
4910 (class Archive): Update declarations.
4911 (Archive::file): New const method.
4912 (class Add_archive_symbols): Add mapfile_ field. Update
4913 constructor. Change all callers.
4914 * readsyms.h (class Read_symbols): Likewise.
4915 (class Finish_group): Likewise.
4916 (class Read_script): Likewise.
4917 * common.cc: Include "mapfile.h".
4918 (Symbol_table::allocate_commons): Add mapfile parameter. Change
4920 (Symbol_table::do_allocate_commons): Likewise.
4921 (Symbol_table::do_allocate_commons_list): Likewise. Report common
4922 symbol allocation to mapfile.
4923 * common.h (class Allocate_commons_task): Add mapfile_ field.
4924 Update constructor. Change all callers.
4925 * symtab.h (class Symbol_table): Update declarations.
4926 * layout.cc: Include "mapfile.h".
4927 (Layout_task_runner::run): Print information to mapfile.
4928 (Layout::create_gold_note): Change Output_data_fixed_space to
4929 Output_data_zero_fill.
4930 (Layout::create_build_id): Likewise.
4931 (Layout::print_to_mapfile): New function.
4932 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
4933 constructor. Change caller.
4934 (class Layout): Declare print_to_mapfile.
4935 * output.cc (Output_section::Input_section::print_to_mapfile): New
4937 (Output_section::add_input_section): If producing a map, always
4938 add to input_sections_ list.
4939 (Output_section::do_print_to_mapfile): New function.
4940 (Output_segment::print_sections_to_mapfile): New function.
4941 (Output_segment::print_section_list_to_mapfile): New function.
4942 * output.h: Include "mapfile.h".
4943 (Output_data::print_to_mapfile): New function.
4944 (Output_data::do_print_to_mapfile): New virtual function.
4945 (Output_segment_headers::do_print_to_mapfile): New function.
4946 (Output_file_header::do_print_to_mapfile): New function.
4947 (Output_data_const::do_print_to_mapfile): New function.
4948 (class Output_data_const_buffer): Add map_name_ field. Update
4949 constructor. Change all callers. Add do_print_to_mapfile
4951 (class Output_data_fixed_space): Likewise.
4952 (class Output_data_space): Likewise.
4953 (class Output_data_zero_fill): New class.
4954 (Output_data_strtab::do_print_to_mapfile): New function.
4955 (Output_data_reloc_base::do_print_to_mapfile): New function.
4956 (Output_relocatable_relocs::do_print_to_mapfile): New function.
4957 (Output_data_group::do_print_to_mapfile): New function.
4958 (Output_data_got::do_print_to_mapfile): New function.
4959 (Output_data_dynamic::do_print_to_mapfile): New function.
4960 (Output_symtab_xindex::do_print_to_mapfile): New function.
4961 (class Output_section): Declare do_print_to_mapflie. Declare
4962 print_to_mapfile in Input_section.
4963 (class Output_segment): Declare new functions.
4964 * object.h (Sized_relobj::symbol_count): New function.
4965 * script-sections.cc
4966 (Output_section_element_dot_assignment::set_section_addresses):
4967 Change Output_data_fixed_space to Output_data_zero_fill.
4968 (Output_data_expression::do_print_to_mapfile): New function.
4969 * script.cc (read_input_script): Add mapfile parameter. Change
4971 * script.h (read_input_script): Update declaration.
4972 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4973 (Eh_frame::do_print_to_mapfile): New function.
4974 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4975 (Output_merge_string::do_print_to_mapfile): New function.
4976 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4978 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4980 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4982 * Makefile.am (CCFILES): Add mapfile.cc.
4983 (HFILES): Add mapfile.h.
4984 * Makefile.in: Rebuild.
4986 2008-05-19 Ian Lance Taylor <iant@google.com>
4988 * options.h (class General_options): Add -z relro.
4989 * layout.cc (Layout::Layout): Initialize relro_segment_.
4990 (Layout::add_output_section_data): Return the output section.
4991 (Layout::make_output_section): Rcognize relro sections and mark
4993 (Layout::attach_allocated_section_to_segment): Put relro sections
4994 in a PT_GNU_RELRO segment.
4995 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4997 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4999 (Layout::linkonce_mapping): Map d.rel.ro.local to
5001 (Layout::output_section_name): Us .data.rel.ro.local for any
5002 section which begins with that.
5003 * layout.h (class Layout): Update add_output_section_data
5004 declaration. Add relro_segment_ field.
5005 * output.cc (Output_section::Output_section): Initialize is_relro_
5006 and is_relro_local_ fields.
5007 (Output_segment::add_output_section): Group relro sections.
5008 (Output_segment::is_first_section_relro): New function.
5009 (Output_segment::maximum_alignment): If there is a relro section,
5010 align the segment to the common page size.
5011 (Output_segment::set_section_addresses): Track whether we are
5012 looking at relro sections. If the last section is a relro
5013 section, align to the common page size.
5014 (Output_segment::set_section_list_addresses): Add in_relro
5015 parameter. Change all callers. Align to the page size when
5016 moving from relro to non-relro section.
5017 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
5019 * output.h (class Output_section): Add is_relro_ and
5020 is_relro_local_ fields.
5021 (Output_section::is_relro): New function.
5022 (Output_section::set_is_relro): New function.
5023 (Output_section::is_relro_local): New function.
5024 (Output_section::set_is_relro_local): New function.
5025 (class Output_segment): Update declarations.
5026 * i386.cc (Target_i386::got_section): Mark .got section as relro.
5027 * sparc.cc (Target_sparc::got_section): Likewise.
5028 * x86_64.cc (Target_x86_64::got_section): Likewise.
5029 * testsuite/relro_test_main.cc: New file.
5030 * testsuite/relro_test.cc: New file.
5031 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5032 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5033 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5034 (relro_test.so, relro_test_pic.o): New targets.
5035 * testsuite/Makefile.in: Rebuild.
5037 2008-05-16 Ian Lance Taylor <iant@google.com>
5039 * output.cc (Output_segment::add_output_section): Remove front
5041 * output.h (class Output_segment): Remove
5042 add_initial_output_section and overloaded add_output_section.
5043 Update declaration of remaining add_output_section.
5044 * layout.cc (Layout::create_interp): Call add_output_section
5045 rather than add_initial_output_section.
5046 (Layout::finish_dynamic_section): Likewise.
5048 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5049 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
5050 know the dynamic type.
5051 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5052 field. Initialize it in constructor.
5053 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5054 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5055 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5058 * output.cc (Output_reloc::get_address): Change return type to
5060 * output.h (class Output_reloc): Update get_address declaration.
5061 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5062 for section addresses.
5064 2008-05-09 Ian Lance Taylor <iant@google.com>
5067 * gold.cc (gold_nomem): Use return value of write.
5069 2008-05-08 Ian Lance Taylor <iant@google.com>
5071 * symtab.c (Symbol::init_base_output_data): Add version
5072 parameter. Change all callers.
5073 (Symbol::init_base_output_segment): Likewise.
5074 (Symbol::init_base_constant): Likewise.
5075 (Symbol::init_base_undefined): Likewise.
5076 (Sized_symbol::init_output_data): Likewise.
5077 (Sized_symbol::init_output_segment): Likewise.
5078 (Sized_symbol::init_constant): Likewise.
5079 (Sized_symbol::init_undefined): Likewise.
5080 (Symbol_table::do_define_in_output_data): If the new symbol has a
5081 version, mark it as the default.
5082 (Symbol_table::do_define_in_output_segment): Likewise.
5083 (Symbol_table::do_define_as_constant): Likewise.
5084 * symtab.h (class Symbol): Update declarations.
5085 (class Sized_symbol): Likewise.
5086 * resolve.cc (Symbol::override_version): New function.
5087 (Symbol::override_base): Call override_version.
5088 (Symbol::override_base_with_special): Likewise.
5089 * testsuite/ver_script_8.script: New file.
5090 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5091 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5092 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5093 (ver_test_8_1.so, ver_test_8_2.so): New targets.
5095 2008-05-06 Ian Lance Taylor <iant@google.com>
5098 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5100 (class General_options): Remove existing --undefined, and add
5101 --no-undefined instead. Add new --undefined as synonym for -u.
5102 * archive.cc (Archive::add_symbols): Check whether symbol was
5104 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5105 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5106 all uses. Add IS_UNDEFINED. Update declarations to split
5107 different versions of init_base. Declare init_base_undefined.
5108 (Symbol::is_defined): Handle IS_UNDEFINED.
5109 (Symbol::is_undefined): Likewise.
5110 (Symbol::is_weak_undefined): Call is_undefined.
5111 (Symbol::is_absolute): Handle IS_CONSTANT.
5112 (class Sized_symbol): Update declarations to split different
5113 versions of init. Declare init_undefined.
5114 (class Symbol_table): Declare new functions.
5115 * symtab.cc (Symbol::init_base_object): Rename from init_base.
5117 (Symbol::init_base_output_data): Likewise.
5118 (Symbol::init_base_output_segment): Likewise.
5119 (Symbol::init_base_constant): Likewise.
5120 (Symbol::init_base_undefined): New function.
5121 (Sized_symbol::init_object): Rename from init. Change all
5123 (Sized_symbol::init_output_data): Likewise.
5124 (Sized_symbol::init_output_segment): Likewise.
5125 (Sized_symbol::init_constant): Likewise.
5126 (Sized_symbol::init_undefined): New function.
5127 (Symbol_table::add_undefined_symbols_from_command_line): New
5129 (Symbol_table::do_add_undefined_symbols_from_command_line): New
5131 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5132 (Symbol::output_section): Likewise.
5133 (Symbol::set_output_section): Likewise.
5134 (Symbol_table::sized_finalize_symbol): Likewise.
5135 (Symbol_table::sized_write_globals): Likewise.
5136 * resolve.cc (Symbol_table::should_override): Likewise.
5137 (Symbol::override_base_with_special): Likewise.
5139 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5140 symbol, change it to have default visibility.
5141 * testsuite/protected_1.cc: New file.
5142 * testsuite/protected_2.cc: New file.
5143 * testsuite/protected_3.cc: New file.
5144 * testsuite/protected_main_1.cc: New file.
5145 * testsuite/protected_main_2.cc: New file.
5146 * testsuite/protected_main_3.cc: New file.
5147 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5148 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5149 (protected_1_LDFLAGS, protected_1_LDADD): Define.
5150 (protected_1.so): New target.
5151 (protected_1_pic.o, protected_2_pic.o): New targets.
5152 (protected_3_pic.o): New target.
5153 (check_PROGRAMS): Add protected_2.
5154 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5155 (protected_2_LDFLAGS, protected_2_LDADD): Define.
5156 * testsuite/Makefile.in: Rebuild.
5158 * options.h (DEFINE_var): Add set_user_set_##varname__.
5159 (DEFINE_bool_alias): New macro.
5160 (class General_options): Define -Bstatic using DEFINE_bool_alias
5161 rather than DEFINE_special. Add --undefined as an alias for -z
5163 * options.cc (General_options::parse_Bstatic): Remove.
5165 * options.h (class General_options): Add --fatal-warnings.
5166 * main.cc (main): Implement --fatal-warnings.
5167 * errors.h (Errors::warning_count): New function.
5169 * options.h (class General_options): Add -Bsymbolic-functions.
5170 * symtab.h (Symbol::is_preemptible): Check for
5171 -Bsymbolic-functions.
5173 2008-05-05 Ian Lance Taylor <iant@google.com>
5175 * options.h (DEFINE_bool): For DASH_Z, create the negative option
5176 as noVARNAME rather than no-VARNAME.
5177 (class General_options): Add option -z combreloc.
5178 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5180 (Output_reloc::sort_before) [SHT_REL]: New function.
5181 (Output_reloc::sort_before) [SHT_RELA]: New function.
5182 (class Output_data_reloc_base): Add sort_relocs_ field. Define
5183 Sort_relocs_comparison.
5184 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5185 parameter. Change all callers.
5186 (Output_data_reloc::Output_data_reloc) [both versions]: Add
5187 sort_relocs parameter. Change all callers.
5188 * output.cc (Output_reloc::get_address): New function, broken out
5190 (Output_reloc::write_rel): Call it.
5191 (Output_reloc::compare): New function.
5192 (Output_data_reloc_base::do_write): Optionally sort relocs.
5194 * configure.ac: If targ_extra_obj is set, link it in.
5195 * configure.tgt: Initialize all variables.
5196 (x86_64*): Set targ_extra_obj and targ_extra_size.
5197 * configure: Rebuild.
5199 * object.cc (Sized_relobj::include_section_group): Adjust section
5200 indexes read from group data. Build vector to pass to
5202 * layout.cc (Layout::layout_group): Add flags and shndxes
5203 parameters. Remove contents parameter. Change caller. Update
5204 explicit instantiations.
5205 * layout.h (class Layout): Update layout_group declaration.
5206 * output.cc (Output_data_group::Output_data_group): Add flags and
5207 input_shndxes parameters. Remove contents parameter. Change
5209 (Output_data_group::do_write): Change input_sections_ to
5211 * output.h (class Output_data_group): Update constructor
5212 declaration. Rename input_sections_ to input_shndxes_.
5213 * testsuite/many_sections_test.cc: Add template.
5215 2008-04-30 Cary Coutant <ccoutant@google.com>
5217 * target-reloc.h (relocate_section): Fix dead-pointer bug.
5219 * layout.cc (Layout::include_section): Refactored check for debug
5221 (Layout::add_comdat): Add new parameters. Change type
5222 of signature parameter. Add object and shndx to signatures table.
5223 (Layout::find_kept_object): New function.
5224 * layout.h: Include <cstring>.
5225 (Layout::is_debug_info_section): New function.
5226 (Layout::add_comdat): Add new parameters.
5227 (Layout::find_kept_object): New function.
5228 (Layout::Kept_section): New struct.
5229 (Layout::Signatures): Change type of map range.
5230 * object.cc (Relobj::output_section_address): New function.
5231 (Sized_relobj::include_section_group): Add new parameters. Change
5232 calls to Layout::add_comdat. Change to build table of kept comdat
5233 groups and table mapping discarded sections to kept sections.
5234 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5235 (Sized_relobj::do_layout): Change calls to include_section_group and
5236 include_linkonce_section.
5237 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5238 value to zero when section is discarded.
5239 (Sized_relobj::map_to_kept_section): New function.
5240 * object.h (Relobj::output_section_address): New function.
5241 (Relobj::Comdat_group): New type.
5242 (Relobj::find_comdat_group): New function.
5243 (Relobj::Comdat_group_table): New type.
5244 (Relobj::Kept_comdat_section): New type.
5245 (Relobj::Kept_comdat_section_table): New type.
5246 (Relobj::add_comdat_group): New function.
5247 (Relobj::set_kept_comdat_section): New function.
5248 (Relobj::get_kept_comdat_section): New function.
5249 (Relobj::comdat_groups_): New field.
5250 (Relobj::kept_comdat_sections_): New field.
5251 (Symbol_value::input_value): Update comment.
5252 (Sized_relobj::map_to_kept_section) New function.
5253 (Sized_relobj::include_linkonce_section): Add new parameter.
5254 * target-reloc.h (Comdat_behavior): New type.
5255 (get_comdat_behavior): New function.
5256 (relocate_section): Add code to map a discarded section to the
5257 corresponding kept section when applying a relocation.
5259 2008-04-30 Craig Silverstein <csilvers@google.com>
5261 * dwarf_reader.cc (next_generation_count): New static var.
5262 (Addr2line_cache_entry): New struct.
5263 (addr2line_cache): New static var.
5264 (Dwarf_line_info::one_addr2line): Added caching.
5265 (Dwarf_line_info::clear_addr2line_cache): New function.
5266 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5267 cache-size parameter.
5268 (Dwarf_line_info::one_addr2line_cache): New function.
5269 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5270 new cache-size argument to one_addr2line(), and clear cache.
5272 2008-04-28 Cary Coutant <ccoutant@google.com>
5274 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5275 R_386_PC8 relocations.
5277 2008-04-23 Ian Lance Taylor <iant@google.com>
5279 * object.cc (Sized_relobj::include_section_group): Check for
5280 invalid section group.
5282 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5285 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5286 than read for file header.
5287 * archive.cc (Archive::include_member): Likewise.
5289 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
5291 * aclocal.m4: Regenerate.
5292 * configure: Regenerate.
5294 2008-04-19 Ian Lance Taylor <iant@google.com>
5296 * version.cc (version_string): Bump to 1.6.
5298 * testsuite/Makefile.am (many_sections_r_test): New target.
5299 (many_sections_r_test_SOURCES): Remove.
5300 (many_sections_r_test_DEPENDENCIES): Remove.
5301 (many_sections_r_test_LDFLAGS): Remove.
5302 (many_sections_r_test_LDADD): Remove.
5304 * object.cc (Sized_relobj::do_add_symbols): Always pass
5305 local_symbol_count_ to add_from_relobj.
5307 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5308 every thousand variables.
5309 * testsuite/Makefile.in: Rebuild.
5311 * object.cc (Xindex::initialize_symtab_xindex): New function.
5312 (Xindex::read_symtab_xindex): New function.
5313 (Xindex::sym_xindex_to_shndx): New function.
5314 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5316 (Sized_relobj::do_initialize_xindex): New function.
5317 (Sized_relobj::do_read_symbols): Adjust section links.
5318 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5319 parameter. Change all callers.
5320 (Sized_relobj::include_section_group): Adjust section links and
5321 symbol section indexes.
5322 (Sized_relobj::do_layout): Adjust section links.
5323 (Sized_relobj::do_count_local_symbols): Adjust section links and
5324 symbol section indexes.
5325 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5326 ordinary and special symbols.
5327 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5328 dynsym_xindex parameters. Change all callers. Adjust section
5329 links. Use SHN_XINDEX when needed.
5330 (Sized_relobj::get_symbol_location_info): Adjust section links.
5331 Don't get fooled by special symbols.
5332 * object.h (class Xindex): Define.
5333 (class Object): Add xindex_ parameter. Declare virtual functoin
5334 do_initialize_xindex.
5335 (Object::adjust_sym_shndx): New function.
5336 (Object::set_xindex): New protected function.
5337 (class Symbol_value): Add is_ordinary_shndx_ field.
5338 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5339 (Symbol_value::value): Assert ordinary section.
5340 (Symbol_value::initialize_input_to_output_map): Likewise.
5341 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5343 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5345 (class Sized_relobj): Update declarations.
5346 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5347 parameter. Change all callers.
5348 (Sized_relobj::adjust_shndx): New function.
5349 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5351 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5352 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5353 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5354 (Sized_dynobj::read_dynsym_section): Adjust section links.
5355 (Sized_dynobj::read_dynamic): Likewise.
5356 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5358 (Sized_dynobj::do_initialize_xindex): New function.
5359 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5360 do_initialize_xindex.
5361 (Sized_dynobj::adjust_shndx): New function.
5362 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5363 dynsym_xindex_ fields.
5364 (Layout::finalize): Add a call to set_section_indexes before
5365 creating the symtab sections.
5366 (Layout::set_section_indexes): Don't do anything if the section
5367 already has a section index.
5368 (Layout::create_symtab_sections): Add shnum parameter. Change
5369 caller. Create .symtab_shndx section if needed.
5370 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5372 (Layout::allocated_output_section_count): New function.
5373 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5375 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5376 fields. Update declarations.
5377 (Layout::symtab_xindex): New function.
5378 (Layout::dynsym_xindex): New function.
5379 (class Write_symbols_task): Add layout_ field.
5380 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5382 * output.cc (Output_section_headers::Output_section_headers): Add
5383 shstrtab_section parameter. Change all callers.
5384 (Output_section_headers::do_sized_write): Store overflow values
5385 for section count and section string table section index in
5386 section header zero.
5387 (Output_file_header::do_sized_write): Check for overflow of
5388 section count and section string table section index.
5389 (Output_symtab_xindex::do_write): New function.
5390 (Output_symtab_xindex::endian_do_write): New function.
5391 * output.h (class Output_section_headers): Add shstrtab_section_.
5392 Update declarations.
5393 (class Output_symtab_xindex): Define.
5394 (Output_section::has_out_shndx): New function.
5395 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5397 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5399 (Sized_symbol::init): Likewise.
5400 (Symbol::output_section): Check for ordinary symbol.
5401 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5402 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5404 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5405 Change all callers. Simplify handling of symbols from sections
5406 not included in the link.
5407 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5409 (Weak_alias_sorter::operator()): Assert that symbols are
5411 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5413 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5414 parameters. Change all callers.
5415 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5416 symbol distinction. Use SHN_XINDEX when needed.
5417 (Symbol_table::write_section_symbol): Add symtab_xindex
5418 parameter. Change all callers.
5419 (Symbol_table::sized_write_section_symbol): Likewise. Use
5420 SHN_XINDEX when needed.
5421 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5423 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5424 (Symbol::is_defined): Check is_ordinary.
5425 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5426 (Symbol::is_absolute, Symbol::is_common): Likewise.
5427 (class Sized_symbol): Update declarations.
5428 (class Symbol_table): Update declarations.
5429 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5430 parameters. Change all callers.
5431 (Sized_symbol::override): Likewise.
5432 (Symbol_table::override): Likewise.
5433 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5434 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5435 is_ordinary, and orig_st_shndx parameters. Change all callers.
5436 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5437 to be in an ordinary section.
5438 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5439 object and is_ordinary parameters. Change all callers.
5440 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5441 Change all callers. Don't add undefined or non-ordinary symbols
5443 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5445 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5447 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5448 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5449 (Sized_relobj::relocate_sections): Likewise.
5450 * target-reloc.h (scan_relocs): Adjust section symbol index.
5451 (scan_relocatable_relocs): Likewise.
5452 * i386.cc (Scan::local): Check for ordinary symbols.
5453 * sparc.cc (Scan::local): Likewise.
5454 * x86_64.cc (Scan::local): Likewise.
5455 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5456 to symbol_section_and_value.
5457 * testsuite/many_sections_test.cc: New file.
5458 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5459 (check_PROGRAMS): Add many_sections_test.
5460 (many_sections_test_SOURCES): Define.
5461 (many_sections_test_DEPENDENCIES): Define.
5462 (many_sections_test_LDFLAGS): Define.
5463 (BUILT_SOURCES): Add many_sections_define.h.
5464 (many_sections_define.h): New target.
5465 (BUILT_SOURCES): Add many_sections_check.h.
5466 (many_sections_check.h): New target.
5467 (check_PROGRAMS): Add many_sections_r_test.
5468 (many_sections_r_test_SOURCES): Define.
5469 (many_sections_r_test_DEPENDENCIES): Define.
5470 (many_sections_r_test_LDFLAGS): Define.
5471 (many_sections_r_test_LDADD): Define.
5472 (many_sections_r_test.o): New target.
5473 * testsuite/Makefile.in: Rebuild.
5475 2008-04-17 Cary Coutant <ccoutant@google.com>
5477 * errors.cc (Errors::info): New function.
5478 (gold_info): New function.
5479 * errors.h (Errors::info): New function.
5480 * gold.h (gold_info): New function.
5481 * object.cc (Input_objects::add_object): Print trace output.
5482 * options.cc (options::parse_set): New function.
5483 (General_options::parse_wrap): Deleted.
5484 (General_options::General_options): Deleted initializer.
5485 * options.h (options::String_set): New typedef.
5486 (options::parse_set): New function.
5487 (DEFINE_set): New macro.
5488 (General_options::wrap): Changed to use DEFINE_set. Changed
5489 callers of any_wrap_symbols and is_wrap_symbol.
5490 (General_options::trace, General_options::trace_symbol):
5492 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5493 (General_options::wrap_symbols_): Deleted.
5494 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5496 2008-04-17 David S. Miller <davem@davemloft.net>
5498 * options.cc (General_options::parse_V): New function.
5499 * options.h: Add entries for -V and -Qy.
5501 2008-04-17 Ian Lance Taylor <iant@google.com>
5503 * common.cc (Symbol_table::allocate_commons): Remove options
5504 parameter. Change caller.
5505 (Symbol_table::do_allocate_commons): Remove options parameter.
5506 Change caller. Just call do_allocate_commons_list twice.
5507 (Symbol_table::do_allocate_commons_list): New function, broken out
5508 of do_allocate_commons.
5509 * common.h (class Allocate_commons_task): Remove options_ field.
5511 * symtab.cc (Symbol_table::Symbol_table): Initialize
5513 (Symbol_table::add_from_object): Put TLS common symbols on
5515 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5516 which are IN_OUTPUT_DATA.
5517 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5518 allocate_commons and do_allocate_commons declarations. Declare
5519 do_allocate_commons_list.
5520 * gold.cc (queue_middle_tasks): Update creation of
5521 Allocate_commons_task to not pass options.
5522 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5523 (TLS_TEST_C_FLAGS): New variable.
5524 (tls_test_c_pic.o): New target.
5525 (tls_test_shared.so): Link in tls_test_c_pic.o.
5526 (tls_test_c_pic_ie.o): New target.
5527 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5528 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5529 (tls_test_c.o): New target.
5530 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5531 (tls_pic_test_LDADD): Likewise.
5532 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5533 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5534 (tls_test_c_gnu2.o): New target.
5535 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5537 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5538 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5539 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5540 * testsuite/tls_test.cc: Include "config.h".
5541 (t_last): Call t11_last.
5542 * testsuite/tls_test.h (t11, t11_last): Declare.
5543 * testsuite/tls_test_c.c: New file.
5544 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5545 * configure.ac: Check for OpenMP support.
5546 * configure, config.in, Makefile.in: Rebuild.
5547 * testsuite/Makefile.in: Rebuild.
5549 2008-04-16 Cary Coutant <ccoutant@google.com>
5551 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5552 (Target_i386::tls_base_symbol_defined_): New field.
5553 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5554 (Target_i386::Scan::global): Likewise.
5555 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5556 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5557 (Target_x86_64::tls_base_symbol_defined_): New field.
5558 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5559 (Target_x86_64::Scan::global): Likewise.
5561 2008-04-16 Cary Coutant <ccoutant@google.com>
5563 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5564 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5565 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5566 building shared libraries.
5567 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5568 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5569 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5570 * testsuite/Makefile.in: Rebuild.
5571 * testsuite/weak_undef.h: New file.
5572 * testsuite/weak_undef_file1.cc: Add extra test cases.
5573 * testsuite/weak_undef_file2.cc: Likewise.
5574 * testsuite/weak_undef_test.cc: Likewise.
5576 2008-04-16 David S. Miller <davem@davemloft.net>
5578 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5579 Add issued_non_pic_error_ field. Declare check_non_pic.
5580 (Target_sparc::Scan::check_non_pic): New function.
5581 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5582 (Target_sparc::Scan::global): Likewise.
5584 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5585 * configure: Rebuild.
5587 * options.h (DEFINE_enable): New macro.
5588 (new_dtags): New enable option.
5589 (initfirst, interpose, loadfltr, nodefaultlib,
5590 nodelete, nodlopen, nodump): New -z options.
5591 * layout.cc (Layout:finish_dynamic_section): If new
5592 dtags enabled, emit DT_RUNPATH. Also, emit a
5593 DT_FLAGS_1 containing any specified -z flags.
5595 2008-04-16 Ian Lance Taylor <iant@google.com>
5597 * copy-relocs.cc: New file.
5598 * copy-relocs.h: New file.
5599 * reloc.cc: Remove Copy_relocs code.
5600 * reloc.h: Likewise.
5601 * reloc-types.h (struct Reloc_types) [both versions]: Add
5602 get_reloc_addend_noerror.
5603 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5604 variants of add_global which take an addend which must be zero.
5605 * i386.cc: Include "copy-relocs.h".
5606 (class Target_i386): Change type of copy_relocs_ to variable,
5608 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5610 (Target_i386::do_finalize_sections): Change handling of
5612 * sparc.cc: Include "copy-relocs.h".
5613 (class Target_sparc): Change type of copy_relocs_ to variable,
5615 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5617 (Target_sparc::do_finalize_sections): Change handling of
5619 * x86_64.cc: Include "copy-relocs.h".
5620 (class Target_x86_64): Change type of copy_relocs_ to variable,
5622 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5623 class. Change all callers.
5624 (Target_x86_64::do_finalize_sections): Change handling of
5626 * Makefile.am (CCFILES): Add copy-relocs.cc.
5627 (HFILES): Add copy-relocs.h.
5629 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5631 * testsuite/script_test_4.sh: Permit leading zeroes.
5633 2008-04-15 Ian Lance Taylor <iant@google.com>
5635 * script-sections.cc (Script_sections::create_segments): Use
5636 header_size_adjustment even when there is enough room for the
5638 * testsuite/script_test_4.sh: New file.
5639 * testsuite/script_test_4.t: New file.
5640 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5641 (check_DATA): Add script_test_4.stdout.
5642 (MOSTLYCLEANFILES): Likewise.
5643 (script_test_4): New target.
5644 (script_test_4.stdout): New target.
5645 * testsuite/Makefile.in: Rebuild.
5647 * sparc.cc: Add definitions for Output_data_plt_sparc class
5650 2008-04-14 David S. Miller <davem@davemloft.net>
5652 * sparc.cc: New file.
5653 * Makefile.am (TARGETSOURCES): Add sparc.cc
5654 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5655 * configure.tgt: Document targ_extra_size and
5656 targ_extra_big_endian. Add entries for sparc-* and
5658 * configure.ac: Handle targ_extra_size and
5659 targ_extra_big_endian.
5660 * Makefile.in: Rebuild.
5661 * configure: Likewise.
5662 * po/POTFILES.in: Likewise.
5663 * po/gold.pot: Likewise.
5665 2008-04-14 Ian Lance Taylor <iant@google.com>
5667 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5668 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5669 in the name/type/flags to section mapping. Don't call
5670 allocate_output_section.
5671 (Layout::choose_output_section): Change parameter from adjust_name
5672 to is_input_section. Don't permit input sections after sections
5673 are attached to segments. Don't call allocate_output_section.
5674 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5675 not write_enable_output_section.
5676 (Layout::make_output_section): Don't push to
5677 unattached_section_list_ nor call attach_to_segment. Call
5678 attach_section_to_segment if sections are attached.
5679 (Layout::attach_sections_to_segments): New function.
5680 (Layout::attach_section_to_segment): New function.
5681 (Layout::attach_allocated_section_to_segment): Rename from
5682 attach_to_segment. Remove flags parameter.
5683 (Layout::allocate_output_section): Remove function.
5684 (Layout::write_enable_output_section): Remove function.
5685 * layout.h (class Layout): Update for above changes. Add new
5686 field sections_are_attached_.
5687 * output.h (Output_section::update_flags_for_input_section): New
5689 * output.cc (Output_section::add_input_section): Call
5690 update_flags_for_input_section.
5691 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5693 2008-04-11 Cary Coutant <ccoutant@google.com>
5695 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5696 thought unnecessary.
5697 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5699 2008-04-11 Ian Lance Taylor <iant@google.com>
5701 * output.h (class Output_section_data): Remove inline definition
5703 * output.cc (Output_section_data::set_addralign): New function.
5705 2008-04-11 Cary Coutant <ccoutant@google.com>
5707 Add support for TLS descriptors for i386 and x86_64.
5708 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5709 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5710 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5712 (Target_i386::got_mod_index_entry): Remove unnecessary code.
5713 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5714 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
5716 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5717 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5718 Fix problem with initial-exec relocations.
5719 (Target_i386::Relocate::relocate_tls): Likewise.
5720 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5722 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5723 support for section-plus-offset dynamic table entries.
5724 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5725 (Output_data_dynamic::Dynamic_entry): Add support for
5726 section-plus-offset dynamic table entries.
5727 (Output_data_dynamic::Classification): Likewise.
5728 (Output_data_dynamic::classification_): Renamed offset_.
5729 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5730 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5731 (Target_x86_64::make_plt_section): New function.
5732 (Target_x86_64::reserve_tlsdesc_entries): New function.
5733 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5734 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5735 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5736 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5737 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5738 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5739 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5740 add extra PLT entry for TLS descriptors.
5741 (Output_data_plt_x86_64::got_): New field.
5742 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5743 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5745 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5747 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5748 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5749 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5750 R_386_TLS_DESC_CALL relocations.
5751 (Target_x86_64::Scan::global): Likewise.
5752 (Target_x86_64::do_finalize_sections): Add dynamic table entries
5753 for TLS descriptors.
5754 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
5755 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
5756 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
5757 GD-to-IE relaxation.
5758 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
5759 and TLS_DESCRIPTORS.
5760 * Makefile.in: Rebuild.
5761 * configure: Rebuild.
5762 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
5763 (tls_test_shared2.so): New target.
5764 (tls_shared_gd_to_ie_test_SOURCES): New variable.
5765 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
5766 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
5767 (tls_shared_gd_to_ie_test_LDADD): New variable.
5768 (tls_shared_gnu2_gd_to_ie_test): New target.
5769 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
5771 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
5772 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
5773 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
5774 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
5775 (tls_shared_gnu2_test): New target.
5776 (tls_test_gnu2_shared.so): New target.
5777 (tls_shared_gnu2_test_SOURCES): New variable.
5778 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
5779 (tls_shared_gnu2_test_LDFLAGS): New variable.
5780 (tls_shared_gnu2_test_LDADD): New variable.
5781 * testsuite/Makefile.in: Rebuild.
5782 * testsuite/Makefile.
5784 2008-04-11 Ian Lance Taylor <iant@google.com>
5786 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
5788 * testsuite/Makefile.in: Rebuild.
5790 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
5792 * testsuite/script_test_2.cc (main): Adjust test.
5794 2008-04-11 David S. Miller <davem@davemloft.net>
5795 Ian Lance Taylor <iant@google.com>
5797 * options.h (General_options): Add entries for '-Y' and
5799 * options.cc (General_options:finalize): If -Y was used, add those
5800 entries to the library path instead of the default "/lib" and
5803 2008-04-11 David S. Miller <davem@davemloft.net>
5805 * testsuite/justsyms.t: Start at 0x100.
5806 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
5807 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
5809 * testsuite/script_test_2.cc: Adjust string and section length
5812 2008-04-09 Ian Lance Taylor <iant@google.com>
5815 * script-sections.cc (Sections_element::allocate_to_segment): Add
5817 (Output_section_definition::allocate_to_segment): Likewise.
5818 (Orphan_output_section::allocate_to_segment): Likewise.
5819 (Script_sections::attach_sections_using_phdrs_clause): Don't
5820 propagate non-PT_LOAD segments to orphan sections.
5821 * testsuite/Makefile.am (script_test_3.stdout): Generate using
5822 readelf rather than objdump.
5823 * testsuite/script_test_3.sh: Adjust accordingly. Test that
5824 .interp section and PT_INTERP segment are the same size.
5825 * testsuite/Makefile.in: Rebuild.
5827 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
5828 aliases for symbols defined in the same object.
5829 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5830 (weak_alias_test_SOURCES): New variable.
5831 (weak_alias_test_DEPENDENCIES): New variable.
5832 (weak_alias_test_LDFLAGS): New variable.
5833 (weak_alias_test_LDADD): New variable.
5834 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5835 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5836 (weak_alias_test_3.o): New target.
5837 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5838 * testsuite/weak_alias_test_main.cc: New file.
5839 * testsuite/weak_alias_test_1.cc: New file.
5840 * testsuite/weak_alias_test_2.cc: New file.
5841 * testsuite/weak_alias_test_3.cc: New file.
5843 2008-04-08 Ian Lance Taylor <iant@google.com>
5845 * options.h (class General_options): Add --noinhibit-exec option.
5846 * main.cc (main): Check --noinhibit-exec.
5848 * options.h (class General_options): Define --wrap as a special
5849 option. Add wrap_symbols_ field.
5850 (General_options::any_wrap_symbols): New function.
5851 (General_options::is_wrap_symbol): New function.
5852 * options.cc (General_options::parse_wrap): New function.
5853 (General_options::General_options): Initialize wrap_symbols_.
5854 * symtab.cc (Symbol_table::wrap_symbol): New function.
5855 (Symbol_table::add_from_object): Handle --wrap.
5856 * symtab.h (class Symbol_table): Declare wrap_symbol.
5857 * target.h (Target::wrap_char): New function.
5858 (Target::Target_info): Add wrap_char field.
5859 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
5860 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5861 * testsuite/testfile.cc (Target_test::test_target_info):
5864 * errors.cc (Errors::undefined_symbol): Mention symbol version if
5867 * layout.h (class Layout): Add added_eh_frame_data_ field.
5868 * layout.cc (Layout::Layout): Initialize new field.
5869 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
5870 output section until we find a section we merged successfully.
5871 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
5872 that the size be non-zero.
5874 * merge.cc (Object_merge_map::get_output_offset): Remove inline
5877 2008-04-08 Craig Silverstein <csilvers@google.com>
5879 * configure.ac: Export new conditional variable HAVE_ZLIB.
5880 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
5882 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
5883 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5885 2008-04-07 Ian Lance Taylor <iant@google.com>
5887 * version.cc (version_string): Set to "1.5".
5889 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
5890 Add issued_non_pic_error_ field. Declare check_non_pic.
5891 (Target_x86_64::Scan::check_non_pic): New function.
5892 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
5893 (Target_x86_64::Scan::global): Likewise.
5895 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
5896 addend parameter. Change caller. Handle merge sections.
5897 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5898 Address to Addend. Don't add in the result of
5899 local_section_offset, pass down the addend and use the returned
5901 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5902 Update declarations of local_section_offset and symbol_value.
5903 * testsuite/two_file_test_1.cc (t18): New function.
5904 * testsuite/two_file_test_2.cc (f18): New function.
5905 * testsuite/two_file_test_main.cc (main): Call t18.
5906 * testsuite/two_file_test.h (t18, f18): Declare.
5908 * configure.ac: Don't test for objdump, c++filt, or readelf.
5909 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5911 (TEST_READELF): New variable.
5912 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5913 (check_PROGRAMS): Add two_file_strip_test.
5914 (two_file_strip_test): New target.
5915 (check_PROGRAMS): Add two_file_same_shared_strip_test.
5916 (two_file_same_shared_strip_test_SOURCES): New variable.
5917 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5918 (two_file_same_shared_strip_test_LDFLAGS): New variable.
5919 (two_file_same_shared_strip_test_LDADD): New variable.
5920 (two_file_shared_strip.so): New target.
5921 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5922 (ver_test_5.syms, ver_test_7.syms): Likewise.
5923 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5924 (strip_test_3.stdout): Use TEST_OBJDUMP.
5925 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5927 2008-04-04 Cary Coutant <ccoutant@google.com>
5929 * symtab.h (Symbol::is_weak_undefined): New function.
5930 (Symbol::is_strong_undefined): New function.
5931 (Symbol::is_absolute): New function.
5932 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5933 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5935 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5936 (weak_undef_test): New target.
5937 * testsuite/Makefile.in: Rebuild.
5938 * testsuite/weak_undef_file1.cc: New file.
5939 * testsuite/weak_undef_file2.cc: New file.
5940 * testsuite/weak_undef_test.cc: New file.
5942 2008-04-03 Craig Silverstein <csilvers@google.com>
5944 * compressed_output.h (class Output_compressed_section): Use
5946 * compressed_output.cc (zlib_compress): Use unsigned buffers,
5948 (zlib_compressed_suffix): Removed.
5949 (Output_compressed_section::set_final_data_size): Use unsigned
5951 * testsuite/Makefile.am (flagstest_compress_debug_sections):
5952 Fix linker invocation.
5953 (flagstest_o_specialfile_and_compress_debug_sections):
5955 * testsuite/Makefile.in: Regenerated.
5957 2008-04-02 David S. Miller <davem@davemloft.net>
5959 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5960 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5962 2008-04-02 Craig Silverstein <csilvers@google.com>
5966 2008-04-02 Ian Lance Taylor <iant@google.com>
5968 * fileread.cc (File_read::find_view): Add byteshift and vshifted
5969 parameters. Update for new key type to views_. Change all
5971 (File_read::read): Adjust for byteshift in returned view.
5972 (File_read::add_view): New function, broken out of
5974 (File_read::make_view): New function, broken out of
5976 (File_read::find_or_make_view): Add offset and aligned
5977 parameters. Rewrite accordingly. Change all callers.
5978 (File_read::get_view): Add offset and aligned parameters. Adjust
5979 for byteshift in return value.
5980 (File_read::get_lasting_view): Likewise.
5981 * fileread.h (class File_read): Update declarations.
5982 (class File_read::View): Add byteshift_ field. Add byteshift to
5983 constructor. Add byteshift method.
5984 * archive.h (Archive::clear_uncached_views): New function.
5985 (Archive::get_view): Add aligned parameter. Change all callers.
5986 * object.h (Object::get_view): Add aligned parameter. Change all
5988 (Object::get_lasting_view): Likewise.
5990 * fileread.cc (File_read::release): Don't call clear_views if
5991 there are multiple objects.
5992 * fileread.h (File_read::clear_uncached_views): New function.
5993 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5996 2008-03-31 Cary Coutant <ccoutant@google.com>
5998 Add thin archive support.
5999 * archive.cc (Archive::armagt): New const.
6000 (Archive::setup): Remove task parameter and calls to unlock.
6001 (Archive::unlock_nested_archives): New function.
6002 (Archive::read_header): Add nested_off parameter. Change
6004 (Archive::interpret_header): Likewise.
6005 (Archive::include_all_members): Change to handle thin
6007 (Archive::include_member): Likewise.
6008 * archive.h (Archive::Archive): Add new parameters and
6010 (Archive::armagt): New const.
6011 (Archive::setup): Remove task parameter.
6012 (Archive::unlock_nested_archives): New function.
6013 (Archive::read_header): Add nested_off parameter.
6014 (Archive::interpret_header): Likewise.
6015 (Archive::Nested_archive_table): New typedef.
6016 (Archive::is_thin_archive_): New field.
6017 (Archive::nested_archives_): New field.
6018 (Archive::options_): New field.
6019 (Archive::dirpath_): New field.
6020 (Archive::task_): New field.
6021 * readsyms.cc (Read_symbols::do_read_symbols): Add check
6022 for thin archives. Pass additional parameters to
6023 Archive::Archive. Unlock the archive file after calling
6026 2008-03-29 Ian Lance Taylor <iant@google.com>
6028 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6029 version symbol to be local.
6030 * testsuite/ver_test_4.sh: New file.
6031 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6032 (check_DATA): Add ver_test_4.syms.
6033 (ver_test_4.syms): New target.
6034 * testsuite/Makefile.in: Rebuild.
6037 (Output_section::Input_section_sort_entry::has_priority): New
6039 (Output_section::Input_section_sort_entry::match_file_name): New
6041 (Output_section::Input_section_sort_entry::match_section_name):
6043 (Output_section::Input_section_sort_entry::match_section_name_prefix):
6045 (Output_section::Input_section_sort_entry::match_section_file):
6047 (Output_section::Input_section_sort_compare::operator()): Rewrite
6048 using new Input_section_sort_entry functions. Sort crtbegin and
6049 crtend first. Sort sections with no priority before sections with
6051 * testsuite/initpri1.c (d3): Check j != 4.
6052 (cd5): New constructor/destructor function.
6053 (main): Check j != 2.
6055 * symtab.cc (Symbol_table::add_from_object): If we don't use the
6056 new symbol when resolving, don't call set_is_default.
6057 * testsuite/ver_test_7.cc: New file.
6058 * testsuite/ver_test_7.sh: New file.
6059 * testsuite/Makefile.am (ver_test_7.so): New target.
6060 (ver_test_7.o): New target.
6061 (check_SCRIPTS): Add ver_test_7.sh.
6062 (check_DATA): Add ver_test_7.syms.
6063 (ver_test_7.syms): New target.
6065 2008-03-28 Ian Lance Taylor <iant@google.com>
6067 * layout.cc (Layout::layout): If we see an input section with a
6068 name that needs sorting, set the must_sort flag for the output
6070 (Layout::make_output_section): If the name of the output section
6071 indicates that it might require sorting, set the may_sort flag.
6072 * output.h (Output_section::may_sort_attached_input_sections): New
6074 (Output_section::set_may_sort_attached_input_sections): New
6076 (Output_section::must_sort_attached_input_sections): New
6078 (Output_section::set_must_sort_attached_input_sections): New
6080 (class Output_section): Declare Input_section_sort_entry. Define
6081 Input_section_sort_compare. Declare
6082 sort_attached_input_sections. Add new fields:
6083 may_sort_attached_input_sections_,
6084 must_sort_attached_input_sections_,
6085 attached_input_sections_are_sorted_.
6086 * output.cc (Output_section::Output_section): Initialize new
6088 (Output_section::add_input_section): Add an entry to
6089 input_sections_ if may_sort or must_sort are true.
6090 (Output_section::set_final_data_size): Call
6091 sort_attached_input_sections if necessary.
6092 (Output_section::Input_section_sort_entry): Define new class.
6093 (Output_section::Input_section_sort_compare::operator()): New
6095 (Output_section::sort_attached_input_sections): New function.
6096 * configure.ac: Check whether the compiler supports constructor
6097 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
6098 * testsuite/initpri1.c: New file.
6099 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6100 CONSTRUCTOR_PRIORITY.
6101 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6102 (initpri1_LDFLAGS): New variable.
6103 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6105 2008-03-27 Ian Lance Taylor <iant@google.com>
6107 * common.cc (Sort_commons::operator): Correct sorting algorithm.
6108 * testsuite/common_test_1.c: New file.
6109 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6110 (common_test_1_SOURCES): New variable.
6111 (common_test_1_DEPENDENCIES): New variable.
6112 (common_test_1_LDFLAGS): New variable.
6114 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6115 and commons_ correctly when NAME/VERSION does not override
6117 * testsuite/ver_test_6.c: New file.
6118 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6119 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6120 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6122 2008-03-26 Ian Lance Taylor <iant@google.com>
6124 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6125 of an undefined symbol from a version script.
6126 * testsuite/Makefile.am (ver_test_5.so): New target.
6127 (ver_test_5.o): New target.
6128 (check_SCRIPTS): Add ver_test_5.sh.
6129 (check_DATA): Add ver_test_5.syms.
6130 (ver_test_5.syms): New target.
6131 * testsuite/ver_test_5.cc: New file.
6132 * testsuite/ver_test_5.script: New file.
6133 * testsuite/ver_test_5.sh: New file.
6134 * Makefile.in, testsuite/Makefile.in: Rebuild.
6137 Fix problems building gold with gcc 4.3.0.
6138 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6139 (gold_error_at_location, gold_warning_at_location): Use it.
6140 * configure.ac: Check whether we can compile and use a template
6141 function with a printf attribute.
6142 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6143 when jumping over bytes.
6144 * object.cc: Instantiate Object::read_section_data.
6145 * debug.h: Include <cstring>
6146 * dwarf_reader.cc: Include <algorithm>
6147 * main.cc: Include <cstring>.
6148 * options.cc: Include <cstring>.
6149 * output.cc: Include <cstring>.
6150 * script.cc: Include <cstring>.
6151 * script.h: Include <string>.
6152 * symtab.cc: Include <cstring> and <algorithm>.
6153 * target-select.cc: Include <cstring>.
6154 * version.cc: Include <string>.
6155 * testsuite/testmain.cc: Include <cstdlib>.
6156 * configure, config.in: Rebuild.
6158 2008-03-25 Ian Lance Taylor <iant@google.com>
6160 * options.cc: Include "../bfd/bfdver.h".
6161 (options::help): Print bug reporting address.
6163 * version.cc (print_version): Adjust output for current value of
6168 * options.cc (options::help): Print list of supported targets.
6169 * target-select.h: Include <vector>.
6170 (class Target_selector): Make machine_, size_, and is_big_endian_
6171 fields const. Add bfd_name_ and instantiated_target_ fields.
6172 (Target_selector::Target_selector): Add bfd_name parameter.
6173 (Target_selector::recognize): Make non-virtual, call
6175 (Target_selector::recognize_by_name): Make non-virtual, call
6176 do_recognize_by_name.
6177 (Target_selector::supported_names): New function.
6178 (Target_selector::bfd_name): New function.
6179 (Target_selector::do_instantiate_target): New pure virtual
6181 (Target_selector::do_recognize): New virtual function.
6182 (Target_selector::do_recognize_by_name): New virtual function.
6183 (Target_selector::instantiate_target): New private function.
6184 (supported_target_names): Declare.
6185 * target-select.cc (Target_selector::Target_selector): Update for
6186 new parameter and fields.
6187 (select_target_by_name): Check that the name matches before
6188 calling recognize_by_name.
6189 (supported_target_names): New function.
6190 * i386.cc (class Target_selector_i386): Update Target_selector
6191 constructor call. Remove recognize and recognize_by_name. Add
6192 do_instantiate_target.
6193 * x86_64.cc (class Target_selector_x86_64): Likewise.
6194 * testsuite/testfile.cc (class Target_selector_test): Update for
6195 changes to Target_selector.
6197 * README: Rewrite, with some notes on unsupported features.
6199 2008-03-24 Cary Coutant <ccoutant@google.com>
6201 * i386.cc (Target_i386::Got_type): New enum declaration.
6202 (Target_i386::Scan::local): Updated callers of Output_data_got
6204 (Target_i386::Scan::global): Likewise.
6205 (Target_i386::Relocate::relocate): Likewise.
6206 (Target_i386::Relocate::relocate_tls): Likewise.
6207 * object.h (Got_offset_list): New class.
6208 (Sized_relobj::local_has_got_offset): Added got_type parameter.
6209 (Sized_relobj::local_got_offset): Likewise.
6210 (Sized_relobj::set_local_got_offset): Likewise.
6211 (Sized_relobj::local_has_tls_got_offset): Removed.
6212 (Sized_relobj::local_tls_got_offset): Removed.
6213 (Sized_relobj::set_local_tls_got_offset): Removed.
6214 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6215 * output.cc (Output_data_got::add_global): Added got_type parameter.
6216 (Output_data_got::add_global_with_rel): Likewise.
6217 (Output_data_got::add_global_with_rela): Likewise.
6218 (Output_data_got::add_global_pair_with_rel): New function.
6219 (Output_data_got::add_global_pair_with_rela): New function.
6220 (Output_data_got::add_local): Added got_type parameter.
6221 (Output_data_got::add_local_with_rel): Likewise.
6222 (Output_data_got::add_local_with_rela): Likewise.
6223 (Output_data_got::add_local_pair_with_rel): New function.
6224 (Output_data_got::add_local_pair_with_rela): New function.
6225 (Output_data_got::add_global_tls): Removed.
6226 (Output_data_got::add_global_tls_with_rel): Removed.
6227 (Output_data_got::add_global_tls_with_rela): Removed.
6228 (Output_data_got::add_local_tls): Removed.
6229 (Output_data_got::add_local_tls_with_rel): Removed.
6230 (Output_data_got::add_local_tls_with_rela): Removed.
6231 * output.h (Output_data_got::add_global): Added got_type parameter.
6232 (Output_data_got::add_global_with_rel): Likewise.
6233 (Output_data_got::add_global_with_rela): Likewise.
6234 (Output_data_got::add_global_pair_with_rel): New function.
6235 (Output_data_got::add_global_pair_with_rela): New function.
6236 (Output_data_got::add_local): Added got_type parameter.
6237 (Output_data_got::add_local_with_rel): Likewise.
6238 (Output_data_got::add_local_with_rela): Likewise.
6239 (Output_data_got::add_local_pair_with_rel): New function.
6240 (Output_data_got::add_local_pair_with_rela): New function.
6241 (Output_data_got::add_global_tls): Removed.
6242 (Output_data_got::add_global_tls_with_rel): Removed.
6243 (Output_data_got::add_global_tls_with_rela): Removed.
6244 (Output_data_got::add_local_tls): Removed.
6245 (Output_data_got::add_local_tls_with_rel): Removed.
6246 (Output_data_got::add_local_tls_with_rela): Removed.
6247 * resolve.cc (Symbol::override_base_with_special): Removed
6248 reference to has_got_offset_ field.
6249 * symtab.cc (Symbol::init_fields): Replaced initialization
6250 of got_offset_ with got_offsets_. Removed initialization
6252 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6253 (Symbol::got_offset): Likewise.
6254 (Symbol::set_got_offset): Likewise.
6255 (Symbol::has_tls_got_offset): Removed.
6256 (Symbol::tls_got_offset): Removed.
6257 (Symbol::set_tls_got_offset): Removed.
6258 (Symbol::got_offset_): Removed.
6259 (Symbol::tls_mod_got_offset_): Removed.
6260 (Symbol::tls_pair_got_offset_): Removed.
6261 (Symbol::got_offsets_): New field.
6262 (Symbol::has_got_offset): Removed.
6263 (Symbol::has_tls_mod_got_offset): Removed.
6264 (Symbol::has_tls_pair_got_offset): Removed.
6265 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6266 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6268 (Target_x86_64::Scan::global): Likewise.
6269 (Target_x86_64::Relocate::relocate): Likewise.
6270 (Target_x86_64::Relocate::relocate_tls): Likewise.
6272 2008-03-25 Ben Elliston <bje@au.ibm.com>
6274 * yyscript.y: Fix spelling error in comment.
6276 2008-03-24 Ian Lance Taylor <iant@google.com>
6278 * options.h (class General_options): Define build_id option.
6279 * layout.h (class Layout): Declare write_build_id, create_note,
6280 create_build_id. Add build_id_note_ member.
6281 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6282 "libiberty.h", "md5.h", "sha1.h".
6283 (Layout::Layout): Initialize eh_frame_data_,
6284 eh_frame_hdr_section_, and build_id_note_.
6285 (Layout::finalize): Call create_build_id.
6286 (Layout::create_note): New function, broken out of
6287 Layout::create_gold_note.
6288 (Layout::create_gold_note): Call create_note.
6289 (Layout::create_build_id): New function.
6290 (Layout::write_build_id): New function.
6291 (Close_task_runner::run): Call write_build_id.
6293 * x86_64.cc: Correct license to GPLv3.
6295 2008-03-23 Ian Lance Taylor <iant@google.com>
6297 * options.cc: Include "demangle.h".
6298 (parse_optional_string): New function.
6299 (parse_long_option): Handle takes_optional_argument.
6300 (parse_short_option): Update dash_z initializer. Handle
6301 takes_optional_argument.
6302 (General_options::General_options): Initialize do_demangle_.
6303 (General_options::finalize): Set do_demangle_. Handle demangling
6305 * options.h (parse_optional_string): Declare.
6306 (struct One_option): Add optional_arg field. Update constructor.
6307 Update call constructor calls. Add takes_optional_argument
6309 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6310 (DEFINE_optional_string): Define.
6311 (General_options::demangle): Change from DEFINE_bool to
6312 DEFINE_optional_string.
6313 (General_options::no_demangle): New function.
6314 (General_options::do_demangle): New function.
6315 (General_options::set_do_demangle): New function.
6316 (General_options::execstack_status_): Move definition to end of
6318 (General_options::static_): Likewise.
6319 (General_options::do_demangle_): New field.
6320 * object.cc (big_endian>::get_symbol_location_info): Call
6321 Options::do_demangle, not Options::demangle.
6322 * symtab.cc (demangle): Likewise.
6324 2008-03-22 Ian Lance Taylor <iant@google.com>
6326 * gold.h: Include <cstddef> and <sys/types.h>
6327 * options.h: Include <cstring>.
6329 2008-03-21 Ian Lance Taylor <iant@google.com>
6331 * Added source code to GNU binutils.