1 2010-01-08 Ian Lance Taylor <iant@google.com>
3 * object.cc (Sized_relobj::do_layout): Don't get confused if
4 layout_eh_frame returns NULL.
6 2010-01-08 Ian Lance Taylor <iant@google.com>
9 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10 dynamic symbol table, use the normal symbol table.
11 (Sized_dynobj::do_read_symbols): Remove assertion about type of
14 2010-01-08 Ian Lance Taylor <iant@google.com>
17 * layout.cc (Layout::include_section): Remove .gnu_debuglink
20 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
22 * version.cc (print_version): Change to "Copyright 2010".
24 2010-01-08 Ian Lance Taylor <iant@google.com>
28 * i386.cc (class Target_i386): Change return type of plt_section
30 (class Output_data_plt_i386): Add tls_desc_rel_ field.
31 (Output_data_plt_i386::Output_data_plt_i386): Initialize
33 (Output_data_plt_i386::rel_tls_desc): New function.
34 (Target_i386::rel_tls_desc_section): New function.
35 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
36 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
37 R_386_TLS_DESC reloc in rel_tls_desc_section.
38 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
39 Define struct Tlsdesc_info.
40 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
41 (Target_x86_64::do_reloc_symbol_index): New function.
42 (Target_x86_64::add_tlsdesc_info): New function.
43 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
44 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
46 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
48 (Output_data_plt_x86_64::rela_tlsdesc): New function.
49 (Target_x86_64::rela_tlsdesc_section): New function.
50 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
52 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
53 (Target_x86_64::do_reloc_addend): New function.
54 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
55 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
56 declarations. Define TARGET_CODE. Add arg field to u1_ union.
57 (Output_reloc::type): New function.
58 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
59 (Output_reloc::is_target_specific): New function.
60 (Output_reloc::target_arg): New function.
61 (class Output_reloc) [SHT_RELA]: Add four new constructors for
62 absolute relocs and target specific relocs.
63 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
65 (class Output_data_reloc) [SHT_RELA]: Likewise.
66 * output.cc (Output_reloc::Output_reloc): Add four new versions
67 for absolute relocs and target specific relocs.
68 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
69 (Output_reloc::get_symbol_index): Likewise.
70 (Output_reloc::local_section_offset): Check that local_sym_index_
71 is not TARGET_CODE or 0.
72 (Output_reloc::symbol_value): Likewise.
73 (Output_reloc::write) [SHT_RELA]: Call target for target specific
75 * target.h (class Target): Add reloc_symbol_index and reloc_addend
76 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
78 * layout.cc (add_target_dynamic_tags): Use output section for
79 DT_PLTRELSZ and DT_JMPREL.
81 2010-01-07 Ian Lance Taylor <iant@google.com>
84 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
86 (class Output_data_reloc_generic): Define.
87 (class Output_data_reloc_base): Change base class to
88 Output_data_reloc_generic. Change add() method to call
89 bump_relative_reloc_count for a relative reloc. Remove
91 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
93 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
94 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
96 * layout.h (class Layout): Update declaration.
98 2010-01-07 Ian Lance Taylor <iant@google.com>
100 * output.h (class Output_data): Add const version of
101 output_section and do_output_section.
102 (class Output_section_data): Add const version of
104 (class Output_section): Likewise.
105 * layout.cc (Layout::add_target_dynamic_tags): New function.
106 * layout.h (class Layout): Update declarations.
107 * arm.cc (Target_arm::do_finalize_sections): Use
108 add_target_dynamic_tags.
109 * i386.cc (Target_i386::do_finalize_sections): Likewise.
110 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
111 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
112 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
114 2010-01-07 Ian Lance Taylor <iant@google.com>
117 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
120 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
121 Ian Lance Taylor <iant@google.com>
124 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
125 Xindex::read_symtab_xindex.
127 2010-01-07 Doug Kwan <dougkwan@google.com>
129 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
130 (Insn_template::thumb16_bcond_insn): New method declaration.
131 (Insn_template): Fix spelling.
132 (Stub::thumb16_special): New method declaration.
133 (Stub::do_write): Define virtual method which was previously pure
135 (Stub::do_thumb16_special): New method declaration.
136 (Stub::do_fixed_endian_write): New template member.
137 (Reloc_stub::do_write): Remove.
138 (Reloc_stub::do_fixed_endian_write): Remove.
139 (Cortex_a8_stub): New class definition.
140 (Stub_factory::make_cortex_a8_stub): New method definition.
141 (Stub_factory::Stub_factory): Add missing static storage class
142 qualifier for elf32_arm_stub_a8_veneer_blx.
144 2010-01-07 Ian Lance Taylor <iant@google.com>
147 * options.h (class General_options): Add --warn-unresolved-symbols
148 and --error-unresolved-symbols.
149 * errors.cc (Errors::undefined_symbol): Implement
150 --warn-unresolved-symbols.
152 * options.h (class General_options): Add -z text and -z textoff.
153 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
155 2010-01-06 Sriraman Tallam <tmsriram@google.com>
157 * gc.h (Garbage_collection::Cident_section_map): New typedef.
158 (Garbage_collection::cident_sections): New function.
159 (Garbage_collection::add_cident_section): New function.
160 (Garbage_collection::cident_sections_): New member.
161 (gc_process_relocs): Add references to sections whose names are C
163 * gold.h (cident_section_start_prefix): New constant.
164 (cident_section_stop_prefix): New constant.
165 (is_cident): New function.
166 * layout.cc (Layout::define_section_symbols): Replace string constants
167 with the newly defined constants.
168 * object.cc (Sized_relobj::do_layout): Track sections whose names are
170 * testsuite/Makefile.am: Add gc_orphan_section_test.
171 * testsuite/Makefile.in: Regenerate.
172 * testsuite/gc_orphan_section_test.cc: New file.
173 * testsuite/gc_orphan_section_test.sh: New file.
175 2010-01-06 Ian Lance Taylor <iant@google.com>
178 * options.h (class General_options): Add --warn-shared-textrel.
179 * layout.cc (Layout::finish_dynamic_section): Implement
180 --warn-shared-textrel.
183 * options.h (class General_options): Add --warn-multiple-gp.
185 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
187 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
188 $(THREADSLIB) and $(LIBDL).
189 * Makefile.in: Rebuild.
191 2010-01-06 Ian Lance Taylor <iant@google.com>
194 * options.cc (General_options::parse_section_start): New function.
195 (General_options::section_start): New function.
196 (General_options::General_options): Initialize all members.
197 * options.h: Include <map>
198 (class General_options): Add --section-start. Add section_starts_
200 * layout.cc (Layout::attach_allocated_section_to_segment): If
201 --section-start was used, set the address of the segment. Remove
203 (Layout::relaxation_loop_body): If the address of the load segment
204 has been set by --section-start, don't use it.
205 * output.h (Output_segment::update_flags_for_output_section): New
207 * output.cc (Output_segment::add_output_section): Call
208 update_flags_for_output_section.
210 2010-01-05 Ian Lance Taylor <iant@google.com>
213 * options.h (class General_options): Add --undefined-version.
214 * script.cc (struct Version_expression): Add was_matched_by_symbol
216 (Version_script_info::matched_symbol): New function.
217 (Version_script_info::get_symbol_version_helper): Call
219 (Version_script_info::check_unmatched_names): New function.
220 * script.h (class Version_script_info): Update declarations.
221 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
223 * options.h (class General_options): Use DEFINE_bool_alias for
224 allow_multiple_definition.
225 * resolve.cc (Symbol_table::should_override): Don't test
226 allow_multiple_definition.
229 * options.h (class General_options): Add --cref.
230 * main.cc (main): Print cref table if --cref. Don't close mapfile
231 until after printing cref table.
232 * cref.cc: Include "symtab.h".
233 (class Cref_inputs): Define Cref_table_compare and Cref_table.
234 (Cref_table_compare::operator()): New function.
235 (Cref_inputs::gather_cref): New function.
236 (filecol): New static const.
237 (Cref_inputs::print_cref): New function.
238 (Cref::print_cref): New function.
239 * cref.h: Include <cstdio>.
240 (class Cref): Update declarations.
241 * mapfile.h (Mapfile::file): New function.
242 * object.h (class Object): Define Symbols. Declare virtual
243 do_get_global_symbols.
244 (Object::get_global_symbols): New function.
245 * object.cc (Input_objects::add_object): Pass object to cref_ if
247 (Input_objects::archive_start): Likewise.
248 (Input_objects::archive_stop): Likewise.
249 (Input_objects::print_cref): New function.
250 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
251 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
253 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
255 * plugin.h (class Sized_pluginobj): Update declarations.
257 2010-01-05 Ian Lance Taylor <iant@google.com>
259 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
260 to is_default_version. Rename insdef to insdefault.
261 (Symbol_table::add_from_relobj): Rename def to is_default_version
262 and local to is_forced_local.
263 (Symbol_table::add_from_pluginobj): Likewise.
264 (Symbol_table::add_from_dynobj): Likewise.
265 (Symbol_table::define_special_symbol): Rename insdef to
268 2010-01-04 Ian Lance Taylor <iant@google.com>
271 * options.h (class General_options): Add
272 --allow-multiple-definition and -z muldefs.
273 * resolve.cc (Symbol_table::should_override): Don't warn about a
274 multiple symbol definition if --allow-multiple-definition or -z
278 * options.h (class General_options): Add --add-needed and
279 --copy-dt-needed-entries. Tweak --as-needed help entry.
280 * object.cc (Input_objects::check_dynamic_dependencies): Give an
281 error if --copy-dt-needed-entries aka --add-needed is used and
282 would cause a change in behaviour.
285 * options.h (class General_options): Add -G as a short version of
286 --shared. Add no-op options -assert, -g, and -i.
288 2010-01-04 Sriraman Tallam <tmsriram@google.com>
290 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
291 check for .text or .gnu.linkonce.t sections.
292 * icf.cc (Icf::find_identical_sections): Ditto.
293 Change the detection for mangled function name within the section
295 * icf.h (is_section_foldable_candidate): New function.
297 2009-12-30 Ian Lance Taylor <iant@google.com>
300 * options.h (class General_options): Permit two dashes with
301 --retain-symbols-file.
303 2009-12-30 Ian Lance Taylor <iant@google.com>
306 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
307 don't put the file header and segment headers in the text
311 * common.cc (Sort_commons::operator()): Stabilize sort when both
313 (Symbol_table::do_allocate_commons_list): When allocating common
314 symbols, skip a symbol which is no longer common.
315 * symtab.h (Symbol::is_common): Test whether the symbol comes from
316 an object before checking its type.
317 * testsuite/common_test_2.c: New file.
318 * testsuite/common_test_3.c: New file.
319 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
320 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
321 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
322 (common_test_2_pic.o, common_test_2.so): New targets.
323 (common_test_3_pic.o, common_test_3.so): New targets.
324 * testsuite/Makefile.in: Rebuild.
327 * script.cc (read_input_script): If we see a new SECTIONS clause,
328 and we have added an input section, give an error.
329 * layout.h (class Layout): Add have_added_input_section function.
330 Add have_added_input_section_ field.
331 * layout.cc (Layout::Layout): Initialize
332 have_added_input_section_.
333 (Layout::layout): Set have_added_input_section_.
334 (Layout::layout_eh_frame): Likewise.
336 2009-12-30 Ian Lance Taylor <iant@google.com>
339 * options.h (class General_options): Add --sort-common option.
340 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
341 * common.cc (Sort_common): Add sort_order parameter to
342 constructor. Add sort_order_ field.
343 (Sort_commons::operator): Check sort_order_.
344 (Symbol_table::allocate_commons): Determine the sort order.
345 (Symbol_table::do_allocate_commons): Add sort_order parameter.
347 (Symbol_table::do_allocate_commons_list): Likewise.
349 2009-12-30 Ian Lance Taylor <iant@google.com>
352 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
353 symbols from this object, don't change the visibility of an
355 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
357 2009-12-30 Ian Lance Taylor <iant@google.com>
360 * script.h (class Version_script_info): Define Language enum.
361 Update declarations. Define Glob, Exact, and Lookup types. Add
362 new fields globals_, locals_, and is_finalized_.
363 * script.cc: Various formatting fixes.
364 (class Parser_closure): Change language_stack_ from a vector of
365 std::string to one of Version_script_info::Language. Adjust all
367 (class Lazy_demangler): Remove.
368 (struct Version_expression): Change language from std::string to
369 Version_script_info::Language.
370 (Version_script_info::Version_script_info): New function.
371 (Version_script_info::~Version_script_info): Don't call clear.
372 (Version_script_info::finalize): New function.
373 (Version_script_info::build_lookup_tables): New function.
374 (Version_script_info::build_expression_list_lookup): New
376 (Version_script_info::get_symbol_version_helper): Rewrite to use
378 (Version_script_info::print_expression_list): Adjust to use
379 Version_script_info::Language.
380 (script_push_lex_into_version_mode): Check that the version script
381 has not been finalized.
382 (version_script_push_lang): Change language string to
383 Version_script_info::Language.
384 * options.cc (Command_line::version_script): New function.
385 * options.h (class General_options): Add finalize_dynamic_list
386 function. Change version_script from declaration to definition.
387 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
388 * testsuite/version_script.map: Remove duplicate def of foo.
389 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
391 * testsuite/Makefile.in: Rebuild.
393 2009-12-30 Ian Lance Taylor <iant@google.com>
396 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
397 if the input symbol index is 0, make the output symbol index 0.
399 2009-12-30 Ian Lance Taylor <iant@google.com>
402 * options.h (class General_options): Add -x/--discard-all.
403 * object.cc (Sized_relobj::do_count_local_symbols): Handle
404 --discard-all. If the local symbol needs a dynamic entry, check
405 that before handling --discard-locals.
407 2009-12-30 Ian Lance Taylor <iant@google.com>
410 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
412 (Output_segment::add_output_section): Don't change the flags if
416 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
417 GNU hash table if they need a dynamic value. Otherwise, don't add
418 them if they are defined in a dynamic object or are forced local.
420 2009-12-29 Ian Lance Taylor <iant@google.com>
423 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
424 .gnu.hash table for a 32-bit target.
427 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
428 regular and a dynamic object only needs a dynamic symbol table
429 entry if it is externally visible.
432 * i386.cc (class Target_i386): Initialize global_offset_table_ in
433 constructor. Add global_offset_table_ field.
434 (Target_i386::got_section): Set global_offset_table_.
435 (Target_i386::do_finalize_sections): Set global_offset_table_
437 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
438 in constructor. Add global_offset_table_ field.
439 (Target_x86_64::got_section): Set global_offset_table_.
440 (Target_x86_64::do_finalize_sections): Set global_offset_table_
443 * layout.cc (Layout::Layout): Initialize increase_relro_.
444 (Layout::get_output_section): Add is_relro, is_last_relro, and
445 is_first_non_relro parameters. Change all callers.
446 (Layout::choose_output_section): Likewise.
447 (Layout::add_output_section_data): Likewise.
448 (Layout::make_output_section): Likewise.
449 (Layout::set_segment_offsets): Clear increase_relro when using a
451 * layout.h (class Layout): Add increase_relro method. Add
452 increase_relro_ field. Update declarations.
453 * output.cc (Output_section::Output_section): Initialize
454 is_last_relro_ and is_first_non_relro_.
455 (Output_segment::add_output_section): Group relro sections is
456 do_sort is true. Handle is_last_relro and is_first_non_relro.
457 (Output_segment::maximum_alignment): Remove relro handling.
458 (Output_segment::set_section_addresses): Add increase_relro
459 parameter. Change all callers. Add initial alignment to align
460 relro sections on separate page. Remove old relro handling.
461 (Output_segment::set_section_list_addresses): Remove in_relro
462 parameter. Change all callers.
463 (Output_segment::set_offset): Add increase parameter. Change all
464 callers. Remove old relro handling.
465 * output.h (class Output_section): Add new methods: is_last_relro,
466 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
467 Add is_last_relro_ and is_first_non_relro_ fields.
468 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
469 Create separate .got.plt section. Call increase_relro.
470 * x86_64.cc (Target_x86_64::got_section): Likewise.
471 * testsuite/relro_script_test.t: Add .got.plt.
474 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
475 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
476 (Layout::finalize): Call set_dynamic_symbol_size.
477 (Layout::set_dynamic_symbol_size): New function.
478 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
479 set_dynamic_symbol_size.
482 * output.h (class Output_section): Add is_entsize_zero_ field.
483 * output.cc (Output_section::Output_section): Initialize
485 (Output_section::set_entsize): If two different entsizes are
486 requested, force it to zero.
487 (Output_section::add_input_section): Set flags for .debug_str
488 before updating section flags. Set entsize.
489 (Output_section::update_flags_for_input_section): Set SHF_MERGE
490 and SHF_STRING if all input sections have those flags.
492 2009-12-29 Rafael Espindola <espindola@google.com>
494 * main.cc (main): Fix the sys time reporting.
495 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
498 2009-12-29 Sriraman Tallam <tmsriram@google.com>
500 * options.cc (General_options::parse_version): Allow -v to exit
501 without an error if there is nothing to link.
503 2009-12-29 Ian Lance Taylor <iant@google.com>
505 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
506 using a version of gcc before 4.1.
507 * configure: Rebuild.
509 2009-12-28 Chris Demetriou <cgd@google.com>
511 * attributes.cc (Output_attributes_section_data::do_write): Use
512 std::vector::front rather than std::vector::data.
514 2009-12-28 Ian Lance Taylor <iant@google.com>
516 * symtab.h (class Symbol_table): Add enum Defined.
517 * resolve.cc (Symbol_table::should_override): Add defined
518 parameter. Change all callers. Test whether object is NULL
519 before calling a method on it.
520 (Symbol_table::report_resolve_problem): Add defined parameter.
522 (Symbol_table::should_override_with_special): Likewise.
523 * symtab.cc (Symbol_table::define_in_output_data): Add defined
524 parameter. Change all callers.
525 (Symbol_table::do_define_in_output_data): Likewise.
526 (Symbol_table::define_in_output_segment): Likewise.
527 (Symbol_table::do_define_in_output_segment): Likewise.
528 (Symbol_table::define_as_constant): Likewise.
529 (Symbol_table::do_define_as_constant): Likewise.
530 * script.h (class Symbol_assignment): Add is_defsym parameter to
531 constructor; change all callers.
532 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
533 parameter. Change all callers. Add is_defsym_ field.
534 (class Parser_closure): Add parsing_defsym parameter to
535 constructor; change all callers. Add parsing_defsym accessor
536 function. Add parsing_defsym_ field.
538 2009-12-28 Ian Lance Taylor <iant@google.com>
540 * gold.cc (queue_middle_tasks): Fix formatting.
541 * object.cc (Relobj::is_section_name_included): Likewise.
543 2009-12-23 Ian Lance Taylor <iant@google.com>
545 * i386.cc (Target_i386::do_calls_non_split): Recognize
546 -fsplit-stack prologue for a function with a static chain.
547 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
548 -fsplit-stack prologue when using %r11.
550 2009-12-21 Sriraman Tallam <tmsriram@google.com>
552 * options.cc (General_options::parse_version): Make -v continue and do
553 the link like GNU ld does.
555 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
557 * Makefile.am (CCFILES): Add timer.cc.
558 (HFILES): Add timer.h.
559 * configure.ac: Check for sysconf and times.
560 * main.cc: include timer.h.
561 (main): Use Timer instead of get_run_time.
564 * workqueue.cc: include timer.h.
565 (Workqueue::find_and_run_task):
566 Report user, sys and wall time.
567 * Makefile.in: Regenerate.
568 * config.in: Regenerate.
569 * configure: Regenerate.
571 2009-12-16 Doug Kwan <dougkwan@google.com>
573 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
575 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
576 relaxed input sections.
577 * output.cc (Output_section::find_relaxed_input_section): Change
578 return type to Output_relaxed_input_section pointer. Adjust code
579 for new type of relaxed_input_section_map_.
580 * output.h (Output_section::find_relaxed_input_section): Change
581 return type to Output_relaxed_input_section pointer.
582 (Output_section::Output_relaxed_input_section_by_input_section_map):
584 (Output_section::relaxed_input_section_map_): Change type to
585 Output_section::Output_relaxed_input_section_by_input_section_map.
586 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
589 2009-12-15 Ian Lance Taylor <iant@google.com>
591 * layout.cc (Layout::create_shstrtab): Only write out after input
592 sections if we are compressing debug sections.
594 2009-12-15 Ian Lance Taylor <iant@google.com>
596 * archive.cc (Archive::add_symbols): Only look up a symbol without
597 a version if there is, in fact, a version.
599 2009-12-14 Ian Lance Taylor <iant@google.com>
601 Revert -Wshadow changes, all changes from:
602 2009-12-11 Doug Kwan <dougkwan@google.com>
603 2009-12-11 Nick Clifton <nickc@redhat.com>
604 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
606 2009-12-11 Doug Kwan <dougkwan@google.com>
608 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
610 * attributes.cc (Object_attribute::size): Ditto.
611 (Attributes_section_data::size): Ditto.
612 (Attributes_section_data::Attributes_section_data): Ditto.
613 (Output_attributes_section_data::do_write): Ditto.
614 * attributes.h (Object_attribute::set_type): Ditto.
615 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
617 2009-12-11 Nick Clifton <nickc@redhat.com>
619 * archive.cc: Fix shadowed variable warnings.
621 * compressed_output.cc: Likewise.
622 * compressed_output.h: Likewise.
623 * configure: Likewise.
624 * dwarf_reader.cc: Likewise.
625 * dynobj.cc: Likewise.
626 * dynobj.h: Likewise.
627 * ehframe.cc: Likewise.
628 * ehframe.h: Likewise.
629 * errors.cc: Likewise.
630 * expression.cc: Likewise.
631 * fileread.cc: Likewise.
632 * fileread.h: Likewise.
633 * freebsd.h: Likewise.
636 * incremental.h: Likewise.
637 * layout.cc: Likewise.
638 * layout.h: Likewise.
639 * mapfile.cc: Likewise.
640 * merge.cc: Likewise.
642 * object.cc: Likewise.
643 * object.h: Likewise.
644 * options.h: Likewise.
645 * output.cc: Likewise.
646 * output.h: Likewise.
647 * parameters.cc: Likewise.
648 * plugin.cc: Likewise.
649 * powerpc.cc: Likewise.
650 * reduced_debug_output.cc: Likewise.
651 * reduced_debug_output.h: Likewise.
652 * reloc.cc: Likewise.
654 * resolve.cc: Likewise.
655 * script-sections.cc: Likewise.
656 * script.cc: Likewise.
657 * script.h: Likewise.
658 * sparc.cc: Likewise.
659 * symtab.cc: Likewise.
660 * symtab.h: Likewise.
661 * target-select.cc: Likewise.
662 * target-select.h: Likewise.
664 * workqueue.cc: Likewise.
665 * workqueue.h: Likewise.
666 * x86_64.cc: Likewise.
668 2009-12-10 Doug Kwan <dougkwan@google.com>
670 * arm.cc (attributes.h): New include.
671 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
672 (Arm_relobj::~Arm_relobj): Delete object pointed by
673 attributes_section_data_.
674 (Arm_relobj::attributes_section_data): New method definition.
675 (Arm_relobj::attributes_section_data_): New data member declaration.
676 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
677 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
678 attributes_section_data_.
679 (Arm_dynobj::attributes_section_data): New method definition.
680 (Arm_dynobj::attributes_section_data_): New data member declaration.
681 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
682 initialization value of may_use_blx_ to false.
683 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
684 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
685 object attributes to compute results instead of hard-coding.
686 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
687 Target_arm::get_secondary_compatible_arch,
688 Target_arm::set_secondary_compatible_arch
689 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
690 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
691 New method declarations.
692 (Target_arm::get_aeabi_object_attribute): New method definition.
693 (Target_arm::attributes_section_data_): New data member declaration.
694 (read_arm_attributes_section): New template definition.
695 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
696 (Arm_dynobj::do_read_symbols): Ditto.
697 (Target_arm::do_finalize_sections): Merge attributes sections from
698 input. Check for BLX use after attributes section merging.
699 Fix __exidx_start and __exidx_end visibility. Create an
700 .ARM.attributes section if necessary.
701 (Target_arm::get_secondary_compatible_arch,
702 Target_arm::set_secondary_compatible_arch,
703 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
704 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
705 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
706 New method definitions.
708 2009-12-09 Ian Lance Taylor <iant@google.com>
710 * plugin.cc (Plugin::load): Don't cast from void* to a function
713 2009-12-09 Ian Lance Taylor <iant@google.com>
715 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
718 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
720 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
721 Replace two_file_shared_1.so with two_file_shared_2.so.
722 * testsuite/Makefile.in: Regenerated.
724 2009-12-08 Doug Kwan <dougkwan@google.com>
726 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
727 (HFILES): Add attributes.h and int_encoding.h.
728 * Makefile.in: Regenerate.
729 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
730 function definitions to int_encoding.cc
731 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
732 prototypes to int_encoding.h
733 * reduced_debug_output.cc (int_encoding.h): New include.
734 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
735 function definitions to int_encoding.cc
736 (insert_into_vector, read_from_pointer): Move template definitions to
738 * attributes.cc: New file.
739 * attributes.h: New file.
740 * int_encoding.cc: New file.
741 * int_encoding.h: New file.
743 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
746 * incremental-dump.cc (dump_incremental_inputs): New.
747 (main): Use dump_incremental_inputs.
749 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
752 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
753 checking elfcpp::STT_FUNC.
754 (Target_i386::Relocate::relocate): Likewise.
755 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
757 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
758 symbols from shared libraries into normal FUNC symbols.
760 * symtab.h (Symbol): Add is_func and use it.
762 2009-12-05 Doug Kwan <dougkwan@google.com>
764 * arm.cc (Target_arm::arm_info): Initialize new fields
765 attributes_section and attributes_vendor.
766 * i386.cc (Target_i386::i386_info): Same.
767 * object.cc (Sized_relobj::do_layout): Skip attribute section.
768 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
769 fields attributes_section and attributes_vendor.
770 * sparc.cc (Target_sparc::sparc_info): Same.
771 * target.h (Target::attributes_section, Target::attributes_vendor,
772 Target::is_attributes_section, Target::attribute_arg_type,
773 Target::attributes_order): New method definitions.
774 (Target::Target_info::attributes_section,
775 Target::Target_info::attributes_vendor): New fields.
776 (Target::do_attribute_arg_type, Target::do_attributes_order): New
777 virtual method definitions.
778 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
779 attributes_section and attributes_vendor.
780 * testsuite/testfile.cc (Target_test::test_target_info): Same.
782 2009-12-05 Doug Kwan <dougkwan@google.com>
784 * arm.cc: Update comments about interworking and stub generation.
785 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
786 considered as non-PIC.
787 (Arm_relocate_functions::base_abs): Fix formatting.
788 (Arm_relocate_functions::got_prel): Fix comment. Change interface
789 of function to use GOT entry address instead of offset.
790 (Target_arm::Scan::global): Issue an error if a symbol would need a
791 PLT does not get one because it is untyped. Remove code to create
792 dynamic symbols for relative branches.
793 (Target_arm::Relocate::relocate: Use 0 instead of false since function
794 takes unsigned integer instead of boolean.
796 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
798 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
799 (two_file_test_LDADD): Likewise.
800 (common_test_1_LDADD): Likewise.
801 (exception_test_LDADD) Likewise.
802 (weak_test_LDADD): Likewise.
803 (many_sections_test_LDADD): Likewise.
804 (initpri1_LDADD): Likewise.
805 (script_test_1_LDADD): Likewise.
806 (script_test_2_LDADD): Likewise.
807 (justsyms_LDADD): Likewise.
808 (binary_test_LDADD): Likewise.
809 (large_LDADD): Likewise.
810 * testsuite/Makefile.in: Regenerated.
812 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
814 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
815 (Symbol_table::override_with_special): Likewise.
816 (Symbol_table::add_from_object): Likewise.
818 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
820 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
821 Don't set the data_offset twice.
823 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
825 * testsuite/Makefile.in: Regenerate.
827 2009-12-03 Doug Kwan <dougkwan@google.com>
829 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
830 (Target_arm::do_finalize_sections): Add parameter for symbol table
831 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
832 * i386.cc (Target_i386::do_finalize_sections): Add an additional
833 parameter for symbol table pointer.
834 * layout.cc (Layout::finalize): Call Target::finalize_sections with
835 an additional parameter for a pointer to symbol table.
836 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
837 parameter for a symbol table pointer.
838 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
839 * target.h (Target::finalize_sections, Target::do_finalize_sections):
841 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
842 parameter for a symbol table pointer.
844 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
846 * incremental.cc (Incremental_inputs_header)
847 (Incremental_inputs_header_write, Incremental_inputs_entry)
848 (Incremental_inputs_entry_write): Move ...
849 * incremental.h (Incremental_inputs_header)
850 (Incremental_inputs_header_write, Incremental_inputs_entry)
851 (Incremental_inputs_entry_write): here.
853 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
855 * incremental.cc (make_sized_incremental_binary): Set the target.
856 Error if it is incompatible.
857 * output.h (Output_file): Add filename method.
859 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
861 * incremental.cc (Incremental_inputs_entry): Remove unused argument
862 from the get_* methods.
864 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
866 * incremental-dump.cc (main): Check that the offeset of a script is 0.
867 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
868 Write 0 for the data_offset of scripts.
870 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
872 * testsuite/Makefile.am: Add the incremental_test.sh test.
873 * testsuite/incremental_test.sh: New.
874 * testsuite/incremental_test_1.c: New.
875 * testsuite/incremental_test_2.c: New.
877 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
879 * incremental-dump.cc (main): Fix typos.
881 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
884 * incremental-dump.cc (main): Use llu to print 64 bit values.
886 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
887 H.J. Lu <hongjiu.lu@intel.com>
889 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
891 (incremental_dump_LDADD): Likewise.
892 * Makefile.in: Regenerated.
894 2009-11-25 Doug Kwan <dougkwan@google.com>
898 2009-11-25 Doug Kwan <dougkwan@google.com>
900 * arm.cc (Target_arm::Target_arm): Move method definition
901 outside of class definition. Add code to handle
902 --target1-rel, --target1-abs and --target2= options.
903 (Target_arm::get_reloc_reloc_type): Change method to be
904 non-static and const.
905 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
906 New data member declaration.
907 (Target_arm::Scan::local, Target_arm::Scan::global,
908 Target_arm::Relocate::relocate,
909 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
910 Adjust call to Target_arm::get_real_reloc_type.
911 (Target_arm::get_real_reloc_type): Use command line options
912 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
913 * options.h (--target1-rel, --target1-abs, --target2): New
916 2009-11-25 Doug Kwan <dougkwan@google.com>
918 * arm.cc (Target_arm::Target_arm): Move method definition outside of
919 class definition. Add code to handle --target1-rel, --target1-abs
920 and --target2= options.
921 (Target_arm::get_reloc_reloc_type): Change method to be non-static
923 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
925 (Target_arm::Scan::local, Target_arm::Scan::global,
926 Target_arm::Relocate::relocate,
927 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
928 call to Target_arm::get_real_reloc_type.
929 (Target_arm::get_real_reloc_type): Use command line options to
930 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
931 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
934 2009-11-25 Doug Kwan <dougkwan@google.com>
936 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
937 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
938 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
940 (Arm_relocate_functions::thm_call): Replace body with a call to
941 Arm_relocate_functions::thumb_branch_common.
942 (Arm_relocate_functions::thm_jump24,
943 Arm_relocate_functions::thm_xpc22): New method definitions.
944 (Arm_relocate_functions::thumb_branch_common): New method definition.
945 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
947 (Target_arm::Relocate::relocate): Adjust call to thm_call.
948 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
950 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
952 * Makefile.am: Build incremental-dump
953 * Makefile.in: Regenerate.
954 * incremental-dump.cc: New.
955 * incremental.cc (Incremental_inputs_header_data,
956 Incremental_inputs_entry_data): Move to incremental.h
957 * incremental.h: (Incremental_inputs_header_data,
958 Incremental_inputs_entry_data): Move from incremental.cc
960 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
962 * incremental.cc (Incremental_inputs_header,
963 Incremental_inputs_header_write, Incremental_inputs_entry,
964 Incremental_inputs_entry_write): Add a typedef with the data type.
966 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
968 * incremental.cc (Incremental_inputs_header,
969 Incremental_inputs_header_write, Incremental_inputs_entry,
970 Incremental_inputs_entry_write): Update comment about which
971 type has the filed descriptions.
973 2009-11-15 Doug Kwan <dougkwan@google.com>
975 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
976 (Arm_relocate_functions::arm_branch_common): Change method defintion
977 in class definition to a method declaration and update list of formal
979 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
980 Arm_relocation_functions::jump24): Adjust call to
981 Arm_relocate_functions::arm_branch_common. Update list of formal
983 (Arm_relocate_functions::xpc25): New method definition.
984 (Arm_relocate_functions::arm_branch_common): Move method defintion
985 out from class definition. Use stubs for mode-switching and extending
987 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
988 specially. Change code to enable use of stubs in ARM branches.
990 2009-11-10 Doug Kwan <dougkwan@google.com>
992 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
993 in method declaration.
994 (Target_arm::relocate_stub): New method declaration.
995 (Target_arm::default_target): Change to return a pointer instead of
997 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
998 Target_arm::default_target.
999 (Arm_Relobj::do_relocate_sections): Remove options paramater in
1001 (Target_arm::relocate_section): Adjust view.
1002 (Target_arm::relocate_stub): New method definition.
1004 2009-11-10 Doug Kwan <dougkwan@google.com>
1006 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1008 * incremental.cc (open_incremental_binary): Initialized local
1009 variables to avoid warnings.
1010 * object.cc (make_elf_object): Ditto.
1011 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1014 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1017 * testsuite/plugin_test.c: Include "config.h".
1019 2009-11-09 Doug Kwan <dougkwan@google.com>
1021 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1022 (arm_symbol_value): Remove.
1023 (Arm_relocate_functions::arm_branch_common,
1024 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1025 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1026 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1027 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1028 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1029 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1030 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1031 Arm_relocate_functions::thm_mobw_abs_nc,
1032 Arm_relocate_functions::thm_mov_abs,
1033 Arm_relocate_functions::movw_prel_nc,
1034 Arm_relocate_functions::thm_movt_abs,
1035 Arm_relocate_functions::movt_prel,
1036 Arm_relocate_functions::thm_movw_prel_nc,
1037 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1038 (Target_arm::Relocate::relocate): Only decompose address into two
1039 parts if relocation type uses the thumb-bit and pass the actual
1040 bit instead of a flag indicating that the thumb-bit is used. Adjust
1041 calls to methods in Arm_relocate_functions for this change.
1043 2009-11-08 Ian Lance Taylor <iant@google.com>
1046 * reloc.cc: Instantiate
1047 Sized_relobj::initialize_input_to_output_maps and
1048 Sized_relobj:free_input_to_output_maps.
1050 2009-11-06 Ian Lance Taylor <iant@google.com>
1053 * defstd.cc (in_segment): Set only_if_ref true for "end".
1055 2009-11-06 Doug Kwan <dougkwan@google.com>
1057 * arm.cc (class Reloc_stub): Correct a comment.
1058 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1059 (Target_arm::scan_section_for_stubs): New method declaration.
1060 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1061 Change methods from private to protected.
1062 (Target_arm::do_may_relax): New method definition.
1063 (Target_arm::do_relax, Target_arm::group_sections,
1064 Target_arm::scan_reloc_for_stub,
1065 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1066 (Target_arm::arm_input_section_map_): New data member declaration.
1067 (Target_arm::scan_reloc_for_stub,
1068 Target_arm::scan_reloc_section_for_stubs,
1069 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1070 Target_arm::do_relax): New method definitions.
1072 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1074 * configure.ac: Check for (struct stat)::st_mtim
1075 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1076 * config.in: Regenerate.
1077 * configure: Regenerate.
1079 2009-11-05 Ian Lance Taylor <iant@google.com>
1082 * output.cc (Output_segment::add_output_section): Add missing
1085 2009-11-04 Ian Lance Taylor <iant@google.com>
1088 * object.h (class Object): Add is_needed and set_is_needed
1089 methods. Add is_needed_ field. Make bool fields into bitfields.
1090 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1091 defined in a dynamic object and referenced by a regular object,
1092 set is_needed for the dynamic object.
1093 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1094 if the file is marked with as_needed and it is not needed.
1096 2009-11-04 Ian Lance Taylor <iant@google.com>
1099 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1100 tags if data is discarded by linker script.
1101 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1102 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1103 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1104 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1106 2009-11-04 Ian Lance Taylor <iant@google.com>
1108 * layout.cc (Layout::get_output_section): Add is_interp and
1109 is_dynamic_linker_section parameters. Change all callers.
1110 (Layout::choose_output_section): Likewise.
1111 (Layout::make_output_section): Likewise.
1112 (Layout::add_output_section_data): Add is_dynamic_linker_section
1113 parameter. Change all callers.
1114 * layout.h (class Layout): Update declarations.
1115 * output.h (class Output_section): Add is_interp, set_is_interp,
1116 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1117 Add is_interp_, is_dynamic_linker_section_ fields. Change
1118 generate_code_fills_at_write_ to a bitfield.
1119 * output.cc (Output_section::Output_sections): Initialize new
1121 (Output_segment::add_output_section): Add do_sort parameter.
1124 2009-11-03 Ian Lance Taylor <iant@google.com>
1127 * options.h (class General_options): Add --warn-common.
1128 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1129 merging two common symbols.
1130 (Symbol_table::should_override): Handle --warn-common when merging
1131 a common symbol with a defined symbol. Use report_resolve_problem
1132 for multiple definitions.
1133 (Symbol_table::report_resolve_problem): New function.
1134 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1136 2009-11-03 Doug Kwan <dougkwan@google.com>
1138 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1140 (Target_arm::stub_factory): New method definition.
1141 (Target_arm::new_arm_input_section,
1142 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1143 Target_arm::reloc_uses_thumb_bit): New method declarations.
1144 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1145 New type definitions.
1146 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1147 member declarations.
1148 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1149 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1150 New method definitions.
1152 2009-11-03 Ian Lance Taylor <iant@google.com>
1154 * options.h (class General_options): Add --warn_constructors.
1156 2009-11-03 Ian Lance Taylor <iant@google.com>
1159 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1160 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1162 2009-11-03 Ian Lance Taylor <iant@google.com>
1165 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1166 --msgid-bugs-address.
1167 (install-pdf): New target.
1168 (install-data_yes): Look up one directory to find mkinstalldirs.
1170 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1172 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1175 2009-10-30 Doug Kwan <dougkwan@google.com>
1177 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1179 2009-10-30 Doug Kwan <dougkwan@google.com>
1181 * arm.cc (Stub_addend_reader): New struct template definition
1182 and partial specializations.
1183 (Stub_addend_reader::operator()): New method definition for a
1184 partially specialized template.
1186 2009-10-30 Doug Kwan <dougkwan@google.com>
1188 * arm.cc (Arm_relobj::processor_specific_flags): New method
1190 (Arm_relobj::do_read_symbols): New method declaration.
1191 (Arm_relobj::processor_specific_flags_): New data member declaration.
1192 (Arm_dynobj): New class definition.
1193 (Target_arm::do_finalize_sections): Add input_objects parameter.
1194 (Target_arm::do_adjust_elf_header): New method declaration.
1195 (Target_arm::are_eabi_versions_compatible,
1196 (Target_arm::merge_processor_specific_flags): New method declaration.
1197 (Target_arm::do_make_elf_object): New overloaded method definitions
1199 (Arm_relobj::do_read_symbols): New method definition.
1200 (Arm_dynobj::do_read_symbols): Ditto.
1201 (Target_arm::do_finalize_sections): Add input_objects parameters.
1202 Merge processor-specific flags from all input objects.
1203 (Target_arm::are_eabi_versions_compatible,
1204 Target_arm::merge_processor_specific_flags,
1205 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1206 New method definitions.
1207 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1208 Input_objects pointer type parameter.
1209 * layout.cc (Layout::finalize): Pass input objects to target's.
1210 finalize_sections function.
1211 * output.cc (Output_file_header::do_sized_write): Set ELF file
1212 header's processor-specific flags.
1213 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1214 Input_objects pointer type parameter.
1215 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1216 * target.h (Input_objects): New forward class declaration.
1217 (Target::processor_specific_flags,
1218 Target::are_processor_specific_flags_sect): New method definitions.
1219 (Target::finalize_sections): Add input_objects parameter.
1220 (Target::Target): Initialize processor_specific_flags_ and
1221 are_processor_specific_flags_set_.
1222 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1224 (Target::set_processor_specific_flags): New method definition.
1225 (Target::processor_specific_flags_,
1226 Target::are_processor_specific_flags_set_): New data member
1228 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1229 Input_objects pointer type parameter.
1231 2009-10-30 Doug Kwan <dougkwan@google.com>
1233 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1235 2009-10-28 Ian Lance Taylor <iant@google.com>
1237 * object.h (class Relobj): Drop options parameter from
1238 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1239 do_scan_relocs, do_relocate. Change all callers.
1240 (class Sized_relobj): Drop options parameters from
1241 do_gc_process_relocs, do_scan_relocs, do_relocate,
1242 do_relocate_sections, relocate_sections, emit_relocs_scan,
1243 emit_relocs_scan_reltype. Change all callers.
1244 (struct Relocate_info): Remove options field and all references to
1246 * reloc.h (class Read_relocs): Remove options constructor
1247 parameter and options_ field. Change all callers.
1248 (class Gc_process_relocs, class Scan_relocs): Likewise.
1249 (class Relocate_task): Likewise.
1250 * target-reloc.h (scan_relocs): Remove options parameter. Change
1252 (scan_relocatable_relocs): Likewise.
1253 * target.h (class Sized_target): Remove options parameter from
1254 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1256 * gc.h (gc_process_relocs): Remove options parameter. Change all
1258 * arm.cc: Update functions to remove options parameters.
1259 * i386.cc: Likewise.
1260 * powerpc.cc: Likewise.
1261 * sparc.cc: Likewise.
1262 * x86_64.cc: Likewise.
1263 * testsuite/testfile.cc: Likewise.
1265 2009-10-28 Doug Kwan <dougkwan@google.com>
1267 * arm.cc (Arm_relobj): New class definition.
1268 (Arm_relobj::scan_sections_for_stubs,
1269 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1270 New method definitions.
1272 2009-10-28 Cary Coutant <ccoutant@google.com>
1274 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1275 (Plugin::cleanup_done_): New member.
1276 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1277 (Plugin_manager::cleanup_done_): Remove.
1278 (Plugin_manager::add_input_file): Edit error message.
1279 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1280 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1282 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1284 * fileread.cc: (File_read::View::~View): Use the new
1285 data_ownership_ filed.
1286 (File_read::~File_read): Dispose the new whole_file_view_.
1287 (File_read::open): Mmap the whole file if needed.
1288 (File_read::open): Use whole_file_view_ instead of contents_.
1289 (File_read::find_view): Use whole_file_view_ if applicable.
1290 (File_read::do_read): Use whole_file_view_ instead of contents_.
1291 (File_read::make_view): Use whole_file_view_ instead of contents_,
1292 update File_read::View::View call.
1293 (File_read::find_or_make_view): Update File_read::View::View
1295 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1297 (File_read::View::Data_ownership): New enum.
1298 (File_read::View::View): Replace bool mapped_ with Data_ownership
1300 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1301 (File_read::View::data_ownership_): New field.
1302 (File_read::contents_): Remove (replaced by whole_file_view_).
1303 (File_read::whole_file_view_): New field.
1304 * options.h (class General_options): Add --keep-files-mapped.
1306 2009-10-27 Cary Coutant <ccoutant@google.com>
1308 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1309 * testsuite/Makefile.am (plugin_test_5): New test case.
1310 * testsuite/Makefile.in: Regenerate.
1312 2009-10-25 Doug Kwan <dougkwan@google.com>
1314 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1315 from private to protected to allow access by child class.
1316 (Sized_relobj::do_relocate_sections): New method declaration.
1317 (Sized_relobj::relocate_sections): Virtualize.
1318 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1319 Sized_relobj::relocate_sections. Instantiate template explicitly
1320 for different target sizes and endianity.
1322 2009-10-24 Doug Kwan <dougkwan@google.com>
1324 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1325 (Arm_input_section::as_arm_input_section): New method.
1326 (Arm_output_section): New class definition.
1327 (Arm_output_section::create_stub_group,
1328 Arm_output_section::group_sections): New method definitions.
1330 2009-10-22 Doug Kwan <dougkwan@google.com>
1332 * arm.cc (Arm_input_section): New class definition.
1333 (Arm_input_section::init, Arm_input_section:do_write,
1334 Arm_input_section::set_final_data_size,
1335 Arm_input_section::do_reset_address_and_file_offset): New method
1338 2009-10-21 Doug Kwan <dougkwan@google.com>
1340 * arm.cc (Stub_table, Arm_input_section): New forward class
1342 (Stub_table): New class defintion.
1343 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1344 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1345 New method definition.
1347 2009-10-21 Doug Kwan <dougkwan@google.com>
1349 * arm.cc: Update copyright comments.
1350 (Target_arm): New forward class template declaration.
1351 (Arm_address): New type.
1352 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1353 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1354 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1356 (Insn_template): Same.
1357 (DEF_STUBS): New macro.
1358 (Stub_type): New enum type.
1359 (Stub_template): New class definition.
1362 (Stub_factory): Same.
1363 (Target_arm::Target_arm): Initialize may_use_blx_ and
1364 should_force_pic_veneer_.
1365 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1366 Target_arm::should_force_pic_veneer,
1367 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1368 Target_arm::using_thumb_only, Target_arm:;default_target): New
1370 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1371 New data member declarations.
1372 (Insn_template::size, Insn_template::alignment): New method defintions.
1373 (Stub_template::Stub_template): New method definition.
1374 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1375 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1376 (Stub_factory::Stub_factory): New method definition.
1377 * gold.h (string_hash): New template.
1378 * output.h (Input_section_specifier::hash_value): Use
1380 (Input_section_specifier::string_hash): Remove.
1381 * stringpool.cc (Stringpool_template::string_hash): Use
1384 2009-10-20 Doug Kwan <dougkwan@google.com>
1386 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1387 symbols of relaxed input sections.
1388 * output.h (Output_section::find_relaxed_input_section): Make
1391 2009-10-16 Doug Kwan <dougkwan@google.com>
1393 * dynobj.cc (Versions::Versions): Initialize version_script_.
1394 Only insert base version symbol definition for a shared object
1395 if version script defines any version versions.
1396 (Versions::define_base_version): New method definition.
1397 (Versions::add_def): Check that base version is not needed.
1398 (Versions::add_need): Define base version lazily.
1399 * dynobj.h (Versions::define_base_version): New method declaration.
1400 (Versions::needs_base_version_): New data member declaration.
1401 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1402 (check_DATA): Add no_version_test.stdout.
1403 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1405 * testsuite/Makefile.in: Regenerate.
1406 * testsuite/no_version_test.c: New file.
1407 * testsuite/no_version_test.sh: Ditto.
1409 2009-10-16 Doug Kwan <dougkwan@google.com>
1411 * expression.cc (class Segment_start_expression): New class definition.
1412 (Segment_start_expression::value): New method definition.
1413 (script_exp_function_segment_start): Return a new
1414 Segment_start_expression.
1415 * gold/script-c.h (script_saw_segment_start_expression): New function
1417 * script-sections.cc (Script_sections::Script_sections): Initialize
1418 SAW_SEGMENT_START_EXPRESSION_ to false.
1419 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1420 and -Tbbs options to specify section addresses if given in
1421 command line and no SEGMENT_START expression is seen in a script.
1422 * script-sections.h (Script_sections::saw_segment_start_expression,
1423 Script_sections::set_saw_segment_start_expression): New method
1425 (Script_sections::saw_segment_start_expression_): New data member
1427 * script.cc (script_saw_segment_start_expression): New function.
1428 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1429 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1430 script_test_7.sh and script_test_8.sh.
1431 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1432 script_test_8.stdout.
1433 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1434 (script_test_6, script_test_6.stdout, script_test_7,
1435 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1436 * Makefile.in: Regenerate.
1437 * testsuite/script_test_6.sh: New file.
1438 * testsuite/script_test_6.t: Same.
1439 * testsuite/script_test_7.sh: Same.
1440 * testsuite/script_test_7.t: Same.
1441 * testsuite/script_test_8.sh: Same.
1443 2009-10-16 Doug Kwan <dougkwan@google.com>
1445 * output.cc (Output_segment::set_section_list_address): Cast
1446 expressions to unsigned long long type to avoid format warnings.
1448 2009-10-15 Ian Lance Taylor <iant@google.com>
1450 * script.cc (Script_options::add_symbol_assignment): Always add a
1451 dot assignment to script_sections_.
1452 * script-sections.cc (Script_sections::add_dot_assignment):
1453 Initialize if necessary.
1455 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1456 program headers with no load segment if there is a linker script.
1458 * layout.cc (Layout::set_segment_offsets): Align the file offset
1459 to the segment aligment for -N or -n with no load segment.
1460 * output.cc (Output_segment::add_output_section): Don't crash if
1461 the first section is a TLS section.
1462 (Output_segment::set_section_list_addresses): Print an error
1463 message if the address moves backward in a linker script.
1464 * script-sections.cc
1465 (Output_section_element_input::set_section_addresses): Don't
1466 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1467 (Orphan_output_section::set_section_addresses): Likewise.
1469 2009-10-15 Doug Kwan <dougkwan@google.com>
1471 * layout.cc (Layout::finish_dynamic_section): Generate tags
1472 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1473 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1474 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1476 2009-10-14 Ian Lance Taylor <iant@google.com>
1478 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1480 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1481 data_shdr fields of relinfo.
1482 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1483 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
1484 R_386_TLS_LDO_32, adjust based on section flags.
1485 (Target_i386::Relocate::fix_up_ldo): Remove.
1487 2009-10-13 Ian Lance Taylor <iant@google.com>
1489 Add support for -pie.
1490 * options.h (class General_options): Add -pie and
1492 (General_options::output_is_position_independent): Test -pie.
1493 (General_options::output_is_executable): Return true if not shared
1494 and not relocatable.
1495 (General_options::output_is_pie): Remove.
1496 * options.cc (General_options::finalize): Reject incompatible uses
1498 * gold.cc (queue_middle_tasks): A -pie link is not static.
1499 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1500 * symtab.cc (Symbol::final_value_is_known): Return false if
1501 output_is_position_independent.
1502 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1503 output_is_position_independent.
1504 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1505 output_is_position_independent.
1506 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1507 output_is_position_independent.
1508 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1510 (basic_pie_test.o, basic_pie_test): New targets.
1511 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1512 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1513 (two_file_pie_test): New target.
1514 * testsuite/Makefile.in: Rebuild.
1515 * README: Remove note saying that -pie is not supported.
1517 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
1519 * options.h (class General_options): Add -init and -fini.
1520 * layout.cc (Layout::finish_dynamic_section): Emit
1521 given init and fini functions.
1523 2009-10-13 Sriraman Tallam <tmsriram@google.com>
1525 * gc.h (gc_process_relocs): Check if icf is enabled using new
1527 * gold.cc (queue_initial_tasks): Likewise.
1528 (queue_middle_tasks): Likewise.
1529 * object.cc (do_layout): Likewise.
1530 * symtab.cc (is_section_folded): Likewise.
1531 * main.cc (main): Likewise.
1532 * reloc.cc (Read_relocs::run): Likewise.
1533 (Sized_relobj::do_scan_relocs): Likewise.
1534 * icf.cc (is_function_ctor_or_dtor): New function.
1535 (Icf::find_identical_sections): Check if function is ctor or dtor when
1537 * options.h (General_options::icf): Change option to be an enum.
1538 (Icf_status): New enum.
1539 (icf_enabled): New method.
1540 (icf_safe_folding): New method.
1541 (set_icf_status): New method.
1542 (icf_status_): New variable.
1543 * (options.cc) (General_options::finalize): Set icf_status_.
1544 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
1545 icf_test and icf_keep_unique_test to use the --icf enum flag.
1546 * testsuite/icf_safe_test.sh: New file.
1547 * testsuite/icf_safe_test.cc: New file.
1549 2009-10-12 Sriraman Tallam <tmsriram@google.com>
1551 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
1552 includes to gc.h and icf.h.
1553 * arm.cc: Include gc.h.
1554 * gold.cc: Likewise.
1555 * i386.cc: Likewise.
1556 * powerpc.cc: Likewise.
1557 * sparc.cc: Likewise.
1558 * x86_64.cc: Likewise.
1559 * gc.h: Include icf.h.
1561 2009-10-11 Ian Lance Taylor <iant@google.com>
1563 * plugin.cc: Include "gold.h" before other header files.
1565 2009-10-10 Chris Demetriou <cgd@google.com>
1567 * options.h (Input_file_argument::Input_file_type): New enum.
1568 (Input_file_argument::is_lib_): Replace with...
1569 (Input_file_argument::type_): New member.
1570 (Input_file_argument::Input_file_argument): Take Input_file_type
1571 'type' rather than boolean 'is_lib' as second argument.
1572 (Input_file_argument::is_lib): Use type_.
1573 (Input_file_argument::is_searched_file): New function.
1574 (Input_file_argument::may_need_search): Handle is_searched_file.
1575 * options.cc (General_options::parse_library): Support -l:filename.
1576 (General_options::parse_just_symbols): Update for Input_file_argument
1578 (Command_line::process): Likewise.
1579 * archive.cc (Archive::get_file_and_offset): Likewise.
1580 * plugin.cc (Plugin_manager::release_input_file): Likewise.
1581 * script.cc (read_script_file, script_add_file): Likewise.
1582 * fileread.cc (Input_file::Input_file): Likewise.
1583 (Input_file::will_search_for): Handle is_searched_file.
1584 (Input_file::open): Likewise.
1585 * readsyms.cc (Read_symbols::get_name): Likewise.
1586 * testsuite/Makefile.am (searched_file_test): New test.
1587 * testsuite/Makefile.in: Regenerate.
1588 * testsuite/searched_file_test.cc: New file.
1589 * testsuite/searched_file_test_lib.cc: New file.
1591 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1592 Ian Lance Taylor <iant@google.com>
1594 * descriptor.cc: Include <cstdio> and "binary-io.h".
1595 (Descriptors::open): Open the files in binary mode always.
1596 * script.cc (Lex::get_token): Treat \r as whitespace.
1598 2009-10-09 Ian Lance Taylor <iant@google.com>
1600 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1602 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1603 Ian Lance Taylor <iant@google.com>
1605 * configure.ac: Check for readv function also.
1606 * fileread.cc (readv): Define if not HAVE_READV.
1607 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1609 * config.in: Regenerate.
1610 * configure: Regenerate.
1612 2009-10-09 Doug Kwan <dougkwan@google.com>
1614 * layout.cc (Layout::make_output_section): Call target hook to make
1615 ordinary output section.
1616 (Layout::finalize): Adjust parameter list of call the
1617 Target::may_relax().
1618 * layout.h (class Layout::section_list): New method.
1619 * merge.h (Output_merge_base::entsize): Change visibility to public.
1620 (Output_merge_base::is_string, Output_merge_base::do_is_string):
1622 (Output_merge_string::do_is_string): New method.
1623 * object.cc (Sized_relobj::do_setup): renamed from
1624 Sized_relobj::set_up.
1625 * object.h (Sized_relobj::adjust_shndx,
1626 Sized_relobj::initializ_input_to_output_maps,
1627 Sized_relobj::free_input_to_output_maps): Change visibilities to
1629 (Sized_relobj::setup): Virtualize.
1630 (Sized_relobj::do_setup): New method declaration.
1631 (Sized_relobj::invalidate_section_offset,
1632 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
1633 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
1634 * options.cc (parse_int): New function.
1635 * options.h (parse_int): New declaration.
1636 (DEFINE_int): New macro.
1637 (stub_group_size): New option.
1638 * output.cc (Output_section::Output_section): Initialize memebers
1639 merge_section_map_, merge_section_by_properties_map_,
1640 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
1641 (Output_section::add_input_section): Handled deferred code-fill
1642 generation and remove an old comment.
1643 (Output_section::add_relaxed_input_section): New method definition.
1644 (Output_section::add_merge_input_section): Use merge section by
1645 properties map to speed to search. Update merge section maps
1647 (Output_section::build_relaxation_map): New method definition.
1648 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1650 (Output_section::relax_input_section): Renamed to
1651 Output_section::convert_input_sections_to_relaxed_sections and change
1652 interface to take a vector of pointers to relaxed sections.
1653 (Output_section::find_merge_section,
1654 Output_section::find_relaxed_input_section): New method definitions.
1655 (Output_section::is_input_address_mapped,
1656 Output_section::output_offset, Output_section::output_address):
1657 Use output section data maps to speed up searching.
1658 (Output_section::find_starting_output_address): Add comments.
1659 (Output_section::do_write,
1660 Output_section::write_to_postprocessing_buffer): Do code-fill
1661 generation as appropriate.
1662 (Output_section::get_input_sections): Invalidate relaxed input section
1664 (Output_section::restore_states): Adjust type of checkpoint .
1665 Invalidate relaxed input section map.
1666 * output.h (Output_merge_base): New class declaration.
1667 (Input_section_specifier): New class defintion.
1668 (class Output_relaxed_input_section) Change base class to
1669 Output_section_data_build.
1670 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1671 base class initializer.
1672 (Output_section::add_relaxed_input_section): New method declaration.
1673 (Output_section::Input_section): Change visibility to protected.
1674 (Output_section::Input_section::relobj,
1675 Output_section::Input_section::shndx): Handle relaxed input sections.
1676 Output_section::input_sections) Change visibility to protected. Also
1677 define overload to return a non-const pointer.
1678 (Output_section::Merge_section_properties): New class defintion.
1679 (Output_section::Merge_section_by_properties_map,
1680 Output_section::Output_section_data_by_input_section_map,
1681 Output_section::Relaxation_map): New types.
1682 (Output_section::relax_input_section): Rename method to
1683 Output_section::convert_input_sections_to_relaxed_sections and change
1684 interface to take a vector of relaxed section pointers.
1685 (Output_section::find_merge_section,
1686 Output_section::find_relaxed_input_section,
1687 Output_section::build_relaxation_map,
1688 Output_section::convert_input_sections_in_list_to_relaxed_sections):
1689 New method declarations.
1690 (Output_section::merge_section_map_
1691 Output_section::merge_section_by_properties_map_,
1692 Output_section::relaxed_input_section_map_,
1693 Output_section::is_relaxed_input_section_map_valid_,
1694 Output_section::generate_code_fills_at_write_): New data members.
1695 * script-sections.cc
1696 (Output_section_element_input::set_section_addresses): Call
1697 current_data_size and addralign methods of relaxed input sections.
1698 (Orphan_output_section::set_section_addresses): Call current_data_size
1699 and addralign methods of relaxed input sections.
1700 * symtab.cc (Symbol_table::compute_final_value): Extract template
1701 from the body of Symbol_table::sized_finalize_symbol.
1702 (Symbol_table::sized_finalized_symbol): Call
1703 Symbol_table::compute_final_value.
1704 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1705 (Symbol_table::compute_final_value): New templated method declaration.
1706 * target.cc (Target::do_make_output_section): New method defintion.
1707 * target.h (Target::make_output_section): New method declaration.
1708 (Target::relax): Add more parameters for input objects, symbol table
1709 and layout. Adjust call to do_relax.
1710 (Target::do_make_output_section): New method declaration.
1711 (Target::do_relax): Add parameters for input objects, symbol table
1714 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1716 * pread.c: Include stdio.h.
1718 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1720 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1723 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1725 * dwarf_reader.cc (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 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1731 Change read_shndx type to unsigned int.
1732 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1734 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1735 * layout.cc (Layout::create_symtab_sections): Cast the result of
1736 local_symcount * symsize to off_t in the gold_assert.
1738 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1740 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1741 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1743 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1744 (Arm_relocate_functions::thm_abs5): New function.
1745 (Arm_relocate_functions::abs12): New function.
1746 (Arm_relocate_functions::abs16): New function.
1747 (Arm_relocate_functions::base_abs): New function.
1748 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1749 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1750 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1752 (Scan::global): Likewise.
1753 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1754 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1755 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1756 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1759 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1761 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1762 (Arm_relocate_functions::movt_prel): New function.
1763 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1764 (Arm_relocate_functions::thm_movt_prel): New function.
1765 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1766 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1767 (Scan::global, Relocate::relocate): Likewise.
1768 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1770 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1772 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1773 Incremental_checker.
1774 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1776 (class Incremental_inputs_header): New class.
1777 (Incremental_inputs_header_writer): Edit comment.
1778 (Incremental_inputs_entry): New class.
1779 (Incremental_inputs_entry_writer): Edit comment.
1780 (Sized_incremental_binary::do_find_incremental_inputs_section):
1781 Add *strtab_shndx parameter, fill it.
1782 (Sized_incremental_binary::do_check_inputs): New method.
1783 (Incremental_checker::can_incrementally_link_output_file): Use
1784 Sized_incremental_binary::check_inputs.
1785 (Incremental_inputs::report_command_line): Save command line in
1788 (Incremental_binary::find_incremental_inputs_section): New
1790 (Incremental_binary::do_find_incremental_inputs_section): Add
1791 strtab_shndx parameter.
1792 (Incremental_binary::do_check_inputs): New pure virtual method.
1793 (Sized_incremental_binary::do_check_inputs): Declare.
1794 (Incremental_checker::Incremental_checker): Add incremental_inputs
1795 parameter, use it to initialize incremental_inputs_.
1796 (Incremental_checker::incremental_inputs_): New field.
1797 (Incremental_checker::command_line): New method.
1798 (Incremental_checker::inputs): New method.
1799 (Incremental_checker::command_line_): New field.
1801 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1803 * incremental.cc: Include <cstdarg> and "target-select.h".
1804 (vexplain_no_incremental): New function.
1805 (explain_no_incremental): New function.
1806 (Incremental_binary::error): New method.
1807 (Sized_incremental_binary::do_find_incremental_inputs_section): New
1809 (make_sized_incremental_binary): New function.
1810 (open_incremental_binary): New function.
1811 (can_incrementally_link_file): Add checks if output is ELF and has
1813 * incremental.h: Include "elfcpp_file.h" and "output.h".
1814 (Incremental_binary): New class.
1815 (Sized_incremental_binary): New class.
1816 (open_incremental_binary): Declare.
1817 * object.cc (is_elf_object): Use
1818 elfcpp::Elf_recognizer::is_elf_file.
1819 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
1820 * output.h (Output_file::filesize): New method.
1822 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1824 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
1826 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
1827 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
1829 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
1831 (Arm_relocate_functions::movw_abs_nc): New function.
1832 (Arm_relocate_functions::movt_abs): New function.
1833 (Arm_relocate_functions::thm_movw_abs_nc): New function.
1834 (Arm_relocate_functions::thm_movt_abs): New function.
1835 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
1836 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
1837 (Scan::global): Likewise.
1838 (Relocate::relocate): Likewise.
1839 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1841 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1843 * arm.cc (Arm_relocate_functions::got_prel) New function.
1844 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
1845 (Relocate::relocate): Likewise.
1846 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1848 2009-10-06 Ian Lance Taylor <iant@google.com>
1850 * options.h (class General_options): Define
1851 split_stack_adjust_size parameter.
1852 * object.h (class Object): Add uses_split_stack_ and
1853 has_no_split_stack_ fields. Add uses_split_stack and
1854 has_no_split_stack accessor functions. Declare
1855 handle_split_stack_section.
1856 (class Reloc_symbol_changes): Define.
1857 (class Sized_relobj): Define Function_offsets. Declare
1858 split_stack_adjust, split_stack_adjust_reltype, and
1860 * object.cc (Object::handle_split_stack_section): New function.
1861 (Sized_relobj::do_layout): Call handle_split_stack_section.
1862 * dynobj.cc (Sized_dynobj::do_layout): Call
1863 handle_split_stack_section.
1864 * reloc.cc (Sized_relobj::relocate_sections): Call
1865 split_stack_adjust for executable sections in split_stack
1866 objects. Pass reloc_map to relocate_section.
1867 (Sized_relobj::split_stack_adjust): New function.
1868 (Sized_relobj::split_stack_adjust_reltype): New function.
1869 (Sized_relobj::find_functions): New function.
1870 * target-reloc.h: Include "object.h".
1871 (relocate_section): Add reloc_symbol_changes parameter. Change
1873 * target.h (class Target): Add calls_non_split method. Declare
1874 do_calls_non_split virtual method. Declare match_view and
1876 * target.cc: Include "elfcpp.h".
1877 (Target::do_calls_non_split): New function.
1878 (Target::match_view): New function.
1879 (Target::set_view_to_nop): New function.
1880 * gold.cc (queue_middle_tasks): Give an error if mixing
1881 split-stack and non-split-stack objects with -r.
1882 * i386.cc (Target_i386::relocate_section): Add
1883 reloc_symbol_changes parameter.
1884 (Target_i386::do_calls_non_split): New function.
1885 * x86_64.cc (Target_x86_64::relocate_section): Add
1886 reloc_symbol_changes parameter.
1887 (Target_x86_64::do_calls_non_split): New function.
1888 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
1890 * powerpc.cc (Target_powerpc::relocate_section): Add
1891 reloc_symbol_changes parameter.
1892 * sparc.cc (Target_sparc::relocate_section): Add
1893 reloc_symbol_changes parameter.
1894 * configure.ac: Call AM_CONDITIONAL for the default target.
1895 * configure: Rebuild.
1896 * testsuite/Makefile.am (TEST_AS): New variable.
1897 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
1898 (check_DATA): Add split_i386 and split_x86_64 files.
1899 (SPLIT_DEFSYMS): Define.
1900 (split_i386_[1234n].o): New targets.
1901 (split_i386_[124]): New targets.
1902 (split_i386_[1234r].stdout): New targets.
1903 (split_x86_64_[1234n].o): New targets.
1904 (split_x86_64_[124]): New targets.
1905 (split_x86_64_[1234r].stdout): New targets.
1906 (MOSTLYCLEANFILES): Add new executables.
1907 * testsuite/split_i386.sh: New file.
1908 * testsuite/split_x86_64.sh: New file.
1909 * testsuite/split_i386_1.s: New file.
1910 * testsuite/split_i386_2.s: New file.
1911 * testsuite/split_i386_3.s: New file.
1912 * testsuite/split_i386_4.s: New file.
1913 * testsuite/split_i386_n.s: New file.
1914 * testsuite/split_x86_64_1.s: New file.
1915 * testsuite/split_x86_64_2.s: New file.
1916 * testsuite/split_x86_64_3.s: New file.
1917 * testsuite/split_x86_64_4.s: New file.
1918 * testsuite/split_x86_64_n.s: New file.
1919 * testsuite/testfile.cc (Target_test): Update relocation_section
1921 * testsuite/Makefile.in: Rebuild.
1923 2009-10-06 Ian Lance Taylor <iant@google.com>
1925 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
1926 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
1927 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
1928 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
1929 the address on ldo_addrs_.
1930 (Target_i386::Relocate::fix_up_ldo): New function.
1932 2009-10-06 Rafael Espindola <espindola@google.com>
1934 * plugin.cc (add_input_library): New.
1935 (Plugin::load): Add add_input_library to tv.
1936 (Plugin_manager::add_input_file): Add the is_lib argument.
1937 (add_input_file): Update call to Plugin_manager::add_input_file.
1938 (add_input_library): New.
1939 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
1941 2009-09-30 Doug Kwan <dougkwan@google.com>
1943 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
1944 symbol and call Symbol::may_need_copy_reloc to determine if
1945 a copy reloc is needed.
1946 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
1947 nocopyreloc is given in command line.
1948 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
1949 given in command line.
1950 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
1951 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
1952 of the removed Target_i386::may_need_copy_reloc.
1953 * options.h (copyreloc): New option with default value false.
1954 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1955 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
1956 instead of the removed Target_powerpc::may_need_copy_reloc.
1957 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1958 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
1959 instead of the removed Target_sparc::may_need_copy_reloc.
1960 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
1961 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
1962 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
1963 instead of the removed Target_x86_64::may_need_copy_reloc.
1965 2009-09-30 Ian Lance Taylor <iant@google.com>
1967 * object.h (class Object): Remove target_ field, and target,
1968 sized_target, and set_target methods.
1969 (Object::sized_target): Remove.
1970 (class Sized_relobj): Update declarations. Remove sized_target.
1971 * object.cc (Sized_relobj::setup): Remove target parameter.
1973 (Input_objects::add_object): Don't do anything with the target.
1974 (make_elf_sized_object): Add punconfigured parameter. Change all
1975 callers. Set or test parameter target.
1976 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
1978 * parameters.cc (Parameters::set_target): Change parameter type to
1980 (Parameters::default_target): Remove.
1981 (set_parameters_target): Change parameter type to be non-const.
1982 (parameters_force_valid_target): New function.
1983 (parameters_clear_target): New function.
1984 * parameters.h (class Parameters): Update declarations. Remove
1985 default_target method. Add sized_target and clear_target
1986 methods. Change target_ to be non-const.
1987 (set_parameters_target): Update declaration.
1988 (parameters_force_valid_target): Declare.
1989 (parameters_clear_target): Declare.
1990 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
1991 as NULL if we aren't searching.
1992 (Add_symbols::run): Don't check for compatible target.
1993 * fileread.cc (Input_file::open_binary): Call
1994 parameters_force_valid_target.
1995 * gold.cc (queue_middle_tasks): Likewise.
1996 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
1997 set_target on object.
1998 * dynobj.h (class Sized_dynobj): Update declarations.
1999 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2000 make_elf_object returns NULL.
2001 (Archive::include_member): Don't check whether object target is
2003 * output.cc (Output_section::add_input_section): Get target from
2005 (Output_section::relax_input_section): Likewise.
2006 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2008 (Sized_relobj::do_scan_relocs): Likewise.
2009 (Sized_relobj::relocate_sections): Likewise.
2010 * resolve.cc (Symbol_table::resolve): Likewise.
2011 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
2012 parameter. Change all callers.
2013 (Symbol_table::add_from_object): Get target from parameters.
2014 (Symbol_table::add_from_relobj): Don't check object target.
2015 (Symbol_table::add_from_dynobj): Likewise.
2016 (Symbol_table::define_special_symbol): Get target from
2018 * symtab.h (class Symbol_table): Update declaration.
2019 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2020 parameter. Change all callers. Clear parameter target.
2021 (Binary_test): Test target here.
2022 * testsuite/object_unittest.cc (gold_testsuite): Remove
2023 target_test_pointer parameter. Change all callers.
2024 (Object_test): Test target here.
2026 2009-09-26 Ian Lance Taylor <iant@google.com>
2028 * testsuite/initpri1.c: Don't try to use constructor priorities if
2029 compiling with gcc before 4.3.
2031 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2033 * testsuite/retain_symbols_file_test.sh (check_present): Change
2034 output file name to retain_symbols_file_test.stdout.
2035 (check_absent): Likewise.
2037 2009-09-18 Craig Silverstein <csilvers@google.com>
2039 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2040 * options.cc: Include <cerrno> and <fstream>.
2041 (General_options::finalize): Parse -retain-symbols-file tag.
2042 * options.h: New flag.
2043 (General_options): New method should_retain_symbol, new
2044 variable symbols_to_retain.
2045 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2046 should_retain_symbol map.
2047 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2048 * testsuite/Makefile.in: Regenerate.
2049 * testsuite/retain_symbols_file_test.sh: New file.
2051 2009-09-18 Nick Clifton <nickc@redhat.com>
2053 * po/es.po: Updated Spanish translation.
2055 2009-09-17 Doug Kwan <dougkwan@google.com>
2057 * debug.h (DEBUG_RELAXATION): New constant.
2058 (DEBUG_ALL): Add DEBUG_RELAXATION.
2059 (debug_string_to_enum): Add relaxation debug option.
2061 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2062 Layout::Relaxation_debug_check::read_sections,
2063 Layout::Relaxation_debug_check::read_sections): New method definitions.
2064 (Layout::Layout): Initialize data members
2065 record_output_section_data_from_scrips_,
2066 script_output_section_data_list_ and relaxation_debug_check_.
2067 (Layout::save_segments, Layout::restore_segments,
2068 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2069 Layout::relaxation_loop_body): New method definitions.
2070 (Layout::finalize): Support relaxation. Move section layout code to
2071 Layout::relaxation_loop_body.
2072 (Layout::set_asection_address_from_script): Move code for orphan
2073 section placement out.
2074 (Layout::place_orphan_sections_in_script): New method definition.
2075 * layout.h (Output_segment_headers, Output_file_header):
2076 New forward class declarations.
2077 (Layout::~Layout): Define.
2078 (Layout::new_output_section_data_from_script): New method definition.
2079 (Layout::place_orphan_sections_in_script): New method declaration.
2080 (Layout::Segment_states): New type declaration.
2081 (Layout::save_segments, Layout::restore_segments,
2082 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2083 Layout::relaxation_loop_body): New method declarations.
2084 (Layout::Output_section_data_list): New type declaration.
2085 (Layout::Relaxation_debug_check): New class definition.
2086 (Layout::record_output_section_data_from_script_,
2087 Layout::script_output_section_data_list_, Layout::segment_states_,
2088 Layout::relaxation_debug_check_): New data members.
2089 * output.cc: (Output_section_headers::do_size): New method definition.
2090 (Output_section_headers::Output_section_headers): Move size
2091 computation to Output_section_headers::do_size.
2092 (Output_segment_headers::do_size): New method definition.
2093 (Output_file_header::Output_file_header): Move size computation to
2094 Output_file_header::do_size and call it.
2095 (Output_file_header::do_size): New method definition.
2096 (Output_data_group::Output_data_group): Adjust call to
2097 Output_section_data.
2098 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2099 (Output_symtab_xindex::do_write): Add array bound check.
2100 (Output_section::Input_section::print_to_mapfile): Handle
2101 RELAXED_INPUT_SECTION_CODE.
2102 (Output_section::Output_section): Initialize data member checkpoint_.
2103 (Output_section::~Output_section): Delete checkpoint object pointed
2105 (Output_section::add_input_section): Always add an Input_section if
2107 (Output_section::add_merge_input_section): Add assert.
2108 (Output_section::relax_input_section): New method definition.
2109 (Output_section::set_final_data_size): Set load address to zero for
2110 an unallocated section.
2111 (Output_section::do_address_and_file_offset_have_reset_values):
2112 New method definition.
2113 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2114 Handle relaxed input section.
2115 (Output_section::sort_attached_input_sections): Checkpoint input
2116 section list lazily.
2117 (Output_section::get_input_sections): Change type of input_sections to
2118 list of Simple_input_section pointers. Checkpoint input section list
2119 lazily. Also handle relaxed input sections.
2120 (Output_section::add_input_section_for_script): Take a reference to
2121 a Simple_input_section object instead of Relobj pointer and section
2122 index as parameter. Handle relaxed input sections.
2123 (Output_section::save_states, Output_section::restore_states): New
2125 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2126 (Output_data::is_data_size_fixed): New method definition.
2127 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2129 (Output_data::address_and_file_offset_have_reset_values): New method
2131 (Output_data::do_address_and_file_offset_have_reset_values): New method
2133 (Output_data::set_data_size): Check that data size is not fixed.
2134 (Output_data::fix_data_size): New method definition.
2135 (Output_data::is_data_size_fixed_): New data member.
2136 (Output_section_headers::set_final_data_size): New method definition.
2137 (Output_section_headers::do_size): New method declaration.
2138 (Output_segment_headers::set_final_data_size): New method definition.
2139 (Output_segment_headers::do_size): New method declaration.
2140 (Output_file_header::set_final_data_size)::New method definition.
2141 (Output_file_header::do_size)::New method declaration.
2142 (Output_section_data::Output_section_data): Add new parameter
2143 is_data_size_fixed and use it to fix data size.
2144 (Output_data_const::Output_data_const): Adjust call to base class
2145 constructor and fix data size.
2146 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2147 base class constructor and fix data size.
2148 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2149 base class constructor and fix data size.
2150 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2151 class constructor and fix data size.
2152 (Output_data_group::set_final_data_size): New method definition.
2153 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2154 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2155 class constructor and fix data size.
2156 (Output_relaxed_input_section): New class definition.
2157 (Output_section::Simple_input_section): New class definition.
2158 (Output_section::get_input_sections): Adjust parameter list.
2159 (Output_section::add_input_section_for_script): Same.
2160 (Output_section::save_states, Output_section::restore_states,
2161 Output_section::do_address_and_file_offset_have_reset_values,
2162 (Output_section::Input_section::Input_section): Handle
2163 RELAXED_INPUT_SECTION_CODE. Add new overload for
2164 Output_relaxed_input_section.
2165 (Output_section::Input_section::is_input_section,
2166 Output_section::Input_section::set_output_section): Handle relaxed
2168 (Output_section::Input_section::is_relaxed_input_section,
2169 Output_section::Input_section::output_section_data,
2170 Output_section::Input_section::relaxed_input_section): New method
2172 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2174 (Output_section::Input_section::u1_): Update comments.
2175 (Output_section::Input_section::u2_): Add new union member poris.
2176 (Output_section::Checkpoint_output_section): New classs definition.
2177 (Output_section::relax_input_section): New method declaration.
2178 (Output_section::checkpoint_): New data member.
2179 (Output_segment): Update comments.
2180 (Output_segment::Output_segment): Un-privatize copy constructor.
2181 (Output_segment::operator=): Un-privatize.
2182 * script-sections.cc (Output_section_element::Input_section_list):
2183 Change element type to Output_section::Simple_input_section.
2184 (Output_section_element_dot_assignment::set_section_addresses):
2185 Register output section data for relaxation clean up.
2186 (Output_data_exression::Output_data_expression): Adjust call to base
2187 constructor to fix data size.
2188 (Output_section_element_data::set_section_addresses): Register
2189 Output_data_expression object for relaxation clean up.
2190 (struct Input_section_info): Replace Relobj pointer and section index
2191 pair with Output_section::Simple_input_section and Convert struct to a
2193 (Input_section_sorter::operator()): Adjust access to
2194 Input_section_info data member to use accessors.
2195 (Output_section_element_input::set_section_addresses): Use layout
2196 parameter. Adjust code to use Output_section::Simple_input_section
2197 and Input_secction_info classes. Register filler for relaxation
2199 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2200 and section index pair with Output_section::Simple_input_section
2201 class. Adjust code accordingly.
2202 (Phdrs_element::release_segment): New method definition.
2203 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2205 (Script_sections::release_segments): New method definition.
2206 * gold/script-sections.h (Script_sections::release_segments): New
2208 * gold/target.h (Target::may_relax, Target::relax,
2209 Target::do_may_relax, Target::do_relax): New method definitions.
2211 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2213 * arm.cc (has_signed_unsigned_overflow): New function.
2214 (Arm_relocate_functions::abs8): New function.
2215 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2216 (Target_arm::Scan::global): Likewise.
2217 (Target_arm::relocate::relocate): Likewise.
2218 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2221 2009-09-16 Cary Coutant <ccoutant@google.com>
2223 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2224 * testsuite/Makefile.in: Regenerate.
2226 2009-09-11 Nick Clifton <nickc@redhat.com>
2228 * po/gold.pot: Updated by the Translation project.
2230 2009-09-08 Cary Coutant <ccoutant@google.com>
2232 * output.cc (Output_file::open): Add execute permission to empty file.
2233 * testsuite/Makefile.am (permission_test): New test.
2234 * testsuite/Makefile.in: Regenerate.
2236 2009-09-02 Ian Lance Taylor <iant@google.com>
2238 * output.cc (Output_file::resize): Call map_no_anonymous rather
2241 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2243 * gold.cc: Include "incremental.h".
2244 (queue_initial_tasks): Call Incremental_checker methods.
2245 * incremental.cc: Include "output.h".
2246 (Incremental_checker::can_incrementally_link_output_file): New
2248 * incremental.h (Incremental_checker): New class.
2250 * output.cc (Output_file::open_for_modification): New method.
2251 (Output_file::map_anonymous): Changed return type to bool. Record
2253 (Output_file::map_no_anonymous): New method, broken out of map.
2254 (Output_file::map): Use map_no_anonymous and map_anonymous.
2255 * output.h (class Output_file): Update declarations.
2257 2009-08-24 Cary Coutant <ccoutant@google.com>
2259 * options.h (Command_line::Pre_options): New class.
2260 (Command_line::pre_options): New member.
2261 * options.cc (gold::options::ready_to_register): New variable.
2262 (One_option::register_option): Do nothing if not registering options.
2263 Assert if same short option registered twice.
2264 (General_options::General_options): Turn off option registration when
2266 (Command_line::Pre_options::Pre_options): New constructor.
2268 2009-08-24 Cary Coutant <ccoutant@google.com>
2270 * options.h (General_options::no_keep_memory): Remove incorrect
2273 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2275 * Makefile.am (am__skiplex, am__skipyacc): New.
2276 * Makefile.in: Regenerate.
2278 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2280 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2281 (INCLUDES): ... this.
2282 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2283 (AM_CPPFLAGS): Renamed from ...
2284 (INCLUDE): ... this.
2285 * Makefile.in, testsuite/Makefile.in: Regenerate.
2287 * Makefile.in: Regenerate.
2288 * aclocal.m4: Likewise.
2289 * config.in: Likewise.
2290 * configure: Likewise.
2291 * testsuite/Makefile.in: Likewise.
2293 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2294 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2295 * Makefile.in: Regenerate.
2296 * testsuite/Makefile.in: Regenerate.
2298 2009-08-19 Cary Coutant <ccoutant@google.com>
2300 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2301 symbols in shared libraries overridden by hidden or internal symbols
2302 in the main program.
2304 2009-08-19 Chris Demetriou <cgd@google.com>
2306 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2307 checking source file names in error messages.
2309 2009-08-18 Doug Kwan <dougkwan@google.com>
2311 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2312 an elcpp::Ehdr as parameter. Adjust call to set_target.
2313 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2314 an elfcpp::Ehdr as parameter.
2315 * object.cc (Object::set_target): Remove the version that looks up
2316 a target and sets it.
2317 (Sized_relobj::setup): Take a Target object instead of
2318 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2319 (make_elf_sized_object): Find target and ask target to
2321 * object.h: (Object::set_target): Remove the version that looks up
2322 a target and sets it.
2323 (Sized_relobj::setup): Take a Target object instead of
2324 an elfcpp:Ehdr as parameter.
2325 * target.cc: Include dynobj.h.
2326 (Target::do_make_elf_object_implementation): New.
2327 (Target::do_make_elf_object): New.
2328 * target.h (Target::make_elf_object): New template declaration.
2329 (Target::do_make_elf_object): New method declarations.
2330 (Target::do_make_elf_object_implementation): New template declaration.
2332 2009-08-14 Ian Lance Taylor <iant@google.com>
2334 * gold.h (FUNCTION_NAME): Define.
2335 (gold_unreachable): Use FUNCTION_NAME.
2337 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2339 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2340 symbol in the --keep-unique list is not found.
2342 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2344 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2345 been maked as --keep-unique.
2346 (Icf::unfold_section): New function.
2347 * icf.h (Icf::unfold_section): New function.
2348 * options.h (General_options::keep_unique): New option.
2349 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2350 * testsuite/Makefile.in: Regenerate.
2351 * testsuite/icf_keep_unique_test.sh: New file.
2352 * testsuite/icf_keep_unique_test.cc: New file.
2354 2009-08-12 Cary Coutant <ccoutant@google.com>
2357 * resolve.cc (Symbol_table::resolve): Check for references from
2358 dynamic objects to hidden and internal symbols.
2359 * testsuite/Makefile.am (hidden_test.sh): New test.
2360 * testsuite/Makefile.in: Regenerate.
2361 * testsuite/hidden_test.sh: New script.
2362 * testsuite/hidden_test_1.c: New test source.
2363 * testsuite/hidden_test_main.c: New test source.
2365 2009-08-11 Doug Kwan <dougkwan@google.com>
2367 * arm.cc: Update comments.
2368 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2369 segment to locate the .ARM.exidx section if present.
2371 2009-08-09 Doug Kwan <dougkwan@google.com>
2373 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2376 2009-08-07 Sriraman Tallam <tmsriram@google.com>
2377 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2380 2009-08-06 Sriraman Tallam <tmsriram@google.com>
2382 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2383 valid tls_segment only for non-debug-section relocations.
2384 * testsuite/Makefile.am: Add gc_tls_test.
2385 * testsuite/Makefile.in: Regenerate.
2386 * testsuite/gc_tls_test.cc: New file.
2387 * testsuite/gc_tls_test.sh: New file.
2389 2009-08-05 Sriraman Tallam <tmsriram@google.com>
2393 * Makefile.am (CCFILES): Add icf.cc.
2395 * Makefile.in: Regenerate.
2396 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2397 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2398 section, symbol and addend information for the relocs.
2399 * gold.cc (queue_middle_tasks): Call identical code folding.
2400 * gold.h: Add defines for multimap.
2401 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2402 to the call of finalize_local_symbols.
2403 * main.cc (main): Create object of class Icf.
2404 * object.cc (Sized_relobj::do_layout): Allow this function to be
2405 called twice during icf.
2406 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2407 to sections marked as identical by icf.
2408 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2410 (Sized_relobj::do_section_entsize): New function.
2411 * object.h (Object::section_entsize): New function.
2412 (Object::do_section_entsize): New pure virtual function.
2413 (Relobj::finalize_local_symbols): Add new parameter.
2414 (Relobj::do_section_entsize): New function.
2415 * options.h (General_options::icf): New option.
2416 (General_options::icf_iterations): New option.
2417 (General_options::print_icf_sections): New option.
2418 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2419 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2420 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2422 * symtab.cc (Symbol_table::is_section_folded): New function.
2423 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2424 to sections marked as identical by icf.
2425 * symtab.h (Symbol_table::set_icf): New function.
2426 (Symbol_table::icf): New function.
2427 (Symbol_table::is_section_folded): New function.
2428 (Symbol_table::icf_): New data member.
2429 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2430 * testsuite/Makefile.am: Add commands to build icf_test.
2431 * testsuite/Makefile.in: Regenerate.
2432 * testsuite/icf_test.sh: New file.
2433 * testsuite/icf_test.cc: New file.
2435 2009-07-24 Chris Demetriou <cgd@google.com>
2437 * layout.cc (is_compressible_debug_section): Fix incorrect
2438 comment about compressed section names.
2440 2009-07-20 Ian Lance Taylor <ian@airs.com>
2443 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2445 2009-07-16 Ian Lance Taylor <iant@google.com>
2448 * layout.h: #include <map>.
2449 (class Kept_section): Change from struct to class. Add accessors
2450 and setters. Add section size to Comdat_group mapping. Change
2451 Comdat_group to std::map. Add is_comdat_ field. Add
2452 linkonce_size field in union.
2453 (class Layout): Update declaration of find_or_add_kept_section.
2454 Don't declare find_kept_object.
2455 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2456 parameter. Add object, shndx, is_comdat, and is_group_name
2457 parameters. Change all callers. Adjust for new Kept_section.
2458 (Layout::find_kept_object): Remove.
2459 * object.cc (Sized_relobj::include_section_group): Update use of
2460 Kept_section. Rename secnum to shndx. Only record
2461 Kept_comdat_section if sections are the same size.
2462 (Sized_relobj::include_linkonce_section): Update use of
2463 Kept_section. Only record Kept_comdat_section if sections are the
2464 same size. Set size of linkonce section.
2465 (Sized_relobj::map_to_kept_section): Update call to
2466 get_kept_comdat_section.
2467 * object.h (class Sized_relobj): Rename fields in
2468 Kept_comdat_section to drop trailing underscores; change object
2469 field to Relobj*. Change Kept_comdat_section_table to store
2470 struct rather than pointer.
2471 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2472 Add kept_object and kept_shndx parameters. Change all callers.
2473 (Sized_relobj::get_kept_comdat_section): Change return type to
2474 bool. Add kept_object and kept_shndx parameters. Change all
2476 * plugin.cc (Pluginobj::include_comdat_group): Update call to
2477 Layout::find_or_add_kept_section.
2479 2009-07-09 Ian Lance Taylor <iant@google.com>
2481 * merge.cc (Object_merge_map::initialize_input_to_output_map):
2482 Reserve space in the hash table.
2484 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
2486 * fileread.cc (File_read::get_mtime): New method.
2487 * fileread.h (Timespec): New structure.
2488 (File_read::get_mtime): New method.
2489 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2490 Renamed from timestamp_nsec.
2491 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2493 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
2495 (Incremental_inputs::report_archive): Save mtime; style fix.
2496 (Incremental_inputs::report_obejct): Save mtime; style fix.
2497 (Incremental_inputs::report_script): Save mtime; style fix.
2498 (Incremental_inputs::finalize_inputs): Style fix.
2499 (Incremental_inputs::finalize): Style fix.
2500 (Incremental_inputs::create_input_section_data): Store inputs
2502 * incremental.h (Incremental_inputs::report_script): Add mtime
2504 (Incremental_inputs::Input_info::Input_info): Intialize only one
2506 (Incremental_inputs::Input_info::archive): Move to nameless
2508 (Incremental_inputs::Input_info::obejct): Move to nameless union.
2509 (Incremental_inputs::Input_info::script): Move to nameless union.
2510 (Incremental_inputs::mtime): New field.
2511 * script.cc (read_input_script): Pass file mtime to
2513 * script.h (Script_info::inputs): Style fix.
2515 2009-07-01 Ian Lance Taylor <ian@airs.com>
2517 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2520 2009-06-24 Ian Lance Taylor <iant@google.com>
2523 * layout.cc (Layout::choose_output_section): If we find an
2524 existing section, update the flags.
2525 (Layout::create_notes): New function, broken out of
2527 (Layout::finalize): Don't create note sections.
2528 (Layout::create_note): Don't crash if linker script discards
2530 (Layout::create_gold_note): Likewise.
2531 (Layout::create_build_id): Likewise. Don't set
2532 after_input_sections on the section.
2533 (Layout::create_executable_stack_info): Remove target parameter.
2535 * layout.h (class Layout): Declare create_notes. Update
2536 declaration of create_executable_stack_info.
2537 * gold.cc (queue_middle_tasks): Call create_notes.
2538 * output.cc (Output_section::update_flags_for_input_section): Move
2539 here from output.h. If SHF_ALLOC flag is newly set, mark address
2541 * output.h (Output_data::mark_address_invalid): New function.
2542 (class Output_section): Only declare, not define,
2543 update_flags_for_input_section. Remove set_flags.
2545 2009-06-24 Ian Lance Taylor <iant@google.com>
2547 * script-sections.cc (Output_section_definition::
2548 set_section_addresses): Rename shadowing local load_address to
2551 2009-06-24 Ian Lance Taylor <iant@google.com>
2554 * reloc.cc (relocate_sections): Skip empty relocation sections.
2556 2009-06-23 Ian Lance Taylor <iant@google.com>
2559 * layout.cc (Layout::create_note): Use choose_output_section
2560 rather than make_output_section.
2562 2009-06-23 Ian Lance Taylor <iant@google.com>
2565 * options.cc (General_options::parse_V): Set printed_version_.
2566 (General_options::General_options): Initialize printed_version_.
2567 * options.h (class General_options): Add printed_version_ field.
2568 * gold.cc (queue_initial_tasks): If there are no input files,
2569 don't give a fatal error if we printed the version information.
2570 (queue_middle_tasks): If using -r with a shared object, give a
2571 fatal error rather than an ordinary error.
2573 2009-06-23 Ian Lance Taylor <iant@google.com>
2576 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
2577 (Layout::make_output_section): Set have_stabstr_section_ if we see
2578 a .stab*str section.
2579 (Layout::finalize): Call link_stabs_sections.
2580 (Layout::link_stabs_sections): New file.
2581 * layout.h (class Layout): Add have_stabstr_section_ field.
2582 Declare link_stabs_sections.
2584 2009-06-23 Doug Kwan <dougkwan@google.com>
2586 * Makefile.am (libgold_a_LIBADD): New.
2587 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2588 * Makefile.in: Regenerate.
2589 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
2590 * configure: Regenerate.
2591 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
2592 * fileread.cc: Include sys/state.h
2593 * gold.h: Declare memmem and strndup if found missing.
2594 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2596 2009-06-23 Ian Lance Taylor <iant@google.com>
2598 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2599 * configure: Rebuild.
2601 2009-06-23 Ian Lance Taylor <iant@google.com>
2604 * object.cc (Object::section_contents): Don't try to get a view if
2605 the section has length zero.
2606 (Object::handle_gnu_warning_section): If the section is empty, use
2607 the name of the section as the warning.
2609 2009-06-23 Ian Lance Taylor <iant@google.com>
2612 * stringpool.h (class Stringpool_template): Add optimize_ field.
2613 (Stringpool_template::set_optimize): New function.
2614 * stringpool.cc (Stringpool_template::Stringpool_template):
2615 Initialize optimize_ field.
2616 (Stringpool_template::set_string_offsets): Test local optimize
2617 fild rather than parameter.
2618 * layout.cc (Layout::Layout): Call set_optimize on the section
2621 2009-06-22 Ian Lance Taylor <iant@google.com>
2624 * yyscript.y: Parse TARGET.
2625 * script.cc (script_set_target): New function.
2626 * script-c.h (script_set_target): Declare.
2627 * options.cc (General_options::string_to_object_format): Rename
2628 from string_to_object_format in anonymous namespace. Change
2630 * options.h (class General_options): Declare
2631 string_to_object_format.
2633 2009-06-22 Ian Lance Taylor <iant@google.com>
2635 * script-sections.cc (Script_sections::create_segments): Don't put
2636 program headers in a PT_LOAD segment if -n or -N.
2638 2009-06-22 Ian Lance Taylor <iant@google.com>
2641 * options.h (class General_options): Add -z lazy and -z now. Sort
2642 -z options into alphabetical order.
2643 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
2645 2009-06-21 Ian Lance Taylor <iant@google.com>
2647 * layout.cc (Layout::make_output_section): Call
2648 Target::new_output_section.
2649 (Layout::attach_allocated_section_to_segment): Put large section
2650 sections in a separate load segment with the large segment flag
2652 (Layout::segment_precedes): Sort large data segments after other
2654 (align_file_offset): New static function.
2655 (Layout::set_segment_offsets): Use align_file_offset.
2656 * output.h (class Output_section): Add is_small_section_ and
2657 is_large_section_ fields.
2658 (Output_section::is_small_section): New function.
2659 (Output_section::set_is_small_section): New function.
2660 (Output_section::is_large_section): New function.
2661 (Output_section::set_is_large_section): New function.
2662 (Output_section::is_large_data_section): New function.
2663 (class Output_segment): Add is_large_data_segment_ field.
2664 (Output_segment::is_large_data_segment): New function.
2665 (Output_segment::set_is_large_data_segment): New function.
2666 * output.cc (Output_section::Output_section): Initialize new
2668 (Output_segment::Output_segment): Likewise.
2669 (Output_segment::add_output_section): Add assertion that large
2670 data sections always go in large data segments. Force small data
2671 sections to the end of the list of data sections. Force small BSS
2672 sections to the start of the list of BSS sections. For large BSS
2673 sections to the end of the list of BSS sections.
2674 * symtab.h (class Symbol): Declare is_common_shndx.
2675 (Symbol::is_defined): Check Symbol::is_common_shndx.
2676 (Symbol::is_common): Likewise.
2677 (class Symbol_table): Define enum Commons_section_type. Update
2678 declarations. Add small_commons_ and large_commons_ fields.
2679 * symtab.cc (Symbol::is_common_shndx): New function.
2680 (Symbol_table::Symbol_table): Initialize new fields.
2681 (Symbol_table::add_from_object): Put small and large common
2682 symbols in the right list.
2683 (Symbol_table::sized_finalized_symbol): Check
2684 Symbol::is_common_shndx.
2685 (Symbol_table::sized_write_globals): Likewise.
2686 * common.cc (Symbol_table::do_allocate_commons): Allocate new
2687 common symbol lists. Don't call do_allocate_commons_list if the
2689 (Symbol_table::do_allocate_commons_list): Remove is_tls
2690 parameter. Add comons_section_type parameter. Change all
2691 callers. Handle small and large common symbols.
2692 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2693 Symbol::is_common_shndx.
2694 * resolve.cc (symbol_to_bits): Likewise.
2695 * target.h (Target::small_common_shndx): New function.
2696 (Target::small_common_section_flags): New function.
2697 (Target::large_common_shndx): New function.
2698 (Target::large_common_section_flags): New function.
2699 (Target::new_output_section): New function.
2700 (Target::Target_info): Add small_common_shndx, large_common_shndx,
2701 small_common_section_flags, and large_common_section_flags
2703 (Target::do_new_output_section): New virtual function.
2704 * arm.cc (Target_arm::arm_info): Initialize new fields.
2705 * i386.cc (Target_i386::i386_info): Likewise.
2706 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2708 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2709 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2710 (Target_x86_64::do_new_output_section): New function.
2711 * configure.ac: Define conditional MCMODEL_MEDIUM.
2712 * testsuite/Makefile.am (check_PROGRAMS): Add large.
2713 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2714 (large_LDFLAGS): Define.
2715 * testsuite/large.c: New file.
2716 * testsuite/testfile.cc (Target_test::test_target_info):
2717 Initialize new fields.
2718 * configure, testsuite/Makefile.in: Rebuild.
2720 2009-06-05 Doug Kwan <dougkwan@google.com>
2722 * Makefile.am (CCFILES): Add target.cc.
2723 * Makefile.in: Regenerate.
2724 * i386.cc (class Target_i386): Define new virtual method to
2725 override do_is_local_label_name in parent.
2726 * object.cc (Sized_relobj::do_count_local_symbols): Discard
2727 local symbols if --discard-locals or -X is given.
2728 * options.h (class General_options): Declare new options
2729 '--discard-locals' and '-X' for discarding locals.
2730 * target.h (class Target): Define new methods is_local_label_name.
2731 Declare new virtual method do_is_local_label_name.
2732 * target.cc: New file.
2733 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2734 (check_SCRIPTS): Add discard_locals_test.sh.
2735 (check_DATA): Add discard_local_tests.syms.
2736 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2737 (discard_local_tests.syms, discard_locals_test.o): New make rules.
2738 * testsuite/Makefile.in: Regenerate.
2739 * testsuite/discard_locals_test.c: New file.
2740 * testsuite/discard_locals_test.sh: Same.
2742 2009-06-05 Doug Kwan <dougkwan@google.com>
2744 * object.cc (Sized_relobj::Sized_relobj): Initialize
2745 discarded_eh_frame_shndx_ to -1U.
2746 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2748 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2749 a discarded .eh_frame section.
2750 (Sized_relobj::do_finalize_local_symbols): Ditto.
2751 * object.h (class Sized_relobj): Declare new member
2752 discarded_eh_frame_shndx_.
2753 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2754 (local_labels_test.o, local_labels_test): New rules.
2755 * testsuite/Makefile.in: Regenerate.
2757 2009-06-04 Doug Kwan <dougkwan@google.com>
2759 * layout.cc (Layout::section_name_mapping): Add mapping for
2760 special ARM sections.
2762 2009-06-03 Doug Kwan <dougkwan@google.com>
2764 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2765 (utils::has_overflow): Same.
2767 2009-06-03 Ian Lance Taylor <iant@google.com>
2769 * layout.cc (Layout::section_name_mapping): New array, replacing
2770 Layout::linkonce_mapping.
2771 (Layout::section_name_mapping_count): New variable, replacing
2772 Layout::linkonce_mapping_count.
2773 (Layout::linkonce_output_name): Remove.
2774 (Layout::output_section_name): Rewrite.
2775 * layout.h (class Layout): Rename Linkonce_mapping to
2776 Section_name_mapping, linkonce_mapping to section_name_mapping,
2777 linkonce_mapping_count to section_name_mapping_count. Don't
2778 declare linkonce_output_name.
2780 2009-06-03 Doug Kwan <dougkwan@google.com>
2782 * gold/arm.cc (namespace utils): New.
2783 (Target_arm::reloc_is_non_pic): Define new method.
2784 (class Arm_relocate_functions): New.
2785 (Target_arm::Relocate::relocate): Handle relocation types used by
2788 2009-06-03 Ian Lance Taylor <iant@google.com>
2790 * arm.cc (Target_arm::scan::global): Use || instead of |.
2792 2009-06-02 Doug Kwan <dougkwan@google.com>
2794 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
2795 issued_non_pic_error_.
2796 (class Target_arm::Scan): Declare new method check_non_pic.
2797 Define new method symbol_needs_plt_entry.
2798 Declare new data member issued_non_pic_error_.
2799 (class Target_arm::Relocate): Declare new method
2800 should_apply_static_reloc.
2801 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
2802 (Target_arm::Scan::check_non_pic): Define new method.
2803 (Target_arm::Scan::local): Handle a small subset of reloc types used
2805 (Target_arm::Scan::local): Same.
2806 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2808 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
2810 * incremental.cc (Incremental_inputs::report_command_line): Filter
2811 out --incremental-* options.
2813 2009-05-29 Doug Kwan <dougkwan@google.com>
2815 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
2817 (class Target_arm): Update comment.
2818 (Target_arm::Target_arm): Initialize new data members GOT_,
2819 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
2820 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
2821 and Target_arm::rel_dyn_section.
2822 Declare new_enum Target_arm::Got_type.
2823 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
2825 Update commments for member do_dynsym_value.
2826 (Target_arm::got_size, Target_arm::plt_section,
2827 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
2828 new methods inside class defintion.
2829 (Target_arm::got_section): Define new method.
2830 (Target_arm::rel_dyn_section): Same.
2831 (Output_data_plt_arm): New template class.
2832 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
2833 (Output_data_plt_arm:do_adjust_output_section): Define new method.
2834 (Output_data_plt_arm::add_entry): Same.
2835 (Output_data_plt_arm::first_plt_entry): Define new
2836 static data member for PLT instruction template.
2837 (Output_data_plt_arm::plt_entry): Same.
2838 (Output_data_plt_arm::do_write): Define new method.
2839 (Target_arm::make_plt_entry): Same.
2840 (Target_arm::do_finalize_sections): Same.
2841 (Target_arm::do_dynsym_value): Same.
2843 2009-05-28 Doug Kwan <dougkwan@google.com>
2845 * Makefile.am (TARGETSOURCES): Add arm.cc.
2846 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
2847 * Makefile.in: Regenerate.
2849 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2851 2009-05-26 Doug Kwan <dougkwan@google.com>
2853 * options.cc (General_options::parse_exclude_libs). Fix a comment.
2854 (General_options::check_excluded_libs): Strip off directories in
2855 archive name before matching like GNU ld does.
2856 * testsuite/Makefile.am (MOSTLYCLEANFILES,
2857 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
2858 (exclude_libs_test_LDFLAGS): Add linker option
2859 -Wl,--exclude-libs,libexclude_libs_test_3
2860 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
2861 an explicit archive without using -l.
2862 (alt/libexclude_libs_test_3.a): New make rule.
2863 * testsuite/Makefile.in: Regenerate.
2864 * testsuite/exclude_libs_test.c : Declare lib3_default().
2866 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
2867 * exclude_libs_test_3.c: New file.
2869 2009-05-26 Nick Clifton <nickc@redhat.com>
2871 * po/id.po: New Indonesian translation.
2872 * po/gold.pot: Updated template file.
2874 2009-05-22 Sriraman Tallam <tmsriram@google.com>
2876 * testsuite/Makefile.am: Add -ffunction-sections to compile
2877 gc_comdat_test files. Add -Wl,--gc-sections to build
2879 * testsuite/Makefile.in: Regenerate.
2880 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
2882 2009-05-21 Sriraman Tallam <tmsriram@google.com>
2884 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
2885 kept comdat section was garbage collected.
2886 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
2887 * testsuite/Makefile.in: Regenerate.
2888 * testsuite/gc_comdat_test.sh: New file.
2889 * testsuite/gc_comdat_test_1.cc: New file.
2890 * testsuite/gc_comdat_test_2.cc: New file.
2892 2009-05-19 Doug Kwan <dougkwan@google.com>
2894 * archive.cc (Archive::Archive): Move constructor from archive.h
2895 to here. Initialize no_export_.
2896 (Archive::get_elf_object_for_member): Set no_export flag of object.
2897 * archive.h (Archive::Archive): Move constructor body to
2899 (Archive::no_export): New method.
2900 (Archive::no_export_): New field.
2901 * object.h (Object::Object): Initialize no_export_ to false.
2902 (Object::no_export, Object::set_no_export): New methods.
2903 (Object::no_export_): New field.
2904 * options.cc (General_options::parse_exclude_libs): New method.
2905 (General_options::check_excluded_libs) Same.
2906 * options.h (exclude_libs): New option.
2907 (General_options::check_excluded_libs): New method declaration.
2908 (General_options::excluded_libs_): New field.
2909 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
2910 default or protected visibility if an object has no-export flag set.
2911 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
2912 (check_SCRIPTS): Add exclude_libs_test.sh.
2913 (check_DATA): Add exclude_libs_test.syms.
2914 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
2915 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
2916 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
2917 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
2918 (exclude_libs_test.syms, libexclude_libs_test_1.a,
2919 libexclude_libs_test_2.a): New rules.
2920 * testsuite/Makefile.in: Regenerate.
2921 * testsuite/exclude_libs_test.c: New file.
2922 * testsuite/exclude_libs_test.sh: Ditto.
2923 * testsuite/exclude_libs_test_1.c: Ditto.
2924 * testsuite/exclude_libs_test_2.c: Ditto.
2926 2009-05-15 Ian Lance Taylor <iant@google.com>
2928 * configure.ac: Check for declarations for cases where libiberty.h
2929 checks HAVE_DECL_xxx.
2930 * configure, config.in: Rebuild.
2932 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
2934 * gold.h (Incremental_argument_list): Remove (invalid) forward
2936 * incremental.cc (Incremental_inputs::report_achive): New method.
2937 (Incremental_inputs::report_object): New method.
2938 (Incremental_inputs::report_script): New method.
2939 (Incremental_inputs::finalize_inputs): New method.
2940 (Incremental_inputs::finalize): Call finalize_inputs().
2941 (Incremental_inputs::sized_create_incremental_inputs_section_data):
2942 Create inputs entries.
2943 * incremental.h (Incremental_input_type): New enum.
2944 (Incremental_inputs::Incremental_input): Initialize new fields.
2945 (Incremental_inputs::report_inputs): New method.
2946 (Incremental_inputs::report_achive): New method.
2947 (Incremental_inputs::report_object): New method.
2948 (Incremental_inputs::report_script): New method.
2949 (Incremental_inputs::finalize_inputs): New method.
2950 (Incremental_inputs::Input_info): New struct.
2951 (Incremental_inputs::Input_info_map): New typedef.
2952 (Incremental_inputs::lock_): New field.
2953 (Incremental_inputs::Inputs_): New field.
2954 (Incremental_inputs::Inputs_map): New field.
2955 * main.cc (main): Call Incremental_input::report_inputs.
2956 * options.h (Input_argument_list): Typedef moved from
2958 (Input_file_group::Files): Remove, use ::Input_argument_list.
2959 (Input_file_group::Input_argument_list): Remove, use
2960 ::Input_argument_list.
2961 * plugin.cc (Plugin_manager::add_input_file): Add error in
2963 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
2965 * script.cc (read_input_script): Call
2966 Incremental_input::report_script.
2967 * script.h (Script_info): New class.
2969 2009-04-27 Ian Lance Taylor <iant@google.com>
2971 * x86_64.cc (do_adjust_output_section): Set entsize to
2974 2009-04-23 Elliott Hughes <enh@google.com>
2976 * output.cc (Output_file::close): After short writes, continue
2977 writing from the correct offset in the buffer being written.
2979 2009-04-23 Chris Demetriou <cgd@google.com>
2981 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
2982 * configure: Regenerate.
2983 * config.in: Regenerate.
2984 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
2985 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2987 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
2989 * incremental.cc (Incremental_inputs_header_data): Renamed from
2990 Incremental_input_header_data.
2991 (Incremental_inputs_header_data::data_size): New field.
2992 (Incremental_inputs_header_data::put_input_file_count): Renamed
2993 from input_file_count.
2994 (Incremental_inputs_header_data::put_command_line_offset): Renamed
2995 from command_line_offset.
2996 (Incremental_inputs_header_data::put_reserved): Renamed from
2998 (Incremental_inputs_entry_data): Renamed from
2999 Incremental_input_entry_data.
3000 (Incremental_inputs_entry_data::data_size): New field.
3001 (Incremental_inputs::report_command_line): New method.
3002 (Incremental_inputs::finalize): New method.
3003 (Incremental_inputs::create_incremental_inputs_data): New method.
3004 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3005 * incremental.h: New file.
3006 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3007 (Layout::finalize): Create incremental inputs section in
3009 (Layout::create_incremental_info_sections): New method.
3010 * layout.h (Layout::incremental_inputs): New method.
3011 (Layout::create_incremental_info_sections): New method.
3012 (Layout::incremental_inputs_): New field.
3013 * main.cc (main): Notify Incremental_input of the command line.
3015 2009-04-01 Ian Lance Taylor <iant@google.com>
3016 Mikolaj Zalewski <mikolajz@google.com>
3018 * gold.h (reserve_unordered_map): Define, three versions, one for
3019 each version of Unordered_map.
3020 * layout.cc (Layout::Layout): Remove options parameter. Add
3021 number_of_input_files parameter. Don't initialize options_.
3022 Initialize number_of_input_files_ and resized_signatures_. Move
3023 sections_are_attached_.
3024 (Layout::layout_group): Reserve space for group_signatures_.
3025 (Layout::find_or_add_kept_section): Change name parameter to be a
3026 reference. Resize signatures_ map when it gets large enough.
3027 (Layout::layout_eh_frame): Use parameters->options() instead of
3029 (Layout::make_output_section): Likewise.
3030 (Layout::attach_allocated_section_to_segment): Likewise.
3031 (Layout::finalize, Layout::create_executable_stack): Likewise.
3032 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3033 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3034 * layout.h (class Layout): Update declarations. Remove options_
3035 field. Add number_of_input_files_ and resized_signatures_
3036 fields. Move sections_are_attached_ field.
3037 * main.cc (main): Pass number of input files to Layout
3038 constructor. Don't pass options.
3040 2009-03-30 Ian Lance Taylor <iant@google.com>
3042 * ffsll.c (ffsll): Correct implementation.
3044 2009-03-27 Ian Lance Taylor <iant@google.com>
3046 * ffsll.c: New file.
3047 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3048 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3049 * ftruncate.c (ftruncate): Declare before definition.
3050 * mremap.c (mremap): Likewise.
3051 * pread.c (pread): Likewise.
3052 * configure, Makefile.in, config.in: Rebuild.
3054 * mremap.c: New file.
3055 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3056 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3057 (mremap): Declare if HAVE_MREMAP is not defined.
3058 * configure, Makefile.in, config.in: Rebuild.
3060 2009-03-27 Cary Coutant <ccoutant@google.com>
3062 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3063 position independent.
3064 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3065 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3067 2009-03-24 Cary Coutant <ccoutant@google.com>
3069 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3071 (needs_dynamic_reloc): Likewise.
3073 2009-03-24 Ian Lance Taylor <iant@google.com>
3075 * yyscript.y (file_cmd): Recognize EXTERN.
3076 (extern_name_list, extern_name_list_body): New nonterminals.
3077 * script.cc (script_add_extern): Define.
3078 * script-c.h (script_add_extern): Declare.
3080 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
3082 * object.cc (is_elf_object): Define.
3083 * object.h (is_elf_object): Declare.
3084 * archive.cc (Archive::get_elf_object_for_member): Call
3086 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3088 2009-03-24 Elliott Hughes <enh@google.com>
3090 * output.cc (Output_file::map_anonymous): Define.
3091 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3092 try an anonymous one. Report the size if the mmap fails.
3093 * output.h (class Output_file): Declare map_anonymous.
3095 2009-03-24 Ian Lance Taylor <iant@google.com>
3097 * target-select.cc (instantiate_target): Don't acquire the lock if
3098 the instantiated_target_ field has already been set.
3100 2009-03-23 Ian Lance Taylor <iant@google.com>
3102 * gold-threads.h (class Initialize_lock): Define.
3103 * gold-threads.cc (class Initialize_lock_once): Define.
3104 (initialize_lock_control): New static variable.
3105 (initialize_lock_pointer): New static variable.
3106 (initialize_lock_once): New static function.
3107 (Initialize_lock::Initialize_lock): Define.
3108 (Initialize_lock::initialize): Define.
3109 * target-select.h: Include "gold-threads.h".
3110 (class Target_selector): Add lock_ and initialize_lock_ fields.
3111 Don't define instantiate_target, just declare it.
3112 * target-select.cc (Target_selector::Target_selector): Initialize
3114 (Target_selector::instantiate_target): Define.
3115 * descriptors.h: Include "gold-threads.h".
3116 (class Descriptors): Add initialize_lock_ field.
3117 * descriptors.cc (Descriptors::Descriptors): Initialize new
3119 (Descriptors::open): Use initialize_lock_ field
3120 * errors.h (class Errors): Add initialize_lock_ field.
3121 * errors.cc (Errors::Errors): Initialize new field.
3122 (Errors::initialize_lock): Use initialize_lock_ field.
3123 * powerpc.cc (class Target_selector_powerpc): Remove
3124 instantiated_target_ field. In do_recognize call
3125 instantiate_target rather than do_instantiate_target. In
3126 do_instantiate_target just allocate a new target.
3127 * sparc.cc (class Target_selector_sparc): Likewise.
3129 * freebsd.h: New file.
3130 * i386.cc: Include "freebsd.h".
3131 (Target_i386): Derive from Target_freebsd rather than
3133 (Target_selector_i386): Derive from Target_selector_freebsd rather
3134 than Target_selector.
3135 * x86_64.cc: Include "freebsd.h".
3136 (Target_x86_64): Derive from Target_freebsd rather than
3138 (Target_selector_x86_64): Derive from Target_selector_freebsd
3139 rather than Target_selector.
3140 * target.h (class Target): Add adjust_elf_header and
3141 do_adjust_elf_header.
3142 * output.cc (Output_file_header:: do_sized_write): Call target
3143 adjust_elf_header routine.
3144 * configure.tgt: Set targ_osabi.
3145 * configure.ac: Define GOLD_DEFAULT_OSABI.
3146 * parameters.cc (Parameters::default_target): Pass
3147 GOLD_DEFAULT_OSABI to select_target.
3148 * target-select.h (class Target_selector): Make instantiate_target
3149 protected rather than private.
3150 * Makefile.am (HFILES): Add freebsd.h.
3151 * configure, Makefile.in, config.in: Rebuild.
3153 * merge.cc (do_add_input_section): Correct pend value. Change
3154 message about last entry not being null terminated from error to
3157 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3159 * incremental.cc: New file.
3160 * Makefile.am (CCFILES): Add incremental.cc.
3161 * Makefile.in: Rebuild.
3163 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3165 * layout.cc (Layout::output_section_name): Preserve names
3166 of '.note.' sections.
3168 2009-03-19 Ian Lance Taylor <iant@google.com>
3170 * descriptors.cc (Descriptors::open): Check that the options are
3171 valid before using them.
3173 2009-03-18 Ian Lance Taylor <iant@google.com>
3175 * script-sections.h: Include <list>.
3176 (class Script_sections): Change Sections_elements from std::vector
3177 to std::list. Typedef public Elements_iterator. Add
3178 orphan_section_placement_, data_segment_align_start_, and
3179 saw_data_segment_align_ fields. Remove data_segment_align_index_
3181 * script-sections.cc (class Orphan_section_placement): New class.
3182 (class Sections_element): Add virtual functions is_relro and
3183 orphan_section_init. Remove virtual function place_orphan_here.
3184 (class Output_section_definition): Add is_relro and
3185 orphan_section_init. Remove place_orphan_here.
3186 (class Orphan_output_section): Likewise.
3187 (Script_sections::Script_sections): Update for field changes.
3188 (Script_sections::data_segment_align): Set saw_data_segment_align_
3189 and data_segment_align_start_, not data_segment_align_index.
3190 (Script_sections::data_segment_relro_end): Check
3191 saw_data_segment_align_. Use data_segment_align_start_ rather
3192 than data_segment_align_index_.
3193 (Script_sections::place_orphan): Rewrite to use
3194 Orphan_section_placement.
3196 2009-03-17 Ian Lance Taylor <iant@google.com>
3198 * archive.cc (Archive::add_symbols): Check for a version attached
3199 to the symbol name in the archive map.
3200 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3201 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3202 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3203 (ver_test_11.a): New target.
3204 * testsuite/Makefile.in: Rebuild.
3206 * configure.ac: Check for chsize and posix_fallocate. Replace
3208 * ftruncate.c: New file, from gnulib.
3209 * output.cc (posix_fallocate): Define dummy version if not
3210 HAVE_POSIX_FALLOCATE.
3211 (Output_file::map): Call posix_fallocate rather than lseek and
3213 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3214 * configure, Makefile.in, config.in: Rebuild.
3216 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3218 * layout.h (Layout::create_note): Add section_name parameter.
3219 * layout.cc (Layout::create_note): Likewise.
3220 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3222 2009-03-17 Ian Lance Taylor <iant@google.com>
3224 * descriptors.cc: Include "options.h".
3225 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3226 (Descriptors::open): Always use O_CLOEXEC when opening a new
3227 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3228 then set FD_CLOEXEC.
3230 * sparc.cc (class Target_sparc): Add has_got_section.
3231 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3232 make sure we have a GOT section.
3234 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3235 (Target_sparc::Scan::local): Likewise.
3236 (Target_sparc::Scan::global): Likewise.
3237 (Target_sparc::Relocate::relocate): Likewise.
3238 (Target_sparc::Relocate::relocate_tls): Likewise.
3240 * symtab.cc (Symbol_table::define_default_version): New function,
3241 broken out of add_from_object.
3242 (Symbol_table::add_from_object): Call define_default_version.
3243 (Symbol_table::define_special_symbol): Add resolve_oldsym
3244 parameter. Change all callers. If the version for a symbol comes
3245 from a version script, resolve it with the symbol with the same
3246 name with no version. Also add the symbol without a version if
3248 (do_define_in_output_data): If resolving with oldsym, don't delete
3250 (do_define_in_output_segment): Likewise.
3251 (do_define_as_constant): Likewise.
3252 * symtab.h (class Symbol_table): Update declarations.
3254 2009-03-13 Ian Lance Taylor <iant@google.com>
3256 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3257 (Read_symbols::requeue): New function.
3258 (Read_symbols::do_read_symbols): If make_elf_object fails because
3259 the target type is not configured, and the file was searched for,
3260 issue a warning and retry with the next directory.
3261 (Add_symbols::run): If the file has an incompatible format, and
3262 it was searched for, requeue the Read_symbols task. On error,
3264 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3265 dirindex parameter to constructor. Change all callers. Declare
3266 incompatible_warning and requeue.
3267 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3268 input_argument_ and input_group_ fields. Add them to
3269 constructor. Change all callers.
3270 (class Read_script): Add dirindex_ field. Add it to constructor.
3272 * archive.cc (Archive::setup): Remove input_objects parameter.
3274 (Archive::get_file_and_offset): Likewise.
3275 (Archive::read_all_symbols): Likewise.
3276 (Archive::read_symbols): Likewise.
3277 (Archive::get_elf_object_for_member): Remove input_objects
3278 parameter. Add punconfigured parameter. Change all callers.
3279 (Archive::add_symbols): Change return type to bool. Check return
3280 value of include_member.
3281 (Archive::include_all_members): Likewise.
3282 (Archive::include_member): Change return type to bool. Return
3283 false if first included object has incompatible target. Set
3284 included_member_ field.
3285 (Add_archive_symbols::run): If add_symbols returns false, requeue
3287 * archive.h (class Archive): Add included_member_ field.
3288 Initialize it in constructor. Add input_file and searched_for
3289 methods. Update declarations.
3290 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3291 input_argument_ fields. Add them to constructor. Change all
3293 * script.cc: Include "target-select.h".
3294 (class Parser_closure): Add skip_on_incompatible_target_ and
3295 found_incompatible_target_ fields. Add
3296 skip_on_incompatible_target parameter to constructor. Change all
3297 callers. Add methods skip_on_incompatible_target,
3298 clear_skip_on_incompatible_target, found_incompatible_target, and
3299 set_found_incompatible_target.
3300 (read_input_script): Add dirindex parameter. Change all callers.
3301 If parser finds an incompatible target, requeue Read_symbols
3303 (script_set_symbol): Clear skip_on_incompatible_target in
3305 (script_add_assertion, script_parse_option): Likewise.
3306 (script_start_sections, script_add_phdr): Likewise.
3307 (script_check_output_format): New function.
3308 * script.h (read_input_script): Update declaration.
3309 * script-c.h (script_check_output_format): Declare.
3310 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3311 (ignore_cmd): Remove OUTPUT_FORMAT.
3312 * fileread.cc (Input_file::Input_file): Add explicit this.
3313 (Input_file::will_search_for): New function.
3314 (Input_file::open): Add pindex parameter. Change all callers.
3315 * fileread.h (class Input_file): Add input_file_argument method.
3316 Declare will_search_for. Update declarations.
3317 * object.cc (make_elf_object): Add punconfigured parameter.
3319 * object.h (class Object): Make input_file public. Add
3320 searched_for method.
3321 (make_elf_object): Update declaration.
3322 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3324 * dirsearch.h (class Dirsearch): Update declaration.
3325 * options.h (class General_options): Add --warn-search-mismatch.
3326 * parameters.cc (Parameters::is_compatible_target): New function.
3327 * parameters.h (class Parameters): Declare is_compatible_target.
3328 * workqueue.cc (Workqueue::add_blocker): New function.
3329 * workqueue.h (class Workqueue): Declare add_blocker.
3331 * fileread.cc (Input_file::open): Remove options parameter.
3333 (Input_file::open_binary): Likewise.
3334 * script.cc (read_input_script): Likewise.
3335 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3336 options parameter from constructor. Change all callers.
3337 (class Read_script): Likewise.
3338 * fileread.h (class Input_file): Update declarations.
3339 * script.h (read_input_script): Update declaration.
3341 2009-03-10 Nick Clifton <nickc@redhat.com>
3343 * po/es.po: New Spanish translation.
3345 2009-03-06 Cary Coutant <ccoutant@google.com>
3347 * options.cc (parse_short_option): Keep dash_z from registering itself.
3349 2009-03-03 Ian Lance Taylor <iant@google.com>
3352 * target-reloc.h (relocate_section): Pass output_section to
3354 * i386.cc (Target_i386::should_apply_static_reloc): Add
3355 output_section parameter. Change all callers.
3356 (Target_i386::Relocate::relocate): Add output_section parameter.
3357 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3358 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3359 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3360 * testsuite/two_file_shared.sh: New script.
3361 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3362 (check_DATA): Add two_file_shared.dbg.
3363 (two_file_shared.dbg): New target.
3364 * testsuite/Makefile.in: Rebuild.
3366 2009-03-01 Ian Lance Taylor <iant@google.com>
3368 * configure.ac: Check for byteswap.h.
3369 * configure: Rebuild.
3370 * config.in: Rebuild.
3372 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3374 * layout.cc (Layout::find_or_add_kept_section): New function.
3375 (Layout::add_comdat): Removed.
3376 * layout.h (struct Kept_section): Move out of class Layout.
3377 Remove trailing underscores from field names. Add group_sections
3378 field. Rename group_ field to is_group. Change all uses.
3379 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3380 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3381 comdat_groups_ field.
3382 (Sized_relobj::include_section_group): Use
3383 find_or_add_kept_section and Kept_section::group_sections.
3384 (Sized_relobj::include_linkonce_section): Likewise.
3385 * object.cc (class Sized_relobj): Don't define Comdat_group or
3386 Comdat_group_table. Remove find_comdat_group and
3387 add_comdat_group. Remove comdat_groups_ field.
3388 * plugin.cc (include_comdat_group): Use
3389 Layout::find_or_add_kept_section.
3391 2009-02-28 Ian Lance Taylor <iant@google.com>
3393 * README: --gc-sections and map files are now supported. Document
3394 some build requirements.
3397 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3398 relocatable link set the value of the section symbol to zero.
3399 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3400 relocatable link don't include the section address in the local
3403 2009-02-27 Ian Lance Taylor <iant@google.com>
3406 * options.h (class Search_directory): Add is_system_directory.
3407 (class General_options): Declare is_in_system_directory.
3408 * options.cc (get_relative_sysroot): Make static.
3409 (get_default_sysroot): Make static.
3410 (General_optoins::is_in_system_directory): New function.
3411 * fileread.cc (Input_file::is_in_system_directory): New function.
3412 * fileread.h (class Input_file): Declare is_in_system_directory.
3413 * object.h (class Object): Add is_in_system_directory.
3414 (class Input_objects): Remove system_library_directory_ field.
3415 * object.cc (Input_objects::add_object): Don't set
3416 system_library_directory_.
3417 (input_objects::found_in_system_library_directory): Remove.
3418 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3419 parameter. Change all callers.
3420 (Symbol_table::sized_write_globals): Likewise.
3421 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3422 Call Object::is_in_system_directory.
3423 * symtab.h (class Symbol_table): Update declarations.
3426 * descriptors.h (Open_descriptor): Add is_on_stack field.
3427 * descriptors.cc (Descriptors::open): If the descriptor is on the
3428 top of the stack, remove it. Initialize is_on_stack field.
3429 (Descriptors::release): Only add pod to stack if it is not on the
3431 (Descriptors::close_some_descriptor): Clear stack_next and
3435 * output.cc (Output_section::find_starting_output_address): Rename
3436 from starting_output_address; add PADDR parameter; change return
3438 * output.h (class Output_section): Declare
3439 find_starting_output_address instead of starting_output_address.
3440 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3441 section symbol for which we can't find a merge section.
3444 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3445 hidden or internal, force the symbol to be local.
3446 * resolve.cc (Symbol::override_visibility): Define.
3447 (Symbol::override_base): Use override_visibility.
3448 (Symbol_table::resolve): Likewise.
3449 (Symbol::override_base_with_special): Likewise.
3450 (Symbol_table::override_with_special): If the visibility is hidden
3451 or internal, force the symbol to be local.
3452 * symtab.h (class Symbol): Add set_visibility and
3453 override_visibility.
3454 * testsuite/ver_test_1.sh: New file.
3455 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3456 (check_DATA): Add ver_test_1.syms.
3457 (ver_test_1.syms): New target.
3458 * testsuite/Makefile.in: Rebuild.
3460 2009-02-25 Cary Coutant <ccoutant@google.com>
3462 * layout.cc (Layout::choose_output_section): Don't rename sections
3463 when using a linker script that has a SECTIONS clause.
3464 * Makefile.in: Regenerate.
3466 * testsuite/Makefile.am (script_test_5.sh): New test case.
3467 * testsuite/Makefile.in: Regenerate.
3468 * testsuite/script_test_5.cc: New file.
3469 * testsuite/script_test_5.sh: New file.
3470 * testsuite/script_test_5.t: New file.
3472 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
3474 * archive.cc (Archive::include_member): Update calls to add_symbols.
3475 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3476 the Layout argument.
3477 * dynobj.h (do_add_symbols): Add the Layout argument.
3478 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3480 * object.h (Object::add_symbols): Add the Layout argument.
3481 (Object::do_add_symbols): Add the Layout argument.
3482 (Sized_relobj::do_add_symbols): Add the Layout argument.
3483 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3484 Unify the two versions.
3485 (Add_plugin_symbols): Remove.
3486 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3487 (Sized_pluginobj::do_add_symbols): Unify the two versions.
3488 (Add_plugin_symbols): Remove.
3489 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3490 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3491 (Add_symbols::run): Make it work with Pulginobj.
3493 2009-02-06 Ian Lance Taylor <iant@google.com>
3495 * object.cc (Sized_relobj::do_layout): Make info message start
3496 with lower case letter.
3498 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
3500 * binary.cc: Fix file comment.
3502 * options.h (enum Incremental_disposition): Define.
3503 (class General_options): Add new options: --incremental,
3504 --incremental_changed, --incremental_unchanged,
3505 --incremental_unknown. Add incremental_disposition_ and
3506 implicit_incremental_ fields.
3507 (General_options::incremental_disposition): New function.
3508 (class Position_dependent_options): Add incremental_disposition
3510 (Position_dependent_options::copy_from_options): Set incremental
3512 * options.cc (General_options::parse_incremental_changed): New
3514 (General_options::parse_incremental_unchanged): New function.
3515 (General_options::parse_incremental_unknown): New function.
3516 (General_options::General_options): Initialize new fields
3517 incremental_disposition_ and implicit_incremental_.
3518 (General_options::finalize): Check for uasge of --incremental-*
3519 without --incremental.
3521 2009-02-06 Chris Demetriou <cgd@google.com>
3523 * gold.h (gold_undefined_symbol): Change to take only a Symbol
3524 pointer and to report location as the file name associated with
3526 (gold_undefined_symbol_at_location): New function to replace the
3527 old gold_undefined_symbol functionality.
3528 * target-reloc.h (relocate_section): Update to use
3529 gold_undefined_symbol_at_location.
3530 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3531 Call gold_undefined_symbol function rather than gold_error.
3532 * errors.h (Errors::undefined_symbol): Take location as a
3533 string, rather than calculating it from a relocation.
3534 * errors.cc (Errors::fatal): Print "fatal error:" before the
3536 (Errors::error, Errors::error_at_location): Print "error: "
3537 before the formatted message.
3538 (Errors::undefined_symbol): Take location as a string, rather
3539 than calculating it from a relocation.
3540 (gold_undefined_symbol_at_location): New function akin to
3541 old gold_undefined_symbol, calculates location from relocation.
3542 (gold_undefined_symbol): Change to take only a Symbol pointer
3543 and to report location as the file name associated with the symbol.
3544 * testsuite/debug_msg.sh: Update for changed error messages.
3545 * testsuite/undef_symbol.sh: Likewise.
3547 2009-02-04 Duncan Sands <baldrick@free.fr>
3550 * reduced_debug_output.h
3551 (Output_reduced_debug_abbrev_section::failed): Use format for
3553 (Output_reduced_debug_info_section::faild): Likewise.
3555 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
3557 * script.cc (Lazy_demangler): New class.
3558 (Version_script_info::get_symbol_version_helper): Demangle a
3561 2009-01-29 Cary Coutant <ccoutant@google.com>
3563 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
3565 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3567 2009-01-28 Ian Lance Taylor <iant@google.com>
3569 * version.cc (version_string): Bump to 1.9.
3571 * gold.h: Include <cstring> and <stdint.h>.
3572 * version.cc: Include <cstdio>.
3573 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
3575 * reduced_debug_output.cc (insert_into_vector): Rename from
3576 Insert_into_vector; change all callers. Use Swap_unaligned to
3577 avoid aliasing issue; remove union since it is unnecessary.
3579 2009-01-27 Sriraman Tallam <tmsriram@google.com>
3581 * Makefile.am (CCFILES): Add gc.cc.
3583 * Makefile.in: Regenerate.
3584 * gold.cc (Gc_runner): New class.
3585 (queue_initial_tasks): Call garbage collection related tasks
3586 when corresponding options are invoked.
3587 (queue_middle_gc_tasks): New function.
3588 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
3589 processed early before laying out sections during garbage collection.
3590 * gold.h (queue_middle_gc_tasks): New function.
3591 (is_prefix_of): Move from "layout.cc".
3592 * i386.cc (Target_i386::gc_process_relocs): New function.
3593 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
3594 * main.cc (main): Create object of class "Garbage_collection".
3595 * object.cc (Relobj::copy_symbols_data): New function.
3596 (Relobj::is_section_name_included): New function.
3597 (Sized_relobj::do_layout): Allow this function to be called twice
3598 during garbage collection and defer layout of section during the
3600 * object.h (Relobj::get_symbols_data): New function.
3601 (Relobj::is_section_name_included): New function.
3602 (Relobj::copy_symbols_data): New function.
3603 (Relobj::set_symbols_data): New function.
3604 (Relobj::get_relocs_data): New function.
3605 (Relobj::set_relocs_data): New function.
3606 (Relobj::is_output_section_offset_invalid): New pure virtual function.
3607 (Relobj::gc_process_relocs): New function.
3608 (Relobj::do_gc_process_relocs): New pure virtual function.
3609 (Relobj::sd_): New data member.
3610 (Sized_relobj::is_output_section_offset_invalid): New function.
3611 (Sized_relobj::do_gc_process_relocs): New function.
3612 * options.h (General_options::gc_sections): Modify to not be a no-op.
3613 (General_options::print_gc_sections): New option.
3614 * plugin.cc (Plugin_finish::run): Remove function call to
3615 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
3616 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
3617 * reloc.cc (Read_relocs::run): Add task to process relocs and
3618 determine unreferenced sections when doing garbage collection.
3619 (Gc_process_relocs): New class.
3620 (Sized_relobj::do_gc_process_relocs): New function.
3621 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
3622 sections that are garbage collected.
3623 * reloc.h (Gc_process_relocs): New class.
3624 * sparc.cc (Target_sparc::gc_process_relocs): New function.
3625 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
3626 symbols whose corresponding sections are garbage collected.
3627 (Symbol_table::Symbol_table): Add new parameter for the garbage
3629 (Symbol_table::gc_mark_undef_symbols): New function.
3630 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3631 (Symbol_table::gc_mark_dyn_syms): New function.
3632 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
3634 (Symbol_table::add_from_object): Likewise.
3635 (Symbol_table::add_from_relobj): When building shared objects, do not
3636 treat externally visible symbols as garbage.
3637 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
3638 table information for static and relocatable links.
3639 * symtab.h (Symbol_table::set_gc): New function.
3640 (Symbol_table::gc): New function.
3641 (Symbol_table::gc_mark_undef_symbols): New function.
3642 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3643 (Symbol_table::gc_mark_dyn_syms): New function.
3644 (Symbol_table::gc_): New data member.
3645 * target.h (Sized_target::gc_process_relocs): New pure virtual
3647 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
3648 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
3650 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
3652 * options.h (General_options::gc_sections): Define as a no-op for now.
3653 (General_options::no_keep_memory): Ditto.
3654 (General_options::Bshareable): Define.
3655 * options.cc (General_options::finalize): Honor -Bshareable.
3657 2009-01-20 Andreas Schwab <schwab@suse.de>
3659 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
3660 read the value in the contents, since we don't use it. Use the
3661 template endianness when writing.
3662 (Relocate::relocate): Use it for R_PPC_REL16_HA.
3664 2009-01-19 Andreas Schwab <schwab@suse.de>
3666 * configure.tgt (powerpc64-*): Fix targ_obj.
3668 2009-01-15 Ian Lance Taylor <iant@google.com>
3670 * object.cc (Sized_relobj::write_local_symbols): Don't write out
3671 local symbols when stripping all symbols.
3673 2009-01-14 Cary Coutant <ccoutant@google.com>
3675 * output.cc (Output_reloc): Add explicit instantiations.
3677 2009-01-14 Cary Coutant <ccoutant@google.com>
3679 * archive.cc (Archive::get_elf_object_for_member): Remove call
3680 to File_read::claim_for_plugin.
3681 * descriptors.cc (Descriptors::open): Remove reference to
3683 (Descriptors::claim_for_plugin): Remove.
3684 * descriptors.h (Descriptors::claim_for_plugin): Remove.
3685 (Descriptors::is_claimed): Remove.
3686 (claim_descriptor_for_plugin): Remove.
3687 * fileread.cc (File_read::claim_for_plugin): Remove.
3688 * fileread.h (File_read::claim_for_plugin): Remove.
3689 (File_read::descriptor): Reopen descriptor if necessary.
3690 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
3691 (Plugin_manager::all_symbols_read): Add task parameter. Change
3693 (Plugin_manager::get_input_file): New function.
3694 (Plugin_manager::release_input_file): New function.
3695 (Pluginobj::Pluginobj): Add filesize parameter and initialize
3696 corresponding data member.
3697 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3698 and pass to base constructor. Change all callers.
3699 (get_input_file, release_input_file): New functions.
3700 (make_sized_plugin_object): Add filesize parameter. Change all callers.
3701 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3702 (Plugin_manager::all_symbols_read): Add task parameter.
3703 (Plugin_manager::get_input_file): New function.
3704 (Plugin_manager::release_input_file): New function.
3705 (Plugin_manager::task_): New data member.
3706 (Pluginobj::Pluginobj): Add filesize parameter.
3707 (Pluginobj::filename): New function.
3708 (Pluginobj::descriptor): New function.
3709 (Pluginobj::filesize): New function.
3710 (Pluginobj::filesize_): New data member.
3711 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3712 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3713 File_read::claim_for_plugin; use Object::unlock to unlock the file.
3715 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3716 with archive libraries.
3717 * testsuite/Makefile.in: Regenerate.
3718 * testsuite/plugin_test.c (struct sym_info): New type.
3719 (get_input_file, release_input_file): New static variables.
3720 (onload): Capture new transfer vector entries.
3721 (claim_file_hook): Stop reading at end of file according to filesize.
3722 Factor out parsing of readelf output into separate function.
3723 (all_symbols_read_hook): Exercise get_input_file and release_input_file
3724 APIs and get the source file name from the symbol table. Convert
3725 source file name to corresponding object file name. Print info
3726 message when adding new input files.
3727 (parse_readelf_line): New function.
3728 * testsuite/plugin_test_1.sh: Add checks for new info messages.
3729 * testsuite/plugin_test_2.sh: Likewise.
3730 * testsuite/plugin_test_3.sh: Likewise.
3731 * testsuite/plugin_test_4.sh: New test case.
3733 2009-01-07 Ian Lance Taylor <iant@google.com>
3735 * version.cc (version_string): Bump to 1.8.
3737 2008-12-23 Cary Coutant <ccoutant@google.com>
3739 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3740 * plugin.cc (Plugin_manager::finish): Rename as
3741 layout_deferred_objects. Move cleanup to separate function.
3742 (Plugin_manager::cleanup): New function.
3743 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3745 * plugin.h (Plugin_manager::finish): Rename as
3746 layout_deferred_objects.
3747 (Plugin_manager::cleanup): New function.
3748 (Plugin_manager::cleanup_done): New field.
3750 2008-12-23 Cary Coutant <ccoutant@google.com>
3752 * plugin.cc (is_visible_from_outside): New function.
3753 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3754 so we don't return "IR only" status for exported symbols or -r links.
3756 * testsuite/Makefile.am (plugin_test_3): New test case.
3757 * testsuite/Makefile.in: Regenerate.
3758 * testsuite/plugin_test_3.sh: New file.
3760 2008-12-22 Cary Coutant <ccoutant@google.com>
3762 * object.cc (Sized_relobj::layout_section): New function.
3763 (Sized_relobj::do_layout): Defer layout of input sections until after
3764 plugin has provided replacement files.
3765 (Sized_relobj::do_layout_deferred_sections): New function.
3766 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3767 (Relobj::layout_deferred_sections): New function.
3768 (Relobj::do_layout_deferred_sections): New function.
3769 (Sized_relobj::do_layout_deferred_sections): New function.
3770 (Sized_relobj::layout_section): New function.
3771 (Sized_relobj::Deferred_layout): New structure.
3772 (Sized_relobj::deferred_layout_): New field.
3773 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3774 Change all callers. Layout deferred sections.
3775 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
3777 (Plugin_hook::run): Move code from do_plugin_hook inline.
3778 (Plugin_hook::do_plugin_hook): Remove.
3779 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3780 (Plugin_manager::finish): Renamed, was cleanup.
3781 (Plugin_manager::should_defer_layout): New function.
3782 (Plugin_manager::add_deferred_layout_object): New function.
3783 (Plugin_manager::Deferred_layout_list): New type.
3784 (Plugin_manager::deferred_layout_objects_): New field.
3785 (Plugin_hook::do_plugin_hook): Remove.
3787 2008-12-17 Ian Lance Taylor <iant@google.com>
3789 * options.h (class General_options): Add --no case for
3792 2008-12-16 Cary Coutant <ccoutant@google.com>
3794 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3796 (Plugin_manager::claim_file): Create plugin object even if
3797 plugin did not call the add_symbols callback.
3798 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
3799 asking for more symbols than were added.
3800 * testsuite/Makefile.am (plugin_test_1): Add test case with
3802 (empty.syms): New target.
3803 * testsuite/Makefile.in: Regenerate.
3804 * testsuite/plugin_test.c (claim_file_hook): Add new debug
3805 message. Don't call add_symbols if no globals.
3806 (all_symbols_read_hook): Don't provide replacement for empty
3809 2008-12-12 Ian Lance Taylor <iant@google.com>
3811 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
3812 r_type == 0 for a local symbol with r_sym == 0.
3813 (scan_relocatable_relocs): Pass r_sym to
3814 local_non_section_strategy.
3815 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
3818 * configure.ac: Update test for TLS descriptors: they are
3819 supported as of glibc 2.9.
3820 * configure: Rebuild.
3822 2008-12-11 Ian Lance Taylor <iant@google.com>
3825 * target-reloc.h (Default_scan_relocatable_relocs): For each
3826 function, map r_type == 0 to RELOC_DISCARD.
3828 2008-12-10 Cary Coutant <ccoutant@google.com>
3830 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
3831 object to override a kept COMDAT group from a plugin object.
3833 2008-12-09 Ian Lance Taylor <iant@google.com>
3836 * yyscript.y (file_cmd): Handle INPUT.
3838 * testsuite/initpri1.c: Change all declarations to be full
3839 prototypes by adding void, to avoid compiler warnings.
3841 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
3843 * options.cc (General_options::parse_plugin_opt): New.
3844 (General_options::add_plugin): The argument now is just the filename.
3845 (General_options::add_plugin_option): New.
3846 * options.h (plugin_opt): New.
3847 (add_plugin): Change argument name.
3848 (add_plugin_option): New.
3849 * plugin.cc (Plugin::load): Don't parse the plugin option.
3850 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
3851 (Plugin::add_option): New.
3852 (Plugin::args_): Change type.
3853 (Plugin::filename_): New.
3854 (Plugin_manager::add_plugin_option): New.
3855 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
3856 * testsuite/Makefile.in: Regenerate.
3858 2008-12-05 Cary Coutant <ccoutant@google.com>
3860 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
3861 Handle --strip-lto-sections option.
3862 * options.h (strip_lto_sections): New option.
3864 2008-12-01 Cary Coutant <ccoutant@google.com>
3866 * plugin.cc (ld_plugin_message): Change format parameter to const.
3867 Fix mismatch between new[] and delete.
3869 2008-11-14 Cary Coutant <ccoutant@google.com>
3871 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
3874 2008-11-05 Craig Silverstein <csilvers@google.com>
3876 * options.cc (General_options::parse_dynamic_list): New function.
3877 * options.h (General_options): New flags dynamic_list,
3878 dynamic_list_data, dynamic_list_cpp_new, and
3879 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
3880 (General_options::in_dynamic_list): New function.
3881 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
3882 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
3883 (Lex::can_continue_name): Likewise.
3885 (read_script_file): New parameter script_options.
3886 (read_dynamic_list): New function.
3887 (Script_options::define_dynamic_list): New function.
3888 (dynamic_list_keyword_parsecodes): New variable.
3889 (dynamic_list_keywords): New variable.
3890 * script.h (Script_options::define_dynamic_list): New function
3892 (read_dynamic_list): New function prototype.
3893 * symtab.cc (strprefix): New macro.
3894 (Symbol::should_add_dynsym_entry): Support dynamic_list,
3895 dynamic_list_data, dynamic_list_cpp_new, and
3896 dynamic_list_cpp_typeinfo.
3897 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
3898 (dynamic_list_expr): New rule.
3899 (dynamic_list_nodes): Likewise.
3900 (dynamic_list_node): Likewise.
3901 * testsuite/Makefile.am (dynamic_list): New test.
3902 * testsuite/Makefile.in: Regenerated.
3903 * testsuite/dynamic_list.t: New file.
3904 * testsuite/dynamic_list.sh: New file.
3906 2008-11-05 Craig Silverstein <csilvers@google.com>
3908 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
3909 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
3910 (t11_last): Likewise.
3911 * testsuite/ver_test_6.c (main): Likewise.
3913 2008-10-07 Cary Coutant <ccoutant@google.com>
3915 * options.c (General_options::finalize): Add check for -static and
3917 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
3920 2008-10-02 Cary Coutant <ccoutant@google.com>
3922 * plugin.cc (make_sized_plugin_object): Fix conditional
3923 compilation to work when not all targets are enabled.
3925 2008-09-29 Cary Coutant <ccoutant@google.com>
3927 * archive.cc (Archive::get_file_and_offset): Use filename instead
3928 of name to get library path.
3929 (Archive::include_member): Unlock external member of a thin archive.
3931 * testsuite/Makefile.am (TEST_AR): New variable.
3932 (thin_archive_test_1): New test.
3933 (thin_archive_test_2): New test.
3934 * testsuite/Makefile.in: Regenerate.
3935 * testsuite/thin_archive_main.cc: New file.
3936 * testsuite/thin_archive_test_1.cc: New file.
3937 * testsuite/thin_archive_test_2.cc: New file.
3938 * testsuite/thin_archive_test_3.cc: New file.
3939 * testsuite/thin_archive_test_4.cc: New file.
3941 2008-09-29 Cary Coutant <ccoutant@google.com>
3943 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
3944 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
3946 (Sized_relobj::do_finalize_local_symbols): Likewise.
3947 (Sized_relobj::map_to_kept_section): Likewise.
3948 * object.h (Sized_relobj::invalid_address): New constant.
3949 (Sized_relobj::do_output_section_offset): Check for invalid_address
3951 * output.cc (Output_reloc::local_section_offset): Use constant
3952 invalid_address instead of -1U.
3953 (Output_reloc::get_address): Likewise.
3954 (Output_section::output_address): Change -1U to -1ULL.
3955 * output.h (Output_reloc::invalid_address): New constant.
3956 * reloc.cc (Sized_relobj::write_sections): Use constant
3957 invalid_address instead of -1U.
3958 (Sized_relobj::relocate_sections): Likewise.
3959 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
3960 values for merge sections.
3961 * target-reloc.h (relocate_for_relocatable): Use constant
3962 invalid_address instead of -1U.
3964 2008-09-19 Cary Coutant <ccoutant@google.com>
3966 Add plugin functionality for link-time optimization (LTO).
3967 * configure.ac (plugins): Add --enable-plugins option.
3968 * configure: Regenerate.
3969 * config.in: Regenerate.
3970 * Makefile.am (LIBDL): New variable.
3971 (CCFILES): Add plugin.cc.
3972 (HFILES): Add plugin.h.
3973 (ldadd_var): Add LIBDL.
3974 * Makefile.in: Regenerate.
3976 * archive.cc: Include "plugin.h".
3977 (Archive::setup): Don't preread archive symbols when using a plugin.
3978 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
3979 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
3981 (Archive::include_member): Add symbols from plugin objects.
3982 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
3983 * descriptors.cc (Descriptors::open): Check for file descriptors
3984 abandoned by plugins.
3985 (Descriptors::claim_for_plugin): New function.
3986 * descriptors.h (Descriptors::claim_for_plugin): New function.
3987 (Open_descriptor::is_claimed): New field.
3988 (claim_descriptor_for_plugin): New function.
3989 * fileread.cc (File_read::claim_for_plugin): New function.
3990 * fileread.h (File_read::claim_for_plugin): New function.
3991 (File_read::descriptor): New function.
3992 * gold.cc: Include "plugin.h".
3993 (queue_initial_tasks): Add task to call plugin hooks for generating
3995 * main.cc: Include "plugin.h".
3996 (main): Load plugin libraries.
3997 * object.h (Pluginobj): Declare.
3998 (Object::pluginobj): New function.
3999 (Object::do_pluginobj): New function.
4000 (Object::set_target): New function.
4001 * options.cc: Include "plugin.h".
4002 (General_options::parse_plugin): New function.
4003 (General_options::General_options): Initialize plugins_ field.
4004 (General_options::add_plugin): New function.
4005 * options.h (Plugin_manager): Declare.
4006 (General_options): Add --plugin option.
4007 (General_options::has_plugins): New function.
4008 (General_options::plugins): New function.
4009 (General_options::add_plugin): New function.
4010 (General_options::plugins_): New field.
4011 * plugin.cc: New file.
4012 * plugin.h: New file.
4013 * readsyms.cc: Include "plugin.h".
4014 (Read_symbols::do_read_symbols): Check for archive before checking
4015 for ELF file. Call plugin hooks to claim files.
4016 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4017 from a real object file; force override when processing replacement
4019 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4020 (Symbol::init_base_object): Likewise.
4021 (Symbol::init_base_output_data): Likewise.
4022 (Symbol::init_base_output_segment): Likewise.
4023 (Symbol::init_base_constant): Likewise.
4024 (Symbol::init_base_undefined): Likewise.
4025 (Symbol::output_section): Assert that object is not a plugin.
4026 (Symbol_table::add_from_pluginobj): New function.
4027 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4029 (Symbol_table::sized_write_globals): Likewise.
4030 (Symbol_table::add_from_pluginobj): Instantiate template.
4031 * symtab.h (Sized_pluginobj): Declare.
4032 (Symbol::in_real_elf): New function.
4033 (Symbol::set_in_real_elf): New function.
4034 (Symbol::in_real_elf_): New field.
4035 (Symbol_table::add_from_pluginobj): New function.
4037 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4038 (LIBDL): New variable.
4040 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4041 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4042 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4043 (MOSTLYCLEANFILES): Likewise.
4044 * testsuite/Makefile.in: Regenerate.
4045 * testsuite/plugin_test.c: New file.
4046 * testsuite/plugin_test_1.sh: New file.
4047 * testsuite/plugin_test_2.sh: New file.
4049 2008-09-16 Ian Lance Taylor <iant@google.com>
4051 * target-reloc.h (relocate_section): Check whether a symbol is
4052 defined by the ABI before reporting an undefined symbol error.
4053 * target.h (Target::is_defined_by_abi): Make parameter const.
4054 (Target::do_is_defined_by_abi): Likewise.
4055 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4056 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4057 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4058 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4059 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4060 * testsuite/Makefile.in: Rebuild.
4062 * fileread.cc (make_view): Add casts to avoid warning.
4064 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4066 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4067 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4069 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4071 * options.h (General_options::output_is_executable): New.
4072 (General_options::output_is_pie): New.
4073 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4074 for shared libraries.
4075 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4077 2008-09-11 Chris Demetriou <cgd@google.com>
4079 * options.h (origin): New -z option.
4080 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4081 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4084 2008-09-05 Cary Coutant <ccoutant@google.com>
4086 * fileread.cc (File_read::make_view): Add check for attempt to map
4089 2008-09-05 Cary Coutant <ccoutant@google.com>
4091 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4092 explicit instantiations.
4094 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4097 * options.cc (General_options::finalize): Allow undefined symbols
4098 in shlibs if linking -shared.
4101 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4102 symbols as not needing a dynsym entry.
4104 2008-08-20 Craig Silverstein <csilvers@google.com>
4106 * fileread.cc (File_read::open): Do not lock the file unless it
4107 was successfully opened.
4109 2008-08-14 Cary Coutant <ccoutant@google.com>
4111 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4112 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4113 * testsuite/tls_test.cc (struct int128): 128-bit struct
4114 for testing TLS relocs with non-zero addend.
4115 (v12): New TLS variable.
4117 (t_last): Add check for v12.
4118 * testsuite/tls_test.h (t12): New function.
4119 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4121 2008-08-13 Ian Lance Taylor <iant@google.com>
4123 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4124 set tls_segment_ or relro_segment_.
4125 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4127 * output.h (Output_section::clear_is_relro): New function.
4128 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4129 sections specially even when output_data_ is empty.
4130 (Output_segment::maximum_alignment): When first section is relro,
4131 only force alignment for PT_LOAD segments.
4132 * script.cc (script_data_segment_align): New function.
4133 (script_data_segment_relro_end): New function.
4134 * script-c.h (script_data_segment_align): Declare.
4135 (script_data_segment_relro_end): Declare.
4136 * script-sections.h (class Script_sections): Declare
4137 data_segment_align and data_segment_relro_end. Add fields
4138 segment_align_index_ and saw_relro_end_.
4139 * script-sections.cc (class Sections_element): Add set_is_relro
4140 virtual function. Add new bool* parameter to place_orphan_here.
4141 Add get_output_section virtual function.
4142 (class Output_section_definition): Add set_is_relro. Add new
4143 bool* parameter to place_orphan_here. Add get_output_section.
4144 Add is_relro_ field.
4145 (Output_section_definition::Output_section_definition): Initialize
4146 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4147 and is_relro_ fields.
4148 (Output_section_definition::place_orphan_here): Add is_relro
4150 (Output_section_definition::set_section_addresses): Set relro for
4152 (Output_section_definition::alternate_constraint): Likewise.
4153 (class Orphan_output_section): Add new bool* parameter to
4154 place_orphan_here. Add get_output_section.
4155 (Orphan_output_section::place_orphan_here): Add is_relro
4157 (Script_sections::Script_sections): Initialize
4158 data_segment_align_index_ and saw_relro_end_.
4159 (Script_sections::data_segment_align): New function.
4160 (Script_sections::data_segment_relro_end): New function.
4161 (Script_sections::place_orphan): Set or clear is_relro.
4162 (Script_sections::set_section_addresses): Force alignment of first
4164 * yyscript.y (exp): Call script_data_segment_align and
4165 script_data_segment_relro_end.
4166 * testsuite/relro_script_test.t: New file.
4167 * testsuite/relro_test.cc (using_script): Declare.
4168 (t1, t2): Test using_script.
4169 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4170 (relro_script_test_SOURCES): Define.
4171 (relro_script_test_DEPENDENCIES): Define.
4172 (relro_script_test_LDFLAGS): Define.
4173 (relro_script_test_LDADD): Define.
4174 (relro_script_test.so): New target.
4175 * testsuite/Makefile.in: Rebuild.
4177 2008-08-06 Cary Coutant <ccoutant@google.com>
4179 * archive.cc (Archive::total_archives, Archive::total_members)
4180 (Archive::total_members_loaded): New variables.
4181 (Archive::setup): Add parameter. Add option to preread
4183 (Archive::read_armap): Add counter.
4184 (Archive::get_file_and_offset): New function.
4185 (Archive::get_elf_object_for_member): New function.
4186 (Archive::read_all_symbols): New function.
4187 (Archive::read_symbols): New function.
4188 (Archive::add_symbols): Add counters.
4189 (Archive::include_all_members): Use armap to find members if it's
4191 (Archive::include_member): Skip reading symbols if already read.
4192 Factored code into Archive::get_file_and_offset and
4193 Archive::get_elf_object_for_member. Changed call to
4194 Mapfile::report_include_archive_member.
4195 (Archive::print_stats): New function.
4196 * archive.h: Declare Object and Read_symbols_data classes.
4197 (Archive::Archive): Add initializers for new members.
4198 (Archive::setup): Add parameter.
4199 (Archive::print_stats): New function.
4200 (Archive::total_archives, Archive::total_members)
4201 (Archive::total_members_loaded): New variables.
4202 (Archive::get_file_and_offset): New function.
4203 (Archive::get_elf_object_for_member): New function.
4204 (Archive::read_all_symbols): New function.
4205 (Archive::read_symbols): New function.
4206 (Archive::Archive_member): New class.
4207 (Archive::members_): New member.
4208 (Archive::num_members_): New member.
4209 * main.cc: Include archive.h.
4210 (main): Call Archive::print_stats.
4211 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4212 archive parameter; member_name is now the fully-decorated name.
4213 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4214 * options.h: (General_options): Add --preread-archive-symbols option.
4215 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4218 2008-08-04 Ian Lance Taylor <iant@google.com>
4220 * symtab.h (Symbol::use_plt_offset): New function.
4221 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4222 * powerpc.cc (Relocate::relocate): Likewise.
4223 * sparc.cc (Relocate::relocate): Likewise.
4224 * x86_64.cc (Relocate::relocate): Likewise.
4225 * testsuite/weak_plt.sh: New test.
4226 * testsuite/weak_plt_main.cc: New test.
4227 * testsuite/weak_plt_shared.cc: New test.
4228 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4229 (check_PROGRAMS): Add weak_plt.
4230 (check_DATA): Add weak_plt_shared.so.
4231 (weak_plt_main_pic.o, weak_plt): New targets.
4232 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4233 * testsuite/Makefile.in: Rebuild.
4235 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4237 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4238 * testsuite/Makefile.in: Rebuild.
4240 2008-08-04 Alan Modra <amodra@bigpond.net.au>
4242 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4243 * Makefile.in: Regenerate.
4244 * po/POTFILES.in: Regenerate.
4246 2008-07-29 Ian Lance Taylor <iant@google.com>
4248 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4249 symbols before other symbols.
4250 * testsuite/script_test_2.cc (test_addr): Declare.
4251 (test_addr_alias): Declare.
4252 (main): Check that test_addr and test_addr_alias have the right
4254 * testsuite/script_test_2.t: Define test_addr_alias and
4257 2008-07-24 Ian Lance Taylor <iant@google.com>
4260 * descriptors.cc: New file.
4261 * descriptors.h: New file.
4262 * gold-threads.h (class Hold_optional_lock): New class.
4263 * fileread.cc: Include "descriptors.h".
4264 (File_read::~File_read): Release descriptor rather than closing
4266 (File_read::open) [file]: Call open_descriptor rather than open.
4267 Set is_descriptor_opened_.
4268 (File_read::open) [memory]: Assert that descriptor is not open.
4269 (File_read::reopen_descriptor): New function.
4270 (File_read::release): Release descriptor.
4271 (File_read::do_read): Make non-const. Reopen descriptor.
4272 (File_read::read): Make non-const.
4273 (File_read::make_view): Reopen descriptor.
4274 (File_read::do_readv): Likewise.
4275 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4276 Update declarations.
4277 * layout.cc: Include "descriptors.h".
4278 (Layout::create_build_id): Use open_descriptor rather than open.
4279 * output.cc: Include "descriptors.h".
4280 (Output_file::open): Use open_descriptor rather than open.
4281 * archive.cc (Archive::const_iterator): Change Archive to be
4283 (Archive::begin, Archive::end): Make non-const.
4284 (Archive::count_members): Likewise.
4285 * archive.h (class Archive): Update declarations.
4286 * object.h (Object::read): Make non-const.
4287 * Makefile.am (CCFILES): Add descriptors.cc.
4288 (HFILES): Add descriptors.h.
4289 * Makefile.in: Rebuild.
4292 * gold.h: Always include <clocale>. Add Solaris workarounds
4293 following code in binutils/sysdep.h.
4296 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4297 this->eh_frame_hdr_ is NULL before using it.
4299 * dynobj.cc (Versions::Versions): Update comment.
4301 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4302 the base version name.
4304 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4305 array size plus one.
4306 (Stringpool_template::set_string_offsets): Subtract one from key
4307 before using it as an array index.
4308 (Stringpool_template::get_offset_with_length): Likewise.
4309 (Stringpool_template::write_to_buffer): Likewise.
4310 * stringpool.h (Stringpool_template::get_offset_from_key):
4313 2008-07-23 Ian Lance Taylor <iant@google.com>
4316 * object.h (Merged_symbol_value::value): Do our best to handle a
4320 * script.cc (Version_script_info::get_versions): Don't add empty
4321 version tag to return value.
4322 (Version_script_info::get_symbol_version_helper): Change return
4323 type to bool. Add pversion parameter. Change all callers.
4324 (script_register_vers_node): Don't require a non-NULL tag.
4325 * script.h (class Version_script_info): Update declarations.
4326 (Version_script_info::get_symbol_version): Change return type to
4327 bool. Add version parameter. Change all callers.
4328 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4329 handling. Handle an empty version from a version script.
4330 (Symbol_table::define_special_symbol): Likewise.
4331 * testsuite/ver_test_10.script: New file.
4332 * testsuite/ver_test_10.sh: New file.
4333 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4334 (check_DATA): Add ver_test_10.syms.
4335 (ver_test_10.syms, ver_test_10.so): New target.
4336 * testsuite/Makefile.in: Rebuild.
4338 2008-07-23 Simon Baldwin <simonb@google.com>
4340 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4341 to zero for undefined symbols from dynamic libraries.
4343 2008-07-23 Ian Lance Taylor <iant@google.com>
4345 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4347 * symtab.h (class Symbol_table): Update declaration.
4348 * testsuite/ver_test_9.cc: New file.
4349 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4350 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4351 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4352 (ver_test_9.so, ver_test_9.o): New targets.
4353 * testsuite/Makefile.in: Rebuild.
4355 2008-07-22 Ian Lance Taylor <iant@google.com>
4357 * options.h (class General_options): Define --check-sections.
4358 * layout.cc (Layout::set_segment_offsets): Handle
4361 * options.h (class General_options): Define -n/--nmagic and
4363 * options.cc (General_options::finalize): For -n/--nmagic or
4364 -N/--omagic, set -static.
4365 * layout.cc (Layout::attach_allocated_section_to_segment): If
4366 -N/--omagic, don't put read-only and read-write sections in
4368 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4369 finding a read-only segment.
4370 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4371 don't set the minimum segment alignment to the common page size,
4372 and don't set the file offset to the address modulo the page size.
4373 * script-sections.cc (Script_sections::create_segments): If
4374 -n/--omagic, don't put read-only and read-write sections in
4377 * cref.cc: New file.
4379 * options.h (class General_options): Add --print-symbol-counts.
4380 * main.cc (main): Issue defined symbol report if requested.
4381 * archive.cc (Archive::interpret_header): Make into a const member
4383 (Archive::add_symbols): Call Input_objects::archive_start and
4385 (Archive::const_iterator): Define new class.
4386 (Archive::begin, Archive::end): New functions.
4387 (Archive::include_all_members): Rewrite to use iterator.
4388 (Archive::count_members): New function.
4389 * archive.h (class Archive): Update declarations.
4390 (Archive::filename): New function.
4391 * object.cc: Include "cref.h".
4392 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4393 (Sized_relobj::do_get_global_symbol_counts): New function.
4394 (Input_objects::add_object): Add object to cross-referencer.
4395 (Input_objects::archive_start): New function.
4396 (Input_objects::archive_stop): New function.
4397 (Input_objects::print_symbol_counts): New function.
4398 * object.h: Declare Cref and Archive.
4399 (Object::get_global_symbol_counts): New function.
4400 (Object::do_get_global_symbol_counts): New pure virtual function.
4401 (class Sized_relobj): Add defined_count_ field. Update
4403 (class Input_objects): Add cref_ field. Update constructor.
4404 Update declarations.
4405 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4407 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4409 (Sized_dynobj::do_get_global_symbol_counts): New function.
4410 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4411 defined_count_. Update declarations. Define Symbols typedef.
4412 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4413 parameter. Change all callers.
4414 (Symbol_table::add_from_dynobj): Add sympointers and defined
4415 parameters. Change all callers.
4416 * symtab.h (class Symbol_table): Update declarations.
4417 * Makefile.am (CCFILES): Add cref.cc.
4418 (HFILES): Add cref.h.
4419 * Makefile.in: Rebuild.
4421 2008-07-22 Simon Baldwin <simonb@google.com>
4423 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4424 to zero when writing undefined symbols.
4426 2008-07-22 Ian Lance Taylor <iant@google.com>
4428 * output.cc (Output_section::add_input_section): Don't try to
4429 merge empty merge sections.
4431 2008-07-21 Craig Silverstein <csilvers@google.com>
4433 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4434 Include symbol version in error message.
4436 2008-07-20 Chris Demetriou <cgd@google.com>
4438 * configure.ac (gold_cv_c_random_seed): New configured variable.
4439 (RANDOM_SEED_CFLAGS): New substituted variable.
4440 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4441 * configure: Rebuild.
4442 * Makefile.in: Likewise.
4443 * testsuite/Makefile.in: Likewise.
4445 2008-07-18 Ian Lance Taylor <iant@google.com>
4447 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4448 where we see NAME/NULL and NAME/VERSION as separate symbols.
4449 * testsuite/ver_test_main.cc (main): Call t4.
4450 (t4, t4_2a): Define.
4451 * testsuite/ver_test_2.cc (t4_2): Define.
4452 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4453 * testsuite/ver_test_4.cc (t4_2a): Define.
4454 * testsuite/ver_test_4.script: Put t4_2a in VER2.
4455 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4457 2008-07-17 Ian Lance Taylor <iant@google.com>
4459 * dynobj.cc (Versions::add_def): If we give an error about a
4460 missing version, go ahead and create the version anyhow.
4462 2008-07-10 Ian Lance Taylor <iant@google.com>
4464 Handle output sections with more than 0x7fffffff bytes.
4465 * object.h (class Relobj): Change map_to_output_ to
4466 output_sections_, and just keep a section pointer. Change all
4467 uses. Move comdat group support to Sized_relobj.
4468 (Relobj::is_section_specially_mapped): Remove.
4469 (Relobj::output_section): Remove poff parameter. Change all
4471 (Relobj::output_section_offset): New function.
4472 (Relobj::set_section_offset): Rewrite.
4473 (Relobj::map_to_output): Remove.
4474 (Relobj::output_sections): New function.
4475 (Relobj::do_output_section_offset): New pure virtual function.
4476 (Relobj::do_set_section_offset): Likewise.
4477 (class Sized_relobj): Add section_offsets_ field. Add comdat
4478 group support from Relobj. Update declarations.
4479 (Sized_relobj::get_output_section_offset): New function.
4480 (Sized_relobj::do_output_section_offset): New function.
4481 (Sized_relobj::do_set_section_offset): New function.
4482 * object.cc (Relobj::output_section_address): Remove.
4483 (Sized_relobj::Sized_relobj): Initialize new fields.
4484 (Sized_relobj::include_section_group): Cast find_kept_object to
4486 (Sized_relobj::include_linkonce_section): Likewise.
4487 (Sized_relobj::do_layout): Use separate arrays for output section
4489 (Sized_relobj::do_count_local_symbols): Change map_to_output to
4491 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4492 output_sections and section_offsets.
4493 (Sized_relobj::write_local_symbols): Likewise.
4494 (map_to_kept_section): Compute output address directly.
4495 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4496 output_sections and section_offsets.
4497 (Sized_relobj::write_sections): Likewise.
4498 (Sized_relobj::relocate_sections): Likewise.
4499 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4500 * output.h (class Output_reloc): Update declarations. Change
4501 u2_.relobj to Sized_relobj*.
4502 (class Output_data_reloc): Change add functions to use
4504 * output.cc (Output_reloc::Output_reloc): Change relobj to
4506 (Output_reloc::local_section_offset): Change return type to
4507 Elf_Addr. Use get_output_section_offset.
4508 (Output_reloc::get_address): Likewise.
4509 (Output_section::is_input_address_mapped): Don't call
4510 is_section_specially_mapped.
4511 (Output_section::output_offset): Likewise.
4512 (Output_section::output_address): Likewise.
4513 (Output_section::starting_output_address): Likewise.
4514 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4515 parameter to Sized_relobj*.
4516 (Copy_relocs::need_copy_reloc): Likewise.
4517 (Copy_relocs::save): Likewise.
4518 * copy-relocs.h (class Copy_relocs): Update declarations.
4519 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4520 Sized_relobj*. Change relobj_ field to Sized_relobj*.
4521 * target-reloc.h (relocate_for_relocatable): Change
4522 offset_in_output_section type to Elf_Addr. Change code that uses
4524 * layout.cc (Layout::layout): Always set *off.
4525 * mapfile.cc (Mapfile::print_input_section): Use
4526 output_section_offset.
4527 * i386.cc (Target_i386::copy_reloc): Change object parameter to
4529 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
4530 * sparc.cc (Target_sparc::copy_reloc): Likewise.
4531 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
4533 2008-07-03 Ian Lance Taylor <iant@google.com>
4535 * layout.cc (Layout::include_section): Do not discard unrecognized
4536 SHT_STRTAB sections.
4538 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
4540 * script.cc (Lex::can_continue_name): Make '?' allowable in
4541 version-script names.
4542 * testsuite/version_script.map: Change glob pattern to use '?'
4544 2008-06-30 Manish Singh <yosh@gimp.org>
4547 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
4550 2008-06-30 Ian Lance Taylor <iant@google.com>
4554 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
4555 versions]: Don't try to read the value in the contents, since we
4556 don't use it. Use the template endianness when writing.
4558 2008-06-25 Cary Coutant <ccoutant@google.com>
4560 * fileread.cc (File_read::make_view): Assert on zero-length view.
4561 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
4562 symbol table when there are no symbols to read.
4564 2008-06-23 Craig Silverstein <csilvers@google.com>
4566 * version.cc (version_string): Bump to 1.7
4568 2008-06-18 Craig Silverstein <csilvers@google.com>
4570 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4571 constant 0xFFFF to type Valtype.
4572 (Powerpc_relocate_functions::rel16_ha): Likewise.
4574 2008-06-17 Ian Lance Taylor <iant@google.com>
4576 * output.h (Output_section::Input_section): Initialize p2align_ to
4577 zero for Output_section_data constructors.
4578 (Output_section::Input_section::addralign): If not an input
4579 section, return the alignment of the Output_section_data.
4580 * testsuite/copy_test.cc: New file.
4581 * testsuite/copy_test_1.cc: New file.
4582 * testsuite/copy_test_2.cc: New file.
4583 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
4584 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
4585 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
4586 (copy_test_1_pic.o, copy_test_1.so): New targets.
4587 (copy_test_2_pic.o, copy_test_2.so): New targets.
4588 * testsuite/Makefile.in: Rebuild.
4590 * script-sections.cc (Script_sections::place_orphan): Initialize
4591 local variable exact.
4593 2008-06-13 David Edelsohn <edelsohn@gnu.org>
4595 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
4597 2008-06-12 David Edelsohn <edelsohn@gnu.org>
4598 David S. Miller <davem@davemloft.net>
4600 * powerpc.cc: New file.
4601 * Makefile.am (TARGETSOURCES): Add powerpc.cc
4602 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4603 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4604 * Makefile.in: Rebuild.
4606 2008-06-09 Ian Lance Taylor <iant@google.com>
4608 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4610 (throwing, orig_terminate): New static variables.
4611 (terminate_handler): New static function.
4612 (t2): Set terminate handler.
4614 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
4617 * binary.cc (Binary_to_elf::sized_convert): Fix .data
4620 2008-05-30 Cary Coutant <ccoutant@google.com>
4622 * archive.cc (Archive::include_all_members) Correct to step
4623 over symbol table and extended name table in thin archives.
4625 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
4628 * target-reloc.h (relocate_for_relocatable): Fix new_offset
4631 2008-05-28 Caleb Howe <cshowe@google.com>
4633 * reduced_debug_output.cc: New file.
4634 * reduced_debug_output.h: New file.
4635 * options.h (class General_options): Add --strip-debug-non-line.
4636 * options.cc (General_options::finalize): Add strip_debug_non_line
4637 to the strip heirarchy.
4638 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
4640 * layout.cc: Include "reduced_debug_output.h".
4641 (Layout::Layout): Initialize new fields.
4642 (line_only_debug_sections): New static array.
4643 (is_lines_only_debug_sections): New static inline function.
4644 (Layout::include_section): Handle --strip-debug-non-line.
4645 (Layout::make_output_section): If --strip-debug-non-line, build
4646 new output sections for .debug_abbrev and .debug_info.
4647 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
4648 gold. Warn about possible overflow.
4649 (read_signed_LEB_128): Likewise.
4650 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
4651 (read_signed_LEB_128): Declare.
4652 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
4653 (HFILES): Add reduced_debug_output.h.
4654 * Makefile.in: Rebuild.
4656 2008-05-21 Ian Lance Taylor <iant@google.com>
4658 * mapfile.cc: New file.
4659 * mapfile.h: New file.
4660 * options.h (class General_options): Add -M/--print-map and -Map.
4661 * options.cc (General_options::finalize): Make -M equivalent to
4663 * main.cc: Include <cstdio> and "mapfile.h".
4664 (main): Open mapfile if requested.
4665 * gold.cc (class Middle_runner): Add mapfile_ field. Update
4666 constructor. Change caller.
4667 (queue_initial_tasks): Add mapfile parameter. Change caller.
4668 (queue_middle_tasks): Likewise.
4669 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4671 * archive.cc: Include "mapfile.h".
4672 (Archive::add_symbols): Add mapfile parameter. Change all
4673 callers. Pass mapfile, symbol, and reason to include_member.
4674 (Archive::include_all_members): Add mapfile parameter. Change all
4676 (Archive::include_member): Add mapfile, sym, and why parameters.
4677 Change all callers. Report inclusion to map file.
4678 * archive.h: Include "fileread.h".
4679 (class Archive): Update declarations.
4680 (Archive::file): New const method.
4681 (class Add_archive_symbols): Add mapfile_ field. Update
4682 constructor. Change all callers.
4683 * readsyms.h (class Read_symbols): Likewise.
4684 (class Finish_group): Likewise.
4685 (class Read_script): Likewise.
4686 * common.cc: Include "mapfile.h".
4687 (Symbol_table::allocate_commons): Add mapfile parameter. Change
4689 (Symbol_table::do_allocate_commons): Likewise.
4690 (Symbol_table::do_allocate_commons_list): Likewise. Report common
4691 symbol allocation to mapfile.
4692 * common.h (class Allocate_commons_task): Add mapfile_ field.
4693 Update constructor. Change all callers.
4694 * symtab.h (class Symbol_table): Update declarations.
4695 * layout.cc: Include "mapfile.h".
4696 (Layout_task_runner::run): Print information to mapfile.
4697 (Layout::create_gold_note): Change Output_data_fixed_space to
4698 Output_data_zero_fill.
4699 (Layout::create_build_id): Likewise.
4700 (Layout::print_to_mapfile): New function.
4701 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
4702 constructor. Change caller.
4703 (class Layout): Declare print_to_mapfile.
4704 * output.cc (Output_section::Input_section::print_to_mapfile): New
4706 (Output_section::add_input_section): If producing a map, always
4707 add to input_sections_ list.
4708 (Output_section::do_print_to_mapfile): New function.
4709 (Output_segment::print_sections_to_mapfile): New function.
4710 (Output_segment::print_section_list_to_mapfile): New function.
4711 * output.h: Include "mapfile.h".
4712 (Output_data::print_to_mapfile): New function.
4713 (Output_data::do_print_to_mapfile): New virtual function.
4714 (Output_segment_headers::do_print_to_mapfile): New function.
4715 (Output_file_header::do_print_to_mapfile): New function.
4716 (Output_data_const::do_print_to_mapfile): New function.
4717 (class Output_data_const_buffer): Add map_name_ field. Update
4718 constructor. Change all callers. Add do_print_to_mapfile
4720 (class Output_data_fixed_space): Likewise.
4721 (class Output_data_space): Likewise.
4722 (class Output_data_zero_fill): New class.
4723 (Output_data_strtab::do_print_to_mapfile): New function.
4724 (Output_data_reloc_base::do_print_to_mapfile): New function.
4725 (Output_relocatable_relocs::do_print_to_mapfile): New function.
4726 (Output_data_group::do_print_to_mapfile): New function.
4727 (Output_data_got::do_print_to_mapfile): New function.
4728 (Output_data_dynamic::do_print_to_mapfile): New function.
4729 (Output_symtab_xindex::do_print_to_mapfile): New function.
4730 (class Output_section): Declare do_print_to_mapflie. Declare
4731 print_to_mapfile in Input_section.
4732 (class Output_segment): Declare new functions.
4733 * object.h (Sized_relobj::symbol_count): New function.
4734 * script-sections.cc
4735 (Output_section_element_dot_assignment::set_section_addresses):
4736 Change Output_data_fixed_space to Output_data_zero_fill.
4737 (Output_data_expression::do_print_to_mapfile): New function.
4738 * script.cc (read_input_script): Add mapfile parameter. Change
4740 * script.h (read_input_script): Update declaration.
4741 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4742 (Eh_frame::do_print_to_mapfile): New function.
4743 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4744 (Output_merge_string::do_print_to_mapfile): New function.
4745 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4747 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4749 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4751 * Makefile.am (CCFILES): Add mapfile.cc.
4752 (HFILES): Add mapfile.h.
4753 * Makefile.in: Rebuild.
4755 2008-05-19 Ian Lance Taylor <iant@google.com>
4757 * options.h (class General_options): Add -z relro.
4758 * layout.cc (Layout::Layout): Initialize relro_segment_.
4759 (Layout::add_output_section_data): Return the output section.
4760 (Layout::make_output_section): Rcognize relro sections and mark
4762 (Layout::attach_allocated_section_to_segment): Put relro sections
4763 in a PT_GNU_RELRO segment.
4764 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4766 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4768 (Layout::linkonce_mapping): Map d.rel.ro.local to
4770 (Layout::output_section_name): Us .data.rel.ro.local for any
4771 section which begins with that.
4772 * layout.h (class Layout): Update add_output_section_data
4773 declaration. Add relro_segment_ field.
4774 * output.cc (Output_section::Output_section): Initialize is_relro_
4775 and is_relro_local_ fields.
4776 (Output_segment::add_output_section): Group relro sections.
4777 (Output_segment::is_first_section_relro): New function.
4778 (Output_segment::maximum_alignment): If there is a relro section,
4779 align the segment to the common page size.
4780 (Output_segment::set_section_addresses): Track whether we are
4781 looking at relro sections. If the last section is a relro
4782 section, align to the common page size.
4783 (Output_segment::set_section_list_addresses): Add in_relro
4784 parameter. Change all callers. Align to the page size when
4785 moving from relro to non-relro section.
4786 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4788 * output.h (class Output_section): Add is_relro_ and
4789 is_relro_local_ fields.
4790 (Output_section::is_relro): New function.
4791 (Output_section::set_is_relro): New function.
4792 (Output_section::is_relro_local): New function.
4793 (Output_section::set_is_relro_local): New function.
4794 (class Output_segment): Update declarations.
4795 * i386.cc (Target_i386::got_section): Mark .got section as relro.
4796 * sparc.cc (Target_sparc::got_section): Likewise.
4797 * x86_64.cc (Target_x86_64::got_section): Likewise.
4798 * testsuite/relro_test_main.cc: New file.
4799 * testsuite/relro_test.cc: New file.
4800 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
4801 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
4802 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
4803 (relro_test.so, relro_test_pic.o): New targets.
4804 * testsuite/Makefile.in: Rebuild.
4806 2008-05-16 Ian Lance Taylor <iant@google.com>
4808 * output.cc (Output_segment::add_output_section): Remove front
4810 * output.h (class Output_segment): Remove
4811 add_initial_output_section and overloaded add_output_section.
4812 Update declaration of remaining add_output_section.
4813 * layout.cc (Layout::create_interp): Call add_output_section
4814 rather than add_initial_output_section.
4815 (Layout::finish_dynamic_section): Likewise.
4817 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
4818 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
4819 know the dynamic type.
4820 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
4821 field. Initialize it in constructor.
4822 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
4823 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
4824 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
4827 * output.cc (Output_reloc::get_address): Change return type to
4829 * output.h (class Output_reloc): Update get_address declaration.
4830 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
4831 for section addresses.
4833 2008-05-09 Ian Lance Taylor <iant@google.com>
4836 * gold.cc (gold_nomem): Use return value of write.
4838 2008-05-08 Ian Lance Taylor <iant@google.com>
4840 * symtab.c (Symbol::init_base_output_data): Add version
4841 parameter. Change all callers.
4842 (Symbol::init_base_output_segment): Likewise.
4843 (Symbol::init_base_constant): Likewise.
4844 (Symbol::init_base_undefined): Likewise.
4845 (Sized_symbol::init_output_data): Likewise.
4846 (Sized_symbol::init_output_segment): Likewise.
4847 (Sized_symbol::init_constant): Likewise.
4848 (Sized_symbol::init_undefined): Likewise.
4849 (Symbol_table::do_define_in_output_data): If the new symbol has a
4850 version, mark it as the default.
4851 (Symbol_table::do_define_in_output_segment): Likewise.
4852 (Symbol_table::do_define_as_constant): Likewise.
4853 * symtab.h (class Symbol): Update declarations.
4854 (class Sized_symbol): Likewise.
4855 * resolve.cc (Symbol::override_version): New function.
4856 (Symbol::override_base): Call override_version.
4857 (Symbol::override_base_with_special): Likewise.
4858 * testsuite/ver_script_8.script: New file.
4859 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
4860 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
4861 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
4862 (ver_test_8_1.so, ver_test_8_2.so): New targets.
4864 2008-05-06 Ian Lance Taylor <iant@google.com>
4867 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
4869 (class General_options): Remove existing --undefined, and add
4870 --no-undefined instead. Add new --undefined as synonym for -u.
4871 * archive.cc (Archive::add_symbols): Check whether symbol was
4873 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
4874 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
4875 all uses. Add IS_UNDEFINED. Update declarations to split
4876 different versions of init_base. Declare init_base_undefined.
4877 (Symbol::is_defined): Handle IS_UNDEFINED.
4878 (Symbol::is_undefined): Likewise.
4879 (Symbol::is_weak_undefined): Call is_undefined.
4880 (Symbol::is_absolute): Handle IS_CONSTANT.
4881 (class Sized_symbol): Update declarations to split different
4882 versions of init. Declare init_undefined.
4883 (class Symbol_table): Declare new functions.
4884 * symtab.cc (Symbol::init_base_object): Rename from init_base.
4886 (Symbol::init_base_output_data): Likewise.
4887 (Symbol::init_base_output_segment): Likewise.
4888 (Symbol::init_base_constant): Likewise.
4889 (Symbol::init_base_undefined): New function.
4890 (Sized_symbol::init_object): Rename from init. Change all
4892 (Sized_symbol::init_output_data): Likewise.
4893 (Sized_symbol::init_output_segment): Likewise.
4894 (Sized_symbol::init_constant): Likewise.
4895 (Sized_symbol::init_undefined): New function.
4896 (Symbol_table::add_undefined_symbols_from_command_line): New
4898 (Symbol_table::do_add_undefined_symbols_from_command_line): New
4900 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
4901 (Symbol::output_section): Likewise.
4902 (Symbol::set_output_section): Likewise.
4903 (Symbol_table::sized_finalize_symbol): Likewise.
4904 (Symbol_table::sized_write_globals): Likewise.
4905 * resolve.cc (Symbol_table::should_override): Likewise.
4906 (Symbol::override_base_with_special): Likewise.
4908 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
4909 symbol, change it to have default visibility.
4910 * testsuite/protected_1.cc: New file.
4911 * testsuite/protected_2.cc: New file.
4912 * testsuite/protected_3.cc: New file.
4913 * testsuite/protected_main_1.cc: New file.
4914 * testsuite/protected_main_2.cc: New file.
4915 * testsuite/protected_main_3.cc: New file.
4916 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
4917 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
4918 (protected_1_LDFLAGS, protected_1_LDADD): Define.
4919 (protected_1.so): New target.
4920 (protected_1_pic.o, protected_2_pic.o): New targets.
4921 (protected_3_pic.o): New target.
4922 (check_PROGRAMS): Add protected_2.
4923 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
4924 (protected_2_LDFLAGS, protected_2_LDADD): Define.
4925 * testsuite/Makefile.in: Rebuild.
4927 * options.h (DEFINE_var): Add set_user_set_##varname__.
4928 (DEFINE_bool_alias): New macro.
4929 (class General_options): Define -Bstatic using DEFINE_bool_alias
4930 rather than DEFINE_special. Add --undefined as an alias for -z
4932 * options.cc (General_options::parse_Bstatic): Remove.
4934 * options.h (class General_options): Add --fatal-warnings.
4935 * main.cc (main): Implement --fatal-warnings.
4936 * errors.h (Errors::warning_count): New function.
4938 * options.h (class General_options): Add -Bsymbolic-functions.
4939 * symtab.h (Symbol::is_preemptible): Check for
4940 -Bsymbolic-functions.
4942 2008-05-05 Ian Lance Taylor <iant@google.com>
4944 * options.h (DEFINE_bool): For DASH_Z, create the negative option
4945 as noVARNAME rather than no-VARNAME.
4946 (class General_options): Add option -z combreloc.
4947 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
4949 (Output_reloc::sort_before) [SHT_REL]: New function.
4950 (Output_reloc::sort_before) [SHT_RELA]: New function.
4951 (class Output_data_reloc_base): Add sort_relocs_ field. Define
4952 Sort_relocs_comparison.
4953 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
4954 parameter. Change all callers.
4955 (Output_data_reloc::Output_data_reloc) [both versions]: Add
4956 sort_relocs parameter. Change all callers.
4957 * output.cc (Output_reloc::get_address): New function, broken out
4959 (Output_reloc::write_rel): Call it.
4960 (Output_reloc::compare): New function.
4961 (Output_data_reloc_base::do_write): Optionally sort relocs.
4963 * configure.ac: If targ_extra_obj is set, link it in.
4964 * configure.tgt: Initialize all variables.
4965 (x86_64*): Set targ_extra_obj and targ_extra_size.
4966 * configure: Rebuild.
4968 * object.cc (Sized_relobj::include_section_group): Adjust section
4969 indexes read from group data. Build vector to pass to
4971 * layout.cc (Layout::layout_group): Add flags and shndxes
4972 parameters. Remove contents parameter. Change caller. Update
4973 explicit instantiations.
4974 * layout.h (class Layout): Update layout_group declaration.
4975 * output.cc (Output_data_group::Output_data_group): Add flags and
4976 input_shndxes parameters. Remove contents parameter. Change
4978 (Output_data_group::do_write): Change input_sections_ to
4980 * output.h (class Output_data_group): Update constructor
4981 declaration. Rename input_sections_ to input_shndxes_.
4982 * testsuite/many_sections_test.cc: Add template.
4984 2008-04-30 Cary Coutant <ccoutant@google.com>
4986 * target-reloc.h (relocate_section): Fix dead-pointer bug.
4988 * layout.cc (Layout::include_section): Refactored check for debug
4990 (Layout::add_comdat): Add new parameters. Change type
4991 of signature parameter. Add object and shndx to signatures table.
4992 (Layout::find_kept_object): New function.
4993 * layout.h: Include <cstring>.
4994 (Layout::is_debug_info_section): New function.
4995 (Layout::add_comdat): Add new parameters.
4996 (Layout::find_kept_object): New function.
4997 (Layout::Kept_section): New struct.
4998 (Layout::Signatures): Change type of map range.
4999 * object.cc (Relobj::output_section_address): New function.
5000 (Sized_relobj::include_section_group): Add new parameters. Change
5001 calls to Layout::add_comdat. Change to build table of kept comdat
5002 groups and table mapping discarded sections to kept sections.
5003 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
5004 (Sized_relobj::do_layout): Change calls to include_section_group and
5005 include_linkonce_section.
5006 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5007 value to zero when section is discarded.
5008 (Sized_relobj::map_to_kept_section): New function.
5009 * object.h (Relobj::output_section_address): New function.
5010 (Relobj::Comdat_group): New type.
5011 (Relobj::find_comdat_group): New function.
5012 (Relobj::Comdat_group_table): New type.
5013 (Relobj::Kept_comdat_section): New type.
5014 (Relobj::Kept_comdat_section_table): New type.
5015 (Relobj::add_comdat_group): New function.
5016 (Relobj::set_kept_comdat_section): New function.
5017 (Relobj::get_kept_comdat_section): New function.
5018 (Relobj::comdat_groups_): New field.
5019 (Relobj::kept_comdat_sections_): New field.
5020 (Symbol_value::input_value): Update comment.
5021 (Sized_relobj::map_to_kept_section) New function.
5022 (Sized_relobj::include_linkonce_section): Add new parameter.
5023 * target-reloc.h (Comdat_behavior): New type.
5024 (get_comdat_behavior): New function.
5025 (relocate_section): Add code to map a discarded section to the
5026 corresponding kept section when applying a relocation.
5028 2008-04-30 Craig Silverstein <csilvers@google.com>
5030 * dwarf_reader.cc (next_generation_count): New static var.
5031 (Addr2line_cache_entry): New struct.
5032 (addr2line_cache): New static var.
5033 (Dwarf_line_info::one_addr2line): Added caching.
5034 (Dwarf_line_info::clear_addr2line_cache): New function.
5035 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5036 cache-size parameter.
5037 (Dwarf_line_info::one_addr2line_cache): New function.
5038 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5039 new cache-size argument to one_addr2line(), and clear cache.
5041 2008-04-28 Cary Coutant <ccoutant@google.com>
5043 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5044 R_386_PC8 relocations.
5046 2008-04-23 Ian Lance Taylor <iant@google.com>
5048 * object.cc (Sized_relobj::include_section_group): Check for
5049 invalid section group.
5051 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5054 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5055 than read for file header.
5056 * archive.cc (Archive::include_member): Likewise.
5058 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
5060 * aclocal.m4: Regenerate.
5061 * configure: Regenerate.
5063 2008-04-19 Ian Lance Taylor <iant@google.com>
5065 * version.cc (version_string): Bump to 1.6.
5067 * testsuite/Makefile.am (many_sections_r_test): New target.
5068 (many_sections_r_test_SOURCES): Remove.
5069 (many_sections_r_test_DEPENDENCIES): Remove.
5070 (many_sections_r_test_LDFLAGS): Remove.
5071 (many_sections_r_test_LDADD): Remove.
5073 * object.cc (Sized_relobj::do_add_symbols): Always pass
5074 local_symbol_count_ to add_from_relobj.
5076 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5077 every thousand variables.
5078 * testsuite/Makefile.in: Rebuild.
5080 * object.cc (Xindex::initialize_symtab_xindex): New function.
5081 (Xindex::read_symtab_xindex): New function.
5082 (Xindex::sym_xindex_to_shndx): New function.
5083 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5085 (Sized_relobj::do_initialize_xindex): New function.
5086 (Sized_relobj::do_read_symbols): Adjust section links.
5087 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5088 parameter. Change all callers.
5089 (Sized_relobj::include_section_group): Adjust section links and
5090 symbol section indexes.
5091 (Sized_relobj::do_layout): Adjust section links.
5092 (Sized_relobj::do_count_local_symbols): Adjust section links and
5093 symbol section indexes.
5094 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5095 ordinary and special symbols.
5096 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5097 dynsym_xindex parameters. Change all callers. Adjust section
5098 links. Use SHN_XINDEX when needed.
5099 (Sized_relobj::get_symbol_location_info): Adjust section links.
5100 Don't get fooled by special symbols.
5101 * object.h (class Xindex): Define.
5102 (class Object): Add xindex_ parameter. Declare virtual functoin
5103 do_initialize_xindex.
5104 (Object::adjust_sym_shndx): New function.
5105 (Object::set_xindex): New protected function.
5106 (class Symbol_value): Add is_ordinary_shndx_ field.
5107 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5108 (Symbol_value::value): Assert ordinary section.
5109 (Symbol_value::initialize_input_to_output_map): Likewise.
5110 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5112 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5114 (class Sized_relobj): Update declarations.
5115 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5116 parameter. Change all callers.
5117 (Sized_relobj::adjust_shndx): New function.
5118 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5120 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5121 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5122 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5123 (Sized_dynobj::read_dynsym_section): Adjust section links.
5124 (Sized_dynobj::read_dynamic): Likewise.
5125 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5127 (Sized_dynobj::do_initialize_xindex): New function.
5128 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5129 do_initialize_xindex.
5130 (Sized_dynobj::adjust_shndx): New function.
5131 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5132 dynsym_xindex_ fields.
5133 (Layout::finalize): Add a call to set_section_indexes before
5134 creating the symtab sections.
5135 (Layout::set_section_indexes): Don't do anything if the section
5136 already has a section index.
5137 (Layout::create_symtab_sections): Add shnum parameter. Change
5138 caller. Create .symtab_shndx section if needed.
5139 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5141 (Layout::allocated_output_section_count): New function.
5142 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5144 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5145 fields. Update declarations.
5146 (Layout::symtab_xindex): New function.
5147 (Layout::dynsym_xindex): New function.
5148 (class Write_symbols_task): Add layout_ field.
5149 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5151 * output.cc (Output_section_headers::Output_section_headers): Add
5152 shstrtab_section parameter. Change all callers.
5153 (Output_section_headers::do_sized_write): Store overflow values
5154 for section count and section string table section index in
5155 section header zero.
5156 (Output_file_header::do_sized_write): Check for overflow of
5157 section count and section string table section index.
5158 (Output_symtab_xindex::do_write): New function.
5159 (Output_symtab_xindex::endian_do_write): New function.
5160 * output.h (class Output_section_headers): Add shstrtab_section_.
5161 Update declarations.
5162 (class Output_symtab_xindex): Define.
5163 (Output_section::has_out_shndx): New function.
5164 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5166 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5168 (Sized_symbol::init): Likewise.
5169 (Symbol::output_section): Check for ordinary symbol.
5170 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5171 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5173 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5174 Change all callers. Simplify handling of symbols from sections
5175 not included in the link.
5176 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5178 (Weak_alias_sorter::operator()): Assert that symbols are
5180 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5182 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5183 parameters. Change all callers.
5184 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5185 symbol distinction. Use SHN_XINDEX when needed.
5186 (Symbol_table::write_section_symbol): Add symtab_xindex
5187 parameter. Change all callers.
5188 (Symbol_table::sized_write_section_symbol): Likewise. Use
5189 SHN_XINDEX when needed.
5190 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5192 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5193 (Symbol::is_defined): Check is_ordinary.
5194 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5195 (Symbol::is_absolute, Symbol::is_common): Likewise.
5196 (class Sized_symbol): Update declarations.
5197 (class Symbol_table): Update declarations.
5198 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5199 parameters. Change all callers.
5200 (Sized_symbol::override): Likewise.
5201 (Symbol_table::override): Likewise.
5202 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5203 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5204 is_ordinary, and orig_st_shndx parameters. Change all callers.
5205 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5206 to be in an ordinary section.
5207 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5208 object and is_ordinary parameters. Change all callers.
5209 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5210 Change all callers. Don't add undefined or non-ordinary symbols
5212 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5214 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5216 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5217 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5218 (Sized_relobj::relocate_sections): Likewise.
5219 * target-reloc.h (scan_relocs): Adjust section symbol index.
5220 (scan_relocatable_relocs): Likewise.
5221 * i386.cc (Scan::local): Check for ordinary symbols.
5222 * sparc.cc (Scan::local): Likewise.
5223 * x86_64.cc (Scan::local): Likewise.
5224 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5225 to symbol_section_and_value.
5226 * testsuite/many_sections_test.cc: New file.
5227 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5228 (check_PROGRAMS): Add many_sections_test.
5229 (many_sections_test_SOURCES): Define.
5230 (many_sections_test_DEPENDENCIES): Define.
5231 (many_sections_test_LDFLAGS): Define.
5232 (BUILT_SOURCES): Add many_sections_define.h.
5233 (many_sections_define.h): New target.
5234 (BUILT_SOURCES): Add many_sections_check.h.
5235 (many_sections_check.h): New target.
5236 (check_PROGRAMS): Add many_sections_r_test.
5237 (many_sections_r_test_SOURCES): Define.
5238 (many_sections_r_test_DEPENDENCIES): Define.
5239 (many_sections_r_test_LDFLAGS): Define.
5240 (many_sections_r_test_LDADD): Define.
5241 (many_sections_r_test.o): New target.
5242 * testsuite/Makefile.in: Rebuild.
5244 2008-04-17 Cary Coutant <ccoutant@google.com>
5246 * errors.cc (Errors::info): New function.
5247 (gold_info): New function.
5248 * errors.h (Errors::info): New function.
5249 * gold.h (gold_info): New function.
5250 * object.cc (Input_objects::add_object): Print trace output.
5251 * options.cc (options::parse_set): New function.
5252 (General_options::parse_wrap): Deleted.
5253 (General_options::General_options): Deleted initializer.
5254 * options.h (options::String_set): New typedef.
5255 (options::parse_set): New function.
5256 (DEFINE_set): New macro.
5257 (General_options::wrap): Changed to use DEFINE_set. Changed
5258 callers of any_wrap_symbols and is_wrap_symbol.
5259 (General_options::trace, General_options::trace_symbol):
5261 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5262 (General_options::wrap_symbols_): Deleted.
5263 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5265 2008-04-17 David S. Miller <davem@davemloft.net>
5267 * options.cc (General_options::parse_V): New function.
5268 * options.h: Add entries for -V and -Qy.
5270 2008-04-17 Ian Lance Taylor <iant@google.com>
5272 * common.cc (Symbol_table::allocate_commons): Remove options
5273 parameter. Change caller.
5274 (Symbol_table::do_allocate_commons): Remove options parameter.
5275 Change caller. Just call do_allocate_commons_list twice.
5276 (Symbol_table::do_allocate_commons_list): New function, broken out
5277 of do_allocate_commons.
5278 * common.h (class Allocate_commons_task): Remove options_ field.
5280 * symtab.cc (Symbol_table::Symbol_table): Initialize
5282 (Symbol_table::add_from_object): Put TLS common symbols on
5284 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5285 which are IN_OUTPUT_DATA.
5286 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5287 allocate_commons and do_allocate_commons declarations. Declare
5288 do_allocate_commons_list.
5289 * gold.cc (queue_middle_tasks): Update creation of
5290 Allocate_commons_task to not pass options.
5291 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5292 (TLS_TEST_C_FLAGS): New variable.
5293 (tls_test_c_pic.o): New target.
5294 (tls_test_shared.so): Link in tls_test_c_pic.o.
5295 (tls_test_c_pic_ie.o): New target.
5296 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5297 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5298 (tls_test_c.o): New target.
5299 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5300 (tls_pic_test_LDADD): Likewise.
5301 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5302 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5303 (tls_test_c_gnu2.o): New target.
5304 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5306 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5307 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5308 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5309 * testsuite/tls_test.cc: Include "config.h".
5310 (t_last): Call t11_last.
5311 * testsuite/tls_test.h (t11, t11_last): Declare.
5312 * testsuite/tls_test_c.c: New file.
5313 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5314 * configure.ac: Check for OpenMP support.
5315 * configure, config.in, Makefile.in: Rebuild.
5316 * testsuite/Makefile.in: Rebuild.
5318 2008-04-16 Cary Coutant <ccoutant@google.com>
5320 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5321 (Target_i386::tls_base_symbol_defined_): New field.
5322 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5323 (Target_i386::Scan::global): Likewise.
5324 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5325 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5326 (Target_x86_64::tls_base_symbol_defined_): New field.
5327 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5328 (Target_x86_64::Scan::global): Likewise.
5330 2008-04-16 Cary Coutant <ccoutant@google.com>
5332 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5333 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5334 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5335 building shared libraries.
5336 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5337 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5338 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5339 * testsuite/Makefile.in: Rebuild.
5340 * testsuite/weak_undef.h: New file.
5341 * testsuite/weak_undef_file1.cc: Add extra test cases.
5342 * testsuite/weak_undef_file2.cc: Likewise.
5343 * testsuite/weak_undef_test.cc: Likewise.
5345 2008-04-16 David S. Miller <davem@davemloft.net>
5347 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5348 Add issued_non_pic_error_ field. Declare check_non_pic.
5349 (Target_sparc::Scan::check_non_pic): New function.
5350 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5351 (Target_sparc::Scan::global): Likewise.
5353 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5354 * configure: Rebuild.
5356 * options.h (DEFINE_enable): New macro.
5357 (new_dtags): New enable option.
5358 (initfirst, interpose, loadfltr, nodefaultlib,
5359 nodelete, nodlopen, nodump): New -z options.
5360 * layout.cc (Layout:finish_dynamic_section): If new
5361 dtags enabled, emit DT_RUNPATH. Also, emit a
5362 DT_FLAGS_1 containing any specified -z flags.
5364 2008-04-16 Ian Lance Taylor <iant@google.com>
5366 * copy-relocs.cc: New file.
5367 * copy-relocs.h: New file.
5368 * reloc.cc: Remove Copy_relocs code.
5369 * reloc.h: Likewise.
5370 * reloc-types.h (struct Reloc_types) [both versions]: Add
5371 get_reloc_addend_noerror.
5372 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5373 variants of add_global which take an addend which must be zero.
5374 * i386.cc: Include "copy-relocs.h".
5375 (class Target_i386): Change type of copy_relocs_ to variable,
5377 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5379 (Target_i386::do_finalize_sections): Change handling of
5381 * sparc.cc: Include "copy-relocs.h".
5382 (class Target_sparc): Change type of copy_relocs_ to variable,
5384 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5386 (Target_sparc::do_finalize_sections): Change handling of
5388 * x86_64.cc: Include "copy-relocs.h".
5389 (class Target_x86_64): Change type of copy_relocs_ to variable,
5391 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5392 class. Change all callers.
5393 (Target_x86_64::do_finalize_sections): Change handling of
5395 * Makefile.am (CCFILES): Add copy-relocs.cc.
5396 (HFILES): Add copy-relocs.h.
5398 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5400 * testsuite/script_test_4.sh: Permit leading zeroes.
5402 2008-04-15 Ian Lance Taylor <iant@google.com>
5404 * script-sections.cc (Script_sections::create_segments): Use
5405 header_size_adjustment even when there is enough room for the
5407 * testsuite/script_test_4.sh: New file.
5408 * testsuite/script_test_4.t: New file.
5409 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5410 (check_DATA): Add script_test_4.stdout.
5411 (MOSTLYCLEANFILES): Likewise.
5412 (script_test_4): New target.
5413 (script_test_4.stdout): New target.
5414 * testsuite/Makefile.in: Rebuild.
5416 * sparc.cc: Add definitions for Output_data_plt_sparc class
5419 2008-04-14 David S. Miller <davem@davemloft.net>
5421 * sparc.cc: New file.
5422 * Makefile.am (TARGETSOURCES): Add sparc.cc
5423 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5424 * configure.tgt: Document targ_extra_size and
5425 targ_extra_big_endian. Add entries for sparc-* and
5427 * configure.ac: Handle targ_extra_size and
5428 targ_extra_big_endian.
5429 * Makefile.in: Rebuild.
5430 * configure: Likewise.
5431 * po/POTFILES.in: Likewise.
5432 * po/gold.pot: Likewise.
5434 2008-04-14 Ian Lance Taylor <iant@google.com>
5436 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5437 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5438 in the name/type/flags to section mapping. Don't call
5439 allocate_output_section.
5440 (Layout::choose_output_section): Change parameter from adjust_name
5441 to is_input_section. Don't permit input sections after sections
5442 are attached to segments. Don't call allocate_output_section.
5443 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5444 not write_enable_output_section.
5445 (Layout::make_output_section): Don't push to
5446 unattached_section_list_ nor call attach_to_segment. Call
5447 attach_section_to_segment if sections are attached.
5448 (Layout::attach_sections_to_segments): New function.
5449 (Layout::attach_section_to_segment): New function.
5450 (Layout::attach_allocated_section_to_segment): Rename from
5451 attach_to_segment. Remove flags parameter.
5452 (Layout::allocate_output_section): Remove function.
5453 (Layout::write_enable_output_section): Remove function.
5454 * layout.h (class Layout): Update for above changes. Add new
5455 field sections_are_attached_.
5456 * output.h (Output_section::update_flags_for_input_section): New
5458 * output.cc (Output_section::add_input_section): Call
5459 update_flags_for_input_section.
5460 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5462 2008-04-11 Cary Coutant <ccoutant@google.com>
5464 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5465 thought unnecessary.
5466 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5468 2008-04-11 Ian Lance Taylor <iant@google.com>
5470 * output.h (class Output_section_data): Remove inline definition
5472 * output.cc (Output_section_data::set_addralign): New function.
5474 2008-04-11 Cary Coutant <ccoutant@google.com>
5476 Add support for TLS descriptors for i386 and x86_64.
5477 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5478 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5479 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5481 (Target_i386::got_mod_index_entry): Remove unnecessary code.
5482 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5483 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
5485 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5486 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5487 Fix problem with initial-exec relocations.
5488 (Target_i386::Relocate::relocate_tls): Likewise.
5489 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5491 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5492 support for section-plus-offset dynamic table entries.
5493 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5494 (Output_data_dynamic::Dynamic_entry): Add support for
5495 section-plus-offset dynamic table entries.
5496 (Output_data_dynamic::Classification): Likewise.
5497 (Output_data_dynamic::classification_): Renamed offset_.
5498 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5499 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5500 (Target_x86_64::make_plt_section): New function.
5501 (Target_x86_64::reserve_tlsdesc_entries): New function.
5502 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5503 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5504 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5505 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5506 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5507 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5508 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5509 add extra PLT entry for TLS descriptors.
5510 (Output_data_plt_x86_64::got_): New field.
5511 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5512 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5514 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5516 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5517 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5518 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5519 R_386_TLS_DESC_CALL relocations.
5520 (Target_x86_64::Scan::global): Likewise.
5521 (Target_x86_64::do_finalize_sections): Add dynamic table entries
5522 for TLS descriptors.
5523 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
5524 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
5525 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
5526 GD-to-IE relaxation.
5527 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
5528 and TLS_DESCRIPTORS.
5529 * Makefile.in: Rebuild.
5530 * configure: Rebuild.
5531 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
5532 (tls_test_shared2.so): New target.
5533 (tls_shared_gd_to_ie_test_SOURCES): New variable.
5534 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
5535 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
5536 (tls_shared_gd_to_ie_test_LDADD): New variable.
5537 (tls_shared_gnu2_gd_to_ie_test): New target.
5538 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
5540 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
5541 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
5542 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
5543 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
5544 (tls_shared_gnu2_test): New target.
5545 (tls_test_gnu2_shared.so): New target.
5546 (tls_shared_gnu2_test_SOURCES): New variable.
5547 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
5548 (tls_shared_gnu2_test_LDFLAGS): New variable.
5549 (tls_shared_gnu2_test_LDADD): New variable.
5550 * testsuite/Makefile.in: Rebuild.
5551 * testsuite/Makefile.
5553 2008-04-11 Ian Lance Taylor <iant@google.com>
5555 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
5557 * testsuite/Makefile.in: Rebuild.
5559 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
5561 * testsuite/script_test_2.cc (main): Adjust test.
5563 2008-04-11 David S. Miller <davem@davemloft.net>
5564 Ian Lance Taylor <iant@google.com>
5566 * options.h (General_options): Add entries for '-Y' and
5568 * options.cc (General_options:finalize): If -Y was used, add those
5569 entries to the library path instead of the default "/lib" and
5572 2008-04-11 David S. Miller <davem@davemloft.net>
5574 * testsuite/justsyms.t: Start at 0x100.
5575 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
5576 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
5578 * testsuite/script_test_2.cc: Adjust string and section length
5581 2008-04-09 Ian Lance Taylor <iant@google.com>
5584 * script-sections.cc (Sections_element::allocate_to_segment): Add
5586 (Output_section_definition::allocate_to_segment): Likewise.
5587 (Orphan_output_section::allocate_to_segment): Likewise.
5588 (Script_sections::attach_sections_using_phdrs_clause): Don't
5589 propagate non-PT_LOAD segments to orphan sections.
5590 * testsuite/Makefile.am (script_test_3.stdout): Generate using
5591 readelf rather than objdump.
5592 * testsuite/script_test_3.sh: Adjust accordingly. Test that
5593 .interp section and PT_INTERP segment are the same size.
5594 * testsuite/Makefile.in: Rebuild.
5596 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
5597 aliases for symbols defined in the same object.
5598 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5599 (weak_alias_test_SOURCES): New variable.
5600 (weak_alias_test_DEPENDENCIES): New variable.
5601 (weak_alias_test_LDFLAGS): New variable.
5602 (weak_alias_test_LDADD): New variable.
5603 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5604 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5605 (weak_alias_test_3.o): New target.
5606 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5607 * testsuite/weak_alias_test_main.cc: New file.
5608 * testsuite/weak_alias_test_1.cc: New file.
5609 * testsuite/weak_alias_test_2.cc: New file.
5610 * testsuite/weak_alias_test_3.cc: New file.
5612 2008-04-08 Ian Lance Taylor <iant@google.com>
5614 * options.h (class General_options): Add --noinhibit-exec option.
5615 * main.cc (main): Check --noinhibit-exec.
5617 * options.h (class General_options): Define --wrap as a special
5618 option. Add wrap_symbols_ field.
5619 (General_options::any_wrap_symbols): New function.
5620 (General_options::is_wrap_symbol): New function.
5621 * options.cc (General_options::parse_wrap): New function.
5622 (General_options::General_options): Initialize wrap_symbols_.
5623 * symtab.cc (Symbol_table::wrap_symbol): New function.
5624 (Symbol_table::add_from_object): Handle --wrap.
5625 * symtab.h (class Symbol_table): Declare wrap_symbol.
5626 * target.h (Target::wrap_char): New function.
5627 (Target::Target_info): Add wrap_char field.
5628 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
5629 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5630 * testsuite/testfile.cc (Target_test::test_target_info):
5633 * errors.cc (Errors::undefined_symbol): Mention symbol version if
5636 * layout.h (class Layout): Add added_eh_frame_data_ field.
5637 * layout.cc (Layout::Layout): Initialize new field.
5638 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
5639 output section until we find a section we merged successfully.
5640 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
5641 that the size be non-zero.
5643 * merge.cc (Object_merge_map::get_output_offset): Remove inline
5646 2008-04-08 Craig Silverstein <csilvers@google.com>
5648 * configure.ac: Export new conditional variable HAVE_ZLIB.
5649 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
5651 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
5652 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5654 2008-04-07 Ian Lance Taylor <iant@google.com>
5656 * version.cc (version_string): Set to "1.5".
5658 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
5659 Add issued_non_pic_error_ field. Declare check_non_pic.
5660 (Target_x86_64::Scan::check_non_pic): New function.
5661 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
5662 (Target_x86_64::Scan::global): Likewise.
5664 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
5665 addend parameter. Change caller. Handle merge sections.
5666 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5667 Address to Addend. Don't add in the result of
5668 local_section_offset, pass down the addend and use the returned
5670 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5671 Update declarations of local_section_offset and symbol_value.
5672 * testsuite/two_file_test_1.cc (t18): New function.
5673 * testsuite/two_file_test_2.cc (f18): New function.
5674 * testsuite/two_file_test_main.cc (main): Call t18.
5675 * testsuite/two_file_test.h (t18, f18): Declare.
5677 * configure.ac: Don't test for objdump, c++filt, or readelf.
5678 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5680 (TEST_READELF): New variable.
5681 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5682 (check_PROGRAMS): Add two_file_strip_test.
5683 (two_file_strip_test): New target.
5684 (check_PROGRAMS): Add two_file_same_shared_strip_test.
5685 (two_file_same_shared_strip_test_SOURCES): New variable.
5686 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5687 (two_file_same_shared_strip_test_LDFLAGS): New variable.
5688 (two_file_same_shared_strip_test_LDADD): New variable.
5689 (two_file_shared_strip.so): New target.
5690 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5691 (ver_test_5.syms, ver_test_7.syms): Likewise.
5692 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5693 (strip_test_3.stdout): Use TEST_OBJDUMP.
5694 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5696 2008-04-04 Cary Coutant <ccoutant@google.com>
5698 * symtab.h (Symbol::is_weak_undefined): New function.
5699 (Symbol::is_strong_undefined): New function.
5700 (Symbol::is_absolute): New function.
5701 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5702 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5704 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5705 (weak_undef_test): New target.
5706 * testsuite/Makefile.in: Rebuild.
5707 * testsuite/weak_undef_file1.cc: New file.
5708 * testsuite/weak_undef_file2.cc: New file.
5709 * testsuite/weak_undef_test.cc: New file.
5711 2008-04-03 Craig Silverstein <csilvers@google.com>
5713 * compressed_output.h (class Output_compressed_section): Use
5715 * compressed_output.cc (zlib_compress): Use unsigned buffers,
5717 (zlib_compressed_suffix): Removed.
5718 (Output_compressed_section::set_final_data_size): Use unsigned
5720 * testsuite/Makefile.am (flagstest_compress_debug_sections):
5721 Fix linker invocation.
5722 (flagstest_o_specialfile_and_compress_debug_sections):
5724 * testsuite/Makefile.in: Regenerated.
5726 2008-04-02 David S. Miller <davem@davemloft.net>
5728 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5729 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5731 2008-04-02 Craig Silverstein <csilvers@google.com>
5735 2008-04-02 Ian Lance Taylor <iant@google.com>
5737 * fileread.cc (File_read::find_view): Add byteshift and vshifted
5738 parameters. Update for new key type to views_. Change all
5740 (File_read::read): Adjust for byteshift in returned view.
5741 (File_read::add_view): New function, broken out of
5743 (File_read::make_view): New function, broken out of
5745 (File_read::find_or_make_view): Add offset and aligned
5746 parameters. Rewrite accordingly. Change all callers.
5747 (File_read::get_view): Add offset and aligned parameters. Adjust
5748 for byteshift in return value.
5749 (File_read::get_lasting_view): Likewise.
5750 * fileread.h (class File_read): Update declarations.
5751 (class File_read::View): Add byteshift_ field. Add byteshift to
5752 constructor. Add byteshift method.
5753 * archive.h (Archive::clear_uncached_views): New function.
5754 (Archive::get_view): Add aligned parameter. Change all callers.
5755 * object.h (Object::get_view): Add aligned parameter. Change all
5757 (Object::get_lasting_view): Likewise.
5759 * fileread.cc (File_read::release): Don't call clear_views if
5760 there are multiple objects.
5761 * fileread.h (File_read::clear_uncached_views): New function.
5762 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5765 2008-03-31 Cary Coutant <ccoutant@google.com>
5767 Add thin archive support.
5768 * archive.cc (Archive::armagt): New const.
5769 (Archive::setup): Remove task parameter and calls to unlock.
5770 (Archive::unlock_nested_archives): New function.
5771 (Archive::read_header): Add nested_off parameter. Change
5773 (Archive::interpret_header): Likewise.
5774 (Archive::include_all_members): Change to handle thin
5776 (Archive::include_member): Likewise.
5777 * archive.h (Archive::Archive): Add new parameters and
5779 (Archive::armagt): New const.
5780 (Archive::setup): Remove task parameter.
5781 (Archive::unlock_nested_archives): New function.
5782 (Archive::read_header): Add nested_off parameter.
5783 (Archive::interpret_header): Likewise.
5784 (Archive::Nested_archive_table): New typedef.
5785 (Archive::is_thin_archive_): New field.
5786 (Archive::nested_archives_): New field.
5787 (Archive::options_): New field.
5788 (Archive::dirpath_): New field.
5789 (Archive::task_): New field.
5790 * readsyms.cc (Read_symbols::do_read_symbols): Add check
5791 for thin archives. Pass additional parameters to
5792 Archive::Archive. Unlock the archive file after calling
5795 2008-03-29 Ian Lance Taylor <iant@google.com>
5797 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
5798 version symbol to be local.
5799 * testsuite/ver_test_4.sh: New file.
5800 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
5801 (check_DATA): Add ver_test_4.syms.
5802 (ver_test_4.syms): New target.
5803 * testsuite/Makefile.in: Rebuild.
5806 (Output_section::Input_section_sort_entry::has_priority): New
5808 (Output_section::Input_section_sort_entry::match_file_name): New
5810 (Output_section::Input_section_sort_entry::match_section_name):
5812 (Output_section::Input_section_sort_entry::match_section_name_prefix):
5814 (Output_section::Input_section_sort_entry::match_section_file):
5816 (Output_section::Input_section_sort_compare::operator()): Rewrite
5817 using new Input_section_sort_entry functions. Sort crtbegin and
5818 crtend first. Sort sections with no priority before sections with
5820 * testsuite/initpri1.c (d3): Check j != 4.
5821 (cd5): New constructor/destructor function.
5822 (main): Check j != 2.
5824 * symtab.cc (Symbol_table::add_from_object): If we don't use the
5825 new symbol when resolving, don't call set_is_default.
5826 * testsuite/ver_test_7.cc: New file.
5827 * testsuite/ver_test_7.sh: New file.
5828 * testsuite/Makefile.am (ver_test_7.so): New target.
5829 (ver_test_7.o): New target.
5830 (check_SCRIPTS): Add ver_test_7.sh.
5831 (check_DATA): Add ver_test_7.syms.
5832 (ver_test_7.syms): New target.
5834 2008-03-28 Ian Lance Taylor <iant@google.com>
5836 * layout.cc (Layout::layout): If we see an input section with a
5837 name that needs sorting, set the must_sort flag for the output
5839 (Layout::make_output_section): If the name of the output section
5840 indicates that it might require sorting, set the may_sort flag.
5841 * output.h (Output_section::may_sort_attached_input_sections): New
5843 (Output_section::set_may_sort_attached_input_sections): New
5845 (Output_section::must_sort_attached_input_sections): New
5847 (Output_section::set_must_sort_attached_input_sections): New
5849 (class Output_section): Declare Input_section_sort_entry. Define
5850 Input_section_sort_compare. Declare
5851 sort_attached_input_sections. Add new fields:
5852 may_sort_attached_input_sections_,
5853 must_sort_attached_input_sections_,
5854 attached_input_sections_are_sorted_.
5855 * output.cc (Output_section::Output_section): Initialize new
5857 (Output_section::add_input_section): Add an entry to
5858 input_sections_ if may_sort or must_sort are true.
5859 (Output_section::set_final_data_size): Call
5860 sort_attached_input_sections if necessary.
5861 (Output_section::Input_section_sort_entry): Define new class.
5862 (Output_section::Input_section_sort_compare::operator()): New
5864 (Output_section::sort_attached_input_sections): New function.
5865 * configure.ac: Check whether the compiler supports constructor
5866 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
5867 * testsuite/initpri1.c: New file.
5868 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
5869 CONSTRUCTOR_PRIORITY.
5870 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
5871 (initpri1_LDFLAGS): New variable.
5872 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5874 2008-03-27 Ian Lance Taylor <iant@google.com>
5876 * common.cc (Sort_commons::operator): Correct sorting algorithm.
5877 * testsuite/common_test_1.c: New file.
5878 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
5879 (common_test_1_SOURCES): New variable.
5880 (common_test_1_DEPENDENCIES): New variable.
5881 (common_test_1_LDFLAGS): New variable.
5883 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
5884 and commons_ correctly when NAME/VERSION does not override
5886 * testsuite/ver_test_6.c: New file.
5887 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
5888 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
5889 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
5891 2008-03-26 Ian Lance Taylor <iant@google.com>
5893 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
5894 of an undefined symbol from a version script.
5895 * testsuite/Makefile.am (ver_test_5.so): New target.
5896 (ver_test_5.o): New target.
5897 (check_SCRIPTS): Add ver_test_5.sh.
5898 (check_DATA): Add ver_test_5.syms.
5899 (ver_test_5.syms): New target.
5900 * testsuite/ver_test_5.cc: New file.
5901 * testsuite/ver_test_5.script: New file.
5902 * testsuite/ver_test_5.sh: New file.
5903 * Makefile.in, testsuite/Makefile.in: Rebuild.
5906 Fix problems building gold with gcc 4.3.0.
5907 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
5908 (gold_error_at_location, gold_warning_at_location): Use it.
5909 * configure.ac: Check whether we can compile and use a template
5910 function with a printf attribute.
5911 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
5912 when jumping over bytes.
5913 * object.cc: Instantiate Object::read_section_data.
5914 * debug.h: Include <cstring>
5915 * dwarf_reader.cc: Include <algorithm>
5916 * main.cc: Include <cstring>.
5917 * options.cc: Include <cstring>.
5918 * output.cc: Include <cstring>.
5919 * script.cc: Include <cstring>.
5920 * script.h: Include <string>.
5921 * symtab.cc: Include <cstring> and <algorithm>.
5922 * target-select.cc: Include <cstring>.
5923 * version.cc: Include <string>.
5924 * testsuite/testmain.cc: Include <cstdlib>.
5925 * configure, config.in: Rebuild.
5927 2008-03-25 Ian Lance Taylor <iant@google.com>
5929 * options.cc: Include "../bfd/bfdver.h".
5930 (options::help): Print bug reporting address.
5932 * version.cc (print_version): Adjust output for current value of
5937 * options.cc (options::help): Print list of supported targets.
5938 * target-select.h: Include <vector>.
5939 (class Target_selector): Make machine_, size_, and is_big_endian_
5940 fields const. Add bfd_name_ and instantiated_target_ fields.
5941 (Target_selector::Target_selector): Add bfd_name parameter.
5942 (Target_selector::recognize): Make non-virtual, call
5944 (Target_selector::recognize_by_name): Make non-virtual, call
5945 do_recognize_by_name.
5946 (Target_selector::supported_names): New function.
5947 (Target_selector::bfd_name): New function.
5948 (Target_selector::do_instantiate_target): New pure virtual
5950 (Target_selector::do_recognize): New virtual function.
5951 (Target_selector::do_recognize_by_name): New virtual function.
5952 (Target_selector::instantiate_target): New private function.
5953 (supported_target_names): Declare.
5954 * target-select.cc (Target_selector::Target_selector): Update for
5955 new parameter and fields.
5956 (select_target_by_name): Check that the name matches before
5957 calling recognize_by_name.
5958 (supported_target_names): New function.
5959 * i386.cc (class Target_selector_i386): Update Target_selector
5960 constructor call. Remove recognize and recognize_by_name. Add
5961 do_instantiate_target.
5962 * x86_64.cc (class Target_selector_x86_64): Likewise.
5963 * testsuite/testfile.cc (class Target_selector_test): Update for
5964 changes to Target_selector.
5966 * README: Rewrite, with some notes on unsupported features.
5968 2008-03-24 Cary Coutant <ccoutant@google.com>
5970 * i386.cc (Target_i386::Got_type): New enum declaration.
5971 (Target_i386::Scan::local): Updated callers of Output_data_got
5973 (Target_i386::Scan::global): Likewise.
5974 (Target_i386::Relocate::relocate): Likewise.
5975 (Target_i386::Relocate::relocate_tls): Likewise.
5976 * object.h (Got_offset_list): New class.
5977 (Sized_relobj::local_has_got_offset): Added got_type parameter.
5978 (Sized_relobj::local_got_offset): Likewise.
5979 (Sized_relobj::set_local_got_offset): Likewise.
5980 (Sized_relobj::local_has_tls_got_offset): Removed.
5981 (Sized_relobj::local_tls_got_offset): Removed.
5982 (Sized_relobj::set_local_tls_got_offset): Removed.
5983 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
5984 * output.cc (Output_data_got::add_global): Added got_type parameter.
5985 (Output_data_got::add_global_with_rel): Likewise.
5986 (Output_data_got::add_global_with_rela): Likewise.
5987 (Output_data_got::add_global_pair_with_rel): New function.
5988 (Output_data_got::add_global_pair_with_rela): New function.
5989 (Output_data_got::add_local): Added got_type parameter.
5990 (Output_data_got::add_local_with_rel): Likewise.
5991 (Output_data_got::add_local_with_rela): Likewise.
5992 (Output_data_got::add_local_pair_with_rel): New function.
5993 (Output_data_got::add_local_pair_with_rela): New function.
5994 (Output_data_got::add_global_tls): Removed.
5995 (Output_data_got::add_global_tls_with_rel): Removed.
5996 (Output_data_got::add_global_tls_with_rela): Removed.
5997 (Output_data_got::add_local_tls): Removed.
5998 (Output_data_got::add_local_tls_with_rel): Removed.
5999 (Output_data_got::add_local_tls_with_rela): Removed.
6000 * output.h (Output_data_got::add_global): Added got_type parameter.
6001 (Output_data_got::add_global_with_rel): Likewise.
6002 (Output_data_got::add_global_with_rela): Likewise.
6003 (Output_data_got::add_global_pair_with_rel): New function.
6004 (Output_data_got::add_global_pair_with_rela): New function.
6005 (Output_data_got::add_local): Added got_type parameter.
6006 (Output_data_got::add_local_with_rel): Likewise.
6007 (Output_data_got::add_local_with_rela): Likewise.
6008 (Output_data_got::add_local_pair_with_rel): New function.
6009 (Output_data_got::add_local_pair_with_rela): New function.
6010 (Output_data_got::add_global_tls): Removed.
6011 (Output_data_got::add_global_tls_with_rel): Removed.
6012 (Output_data_got::add_global_tls_with_rela): Removed.
6013 (Output_data_got::add_local_tls): Removed.
6014 (Output_data_got::add_local_tls_with_rel): Removed.
6015 (Output_data_got::add_local_tls_with_rela): Removed.
6016 * resolve.cc (Symbol::override_base_with_special): Removed
6017 reference to has_got_offset_ field.
6018 * symtab.cc (Symbol::init_fields): Replaced initialization
6019 of got_offset_ with got_offsets_. Removed initialization
6021 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6022 (Symbol::got_offset): Likewise.
6023 (Symbol::set_got_offset): Likewise.
6024 (Symbol::has_tls_got_offset): Removed.
6025 (Symbol::tls_got_offset): Removed.
6026 (Symbol::set_tls_got_offset): Removed.
6027 (Symbol::got_offset_): Removed.
6028 (Symbol::tls_mod_got_offset_): Removed.
6029 (Symbol::tls_pair_got_offset_): Removed.
6030 (Symbol::got_offsets_): New field.
6031 (Symbol::has_got_offset): Removed.
6032 (Symbol::has_tls_mod_got_offset): Removed.
6033 (Symbol::has_tls_pair_got_offset): Removed.
6034 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6035 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6037 (Target_x86_64::Scan::global): Likewise.
6038 (Target_x86_64::Relocate::relocate): Likewise.
6039 (Target_x86_64::Relocate::relocate_tls): Likewise.
6041 2008-03-25 Ben Elliston <bje@au.ibm.com>
6043 * yyscript.y: Fix spelling error in comment.
6045 2008-03-24 Ian Lance Taylor <iant@google.com>
6047 * options.h (class General_options): Define build_id option.
6048 * layout.h (class Layout): Declare write_build_id, create_note,
6049 create_build_id. Add build_id_note_ member.
6050 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6051 "libiberty.h", "md5.h", "sha1.h".
6052 (Layout::Layout): Initialize eh_frame_data_,
6053 eh_frame_hdr_section_, and build_id_note_.
6054 (Layout::finalize): Call create_build_id.
6055 (Layout::create_note): New function, broken out of
6056 Layout::create_gold_note.
6057 (Layout::create_gold_note): Call create_note.
6058 (Layout::create_build_id): New function.
6059 (Layout::write_build_id): New function.
6060 (Close_task_runner::run): Call write_build_id.
6062 * x86_64.cc: Correct license to GPLv3.
6064 2008-03-23 Ian Lance Taylor <iant@google.com>
6066 * options.cc: Include "demangle.h".
6067 (parse_optional_string): New function.
6068 (parse_long_option): Handle takes_optional_argument.
6069 (parse_short_option): Update dash_z initializer. Handle
6070 takes_optional_argument.
6071 (General_options::General_options): Initialize do_demangle_.
6072 (General_options::finalize): Set do_demangle_. Handle demangling
6074 * options.h (parse_optional_string): Declare.
6075 (struct One_option): Add optional_arg field. Update constructor.
6076 Update call constructor calls. Add takes_optional_argument
6078 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6079 (DEFINE_optional_string): Define.
6080 (General_options::demangle): Change from DEFINE_bool to
6081 DEFINE_optional_string.
6082 (General_options::no_demangle): New function.
6083 (General_options::do_demangle): New function.
6084 (General_options::set_do_demangle): New function.
6085 (General_options::execstack_status_): Move definition to end of
6087 (General_options::static_): Likewise.
6088 (General_options::do_demangle_): New field.
6089 * object.cc (big_endian>::get_symbol_location_info): Call
6090 Options::do_demangle, not Options::demangle.
6091 * symtab.cc (demangle): Likewise.
6093 2008-03-22 Ian Lance Taylor <iant@google.com>
6095 * gold.h: Include <cstddef> and <sys/types.h>
6096 * options.h: Include <cstring>.
6098 2008-03-21 Ian Lance Taylor <iant@google.com>
6100 * Added source code to GNU binutils.