1 2010-01-08 Ian Lance Taylor <iant@google.com>
4 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5 dynamic symbol table, use the normal symbol table.
6 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9 2010-01-08 Ian Lance Taylor <iant@google.com>
12 * layout.cc (Layout::include_section): Remove .gnu_debuglink
15 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
17 * version.cc (print_version): Change to "Copyright 2010".
19 2010-01-08 Ian Lance Taylor <iant@google.com>
23 * i386.cc (class Target_i386): Change return type of plt_section
25 (class Output_data_plt_i386): Add tls_desc_rel_ field.
26 (Output_data_plt_i386::Output_data_plt_i386): Initialize
28 (Output_data_plt_i386::rel_tls_desc): New function.
29 (Target_i386::rel_tls_desc_section): New function.
30 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
31 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
32 R_386_TLS_DESC reloc in rel_tls_desc_section.
33 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
34 Define struct Tlsdesc_info.
35 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
36 (Target_x86_64::do_reloc_symbol_index): New function.
37 (Target_x86_64::add_tlsdesc_info): New function.
38 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
39 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
41 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
43 (Output_data_plt_x86_64::rela_tlsdesc): New function.
44 (Target_x86_64::rela_tlsdesc_section): New function.
45 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
47 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
48 (Target_x86_64::do_reloc_addend): New function.
49 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
50 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
51 declarations. Define TARGET_CODE. Add arg field to u1_ union.
52 (Output_reloc::type): New function.
53 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
54 (Output_reloc::is_target_specific): New function.
55 (Output_reloc::target_arg): New function.
56 (class Output_reloc) [SHT_RELA]: Add four new constructors for
57 absolute relocs and target specific relocs.
58 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
60 (class Output_data_reloc) [SHT_RELA]: Likewise.
61 * output.cc (Output_reloc::Output_reloc): Add four new versions
62 for absolute relocs and target specific relocs.
63 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
64 (Output_reloc::get_symbol_index): Likewise.
65 (Output_reloc::local_section_offset): Check that local_sym_index_
66 is not TARGET_CODE or 0.
67 (Output_reloc::symbol_value): Likewise.
68 (Output_reloc::write) [SHT_RELA]: Call target for target specific
70 * target.h (class Target): Add reloc_symbol_index and reloc_addend
71 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
73 * layout.cc (add_target_dynamic_tags): Use output section for
74 DT_PLTRELSZ and DT_JMPREL.
76 2010-01-07 Ian Lance Taylor <iant@google.com>
79 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
81 (class Output_data_reloc_generic): Define.
82 (class Output_data_reloc_base): Change base class to
83 Output_data_reloc_generic. Change add() method to call
84 bump_relative_reloc_count for a relative reloc. Remove
86 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
88 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
89 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
91 * layout.h (class Layout): Update declaration.
93 2010-01-07 Ian Lance Taylor <iant@google.com>
95 * output.h (class Output_data): Add const version of
96 output_section and do_output_section.
97 (class Output_section_data): Add const version of
99 (class Output_section): Likewise.
100 * layout.cc (Layout::add_target_dynamic_tags): New function.
101 * layout.h (class Layout): Update declarations.
102 * arm.cc (Target_arm::do_finalize_sections): Use
103 add_target_dynamic_tags.
104 * i386.cc (Target_i386::do_finalize_sections): Likewise.
105 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
106 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
107 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
109 2010-01-07 Ian Lance Taylor <iant@google.com>
112 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
115 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
116 Ian Lance Taylor <iant@google.com>
119 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
120 Xindex::read_symtab_xindex.
122 2010-01-07 Doug Kwan <dougkwan@google.com>
124 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
125 (Insn_template::thumb16_bcond_insn): New method declaration.
126 (Insn_template): Fix spelling.
127 (Stub::thumb16_special): New method declaration.
128 (Stub::do_write): Define virtual method which was previously pure
130 (Stub::do_thumb16_special): New method declaration.
131 (Stub::do_fixed_endian_write): New template member.
132 (Reloc_stub::do_write): Remove.
133 (Reloc_stub::do_fixed_endian_write): Remove.
134 (Cortex_a8_stub): New class definition.
135 (Stub_factory::make_cortex_a8_stub): New method definition.
136 (Stub_factory::Stub_factory): Add missing static storage class
137 qualifier for elf32_arm_stub_a8_veneer_blx.
139 2010-01-07 Ian Lance Taylor <iant@google.com>
142 * options.h (class General_options): Add --warn-unresolved-symbols
143 and --error-unresolved-symbols.
144 * errors.cc (Errors::undefined_symbol): Implement
145 --warn-unresolved-symbols.
147 * options.h (class General_options): Add -z text and -z textoff.
148 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
150 2010-01-06 Sriraman Tallam <tmsriram@google.com>
152 * gc.h (Garbage_collection::Cident_section_map): New typedef.
153 (Garbage_collection::cident_sections): New function.
154 (Garbage_collection::add_cident_section): New function.
155 (Garbage_collection::cident_sections_): New member.
156 (gc_process_relocs): Add references to sections whose names are C
158 * gold.h (cident_section_start_prefix): New constant.
159 (cident_section_stop_prefix): New constant.
160 (is_cident): New function.
161 * layout.cc (Layout::define_section_symbols): Replace string constants
162 with the newly defined constants.
163 * object.cc (Sized_relobj::do_layout): Track sections whose names are
165 * testsuite/Makefile.am: Add gc_orphan_section_test.
166 * testsuite/Makefile.in: Regenerate.
167 * testsuite/gc_orphan_section_test.cc: New file.
168 * testsuite/gc_orphan_section_test.sh: New file.
170 2010-01-06 Ian Lance Taylor <iant@google.com>
173 * options.h (class General_options): Add --warn-shared-textrel.
174 * layout.cc (Layout::finish_dynamic_section): Implement
175 --warn-shared-textrel.
178 * options.h (class General_options): Add --warn-multiple-gp.
180 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
182 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
183 $(THREADSLIB) and $(LIBDL).
184 * Makefile.in: Rebuild.
186 2010-01-06 Ian Lance Taylor <iant@google.com>
189 * options.cc (General_options::parse_section_start): New function.
190 (General_options::section_start): New function.
191 (General_options::General_options): Initialize all members.
192 * options.h: Include <map>
193 (class General_options): Add --section-start. Add section_starts_
195 * layout.cc (Layout::attach_allocated_section_to_segment): If
196 --section-start was used, set the address of the segment. Remove
198 (Layout::relaxation_loop_body): If the address of the load segment
199 has been set by --section-start, don't use it.
200 * output.h (Output_segment::update_flags_for_output_section): New
202 * output.cc (Output_segment::add_output_section): Call
203 update_flags_for_output_section.
205 2010-01-05 Ian Lance Taylor <iant@google.com>
208 * options.h (class General_options): Add --undefined-version.
209 * script.cc (struct Version_expression): Add was_matched_by_symbol
211 (Version_script_info::matched_symbol): New function.
212 (Version_script_info::get_symbol_version_helper): Call
214 (Version_script_info::check_unmatched_names): New function.
215 * script.h (class Version_script_info): Update declarations.
216 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
218 * options.h (class General_options): Use DEFINE_bool_alias for
219 allow_multiple_definition.
220 * resolve.cc (Symbol_table::should_override): Don't test
221 allow_multiple_definition.
224 * options.h (class General_options): Add --cref.
225 * main.cc (main): Print cref table if --cref. Don't close mapfile
226 until after printing cref table.
227 * cref.cc: Include "symtab.h".
228 (class Cref_inputs): Define Cref_table_compare and Cref_table.
229 (Cref_table_compare::operator()): New function.
230 (Cref_inputs::gather_cref): New function.
231 (filecol): New static const.
232 (Cref_inputs::print_cref): New function.
233 (Cref::print_cref): New function.
234 * cref.h: Include <cstdio>.
235 (class Cref): Update declarations.
236 * mapfile.h (Mapfile::file): New function.
237 * object.h (class Object): Define Symbols. Declare virtual
238 do_get_global_symbols.
239 (Object::get_global_symbols): New function.
240 * object.cc (Input_objects::add_object): Pass object to cref_ if
242 (Input_objects::archive_start): Likewise.
243 (Input_objects::archive_stop): Likewise.
244 (Input_objects::print_cref): New function.
245 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
246 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
248 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
250 * plugin.h (class Sized_pluginobj): Update declarations.
252 2010-01-05 Ian Lance Taylor <iant@google.com>
254 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
255 to is_default_version. Rename insdef to insdefault.
256 (Symbol_table::add_from_relobj): Rename def to is_default_version
257 and local to is_forced_local.
258 (Symbol_table::add_from_pluginobj): Likewise.
259 (Symbol_table::add_from_dynobj): Likewise.
260 (Symbol_table::define_special_symbol): Rename insdef to
263 2010-01-04 Ian Lance Taylor <iant@google.com>
266 * options.h (class General_options): Add
267 --allow-multiple-definition and -z muldefs.
268 * resolve.cc (Symbol_table::should_override): Don't warn about a
269 multiple symbol definition if --allow-multiple-definition or -z
273 * options.h (class General_options): Add --add-needed and
274 --copy-dt-needed-entries. Tweak --as-needed help entry.
275 * object.cc (Input_objects::check_dynamic_dependencies): Give an
276 error if --copy-dt-needed-entries aka --add-needed is used and
277 would cause a change in behaviour.
280 * options.h (class General_options): Add -G as a short version of
281 --shared. Add no-op options -assert, -g, and -i.
283 2010-01-04 Sriraman Tallam <tmsriram@google.com>
285 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
286 check for .text or .gnu.linkonce.t sections.
287 * icf.cc (Icf::find_identical_sections): Ditto.
288 Change the detection for mangled function name within the section
290 * icf.h (is_section_foldable_candidate): New function.
292 2009-12-30 Ian Lance Taylor <iant@google.com>
295 * options.h (class General_options): Permit two dashes with
296 --retain-symbols-file.
298 2009-12-30 Ian Lance Taylor <iant@google.com>
301 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
302 don't put the file header and segment headers in the text
306 * common.cc (Sort_commons::operator()): Stabilize sort when both
308 (Symbol_table::do_allocate_commons_list): When allocating common
309 symbols, skip a symbol which is no longer common.
310 * symtab.h (Symbol::is_common): Test whether the symbol comes from
311 an object before checking its type.
312 * testsuite/common_test_2.c: New file.
313 * testsuite/common_test_3.c: New file.
314 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
315 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
316 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
317 (common_test_2_pic.o, common_test_2.so): New targets.
318 (common_test_3_pic.o, common_test_3.so): New targets.
319 * testsuite/Makefile.in: Rebuild.
322 * script.cc (read_input_script): If we see a new SECTIONS clause,
323 and we have added an input section, give an error.
324 * layout.h (class Layout): Add have_added_input_section function.
325 Add have_added_input_section_ field.
326 * layout.cc (Layout::Layout): Initialize
327 have_added_input_section_.
328 (Layout::layout): Set have_added_input_section_.
329 (Layout::layout_eh_frame): Likewise.
331 2009-12-30 Ian Lance Taylor <iant@google.com>
334 * options.h (class General_options): Add --sort-common option.
335 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
336 * common.cc (Sort_common): Add sort_order parameter to
337 constructor. Add sort_order_ field.
338 (Sort_commons::operator): Check sort_order_.
339 (Symbol_table::allocate_commons): Determine the sort order.
340 (Symbol_table::do_allocate_commons): Add sort_order parameter.
342 (Symbol_table::do_allocate_commons_list): Likewise.
344 2009-12-30 Ian Lance Taylor <iant@google.com>
347 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
348 symbols from this object, don't change the visibility of an
350 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
352 2009-12-30 Ian Lance Taylor <iant@google.com>
355 * script.h (class Version_script_info): Define Language enum.
356 Update declarations. Define Glob, Exact, and Lookup types. Add
357 new fields globals_, locals_, and is_finalized_.
358 * script.cc: Various formatting fixes.
359 (class Parser_closure): Change language_stack_ from a vector of
360 std::string to one of Version_script_info::Language. Adjust all
362 (class Lazy_demangler): Remove.
363 (struct Version_expression): Change language from std::string to
364 Version_script_info::Language.
365 (Version_script_info::Version_script_info): New function.
366 (Version_script_info::~Version_script_info): Don't call clear.
367 (Version_script_info::finalize): New function.
368 (Version_script_info::build_lookup_tables): New function.
369 (Version_script_info::build_expression_list_lookup): New
371 (Version_script_info::get_symbol_version_helper): Rewrite to use
373 (Version_script_info::print_expression_list): Adjust to use
374 Version_script_info::Language.
375 (script_push_lex_into_version_mode): Check that the version script
376 has not been finalized.
377 (version_script_push_lang): Change language string to
378 Version_script_info::Language.
379 * options.cc (Command_line::version_script): New function.
380 * options.h (class General_options): Add finalize_dynamic_list
381 function. Change version_script from declaration to definition.
382 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
383 * testsuite/version_script.map: Remove duplicate def of foo.
384 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
386 * testsuite/Makefile.in: Rebuild.
388 2009-12-30 Ian Lance Taylor <iant@google.com>
391 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
392 if the input symbol index is 0, make the output symbol index 0.
394 2009-12-30 Ian Lance Taylor <iant@google.com>
397 * options.h (class General_options): Add -x/--discard-all.
398 * object.cc (Sized_relobj::do_count_local_symbols): Handle
399 --discard-all. If the local symbol needs a dynamic entry, check
400 that before handling --discard-locals.
402 2009-12-30 Ian Lance Taylor <iant@google.com>
405 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
407 (Output_segment::add_output_section): Don't change the flags if
411 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
412 GNU hash table if they need a dynamic value. Otherwise, don't add
413 them if they are defined in a dynamic object or are forced local.
415 2009-12-29 Ian Lance Taylor <iant@google.com>
418 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
419 .gnu.hash table for a 32-bit target.
422 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
423 regular and a dynamic object only needs a dynamic symbol table
424 entry if it is externally visible.
427 * i386.cc (class Target_i386): Initialize global_offset_table_ in
428 constructor. Add global_offset_table_ field.
429 (Target_i386::got_section): Set global_offset_table_.
430 (Target_i386::do_finalize_sections): Set global_offset_table_
432 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
433 in constructor. Add global_offset_table_ field.
434 (Target_x86_64::got_section): Set global_offset_table_.
435 (Target_x86_64::do_finalize_sections): Set global_offset_table_
438 * layout.cc (Layout::Layout): Initialize increase_relro_.
439 (Layout::get_output_section): Add is_relro, is_last_relro, and
440 is_first_non_relro parameters. Change all callers.
441 (Layout::choose_output_section): Likewise.
442 (Layout::add_output_section_data): Likewise.
443 (Layout::make_output_section): Likewise.
444 (Layout::set_segment_offsets): Clear increase_relro when using a
446 * layout.h (class Layout): Add increase_relro method. Add
447 increase_relro_ field. Update declarations.
448 * output.cc (Output_section::Output_section): Initialize
449 is_last_relro_ and is_first_non_relro_.
450 (Output_segment::add_output_section): Group relro sections is
451 do_sort is true. Handle is_last_relro and is_first_non_relro.
452 (Output_segment::maximum_alignment): Remove relro handling.
453 (Output_segment::set_section_addresses): Add increase_relro
454 parameter. Change all callers. Add initial alignment to align
455 relro sections on separate page. Remove old relro handling.
456 (Output_segment::set_section_list_addresses): Remove in_relro
457 parameter. Change all callers.
458 (Output_segment::set_offset): Add increase parameter. Change all
459 callers. Remove old relro handling.
460 * output.h (class Output_section): Add new methods: is_last_relro,
461 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
462 Add is_last_relro_ and is_first_non_relro_ fields.
463 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
464 Create separate .got.plt section. Call increase_relro.
465 * x86_64.cc (Target_x86_64::got_section): Likewise.
466 * testsuite/relro_script_test.t: Add .got.plt.
469 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
470 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
471 (Layout::finalize): Call set_dynamic_symbol_size.
472 (Layout::set_dynamic_symbol_size): New function.
473 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
474 set_dynamic_symbol_size.
477 * output.h (class Output_section): Add is_entsize_zero_ field.
478 * output.cc (Output_section::Output_section): Initialize
480 (Output_section::set_entsize): If two different entsizes are
481 requested, force it to zero.
482 (Output_section::add_input_section): Set flags for .debug_str
483 before updating section flags. Set entsize.
484 (Output_section::update_flags_for_input_section): Set SHF_MERGE
485 and SHF_STRING if all input sections have those flags.
487 2009-12-29 Rafael Espindola <espindola@google.com>
489 * main.cc (main): Fix the sys time reporting.
490 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
493 2009-12-29 Sriraman Tallam <tmsriram@google.com>
495 * options.cc (General_options::parse_version): Allow -v to exit
496 without an error if there is nothing to link.
498 2009-12-29 Ian Lance Taylor <iant@google.com>
500 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
501 using a version of gcc before 4.1.
502 * configure: Rebuild.
504 2009-12-28 Chris Demetriou <cgd@google.com>
506 * attributes.cc (Output_attributes_section_data::do_write): Use
507 std::vector::front rather than std::vector::data.
509 2009-12-28 Ian Lance Taylor <iant@google.com>
511 * symtab.h (class Symbol_table): Add enum Defined.
512 * resolve.cc (Symbol_table::should_override): Add defined
513 parameter. Change all callers. Test whether object is NULL
514 before calling a method on it.
515 (Symbol_table::report_resolve_problem): Add defined parameter.
517 (Symbol_table::should_override_with_special): Likewise.
518 * symtab.cc (Symbol_table::define_in_output_data): Add defined
519 parameter. Change all callers.
520 (Symbol_table::do_define_in_output_data): Likewise.
521 (Symbol_table::define_in_output_segment): Likewise.
522 (Symbol_table::do_define_in_output_segment): Likewise.
523 (Symbol_table::define_as_constant): Likewise.
524 (Symbol_table::do_define_as_constant): Likewise.
525 * script.h (class Symbol_assignment): Add is_defsym parameter to
526 constructor; change all callers.
527 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
528 parameter. Change all callers. Add is_defsym_ field.
529 (class Parser_closure): Add parsing_defsym parameter to
530 constructor; change all callers. Add parsing_defsym accessor
531 function. Add parsing_defsym_ field.
533 2009-12-28 Ian Lance Taylor <iant@google.com>
535 * gold.cc (queue_middle_tasks): Fix formatting.
536 * object.cc (Relobj::is_section_name_included): Likewise.
538 2009-12-23 Ian Lance Taylor <iant@google.com>
540 * i386.cc (Target_i386::do_calls_non_split): Recognize
541 -fsplit-stack prologue for a function with a static chain.
542 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
543 -fsplit-stack prologue when using %r11.
545 2009-12-21 Sriraman Tallam <tmsriram@google.com>
547 * options.cc (General_options::parse_version): Make -v continue and do
548 the link like GNU ld does.
550 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
552 * Makefile.am (CCFILES): Add timer.cc.
553 (HFILES): Add timer.h.
554 * configure.ac: Check for sysconf and times.
555 * main.cc: include timer.h.
556 (main): Use Timer instead of get_run_time.
559 * workqueue.cc: include timer.h.
560 (Workqueue::find_and_run_task):
561 Report user, sys and wall time.
562 * Makefile.in: Regenerate.
563 * config.in: Regenerate.
564 * configure: Regenerate.
566 2009-12-16 Doug Kwan <dougkwan@google.com>
568 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
570 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
571 relaxed input sections.
572 * output.cc (Output_section::find_relaxed_input_section): Change
573 return type to Output_relaxed_input_section pointer. Adjust code
574 for new type of relaxed_input_section_map_.
575 * output.h (Output_section::find_relaxed_input_section): Change
576 return type to Output_relaxed_input_section pointer.
577 (Output_section::Output_relaxed_input_section_by_input_section_map):
579 (Output_section::relaxed_input_section_map_): Change type to
580 Output_section::Output_relaxed_input_section_by_input_section_map.
581 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
584 2009-12-15 Ian Lance Taylor <iant@google.com>
586 * layout.cc (Layout::create_shstrtab): Only write out after input
587 sections if we are compressing debug sections.
589 2009-12-15 Ian Lance Taylor <iant@google.com>
591 * archive.cc (Archive::add_symbols): Only look up a symbol without
592 a version if there is, in fact, a version.
594 2009-12-14 Ian Lance Taylor <iant@google.com>
596 Revert -Wshadow changes, all changes from:
597 2009-12-11 Doug Kwan <dougkwan@google.com>
598 2009-12-11 Nick Clifton <nickc@redhat.com>
599 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
601 2009-12-11 Doug Kwan <dougkwan@google.com>
603 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
605 * attributes.cc (Object_attribute::size): Ditto.
606 (Attributes_section_data::size): Ditto.
607 (Attributes_section_data::Attributes_section_data): Ditto.
608 (Output_attributes_section_data::do_write): Ditto.
609 * attributes.h (Object_attribute::set_type): Ditto.
610 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
612 2009-12-11 Nick Clifton <nickc@redhat.com>
614 * archive.cc: Fix shadowed variable warnings.
616 * compressed_output.cc: Likewise.
617 * compressed_output.h: Likewise.
618 * configure: Likewise.
619 * dwarf_reader.cc: Likewise.
620 * dynobj.cc: Likewise.
621 * dynobj.h: Likewise.
622 * ehframe.cc: Likewise.
623 * ehframe.h: Likewise.
624 * errors.cc: Likewise.
625 * expression.cc: Likewise.
626 * fileread.cc: Likewise.
627 * fileread.h: Likewise.
628 * freebsd.h: Likewise.
631 * incremental.h: Likewise.
632 * layout.cc: Likewise.
633 * layout.h: Likewise.
634 * mapfile.cc: Likewise.
635 * merge.cc: Likewise.
637 * object.cc: Likewise.
638 * object.h: Likewise.
639 * options.h: Likewise.
640 * output.cc: Likewise.
641 * output.h: Likewise.
642 * parameters.cc: Likewise.
643 * plugin.cc: Likewise.
644 * powerpc.cc: Likewise.
645 * reduced_debug_output.cc: Likewise.
646 * reduced_debug_output.h: Likewise.
647 * reloc.cc: Likewise.
649 * resolve.cc: Likewise.
650 * script-sections.cc: Likewise.
651 * script.cc: Likewise.
652 * script.h: Likewise.
653 * sparc.cc: Likewise.
654 * symtab.cc: Likewise.
655 * symtab.h: Likewise.
656 * target-select.cc: Likewise.
657 * target-select.h: Likewise.
659 * workqueue.cc: Likewise.
660 * workqueue.h: Likewise.
661 * x86_64.cc: Likewise.
663 2009-12-10 Doug Kwan <dougkwan@google.com>
665 * arm.cc (attributes.h): New include.
666 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
667 (Arm_relobj::~Arm_relobj): Delete object pointed by
668 attributes_section_data_.
669 (Arm_relobj::attributes_section_data): New method definition.
670 (Arm_relobj::attributes_section_data_): New data member declaration.
671 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
672 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
673 attributes_section_data_.
674 (Arm_dynobj::attributes_section_data): New method definition.
675 (Arm_dynobj::attributes_section_data_): New data member declaration.
676 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
677 initialization value of may_use_blx_ to false.
678 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
679 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
680 object attributes to compute results instead of hard-coding.
681 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
682 Target_arm::get_secondary_compatible_arch,
683 Target_arm::set_secondary_compatible_arch
684 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
685 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
686 New method declarations.
687 (Target_arm::get_aeabi_object_attribute): New method definition.
688 (Target_arm::attributes_section_data_): New data member declaration.
689 (read_arm_attributes_section): New template definition.
690 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
691 (Arm_dynobj::do_read_symbols): Ditto.
692 (Target_arm::do_finalize_sections): Merge attributes sections from
693 input. Check for BLX use after attributes section merging.
694 Fix __exidx_start and __exidx_end visibility. Create an
695 .ARM.attributes section if necessary.
696 (Target_arm::get_secondary_compatible_arch,
697 Target_arm::set_secondary_compatible_arch,
698 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
699 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
700 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
701 New method definitions.
703 2009-12-09 Ian Lance Taylor <iant@google.com>
705 * plugin.cc (Plugin::load): Don't cast from void* to a function
708 2009-12-09 Ian Lance Taylor <iant@google.com>
710 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
713 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
715 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
716 Replace two_file_shared_1.so with two_file_shared_2.so.
717 * testsuite/Makefile.in: Regenerated.
719 2009-12-08 Doug Kwan <dougkwan@google.com>
721 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
722 (HFILES): Add attributes.h and int_encoding.h.
723 * Makefile.in: Regenerate.
724 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
725 function definitions to int_encoding.cc
726 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
727 prototypes to int_encoding.h
728 * reduced_debug_output.cc (int_encoding.h): New include.
729 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
730 function definitions to int_encoding.cc
731 (insert_into_vector, read_from_pointer): Move template definitions to
733 * attributes.cc: New file.
734 * attributes.h: New file.
735 * int_encoding.cc: New file.
736 * int_encoding.h: New file.
738 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
741 * incremental-dump.cc (dump_incremental_inputs): New.
742 (main): Use dump_incremental_inputs.
744 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
747 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
748 checking elfcpp::STT_FUNC.
749 (Target_i386::Relocate::relocate): Likewise.
750 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
752 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
753 symbols from shared libraries into normal FUNC symbols.
755 * symtab.h (Symbol): Add is_func and use it.
757 2009-12-05 Doug Kwan <dougkwan@google.com>
759 * arm.cc (Target_arm::arm_info): Initialize new fields
760 attributes_section and attributes_vendor.
761 * i386.cc (Target_i386::i386_info): Same.
762 * object.cc (Sized_relobj::do_layout): Skip attribute section.
763 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
764 fields attributes_section and attributes_vendor.
765 * sparc.cc (Target_sparc::sparc_info): Same.
766 * target.h (Target::attributes_section, Target::attributes_vendor,
767 Target::is_attributes_section, Target::attribute_arg_type,
768 Target::attributes_order): New method definitions.
769 (Target::Target_info::attributes_section,
770 Target::Target_info::attributes_vendor): New fields.
771 (Target::do_attribute_arg_type, Target::do_attributes_order): New
772 virtual method definitions.
773 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
774 attributes_section and attributes_vendor.
775 * testsuite/testfile.cc (Target_test::test_target_info): Same.
777 2009-12-05 Doug Kwan <dougkwan@google.com>
779 * arm.cc: Update comments about interworking and stub generation.
780 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
781 considered as non-PIC.
782 (Arm_relocate_functions::base_abs): Fix formatting.
783 (Arm_relocate_functions::got_prel): Fix comment. Change interface
784 of function to use GOT entry address instead of offset.
785 (Target_arm::Scan::global): Issue an error if a symbol would need a
786 PLT does not get one because it is untyped. Remove code to create
787 dynamic symbols for relative branches.
788 (Target_arm::Relocate::relocate: Use 0 instead of false since function
789 takes unsigned integer instead of boolean.
791 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
793 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
794 (two_file_test_LDADD): Likewise.
795 (common_test_1_LDADD): Likewise.
796 (exception_test_LDADD) Likewise.
797 (weak_test_LDADD): Likewise.
798 (many_sections_test_LDADD): Likewise.
799 (initpri1_LDADD): Likewise.
800 (script_test_1_LDADD): Likewise.
801 (script_test_2_LDADD): Likewise.
802 (justsyms_LDADD): Likewise.
803 (binary_test_LDADD): Likewise.
804 (large_LDADD): Likewise.
805 * testsuite/Makefile.in: Regenerated.
807 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
809 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
810 (Symbol_table::override_with_special): Likewise.
811 (Symbol_table::add_from_object): Likewise.
813 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
815 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
816 Don't set the data_offset twice.
818 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
820 * testsuite/Makefile.in: Regenerate.
822 2009-12-03 Doug Kwan <dougkwan@google.com>
824 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
825 (Target_arm::do_finalize_sections): Add parameter for symbol table
826 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
827 * i386.cc (Target_i386::do_finalize_sections): Add an additional
828 parameter for symbol table pointer.
829 * layout.cc (Layout::finalize): Call Target::finalize_sections with
830 an additional parameter for a pointer to symbol table.
831 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
832 parameter for a symbol table pointer.
833 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
834 * target.h (Target::finalize_sections, Target::do_finalize_sections):
836 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
837 parameter for a symbol table pointer.
839 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
841 * incremental.cc (Incremental_inputs_header)
842 (Incremental_inputs_header_write, Incremental_inputs_entry)
843 (Incremental_inputs_entry_write): Move ...
844 * incremental.h (Incremental_inputs_header)
845 (Incremental_inputs_header_write, Incremental_inputs_entry)
846 (Incremental_inputs_entry_write): here.
848 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
850 * incremental.cc (make_sized_incremental_binary): Set the target.
851 Error if it is incompatible.
852 * output.h (Output_file): Add filename method.
854 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
856 * incremental.cc (Incremental_inputs_entry): Remove unused argument
857 from the get_* methods.
859 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
861 * incremental-dump.cc (main): Check that the offeset of a script is 0.
862 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
863 Write 0 for the data_offset of scripts.
865 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
867 * testsuite/Makefile.am: Add the incremental_test.sh test.
868 * testsuite/incremental_test.sh: New.
869 * testsuite/incremental_test_1.c: New.
870 * testsuite/incremental_test_2.c: New.
872 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
874 * incremental-dump.cc (main): Fix typos.
876 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
879 * incremental-dump.cc (main): Use llu to print 64 bit values.
881 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
882 H.J. Lu <hongjiu.lu@intel.com>
884 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
886 (incremental_dump_LDADD): Likewise.
887 * Makefile.in: Regenerated.
889 2009-11-25 Doug Kwan <dougkwan@google.com>
893 2009-11-25 Doug Kwan <dougkwan@google.com>
895 * arm.cc (Target_arm::Target_arm): Move method definition
896 outside of class definition. Add code to handle
897 --target1-rel, --target1-abs and --target2= options.
898 (Target_arm::get_reloc_reloc_type): Change method to be
899 non-static and const.
900 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
901 New data member declaration.
902 (Target_arm::Scan::local, Target_arm::Scan::global,
903 Target_arm::Relocate::relocate,
904 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
905 Adjust call to Target_arm::get_real_reloc_type.
906 (Target_arm::get_real_reloc_type): Use command line options
907 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
908 * options.h (--target1-rel, --target1-abs, --target2): New
911 2009-11-25 Doug Kwan <dougkwan@google.com>
913 * arm.cc (Target_arm::Target_arm): Move method definition outside of
914 class definition. Add code to handle --target1-rel, --target1-abs
915 and --target2= options.
916 (Target_arm::get_reloc_reloc_type): Change method to be non-static
918 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
920 (Target_arm::Scan::local, Target_arm::Scan::global,
921 Target_arm::Relocate::relocate,
922 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
923 call to Target_arm::get_real_reloc_type.
924 (Target_arm::get_real_reloc_type): Use command line options to
925 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
926 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
929 2009-11-25 Doug Kwan <dougkwan@google.com>
931 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
932 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
933 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
935 (Arm_relocate_functions::thm_call): Replace body with a call to
936 Arm_relocate_functions::thumb_branch_common.
937 (Arm_relocate_functions::thm_jump24,
938 Arm_relocate_functions::thm_xpc22): New method definitions.
939 (Arm_relocate_functions::thumb_branch_common): New method definition.
940 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
942 (Target_arm::Relocate::relocate): Adjust call to thm_call.
943 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
945 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
947 * Makefile.am: Build incremental-dump
948 * Makefile.in: Regenerate.
949 * incremental-dump.cc: New.
950 * incremental.cc (Incremental_inputs_header_data,
951 Incremental_inputs_entry_data): Move to incremental.h
952 * incremental.h: (Incremental_inputs_header_data,
953 Incremental_inputs_entry_data): Move from incremental.cc
955 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
957 * incremental.cc (Incremental_inputs_header,
958 Incremental_inputs_header_write, Incremental_inputs_entry,
959 Incremental_inputs_entry_write): Add a typedef with the data type.
961 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
963 * incremental.cc (Incremental_inputs_header,
964 Incremental_inputs_header_write, Incremental_inputs_entry,
965 Incremental_inputs_entry_write): Update comment about which
966 type has the filed descriptions.
968 2009-11-15 Doug Kwan <dougkwan@google.com>
970 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
971 (Arm_relocate_functions::arm_branch_common): Change method defintion
972 in class definition to a method declaration and update list of formal
974 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
975 Arm_relocation_functions::jump24): Adjust call to
976 Arm_relocate_functions::arm_branch_common. Update list of formal
978 (Arm_relocate_functions::xpc25): New method definition.
979 (Arm_relocate_functions::arm_branch_common): Move method defintion
980 out from class definition. Use stubs for mode-switching and extending
982 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
983 specially. Change code to enable use of stubs in ARM branches.
985 2009-11-10 Doug Kwan <dougkwan@google.com>
987 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
988 in method declaration.
989 (Target_arm::relocate_stub): New method declaration.
990 (Target_arm::default_target): Change to return a pointer instead of
992 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
993 Target_arm::default_target.
994 (Arm_Relobj::do_relocate_sections): Remove options paramater in
996 (Target_arm::relocate_section): Adjust view.
997 (Target_arm::relocate_stub): New method definition.
999 2009-11-10 Doug Kwan <dougkwan@google.com>
1001 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1003 * incremental.cc (open_incremental_binary): Initialized local
1004 variables to avoid warnings.
1005 * object.cc (make_elf_object): Ditto.
1006 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1009 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1012 * testsuite/plugin_test.c: Include "config.h".
1014 2009-11-09 Doug Kwan <dougkwan@google.com>
1016 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1017 (arm_symbol_value): Remove.
1018 (Arm_relocate_functions::arm_branch_common,
1019 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1020 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1021 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1022 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1023 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1024 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1025 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1026 Arm_relocate_functions::thm_mobw_abs_nc,
1027 Arm_relocate_functions::thm_mov_abs,
1028 Arm_relocate_functions::movw_prel_nc,
1029 Arm_relocate_functions::thm_movt_abs,
1030 Arm_relocate_functions::movt_prel,
1031 Arm_relocate_functions::thm_movw_prel_nc,
1032 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1033 (Target_arm::Relocate::relocate): Only decompose address into two
1034 parts if relocation type uses the thumb-bit and pass the actual
1035 bit instead of a flag indicating that the thumb-bit is used. Adjust
1036 calls to methods in Arm_relocate_functions for this change.
1038 2009-11-08 Ian Lance Taylor <iant@google.com>
1041 * reloc.cc: Instantiate
1042 Sized_relobj::initialize_input_to_output_maps and
1043 Sized_relobj:free_input_to_output_maps.
1045 2009-11-06 Ian Lance Taylor <iant@google.com>
1048 * defstd.cc (in_segment): Set only_if_ref true for "end".
1050 2009-11-06 Doug Kwan <dougkwan@google.com>
1052 * arm.cc (class Reloc_stub): Correct a comment.
1053 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1054 (Target_arm::scan_section_for_stubs): New method declaration.
1055 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1056 Change methods from private to protected.
1057 (Target_arm::do_may_relax): New method definition.
1058 (Target_arm::do_relax, Target_arm::group_sections,
1059 Target_arm::scan_reloc_for_stub,
1060 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1061 (Target_arm::arm_input_section_map_): New data member declaration.
1062 (Target_arm::scan_reloc_for_stub,
1063 Target_arm::scan_reloc_section_for_stubs,
1064 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1065 Target_arm::do_relax): New method definitions.
1067 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1069 * configure.ac: Check for (struct stat)::st_mtim
1070 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1071 * config.in: Regenerate.
1072 * configure: Regenerate.
1074 2009-11-05 Ian Lance Taylor <iant@google.com>
1077 * output.cc (Output_segment::add_output_section): Add missing
1080 2009-11-04 Ian Lance Taylor <iant@google.com>
1083 * object.h (class Object): Add is_needed and set_is_needed
1084 methods. Add is_needed_ field. Make bool fields into bitfields.
1085 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1086 defined in a dynamic object and referenced by a regular object,
1087 set is_needed for the dynamic object.
1088 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1089 if the file is marked with as_needed and it is not needed.
1091 2009-11-04 Ian Lance Taylor <iant@google.com>
1094 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1095 tags if data is discarded by linker script.
1096 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1097 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1098 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1099 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1101 2009-11-04 Ian Lance Taylor <iant@google.com>
1103 * layout.cc (Layout::get_output_section): Add is_interp and
1104 is_dynamic_linker_section parameters. Change all callers.
1105 (Layout::choose_output_section): Likewise.
1106 (Layout::make_output_section): Likewise.
1107 (Layout::add_output_section_data): Add is_dynamic_linker_section
1108 parameter. Change all callers.
1109 * layout.h (class Layout): Update declarations.
1110 * output.h (class Output_section): Add is_interp, set_is_interp,
1111 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1112 Add is_interp_, is_dynamic_linker_section_ fields. Change
1113 generate_code_fills_at_write_ to a bitfield.
1114 * output.cc (Output_section::Output_sections): Initialize new
1116 (Output_segment::add_output_section): Add do_sort parameter.
1119 2009-11-03 Ian Lance Taylor <iant@google.com>
1122 * options.h (class General_options): Add --warn-common.
1123 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1124 merging two common symbols.
1125 (Symbol_table::should_override): Handle --warn-common when merging
1126 a common symbol with a defined symbol. Use report_resolve_problem
1127 for multiple definitions.
1128 (Symbol_table::report_resolve_problem): New function.
1129 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1131 2009-11-03 Doug Kwan <dougkwan@google.com>
1133 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1135 (Target_arm::stub_factory): New method definition.
1136 (Target_arm::new_arm_input_section,
1137 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1138 Target_arm::reloc_uses_thumb_bit): New method declarations.
1139 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1140 New type definitions.
1141 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1142 member declarations.
1143 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1144 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1145 New method definitions.
1147 2009-11-03 Ian Lance Taylor <iant@google.com>
1149 * options.h (class General_options): Add --warn_constructors.
1151 2009-11-03 Ian Lance Taylor <iant@google.com>
1154 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1155 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1157 2009-11-03 Ian Lance Taylor <iant@google.com>
1160 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1161 --msgid-bugs-address.
1162 (install-pdf): New target.
1163 (install-data_yes): Look up one directory to find mkinstalldirs.
1165 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1167 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1170 2009-10-30 Doug Kwan <dougkwan@google.com>
1172 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1174 2009-10-30 Doug Kwan <dougkwan@google.com>
1176 * arm.cc (Stub_addend_reader): New struct template definition
1177 and partial specializations.
1178 (Stub_addend_reader::operator()): New method definition for a
1179 partially specialized template.
1181 2009-10-30 Doug Kwan <dougkwan@google.com>
1183 * arm.cc (Arm_relobj::processor_specific_flags): New method
1185 (Arm_relobj::do_read_symbols): New method declaration.
1186 (Arm_relobj::processor_specific_flags_): New data member declaration.
1187 (Arm_dynobj): New class definition.
1188 (Target_arm::do_finalize_sections): Add input_objects parameter.
1189 (Target_arm::do_adjust_elf_header): New method declaration.
1190 (Target_arm::are_eabi_versions_compatible,
1191 (Target_arm::merge_processor_specific_flags): New method declaration.
1192 (Target_arm::do_make_elf_object): New overloaded method definitions
1194 (Arm_relobj::do_read_symbols): New method definition.
1195 (Arm_dynobj::do_read_symbols): Ditto.
1196 (Target_arm::do_finalize_sections): Add input_objects parameters.
1197 Merge processor-specific flags from all input objects.
1198 (Target_arm::are_eabi_versions_compatible,
1199 Target_arm::merge_processor_specific_flags,
1200 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1201 New method definitions.
1202 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1203 Input_objects pointer type parameter.
1204 * layout.cc (Layout::finalize): Pass input objects to target's.
1205 finalize_sections function.
1206 * output.cc (Output_file_header::do_sized_write): Set ELF file
1207 header's processor-specific flags.
1208 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1209 Input_objects pointer type parameter.
1210 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1211 * target.h (Input_objects): New forward class declaration.
1212 (Target::processor_specific_flags,
1213 Target::are_processor_specific_flags_sect): New method definitions.
1214 (Target::finalize_sections): Add input_objects parameter.
1215 (Target::Target): Initialize processor_specific_flags_ and
1216 are_processor_specific_flags_set_.
1217 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1219 (Target::set_processor_specific_flags): New method definition.
1220 (Target::processor_specific_flags_,
1221 Target::are_processor_specific_flags_set_): New data member
1223 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1224 Input_objects pointer type parameter.
1226 2009-10-30 Doug Kwan <dougkwan@google.com>
1228 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1230 2009-10-28 Ian Lance Taylor <iant@google.com>
1232 * object.h (class Relobj): Drop options parameter from
1233 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1234 do_scan_relocs, do_relocate. Change all callers.
1235 (class Sized_relobj): Drop options parameters from
1236 do_gc_process_relocs, do_scan_relocs, do_relocate,
1237 do_relocate_sections, relocate_sections, emit_relocs_scan,
1238 emit_relocs_scan_reltype. Change all callers.
1239 (struct Relocate_info): Remove options field and all references to
1241 * reloc.h (class Read_relocs): Remove options constructor
1242 parameter and options_ field. Change all callers.
1243 (class Gc_process_relocs, class Scan_relocs): Likewise.
1244 (class Relocate_task): Likewise.
1245 * target-reloc.h (scan_relocs): Remove options parameter. Change
1247 (scan_relocatable_relocs): Likewise.
1248 * target.h (class Sized_target): Remove options parameter from
1249 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1251 * gc.h (gc_process_relocs): Remove options parameter. Change all
1253 * arm.cc: Update functions to remove options parameters.
1254 * i386.cc: Likewise.
1255 * powerpc.cc: Likewise.
1256 * sparc.cc: Likewise.
1257 * x86_64.cc: Likewise.
1258 * testsuite/testfile.cc: Likewise.
1260 2009-10-28 Doug Kwan <dougkwan@google.com>
1262 * arm.cc (Arm_relobj): New class definition.
1263 (Arm_relobj::scan_sections_for_stubs,
1264 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1265 New method definitions.
1267 2009-10-28 Cary Coutant <ccoutant@google.com>
1269 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1270 (Plugin::cleanup_done_): New member.
1271 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1272 (Plugin_manager::cleanup_done_): Remove.
1273 (Plugin_manager::add_input_file): Edit error message.
1274 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1275 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1277 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1279 * fileread.cc: (File_read::View::~View): Use the new
1280 data_ownership_ filed.
1281 (File_read::~File_read): Dispose the new whole_file_view_.
1282 (File_read::open): Mmap the whole file if needed.
1283 (File_read::open): Use whole_file_view_ instead of contents_.
1284 (File_read::find_view): Use whole_file_view_ if applicable.
1285 (File_read::do_read): Use whole_file_view_ instead of contents_.
1286 (File_read::make_view): Use whole_file_view_ instead of contents_,
1287 update File_read::View::View call.
1288 (File_read::find_or_make_view): Update File_read::View::View
1290 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1292 (File_read::View::Data_ownership): New enum.
1293 (File_read::View::View): Replace bool mapped_ with Data_ownership
1295 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1296 (File_read::View::data_ownership_): New field.
1297 (File_read::contents_): Remove (replaced by whole_file_view_).
1298 (File_read::whole_file_view_): New field.
1299 * options.h (class General_options): Add --keep-files-mapped.
1301 2009-10-27 Cary Coutant <ccoutant@google.com>
1303 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1304 * testsuite/Makefile.am (plugin_test_5): New test case.
1305 * testsuite/Makefile.in: Regenerate.
1307 2009-10-25 Doug Kwan <dougkwan@google.com>
1309 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1310 from private to protected to allow access by child class.
1311 (Sized_relobj::do_relocate_sections): New method declaration.
1312 (Sized_relobj::relocate_sections): Virtualize.
1313 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1314 Sized_relobj::relocate_sections. Instantiate template explicitly
1315 for different target sizes and endianity.
1317 2009-10-24 Doug Kwan <dougkwan@google.com>
1319 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1320 (Arm_input_section::as_arm_input_section): New method.
1321 (Arm_output_section): New class definition.
1322 (Arm_output_section::create_stub_group,
1323 Arm_output_section::group_sections): New method definitions.
1325 2009-10-22 Doug Kwan <dougkwan@google.com>
1327 * arm.cc (Arm_input_section): New class definition.
1328 (Arm_input_section::init, Arm_input_section:do_write,
1329 Arm_input_section::set_final_data_size,
1330 Arm_input_section::do_reset_address_and_file_offset): New method
1333 2009-10-21 Doug Kwan <dougkwan@google.com>
1335 * arm.cc (Stub_table, Arm_input_section): New forward class
1337 (Stub_table): New class defintion.
1338 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1339 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1340 New method definition.
1342 2009-10-21 Doug Kwan <dougkwan@google.com>
1344 * arm.cc: Update copyright comments.
1345 (Target_arm): New forward class template declaration.
1346 (Arm_address): New type.
1347 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1348 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1349 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1351 (Insn_template): Same.
1352 (DEF_STUBS): New macro.
1353 (Stub_type): New enum type.
1354 (Stub_template): New class definition.
1357 (Stub_factory): Same.
1358 (Target_arm::Target_arm): Initialize may_use_blx_ and
1359 should_force_pic_veneer_.
1360 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1361 Target_arm::should_force_pic_veneer,
1362 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1363 Target_arm::using_thumb_only, Target_arm:;default_target): New
1365 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1366 New data member declarations.
1367 (Insn_template::size, Insn_template::alignment): New method defintions.
1368 (Stub_template::Stub_template): New method definition.
1369 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1370 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1371 (Stub_factory::Stub_factory): New method definition.
1372 * gold.h (string_hash): New template.
1373 * output.h (Input_section_specifier::hash_value): Use
1375 (Input_section_specifier::string_hash): Remove.
1376 * stringpool.cc (Stringpool_template::string_hash): Use
1379 2009-10-20 Doug Kwan <dougkwan@google.com>
1381 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1382 symbols of relaxed input sections.
1383 * output.h (Output_section::find_relaxed_input_section): Make
1386 2009-10-16 Doug Kwan <dougkwan@google.com>
1388 * dynobj.cc (Versions::Versions): Initialize version_script_.
1389 Only insert base version symbol definition for a shared object
1390 if version script defines any version versions.
1391 (Versions::define_base_version): New method definition.
1392 (Versions::add_def): Check that base version is not needed.
1393 (Versions::add_need): Define base version lazily.
1394 * dynobj.h (Versions::define_base_version): New method declaration.
1395 (Versions::needs_base_version_): New data member declaration.
1396 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1397 (check_DATA): Add no_version_test.stdout.
1398 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1400 * testsuite/Makefile.in: Regenerate.
1401 * testsuite/no_version_test.c: New file.
1402 * testsuite/no_version_test.sh: Ditto.
1404 2009-10-16 Doug Kwan <dougkwan@google.com>
1406 * expression.cc (class Segment_start_expression): New class definition.
1407 (Segment_start_expression::value): New method definition.
1408 (script_exp_function_segment_start): Return a new
1409 Segment_start_expression.
1410 * gold/script-c.h (script_saw_segment_start_expression): New function
1412 * script-sections.cc (Script_sections::Script_sections): Initialize
1413 SAW_SEGMENT_START_EXPRESSION_ to false.
1414 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1415 and -Tbbs options to specify section addresses if given in
1416 command line and no SEGMENT_START expression is seen in a script.
1417 * script-sections.h (Script_sections::saw_segment_start_expression,
1418 Script_sections::set_saw_segment_start_expression): New method
1420 (Script_sections::saw_segment_start_expression_): New data member
1422 * script.cc (script_saw_segment_start_expression): New function.
1423 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1424 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1425 script_test_7.sh and script_test_8.sh.
1426 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1427 script_test_8.stdout.
1428 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1429 (script_test_6, script_test_6.stdout, script_test_7,
1430 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1431 * Makefile.in: Regenerate.
1432 * testsuite/script_test_6.sh: New file.
1433 * testsuite/script_test_6.t: Same.
1434 * testsuite/script_test_7.sh: Same.
1435 * testsuite/script_test_7.t: Same.
1436 * testsuite/script_test_8.sh: Same.
1438 2009-10-16 Doug Kwan <dougkwan@google.com>
1440 * output.cc (Output_segment::set_section_list_address): Cast
1441 expressions to unsigned long long type to avoid format warnings.
1443 2009-10-15 Ian Lance Taylor <iant@google.com>
1445 * script.cc (Script_options::add_symbol_assignment): Always add a
1446 dot assignment to script_sections_.
1447 * script-sections.cc (Script_sections::add_dot_assignment):
1448 Initialize if necessary.
1450 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1451 program headers with no load segment if there is a linker script.
1453 * layout.cc (Layout::set_segment_offsets): Align the file offset
1454 to the segment aligment for -N or -n with no load segment.
1455 * output.cc (Output_segment::add_output_section): Don't crash if
1456 the first section is a TLS section.
1457 (Output_segment::set_section_list_addresses): Print an error
1458 message if the address moves backward in a linker script.
1459 * script-sections.cc
1460 (Output_section_element_input::set_section_addresses): Don't
1461 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1462 (Orphan_output_section::set_section_addresses): Likewise.
1464 2009-10-15 Doug Kwan <dougkwan@google.com>
1466 * layout.cc (Layout::finish_dynamic_section): Generate tags
1467 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1468 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1469 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1471 2009-10-14 Ian Lance Taylor <iant@google.com>
1473 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1475 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1476 data_shdr fields of relinfo.
1477 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1478 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
1479 R_386_TLS_LDO_32, adjust based on section flags.
1480 (Target_i386::Relocate::fix_up_ldo): Remove.
1482 2009-10-13 Ian Lance Taylor <iant@google.com>
1484 Add support for -pie.
1485 * options.h (class General_options): Add -pie and
1487 (General_options::output_is_position_independent): Test -pie.
1488 (General_options::output_is_executable): Return true if not shared
1489 and not relocatable.
1490 (General_options::output_is_pie): Remove.
1491 * options.cc (General_options::finalize): Reject incompatible uses
1493 * gold.cc (queue_middle_tasks): A -pie link is not static.
1494 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1495 * symtab.cc (Symbol::final_value_is_known): Return false if
1496 output_is_position_independent.
1497 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1498 output_is_position_independent.
1499 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1500 output_is_position_independent.
1501 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1502 output_is_position_independent.
1503 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1505 (basic_pie_test.o, basic_pie_test): New targets.
1506 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1507 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1508 (two_file_pie_test): New target.
1509 * testsuite/Makefile.in: Rebuild.
1510 * README: Remove note saying that -pie is not supported.
1512 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
1514 * options.h (class General_options): Add -init and -fini.
1515 * layout.cc (Layout::finish_dynamic_section): Emit
1516 given init and fini functions.
1518 2009-10-13 Sriraman Tallam <tmsriram@google.com>
1520 * gc.h (gc_process_relocs): Check if icf is enabled using new
1522 * gold.cc (queue_initial_tasks): Likewise.
1523 (queue_middle_tasks): Likewise.
1524 * object.cc (do_layout): Likewise.
1525 * symtab.cc (is_section_folded): Likewise.
1526 * main.cc (main): Likewise.
1527 * reloc.cc (Read_relocs::run): Likewise.
1528 (Sized_relobj::do_scan_relocs): Likewise.
1529 * icf.cc (is_function_ctor_or_dtor): New function.
1530 (Icf::find_identical_sections): Check if function is ctor or dtor when
1532 * options.h (General_options::icf): Change option to be an enum.
1533 (Icf_status): New enum.
1534 (icf_enabled): New method.
1535 (icf_safe_folding): New method.
1536 (set_icf_status): New method.
1537 (icf_status_): New variable.
1538 * (options.cc) (General_options::finalize): Set icf_status_.
1539 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
1540 icf_test and icf_keep_unique_test to use the --icf enum flag.
1541 * testsuite/icf_safe_test.sh: New file.
1542 * testsuite/icf_safe_test.cc: New file.
1544 2009-10-12 Sriraman Tallam <tmsriram@google.com>
1546 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
1547 includes to gc.h and icf.h.
1548 * arm.cc: Include gc.h.
1549 * gold.cc: Likewise.
1550 * i386.cc: Likewise.
1551 * powerpc.cc: Likewise.
1552 * sparc.cc: Likewise.
1553 * x86_64.cc: Likewise.
1554 * gc.h: Include icf.h.
1556 2009-10-11 Ian Lance Taylor <iant@google.com>
1558 * plugin.cc: Include "gold.h" before other header files.
1560 2009-10-10 Chris Demetriou <cgd@google.com>
1562 * options.h (Input_file_argument::Input_file_type): New enum.
1563 (Input_file_argument::is_lib_): Replace with...
1564 (Input_file_argument::type_): New member.
1565 (Input_file_argument::Input_file_argument): Take Input_file_type
1566 'type' rather than boolean 'is_lib' as second argument.
1567 (Input_file_argument::is_lib): Use type_.
1568 (Input_file_argument::is_searched_file): New function.
1569 (Input_file_argument::may_need_search): Handle is_searched_file.
1570 * options.cc (General_options::parse_library): Support -l:filename.
1571 (General_options::parse_just_symbols): Update for Input_file_argument
1573 (Command_line::process): Likewise.
1574 * archive.cc (Archive::get_file_and_offset): Likewise.
1575 * plugin.cc (Plugin_manager::release_input_file): Likewise.
1576 * script.cc (read_script_file, script_add_file): Likewise.
1577 * fileread.cc (Input_file::Input_file): Likewise.
1578 (Input_file::will_search_for): Handle is_searched_file.
1579 (Input_file::open): Likewise.
1580 * readsyms.cc (Read_symbols::get_name): Likewise.
1581 * testsuite/Makefile.am (searched_file_test): New test.
1582 * testsuite/Makefile.in: Regenerate.
1583 * testsuite/searched_file_test.cc: New file.
1584 * testsuite/searched_file_test_lib.cc: New file.
1586 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1587 Ian Lance Taylor <iant@google.com>
1589 * descriptor.cc: Include <cstdio> and "binary-io.h".
1590 (Descriptors::open): Open the files in binary mode always.
1591 * script.cc (Lex::get_token): Treat \r as whitespace.
1593 2009-10-09 Ian Lance Taylor <iant@google.com>
1595 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1597 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1598 Ian Lance Taylor <iant@google.com>
1600 * configure.ac: Check for readv function also.
1601 * fileread.cc (readv): Define if not HAVE_READV.
1602 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1604 * config.in: Regenerate.
1605 * configure: Regenerate.
1607 2009-10-09 Doug Kwan <dougkwan@google.com>
1609 * layout.cc (Layout::make_output_section): Call target hook to make
1610 ordinary output section.
1611 (Layout::finalize): Adjust parameter list of call the
1612 Target::may_relax().
1613 * layout.h (class Layout::section_list): New method.
1614 * merge.h (Output_merge_base::entsize): Change visibility to public.
1615 (Output_merge_base::is_string, Output_merge_base::do_is_string):
1617 (Output_merge_string::do_is_string): New method.
1618 * object.cc (Sized_relobj::do_setup): renamed from
1619 Sized_relobj::set_up.
1620 * object.h (Sized_relobj::adjust_shndx,
1621 Sized_relobj::initializ_input_to_output_maps,
1622 Sized_relobj::free_input_to_output_maps): Change visibilities to
1624 (Sized_relobj::setup): Virtualize.
1625 (Sized_relobj::do_setup): New method declaration.
1626 (Sized_relobj::invalidate_section_offset,
1627 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
1628 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
1629 * options.cc (parse_int): New function.
1630 * options.h (parse_int): New declaration.
1631 (DEFINE_int): New macro.
1632 (stub_group_size): New option.
1633 * output.cc (Output_section::Output_section): Initialize memebers
1634 merge_section_map_, merge_section_by_properties_map_,
1635 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
1636 (Output_section::add_input_section): Handled deferred code-fill
1637 generation and remove an old comment.
1638 (Output_section::add_relaxed_input_section): New method definition.
1639 (Output_section::add_merge_input_section): Use merge section by
1640 properties map to speed to search. Update merge section maps
1642 (Output_section::build_relaxation_map): New method definition.
1643 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1645 (Output_section::relax_input_section): Renamed to
1646 Output_section::convert_input_sections_to_relaxed_sections and change
1647 interface to take a vector of pointers to relaxed sections.
1648 (Output_section::find_merge_section,
1649 Output_section::find_relaxed_input_section): New method definitions.
1650 (Output_section::is_input_address_mapped,
1651 Output_section::output_offset, Output_section::output_address):
1652 Use output section data maps to speed up searching.
1653 (Output_section::find_starting_output_address): Add comments.
1654 (Output_section::do_write,
1655 Output_section::write_to_postprocessing_buffer): Do code-fill
1656 generation as appropriate.
1657 (Output_section::get_input_sections): Invalidate relaxed input section
1659 (Output_section::restore_states): Adjust type of checkpoint .
1660 Invalidate relaxed input section map.
1661 * output.h (Output_merge_base): New class declaration.
1662 (Input_section_specifier): New class defintion.
1663 (class Output_relaxed_input_section) Change base class to
1664 Output_section_data_build.
1665 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1666 base class initializer.
1667 (Output_section::add_relaxed_input_section): New method declaration.
1668 (Output_section::Input_section): Change visibility to protected.
1669 (Output_section::Input_section::relobj,
1670 Output_section::Input_section::shndx): Handle relaxed input sections.
1671 Output_section::input_sections) Change visibility to protected. Also
1672 define overload to return a non-const pointer.
1673 (Output_section::Merge_section_properties): New class defintion.
1674 (Output_section::Merge_section_by_properties_map,
1675 Output_section::Output_section_data_by_input_section_map,
1676 Output_section::Relaxation_map): New types.
1677 (Output_section::relax_input_section): Rename method to
1678 Output_section::convert_input_sections_to_relaxed_sections and change
1679 interface to take a vector of relaxed section pointers.
1680 (Output_section::find_merge_section,
1681 Output_section::find_relaxed_input_section,
1682 Output_section::build_relaxation_map,
1683 Output_section::convert_input_sections_in_list_to_relaxed_sections):
1684 New method declarations.
1685 (Output_section::merge_section_map_
1686 Output_section::merge_section_by_properties_map_,
1687 Output_section::relaxed_input_section_map_,
1688 Output_section::is_relaxed_input_section_map_valid_,
1689 Output_section::generate_code_fills_at_write_): New data members.
1690 * script-sections.cc
1691 (Output_section_element_input::set_section_addresses): Call
1692 current_data_size and addralign methods of relaxed input sections.
1693 (Orphan_output_section::set_section_addresses): Call current_data_size
1694 and addralign methods of relaxed input sections.
1695 * symtab.cc (Symbol_table::compute_final_value): Extract template
1696 from the body of Symbol_table::sized_finalize_symbol.
1697 (Symbol_table::sized_finalized_symbol): Call
1698 Symbol_table::compute_final_value.
1699 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1700 (Symbol_table::compute_final_value): New templated method declaration.
1701 * target.cc (Target::do_make_output_section): New method defintion.
1702 * target.h (Target::make_output_section): New method declaration.
1703 (Target::relax): Add more parameters for input objects, symbol table
1704 and layout. Adjust call to do_relax.
1705 (Target::do_make_output_section): New method declaration.
1706 (Target::do_relax): Add parameters for input objects, symbol table
1709 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1711 * pread.c: Include stdio.h.
1713 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1715 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1718 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1720 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1721 Change read_shndx type to unsigned int.
1722 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1724 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1725 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1726 Change read_shndx type to unsigned int.
1727 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1729 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1730 * layout.cc (Layout::create_symtab_sections): Cast the result of
1731 local_symcount * symsize to off_t in the gold_assert.
1733 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1735 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1736 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1738 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1739 (Arm_relocate_functions::thm_abs5): New function.
1740 (Arm_relocate_functions::abs12): New function.
1741 (Arm_relocate_functions::abs16): New function.
1742 (Arm_relocate_functions::base_abs): New function.
1743 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1744 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1745 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1747 (Scan::global): Likewise.
1748 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1749 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1750 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1751 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1754 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1756 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1757 (Arm_relocate_functions::movt_prel): New function.
1758 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1759 (Arm_relocate_functions::thm_movt_prel): New function.
1760 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1761 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1762 (Scan::global, Relocate::relocate): Likewise.
1763 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1765 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1767 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1768 Incremental_checker.
1769 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1771 (class Incremental_inputs_header): New class.
1772 (Incremental_inputs_header_writer): Edit comment.
1773 (Incremental_inputs_entry): New class.
1774 (Incremental_inputs_entry_writer): Edit comment.
1775 (Sized_incremental_binary::do_find_incremental_inputs_section):
1776 Add *strtab_shndx parameter, fill it.
1777 (Sized_incremental_binary::do_check_inputs): New method.
1778 (Incremental_checker::can_incrementally_link_output_file): Use
1779 Sized_incremental_binary::check_inputs.
1780 (Incremental_inputs::report_command_line): Save command line in
1783 (Incremental_binary::find_incremental_inputs_section): New
1785 (Incremental_binary::do_find_incremental_inputs_section): Add
1786 strtab_shndx parameter.
1787 (Incremental_binary::do_check_inputs): New pure virtual method.
1788 (Sized_incremental_binary::do_check_inputs): Declare.
1789 (Incremental_checker::Incremental_checker): Add incremental_inputs
1790 parameter, use it to initialize incremental_inputs_.
1791 (Incremental_checker::incremental_inputs_): New field.
1792 (Incremental_checker::command_line): New method.
1793 (Incremental_checker::inputs): New method.
1794 (Incremental_checker::command_line_): New field.
1796 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1798 * incremental.cc: Include <cstdarg> and "target-select.h".
1799 (vexplain_no_incremental): New function.
1800 (explain_no_incremental): New function.
1801 (Incremental_binary::error): New method.
1802 (Sized_incremental_binary::do_find_incremental_inputs_section): New
1804 (make_sized_incremental_binary): New function.
1805 (open_incremental_binary): New function.
1806 (can_incrementally_link_file): Add checks if output is ELF and has
1808 * incremental.h: Include "elfcpp_file.h" and "output.h".
1809 (Incremental_binary): New class.
1810 (Sized_incremental_binary): New class.
1811 (open_incremental_binary): Declare.
1812 * object.cc (is_elf_object): Use
1813 elfcpp::Elf_recognizer::is_elf_file.
1814 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
1815 * output.h (Output_file::filesize): New method.
1817 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1819 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
1821 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
1822 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
1824 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
1826 (Arm_relocate_functions::movw_abs_nc): New function.
1827 (Arm_relocate_functions::movt_abs): New function.
1828 (Arm_relocate_functions::thm_movw_abs_nc): New function.
1829 (Arm_relocate_functions::thm_movt_abs): New function.
1830 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
1831 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
1832 (Scan::global): Likewise.
1833 (Relocate::relocate): Likewise.
1834 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1836 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1838 * arm.cc (Arm_relocate_functions::got_prel) New function.
1839 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
1840 (Relocate::relocate): Likewise.
1841 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1843 2009-10-06 Ian Lance Taylor <iant@google.com>
1845 * options.h (class General_options): Define
1846 split_stack_adjust_size parameter.
1847 * object.h (class Object): Add uses_split_stack_ and
1848 has_no_split_stack_ fields. Add uses_split_stack and
1849 has_no_split_stack accessor functions. Declare
1850 handle_split_stack_section.
1851 (class Reloc_symbol_changes): Define.
1852 (class Sized_relobj): Define Function_offsets. Declare
1853 split_stack_adjust, split_stack_adjust_reltype, and
1855 * object.cc (Object::handle_split_stack_section): New function.
1856 (Sized_relobj::do_layout): Call handle_split_stack_section.
1857 * dynobj.cc (Sized_dynobj::do_layout): Call
1858 handle_split_stack_section.
1859 * reloc.cc (Sized_relobj::relocate_sections): Call
1860 split_stack_adjust for executable sections in split_stack
1861 objects. Pass reloc_map to relocate_section.
1862 (Sized_relobj::split_stack_adjust): New function.
1863 (Sized_relobj::split_stack_adjust_reltype): New function.
1864 (Sized_relobj::find_functions): New function.
1865 * target-reloc.h: Include "object.h".
1866 (relocate_section): Add reloc_symbol_changes parameter. Change
1868 * target.h (class Target): Add calls_non_split method. Declare
1869 do_calls_non_split virtual method. Declare match_view and
1871 * target.cc: Include "elfcpp.h".
1872 (Target::do_calls_non_split): New function.
1873 (Target::match_view): New function.
1874 (Target::set_view_to_nop): New function.
1875 * gold.cc (queue_middle_tasks): Give an error if mixing
1876 split-stack and non-split-stack objects with -r.
1877 * i386.cc (Target_i386::relocate_section): Add
1878 reloc_symbol_changes parameter.
1879 (Target_i386::do_calls_non_split): New function.
1880 * x86_64.cc (Target_x86_64::relocate_section): Add
1881 reloc_symbol_changes parameter.
1882 (Target_x86_64::do_calls_non_split): New function.
1883 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
1885 * powerpc.cc (Target_powerpc::relocate_section): Add
1886 reloc_symbol_changes parameter.
1887 * sparc.cc (Target_sparc::relocate_section): Add
1888 reloc_symbol_changes parameter.
1889 * configure.ac: Call AM_CONDITIONAL for the default target.
1890 * configure: Rebuild.
1891 * testsuite/Makefile.am (TEST_AS): New variable.
1892 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
1893 (check_DATA): Add split_i386 and split_x86_64 files.
1894 (SPLIT_DEFSYMS): Define.
1895 (split_i386_[1234n].o): New targets.
1896 (split_i386_[124]): New targets.
1897 (split_i386_[1234r].stdout): New targets.
1898 (split_x86_64_[1234n].o): New targets.
1899 (split_x86_64_[124]): New targets.
1900 (split_x86_64_[1234r].stdout): New targets.
1901 (MOSTLYCLEANFILES): Add new executables.
1902 * testsuite/split_i386.sh: New file.
1903 * testsuite/split_x86_64.sh: New file.
1904 * testsuite/split_i386_1.s: New file.
1905 * testsuite/split_i386_2.s: New file.
1906 * testsuite/split_i386_3.s: New file.
1907 * testsuite/split_i386_4.s: New file.
1908 * testsuite/split_i386_n.s: New file.
1909 * testsuite/split_x86_64_1.s: New file.
1910 * testsuite/split_x86_64_2.s: New file.
1911 * testsuite/split_x86_64_3.s: New file.
1912 * testsuite/split_x86_64_4.s: New file.
1913 * testsuite/split_x86_64_n.s: New file.
1914 * testsuite/testfile.cc (Target_test): Update relocation_section
1916 * testsuite/Makefile.in: Rebuild.
1918 2009-10-06 Ian Lance Taylor <iant@google.com>
1920 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
1921 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
1922 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
1923 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
1924 the address on ldo_addrs_.
1925 (Target_i386::Relocate::fix_up_ldo): New function.
1927 2009-10-06 Rafael Espindola <espindola@google.com>
1929 * plugin.cc (add_input_library): New.
1930 (Plugin::load): Add add_input_library to tv.
1931 (Plugin_manager::add_input_file): Add the is_lib argument.
1932 (add_input_file): Update call to Plugin_manager::add_input_file.
1933 (add_input_library): New.
1934 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
1936 2009-09-30 Doug Kwan <dougkwan@google.com>
1938 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
1939 symbol and call Symbol::may_need_copy_reloc to determine if
1940 a copy reloc is needed.
1941 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
1942 nocopyreloc is given in command line.
1943 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
1944 given in command line.
1945 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
1946 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
1947 of the removed Target_i386::may_need_copy_reloc.
1948 * options.h (copyreloc): New option with default value false.
1949 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1950 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
1951 instead of the removed Target_powerpc::may_need_copy_reloc.
1952 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1953 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
1954 instead of the removed Target_sparc::may_need_copy_reloc.
1955 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
1956 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
1957 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
1958 instead of the removed Target_x86_64::may_need_copy_reloc.
1960 2009-09-30 Ian Lance Taylor <iant@google.com>
1962 * object.h (class Object): Remove target_ field, and target,
1963 sized_target, and set_target methods.
1964 (Object::sized_target): Remove.
1965 (class Sized_relobj): Update declarations. Remove sized_target.
1966 * object.cc (Sized_relobj::setup): Remove target parameter.
1968 (Input_objects::add_object): Don't do anything with the target.
1969 (make_elf_sized_object): Add punconfigured parameter. Change all
1970 callers. Set or test parameter target.
1971 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
1973 * parameters.cc (Parameters::set_target): Change parameter type to
1975 (Parameters::default_target): Remove.
1976 (set_parameters_target): Change parameter type to be non-const.
1977 (parameters_force_valid_target): New function.
1978 (parameters_clear_target): New function.
1979 * parameters.h (class Parameters): Update declarations. Remove
1980 default_target method. Add sized_target and clear_target
1981 methods. Change target_ to be non-const.
1982 (set_parameters_target): Update declaration.
1983 (parameters_force_valid_target): Declare.
1984 (parameters_clear_target): Declare.
1985 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
1986 as NULL if we aren't searching.
1987 (Add_symbols::run): Don't check for compatible target.
1988 * fileread.cc (Input_file::open_binary): Call
1989 parameters_force_valid_target.
1990 * gold.cc (queue_middle_tasks): Likewise.
1991 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
1992 set_target on object.
1993 * dynobj.h (class Sized_dynobj): Update declarations.
1994 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
1995 make_elf_object returns NULL.
1996 (Archive::include_member): Don't check whether object target is
1998 * output.cc (Output_section::add_input_section): Get target from
2000 (Output_section::relax_input_section): Likewise.
2001 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2003 (Sized_relobj::do_scan_relocs): Likewise.
2004 (Sized_relobj::relocate_sections): Likewise.
2005 * resolve.cc (Symbol_table::resolve): Likewise.
2006 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2007 parameter. Change all callers.
2008 (Symbol_table::add_from_object): Get target from parameters.
2009 (Symbol_table::add_from_relobj): Don't check object target.
2010 (Symbol_table::add_from_dynobj): Likewise.
2011 (Symbol_table::define_special_symbol): Get target from
2013 * symtab.h (class Symbol_table): Update declaration.
2014 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2015 parameter. Change all callers. Clear parameter target.
2016 (Binary_test): Test target here.
2017 * testsuite/object_unittest.cc (gold_testsuite): Remove
2018 target_test_pointer parameter. Change all callers.
2019 (Object_test): Test target here.
2021 2009-09-26 Ian Lance Taylor <iant@google.com>
2023 * testsuite/initpri1.c: Don't try to use constructor priorities if
2024 compiling with gcc before 4.3.
2026 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2028 * testsuite/retain_symbols_file_test.sh (check_present): Change
2029 output file name to retain_symbols_file_test.stdout.
2030 (check_absent): Likewise.
2032 2009-09-18 Craig Silverstein <csilvers@google.com>
2034 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2035 * options.cc: Include <cerrno> and <fstream>.
2036 (General_options::finalize): Parse -retain-symbols-file tag.
2037 * options.h: New flag.
2038 (General_options): New method should_retain_symbol, new
2039 variable symbols_to_retain.
2040 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2041 should_retain_symbol map.
2042 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2043 * testsuite/Makefile.in: Regenerate.
2044 * testsuite/retain_symbols_file_test.sh: New file.
2046 2009-09-18 Nick Clifton <nickc@redhat.com>
2048 * po/es.po: Updated Spanish translation.
2050 2009-09-17 Doug Kwan <dougkwan@google.com>
2052 * debug.h (DEBUG_RELAXATION): New constant.
2053 (DEBUG_ALL): Add DEBUG_RELAXATION.
2054 (debug_string_to_enum): Add relaxation debug option.
2056 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2057 Layout::Relaxation_debug_check::read_sections,
2058 Layout::Relaxation_debug_check::read_sections): New method definitions.
2059 (Layout::Layout): Initialize data members
2060 record_output_section_data_from_scrips_,
2061 script_output_section_data_list_ and relaxation_debug_check_.
2062 (Layout::save_segments, Layout::restore_segments,
2063 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2064 Layout::relaxation_loop_body): New method definitions.
2065 (Layout::finalize): Support relaxation. Move section layout code to
2066 Layout::relaxation_loop_body.
2067 (Layout::set_asection_address_from_script): Move code for orphan
2068 section placement out.
2069 (Layout::place_orphan_sections_in_script): New method definition.
2070 * layout.h (Output_segment_headers, Output_file_header):
2071 New forward class declarations.
2072 (Layout::~Layout): Define.
2073 (Layout::new_output_section_data_from_script): New method definition.
2074 (Layout::place_orphan_sections_in_script): New method declaration.
2075 (Layout::Segment_states): New type declaration.
2076 (Layout::save_segments, Layout::restore_segments,
2077 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2078 Layout::relaxation_loop_body): New method declarations.
2079 (Layout::Output_section_data_list): New type declaration.
2080 (Layout::Relaxation_debug_check): New class definition.
2081 (Layout::record_output_section_data_from_script_,
2082 Layout::script_output_section_data_list_, Layout::segment_states_,
2083 Layout::relaxation_debug_check_): New data members.
2084 * output.cc: (Output_section_headers::do_size): New method definition.
2085 (Output_section_headers::Output_section_headers): Move size
2086 computation to Output_section_headers::do_size.
2087 (Output_segment_headers::do_size): New method definition.
2088 (Output_file_header::Output_file_header): Move size computation to
2089 Output_file_header::do_size and call it.
2090 (Output_file_header::do_size): New method definition.
2091 (Output_data_group::Output_data_group): Adjust call to
2092 Output_section_data.
2093 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2094 (Output_symtab_xindex::do_write): Add array bound check.
2095 (Output_section::Input_section::print_to_mapfile): Handle
2096 RELAXED_INPUT_SECTION_CODE.
2097 (Output_section::Output_section): Initialize data member checkpoint_.
2098 (Output_section::~Output_section): Delete checkpoint object pointed
2100 (Output_section::add_input_section): Always add an Input_section if
2102 (Output_section::add_merge_input_section): Add assert.
2103 (Output_section::relax_input_section): New method definition.
2104 (Output_section::set_final_data_size): Set load address to zero for
2105 an unallocated section.
2106 (Output_section::do_address_and_file_offset_have_reset_values):
2107 New method definition.
2108 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2109 Handle relaxed input section.
2110 (Output_section::sort_attached_input_sections): Checkpoint input
2111 section list lazily.
2112 (Output_section::get_input_sections): Change type of input_sections to
2113 list of Simple_input_section pointers. Checkpoint input section list
2114 lazily. Also handle relaxed input sections.
2115 (Output_section::add_input_section_for_script): Take a reference to
2116 a Simple_input_section object instead of Relobj pointer and section
2117 index as parameter. Handle relaxed input sections.
2118 (Output_section::save_states, Output_section::restore_states): New
2120 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2121 (Output_data::is_data_size_fixed): New method definition.
2122 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2124 (Output_data::address_and_file_offset_have_reset_values): New method
2126 (Output_data::do_address_and_file_offset_have_reset_values): New method
2128 (Output_data::set_data_size): Check that data size is not fixed.
2129 (Output_data::fix_data_size): New method definition.
2130 (Output_data::is_data_size_fixed_): New data member.
2131 (Output_section_headers::set_final_data_size): New method definition.
2132 (Output_section_headers::do_size): New method declaration.
2133 (Output_segment_headers::set_final_data_size): New method definition.
2134 (Output_segment_headers::do_size): New method declaration.
2135 (Output_file_header::set_final_data_size)::New method definition.
2136 (Output_file_header::do_size)::New method declaration.
2137 (Output_section_data::Output_section_data): Add new parameter
2138 is_data_size_fixed and use it to fix data size.
2139 (Output_data_const::Output_data_const): Adjust call to base class
2140 constructor and fix data size.
2141 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2142 base class constructor and fix data size.
2143 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2144 base class constructor and fix data size.
2145 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2146 class constructor and fix data size.
2147 (Output_data_group::set_final_data_size): New method definition.
2148 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2149 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2150 class constructor and fix data size.
2151 (Output_relaxed_input_section): New class definition.
2152 (Output_section::Simple_input_section): New class definition.
2153 (Output_section::get_input_sections): Adjust parameter list.
2154 (Output_section::add_input_section_for_script): Same.
2155 (Output_section::save_states, Output_section::restore_states,
2156 Output_section::do_address_and_file_offset_have_reset_values,
2157 (Output_section::Input_section::Input_section): Handle
2158 RELAXED_INPUT_SECTION_CODE. Add new overload for
2159 Output_relaxed_input_section.
2160 (Output_section::Input_section::is_input_section,
2161 Output_section::Input_section::set_output_section): Handle relaxed
2163 (Output_section::Input_section::is_relaxed_input_section,
2164 Output_section::Input_section::output_section_data,
2165 Output_section::Input_section::relaxed_input_section): New method
2167 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2169 (Output_section::Input_section::u1_): Update comments.
2170 (Output_section::Input_section::u2_): Add new union member poris.
2171 (Output_section::Checkpoint_output_section): New classs definition.
2172 (Output_section::relax_input_section): New method declaration.
2173 (Output_section::checkpoint_): New data member.
2174 (Output_segment): Update comments.
2175 (Output_segment::Output_segment): Un-privatize copy constructor.
2176 (Output_segment::operator=): Un-privatize.
2177 * script-sections.cc (Output_section_element::Input_section_list):
2178 Change element type to Output_section::Simple_input_section.
2179 (Output_section_element_dot_assignment::set_section_addresses):
2180 Register output section data for relaxation clean up.
2181 (Output_data_exression::Output_data_expression): Adjust call to base
2182 constructor to fix data size.
2183 (Output_section_element_data::set_section_addresses): Register
2184 Output_data_expression object for relaxation clean up.
2185 (struct Input_section_info): Replace Relobj pointer and section index
2186 pair with Output_section::Simple_input_section and Convert struct to a
2188 (Input_section_sorter::operator()): Adjust access to
2189 Input_section_info data member to use accessors.
2190 (Output_section_element_input::set_section_addresses): Use layout
2191 parameter. Adjust code to use Output_section::Simple_input_section
2192 and Input_secction_info classes. Register filler for relaxation
2194 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2195 and section index pair with Output_section::Simple_input_section
2196 class. Adjust code accordingly.
2197 (Phdrs_element::release_segment): New method definition.
2198 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2200 (Script_sections::release_segments): New method definition.
2201 * gold/script-sections.h (Script_sections::release_segments): New
2203 * gold/target.h (Target::may_relax, Target::relax,
2204 Target::do_may_relax, Target::do_relax): New method definitions.
2206 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2208 * arm.cc (has_signed_unsigned_overflow): New function.
2209 (Arm_relocate_functions::abs8): New function.
2210 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2211 (Target_arm::Scan::global): Likewise.
2212 (Target_arm::relocate::relocate): Likewise.
2213 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2216 2009-09-16 Cary Coutant <ccoutant@google.com>
2218 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2219 * testsuite/Makefile.in: Regenerate.
2221 2009-09-11 Nick Clifton <nickc@redhat.com>
2223 * po/gold.pot: Updated by the Translation project.
2225 2009-09-08 Cary Coutant <ccoutant@google.com>
2227 * output.cc (Output_file::open): Add execute permission to empty file.
2228 * testsuite/Makefile.am (permission_test): New test.
2229 * testsuite/Makefile.in: Regenerate.
2231 2009-09-02 Ian Lance Taylor <iant@google.com>
2233 * output.cc (Output_file::resize): Call map_no_anonymous rather
2236 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2238 * gold.cc: Include "incremental.h".
2239 (queue_initial_tasks): Call Incremental_checker methods.
2240 * incremental.cc: Include "output.h".
2241 (Incremental_checker::can_incrementally_link_output_file): New
2243 * incremental.h (Incremental_checker): New class.
2245 * output.cc (Output_file::open_for_modification): New method.
2246 (Output_file::map_anonymous): Changed return type to bool. Record
2248 (Output_file::map_no_anonymous): New method, broken out of map.
2249 (Output_file::map): Use map_no_anonymous and map_anonymous.
2250 * output.h (class Output_file): Update declarations.
2252 2009-08-24 Cary Coutant <ccoutant@google.com>
2254 * options.h (Command_line::Pre_options): New class.
2255 (Command_line::pre_options): New member.
2256 * options.cc (gold::options::ready_to_register): New variable.
2257 (One_option::register_option): Do nothing if not registering options.
2258 Assert if same short option registered twice.
2259 (General_options::General_options): Turn off option registration when
2261 (Command_line::Pre_options::Pre_options): New constructor.
2263 2009-08-24 Cary Coutant <ccoutant@google.com>
2265 * options.h (General_options::no_keep_memory): Remove incorrect
2268 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2270 * Makefile.am (am__skiplex, am__skipyacc): New.
2271 * Makefile.in: Regenerate.
2273 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2275 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2276 (INCLUDES): ... this.
2277 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2278 (AM_CPPFLAGS): Renamed from ...
2279 (INCLUDE): ... this.
2280 * Makefile.in, testsuite/Makefile.in: Regenerate.
2282 * Makefile.in: Regenerate.
2283 * aclocal.m4: Likewise.
2284 * config.in: Likewise.
2285 * configure: Likewise.
2286 * testsuite/Makefile.in: Likewise.
2288 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2289 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2290 * Makefile.in: Regenerate.
2291 * testsuite/Makefile.in: Regenerate.
2293 2009-08-19 Cary Coutant <ccoutant@google.com>
2295 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2296 symbols in shared libraries overridden by hidden or internal symbols
2297 in the main program.
2299 2009-08-19 Chris Demetriou <cgd@google.com>
2301 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2302 checking source file names in error messages.
2304 2009-08-18 Doug Kwan <dougkwan@google.com>
2306 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2307 an elcpp::Ehdr as parameter. Adjust call to set_target.
2308 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2309 an elfcpp::Ehdr as parameter.
2310 * object.cc (Object::set_target): Remove the version that looks up
2311 a target and sets it.
2312 (Sized_relobj::setup): Take a Target object instead of
2313 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2314 (make_elf_sized_object): Find target and ask target to
2316 * object.h: (Object::set_target): Remove the version that looks up
2317 a target and sets it.
2318 (Sized_relobj::setup): Take a Target object instead of
2319 an elfcpp:Ehdr as parameter.
2320 * target.cc: Include dynobj.h.
2321 (Target::do_make_elf_object_implementation): New.
2322 (Target::do_make_elf_object): New.
2323 * target.h (Target::make_elf_object): New template declaration.
2324 (Target::do_make_elf_object): New method declarations.
2325 (Target::do_make_elf_object_implementation): New template declaration.
2327 2009-08-14 Ian Lance Taylor <iant@google.com>
2329 * gold.h (FUNCTION_NAME): Define.
2330 (gold_unreachable): Use FUNCTION_NAME.
2332 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2334 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2335 symbol in the --keep-unique list is not found.
2337 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2339 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2340 been maked as --keep-unique.
2341 (Icf::unfold_section): New function.
2342 * icf.h (Icf::unfold_section): New function.
2343 * options.h (General_options::keep_unique): New option.
2344 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2345 * testsuite/Makefile.in: Regenerate.
2346 * testsuite/icf_keep_unique_test.sh: New file.
2347 * testsuite/icf_keep_unique_test.cc: New file.
2349 2009-08-12 Cary Coutant <ccoutant@google.com>
2352 * resolve.cc (Symbol_table::resolve): Check for references from
2353 dynamic objects to hidden and internal symbols.
2354 * testsuite/Makefile.am (hidden_test.sh): New test.
2355 * testsuite/Makefile.in: Regenerate.
2356 * testsuite/hidden_test.sh: New script.
2357 * testsuite/hidden_test_1.c: New test source.
2358 * testsuite/hidden_test_main.c: New test source.
2360 2009-08-11 Doug Kwan <dougkwan@google.com>
2362 * arm.cc: Update comments.
2363 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2364 segment to locate the .ARM.exidx section if present.
2366 2009-08-09 Doug Kwan <dougkwan@google.com>
2368 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2371 2009-08-07 Sriraman Tallam <tmsriram@google.com>
2372 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2375 2009-08-06 Sriraman Tallam <tmsriram@google.com>
2377 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2378 valid tls_segment only for non-debug-section relocations.
2379 * testsuite/Makefile.am: Add gc_tls_test.
2380 * testsuite/Makefile.in: Regenerate.
2381 * testsuite/gc_tls_test.cc: New file.
2382 * testsuite/gc_tls_test.sh: New file.
2384 2009-08-05 Sriraman Tallam <tmsriram@google.com>
2388 * Makefile.am (CCFILES): Add icf.cc.
2390 * Makefile.in: Regenerate.
2391 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2392 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2393 section, symbol and addend information for the relocs.
2394 * gold.cc (queue_middle_tasks): Call identical code folding.
2395 * gold.h: Add defines for multimap.
2396 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2397 to the call of finalize_local_symbols.
2398 * main.cc (main): Create object of class Icf.
2399 * object.cc (Sized_relobj::do_layout): Allow this function to be
2400 called twice during icf.
2401 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2402 to sections marked as identical by icf.
2403 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2405 (Sized_relobj::do_section_entsize): New function.
2406 * object.h (Object::section_entsize): New function.
2407 (Object::do_section_entsize): New pure virtual function.
2408 (Relobj::finalize_local_symbols): Add new parameter.
2409 (Relobj::do_section_entsize): New function.
2410 * options.h (General_options::icf): New option.
2411 (General_options::icf_iterations): New option.
2412 (General_options::print_icf_sections): New option.
2413 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2414 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2415 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2417 * symtab.cc (Symbol_table::is_section_folded): New function.
2418 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2419 to sections marked as identical by icf.
2420 * symtab.h (Symbol_table::set_icf): New function.
2421 (Symbol_table::icf): New function.
2422 (Symbol_table::is_section_folded): New function.
2423 (Symbol_table::icf_): New data member.
2424 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2425 * testsuite/Makefile.am: Add commands to build icf_test.
2426 * testsuite/Makefile.in: Regenerate.
2427 * testsuite/icf_test.sh: New file.
2428 * testsuite/icf_test.cc: New file.
2430 2009-07-24 Chris Demetriou <cgd@google.com>
2432 * layout.cc (is_compressible_debug_section): Fix incorrect
2433 comment about compressed section names.
2435 2009-07-20 Ian Lance Taylor <ian@airs.com>
2438 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2440 2009-07-16 Ian Lance Taylor <iant@google.com>
2443 * layout.h: #include <map>.
2444 (class Kept_section): Change from struct to class. Add accessors
2445 and setters. Add section size to Comdat_group mapping. Change
2446 Comdat_group to std::map. Add is_comdat_ field. Add
2447 linkonce_size field in union.
2448 (class Layout): Update declaration of find_or_add_kept_section.
2449 Don't declare find_kept_object.
2450 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2451 parameter. Add object, shndx, is_comdat, and is_group_name
2452 parameters. Change all callers. Adjust for new Kept_section.
2453 (Layout::find_kept_object): Remove.
2454 * object.cc (Sized_relobj::include_section_group): Update use of
2455 Kept_section. Rename secnum to shndx. Only record
2456 Kept_comdat_section if sections are the same size.
2457 (Sized_relobj::include_linkonce_section): Update use of
2458 Kept_section. Only record Kept_comdat_section if sections are the
2459 same size. Set size of linkonce section.
2460 (Sized_relobj::map_to_kept_section): Update call to
2461 get_kept_comdat_section.
2462 * object.h (class Sized_relobj): Rename fields in
2463 Kept_comdat_section to drop trailing underscores; change object
2464 field to Relobj*. Change Kept_comdat_section_table to store
2465 struct rather than pointer.
2466 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2467 Add kept_object and kept_shndx parameters. Change all callers.
2468 (Sized_relobj::get_kept_comdat_section): Change return type to
2469 bool. Add kept_object and kept_shndx parameters. Change all
2471 * plugin.cc (Pluginobj::include_comdat_group): Update call to
2472 Layout::find_or_add_kept_section.
2474 2009-07-09 Ian Lance Taylor <iant@google.com>
2476 * merge.cc (Object_merge_map::initialize_input_to_output_map):
2477 Reserve space in the hash table.
2479 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
2481 * fileread.cc (File_read::get_mtime): New method.
2482 * fileread.h (Timespec): New structure.
2483 (File_read::get_mtime): New method.
2484 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2485 Renamed from timestamp_nsec.
2486 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2488 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
2490 (Incremental_inputs::report_archive): Save mtime; style fix.
2491 (Incremental_inputs::report_obejct): Save mtime; style fix.
2492 (Incremental_inputs::report_script): Save mtime; style fix.
2493 (Incremental_inputs::finalize_inputs): Style fix.
2494 (Incremental_inputs::finalize): Style fix.
2495 (Incremental_inputs::create_input_section_data): Store inputs
2497 * incremental.h (Incremental_inputs::report_script): Add mtime
2499 (Incremental_inputs::Input_info::Input_info): Intialize only one
2501 (Incremental_inputs::Input_info::archive): Move to nameless
2503 (Incremental_inputs::Input_info::obejct): Move to nameless union.
2504 (Incremental_inputs::Input_info::script): Move to nameless union.
2505 (Incremental_inputs::mtime): New field.
2506 * script.cc (read_input_script): Pass file mtime to
2508 * script.h (Script_info::inputs): Style fix.
2510 2009-07-01 Ian Lance Taylor <ian@airs.com>
2512 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2515 2009-06-24 Ian Lance Taylor <iant@google.com>
2518 * layout.cc (Layout::choose_output_section): If we find an
2519 existing section, update the flags.
2520 (Layout::create_notes): New function, broken out of
2522 (Layout::finalize): Don't create note sections.
2523 (Layout::create_note): Don't crash if linker script discards
2525 (Layout::create_gold_note): Likewise.
2526 (Layout::create_build_id): Likewise. Don't set
2527 after_input_sections on the section.
2528 (Layout::create_executable_stack_info): Remove target parameter.
2530 * layout.h (class Layout): Declare create_notes. Update
2531 declaration of create_executable_stack_info.
2532 * gold.cc (queue_middle_tasks): Call create_notes.
2533 * output.cc (Output_section::update_flags_for_input_section): Move
2534 here from output.h. If SHF_ALLOC flag is newly set, mark address
2536 * output.h (Output_data::mark_address_invalid): New function.
2537 (class Output_section): Only declare, not define,
2538 update_flags_for_input_section. Remove set_flags.
2540 2009-06-24 Ian Lance Taylor <iant@google.com>
2542 * script-sections.cc (Output_section_definition::
2543 set_section_addresses): Rename shadowing local load_address to
2546 2009-06-24 Ian Lance Taylor <iant@google.com>
2549 * reloc.cc (relocate_sections): Skip empty relocation sections.
2551 2009-06-23 Ian Lance Taylor <iant@google.com>
2554 * layout.cc (Layout::create_note): Use choose_output_section
2555 rather than make_output_section.
2557 2009-06-23 Ian Lance Taylor <iant@google.com>
2560 * options.cc (General_options::parse_V): Set printed_version_.
2561 (General_options::General_options): Initialize printed_version_.
2562 * options.h (class General_options): Add printed_version_ field.
2563 * gold.cc (queue_initial_tasks): If there are no input files,
2564 don't give a fatal error if we printed the version information.
2565 (queue_middle_tasks): If using -r with a shared object, give a
2566 fatal error rather than an ordinary error.
2568 2009-06-23 Ian Lance Taylor <iant@google.com>
2571 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
2572 (Layout::make_output_section): Set have_stabstr_section_ if we see
2573 a .stab*str section.
2574 (Layout::finalize): Call link_stabs_sections.
2575 (Layout::link_stabs_sections): New file.
2576 * layout.h (class Layout): Add have_stabstr_section_ field.
2577 Declare link_stabs_sections.
2579 2009-06-23 Doug Kwan <dougkwan@google.com>
2581 * Makefile.am (libgold_a_LIBADD): New.
2582 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2583 * Makefile.in: Regenerate.
2584 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
2585 * configure: Regenerate.
2586 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
2587 * fileread.cc: Include sys/state.h
2588 * gold.h: Declare memmem and strndup if found missing.
2589 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2591 2009-06-23 Ian Lance Taylor <iant@google.com>
2593 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2594 * configure: Rebuild.
2596 2009-06-23 Ian Lance Taylor <iant@google.com>
2599 * object.cc (Object::section_contents): Don't try to get a view if
2600 the section has length zero.
2601 (Object::handle_gnu_warning_section): If the section is empty, use
2602 the name of the section as the warning.
2604 2009-06-23 Ian Lance Taylor <iant@google.com>
2607 * stringpool.h (class Stringpool_template): Add optimize_ field.
2608 (Stringpool_template::set_optimize): New function.
2609 * stringpool.cc (Stringpool_template::Stringpool_template):
2610 Initialize optimize_ field.
2611 (Stringpool_template::set_string_offsets): Test local optimize
2612 fild rather than parameter.
2613 * layout.cc (Layout::Layout): Call set_optimize on the section
2616 2009-06-22 Ian Lance Taylor <iant@google.com>
2619 * yyscript.y: Parse TARGET.
2620 * script.cc (script_set_target): New function.
2621 * script-c.h (script_set_target): Declare.
2622 * options.cc (General_options::string_to_object_format): Rename
2623 from string_to_object_format in anonymous namespace. Change
2625 * options.h (class General_options): Declare
2626 string_to_object_format.
2628 2009-06-22 Ian Lance Taylor <iant@google.com>
2630 * script-sections.cc (Script_sections::create_segments): Don't put
2631 program headers in a PT_LOAD segment if -n or -N.
2633 2009-06-22 Ian Lance Taylor <iant@google.com>
2636 * options.h (class General_options): Add -z lazy and -z now. Sort
2637 -z options into alphabetical order.
2638 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
2640 2009-06-21 Ian Lance Taylor <iant@google.com>
2642 * layout.cc (Layout::make_output_section): Call
2643 Target::new_output_section.
2644 (Layout::attach_allocated_section_to_segment): Put large section
2645 sections in a separate load segment with the large segment flag
2647 (Layout::segment_precedes): Sort large data segments after other
2649 (align_file_offset): New static function.
2650 (Layout::set_segment_offsets): Use align_file_offset.
2651 * output.h (class Output_section): Add is_small_section_ and
2652 is_large_section_ fields.
2653 (Output_section::is_small_section): New function.
2654 (Output_section::set_is_small_section): New function.
2655 (Output_section::is_large_section): New function.
2656 (Output_section::set_is_large_section): New function.
2657 (Output_section::is_large_data_section): New function.
2658 (class Output_segment): Add is_large_data_segment_ field.
2659 (Output_segment::is_large_data_segment): New function.
2660 (Output_segment::set_is_large_data_segment): New function.
2661 * output.cc (Output_section::Output_section): Initialize new
2663 (Output_segment::Output_segment): Likewise.
2664 (Output_segment::add_output_section): Add assertion that large
2665 data sections always go in large data segments. Force small data
2666 sections to the end of the list of data sections. Force small BSS
2667 sections to the start of the list of BSS sections. For large BSS
2668 sections to the end of the list of BSS sections.
2669 * symtab.h (class Symbol): Declare is_common_shndx.
2670 (Symbol::is_defined): Check Symbol::is_common_shndx.
2671 (Symbol::is_common): Likewise.
2672 (class Symbol_table): Define enum Commons_section_type. Update
2673 declarations. Add small_commons_ and large_commons_ fields.
2674 * symtab.cc (Symbol::is_common_shndx): New function.
2675 (Symbol_table::Symbol_table): Initialize new fields.
2676 (Symbol_table::add_from_object): Put small and large common
2677 symbols in the right list.
2678 (Symbol_table::sized_finalized_symbol): Check
2679 Symbol::is_common_shndx.
2680 (Symbol_table::sized_write_globals): Likewise.
2681 * common.cc (Symbol_table::do_allocate_commons): Allocate new
2682 common symbol lists. Don't call do_allocate_commons_list if the
2684 (Symbol_table::do_allocate_commons_list): Remove is_tls
2685 parameter. Add comons_section_type parameter. Change all
2686 callers. Handle small and large common symbols.
2687 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2688 Symbol::is_common_shndx.
2689 * resolve.cc (symbol_to_bits): Likewise.
2690 * target.h (Target::small_common_shndx): New function.
2691 (Target::small_common_section_flags): New function.
2692 (Target::large_common_shndx): New function.
2693 (Target::large_common_section_flags): New function.
2694 (Target::new_output_section): New function.
2695 (Target::Target_info): Add small_common_shndx, large_common_shndx,
2696 small_common_section_flags, and large_common_section_flags
2698 (Target::do_new_output_section): New virtual function.
2699 * arm.cc (Target_arm::arm_info): Initialize new fields.
2700 * i386.cc (Target_i386::i386_info): Likewise.
2701 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2703 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2704 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2705 (Target_x86_64::do_new_output_section): New function.
2706 * configure.ac: Define conditional MCMODEL_MEDIUM.
2707 * testsuite/Makefile.am (check_PROGRAMS): Add large.
2708 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2709 (large_LDFLAGS): Define.
2710 * testsuite/large.c: New file.
2711 * testsuite/testfile.cc (Target_test::test_target_info):
2712 Initialize new fields.
2713 * configure, testsuite/Makefile.in: Rebuild.
2715 2009-06-05 Doug Kwan <dougkwan@google.com>
2717 * Makefile.am (CCFILES): Add target.cc.
2718 * Makefile.in: Regenerate.
2719 * i386.cc (class Target_i386): Define new virtual method to
2720 override do_is_local_label_name in parent.
2721 * object.cc (Sized_relobj::do_count_local_symbols): Discard
2722 local symbols if --discard-locals or -X is given.
2723 * options.h (class General_options): Declare new options
2724 '--discard-locals' and '-X' for discarding locals.
2725 * target.h (class Target): Define new methods is_local_label_name.
2726 Declare new virtual method do_is_local_label_name.
2727 * target.cc: New file.
2728 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2729 (check_SCRIPTS): Add discard_locals_test.sh.
2730 (check_DATA): Add discard_local_tests.syms.
2731 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2732 (discard_local_tests.syms, discard_locals_test.o): New make rules.
2733 * testsuite/Makefile.in: Regenerate.
2734 * testsuite/discard_locals_test.c: New file.
2735 * testsuite/discard_locals_test.sh: Same.
2737 2009-06-05 Doug Kwan <dougkwan@google.com>
2739 * object.cc (Sized_relobj::Sized_relobj): Initialize
2740 discarded_eh_frame_shndx_ to -1U.
2741 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2743 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2744 a discarded .eh_frame section.
2745 (Sized_relobj::do_finalize_local_symbols): Ditto.
2746 * object.h (class Sized_relobj): Declare new member
2747 discarded_eh_frame_shndx_.
2748 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2749 (local_labels_test.o, local_labels_test): New rules.
2750 * testsuite/Makefile.in: Regenerate.
2752 2009-06-04 Doug Kwan <dougkwan@google.com>
2754 * layout.cc (Layout::section_name_mapping): Add mapping for
2755 special ARM sections.
2757 2009-06-03 Doug Kwan <dougkwan@google.com>
2759 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2760 (utils::has_overflow): Same.
2762 2009-06-03 Ian Lance Taylor <iant@google.com>
2764 * layout.cc (Layout::section_name_mapping): New array, replacing
2765 Layout::linkonce_mapping.
2766 (Layout::section_name_mapping_count): New variable, replacing
2767 Layout::linkonce_mapping_count.
2768 (Layout::linkonce_output_name): Remove.
2769 (Layout::output_section_name): Rewrite.
2770 * layout.h (class Layout): Rename Linkonce_mapping to
2771 Section_name_mapping, linkonce_mapping to section_name_mapping,
2772 linkonce_mapping_count to section_name_mapping_count. Don't
2773 declare linkonce_output_name.
2775 2009-06-03 Doug Kwan <dougkwan@google.com>
2777 * gold/arm.cc (namespace utils): New.
2778 (Target_arm::reloc_is_non_pic): Define new method.
2779 (class Arm_relocate_functions): New.
2780 (Target_arm::Relocate::relocate): Handle relocation types used by
2783 2009-06-03 Ian Lance Taylor <iant@google.com>
2785 * arm.cc (Target_arm::scan::global): Use || instead of |.
2787 2009-06-02 Doug Kwan <dougkwan@google.com>
2789 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
2790 issued_non_pic_error_.
2791 (class Target_arm::Scan): Declare new method check_non_pic.
2792 Define new method symbol_needs_plt_entry.
2793 Declare new data member issued_non_pic_error_.
2794 (class Target_arm::Relocate): Declare new method
2795 should_apply_static_reloc.
2796 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
2797 (Target_arm::Scan::check_non_pic): Define new method.
2798 (Target_arm::Scan::local): Handle a small subset of reloc types used
2800 (Target_arm::Scan::local): Same.
2801 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2803 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
2805 * incremental.cc (Incremental_inputs::report_command_line): Filter
2806 out --incremental-* options.
2808 2009-05-29 Doug Kwan <dougkwan@google.com>
2810 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
2812 (class Target_arm): Update comment.
2813 (Target_arm::Target_arm): Initialize new data members GOT_,
2814 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
2815 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
2816 and Target_arm::rel_dyn_section.
2817 Declare new_enum Target_arm::Got_type.
2818 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
2820 Update commments for member do_dynsym_value.
2821 (Target_arm::got_size, Target_arm::plt_section,
2822 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
2823 new methods inside class defintion.
2824 (Target_arm::got_section): Define new method.
2825 (Target_arm::rel_dyn_section): Same.
2826 (Output_data_plt_arm): New template class.
2827 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
2828 (Output_data_plt_arm:do_adjust_output_section): Define new method.
2829 (Output_data_plt_arm::add_entry): Same.
2830 (Output_data_plt_arm::first_plt_entry): Define new
2831 static data member for PLT instruction template.
2832 (Output_data_plt_arm::plt_entry): Same.
2833 (Output_data_plt_arm::do_write): Define new method.
2834 (Target_arm::make_plt_entry): Same.
2835 (Target_arm::do_finalize_sections): Same.
2836 (Target_arm::do_dynsym_value): Same.
2838 2009-05-28 Doug Kwan <dougkwan@google.com>
2840 * Makefile.am (TARGETSOURCES): Add arm.cc.
2841 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
2842 * Makefile.in: Regenerate.
2844 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2846 2009-05-26 Doug Kwan <dougkwan@google.com>
2848 * options.cc (General_options::parse_exclude_libs). Fix a comment.
2849 (General_options::check_excluded_libs): Strip off directories in
2850 archive name before matching like GNU ld does.
2851 * testsuite/Makefile.am (MOSTLYCLEANFILES,
2852 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
2853 (exclude_libs_test_LDFLAGS): Add linker option
2854 -Wl,--exclude-libs,libexclude_libs_test_3
2855 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
2856 an explicit archive without using -l.
2857 (alt/libexclude_libs_test_3.a): New make rule.
2858 * testsuite/Makefile.in: Regenerate.
2859 * testsuite/exclude_libs_test.c : Declare lib3_default().
2861 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
2862 * exclude_libs_test_3.c: New file.
2864 2009-05-26 Nick Clifton <nickc@redhat.com>
2866 * po/id.po: New Indonesian translation.
2867 * po/gold.pot: Updated template file.
2869 2009-05-22 Sriraman Tallam <tmsriram@google.com>
2871 * testsuite/Makefile.am: Add -ffunction-sections to compile
2872 gc_comdat_test files. Add -Wl,--gc-sections to build
2874 * testsuite/Makefile.in: Regenerate.
2875 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
2877 2009-05-21 Sriraman Tallam <tmsriram@google.com>
2879 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
2880 kept comdat section was garbage collected.
2881 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
2882 * testsuite/Makefile.in: Regenerate.
2883 * testsuite/gc_comdat_test.sh: New file.
2884 * testsuite/gc_comdat_test_1.cc: New file.
2885 * testsuite/gc_comdat_test_2.cc: New file.
2887 2009-05-19 Doug Kwan <dougkwan@google.com>
2889 * archive.cc (Archive::Archive): Move constructor from archive.h
2890 to here. Initialize no_export_.
2891 (Archive::get_elf_object_for_member): Set no_export flag of object.
2892 * archive.h (Archive::Archive): Move constructor body to
2894 (Archive::no_export): New method.
2895 (Archive::no_export_): New field.
2896 * object.h (Object::Object): Initialize no_export_ to false.
2897 (Object::no_export, Object::set_no_export): New methods.
2898 (Object::no_export_): New field.
2899 * options.cc (General_options::parse_exclude_libs): New method.
2900 (General_options::check_excluded_libs) Same.
2901 * options.h (exclude_libs): New option.
2902 (General_options::check_excluded_libs): New method declaration.
2903 (General_options::excluded_libs_): New field.
2904 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
2905 default or protected visibility if an object has no-export flag set.
2906 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
2907 (check_SCRIPTS): Add exclude_libs_test.sh.
2908 (check_DATA): Add exclude_libs_test.syms.
2909 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
2910 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
2911 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
2912 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
2913 (exclude_libs_test.syms, libexclude_libs_test_1.a,
2914 libexclude_libs_test_2.a): New rules.
2915 * testsuite/Makefile.in: Regenerate.
2916 * testsuite/exclude_libs_test.c: New file.
2917 * testsuite/exclude_libs_test.sh: Ditto.
2918 * testsuite/exclude_libs_test_1.c: Ditto.
2919 * testsuite/exclude_libs_test_2.c: Ditto.
2921 2009-05-15 Ian Lance Taylor <iant@google.com>
2923 * configure.ac: Check for declarations for cases where libiberty.h
2924 checks HAVE_DECL_xxx.
2925 * configure, config.in: Rebuild.
2927 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
2929 * gold.h (Incremental_argument_list): Remove (invalid) forward
2931 * incremental.cc (Incremental_inputs::report_achive): New method.
2932 (Incremental_inputs::report_object): New method.
2933 (Incremental_inputs::report_script): New method.
2934 (Incremental_inputs::finalize_inputs): New method.
2935 (Incremental_inputs::finalize): Call finalize_inputs().
2936 (Incremental_inputs::sized_create_incremental_inputs_section_data):
2937 Create inputs entries.
2938 * incremental.h (Incremental_input_type): New enum.
2939 (Incremental_inputs::Incremental_input): Initialize new fields.
2940 (Incremental_inputs::report_inputs): New method.
2941 (Incremental_inputs::report_achive): New method.
2942 (Incremental_inputs::report_object): New method.
2943 (Incremental_inputs::report_script): New method.
2944 (Incremental_inputs::finalize_inputs): New method.
2945 (Incremental_inputs::Input_info): New struct.
2946 (Incremental_inputs::Input_info_map): New typedef.
2947 (Incremental_inputs::lock_): New field.
2948 (Incremental_inputs::Inputs_): New field.
2949 (Incremental_inputs::Inputs_map): New field.
2950 * main.cc (main): Call Incremental_input::report_inputs.
2951 * options.h (Input_argument_list): Typedef moved from
2953 (Input_file_group::Files): Remove, use ::Input_argument_list.
2954 (Input_file_group::Input_argument_list): Remove, use
2955 ::Input_argument_list.
2956 * plugin.cc (Plugin_manager::add_input_file): Add error in
2958 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
2960 * script.cc (read_input_script): Call
2961 Incremental_input::report_script.
2962 * script.h (Script_info): New class.
2964 2009-04-27 Ian Lance Taylor <iant@google.com>
2966 * x86_64.cc (do_adjust_output_section): Set entsize to
2969 2009-04-23 Elliott Hughes <enh@google.com>
2971 * output.cc (Output_file::close): After short writes, continue
2972 writing from the correct offset in the buffer being written.
2974 2009-04-23 Chris Demetriou <cgd@google.com>
2976 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
2977 * configure: Regenerate.
2978 * config.in: Regenerate.
2979 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
2980 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2982 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
2984 * incremental.cc (Incremental_inputs_header_data): Renamed from
2985 Incremental_input_header_data.
2986 (Incremental_inputs_header_data::data_size): New field.
2987 (Incremental_inputs_header_data::put_input_file_count): Renamed
2988 from input_file_count.
2989 (Incremental_inputs_header_data::put_command_line_offset): Renamed
2990 from command_line_offset.
2991 (Incremental_inputs_header_data::put_reserved): Renamed from
2993 (Incremental_inputs_entry_data): Renamed from
2994 Incremental_input_entry_data.
2995 (Incremental_inputs_entry_data::data_size): New field.
2996 (Incremental_inputs::report_command_line): New method.
2997 (Incremental_inputs::finalize): New method.
2998 (Incremental_inputs::create_incremental_inputs_data): New method.
2999 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3000 * incremental.h: New file.
3001 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3002 (Layout::finalize): Create incremental inputs section in
3004 (Layout::create_incremental_info_sections): New method.
3005 * layout.h (Layout::incremental_inputs): New method.
3006 (Layout::create_incremental_info_sections): New method.
3007 (Layout::incremental_inputs_): New field.
3008 * main.cc (main): Notify Incremental_input of the command line.
3010 2009-04-01 Ian Lance Taylor <iant@google.com>
3011 Mikolaj Zalewski <mikolajz@google.com>
3013 * gold.h (reserve_unordered_map): Define, three versions, one for
3014 each version of Unordered_map.
3015 * layout.cc (Layout::Layout): Remove options parameter. Add
3016 number_of_input_files parameter. Don't initialize options_.
3017 Initialize number_of_input_files_ and resized_signatures_. Move
3018 sections_are_attached_.
3019 (Layout::layout_group): Reserve space for group_signatures_.
3020 (Layout::find_or_add_kept_section): Change name parameter to be a
3021 reference. Resize signatures_ map when it gets large enough.
3022 (Layout::layout_eh_frame): Use parameters->options() instead of
3024 (Layout::make_output_section): Likewise.
3025 (Layout::attach_allocated_section_to_segment): Likewise.
3026 (Layout::finalize, Layout::create_executable_stack): Likewise.
3027 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3028 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3029 * layout.h (class Layout): Update declarations. Remove options_
3030 field. Add number_of_input_files_ and resized_signatures_
3031 fields. Move sections_are_attached_ field.
3032 * main.cc (main): Pass number of input files to Layout
3033 constructor. Don't pass options.
3035 2009-03-30 Ian Lance Taylor <iant@google.com>
3037 * ffsll.c (ffsll): Correct implementation.
3039 2009-03-27 Ian Lance Taylor <iant@google.com>
3041 * ffsll.c: New file.
3042 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3043 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3044 * ftruncate.c (ftruncate): Declare before definition.
3045 * mremap.c (mremap): Likewise.
3046 * pread.c (pread): Likewise.
3047 * configure, Makefile.in, config.in: Rebuild.
3049 * mremap.c: New file.
3050 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3051 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3052 (mremap): Declare if HAVE_MREMAP is not defined.
3053 * configure, Makefile.in, config.in: Rebuild.
3055 2009-03-27 Cary Coutant <ccoutant@google.com>
3057 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3058 position independent.
3059 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3060 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3062 2009-03-24 Cary Coutant <ccoutant@google.com>
3064 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3066 (needs_dynamic_reloc): Likewise.
3068 2009-03-24 Ian Lance Taylor <iant@google.com>
3070 * yyscript.y (file_cmd): Recognize EXTERN.
3071 (extern_name_list, extern_name_list_body): New nonterminals.
3072 * script.cc (script_add_extern): Define.
3073 * script-c.h (script_add_extern): Declare.
3075 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
3077 * object.cc (is_elf_object): Define.
3078 * object.h (is_elf_object): Declare.
3079 * archive.cc (Archive::get_elf_object_for_member): Call
3081 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3083 2009-03-24 Elliott Hughes <enh@google.com>
3085 * output.cc (Output_file::map_anonymous): Define.
3086 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3087 try an anonymous one. Report the size if the mmap fails.
3088 * output.h (class Output_file): Declare map_anonymous.
3090 2009-03-24 Ian Lance Taylor <iant@google.com>
3092 * target-select.cc (instantiate_target): Don't acquire the lock if
3093 the instantiated_target_ field has already been set.
3095 2009-03-23 Ian Lance Taylor <iant@google.com>
3097 * gold-threads.h (class Initialize_lock): Define.
3098 * gold-threads.cc (class Initialize_lock_once): Define.
3099 (initialize_lock_control): New static variable.
3100 (initialize_lock_pointer): New static variable.
3101 (initialize_lock_once): New static function.
3102 (Initialize_lock::Initialize_lock): Define.
3103 (Initialize_lock::initialize): Define.
3104 * target-select.h: Include "gold-threads.h".
3105 (class Target_selector): Add lock_ and initialize_lock_ fields.
3106 Don't define instantiate_target, just declare it.
3107 * target-select.cc (Target_selector::Target_selector): Initialize
3109 (Target_selector::instantiate_target): Define.
3110 * descriptors.h: Include "gold-threads.h".
3111 (class Descriptors): Add initialize_lock_ field.
3112 * descriptors.cc (Descriptors::Descriptors): Initialize new
3114 (Descriptors::open): Use initialize_lock_ field
3115 * errors.h (class Errors): Add initialize_lock_ field.
3116 * errors.cc (Errors::Errors): Initialize new field.
3117 (Errors::initialize_lock): Use initialize_lock_ field.
3118 * powerpc.cc (class Target_selector_powerpc): Remove
3119 instantiated_target_ field. In do_recognize call
3120 instantiate_target rather than do_instantiate_target. In
3121 do_instantiate_target just allocate a new target.
3122 * sparc.cc (class Target_selector_sparc): Likewise.
3124 * freebsd.h: New file.
3125 * i386.cc: Include "freebsd.h".
3126 (Target_i386): Derive from Target_freebsd rather than
3128 (Target_selector_i386): Derive from Target_selector_freebsd rather
3129 than Target_selector.
3130 * x86_64.cc: Include "freebsd.h".
3131 (Target_x86_64): Derive from Target_freebsd rather than
3133 (Target_selector_x86_64): Derive from Target_selector_freebsd
3134 rather than Target_selector.
3135 * target.h (class Target): Add adjust_elf_header and
3136 do_adjust_elf_header.
3137 * output.cc (Output_file_header:: do_sized_write): Call target
3138 adjust_elf_header routine.
3139 * configure.tgt: Set targ_osabi.
3140 * configure.ac: Define GOLD_DEFAULT_OSABI.
3141 * parameters.cc (Parameters::default_target): Pass
3142 GOLD_DEFAULT_OSABI to select_target.
3143 * target-select.h (class Target_selector): Make instantiate_target
3144 protected rather than private.
3145 * Makefile.am (HFILES): Add freebsd.h.
3146 * configure, Makefile.in, config.in: Rebuild.
3148 * merge.cc (do_add_input_section): Correct pend value. Change
3149 message about last entry not being null terminated from error to
3152 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3154 * incremental.cc: New file.
3155 * Makefile.am (CCFILES): Add incremental.cc.
3156 * Makefile.in: Rebuild.
3158 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3160 * layout.cc (Layout::output_section_name): Preserve names
3161 of '.note.' sections.
3163 2009-03-19 Ian Lance Taylor <iant@google.com>
3165 * descriptors.cc (Descriptors::open): Check that the options are
3166 valid before using them.
3168 2009-03-18 Ian Lance Taylor <iant@google.com>
3170 * script-sections.h: Include <list>.
3171 (class Script_sections): Change Sections_elements from std::vector
3172 to std::list. Typedef public Elements_iterator. Add
3173 orphan_section_placement_, data_segment_align_start_, and
3174 saw_data_segment_align_ fields. Remove data_segment_align_index_
3176 * script-sections.cc (class Orphan_section_placement): New class.
3177 (class Sections_element): Add virtual functions is_relro and
3178 orphan_section_init. Remove virtual function place_orphan_here.
3179 (class Output_section_definition): Add is_relro and
3180 orphan_section_init. Remove place_orphan_here.
3181 (class Orphan_output_section): Likewise.
3182 (Script_sections::Script_sections): Update for field changes.
3183 (Script_sections::data_segment_align): Set saw_data_segment_align_
3184 and data_segment_align_start_, not data_segment_align_index.
3185 (Script_sections::data_segment_relro_end): Check
3186 saw_data_segment_align_. Use data_segment_align_start_ rather
3187 than data_segment_align_index_.
3188 (Script_sections::place_orphan): Rewrite to use
3189 Orphan_section_placement.
3191 2009-03-17 Ian Lance Taylor <iant@google.com>
3193 * archive.cc (Archive::add_symbols): Check for a version attached
3194 to the symbol name in the archive map.
3195 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3196 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3197 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3198 (ver_test_11.a): New target.
3199 * testsuite/Makefile.in: Rebuild.
3201 * configure.ac: Check for chsize and posix_fallocate. Replace
3203 * ftruncate.c: New file, from gnulib.
3204 * output.cc (posix_fallocate): Define dummy version if not
3205 HAVE_POSIX_FALLOCATE.
3206 (Output_file::map): Call posix_fallocate rather than lseek and
3208 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3209 * configure, Makefile.in, config.in: Rebuild.
3211 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3213 * layout.h (Layout::create_note): Add section_name parameter.
3214 * layout.cc (Layout::create_note): Likewise.
3215 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3217 2009-03-17 Ian Lance Taylor <iant@google.com>
3219 * descriptors.cc: Include "options.h".
3220 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3221 (Descriptors::open): Always use O_CLOEXEC when opening a new
3222 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3223 then set FD_CLOEXEC.
3225 * sparc.cc (class Target_sparc): Add has_got_section.
3226 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3227 make sure we have a GOT section.
3229 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3230 (Target_sparc::Scan::local): Likewise.
3231 (Target_sparc::Scan::global): Likewise.
3232 (Target_sparc::Relocate::relocate): Likewise.
3233 (Target_sparc::Relocate::relocate_tls): Likewise.
3235 * symtab.cc (Symbol_table::define_default_version): New function,
3236 broken out of add_from_object.
3237 (Symbol_table::add_from_object): Call define_default_version.
3238 (Symbol_table::define_special_symbol): Add resolve_oldsym
3239 parameter. Change all callers. If the version for a symbol comes
3240 from a version script, resolve it with the symbol with the same
3241 name with no version. Also add the symbol without a version if
3243 (do_define_in_output_data): If resolving with oldsym, don't delete
3245 (do_define_in_output_segment): Likewise.
3246 (do_define_as_constant): Likewise.
3247 * symtab.h (class Symbol_table): Update declarations.
3249 2009-03-13 Ian Lance Taylor <iant@google.com>
3251 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3252 (Read_symbols::requeue): New function.
3253 (Read_symbols::do_read_symbols): If make_elf_object fails because
3254 the target type is not configured, and the file was searched for,
3255 issue a warning and retry with the next directory.
3256 (Add_symbols::run): If the file has an incompatible format, and
3257 it was searched for, requeue the Read_symbols task. On error,
3259 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3260 dirindex parameter to constructor. Change all callers. Declare
3261 incompatible_warning and requeue.
3262 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3263 input_argument_ and input_group_ fields. Add them to
3264 constructor. Change all callers.
3265 (class Read_script): Add dirindex_ field. Add it to constructor.
3267 * archive.cc (Archive::setup): Remove input_objects parameter.
3269 (Archive::get_file_and_offset): Likewise.
3270 (Archive::read_all_symbols): Likewise.
3271 (Archive::read_symbols): Likewise.
3272 (Archive::get_elf_object_for_member): Remove input_objects
3273 parameter. Add punconfigured parameter. Change all callers.
3274 (Archive::add_symbols): Change return type to bool. Check return
3275 value of include_member.
3276 (Archive::include_all_members): Likewise.
3277 (Archive::include_member): Change return type to bool. Return
3278 false if first included object has incompatible target. Set
3279 included_member_ field.
3280 (Add_archive_symbols::run): If add_symbols returns false, requeue
3282 * archive.h (class Archive): Add included_member_ field.
3283 Initialize it in constructor. Add input_file and searched_for
3284 methods. Update declarations.
3285 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3286 input_argument_ fields. Add them to constructor. Change all
3288 * script.cc: Include "target-select.h".
3289 (class Parser_closure): Add skip_on_incompatible_target_ and
3290 found_incompatible_target_ fields. Add
3291 skip_on_incompatible_target parameter to constructor. Change all
3292 callers. Add methods skip_on_incompatible_target,
3293 clear_skip_on_incompatible_target, found_incompatible_target, and
3294 set_found_incompatible_target.
3295 (read_input_script): Add dirindex parameter. Change all callers.
3296 If parser finds an incompatible target, requeue Read_symbols
3298 (script_set_symbol): Clear skip_on_incompatible_target in
3300 (script_add_assertion, script_parse_option): Likewise.
3301 (script_start_sections, script_add_phdr): Likewise.
3302 (script_check_output_format): New function.
3303 * script.h (read_input_script): Update declaration.
3304 * script-c.h (script_check_output_format): Declare.
3305 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3306 (ignore_cmd): Remove OUTPUT_FORMAT.
3307 * fileread.cc (Input_file::Input_file): Add explicit this.
3308 (Input_file::will_search_for): New function.
3309 (Input_file::open): Add pindex parameter. Change all callers.
3310 * fileread.h (class Input_file): Add input_file_argument method.
3311 Declare will_search_for. Update declarations.
3312 * object.cc (make_elf_object): Add punconfigured parameter.
3314 * object.h (class Object): Make input_file public. Add
3315 searched_for method.
3316 (make_elf_object): Update declaration.
3317 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3319 * dirsearch.h (class Dirsearch): Update declaration.
3320 * options.h (class General_options): Add --warn-search-mismatch.
3321 * parameters.cc (Parameters::is_compatible_target): New function.
3322 * parameters.h (class Parameters): Declare is_compatible_target.
3323 * workqueue.cc (Workqueue::add_blocker): New function.
3324 * workqueue.h (class Workqueue): Declare add_blocker.
3326 * fileread.cc (Input_file::open): Remove options parameter.
3328 (Input_file::open_binary): Likewise.
3329 * script.cc (read_input_script): Likewise.
3330 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3331 options parameter from constructor. Change all callers.
3332 (class Read_script): Likewise.
3333 * fileread.h (class Input_file): Update declarations.
3334 * script.h (read_input_script): Update declaration.
3336 2009-03-10 Nick Clifton <nickc@redhat.com>
3338 * po/es.po: New Spanish translation.
3340 2009-03-06 Cary Coutant <ccoutant@google.com>
3342 * options.cc (parse_short_option): Keep dash_z from registering itself.
3344 2009-03-03 Ian Lance Taylor <iant@google.com>
3347 * target-reloc.h (relocate_section): Pass output_section to
3349 * i386.cc (Target_i386::should_apply_static_reloc): Add
3350 output_section parameter. Change all callers.
3351 (Target_i386::Relocate::relocate): Add output_section parameter.
3352 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3353 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3354 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3355 * testsuite/two_file_shared.sh: New script.
3356 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3357 (check_DATA): Add two_file_shared.dbg.
3358 (two_file_shared.dbg): New target.
3359 * testsuite/Makefile.in: Rebuild.
3361 2009-03-01 Ian Lance Taylor <iant@google.com>
3363 * configure.ac: Check for byteswap.h.
3364 * configure: Rebuild.
3365 * config.in: Rebuild.
3367 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3369 * layout.cc (Layout::find_or_add_kept_section): New function.
3370 (Layout::add_comdat): Removed.
3371 * layout.h (struct Kept_section): Move out of class Layout.
3372 Remove trailing underscores from field names. Add group_sections
3373 field. Rename group_ field to is_group. Change all uses.
3374 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3375 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3376 comdat_groups_ field.
3377 (Sized_relobj::include_section_group): Use
3378 find_or_add_kept_section and Kept_section::group_sections.
3379 (Sized_relobj::include_linkonce_section): Likewise.
3380 * object.cc (class Sized_relobj): Don't define Comdat_group or
3381 Comdat_group_table. Remove find_comdat_group and
3382 add_comdat_group. Remove comdat_groups_ field.
3383 * plugin.cc (include_comdat_group): Use
3384 Layout::find_or_add_kept_section.
3386 2009-02-28 Ian Lance Taylor <iant@google.com>
3388 * README: --gc-sections and map files are now supported. Document
3389 some build requirements.
3392 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3393 relocatable link set the value of the section symbol to zero.
3394 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3395 relocatable link don't include the section address in the local
3398 2009-02-27 Ian Lance Taylor <iant@google.com>
3401 * options.h (class Search_directory): Add is_system_directory.
3402 (class General_options): Declare is_in_system_directory.
3403 * options.cc (get_relative_sysroot): Make static.
3404 (get_default_sysroot): Make static.
3405 (General_optoins::is_in_system_directory): New function.
3406 * fileread.cc (Input_file::is_in_system_directory): New function.
3407 * fileread.h (class Input_file): Declare is_in_system_directory.
3408 * object.h (class Object): Add is_in_system_directory.
3409 (class Input_objects): Remove system_library_directory_ field.
3410 * object.cc (Input_objects::add_object): Don't set
3411 system_library_directory_.
3412 (input_objects::found_in_system_library_directory): Remove.
3413 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3414 parameter. Change all callers.
3415 (Symbol_table::sized_write_globals): Likewise.
3416 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3417 Call Object::is_in_system_directory.
3418 * symtab.h (class Symbol_table): Update declarations.
3421 * descriptors.h (Open_descriptor): Add is_on_stack field.
3422 * descriptors.cc (Descriptors::open): If the descriptor is on the
3423 top of the stack, remove it. Initialize is_on_stack field.
3424 (Descriptors::release): Only add pod to stack if it is not on the
3426 (Descriptors::close_some_descriptor): Clear stack_next and
3430 * output.cc (Output_section::find_starting_output_address): Rename
3431 from starting_output_address; add PADDR parameter; change return
3433 * output.h (class Output_section): Declare
3434 find_starting_output_address instead of starting_output_address.
3435 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3436 section symbol for which we can't find a merge section.
3439 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3440 hidden or internal, force the symbol to be local.
3441 * resolve.cc (Symbol::override_visibility): Define.
3442 (Symbol::override_base): Use override_visibility.
3443 (Symbol_table::resolve): Likewise.
3444 (Symbol::override_base_with_special): Likewise.
3445 (Symbol_table::override_with_special): If the visibility is hidden
3446 or internal, force the symbol to be local.
3447 * symtab.h (class Symbol): Add set_visibility and
3448 override_visibility.
3449 * testsuite/ver_test_1.sh: New file.
3450 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3451 (check_DATA): Add ver_test_1.syms.
3452 (ver_test_1.syms): New target.
3453 * testsuite/Makefile.in: Rebuild.
3455 2009-02-25 Cary Coutant <ccoutant@google.com>
3457 * layout.cc (Layout::choose_output_section): Don't rename sections
3458 when using a linker script that has a SECTIONS clause.
3459 * Makefile.in: Regenerate.
3461 * testsuite/Makefile.am (script_test_5.sh): New test case.
3462 * testsuite/Makefile.in: Regenerate.
3463 * testsuite/script_test_5.cc: New file.
3464 * testsuite/script_test_5.sh: New file.
3465 * testsuite/script_test_5.t: New file.
3467 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
3469 * archive.cc (Archive::include_member): Update calls to add_symbols.
3470 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3471 the Layout argument.
3472 * dynobj.h (do_add_symbols): Add the Layout argument.
3473 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3475 * object.h (Object::add_symbols): Add the Layout argument.
3476 (Object::do_add_symbols): Add the Layout argument.
3477 (Sized_relobj::do_add_symbols): Add the Layout argument.
3478 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3479 Unify the two versions.
3480 (Add_plugin_symbols): Remove.
3481 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3482 (Sized_pluginobj::do_add_symbols): Unify the two versions.
3483 (Add_plugin_symbols): Remove.
3484 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3485 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3486 (Add_symbols::run): Make it work with Pulginobj.
3488 2009-02-06 Ian Lance Taylor <iant@google.com>
3490 * object.cc (Sized_relobj::do_layout): Make info message start
3491 with lower case letter.
3493 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
3495 * binary.cc: Fix file comment.
3497 * options.h (enum Incremental_disposition): Define.
3498 (class General_options): Add new options: --incremental,
3499 --incremental_changed, --incremental_unchanged,
3500 --incremental_unknown. Add incremental_disposition_ and
3501 implicit_incremental_ fields.
3502 (General_options::incremental_disposition): New function.
3503 (class Position_dependent_options): Add incremental_disposition
3505 (Position_dependent_options::copy_from_options): Set incremental
3507 * options.cc (General_options::parse_incremental_changed): New
3509 (General_options::parse_incremental_unchanged): New function.
3510 (General_options::parse_incremental_unknown): New function.
3511 (General_options::General_options): Initialize new fields
3512 incremental_disposition_ and implicit_incremental_.
3513 (General_options::finalize): Check for uasge of --incremental-*
3514 without --incremental.
3516 2009-02-06 Chris Demetriou <cgd@google.com>
3518 * gold.h (gold_undefined_symbol): Change to take only a Symbol
3519 pointer and to report location as the file name associated with
3521 (gold_undefined_symbol_at_location): New function to replace the
3522 old gold_undefined_symbol functionality.
3523 * target-reloc.h (relocate_section): Update to use
3524 gold_undefined_symbol_at_location.
3525 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3526 Call gold_undefined_symbol function rather than gold_error.
3527 * errors.h (Errors::undefined_symbol): Take location as a
3528 string, rather than calculating it from a relocation.
3529 * errors.cc (Errors::fatal): Print "fatal error:" before the
3531 (Errors::error, Errors::error_at_location): Print "error: "
3532 before the formatted message.
3533 (Errors::undefined_symbol): Take location as a string, rather
3534 than calculating it from a relocation.
3535 (gold_undefined_symbol_at_location): New function akin to
3536 old gold_undefined_symbol, calculates location from relocation.
3537 (gold_undefined_symbol): Change to take only a Symbol pointer
3538 and to report location as the file name associated with the symbol.
3539 * testsuite/debug_msg.sh: Update for changed error messages.
3540 * testsuite/undef_symbol.sh: Likewise.
3542 2009-02-04 Duncan Sands <baldrick@free.fr>
3545 * reduced_debug_output.h
3546 (Output_reduced_debug_abbrev_section::failed): Use format for
3548 (Output_reduced_debug_info_section::faild): Likewise.
3550 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
3552 * script.cc (Lazy_demangler): New class.
3553 (Version_script_info::get_symbol_version_helper): Demangle a
3556 2009-01-29 Cary Coutant <ccoutant@google.com>
3558 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
3560 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3562 2009-01-28 Ian Lance Taylor <iant@google.com>
3564 * version.cc (version_string): Bump to 1.9.
3566 * gold.h: Include <cstring> and <stdint.h>.
3567 * version.cc: Include <cstdio>.
3568 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
3570 * reduced_debug_output.cc (insert_into_vector): Rename from
3571 Insert_into_vector; change all callers. Use Swap_unaligned to
3572 avoid aliasing issue; remove union since it is unnecessary.
3574 2009-01-27 Sriraman Tallam <tmsriram@google.com>
3576 * Makefile.am (CCFILES): Add gc.cc.
3578 * Makefile.in: Regenerate.
3579 * gold.cc (Gc_runner): New class.
3580 (queue_initial_tasks): Call garbage collection related tasks
3581 when corresponding options are invoked.
3582 (queue_middle_gc_tasks): New function.
3583 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
3584 processed early before laying out sections during garbage collection.
3585 * gold.h (queue_middle_gc_tasks): New function.
3586 (is_prefix_of): Move from "layout.cc".
3587 * i386.cc (Target_i386::gc_process_relocs): New function.
3588 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
3589 * main.cc (main): Create object of class "Garbage_collection".
3590 * object.cc (Relobj::copy_symbols_data): New function.
3591 (Relobj::is_section_name_included): New function.
3592 (Sized_relobj::do_layout): Allow this function to be called twice
3593 during garbage collection and defer layout of section during the
3595 * object.h (Relobj::get_symbols_data): New function.
3596 (Relobj::is_section_name_included): New function.
3597 (Relobj::copy_symbols_data): New function.
3598 (Relobj::set_symbols_data): New function.
3599 (Relobj::get_relocs_data): New function.
3600 (Relobj::set_relocs_data): New function.
3601 (Relobj::is_output_section_offset_invalid): New pure virtual function.
3602 (Relobj::gc_process_relocs): New function.
3603 (Relobj::do_gc_process_relocs): New pure virtual function.
3604 (Relobj::sd_): New data member.
3605 (Sized_relobj::is_output_section_offset_invalid): New function.
3606 (Sized_relobj::do_gc_process_relocs): New function.
3607 * options.h (General_options::gc_sections): Modify to not be a no-op.
3608 (General_options::print_gc_sections): New option.
3609 * plugin.cc (Plugin_finish::run): Remove function call to
3610 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
3611 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
3612 * reloc.cc (Read_relocs::run): Add task to process relocs and
3613 determine unreferenced sections when doing garbage collection.
3614 (Gc_process_relocs): New class.
3615 (Sized_relobj::do_gc_process_relocs): New function.
3616 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
3617 sections that are garbage collected.
3618 * reloc.h (Gc_process_relocs): New class.
3619 * sparc.cc (Target_sparc::gc_process_relocs): New function.
3620 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
3621 symbols whose corresponding sections are garbage collected.
3622 (Symbol_table::Symbol_table): Add new parameter for the garbage
3624 (Symbol_table::gc_mark_undef_symbols): New function.
3625 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3626 (Symbol_table::gc_mark_dyn_syms): New function.
3627 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
3629 (Symbol_table::add_from_object): Likewise.
3630 (Symbol_table::add_from_relobj): When building shared objects, do not
3631 treat externally visible symbols as garbage.
3632 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
3633 table information for static and relocatable links.
3634 * symtab.h (Symbol_table::set_gc): New function.
3635 (Symbol_table::gc): New function.
3636 (Symbol_table::gc_mark_undef_symbols): New function.
3637 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3638 (Symbol_table::gc_mark_dyn_syms): New function.
3639 (Symbol_table::gc_): New data member.
3640 * target.h (Sized_target::gc_process_relocs): New pure virtual
3642 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
3643 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
3645 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
3647 * options.h (General_options::gc_sections): Define as a no-op for now.
3648 (General_options::no_keep_memory): Ditto.
3649 (General_options::Bshareable): Define.
3650 * options.cc (General_options::finalize): Honor -Bshareable.
3652 2009-01-20 Andreas Schwab <schwab@suse.de>
3654 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
3655 read the value in the contents, since we don't use it. Use the
3656 template endianness when writing.
3657 (Relocate::relocate): Use it for R_PPC_REL16_HA.
3659 2009-01-19 Andreas Schwab <schwab@suse.de>
3661 * configure.tgt (powerpc64-*): Fix targ_obj.
3663 2009-01-15 Ian Lance Taylor <iant@google.com>
3665 * object.cc (Sized_relobj::write_local_symbols): Don't write out
3666 local symbols when stripping all symbols.
3668 2009-01-14 Cary Coutant <ccoutant@google.com>
3670 * output.cc (Output_reloc): Add explicit instantiations.
3672 2009-01-14 Cary Coutant <ccoutant@google.com>
3674 * archive.cc (Archive::get_elf_object_for_member): Remove call
3675 to File_read::claim_for_plugin.
3676 * descriptors.cc (Descriptors::open): Remove reference to
3678 (Descriptors::claim_for_plugin): Remove.
3679 * descriptors.h (Descriptors::claim_for_plugin): Remove.
3680 (Descriptors::is_claimed): Remove.
3681 (claim_descriptor_for_plugin): Remove.
3682 * fileread.cc (File_read::claim_for_plugin): Remove.
3683 * fileread.h (File_read::claim_for_plugin): Remove.
3684 (File_read::descriptor): Reopen descriptor if necessary.
3685 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
3686 (Plugin_manager::all_symbols_read): Add task parameter. Change
3688 (Plugin_manager::get_input_file): New function.
3689 (Plugin_manager::release_input_file): New function.
3690 (Pluginobj::Pluginobj): Add filesize parameter and initialize
3691 corresponding data member.
3692 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3693 and pass to base constructor. Change all callers.
3694 (get_input_file, release_input_file): New functions.
3695 (make_sized_plugin_object): Add filesize parameter. Change all callers.
3696 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3697 (Plugin_manager::all_symbols_read): Add task parameter.
3698 (Plugin_manager::get_input_file): New function.
3699 (Plugin_manager::release_input_file): New function.
3700 (Plugin_manager::task_): New data member.
3701 (Pluginobj::Pluginobj): Add filesize parameter.
3702 (Pluginobj::filename): New function.
3703 (Pluginobj::descriptor): New function.
3704 (Pluginobj::filesize): New function.
3705 (Pluginobj::filesize_): New data member.
3706 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3707 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3708 File_read::claim_for_plugin; use Object::unlock to unlock the file.
3710 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3711 with archive libraries.
3712 * testsuite/Makefile.in: Regenerate.
3713 * testsuite/plugin_test.c (struct sym_info): New type.
3714 (get_input_file, release_input_file): New static variables.
3715 (onload): Capture new transfer vector entries.
3716 (claim_file_hook): Stop reading at end of file according to filesize.
3717 Factor out parsing of readelf output into separate function.
3718 (all_symbols_read_hook): Exercise get_input_file and release_input_file
3719 APIs and get the source file name from the symbol table. Convert
3720 source file name to corresponding object file name. Print info
3721 message when adding new input files.
3722 (parse_readelf_line): New function.
3723 * testsuite/plugin_test_1.sh: Add checks for new info messages.
3724 * testsuite/plugin_test_2.sh: Likewise.
3725 * testsuite/plugin_test_3.sh: Likewise.
3726 * testsuite/plugin_test_4.sh: New test case.
3728 2009-01-07 Ian Lance Taylor <iant@google.com>
3730 * version.cc (version_string): Bump to 1.8.
3732 2008-12-23 Cary Coutant <ccoutant@google.com>
3734 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3735 * plugin.cc (Plugin_manager::finish): Rename as
3736 layout_deferred_objects. Move cleanup to separate function.
3737 (Plugin_manager::cleanup): New function.
3738 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3740 * plugin.h (Plugin_manager::finish): Rename as
3741 layout_deferred_objects.
3742 (Plugin_manager::cleanup): New function.
3743 (Plugin_manager::cleanup_done): New field.
3745 2008-12-23 Cary Coutant <ccoutant@google.com>
3747 * plugin.cc (is_visible_from_outside): New function.
3748 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3749 so we don't return "IR only" status for exported symbols or -r links.
3751 * testsuite/Makefile.am (plugin_test_3): New test case.
3752 * testsuite/Makefile.in: Regenerate.
3753 * testsuite/plugin_test_3.sh: New file.
3755 2008-12-22 Cary Coutant <ccoutant@google.com>
3757 * object.cc (Sized_relobj::layout_section): New function.
3758 (Sized_relobj::do_layout): Defer layout of input sections until after
3759 plugin has provided replacement files.
3760 (Sized_relobj::do_layout_deferred_sections): New function.
3761 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3762 (Relobj::layout_deferred_sections): New function.
3763 (Relobj::do_layout_deferred_sections): New function.
3764 (Sized_relobj::do_layout_deferred_sections): New function.
3765 (Sized_relobj::layout_section): New function.
3766 (Sized_relobj::Deferred_layout): New structure.
3767 (Sized_relobj::deferred_layout_): New field.
3768 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3769 Change all callers. Layout deferred sections.
3770 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
3772 (Plugin_hook::run): Move code from do_plugin_hook inline.
3773 (Plugin_hook::do_plugin_hook): Remove.
3774 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3775 (Plugin_manager::finish): Renamed, was cleanup.
3776 (Plugin_manager::should_defer_layout): New function.
3777 (Plugin_manager::add_deferred_layout_object): New function.
3778 (Plugin_manager::Deferred_layout_list): New type.
3779 (Plugin_manager::deferred_layout_objects_): New field.
3780 (Plugin_hook::do_plugin_hook): Remove.
3782 2008-12-17 Ian Lance Taylor <iant@google.com>
3784 * options.h (class General_options): Add --no case for
3787 2008-12-16 Cary Coutant <ccoutant@google.com>
3789 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3791 (Plugin_manager::claim_file): Create plugin object even if
3792 plugin did not call the add_symbols callback.
3793 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
3794 asking for more symbols than were added.
3795 * testsuite/Makefile.am (plugin_test_1): Add test case with
3797 (empty.syms): New target.
3798 * testsuite/Makefile.in: Regenerate.
3799 * testsuite/plugin_test.c (claim_file_hook): Add new debug
3800 message. Don't call add_symbols if no globals.
3801 (all_symbols_read_hook): Don't provide replacement for empty
3804 2008-12-12 Ian Lance Taylor <iant@google.com>
3806 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
3807 r_type == 0 for a local symbol with r_sym == 0.
3808 (scan_relocatable_relocs): Pass r_sym to
3809 local_non_section_strategy.
3810 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
3813 * configure.ac: Update test for TLS descriptors: they are
3814 supported as of glibc 2.9.
3815 * configure: Rebuild.
3817 2008-12-11 Ian Lance Taylor <iant@google.com>
3820 * target-reloc.h (Default_scan_relocatable_relocs): For each
3821 function, map r_type == 0 to RELOC_DISCARD.
3823 2008-12-10 Cary Coutant <ccoutant@google.com>
3825 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
3826 object to override a kept COMDAT group from a plugin object.
3828 2008-12-09 Ian Lance Taylor <iant@google.com>
3831 * yyscript.y (file_cmd): Handle INPUT.
3833 * testsuite/initpri1.c: Change all declarations to be full
3834 prototypes by adding void, to avoid compiler warnings.
3836 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
3838 * options.cc (General_options::parse_plugin_opt): New.
3839 (General_options::add_plugin): The argument now is just the filename.
3840 (General_options::add_plugin_option): New.
3841 * options.h (plugin_opt): New.
3842 (add_plugin): Change argument name.
3843 (add_plugin_option): New.
3844 * plugin.cc (Plugin::load): Don't parse the plugin option.
3845 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
3846 (Plugin::add_option): New.
3847 (Plugin::args_): Change type.
3848 (Plugin::filename_): New.
3849 (Plugin_manager::add_plugin_option): New.
3850 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
3851 * testsuite/Makefile.in: Regenerate.
3853 2008-12-05 Cary Coutant <ccoutant@google.com>
3855 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
3856 Handle --strip-lto-sections option.
3857 * options.h (strip_lto_sections): New option.
3859 2008-12-01 Cary Coutant <ccoutant@google.com>
3861 * plugin.cc (ld_plugin_message): Change format parameter to const.
3862 Fix mismatch between new[] and delete.
3864 2008-11-14 Cary Coutant <ccoutant@google.com>
3866 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
3869 2008-11-05 Craig Silverstein <csilvers@google.com>
3871 * options.cc (General_options::parse_dynamic_list): New function.
3872 * options.h (General_options): New flags dynamic_list,
3873 dynamic_list_data, dynamic_list_cpp_new, and
3874 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
3875 (General_options::in_dynamic_list): New function.
3876 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
3877 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
3878 (Lex::can_continue_name): Likewise.
3880 (read_script_file): New parameter script_options.
3881 (read_dynamic_list): New function.
3882 (Script_options::define_dynamic_list): New function.
3883 (dynamic_list_keyword_parsecodes): New variable.
3884 (dynamic_list_keywords): New variable.
3885 * script.h (Script_options::define_dynamic_list): New function
3887 (read_dynamic_list): New function prototype.
3888 * symtab.cc (strprefix): New macro.
3889 (Symbol::should_add_dynsym_entry): Support dynamic_list,
3890 dynamic_list_data, dynamic_list_cpp_new, and
3891 dynamic_list_cpp_typeinfo.
3892 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
3893 (dynamic_list_expr): New rule.
3894 (dynamic_list_nodes): Likewise.
3895 (dynamic_list_node): Likewise.
3896 * testsuite/Makefile.am (dynamic_list): New test.
3897 * testsuite/Makefile.in: Regenerated.
3898 * testsuite/dynamic_list.t: New file.
3899 * testsuite/dynamic_list.sh: New file.
3901 2008-11-05 Craig Silverstein <csilvers@google.com>
3903 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
3904 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
3905 (t11_last): Likewise.
3906 * testsuite/ver_test_6.c (main): Likewise.
3908 2008-10-07 Cary Coutant <ccoutant@google.com>
3910 * options.c (General_options::finalize): Add check for -static and
3912 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
3915 2008-10-02 Cary Coutant <ccoutant@google.com>
3917 * plugin.cc (make_sized_plugin_object): Fix conditional
3918 compilation to work when not all targets are enabled.
3920 2008-09-29 Cary Coutant <ccoutant@google.com>
3922 * archive.cc (Archive::get_file_and_offset): Use filename instead
3923 of name to get library path.
3924 (Archive::include_member): Unlock external member of a thin archive.
3926 * testsuite/Makefile.am (TEST_AR): New variable.
3927 (thin_archive_test_1): New test.
3928 (thin_archive_test_2): New test.
3929 * testsuite/Makefile.in: Regenerate.
3930 * testsuite/thin_archive_main.cc: New file.
3931 * testsuite/thin_archive_test_1.cc: New file.
3932 * testsuite/thin_archive_test_2.cc: New file.
3933 * testsuite/thin_archive_test_3.cc: New file.
3934 * testsuite/thin_archive_test_4.cc: New file.
3936 2008-09-29 Cary Coutant <ccoutant@google.com>
3938 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
3939 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
3941 (Sized_relobj::do_finalize_local_symbols): Likewise.
3942 (Sized_relobj::map_to_kept_section): Likewise.
3943 * object.h (Sized_relobj::invalid_address): New constant.
3944 (Sized_relobj::do_output_section_offset): Check for invalid_address
3946 * output.cc (Output_reloc::local_section_offset): Use constant
3947 invalid_address instead of -1U.
3948 (Output_reloc::get_address): Likewise.
3949 (Output_section::output_address): Change -1U to -1ULL.
3950 * output.h (Output_reloc::invalid_address): New constant.
3951 * reloc.cc (Sized_relobj::write_sections): Use constant
3952 invalid_address instead of -1U.
3953 (Sized_relobj::relocate_sections): Likewise.
3954 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
3955 values for merge sections.
3956 * target-reloc.h (relocate_for_relocatable): Use constant
3957 invalid_address instead of -1U.
3959 2008-09-19 Cary Coutant <ccoutant@google.com>
3961 Add plugin functionality for link-time optimization (LTO).
3962 * configure.ac (plugins): Add --enable-plugins option.
3963 * configure: Regenerate.
3964 * config.in: Regenerate.
3965 * Makefile.am (LIBDL): New variable.
3966 (CCFILES): Add plugin.cc.
3967 (HFILES): Add plugin.h.
3968 (ldadd_var): Add LIBDL.
3969 * Makefile.in: Regenerate.
3971 * archive.cc: Include "plugin.h".
3972 (Archive::setup): Don't preread archive symbols when using a plugin.
3973 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
3974 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
3976 (Archive::include_member): Add symbols from plugin objects.
3977 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
3978 * descriptors.cc (Descriptors::open): Check for file descriptors
3979 abandoned by plugins.
3980 (Descriptors::claim_for_plugin): New function.
3981 * descriptors.h (Descriptors::claim_for_plugin): New function.
3982 (Open_descriptor::is_claimed): New field.
3983 (claim_descriptor_for_plugin): New function.
3984 * fileread.cc (File_read::claim_for_plugin): New function.
3985 * fileread.h (File_read::claim_for_plugin): New function.
3986 (File_read::descriptor): New function.
3987 * gold.cc: Include "plugin.h".
3988 (queue_initial_tasks): Add task to call plugin hooks for generating
3990 * main.cc: Include "plugin.h".
3991 (main): Load plugin libraries.
3992 * object.h (Pluginobj): Declare.
3993 (Object::pluginobj): New function.
3994 (Object::do_pluginobj): New function.
3995 (Object::set_target): New function.
3996 * options.cc: Include "plugin.h".
3997 (General_options::parse_plugin): New function.
3998 (General_options::General_options): Initialize plugins_ field.
3999 (General_options::add_plugin): New function.
4000 * options.h (Plugin_manager): Declare.
4001 (General_options): Add --plugin option.
4002 (General_options::has_plugins): New function.
4003 (General_options::plugins): New function.
4004 (General_options::add_plugin): New function.
4005 (General_options::plugins_): New field.
4006 * plugin.cc: New file.
4007 * plugin.h: New file.
4008 * readsyms.cc: Include "plugin.h".
4009 (Read_symbols::do_read_symbols): Check for archive before checking
4010 for ELF file. Call plugin hooks to claim files.
4011 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4012 from a real object file; force override when processing replacement
4014 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4015 (Symbol::init_base_object): Likewise.
4016 (Symbol::init_base_output_data): Likewise.
4017 (Symbol::init_base_output_segment): Likewise.
4018 (Symbol::init_base_constant): Likewise.
4019 (Symbol::init_base_undefined): Likewise.
4020 (Symbol::output_section): Assert that object is not a plugin.
4021 (Symbol_table::add_from_pluginobj): New function.
4022 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4024 (Symbol_table::sized_write_globals): Likewise.
4025 (Symbol_table::add_from_pluginobj): Instantiate template.
4026 * symtab.h (Sized_pluginobj): Declare.
4027 (Symbol::in_real_elf): New function.
4028 (Symbol::set_in_real_elf): New function.
4029 (Symbol::in_real_elf_): New field.
4030 (Symbol_table::add_from_pluginobj): New function.
4032 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4033 (LIBDL): New variable.
4035 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4036 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4037 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4038 (MOSTLYCLEANFILES): Likewise.
4039 * testsuite/Makefile.in: Regenerate.
4040 * testsuite/plugin_test.c: New file.
4041 * testsuite/plugin_test_1.sh: New file.
4042 * testsuite/plugin_test_2.sh: New file.
4044 2008-09-16 Ian Lance Taylor <iant@google.com>
4046 * target-reloc.h (relocate_section): Check whether a symbol is
4047 defined by the ABI before reporting an undefined symbol error.
4048 * target.h (Target::is_defined_by_abi): Make parameter const.
4049 (Target::do_is_defined_by_abi): Likewise.
4050 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4051 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4052 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4053 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4054 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4055 * testsuite/Makefile.in: Rebuild.
4057 * fileread.cc (make_view): Add casts to avoid warning.
4059 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4061 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4062 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4064 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4066 * options.h (General_options::output_is_executable): New.
4067 (General_options::output_is_pie): New.
4068 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4069 for shared libraries.
4070 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4072 2008-09-11 Chris Demetriou <cgd@google.com>
4074 * options.h (origin): New -z option.
4075 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4076 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4079 2008-09-05 Cary Coutant <ccoutant@google.com>
4081 * fileread.cc (File_read::make_view): Add check for attempt to map
4084 2008-09-05 Cary Coutant <ccoutant@google.com>
4086 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4087 explicit instantiations.
4089 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4092 * options.cc (General_options::finalize): Allow undefined symbols
4093 in shlibs if linking -shared.
4096 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4097 symbols as not needing a dynsym entry.
4099 2008-08-20 Craig Silverstein <csilvers@google.com>
4101 * fileread.cc (File_read::open): Do not lock the file unless it
4102 was successfully opened.
4104 2008-08-14 Cary Coutant <ccoutant@google.com>
4106 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4107 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4108 * testsuite/tls_test.cc (struct int128): 128-bit struct
4109 for testing TLS relocs with non-zero addend.
4110 (v12): New TLS variable.
4112 (t_last): Add check for v12.
4113 * testsuite/tls_test.h (t12): New function.
4114 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4116 2008-08-13 Ian Lance Taylor <iant@google.com>
4118 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4119 set tls_segment_ or relro_segment_.
4120 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4122 * output.h (Output_section::clear_is_relro): New function.
4123 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4124 sections specially even when output_data_ is empty.
4125 (Output_segment::maximum_alignment): When first section is relro,
4126 only force alignment for PT_LOAD segments.
4127 * script.cc (script_data_segment_align): New function.
4128 (script_data_segment_relro_end): New function.
4129 * script-c.h (script_data_segment_align): Declare.
4130 (script_data_segment_relro_end): Declare.
4131 * script-sections.h (class Script_sections): Declare
4132 data_segment_align and data_segment_relro_end. Add fields
4133 segment_align_index_ and saw_relro_end_.
4134 * script-sections.cc (class Sections_element): Add set_is_relro
4135 virtual function. Add new bool* parameter to place_orphan_here.
4136 Add get_output_section virtual function.
4137 (class Output_section_definition): Add set_is_relro. Add new
4138 bool* parameter to place_orphan_here. Add get_output_section.
4139 Add is_relro_ field.
4140 (Output_section_definition::Output_section_definition): Initialize
4141 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4142 and is_relro_ fields.
4143 (Output_section_definition::place_orphan_here): Add is_relro
4145 (Output_section_definition::set_section_addresses): Set relro for
4147 (Output_section_definition::alternate_constraint): Likewise.
4148 (class Orphan_output_section): Add new bool* parameter to
4149 place_orphan_here. Add get_output_section.
4150 (Orphan_output_section::place_orphan_here): Add is_relro
4152 (Script_sections::Script_sections): Initialize
4153 data_segment_align_index_ and saw_relro_end_.
4154 (Script_sections::data_segment_align): New function.
4155 (Script_sections::data_segment_relro_end): New function.
4156 (Script_sections::place_orphan): Set or clear is_relro.
4157 (Script_sections::set_section_addresses): Force alignment of first
4159 * yyscript.y (exp): Call script_data_segment_align and
4160 script_data_segment_relro_end.
4161 * testsuite/relro_script_test.t: New file.
4162 * testsuite/relro_test.cc (using_script): Declare.
4163 (t1, t2): Test using_script.
4164 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4165 (relro_script_test_SOURCES): Define.
4166 (relro_script_test_DEPENDENCIES): Define.
4167 (relro_script_test_LDFLAGS): Define.
4168 (relro_script_test_LDADD): Define.
4169 (relro_script_test.so): New target.
4170 * testsuite/Makefile.in: Rebuild.
4172 2008-08-06 Cary Coutant <ccoutant@google.com>
4174 * archive.cc (Archive::total_archives, Archive::total_members)
4175 (Archive::total_members_loaded): New variables.
4176 (Archive::setup): Add parameter. Add option to preread
4178 (Archive::read_armap): Add counter.
4179 (Archive::get_file_and_offset): New function.
4180 (Archive::get_elf_object_for_member): New function.
4181 (Archive::read_all_symbols): New function.
4182 (Archive::read_symbols): New function.
4183 (Archive::add_symbols): Add counters.
4184 (Archive::include_all_members): Use armap to find members if it's
4186 (Archive::include_member): Skip reading symbols if already read.
4187 Factored code into Archive::get_file_and_offset and
4188 Archive::get_elf_object_for_member. Changed call to
4189 Mapfile::report_include_archive_member.
4190 (Archive::print_stats): New function.
4191 * archive.h: Declare Object and Read_symbols_data classes.
4192 (Archive::Archive): Add initializers for new members.
4193 (Archive::setup): Add parameter.
4194 (Archive::print_stats): New function.
4195 (Archive::total_archives, Archive::total_members)
4196 (Archive::total_members_loaded): New variables.
4197 (Archive::get_file_and_offset): New function.
4198 (Archive::get_elf_object_for_member): New function.
4199 (Archive::read_all_symbols): New function.
4200 (Archive::read_symbols): New function.
4201 (Archive::Archive_member): New class.
4202 (Archive::members_): New member.
4203 (Archive::num_members_): New member.
4204 * main.cc: Include archive.h.
4205 (main): Call Archive::print_stats.
4206 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4207 archive parameter; member_name is now the fully-decorated name.
4208 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4209 * options.h: (General_options): Add --preread-archive-symbols option.
4210 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4213 2008-08-04 Ian Lance Taylor <iant@google.com>
4215 * symtab.h (Symbol::use_plt_offset): New function.
4216 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4217 * powerpc.cc (Relocate::relocate): Likewise.
4218 * sparc.cc (Relocate::relocate): Likewise.
4219 * x86_64.cc (Relocate::relocate): Likewise.
4220 * testsuite/weak_plt.sh: New test.
4221 * testsuite/weak_plt_main.cc: New test.
4222 * testsuite/weak_plt_shared.cc: New test.
4223 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4224 (check_PROGRAMS): Add weak_plt.
4225 (check_DATA): Add weak_plt_shared.so.
4226 (weak_plt_main_pic.o, weak_plt): New targets.
4227 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4228 * testsuite/Makefile.in: Rebuild.
4230 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4232 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4233 * testsuite/Makefile.in: Rebuild.
4235 2008-08-04 Alan Modra <amodra@bigpond.net.au>
4237 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4238 * Makefile.in: Regenerate.
4239 * po/POTFILES.in: Regenerate.
4241 2008-07-29 Ian Lance Taylor <iant@google.com>
4243 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4244 symbols before other symbols.
4245 * testsuite/script_test_2.cc (test_addr): Declare.
4246 (test_addr_alias): Declare.
4247 (main): Check that test_addr and test_addr_alias have the right
4249 * testsuite/script_test_2.t: Define test_addr_alias and
4252 2008-07-24 Ian Lance Taylor <iant@google.com>
4255 * descriptors.cc: New file.
4256 * descriptors.h: New file.
4257 * gold-threads.h (class Hold_optional_lock): New class.
4258 * fileread.cc: Include "descriptors.h".
4259 (File_read::~File_read): Release descriptor rather than closing
4261 (File_read::open) [file]: Call open_descriptor rather than open.
4262 Set is_descriptor_opened_.
4263 (File_read::open) [memory]: Assert that descriptor is not open.
4264 (File_read::reopen_descriptor): New function.
4265 (File_read::release): Release descriptor.
4266 (File_read::do_read): Make non-const. Reopen descriptor.
4267 (File_read::read): Make non-const.
4268 (File_read::make_view): Reopen descriptor.
4269 (File_read::do_readv): Likewise.
4270 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4271 Update declarations.
4272 * layout.cc: Include "descriptors.h".
4273 (Layout::create_build_id): Use open_descriptor rather than open.
4274 * output.cc: Include "descriptors.h".
4275 (Output_file::open): Use open_descriptor rather than open.
4276 * archive.cc (Archive::const_iterator): Change Archive to be
4278 (Archive::begin, Archive::end): Make non-const.
4279 (Archive::count_members): Likewise.
4280 * archive.h (class Archive): Update declarations.
4281 * object.h (Object::read): Make non-const.
4282 * Makefile.am (CCFILES): Add descriptors.cc.
4283 (HFILES): Add descriptors.h.
4284 * Makefile.in: Rebuild.
4287 * gold.h: Always include <clocale>. Add Solaris workarounds
4288 following code in binutils/sysdep.h.
4291 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4292 this->eh_frame_hdr_ is NULL before using it.
4294 * dynobj.cc (Versions::Versions): Update comment.
4296 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4297 the base version name.
4299 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4300 array size plus one.
4301 (Stringpool_template::set_string_offsets): Subtract one from key
4302 before using it as an array index.
4303 (Stringpool_template::get_offset_with_length): Likewise.
4304 (Stringpool_template::write_to_buffer): Likewise.
4305 * stringpool.h (Stringpool_template::get_offset_from_key):
4308 2008-07-23 Ian Lance Taylor <iant@google.com>
4311 * object.h (Merged_symbol_value::value): Do our best to handle a
4315 * script.cc (Version_script_info::get_versions): Don't add empty
4316 version tag to return value.
4317 (Version_script_info::get_symbol_version_helper): Change return
4318 type to bool. Add pversion parameter. Change all callers.
4319 (script_register_vers_node): Don't require a non-NULL tag.
4320 * script.h (class Version_script_info): Update declarations.
4321 (Version_script_info::get_symbol_version): Change return type to
4322 bool. Add version parameter. Change all callers.
4323 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4324 handling. Handle an empty version from a version script.
4325 (Symbol_table::define_special_symbol): Likewise.
4326 * testsuite/ver_test_10.script: New file.
4327 * testsuite/ver_test_10.sh: New file.
4328 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4329 (check_DATA): Add ver_test_10.syms.
4330 (ver_test_10.syms, ver_test_10.so): New target.
4331 * testsuite/Makefile.in: Rebuild.
4333 2008-07-23 Simon Baldwin <simonb@google.com>
4335 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4336 to zero for undefined symbols from dynamic libraries.
4338 2008-07-23 Ian Lance Taylor <iant@google.com>
4340 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4342 * symtab.h (class Symbol_table): Update declaration.
4343 * testsuite/ver_test_9.cc: New file.
4344 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4345 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4346 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4347 (ver_test_9.so, ver_test_9.o): New targets.
4348 * testsuite/Makefile.in: Rebuild.
4350 2008-07-22 Ian Lance Taylor <iant@google.com>
4352 * options.h (class General_options): Define --check-sections.
4353 * layout.cc (Layout::set_segment_offsets): Handle
4356 * options.h (class General_options): Define -n/--nmagic and
4358 * options.cc (General_options::finalize): For -n/--nmagic or
4359 -N/--omagic, set -static.
4360 * layout.cc (Layout::attach_allocated_section_to_segment): If
4361 -N/--omagic, don't put read-only and read-write sections in
4363 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4364 finding a read-only segment.
4365 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4366 don't set the minimum segment alignment to the common page size,
4367 and don't set the file offset to the address modulo the page size.
4368 * script-sections.cc (Script_sections::create_segments): If
4369 -n/--omagic, don't put read-only and read-write sections in
4372 * cref.cc: New file.
4374 * options.h (class General_options): Add --print-symbol-counts.
4375 * main.cc (main): Issue defined symbol report if requested.
4376 * archive.cc (Archive::interpret_header): Make into a const member
4378 (Archive::add_symbols): Call Input_objects::archive_start and
4380 (Archive::const_iterator): Define new class.
4381 (Archive::begin, Archive::end): New functions.
4382 (Archive::include_all_members): Rewrite to use iterator.
4383 (Archive::count_members): New function.
4384 * archive.h (class Archive): Update declarations.
4385 (Archive::filename): New function.
4386 * object.cc: Include "cref.h".
4387 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4388 (Sized_relobj::do_get_global_symbol_counts): New function.
4389 (Input_objects::add_object): Add object to cross-referencer.
4390 (Input_objects::archive_start): New function.
4391 (Input_objects::archive_stop): New function.
4392 (Input_objects::print_symbol_counts): New function.
4393 * object.h: Declare Cref and Archive.
4394 (Object::get_global_symbol_counts): New function.
4395 (Object::do_get_global_symbol_counts): New pure virtual function.
4396 (class Sized_relobj): Add defined_count_ field. Update
4398 (class Input_objects): Add cref_ field. Update constructor.
4399 Update declarations.
4400 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4402 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4404 (Sized_dynobj::do_get_global_symbol_counts): New function.
4405 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4406 defined_count_. Update declarations. Define Symbols typedef.
4407 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4408 parameter. Change all callers.
4409 (Symbol_table::add_from_dynobj): Add sympointers and defined
4410 parameters. Change all callers.
4411 * symtab.h (class Symbol_table): Update declarations.
4412 * Makefile.am (CCFILES): Add cref.cc.
4413 (HFILES): Add cref.h.
4414 * Makefile.in: Rebuild.
4416 2008-07-22 Simon Baldwin <simonb@google.com>
4418 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4419 to zero when writing undefined symbols.
4421 2008-07-22 Ian Lance Taylor <iant@google.com>
4423 * output.cc (Output_section::add_input_section): Don't try to
4424 merge empty merge sections.
4426 2008-07-21 Craig Silverstein <csilvers@google.com>
4428 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4429 Include symbol version in error message.
4431 2008-07-20 Chris Demetriou <cgd@google.com>
4433 * configure.ac (gold_cv_c_random_seed): New configured variable.
4434 (RANDOM_SEED_CFLAGS): New substituted variable.
4435 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4436 * configure: Rebuild.
4437 * Makefile.in: Likewise.
4438 * testsuite/Makefile.in: Likewise.
4440 2008-07-18 Ian Lance Taylor <iant@google.com>
4442 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4443 where we see NAME/NULL and NAME/VERSION as separate symbols.
4444 * testsuite/ver_test_main.cc (main): Call t4.
4445 (t4, t4_2a): Define.
4446 * testsuite/ver_test_2.cc (t4_2): Define.
4447 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4448 * testsuite/ver_test_4.cc (t4_2a): Define.
4449 * testsuite/ver_test_4.script: Put t4_2a in VER2.
4450 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4452 2008-07-17 Ian Lance Taylor <iant@google.com>
4454 * dynobj.cc (Versions::add_def): If we give an error about a
4455 missing version, go ahead and create the version anyhow.
4457 2008-07-10 Ian Lance Taylor <iant@google.com>
4459 Handle output sections with more than 0x7fffffff bytes.
4460 * object.h (class Relobj): Change map_to_output_ to
4461 output_sections_, and just keep a section pointer. Change all
4462 uses. Move comdat group support to Sized_relobj.
4463 (Relobj::is_section_specially_mapped): Remove.
4464 (Relobj::output_section): Remove poff parameter. Change all
4466 (Relobj::output_section_offset): New function.
4467 (Relobj::set_section_offset): Rewrite.
4468 (Relobj::map_to_output): Remove.
4469 (Relobj::output_sections): New function.
4470 (Relobj::do_output_section_offset): New pure virtual function.
4471 (Relobj::do_set_section_offset): Likewise.
4472 (class Sized_relobj): Add section_offsets_ field. Add comdat
4473 group support from Relobj. Update declarations.
4474 (Sized_relobj::get_output_section_offset): New function.
4475 (Sized_relobj::do_output_section_offset): New function.
4476 (Sized_relobj::do_set_section_offset): New function.
4477 * object.cc (Relobj::output_section_address): Remove.
4478 (Sized_relobj::Sized_relobj): Initialize new fields.
4479 (Sized_relobj::include_section_group): Cast find_kept_object to
4481 (Sized_relobj::include_linkonce_section): Likewise.
4482 (Sized_relobj::do_layout): Use separate arrays for output section
4484 (Sized_relobj::do_count_local_symbols): Change map_to_output to
4486 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4487 output_sections and section_offsets.
4488 (Sized_relobj::write_local_symbols): Likewise.
4489 (map_to_kept_section): Compute output address directly.
4490 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4491 output_sections and section_offsets.
4492 (Sized_relobj::write_sections): Likewise.
4493 (Sized_relobj::relocate_sections): Likewise.
4494 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4495 * output.h (class Output_reloc): Update declarations. Change
4496 u2_.relobj to Sized_relobj*.
4497 (class Output_data_reloc): Change add functions to use
4499 * output.cc (Output_reloc::Output_reloc): Change relobj to
4501 (Output_reloc::local_section_offset): Change return type to
4502 Elf_Addr. Use get_output_section_offset.
4503 (Output_reloc::get_address): Likewise.
4504 (Output_section::is_input_address_mapped): Don't call
4505 is_section_specially_mapped.
4506 (Output_section::output_offset): Likewise.
4507 (Output_section::output_address): Likewise.
4508 (Output_section::starting_output_address): Likewise.
4509 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4510 parameter to Sized_relobj*.
4511 (Copy_relocs::need_copy_reloc): Likewise.
4512 (Copy_relocs::save): Likewise.
4513 * copy-relocs.h (class Copy_relocs): Update declarations.
4514 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4515 Sized_relobj*. Change relobj_ field to Sized_relobj*.
4516 * target-reloc.h (relocate_for_relocatable): Change
4517 offset_in_output_section type to Elf_Addr. Change code that uses
4519 * layout.cc (Layout::layout): Always set *off.
4520 * mapfile.cc (Mapfile::print_input_section): Use
4521 output_section_offset.
4522 * i386.cc (Target_i386::copy_reloc): Change object parameter to
4524 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
4525 * sparc.cc (Target_sparc::copy_reloc): Likewise.
4526 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
4528 2008-07-03 Ian Lance Taylor <iant@google.com>
4530 * layout.cc (Layout::include_section): Do not discard unrecognized
4531 SHT_STRTAB sections.
4533 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
4535 * script.cc (Lex::can_continue_name): Make '?' allowable in
4536 version-script names.
4537 * testsuite/version_script.map: Change glob pattern to use '?'
4539 2008-06-30 Manish Singh <yosh@gimp.org>
4542 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
4545 2008-06-30 Ian Lance Taylor <iant@google.com>
4549 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
4550 versions]: Don't try to read the value in the contents, since we
4551 don't use it. Use the template endianness when writing.
4553 2008-06-25 Cary Coutant <ccoutant@google.com>
4555 * fileread.cc (File_read::make_view): Assert on zero-length view.
4556 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
4557 symbol table when there are no symbols to read.
4559 2008-06-23 Craig Silverstein <csilvers@google.com>
4561 * version.cc (version_string): Bump to 1.7
4563 2008-06-18 Craig Silverstein <csilvers@google.com>
4565 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4566 constant 0xFFFF to type Valtype.
4567 (Powerpc_relocate_functions::rel16_ha): Likewise.
4569 2008-06-17 Ian Lance Taylor <iant@google.com>
4571 * output.h (Output_section::Input_section): Initialize p2align_ to
4572 zero for Output_section_data constructors.
4573 (Output_section::Input_section::addralign): If not an input
4574 section, return the alignment of the Output_section_data.
4575 * testsuite/copy_test.cc: New file.
4576 * testsuite/copy_test_1.cc: New file.
4577 * testsuite/copy_test_2.cc: New file.
4578 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
4579 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
4580 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
4581 (copy_test_1_pic.o, copy_test_1.so): New targets.
4582 (copy_test_2_pic.o, copy_test_2.so): New targets.
4583 * testsuite/Makefile.in: Rebuild.
4585 * script-sections.cc (Script_sections::place_orphan): Initialize
4586 local variable exact.
4588 2008-06-13 David Edelsohn <edelsohn@gnu.org>
4590 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
4592 2008-06-12 David Edelsohn <edelsohn@gnu.org>
4593 David S. Miller <davem@davemloft.net>
4595 * powerpc.cc: New file.
4596 * Makefile.am (TARGETSOURCES): Add powerpc.cc
4597 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4598 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4599 * Makefile.in: Rebuild.
4601 2008-06-09 Ian Lance Taylor <iant@google.com>
4603 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4605 (throwing, orig_terminate): New static variables.
4606 (terminate_handler): New static function.
4607 (t2): Set terminate handler.
4609 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
4612 * binary.cc (Binary_to_elf::sized_convert): Fix .data
4615 2008-05-30 Cary Coutant <ccoutant@google.com>
4617 * archive.cc (Archive::include_all_members) Correct to step
4618 over symbol table and extended name table in thin archives.
4620 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
4623 * target-reloc.h (relocate_for_relocatable): Fix new_offset
4626 2008-05-28 Caleb Howe <cshowe@google.com>
4628 * reduced_debug_output.cc: New file.
4629 * reduced_debug_output.h: New file.
4630 * options.h (class General_options): Add --strip-debug-non-line.
4631 * options.cc (General_options::finalize): Add strip_debug_non_line
4632 to the strip heirarchy.
4633 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
4635 * layout.cc: Include "reduced_debug_output.h".
4636 (Layout::Layout): Initialize new fields.
4637 (line_only_debug_sections): New static array.
4638 (is_lines_only_debug_sections): New static inline function.
4639 (Layout::include_section): Handle --strip-debug-non-line.
4640 (Layout::make_output_section): If --strip-debug-non-line, build
4641 new output sections for .debug_abbrev and .debug_info.
4642 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
4643 gold. Warn about possible overflow.
4644 (read_signed_LEB_128): Likewise.
4645 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
4646 (read_signed_LEB_128): Declare.
4647 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
4648 (HFILES): Add reduced_debug_output.h.
4649 * Makefile.in: Rebuild.
4651 2008-05-21 Ian Lance Taylor <iant@google.com>
4653 * mapfile.cc: New file.
4654 * mapfile.h: New file.
4655 * options.h (class General_options): Add -M/--print-map and -Map.
4656 * options.cc (General_options::finalize): Make -M equivalent to
4658 * main.cc: Include <cstdio> and "mapfile.h".
4659 (main): Open mapfile if requested.
4660 * gold.cc (class Middle_runner): Add mapfile_ field. Update
4661 constructor. Change caller.
4662 (queue_initial_tasks): Add mapfile parameter. Change caller.
4663 (queue_middle_tasks): Likewise.
4664 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4666 * archive.cc: Include "mapfile.h".
4667 (Archive::add_symbols): Add mapfile parameter. Change all
4668 callers. Pass mapfile, symbol, and reason to include_member.
4669 (Archive::include_all_members): Add mapfile parameter. Change all
4671 (Archive::include_member): Add mapfile, sym, and why parameters.
4672 Change all callers. Report inclusion to map file.
4673 * archive.h: Include "fileread.h".
4674 (class Archive): Update declarations.
4675 (Archive::file): New const method.
4676 (class Add_archive_symbols): Add mapfile_ field. Update
4677 constructor. Change all callers.
4678 * readsyms.h (class Read_symbols): Likewise.
4679 (class Finish_group): Likewise.
4680 (class Read_script): Likewise.
4681 * common.cc: Include "mapfile.h".
4682 (Symbol_table::allocate_commons): Add mapfile parameter. Change
4684 (Symbol_table::do_allocate_commons): Likewise.
4685 (Symbol_table::do_allocate_commons_list): Likewise. Report common
4686 symbol allocation to mapfile.
4687 * common.h (class Allocate_commons_task): Add mapfile_ field.
4688 Update constructor. Change all callers.
4689 * symtab.h (class Symbol_table): Update declarations.
4690 * layout.cc: Include "mapfile.h".
4691 (Layout_task_runner::run): Print information to mapfile.
4692 (Layout::create_gold_note): Change Output_data_fixed_space to
4693 Output_data_zero_fill.
4694 (Layout::create_build_id): Likewise.
4695 (Layout::print_to_mapfile): New function.
4696 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
4697 constructor. Change caller.
4698 (class Layout): Declare print_to_mapfile.
4699 * output.cc (Output_section::Input_section::print_to_mapfile): New
4701 (Output_section::add_input_section): If producing a map, always
4702 add to input_sections_ list.
4703 (Output_section::do_print_to_mapfile): New function.
4704 (Output_segment::print_sections_to_mapfile): New function.
4705 (Output_segment::print_section_list_to_mapfile): New function.
4706 * output.h: Include "mapfile.h".
4707 (Output_data::print_to_mapfile): New function.
4708 (Output_data::do_print_to_mapfile): New virtual function.
4709 (Output_segment_headers::do_print_to_mapfile): New function.
4710 (Output_file_header::do_print_to_mapfile): New function.
4711 (Output_data_const::do_print_to_mapfile): New function.
4712 (class Output_data_const_buffer): Add map_name_ field. Update
4713 constructor. Change all callers. Add do_print_to_mapfile
4715 (class Output_data_fixed_space): Likewise.
4716 (class Output_data_space): Likewise.
4717 (class Output_data_zero_fill): New class.
4718 (Output_data_strtab::do_print_to_mapfile): New function.
4719 (Output_data_reloc_base::do_print_to_mapfile): New function.
4720 (Output_relocatable_relocs::do_print_to_mapfile): New function.
4721 (Output_data_group::do_print_to_mapfile): New function.
4722 (Output_data_got::do_print_to_mapfile): New function.
4723 (Output_data_dynamic::do_print_to_mapfile): New function.
4724 (Output_symtab_xindex::do_print_to_mapfile): New function.
4725 (class Output_section): Declare do_print_to_mapflie. Declare
4726 print_to_mapfile in Input_section.
4727 (class Output_segment): Declare new functions.
4728 * object.h (Sized_relobj::symbol_count): New function.
4729 * script-sections.cc
4730 (Output_section_element_dot_assignment::set_section_addresses):
4731 Change Output_data_fixed_space to Output_data_zero_fill.
4732 (Output_data_expression::do_print_to_mapfile): New function.
4733 * script.cc (read_input_script): Add mapfile parameter. Change
4735 * script.h (read_input_script): Update declaration.
4736 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4737 (Eh_frame::do_print_to_mapfile): New function.
4738 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4739 (Output_merge_string::do_print_to_mapfile): New function.
4740 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4742 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4744 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4746 * Makefile.am (CCFILES): Add mapfile.cc.
4747 (HFILES): Add mapfile.h.
4748 * Makefile.in: Rebuild.
4750 2008-05-19 Ian Lance Taylor <iant@google.com>
4752 * options.h (class General_options): Add -z relro.
4753 * layout.cc (Layout::Layout): Initialize relro_segment_.
4754 (Layout::add_output_section_data): Return the output section.
4755 (Layout::make_output_section): Rcognize relro sections and mark
4757 (Layout::attach_allocated_section_to_segment): Put relro sections
4758 in a PT_GNU_RELRO segment.
4759 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4761 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4763 (Layout::linkonce_mapping): Map d.rel.ro.local to
4765 (Layout::output_section_name): Us .data.rel.ro.local for any
4766 section which begins with that.
4767 * layout.h (class Layout): Update add_output_section_data
4768 declaration. Add relro_segment_ field.
4769 * output.cc (Output_section::Output_section): Initialize is_relro_
4770 and is_relro_local_ fields.
4771 (Output_segment::add_output_section): Group relro sections.
4772 (Output_segment::is_first_section_relro): New function.
4773 (Output_segment::maximum_alignment): If there is a relro section,
4774 align the segment to the common page size.
4775 (Output_segment::set_section_addresses): Track whether we are
4776 looking at relro sections. If the last section is a relro
4777 section, align to the common page size.
4778 (Output_segment::set_section_list_addresses): Add in_relro
4779 parameter. Change all callers. Align to the page size when
4780 moving from relro to non-relro section.
4781 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4783 * output.h (class Output_section): Add is_relro_ and
4784 is_relro_local_ fields.
4785 (Output_section::is_relro): New function.
4786 (Output_section::set_is_relro): New function.
4787 (Output_section::is_relro_local): New function.
4788 (Output_section::set_is_relro_local): New function.
4789 (class Output_segment): Update declarations.
4790 * i386.cc (Target_i386::got_section): Mark .got section as relro.
4791 * sparc.cc (Target_sparc::got_section): Likewise.
4792 * x86_64.cc (Target_x86_64::got_section): Likewise.
4793 * testsuite/relro_test_main.cc: New file.
4794 * testsuite/relro_test.cc: New file.
4795 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
4796 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
4797 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
4798 (relro_test.so, relro_test_pic.o): New targets.
4799 * testsuite/Makefile.in: Rebuild.
4801 2008-05-16 Ian Lance Taylor <iant@google.com>
4803 * output.cc (Output_segment::add_output_section): Remove front
4805 * output.h (class Output_segment): Remove
4806 add_initial_output_section and overloaded add_output_section.
4807 Update declaration of remaining add_output_section.
4808 * layout.cc (Layout::create_interp): Call add_output_section
4809 rather than add_initial_output_section.
4810 (Layout::finish_dynamic_section): Likewise.
4812 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
4813 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
4814 know the dynamic type.
4815 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
4816 field. Initialize it in constructor.
4817 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
4818 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
4819 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
4822 * output.cc (Output_reloc::get_address): Change return type to
4824 * output.h (class Output_reloc): Update get_address declaration.
4825 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
4826 for section addresses.
4828 2008-05-09 Ian Lance Taylor <iant@google.com>
4831 * gold.cc (gold_nomem): Use return value of write.
4833 2008-05-08 Ian Lance Taylor <iant@google.com>
4835 * symtab.c (Symbol::init_base_output_data): Add version
4836 parameter. Change all callers.
4837 (Symbol::init_base_output_segment): Likewise.
4838 (Symbol::init_base_constant): Likewise.
4839 (Symbol::init_base_undefined): Likewise.
4840 (Sized_symbol::init_output_data): Likewise.
4841 (Sized_symbol::init_output_segment): Likewise.
4842 (Sized_symbol::init_constant): Likewise.
4843 (Sized_symbol::init_undefined): Likewise.
4844 (Symbol_table::do_define_in_output_data): If the new symbol has a
4845 version, mark it as the default.
4846 (Symbol_table::do_define_in_output_segment): Likewise.
4847 (Symbol_table::do_define_as_constant): Likewise.
4848 * symtab.h (class Symbol): Update declarations.
4849 (class Sized_symbol): Likewise.
4850 * resolve.cc (Symbol::override_version): New function.
4851 (Symbol::override_base): Call override_version.
4852 (Symbol::override_base_with_special): Likewise.
4853 * testsuite/ver_script_8.script: New file.
4854 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
4855 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
4856 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
4857 (ver_test_8_1.so, ver_test_8_2.so): New targets.
4859 2008-05-06 Ian Lance Taylor <iant@google.com>
4862 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
4864 (class General_options): Remove existing --undefined, and add
4865 --no-undefined instead. Add new --undefined as synonym for -u.
4866 * archive.cc (Archive::add_symbols): Check whether symbol was
4868 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
4869 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
4870 all uses. Add IS_UNDEFINED. Update declarations to split
4871 different versions of init_base. Declare init_base_undefined.
4872 (Symbol::is_defined): Handle IS_UNDEFINED.
4873 (Symbol::is_undefined): Likewise.
4874 (Symbol::is_weak_undefined): Call is_undefined.
4875 (Symbol::is_absolute): Handle IS_CONSTANT.
4876 (class Sized_symbol): Update declarations to split different
4877 versions of init. Declare init_undefined.
4878 (class Symbol_table): Declare new functions.
4879 * symtab.cc (Symbol::init_base_object): Rename from init_base.
4881 (Symbol::init_base_output_data): Likewise.
4882 (Symbol::init_base_output_segment): Likewise.
4883 (Symbol::init_base_constant): Likewise.
4884 (Symbol::init_base_undefined): New function.
4885 (Sized_symbol::init_object): Rename from init. Change all
4887 (Sized_symbol::init_output_data): Likewise.
4888 (Sized_symbol::init_output_segment): Likewise.
4889 (Sized_symbol::init_constant): Likewise.
4890 (Sized_symbol::init_undefined): New function.
4891 (Symbol_table::add_undefined_symbols_from_command_line): New
4893 (Symbol_table::do_add_undefined_symbols_from_command_line): New
4895 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
4896 (Symbol::output_section): Likewise.
4897 (Symbol::set_output_section): Likewise.
4898 (Symbol_table::sized_finalize_symbol): Likewise.
4899 (Symbol_table::sized_write_globals): Likewise.
4900 * resolve.cc (Symbol_table::should_override): Likewise.
4901 (Symbol::override_base_with_special): Likewise.
4903 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
4904 symbol, change it to have default visibility.
4905 * testsuite/protected_1.cc: New file.
4906 * testsuite/protected_2.cc: New file.
4907 * testsuite/protected_3.cc: New file.
4908 * testsuite/protected_main_1.cc: New file.
4909 * testsuite/protected_main_2.cc: New file.
4910 * testsuite/protected_main_3.cc: New file.
4911 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
4912 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
4913 (protected_1_LDFLAGS, protected_1_LDADD): Define.
4914 (protected_1.so): New target.
4915 (protected_1_pic.o, protected_2_pic.o): New targets.
4916 (protected_3_pic.o): New target.
4917 (check_PROGRAMS): Add protected_2.
4918 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
4919 (protected_2_LDFLAGS, protected_2_LDADD): Define.
4920 * testsuite/Makefile.in: Rebuild.
4922 * options.h (DEFINE_var): Add set_user_set_##varname__.
4923 (DEFINE_bool_alias): New macro.
4924 (class General_options): Define -Bstatic using DEFINE_bool_alias
4925 rather than DEFINE_special. Add --undefined as an alias for -z
4927 * options.cc (General_options::parse_Bstatic): Remove.
4929 * options.h (class General_options): Add --fatal-warnings.
4930 * main.cc (main): Implement --fatal-warnings.
4931 * errors.h (Errors::warning_count): New function.
4933 * options.h (class General_options): Add -Bsymbolic-functions.
4934 * symtab.h (Symbol::is_preemptible): Check for
4935 -Bsymbolic-functions.
4937 2008-05-05 Ian Lance Taylor <iant@google.com>
4939 * options.h (DEFINE_bool): For DASH_Z, create the negative option
4940 as noVARNAME rather than no-VARNAME.
4941 (class General_options): Add option -z combreloc.
4942 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
4944 (Output_reloc::sort_before) [SHT_REL]: New function.
4945 (Output_reloc::sort_before) [SHT_RELA]: New function.
4946 (class Output_data_reloc_base): Add sort_relocs_ field. Define
4947 Sort_relocs_comparison.
4948 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
4949 parameter. Change all callers.
4950 (Output_data_reloc::Output_data_reloc) [both versions]: Add
4951 sort_relocs parameter. Change all callers.
4952 * output.cc (Output_reloc::get_address): New function, broken out
4954 (Output_reloc::write_rel): Call it.
4955 (Output_reloc::compare): New function.
4956 (Output_data_reloc_base::do_write): Optionally sort relocs.
4958 * configure.ac: If targ_extra_obj is set, link it in.
4959 * configure.tgt: Initialize all variables.
4960 (x86_64*): Set targ_extra_obj and targ_extra_size.
4961 * configure: Rebuild.
4963 * object.cc (Sized_relobj::include_section_group): Adjust section
4964 indexes read from group data. Build vector to pass to
4966 * layout.cc (Layout::layout_group): Add flags and shndxes
4967 parameters. Remove contents parameter. Change caller. Update
4968 explicit instantiations.
4969 * layout.h (class Layout): Update layout_group declaration.
4970 * output.cc (Output_data_group::Output_data_group): Add flags and
4971 input_shndxes parameters. Remove contents parameter. Change
4973 (Output_data_group::do_write): Change input_sections_ to
4975 * output.h (class Output_data_group): Update constructor
4976 declaration. Rename input_sections_ to input_shndxes_.
4977 * testsuite/many_sections_test.cc: Add template.
4979 2008-04-30 Cary Coutant <ccoutant@google.com>
4981 * target-reloc.h (relocate_section): Fix dead-pointer bug.
4983 * layout.cc (Layout::include_section): Refactored check for debug
4985 (Layout::add_comdat): Add new parameters. Change type
4986 of signature parameter. Add object and shndx to signatures table.
4987 (Layout::find_kept_object): New function.
4988 * layout.h: Include <cstring>.
4989 (Layout::is_debug_info_section): New function.
4990 (Layout::add_comdat): Add new parameters.
4991 (Layout::find_kept_object): New function.
4992 (Layout::Kept_section): New struct.
4993 (Layout::Signatures): Change type of map range.
4994 * object.cc (Relobj::output_section_address): New function.
4995 (Sized_relobj::include_section_group): Add new parameters. Change
4996 calls to Layout::add_comdat. Change to build table of kept comdat
4997 groups and table mapping discarded sections to kept sections.
4998 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
4999 (Sized_relobj::do_layout): Change calls to include_section_group and
5000 include_linkonce_section.
5001 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5002 value to zero when section is discarded.
5003 (Sized_relobj::map_to_kept_section): New function.
5004 * object.h (Relobj::output_section_address): New function.
5005 (Relobj::Comdat_group): New type.
5006 (Relobj::find_comdat_group): New function.
5007 (Relobj::Comdat_group_table): New type.
5008 (Relobj::Kept_comdat_section): New type.
5009 (Relobj::Kept_comdat_section_table): New type.
5010 (Relobj::add_comdat_group): New function.
5011 (Relobj::set_kept_comdat_section): New function.
5012 (Relobj::get_kept_comdat_section): New function.
5013 (Relobj::comdat_groups_): New field.
5014 (Relobj::kept_comdat_sections_): New field.
5015 (Symbol_value::input_value): Update comment.
5016 (Sized_relobj::map_to_kept_section) New function.
5017 (Sized_relobj::include_linkonce_section): Add new parameter.
5018 * target-reloc.h (Comdat_behavior): New type.
5019 (get_comdat_behavior): New function.
5020 (relocate_section): Add code to map a discarded section to the
5021 corresponding kept section when applying a relocation.
5023 2008-04-30 Craig Silverstein <csilvers@google.com>
5025 * dwarf_reader.cc (next_generation_count): New static var.
5026 (Addr2line_cache_entry): New struct.
5027 (addr2line_cache): New static var.
5028 (Dwarf_line_info::one_addr2line): Added caching.
5029 (Dwarf_line_info::clear_addr2line_cache): New function.
5030 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5031 cache-size parameter.
5032 (Dwarf_line_info::one_addr2line_cache): New function.
5033 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5034 new cache-size argument to one_addr2line(), and clear cache.
5036 2008-04-28 Cary Coutant <ccoutant@google.com>
5038 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5039 R_386_PC8 relocations.
5041 2008-04-23 Ian Lance Taylor <iant@google.com>
5043 * object.cc (Sized_relobj::include_section_group): Check for
5044 invalid section group.
5046 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5049 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5050 than read for file header.
5051 * archive.cc (Archive::include_member): Likewise.
5053 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
5055 * aclocal.m4: Regenerate.
5056 * configure: Regenerate.
5058 2008-04-19 Ian Lance Taylor <iant@google.com>
5060 * version.cc (version_string): Bump to 1.6.
5062 * testsuite/Makefile.am (many_sections_r_test): New target.
5063 (many_sections_r_test_SOURCES): Remove.
5064 (many_sections_r_test_DEPENDENCIES): Remove.
5065 (many_sections_r_test_LDFLAGS): Remove.
5066 (many_sections_r_test_LDADD): Remove.
5068 * object.cc (Sized_relobj::do_add_symbols): Always pass
5069 local_symbol_count_ to add_from_relobj.
5071 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5072 every thousand variables.
5073 * testsuite/Makefile.in: Rebuild.
5075 * object.cc (Xindex::initialize_symtab_xindex): New function.
5076 (Xindex::read_symtab_xindex): New function.
5077 (Xindex::sym_xindex_to_shndx): New function.
5078 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5080 (Sized_relobj::do_initialize_xindex): New function.
5081 (Sized_relobj::do_read_symbols): Adjust section links.
5082 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5083 parameter. Change all callers.
5084 (Sized_relobj::include_section_group): Adjust section links and
5085 symbol section indexes.
5086 (Sized_relobj::do_layout): Adjust section links.
5087 (Sized_relobj::do_count_local_symbols): Adjust section links and
5088 symbol section indexes.
5089 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5090 ordinary and special symbols.
5091 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5092 dynsym_xindex parameters. Change all callers. Adjust section
5093 links. Use SHN_XINDEX when needed.
5094 (Sized_relobj::get_symbol_location_info): Adjust section links.
5095 Don't get fooled by special symbols.
5096 * object.h (class Xindex): Define.
5097 (class Object): Add xindex_ parameter. Declare virtual functoin
5098 do_initialize_xindex.
5099 (Object::adjust_sym_shndx): New function.
5100 (Object::set_xindex): New protected function.
5101 (class Symbol_value): Add is_ordinary_shndx_ field.
5102 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5103 (Symbol_value::value): Assert ordinary section.
5104 (Symbol_value::initialize_input_to_output_map): Likewise.
5105 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5107 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5109 (class Sized_relobj): Update declarations.
5110 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5111 parameter. Change all callers.
5112 (Sized_relobj::adjust_shndx): New function.
5113 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5115 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5116 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5117 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5118 (Sized_dynobj::read_dynsym_section): Adjust section links.
5119 (Sized_dynobj::read_dynamic): Likewise.
5120 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5122 (Sized_dynobj::do_initialize_xindex): New function.
5123 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5124 do_initialize_xindex.
5125 (Sized_dynobj::adjust_shndx): New function.
5126 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5127 dynsym_xindex_ fields.
5128 (Layout::finalize): Add a call to set_section_indexes before
5129 creating the symtab sections.
5130 (Layout::set_section_indexes): Don't do anything if the section
5131 already has a section index.
5132 (Layout::create_symtab_sections): Add shnum parameter. Change
5133 caller. Create .symtab_shndx section if needed.
5134 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5136 (Layout::allocated_output_section_count): New function.
5137 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5139 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5140 fields. Update declarations.
5141 (Layout::symtab_xindex): New function.
5142 (Layout::dynsym_xindex): New function.
5143 (class Write_symbols_task): Add layout_ field.
5144 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5146 * output.cc (Output_section_headers::Output_section_headers): Add
5147 shstrtab_section parameter. Change all callers.
5148 (Output_section_headers::do_sized_write): Store overflow values
5149 for section count and section string table section index in
5150 section header zero.
5151 (Output_file_header::do_sized_write): Check for overflow of
5152 section count and section string table section index.
5153 (Output_symtab_xindex::do_write): New function.
5154 (Output_symtab_xindex::endian_do_write): New function.
5155 * output.h (class Output_section_headers): Add shstrtab_section_.
5156 Update declarations.
5157 (class Output_symtab_xindex): Define.
5158 (Output_section::has_out_shndx): New function.
5159 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5161 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5163 (Sized_symbol::init): Likewise.
5164 (Symbol::output_section): Check for ordinary symbol.
5165 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5166 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5168 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5169 Change all callers. Simplify handling of symbols from sections
5170 not included in the link.
5171 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5173 (Weak_alias_sorter::operator()): Assert that symbols are
5175 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5177 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5178 parameters. Change all callers.
5179 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5180 symbol distinction. Use SHN_XINDEX when needed.
5181 (Symbol_table::write_section_symbol): Add symtab_xindex
5182 parameter. Change all callers.
5183 (Symbol_table::sized_write_section_symbol): Likewise. Use
5184 SHN_XINDEX when needed.
5185 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5187 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5188 (Symbol::is_defined): Check is_ordinary.
5189 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5190 (Symbol::is_absolute, Symbol::is_common): Likewise.
5191 (class Sized_symbol): Update declarations.
5192 (class Symbol_table): Update declarations.
5193 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5194 parameters. Change all callers.
5195 (Sized_symbol::override): Likewise.
5196 (Symbol_table::override): Likewise.
5197 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5198 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5199 is_ordinary, and orig_st_shndx parameters. Change all callers.
5200 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5201 to be in an ordinary section.
5202 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5203 object and is_ordinary parameters. Change all callers.
5204 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5205 Change all callers. Don't add undefined or non-ordinary symbols
5207 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5209 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5211 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5212 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5213 (Sized_relobj::relocate_sections): Likewise.
5214 * target-reloc.h (scan_relocs): Adjust section symbol index.
5215 (scan_relocatable_relocs): Likewise.
5216 * i386.cc (Scan::local): Check for ordinary symbols.
5217 * sparc.cc (Scan::local): Likewise.
5218 * x86_64.cc (Scan::local): Likewise.
5219 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5220 to symbol_section_and_value.
5221 * testsuite/many_sections_test.cc: New file.
5222 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5223 (check_PROGRAMS): Add many_sections_test.
5224 (many_sections_test_SOURCES): Define.
5225 (many_sections_test_DEPENDENCIES): Define.
5226 (many_sections_test_LDFLAGS): Define.
5227 (BUILT_SOURCES): Add many_sections_define.h.
5228 (many_sections_define.h): New target.
5229 (BUILT_SOURCES): Add many_sections_check.h.
5230 (many_sections_check.h): New target.
5231 (check_PROGRAMS): Add many_sections_r_test.
5232 (many_sections_r_test_SOURCES): Define.
5233 (many_sections_r_test_DEPENDENCIES): Define.
5234 (many_sections_r_test_LDFLAGS): Define.
5235 (many_sections_r_test_LDADD): Define.
5236 (many_sections_r_test.o): New target.
5237 * testsuite/Makefile.in: Rebuild.
5239 2008-04-17 Cary Coutant <ccoutant@google.com>
5241 * errors.cc (Errors::info): New function.
5242 (gold_info): New function.
5243 * errors.h (Errors::info): New function.
5244 * gold.h (gold_info): New function.
5245 * object.cc (Input_objects::add_object): Print trace output.
5246 * options.cc (options::parse_set): New function.
5247 (General_options::parse_wrap): Deleted.
5248 (General_options::General_options): Deleted initializer.
5249 * options.h (options::String_set): New typedef.
5250 (options::parse_set): New function.
5251 (DEFINE_set): New macro.
5252 (General_options::wrap): Changed to use DEFINE_set. Changed
5253 callers of any_wrap_symbols and is_wrap_symbol.
5254 (General_options::trace, General_options::trace_symbol):
5256 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5257 (General_options::wrap_symbols_): Deleted.
5258 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5260 2008-04-17 David S. Miller <davem@davemloft.net>
5262 * options.cc (General_options::parse_V): New function.
5263 * options.h: Add entries for -V and -Qy.
5265 2008-04-17 Ian Lance Taylor <iant@google.com>
5267 * common.cc (Symbol_table::allocate_commons): Remove options
5268 parameter. Change caller.
5269 (Symbol_table::do_allocate_commons): Remove options parameter.
5270 Change caller. Just call do_allocate_commons_list twice.
5271 (Symbol_table::do_allocate_commons_list): New function, broken out
5272 of do_allocate_commons.
5273 * common.h (class Allocate_commons_task): Remove options_ field.
5275 * symtab.cc (Symbol_table::Symbol_table): Initialize
5277 (Symbol_table::add_from_object): Put TLS common symbols on
5279 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5280 which are IN_OUTPUT_DATA.
5281 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5282 allocate_commons and do_allocate_commons declarations. Declare
5283 do_allocate_commons_list.
5284 * gold.cc (queue_middle_tasks): Update creation of
5285 Allocate_commons_task to not pass options.
5286 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5287 (TLS_TEST_C_FLAGS): New variable.
5288 (tls_test_c_pic.o): New target.
5289 (tls_test_shared.so): Link in tls_test_c_pic.o.
5290 (tls_test_c_pic_ie.o): New target.
5291 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5292 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5293 (tls_test_c.o): New target.
5294 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5295 (tls_pic_test_LDADD): Likewise.
5296 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5297 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5298 (tls_test_c_gnu2.o): New target.
5299 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5301 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5302 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5303 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5304 * testsuite/tls_test.cc: Include "config.h".
5305 (t_last): Call t11_last.
5306 * testsuite/tls_test.h (t11, t11_last): Declare.
5307 * testsuite/tls_test_c.c: New file.
5308 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5309 * configure.ac: Check for OpenMP support.
5310 * configure, config.in, Makefile.in: Rebuild.
5311 * testsuite/Makefile.in: Rebuild.
5313 2008-04-16 Cary Coutant <ccoutant@google.com>
5315 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5316 (Target_i386::tls_base_symbol_defined_): New field.
5317 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5318 (Target_i386::Scan::global): Likewise.
5319 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5320 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5321 (Target_x86_64::tls_base_symbol_defined_): New field.
5322 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5323 (Target_x86_64::Scan::global): Likewise.
5325 2008-04-16 Cary Coutant <ccoutant@google.com>
5327 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5328 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5329 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5330 building shared libraries.
5331 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5332 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5333 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5334 * testsuite/Makefile.in: Rebuild.
5335 * testsuite/weak_undef.h: New file.
5336 * testsuite/weak_undef_file1.cc: Add extra test cases.
5337 * testsuite/weak_undef_file2.cc: Likewise.
5338 * testsuite/weak_undef_test.cc: Likewise.
5340 2008-04-16 David S. Miller <davem@davemloft.net>
5342 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5343 Add issued_non_pic_error_ field. Declare check_non_pic.
5344 (Target_sparc::Scan::check_non_pic): New function.
5345 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5346 (Target_sparc::Scan::global): Likewise.
5348 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5349 * configure: Rebuild.
5351 * options.h (DEFINE_enable): New macro.
5352 (new_dtags): New enable option.
5353 (initfirst, interpose, loadfltr, nodefaultlib,
5354 nodelete, nodlopen, nodump): New -z options.
5355 * layout.cc (Layout:finish_dynamic_section): If new
5356 dtags enabled, emit DT_RUNPATH. Also, emit a
5357 DT_FLAGS_1 containing any specified -z flags.
5359 2008-04-16 Ian Lance Taylor <iant@google.com>
5361 * copy-relocs.cc: New file.
5362 * copy-relocs.h: New file.
5363 * reloc.cc: Remove Copy_relocs code.
5364 * reloc.h: Likewise.
5365 * reloc-types.h (struct Reloc_types) [both versions]: Add
5366 get_reloc_addend_noerror.
5367 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5368 variants of add_global which take an addend which must be zero.
5369 * i386.cc: Include "copy-relocs.h".
5370 (class Target_i386): Change type of copy_relocs_ to variable,
5372 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5374 (Target_i386::do_finalize_sections): Change handling of
5376 * sparc.cc: Include "copy-relocs.h".
5377 (class Target_sparc): Change type of copy_relocs_ to variable,
5379 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5381 (Target_sparc::do_finalize_sections): Change handling of
5383 * x86_64.cc: Include "copy-relocs.h".
5384 (class Target_x86_64): Change type of copy_relocs_ to variable,
5386 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5387 class. Change all callers.
5388 (Target_x86_64::do_finalize_sections): Change handling of
5390 * Makefile.am (CCFILES): Add copy-relocs.cc.
5391 (HFILES): Add copy-relocs.h.
5393 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5395 * testsuite/script_test_4.sh: Permit leading zeroes.
5397 2008-04-15 Ian Lance Taylor <iant@google.com>
5399 * script-sections.cc (Script_sections::create_segments): Use
5400 header_size_adjustment even when there is enough room for the
5402 * testsuite/script_test_4.sh: New file.
5403 * testsuite/script_test_4.t: New file.
5404 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5405 (check_DATA): Add script_test_4.stdout.
5406 (MOSTLYCLEANFILES): Likewise.
5407 (script_test_4): New target.
5408 (script_test_4.stdout): New target.
5409 * testsuite/Makefile.in: Rebuild.
5411 * sparc.cc: Add definitions for Output_data_plt_sparc class
5414 2008-04-14 David S. Miller <davem@davemloft.net>
5416 * sparc.cc: New file.
5417 * Makefile.am (TARGETSOURCES): Add sparc.cc
5418 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5419 * configure.tgt: Document targ_extra_size and
5420 targ_extra_big_endian. Add entries for sparc-* and
5422 * configure.ac: Handle targ_extra_size and
5423 targ_extra_big_endian.
5424 * Makefile.in: Rebuild.
5425 * configure: Likewise.
5426 * po/POTFILES.in: Likewise.
5427 * po/gold.pot: Likewise.
5429 2008-04-14 Ian Lance Taylor <iant@google.com>
5431 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5432 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5433 in the name/type/flags to section mapping. Don't call
5434 allocate_output_section.
5435 (Layout::choose_output_section): Change parameter from adjust_name
5436 to is_input_section. Don't permit input sections after sections
5437 are attached to segments. Don't call allocate_output_section.
5438 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5439 not write_enable_output_section.
5440 (Layout::make_output_section): Don't push to
5441 unattached_section_list_ nor call attach_to_segment. Call
5442 attach_section_to_segment if sections are attached.
5443 (Layout::attach_sections_to_segments): New function.
5444 (Layout::attach_section_to_segment): New function.
5445 (Layout::attach_allocated_section_to_segment): Rename from
5446 attach_to_segment. Remove flags parameter.
5447 (Layout::allocate_output_section): Remove function.
5448 (Layout::write_enable_output_section): Remove function.
5449 * layout.h (class Layout): Update for above changes. Add new
5450 field sections_are_attached_.
5451 * output.h (Output_section::update_flags_for_input_section): New
5453 * output.cc (Output_section::add_input_section): Call
5454 update_flags_for_input_section.
5455 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5457 2008-04-11 Cary Coutant <ccoutant@google.com>
5459 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5460 thought unnecessary.
5461 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5463 2008-04-11 Ian Lance Taylor <iant@google.com>
5465 * output.h (class Output_section_data): Remove inline definition
5467 * output.cc (Output_section_data::set_addralign): New function.
5469 2008-04-11 Cary Coutant <ccoutant@google.com>
5471 Add support for TLS descriptors for i386 and x86_64.
5472 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5473 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5474 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5476 (Target_i386::got_mod_index_entry): Remove unnecessary code.
5477 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5478 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
5480 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5481 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5482 Fix problem with initial-exec relocations.
5483 (Target_i386::Relocate::relocate_tls): Likewise.
5484 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5486 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5487 support for section-plus-offset dynamic table entries.
5488 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5489 (Output_data_dynamic::Dynamic_entry): Add support for
5490 section-plus-offset dynamic table entries.
5491 (Output_data_dynamic::Classification): Likewise.
5492 (Output_data_dynamic::classification_): Renamed offset_.
5493 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5494 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5495 (Target_x86_64::make_plt_section): New function.
5496 (Target_x86_64::reserve_tlsdesc_entries): New function.
5497 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5498 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5499 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5500 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5501 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5502 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5503 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5504 add extra PLT entry for TLS descriptors.
5505 (Output_data_plt_x86_64::got_): New field.
5506 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5507 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5509 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5511 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5512 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5513 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5514 R_386_TLS_DESC_CALL relocations.
5515 (Target_x86_64::Scan::global): Likewise.
5516 (Target_x86_64::do_finalize_sections): Add dynamic table entries
5517 for TLS descriptors.
5518 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
5519 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
5520 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
5521 GD-to-IE relaxation.
5522 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
5523 and TLS_DESCRIPTORS.
5524 * Makefile.in: Rebuild.
5525 * configure: Rebuild.
5526 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
5527 (tls_test_shared2.so): New target.
5528 (tls_shared_gd_to_ie_test_SOURCES): New variable.
5529 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
5530 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
5531 (tls_shared_gd_to_ie_test_LDADD): New variable.
5532 (tls_shared_gnu2_gd_to_ie_test): New target.
5533 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
5535 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
5536 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
5537 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
5538 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
5539 (tls_shared_gnu2_test): New target.
5540 (tls_test_gnu2_shared.so): New target.
5541 (tls_shared_gnu2_test_SOURCES): New variable.
5542 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
5543 (tls_shared_gnu2_test_LDFLAGS): New variable.
5544 (tls_shared_gnu2_test_LDADD): New variable.
5545 * testsuite/Makefile.in: Rebuild.
5546 * testsuite/Makefile.
5548 2008-04-11 Ian Lance Taylor <iant@google.com>
5550 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
5552 * testsuite/Makefile.in: Rebuild.
5554 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
5556 * testsuite/script_test_2.cc (main): Adjust test.
5558 2008-04-11 David S. Miller <davem@davemloft.net>
5559 Ian Lance Taylor <iant@google.com>
5561 * options.h (General_options): Add entries for '-Y' and
5563 * options.cc (General_options:finalize): If -Y was used, add those
5564 entries to the library path instead of the default "/lib" and
5567 2008-04-11 David S. Miller <davem@davemloft.net>
5569 * testsuite/justsyms.t: Start at 0x100.
5570 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
5571 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
5573 * testsuite/script_test_2.cc: Adjust string and section length
5576 2008-04-09 Ian Lance Taylor <iant@google.com>
5579 * script-sections.cc (Sections_element::allocate_to_segment): Add
5581 (Output_section_definition::allocate_to_segment): Likewise.
5582 (Orphan_output_section::allocate_to_segment): Likewise.
5583 (Script_sections::attach_sections_using_phdrs_clause): Don't
5584 propagate non-PT_LOAD segments to orphan sections.
5585 * testsuite/Makefile.am (script_test_3.stdout): Generate using
5586 readelf rather than objdump.
5587 * testsuite/script_test_3.sh: Adjust accordingly. Test that
5588 .interp section and PT_INTERP segment are the same size.
5589 * testsuite/Makefile.in: Rebuild.
5591 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
5592 aliases for symbols defined in the same object.
5593 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5594 (weak_alias_test_SOURCES): New variable.
5595 (weak_alias_test_DEPENDENCIES): New variable.
5596 (weak_alias_test_LDFLAGS): New variable.
5597 (weak_alias_test_LDADD): New variable.
5598 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5599 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5600 (weak_alias_test_3.o): New target.
5601 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5602 * testsuite/weak_alias_test_main.cc: New file.
5603 * testsuite/weak_alias_test_1.cc: New file.
5604 * testsuite/weak_alias_test_2.cc: New file.
5605 * testsuite/weak_alias_test_3.cc: New file.
5607 2008-04-08 Ian Lance Taylor <iant@google.com>
5609 * options.h (class General_options): Add --noinhibit-exec option.
5610 * main.cc (main): Check --noinhibit-exec.
5612 * options.h (class General_options): Define --wrap as a special
5613 option. Add wrap_symbols_ field.
5614 (General_options::any_wrap_symbols): New function.
5615 (General_options::is_wrap_symbol): New function.
5616 * options.cc (General_options::parse_wrap): New function.
5617 (General_options::General_options): Initialize wrap_symbols_.
5618 * symtab.cc (Symbol_table::wrap_symbol): New function.
5619 (Symbol_table::add_from_object): Handle --wrap.
5620 * symtab.h (class Symbol_table): Declare wrap_symbol.
5621 * target.h (Target::wrap_char): New function.
5622 (Target::Target_info): Add wrap_char field.
5623 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
5624 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5625 * testsuite/testfile.cc (Target_test::test_target_info):
5628 * errors.cc (Errors::undefined_symbol): Mention symbol version if
5631 * layout.h (class Layout): Add added_eh_frame_data_ field.
5632 * layout.cc (Layout::Layout): Initialize new field.
5633 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
5634 output section until we find a section we merged successfully.
5635 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
5636 that the size be non-zero.
5638 * merge.cc (Object_merge_map::get_output_offset): Remove inline
5641 2008-04-08 Craig Silverstein <csilvers@google.com>
5643 * configure.ac: Export new conditional variable HAVE_ZLIB.
5644 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
5646 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
5647 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5649 2008-04-07 Ian Lance Taylor <iant@google.com>
5651 * version.cc (version_string): Set to "1.5".
5653 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
5654 Add issued_non_pic_error_ field. Declare check_non_pic.
5655 (Target_x86_64::Scan::check_non_pic): New function.
5656 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
5657 (Target_x86_64::Scan::global): Likewise.
5659 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
5660 addend parameter. Change caller. Handle merge sections.
5661 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5662 Address to Addend. Don't add in the result of
5663 local_section_offset, pass down the addend and use the returned
5665 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5666 Update declarations of local_section_offset and symbol_value.
5667 * testsuite/two_file_test_1.cc (t18): New function.
5668 * testsuite/two_file_test_2.cc (f18): New function.
5669 * testsuite/two_file_test_main.cc (main): Call t18.
5670 * testsuite/two_file_test.h (t18, f18): Declare.
5672 * configure.ac: Don't test for objdump, c++filt, or readelf.
5673 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5675 (TEST_READELF): New variable.
5676 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5677 (check_PROGRAMS): Add two_file_strip_test.
5678 (two_file_strip_test): New target.
5679 (check_PROGRAMS): Add two_file_same_shared_strip_test.
5680 (two_file_same_shared_strip_test_SOURCES): New variable.
5681 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5682 (two_file_same_shared_strip_test_LDFLAGS): New variable.
5683 (two_file_same_shared_strip_test_LDADD): New variable.
5684 (two_file_shared_strip.so): New target.
5685 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5686 (ver_test_5.syms, ver_test_7.syms): Likewise.
5687 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5688 (strip_test_3.stdout): Use TEST_OBJDUMP.
5689 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5691 2008-04-04 Cary Coutant <ccoutant@google.com>
5693 * symtab.h (Symbol::is_weak_undefined): New function.
5694 (Symbol::is_strong_undefined): New function.
5695 (Symbol::is_absolute): New function.
5696 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5697 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5699 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5700 (weak_undef_test): New target.
5701 * testsuite/Makefile.in: Rebuild.
5702 * testsuite/weak_undef_file1.cc: New file.
5703 * testsuite/weak_undef_file2.cc: New file.
5704 * testsuite/weak_undef_test.cc: New file.
5706 2008-04-03 Craig Silverstein <csilvers@google.com>
5708 * compressed_output.h (class Output_compressed_section): Use
5710 * compressed_output.cc (zlib_compress): Use unsigned buffers,
5712 (zlib_compressed_suffix): Removed.
5713 (Output_compressed_section::set_final_data_size): Use unsigned
5715 * testsuite/Makefile.am (flagstest_compress_debug_sections):
5716 Fix linker invocation.
5717 (flagstest_o_specialfile_and_compress_debug_sections):
5719 * testsuite/Makefile.in: Regenerated.
5721 2008-04-02 David S. Miller <davem@davemloft.net>
5723 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5724 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5726 2008-04-02 Craig Silverstein <csilvers@google.com>
5730 2008-04-02 Ian Lance Taylor <iant@google.com>
5732 * fileread.cc (File_read::find_view): Add byteshift and vshifted
5733 parameters. Update for new key type to views_. Change all
5735 (File_read::read): Adjust for byteshift in returned view.
5736 (File_read::add_view): New function, broken out of
5738 (File_read::make_view): New function, broken out of
5740 (File_read::find_or_make_view): Add offset and aligned
5741 parameters. Rewrite accordingly. Change all callers.
5742 (File_read::get_view): Add offset and aligned parameters. Adjust
5743 for byteshift in return value.
5744 (File_read::get_lasting_view): Likewise.
5745 * fileread.h (class File_read): Update declarations.
5746 (class File_read::View): Add byteshift_ field. Add byteshift to
5747 constructor. Add byteshift method.
5748 * archive.h (Archive::clear_uncached_views): New function.
5749 (Archive::get_view): Add aligned parameter. Change all callers.
5750 * object.h (Object::get_view): Add aligned parameter. Change all
5752 (Object::get_lasting_view): Likewise.
5754 * fileread.cc (File_read::release): Don't call clear_views if
5755 there are multiple objects.
5756 * fileread.h (File_read::clear_uncached_views): New function.
5757 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5760 2008-03-31 Cary Coutant <ccoutant@google.com>
5762 Add thin archive support.
5763 * archive.cc (Archive::armagt): New const.
5764 (Archive::setup): Remove task parameter and calls to unlock.
5765 (Archive::unlock_nested_archives): New function.
5766 (Archive::read_header): Add nested_off parameter. Change
5768 (Archive::interpret_header): Likewise.
5769 (Archive::include_all_members): Change to handle thin
5771 (Archive::include_member): Likewise.
5772 * archive.h (Archive::Archive): Add new parameters and
5774 (Archive::armagt): New const.
5775 (Archive::setup): Remove task parameter.
5776 (Archive::unlock_nested_archives): New function.
5777 (Archive::read_header): Add nested_off parameter.
5778 (Archive::interpret_header): Likewise.
5779 (Archive::Nested_archive_table): New typedef.
5780 (Archive::is_thin_archive_): New field.
5781 (Archive::nested_archives_): New field.
5782 (Archive::options_): New field.
5783 (Archive::dirpath_): New field.
5784 (Archive::task_): New field.
5785 * readsyms.cc (Read_symbols::do_read_symbols): Add check
5786 for thin archives. Pass additional parameters to
5787 Archive::Archive. Unlock the archive file after calling
5790 2008-03-29 Ian Lance Taylor <iant@google.com>
5792 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
5793 version symbol to be local.
5794 * testsuite/ver_test_4.sh: New file.
5795 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
5796 (check_DATA): Add ver_test_4.syms.
5797 (ver_test_4.syms): New target.
5798 * testsuite/Makefile.in: Rebuild.
5801 (Output_section::Input_section_sort_entry::has_priority): New
5803 (Output_section::Input_section_sort_entry::match_file_name): New
5805 (Output_section::Input_section_sort_entry::match_section_name):
5807 (Output_section::Input_section_sort_entry::match_section_name_prefix):
5809 (Output_section::Input_section_sort_entry::match_section_file):
5811 (Output_section::Input_section_sort_compare::operator()): Rewrite
5812 using new Input_section_sort_entry functions. Sort crtbegin and
5813 crtend first. Sort sections with no priority before sections with
5815 * testsuite/initpri1.c (d3): Check j != 4.
5816 (cd5): New constructor/destructor function.
5817 (main): Check j != 2.
5819 * symtab.cc (Symbol_table::add_from_object): If we don't use the
5820 new symbol when resolving, don't call set_is_default.
5821 * testsuite/ver_test_7.cc: New file.
5822 * testsuite/ver_test_7.sh: New file.
5823 * testsuite/Makefile.am (ver_test_7.so): New target.
5824 (ver_test_7.o): New target.
5825 (check_SCRIPTS): Add ver_test_7.sh.
5826 (check_DATA): Add ver_test_7.syms.
5827 (ver_test_7.syms): New target.
5829 2008-03-28 Ian Lance Taylor <iant@google.com>
5831 * layout.cc (Layout::layout): If we see an input section with a
5832 name that needs sorting, set the must_sort flag for the output
5834 (Layout::make_output_section): If the name of the output section
5835 indicates that it might require sorting, set the may_sort flag.
5836 * output.h (Output_section::may_sort_attached_input_sections): New
5838 (Output_section::set_may_sort_attached_input_sections): New
5840 (Output_section::must_sort_attached_input_sections): New
5842 (Output_section::set_must_sort_attached_input_sections): New
5844 (class Output_section): Declare Input_section_sort_entry. Define
5845 Input_section_sort_compare. Declare
5846 sort_attached_input_sections. Add new fields:
5847 may_sort_attached_input_sections_,
5848 must_sort_attached_input_sections_,
5849 attached_input_sections_are_sorted_.
5850 * output.cc (Output_section::Output_section): Initialize new
5852 (Output_section::add_input_section): Add an entry to
5853 input_sections_ if may_sort or must_sort are true.
5854 (Output_section::set_final_data_size): Call
5855 sort_attached_input_sections if necessary.
5856 (Output_section::Input_section_sort_entry): Define new class.
5857 (Output_section::Input_section_sort_compare::operator()): New
5859 (Output_section::sort_attached_input_sections): New function.
5860 * configure.ac: Check whether the compiler supports constructor
5861 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
5862 * testsuite/initpri1.c: New file.
5863 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
5864 CONSTRUCTOR_PRIORITY.
5865 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
5866 (initpri1_LDFLAGS): New variable.
5867 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5869 2008-03-27 Ian Lance Taylor <iant@google.com>
5871 * common.cc (Sort_commons::operator): Correct sorting algorithm.
5872 * testsuite/common_test_1.c: New file.
5873 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
5874 (common_test_1_SOURCES): New variable.
5875 (common_test_1_DEPENDENCIES): New variable.
5876 (common_test_1_LDFLAGS): New variable.
5878 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
5879 and commons_ correctly when NAME/VERSION does not override
5881 * testsuite/ver_test_6.c: New file.
5882 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
5883 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
5884 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
5886 2008-03-26 Ian Lance Taylor <iant@google.com>
5888 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
5889 of an undefined symbol from a version script.
5890 * testsuite/Makefile.am (ver_test_5.so): New target.
5891 (ver_test_5.o): New target.
5892 (check_SCRIPTS): Add ver_test_5.sh.
5893 (check_DATA): Add ver_test_5.syms.
5894 (ver_test_5.syms): New target.
5895 * testsuite/ver_test_5.cc: New file.
5896 * testsuite/ver_test_5.script: New file.
5897 * testsuite/ver_test_5.sh: New file.
5898 * Makefile.in, testsuite/Makefile.in: Rebuild.
5901 Fix problems building gold with gcc 4.3.0.
5902 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
5903 (gold_error_at_location, gold_warning_at_location): Use it.
5904 * configure.ac: Check whether we can compile and use a template
5905 function with a printf attribute.
5906 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
5907 when jumping over bytes.
5908 * object.cc: Instantiate Object::read_section_data.
5909 * debug.h: Include <cstring>
5910 * dwarf_reader.cc: Include <algorithm>
5911 * main.cc: Include <cstring>.
5912 * options.cc: Include <cstring>.
5913 * output.cc: Include <cstring>.
5914 * script.cc: Include <cstring>.
5915 * script.h: Include <string>.
5916 * symtab.cc: Include <cstring> and <algorithm>.
5917 * target-select.cc: Include <cstring>.
5918 * version.cc: Include <string>.
5919 * testsuite/testmain.cc: Include <cstdlib>.
5920 * configure, config.in: Rebuild.
5922 2008-03-25 Ian Lance Taylor <iant@google.com>
5924 * options.cc: Include "../bfd/bfdver.h".
5925 (options::help): Print bug reporting address.
5927 * version.cc (print_version): Adjust output for current value of
5932 * options.cc (options::help): Print list of supported targets.
5933 * target-select.h: Include <vector>.
5934 (class Target_selector): Make machine_, size_, and is_big_endian_
5935 fields const. Add bfd_name_ and instantiated_target_ fields.
5936 (Target_selector::Target_selector): Add bfd_name parameter.
5937 (Target_selector::recognize): Make non-virtual, call
5939 (Target_selector::recognize_by_name): Make non-virtual, call
5940 do_recognize_by_name.
5941 (Target_selector::supported_names): New function.
5942 (Target_selector::bfd_name): New function.
5943 (Target_selector::do_instantiate_target): New pure virtual
5945 (Target_selector::do_recognize): New virtual function.
5946 (Target_selector::do_recognize_by_name): New virtual function.
5947 (Target_selector::instantiate_target): New private function.
5948 (supported_target_names): Declare.
5949 * target-select.cc (Target_selector::Target_selector): Update for
5950 new parameter and fields.
5951 (select_target_by_name): Check that the name matches before
5952 calling recognize_by_name.
5953 (supported_target_names): New function.
5954 * i386.cc (class Target_selector_i386): Update Target_selector
5955 constructor call. Remove recognize and recognize_by_name. Add
5956 do_instantiate_target.
5957 * x86_64.cc (class Target_selector_x86_64): Likewise.
5958 * testsuite/testfile.cc (class Target_selector_test): Update for
5959 changes to Target_selector.
5961 * README: Rewrite, with some notes on unsupported features.
5963 2008-03-24 Cary Coutant <ccoutant@google.com>
5965 * i386.cc (Target_i386::Got_type): New enum declaration.
5966 (Target_i386::Scan::local): Updated callers of Output_data_got
5968 (Target_i386::Scan::global): Likewise.
5969 (Target_i386::Relocate::relocate): Likewise.
5970 (Target_i386::Relocate::relocate_tls): Likewise.
5971 * object.h (Got_offset_list): New class.
5972 (Sized_relobj::local_has_got_offset): Added got_type parameter.
5973 (Sized_relobj::local_got_offset): Likewise.
5974 (Sized_relobj::set_local_got_offset): Likewise.
5975 (Sized_relobj::local_has_tls_got_offset): Removed.
5976 (Sized_relobj::local_tls_got_offset): Removed.
5977 (Sized_relobj::set_local_tls_got_offset): Removed.
5978 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
5979 * output.cc (Output_data_got::add_global): Added got_type parameter.
5980 (Output_data_got::add_global_with_rel): Likewise.
5981 (Output_data_got::add_global_with_rela): Likewise.
5982 (Output_data_got::add_global_pair_with_rel): New function.
5983 (Output_data_got::add_global_pair_with_rela): New function.
5984 (Output_data_got::add_local): Added got_type parameter.
5985 (Output_data_got::add_local_with_rel): Likewise.
5986 (Output_data_got::add_local_with_rela): Likewise.
5987 (Output_data_got::add_local_pair_with_rel): New function.
5988 (Output_data_got::add_local_pair_with_rela): New function.
5989 (Output_data_got::add_global_tls): Removed.
5990 (Output_data_got::add_global_tls_with_rel): Removed.
5991 (Output_data_got::add_global_tls_with_rela): Removed.
5992 (Output_data_got::add_local_tls): Removed.
5993 (Output_data_got::add_local_tls_with_rel): Removed.
5994 (Output_data_got::add_local_tls_with_rela): Removed.
5995 * output.h (Output_data_got::add_global): Added got_type parameter.
5996 (Output_data_got::add_global_with_rel): Likewise.
5997 (Output_data_got::add_global_with_rela): Likewise.
5998 (Output_data_got::add_global_pair_with_rel): New function.
5999 (Output_data_got::add_global_pair_with_rela): New function.
6000 (Output_data_got::add_local): Added got_type parameter.
6001 (Output_data_got::add_local_with_rel): Likewise.
6002 (Output_data_got::add_local_with_rela): Likewise.
6003 (Output_data_got::add_local_pair_with_rel): New function.
6004 (Output_data_got::add_local_pair_with_rela): New function.
6005 (Output_data_got::add_global_tls): Removed.
6006 (Output_data_got::add_global_tls_with_rel): Removed.
6007 (Output_data_got::add_global_tls_with_rela): Removed.
6008 (Output_data_got::add_local_tls): Removed.
6009 (Output_data_got::add_local_tls_with_rel): Removed.
6010 (Output_data_got::add_local_tls_with_rela): Removed.
6011 * resolve.cc (Symbol::override_base_with_special): Removed
6012 reference to has_got_offset_ field.
6013 * symtab.cc (Symbol::init_fields): Replaced initialization
6014 of got_offset_ with got_offsets_. Removed initialization
6016 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6017 (Symbol::got_offset): Likewise.
6018 (Symbol::set_got_offset): Likewise.
6019 (Symbol::has_tls_got_offset): Removed.
6020 (Symbol::tls_got_offset): Removed.
6021 (Symbol::set_tls_got_offset): Removed.
6022 (Symbol::got_offset_): Removed.
6023 (Symbol::tls_mod_got_offset_): Removed.
6024 (Symbol::tls_pair_got_offset_): Removed.
6025 (Symbol::got_offsets_): New field.
6026 (Symbol::has_got_offset): Removed.
6027 (Symbol::has_tls_mod_got_offset): Removed.
6028 (Symbol::has_tls_pair_got_offset): Removed.
6029 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6030 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6032 (Target_x86_64::Scan::global): Likewise.
6033 (Target_x86_64::Relocate::relocate): Likewise.
6034 (Target_x86_64::Relocate::relocate_tls): Likewise.
6036 2008-03-25 Ben Elliston <bje@au.ibm.com>
6038 * yyscript.y: Fix spelling error in comment.
6040 2008-03-24 Ian Lance Taylor <iant@google.com>
6042 * options.h (class General_options): Define build_id option.
6043 * layout.h (class Layout): Declare write_build_id, create_note,
6044 create_build_id. Add build_id_note_ member.
6045 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6046 "libiberty.h", "md5.h", "sha1.h".
6047 (Layout::Layout): Initialize eh_frame_data_,
6048 eh_frame_hdr_section_, and build_id_note_.
6049 (Layout::finalize): Call create_build_id.
6050 (Layout::create_note): New function, broken out of
6051 Layout::create_gold_note.
6052 (Layout::create_gold_note): Call create_note.
6053 (Layout::create_build_id): New function.
6054 (Layout::write_build_id): New function.
6055 (Close_task_runner::run): Call write_build_id.
6057 * x86_64.cc: Correct license to GPLv3.
6059 2008-03-23 Ian Lance Taylor <iant@google.com>
6061 * options.cc: Include "demangle.h".
6062 (parse_optional_string): New function.
6063 (parse_long_option): Handle takes_optional_argument.
6064 (parse_short_option): Update dash_z initializer. Handle
6065 takes_optional_argument.
6066 (General_options::General_options): Initialize do_demangle_.
6067 (General_options::finalize): Set do_demangle_. Handle demangling
6069 * options.h (parse_optional_string): Declare.
6070 (struct One_option): Add optional_arg field. Update constructor.
6071 Update call constructor calls. Add takes_optional_argument
6073 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6074 (DEFINE_optional_string): Define.
6075 (General_options::demangle): Change from DEFINE_bool to
6076 DEFINE_optional_string.
6077 (General_options::no_demangle): New function.
6078 (General_options::do_demangle): New function.
6079 (General_options::set_do_demangle): New function.
6080 (General_options::execstack_status_): Move definition to end of
6082 (General_options::static_): Likewise.
6083 (General_options::do_demangle_): New field.
6084 * object.cc (big_endian>::get_symbol_location_info): Call
6085 Options::do_demangle, not Options::demangle.
6086 * symtab.cc (demangle): Likewise.
6088 2008-03-22 Ian Lance Taylor <iant@google.com>
6090 * gold.h: Include <cstddef> and <sys/types.h>
6091 * options.h: Include <cstring>.
6093 2008-03-21 Ian Lance Taylor <iant@google.com>
6095 * Added source code to GNU binutils.