1 2010-01-08 Ian Lance Taylor <iant@google.com>
4 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9 * version.cc (print_version): Change to "Copyright 2010".
11 2010-01-08 Ian Lance Taylor <iant@google.com>
15 * i386.cc (class Target_i386): Change return type of plt_section
17 (class Output_data_plt_i386): Add tls_desc_rel_ field.
18 (Output_data_plt_i386::Output_data_plt_i386): Initialize
20 (Output_data_plt_i386::rel_tls_desc): New function.
21 (Target_i386::rel_tls_desc_section): New function.
22 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
23 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
24 R_386_TLS_DESC reloc in rel_tls_desc_section.
25 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
26 Define struct Tlsdesc_info.
27 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
28 (Target_x86_64::do_reloc_symbol_index): New function.
29 (Target_x86_64::add_tlsdesc_info): New function.
30 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
31 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
33 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
35 (Output_data_plt_x86_64::rela_tlsdesc): New function.
36 (Target_x86_64::rela_tlsdesc_section): New function.
37 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
39 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
40 (Target_x86_64::do_reloc_addend): New function.
41 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
42 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
43 declarations. Define TARGET_CODE. Add arg field to u1_ union.
44 (Output_reloc::type): New function.
45 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
46 (Output_reloc::is_target_specific): New function.
47 (Output_reloc::target_arg): New function.
48 (class Output_reloc) [SHT_RELA]: Add four new constructors for
49 absolute relocs and target specific relocs.
50 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
52 (class Output_data_reloc) [SHT_RELA]: Likewise.
53 * output.cc (Output_reloc::Output_reloc): Add four new versions
54 for absolute relocs and target specific relocs.
55 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
56 (Output_reloc::get_symbol_index): Likewise.
57 (Output_reloc::local_section_offset): Check that local_sym_index_
58 is not TARGET_CODE or 0.
59 (Output_reloc::symbol_value): Likewise.
60 (Output_reloc::write) [SHT_RELA]: Call target for target specific
62 * target.h (class Target): Add reloc_symbol_index and reloc_addend
63 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
65 * layout.cc (add_target_dynamic_tags): Use output section for
66 DT_PLTRELSZ and DT_JMPREL.
68 2010-01-07 Ian Lance Taylor <iant@google.com>
71 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
73 (class Output_data_reloc_generic): Define.
74 (class Output_data_reloc_base): Change base class to
75 Output_data_reloc_generic. Change add() method to call
76 bump_relative_reloc_count for a relative reloc. Remove
78 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
80 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
81 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
83 * layout.h (class Layout): Update declaration.
85 2010-01-07 Ian Lance Taylor <iant@google.com>
87 * output.h (class Output_data): Add const version of
88 output_section and do_output_section.
89 (class Output_section_data): Add const version of
91 (class Output_section): Likewise.
92 * layout.cc (Layout::add_target_dynamic_tags): New function.
93 * layout.h (class Layout): Update declarations.
94 * arm.cc (Target_arm::do_finalize_sections): Use
95 add_target_dynamic_tags.
96 * i386.cc (Target_i386::do_finalize_sections): Likewise.
97 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
98 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
99 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
101 2010-01-07 Ian Lance Taylor <iant@google.com>
104 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
107 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
108 Ian Lance Taylor <iant@google.com>
111 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
112 Xindex::read_symtab_xindex.
114 2010-01-07 Doug Kwan <dougkwan@google.com>
116 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
117 (Insn_template::thumb16_bcond_insn): New method declaration.
118 (Insn_template): Fix spelling.
119 (Stub::thumb16_special): New method declaration.
120 (Stub::do_write): Define virtual method which was previously pure
122 (Stub::do_thumb16_special): New method declaration.
123 (Stub::do_fixed_endian_write): New template member.
124 (Reloc_stub::do_write): Remove.
125 (Reloc_stub::do_fixed_endian_write): Remove.
126 (Cortex_a8_stub): New class definition.
127 (Stub_factory::make_cortex_a8_stub): New method definition.
128 (Stub_factory::Stub_factory): Add missing static storage class
129 qualifier for elf32_arm_stub_a8_veneer_blx.
131 2010-01-07 Ian Lance Taylor <iant@google.com>
134 * options.h (class General_options): Add --warn-unresolved-symbols
135 and --error-unresolved-symbols.
136 * errors.cc (Errors::undefined_symbol): Implement
137 --warn-unresolved-symbols.
139 * options.h (class General_options): Add -z text and -z textoff.
140 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
142 2010-01-06 Sriraman Tallam <tmsriram@google.com>
144 * gc.h (Garbage_collection::Cident_section_map): New typedef.
145 (Garbage_collection::cident_sections): New function.
146 (Garbage_collection::add_cident_section): New function.
147 (Garbage_collection::cident_sections_): New member.
148 (gc_process_relocs): Add references to sections whose names are C
150 * gold.h (cident_section_start_prefix): New constant.
151 (cident_section_stop_prefix): New constant.
152 (is_cident): New function.
153 * layout.cc (Layout::define_section_symbols): Replace string constants
154 with the newly defined constants.
155 * object.cc (Sized_relobj::do_layout): Track sections whose names are
157 * testsuite/Makefile.am: Add gc_orphan_section_test.
158 * testsuite/Makefile.in: Regenerate.
159 * testsuite/gc_orphan_section_test.cc: New file.
160 * testsuite/gc_orphan_section_test.sh: New file.
162 2010-01-06 Ian Lance Taylor <iant@google.com>
165 * options.h (class General_options): Add --warn-shared-textrel.
166 * layout.cc (Layout::finish_dynamic_section): Implement
167 --warn-shared-textrel.
170 * options.h (class General_options): Add --warn-multiple-gp.
172 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
174 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
175 $(THREADSLIB) and $(LIBDL).
176 * Makefile.in: Rebuild.
178 2010-01-06 Ian Lance Taylor <iant@google.com>
181 * options.cc (General_options::parse_section_start): New function.
182 (General_options::section_start): New function.
183 (General_options::General_options): Initialize all members.
184 * options.h: Include <map>
185 (class General_options): Add --section-start. Add section_starts_
187 * layout.cc (Layout::attach_allocated_section_to_segment): If
188 --section-start was used, set the address of the segment. Remove
190 (Layout::relaxation_loop_body): If the address of the load segment
191 has been set by --section-start, don't use it.
192 * output.h (Output_segment::update_flags_for_output_section): New
194 * output.cc (Output_segment::add_output_section): Call
195 update_flags_for_output_section.
197 2010-01-05 Ian Lance Taylor <iant@google.com>
200 * options.h (class General_options): Add --undefined-version.
201 * script.cc (struct Version_expression): Add was_matched_by_symbol
203 (Version_script_info::matched_symbol): New function.
204 (Version_script_info::get_symbol_version_helper): Call
206 (Version_script_info::check_unmatched_names): New function.
207 * script.h (class Version_script_info): Update declarations.
208 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
210 * options.h (class General_options): Use DEFINE_bool_alias for
211 allow_multiple_definition.
212 * resolve.cc (Symbol_table::should_override): Don't test
213 allow_multiple_definition.
216 * options.h (class General_options): Add --cref.
217 * main.cc (main): Print cref table if --cref. Don't close mapfile
218 until after printing cref table.
219 * cref.cc: Include "symtab.h".
220 (class Cref_inputs): Define Cref_table_compare and Cref_table.
221 (Cref_table_compare::operator()): New function.
222 (Cref_inputs::gather_cref): New function.
223 (filecol): New static const.
224 (Cref_inputs::print_cref): New function.
225 (Cref::print_cref): New function.
226 * cref.h: Include <cstdio>.
227 (class Cref): Update declarations.
228 * mapfile.h (Mapfile::file): New function.
229 * object.h (class Object): Define Symbols. Declare virtual
230 do_get_global_symbols.
231 (Object::get_global_symbols): New function.
232 * object.cc (Input_objects::add_object): Pass object to cref_ if
234 (Input_objects::archive_start): Likewise.
235 (Input_objects::archive_stop): Likewise.
236 (Input_objects::print_cref): New function.
237 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
238 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
240 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
242 * plugin.h (class Sized_pluginobj): Update declarations.
244 2010-01-05 Ian Lance Taylor <iant@google.com>
246 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
247 to is_default_version. Rename insdef to insdefault.
248 (Symbol_table::add_from_relobj): Rename def to is_default_version
249 and local to is_forced_local.
250 (Symbol_table::add_from_pluginobj): Likewise.
251 (Symbol_table::add_from_dynobj): Likewise.
252 (Symbol_table::define_special_symbol): Rename insdef to
255 2010-01-04 Ian Lance Taylor <iant@google.com>
258 * options.h (class General_options): Add
259 --allow-multiple-definition and -z muldefs.
260 * resolve.cc (Symbol_table::should_override): Don't warn about a
261 multiple symbol definition if --allow-multiple-definition or -z
265 * options.h (class General_options): Add --add-needed and
266 --copy-dt-needed-entries. Tweak --as-needed help entry.
267 * object.cc (Input_objects::check_dynamic_dependencies): Give an
268 error if --copy-dt-needed-entries aka --add-needed is used and
269 would cause a change in behaviour.
272 * options.h (class General_options): Add -G as a short version of
273 --shared. Add no-op options -assert, -g, and -i.
275 2010-01-04 Sriraman Tallam <tmsriram@google.com>
277 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
278 check for .text or .gnu.linkonce.t sections.
279 * icf.cc (Icf::find_identical_sections): Ditto.
280 Change the detection for mangled function name within the section
282 * icf.h (is_section_foldable_candidate): New function.
284 2009-12-30 Ian Lance Taylor <iant@google.com>
287 * options.h (class General_options): Permit two dashes with
288 --retain-symbols-file.
290 2009-12-30 Ian Lance Taylor <iant@google.com>
293 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
294 don't put the file header and segment headers in the text
298 * common.cc (Sort_commons::operator()): Stabilize sort when both
300 (Symbol_table::do_allocate_commons_list): When allocating common
301 symbols, skip a symbol which is no longer common.
302 * symtab.h (Symbol::is_common): Test whether the symbol comes from
303 an object before checking its type.
304 * testsuite/common_test_2.c: New file.
305 * testsuite/common_test_3.c: New file.
306 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
307 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
308 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
309 (common_test_2_pic.o, common_test_2.so): New targets.
310 (common_test_3_pic.o, common_test_3.so): New targets.
311 * testsuite/Makefile.in: Rebuild.
314 * script.cc (read_input_script): If we see a new SECTIONS clause,
315 and we have added an input section, give an error.
316 * layout.h (class Layout): Add have_added_input_section function.
317 Add have_added_input_section_ field.
318 * layout.cc (Layout::Layout): Initialize
319 have_added_input_section_.
320 (Layout::layout): Set have_added_input_section_.
321 (Layout::layout_eh_frame): Likewise.
323 2009-12-30 Ian Lance Taylor <iant@google.com>
326 * options.h (class General_options): Add --sort-common option.
327 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
328 * common.cc (Sort_common): Add sort_order parameter to
329 constructor. Add sort_order_ field.
330 (Sort_commons::operator): Check sort_order_.
331 (Symbol_table::allocate_commons): Determine the sort order.
332 (Symbol_table::do_allocate_commons): Add sort_order parameter.
334 (Symbol_table::do_allocate_commons_list): Likewise.
336 2009-12-30 Ian Lance Taylor <iant@google.com>
339 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
340 symbols from this object, don't change the visibility of an
342 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
344 2009-12-30 Ian Lance Taylor <iant@google.com>
347 * script.h (class Version_script_info): Define Language enum.
348 Update declarations. Define Glob, Exact, and Lookup types. Add
349 new fields globals_, locals_, and is_finalized_.
350 * script.cc: Various formatting fixes.
351 (class Parser_closure): Change language_stack_ from a vector of
352 std::string to one of Version_script_info::Language. Adjust all
354 (class Lazy_demangler): Remove.
355 (struct Version_expression): Change language from std::string to
356 Version_script_info::Language.
357 (Version_script_info::Version_script_info): New function.
358 (Version_script_info::~Version_script_info): Don't call clear.
359 (Version_script_info::finalize): New function.
360 (Version_script_info::build_lookup_tables): New function.
361 (Version_script_info::build_expression_list_lookup): New
363 (Version_script_info::get_symbol_version_helper): Rewrite to use
365 (Version_script_info::print_expression_list): Adjust to use
366 Version_script_info::Language.
367 (script_push_lex_into_version_mode): Check that the version script
368 has not been finalized.
369 (version_script_push_lang): Change language string to
370 Version_script_info::Language.
371 * options.cc (Command_line::version_script): New function.
372 * options.h (class General_options): Add finalize_dynamic_list
373 function. Change version_script from declaration to definition.
374 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
375 * testsuite/version_script.map: Remove duplicate def of foo.
376 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
378 * testsuite/Makefile.in: Rebuild.
380 2009-12-30 Ian Lance Taylor <iant@google.com>
383 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
384 if the input symbol index is 0, make the output symbol index 0.
386 2009-12-30 Ian Lance Taylor <iant@google.com>
389 * options.h (class General_options): Add -x/--discard-all.
390 * object.cc (Sized_relobj::do_count_local_symbols): Handle
391 --discard-all. If the local symbol needs a dynamic entry, check
392 that before handling --discard-locals.
394 2009-12-30 Ian Lance Taylor <iant@google.com>
397 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
399 (Output_segment::add_output_section): Don't change the flags if
403 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
404 GNU hash table if they need a dynamic value. Otherwise, don't add
405 them if they are defined in a dynamic object or are forced local.
407 2009-12-29 Ian Lance Taylor <iant@google.com>
410 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
411 .gnu.hash table for a 32-bit target.
414 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
415 regular and a dynamic object only needs a dynamic symbol table
416 entry if it is externally visible.
419 * i386.cc (class Target_i386): Initialize global_offset_table_ in
420 constructor. Add global_offset_table_ field.
421 (Target_i386::got_section): Set global_offset_table_.
422 (Target_i386::do_finalize_sections): Set global_offset_table_
424 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
425 in constructor. Add global_offset_table_ field.
426 (Target_x86_64::got_section): Set global_offset_table_.
427 (Target_x86_64::do_finalize_sections): Set global_offset_table_
430 * layout.cc (Layout::Layout): Initialize increase_relro_.
431 (Layout::get_output_section): Add is_relro, is_last_relro, and
432 is_first_non_relro parameters. Change all callers.
433 (Layout::choose_output_section): Likewise.
434 (Layout::add_output_section_data): Likewise.
435 (Layout::make_output_section): Likewise.
436 (Layout::set_segment_offsets): Clear increase_relro when using a
438 * layout.h (class Layout): Add increase_relro method. Add
439 increase_relro_ field. Update declarations.
440 * output.cc (Output_section::Output_section): Initialize
441 is_last_relro_ and is_first_non_relro_.
442 (Output_segment::add_output_section): Group relro sections is
443 do_sort is true. Handle is_last_relro and is_first_non_relro.
444 (Output_segment::maximum_alignment): Remove relro handling.
445 (Output_segment::set_section_addresses): Add increase_relro
446 parameter. Change all callers. Add initial alignment to align
447 relro sections on separate page. Remove old relro handling.
448 (Output_segment::set_section_list_addresses): Remove in_relro
449 parameter. Change all callers.
450 (Output_segment::set_offset): Add increase parameter. Change all
451 callers. Remove old relro handling.
452 * output.h (class Output_section): Add new methods: is_last_relro,
453 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
454 Add is_last_relro_ and is_first_non_relro_ fields.
455 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
456 Create separate .got.plt section. Call increase_relro.
457 * x86_64.cc (Target_x86_64::got_section): Likewise.
458 * testsuite/relro_script_test.t: Add .got.plt.
461 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
462 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
463 (Layout::finalize): Call set_dynamic_symbol_size.
464 (Layout::set_dynamic_symbol_size): New function.
465 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
466 set_dynamic_symbol_size.
469 * output.h (class Output_section): Add is_entsize_zero_ field.
470 * output.cc (Output_section::Output_section): Initialize
472 (Output_section::set_entsize): If two different entsizes are
473 requested, force it to zero.
474 (Output_section::add_input_section): Set flags for .debug_str
475 before updating section flags. Set entsize.
476 (Output_section::update_flags_for_input_section): Set SHF_MERGE
477 and SHF_STRING if all input sections have those flags.
479 2009-12-29 Rafael Espindola <espindola@google.com>
481 * main.cc (main): Fix the sys time reporting.
482 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
485 2009-12-29 Sriraman Tallam <tmsriram@google.com>
487 * options.cc (General_options::parse_version): Allow -v to exit
488 without an error if there is nothing to link.
490 2009-12-29 Ian Lance Taylor <iant@google.com>
492 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
493 using a version of gcc before 4.1.
494 * configure: Rebuild.
496 2009-12-28 Chris Demetriou <cgd@google.com>
498 * attributes.cc (Output_attributes_section_data::do_write): Use
499 std::vector::front rather than std::vector::data.
501 2009-12-28 Ian Lance Taylor <iant@google.com>
503 * symtab.h (class Symbol_table): Add enum Defined.
504 * resolve.cc (Symbol_table::should_override): Add defined
505 parameter. Change all callers. Test whether object is NULL
506 before calling a method on it.
507 (Symbol_table::report_resolve_problem): Add defined parameter.
509 (Symbol_table::should_override_with_special): Likewise.
510 * symtab.cc (Symbol_table::define_in_output_data): Add defined
511 parameter. Change all callers.
512 (Symbol_table::do_define_in_output_data): Likewise.
513 (Symbol_table::define_in_output_segment): Likewise.
514 (Symbol_table::do_define_in_output_segment): Likewise.
515 (Symbol_table::define_as_constant): Likewise.
516 (Symbol_table::do_define_as_constant): Likewise.
517 * script.h (class Symbol_assignment): Add is_defsym parameter to
518 constructor; change all callers.
519 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
520 parameter. Change all callers. Add is_defsym_ field.
521 (class Parser_closure): Add parsing_defsym parameter to
522 constructor; change all callers. Add parsing_defsym accessor
523 function. Add parsing_defsym_ field.
525 2009-12-28 Ian Lance Taylor <iant@google.com>
527 * gold.cc (queue_middle_tasks): Fix formatting.
528 * object.cc (Relobj::is_section_name_included): Likewise.
530 2009-12-23 Ian Lance Taylor <iant@google.com>
532 * i386.cc (Target_i386::do_calls_non_split): Recognize
533 -fsplit-stack prologue for a function with a static chain.
534 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
535 -fsplit-stack prologue when using %r11.
537 2009-12-21 Sriraman Tallam <tmsriram@google.com>
539 * options.cc (General_options::parse_version): Make -v continue and do
540 the link like GNU ld does.
542 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
544 * Makefile.am (CCFILES): Add timer.cc.
545 (HFILES): Add timer.h.
546 * configure.ac: Check for sysconf and times.
547 * main.cc: include timer.h.
548 (main): Use Timer instead of get_run_time.
551 * workqueue.cc: include timer.h.
552 (Workqueue::find_and_run_task):
553 Report user, sys and wall time.
554 * Makefile.in: Regenerate.
555 * config.in: Regenerate.
556 * configure: Regenerate.
558 2009-12-16 Doug Kwan <dougkwan@google.com>
560 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
562 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
563 relaxed input sections.
564 * output.cc (Output_section::find_relaxed_input_section): Change
565 return type to Output_relaxed_input_section pointer. Adjust code
566 for new type of relaxed_input_section_map_.
567 * output.h (Output_section::find_relaxed_input_section): Change
568 return type to Output_relaxed_input_section pointer.
569 (Output_section::Output_relaxed_input_section_by_input_section_map):
571 (Output_section::relaxed_input_section_map_): Change type to
572 Output_section::Output_relaxed_input_section_by_input_section_map.
573 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
576 2009-12-15 Ian Lance Taylor <iant@google.com>
578 * layout.cc (Layout::create_shstrtab): Only write out after input
579 sections if we are compressing debug sections.
581 2009-12-15 Ian Lance Taylor <iant@google.com>
583 * archive.cc (Archive::add_symbols): Only look up a symbol without
584 a version if there is, in fact, a version.
586 2009-12-14 Ian Lance Taylor <iant@google.com>
588 Revert -Wshadow changes, all changes from:
589 2009-12-11 Doug Kwan <dougkwan@google.com>
590 2009-12-11 Nick Clifton <nickc@redhat.com>
591 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
593 2009-12-11 Doug Kwan <dougkwan@google.com>
595 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
597 * attributes.cc (Object_attribute::size): Ditto.
598 (Attributes_section_data::size): Ditto.
599 (Attributes_section_data::Attributes_section_data): Ditto.
600 (Output_attributes_section_data::do_write): Ditto.
601 * attributes.h (Object_attribute::set_type): Ditto.
602 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
604 2009-12-11 Nick Clifton <nickc@redhat.com>
606 * archive.cc: Fix shadowed variable warnings.
608 * compressed_output.cc: Likewise.
609 * compressed_output.h: Likewise.
610 * configure: Likewise.
611 * dwarf_reader.cc: Likewise.
612 * dynobj.cc: Likewise.
613 * dynobj.h: Likewise.
614 * ehframe.cc: Likewise.
615 * ehframe.h: Likewise.
616 * errors.cc: Likewise.
617 * expression.cc: Likewise.
618 * fileread.cc: Likewise.
619 * fileread.h: Likewise.
620 * freebsd.h: Likewise.
623 * incremental.h: Likewise.
624 * layout.cc: Likewise.
625 * layout.h: Likewise.
626 * mapfile.cc: Likewise.
627 * merge.cc: Likewise.
629 * object.cc: Likewise.
630 * object.h: Likewise.
631 * options.h: Likewise.
632 * output.cc: Likewise.
633 * output.h: Likewise.
634 * parameters.cc: Likewise.
635 * plugin.cc: Likewise.
636 * powerpc.cc: Likewise.
637 * reduced_debug_output.cc: Likewise.
638 * reduced_debug_output.h: Likewise.
639 * reloc.cc: Likewise.
641 * resolve.cc: Likewise.
642 * script-sections.cc: Likewise.
643 * script.cc: Likewise.
644 * script.h: Likewise.
645 * sparc.cc: Likewise.
646 * symtab.cc: Likewise.
647 * symtab.h: Likewise.
648 * target-select.cc: Likewise.
649 * target-select.h: Likewise.
651 * workqueue.cc: Likewise.
652 * workqueue.h: Likewise.
653 * x86_64.cc: Likewise.
655 2009-12-10 Doug Kwan <dougkwan@google.com>
657 * arm.cc (attributes.h): New include.
658 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
659 (Arm_relobj::~Arm_relobj): Delete object pointed by
660 attributes_section_data_.
661 (Arm_relobj::attributes_section_data): New method definition.
662 (Arm_relobj::attributes_section_data_): New data member declaration.
663 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
664 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
665 attributes_section_data_.
666 (Arm_dynobj::attributes_section_data): New method definition.
667 (Arm_dynobj::attributes_section_data_): New data member declaration.
668 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
669 initialization value of may_use_blx_ to false.
670 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
671 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
672 object attributes to compute results instead of hard-coding.
673 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
674 Target_arm::get_secondary_compatible_arch,
675 Target_arm::set_secondary_compatible_arch
676 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
677 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
678 New method declarations.
679 (Target_arm::get_aeabi_object_attribute): New method definition.
680 (Target_arm::attributes_section_data_): New data member declaration.
681 (read_arm_attributes_section): New template definition.
682 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
683 (Arm_dynobj::do_read_symbols): Ditto.
684 (Target_arm::do_finalize_sections): Merge attributes sections from
685 input. Check for BLX use after attributes section merging.
686 Fix __exidx_start and __exidx_end visibility. Create an
687 .ARM.attributes section if necessary.
688 (Target_arm::get_secondary_compatible_arch,
689 Target_arm::set_secondary_compatible_arch,
690 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
691 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
692 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
693 New method definitions.
695 2009-12-09 Ian Lance Taylor <iant@google.com>
697 * plugin.cc (Plugin::load): Don't cast from void* to a function
700 2009-12-09 Ian Lance Taylor <iant@google.com>
702 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
705 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
707 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
708 Replace two_file_shared_1.so with two_file_shared_2.so.
709 * testsuite/Makefile.in: Regenerated.
711 2009-12-08 Doug Kwan <dougkwan@google.com>
713 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
714 (HFILES): Add attributes.h and int_encoding.h.
715 * Makefile.in: Regenerate.
716 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
717 function definitions to int_encoding.cc
718 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
719 prototypes to int_encoding.h
720 * reduced_debug_output.cc (int_encoding.h): New include.
721 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
722 function definitions to int_encoding.cc
723 (insert_into_vector, read_from_pointer): Move template definitions to
725 * attributes.cc: New file.
726 * attributes.h: New file.
727 * int_encoding.cc: New file.
728 * int_encoding.h: New file.
730 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
733 * incremental-dump.cc (dump_incremental_inputs): New.
734 (main): Use dump_incremental_inputs.
736 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
739 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
740 checking elfcpp::STT_FUNC.
741 (Target_i386::Relocate::relocate): Likewise.
742 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
744 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
745 symbols from shared libraries into normal FUNC symbols.
747 * symtab.h (Symbol): Add is_func and use it.
749 2009-12-05 Doug Kwan <dougkwan@google.com>
751 * arm.cc (Target_arm::arm_info): Initialize new fields
752 attributes_section and attributes_vendor.
753 * i386.cc (Target_i386::i386_info): Same.
754 * object.cc (Sized_relobj::do_layout): Skip attribute section.
755 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
756 fields attributes_section and attributes_vendor.
757 * sparc.cc (Target_sparc::sparc_info): Same.
758 * target.h (Target::attributes_section, Target::attributes_vendor,
759 Target::is_attributes_section, Target::attribute_arg_type,
760 Target::attributes_order): New method definitions.
761 (Target::Target_info::attributes_section,
762 Target::Target_info::attributes_vendor): New fields.
763 (Target::do_attribute_arg_type, Target::do_attributes_order): New
764 virtual method definitions.
765 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
766 attributes_section and attributes_vendor.
767 * testsuite/testfile.cc (Target_test::test_target_info): Same.
769 2009-12-05 Doug Kwan <dougkwan@google.com>
771 * arm.cc: Update comments about interworking and stub generation.
772 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
773 considered as non-PIC.
774 (Arm_relocate_functions::base_abs): Fix formatting.
775 (Arm_relocate_functions::got_prel): Fix comment. Change interface
776 of function to use GOT entry address instead of offset.
777 (Target_arm::Scan::global): Issue an error if a symbol would need a
778 PLT does not get one because it is untyped. Remove code to create
779 dynamic symbols for relative branches.
780 (Target_arm::Relocate::relocate: Use 0 instead of false since function
781 takes unsigned integer instead of boolean.
783 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
785 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
786 (two_file_test_LDADD): Likewise.
787 (common_test_1_LDADD): Likewise.
788 (exception_test_LDADD) Likewise.
789 (weak_test_LDADD): Likewise.
790 (many_sections_test_LDADD): Likewise.
791 (initpri1_LDADD): Likewise.
792 (script_test_1_LDADD): Likewise.
793 (script_test_2_LDADD): Likewise.
794 (justsyms_LDADD): Likewise.
795 (binary_test_LDADD): Likewise.
796 (large_LDADD): Likewise.
797 * testsuite/Makefile.in: Regenerated.
799 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
801 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
802 (Symbol_table::override_with_special): Likewise.
803 (Symbol_table::add_from_object): Likewise.
805 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
807 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
808 Don't set the data_offset twice.
810 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
812 * testsuite/Makefile.in: Regenerate.
814 2009-12-03 Doug Kwan <dougkwan@google.com>
816 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
817 (Target_arm::do_finalize_sections): Add parameter for symbol table
818 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
819 * i386.cc (Target_i386::do_finalize_sections): Add an additional
820 parameter for symbol table pointer.
821 * layout.cc (Layout::finalize): Call Target::finalize_sections with
822 an additional parameter for a pointer to symbol table.
823 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
824 parameter for a symbol table pointer.
825 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
826 * target.h (Target::finalize_sections, Target::do_finalize_sections):
828 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
829 parameter for a symbol table pointer.
831 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
833 * incremental.cc (Incremental_inputs_header)
834 (Incremental_inputs_header_write, Incremental_inputs_entry)
835 (Incremental_inputs_entry_write): Move ...
836 * incremental.h (Incremental_inputs_header)
837 (Incremental_inputs_header_write, Incremental_inputs_entry)
838 (Incremental_inputs_entry_write): here.
840 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
842 * incremental.cc (make_sized_incremental_binary): Set the target.
843 Error if it is incompatible.
844 * output.h (Output_file): Add filename method.
846 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
848 * incremental.cc (Incremental_inputs_entry): Remove unused argument
849 from the get_* methods.
851 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
853 * incremental-dump.cc (main): Check that the offeset of a script is 0.
854 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
855 Write 0 for the data_offset of scripts.
857 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
859 * testsuite/Makefile.am: Add the incremental_test.sh test.
860 * testsuite/incremental_test.sh: New.
861 * testsuite/incremental_test_1.c: New.
862 * testsuite/incremental_test_2.c: New.
864 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
866 * incremental-dump.cc (main): Fix typos.
868 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
871 * incremental-dump.cc (main): Use llu to print 64 bit values.
873 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
874 H.J. Lu <hongjiu.lu@intel.com>
876 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
878 (incremental_dump_LDADD): Likewise.
879 * Makefile.in: Regenerated.
881 2009-11-25 Doug Kwan <dougkwan@google.com>
885 2009-11-25 Doug Kwan <dougkwan@google.com>
887 * arm.cc (Target_arm::Target_arm): Move method definition
888 outside of class definition. Add code to handle
889 --target1-rel, --target1-abs and --target2= options.
890 (Target_arm::get_reloc_reloc_type): Change method to be
891 non-static and const.
892 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
893 New data member declaration.
894 (Target_arm::Scan::local, Target_arm::Scan::global,
895 Target_arm::Relocate::relocate,
896 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
897 Adjust call to Target_arm::get_real_reloc_type.
898 (Target_arm::get_real_reloc_type): Use command line options
899 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
900 * options.h (--target1-rel, --target1-abs, --target2): New
903 2009-11-25 Doug Kwan <dougkwan@google.com>
905 * arm.cc (Target_arm::Target_arm): Move method definition outside of
906 class definition. Add code to handle --target1-rel, --target1-abs
907 and --target2= options.
908 (Target_arm::get_reloc_reloc_type): Change method to be non-static
910 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
912 (Target_arm::Scan::local, Target_arm::Scan::global,
913 Target_arm::Relocate::relocate,
914 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
915 call to Target_arm::get_real_reloc_type.
916 (Target_arm::get_real_reloc_type): Use command line options to
917 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
918 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
921 2009-11-25 Doug Kwan <dougkwan@google.com>
923 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
924 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
925 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
927 (Arm_relocate_functions::thm_call): Replace body with a call to
928 Arm_relocate_functions::thumb_branch_common.
929 (Arm_relocate_functions::thm_jump24,
930 Arm_relocate_functions::thm_xpc22): New method definitions.
931 (Arm_relocate_functions::thumb_branch_common): New method definition.
932 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
934 (Target_arm::Relocate::relocate): Adjust call to thm_call.
935 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
937 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
939 * Makefile.am: Build incremental-dump
940 * Makefile.in: Regenerate.
941 * incremental-dump.cc: New.
942 * incremental.cc (Incremental_inputs_header_data,
943 Incremental_inputs_entry_data): Move to incremental.h
944 * incremental.h: (Incremental_inputs_header_data,
945 Incremental_inputs_entry_data): Move from incremental.cc
947 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
949 * incremental.cc (Incremental_inputs_header,
950 Incremental_inputs_header_write, Incremental_inputs_entry,
951 Incremental_inputs_entry_write): Add a typedef with the data type.
953 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
955 * incremental.cc (Incremental_inputs_header,
956 Incremental_inputs_header_write, Incremental_inputs_entry,
957 Incremental_inputs_entry_write): Update comment about which
958 type has the filed descriptions.
960 2009-11-15 Doug Kwan <dougkwan@google.com>
962 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
963 (Arm_relocate_functions::arm_branch_common): Change method defintion
964 in class definition to a method declaration and update list of formal
966 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
967 Arm_relocation_functions::jump24): Adjust call to
968 Arm_relocate_functions::arm_branch_common. Update list of formal
970 (Arm_relocate_functions::xpc25): New method definition.
971 (Arm_relocate_functions::arm_branch_common): Move method defintion
972 out from class definition. Use stubs for mode-switching and extending
974 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
975 specially. Change code to enable use of stubs in ARM branches.
977 2009-11-10 Doug Kwan <dougkwan@google.com>
979 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
980 in method declaration.
981 (Target_arm::relocate_stub): New method declaration.
982 (Target_arm::default_target): Change to return a pointer instead of
984 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
985 Target_arm::default_target.
986 (Arm_Relobj::do_relocate_sections): Remove options paramater in
988 (Target_arm::relocate_section): Adjust view.
989 (Target_arm::relocate_stub): New method definition.
991 2009-11-10 Doug Kwan <dougkwan@google.com>
993 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
995 * incremental.cc (open_incremental_binary): Initialized local
996 variables to avoid warnings.
997 * object.cc (make_elf_object): Ditto.
998 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1001 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
1004 * testsuite/plugin_test.c: Include "config.h".
1006 2009-11-09 Doug Kwan <dougkwan@google.com>
1008 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1009 (arm_symbol_value): Remove.
1010 (Arm_relocate_functions::arm_branch_common,
1011 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1012 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1013 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1014 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1015 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1016 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1017 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1018 Arm_relocate_functions::thm_mobw_abs_nc,
1019 Arm_relocate_functions::thm_mov_abs,
1020 Arm_relocate_functions::movw_prel_nc,
1021 Arm_relocate_functions::thm_movt_abs,
1022 Arm_relocate_functions::movt_prel,
1023 Arm_relocate_functions::thm_movw_prel_nc,
1024 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1025 (Target_arm::Relocate::relocate): Only decompose address into two
1026 parts if relocation type uses the thumb-bit and pass the actual
1027 bit instead of a flag indicating that the thumb-bit is used. Adjust
1028 calls to methods in Arm_relocate_functions for this change.
1030 2009-11-08 Ian Lance Taylor <iant@google.com>
1033 * reloc.cc: Instantiate
1034 Sized_relobj::initialize_input_to_output_maps and
1035 Sized_relobj:free_input_to_output_maps.
1037 2009-11-06 Ian Lance Taylor <iant@google.com>
1040 * defstd.cc (in_segment): Set only_if_ref true for "end".
1042 2009-11-06 Doug Kwan <dougkwan@google.com>
1044 * arm.cc (class Reloc_stub): Correct a comment.
1045 (Target_arm::Target_arm): Initialize arm_input_section_map_.
1046 (Target_arm::scan_section_for_stubs): New method declaration.
1047 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1048 Change methods from private to protected.
1049 (Target_arm::do_may_relax): New method definition.
1050 (Target_arm::do_relax, Target_arm::group_sections,
1051 Target_arm::scan_reloc_for_stub,
1052 Target_arm::scan_reloc_section_for_stubs): New method declarations.
1053 (Target_arm::arm_input_section_map_): New data member declaration.
1054 (Target_arm::scan_reloc_for_stub,
1055 Target_arm::scan_reloc_section_for_stubs,
1056 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1057 Target_arm::do_relax): New method definitions.
1059 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
1061 * configure.ac: Check for (struct stat)::st_mtim
1062 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1063 * config.in: Regenerate.
1064 * configure: Regenerate.
1066 2009-11-05 Ian Lance Taylor <iant@google.com>
1069 * output.cc (Output_segment::add_output_section): Add missing
1072 2009-11-04 Ian Lance Taylor <iant@google.com>
1075 * object.h (class Object): Add is_needed and set_is_needed
1076 methods. Add is_needed_ field. Make bool fields into bitfields.
1077 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1078 defined in a dynamic object and referenced by a regular object,
1079 set is_needed for the dynamic object.
1080 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1081 if the file is marked with as_needed and it is not needed.
1083 2009-11-04 Ian Lance Taylor <iant@google.com>
1086 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1087 tags if data is discarded by linker script.
1088 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1089 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1090 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1091 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1093 2009-11-04 Ian Lance Taylor <iant@google.com>
1095 * layout.cc (Layout::get_output_section): Add is_interp and
1096 is_dynamic_linker_section parameters. Change all callers.
1097 (Layout::choose_output_section): Likewise.
1098 (Layout::make_output_section): Likewise.
1099 (Layout::add_output_section_data): Add is_dynamic_linker_section
1100 parameter. Change all callers.
1101 * layout.h (class Layout): Update declarations.
1102 * output.h (class Output_section): Add is_interp, set_is_interp,
1103 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1104 Add is_interp_, is_dynamic_linker_section_ fields. Change
1105 generate_code_fills_at_write_ to a bitfield.
1106 * output.cc (Output_section::Output_sections): Initialize new
1108 (Output_segment::add_output_section): Add do_sort parameter.
1111 2009-11-03 Ian Lance Taylor <iant@google.com>
1114 * options.h (class General_options): Add --warn-common.
1115 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1116 merging two common symbols.
1117 (Symbol_table::should_override): Handle --warn-common when merging
1118 a common symbol with a defined symbol. Use report_resolve_problem
1119 for multiple definitions.
1120 (Symbol_table::report_resolve_problem): New function.
1121 * symtab.h (class Symbol_table): Declare report_resolve_problem.
1123 2009-11-03 Doug Kwan <dougkwan@google.com>
1125 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1127 (Target_arm::stub_factory): New method definition.
1128 (Target_arm::new_arm_input_section,
1129 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1130 Target_arm::reloc_uses_thumb_bit): New method declarations.
1131 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
1132 New type definitions.
1133 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1134 member declarations.
1135 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1136 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1137 New method definitions.
1139 2009-11-03 Ian Lance Taylor <iant@google.com>
1141 * options.h (class General_options): Add --warn_constructors.
1143 2009-11-03 Ian Lance Taylor <iant@google.com>
1146 * defstd.cc (in_section): Add entries for __rel_iplt_start,
1147 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1149 2009-11-03 Ian Lance Taylor <iant@google.com>
1152 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1153 --msgid-bugs-address.
1154 (install-pdf): New target.
1155 (install-data_yes): Look up one directory to find mkinstalldirs.
1157 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
1159 * po/Make-in (.po.gmo): Don't generate .gmo files in source
1162 2009-10-30 Doug Kwan <dougkwan@google.com>
1164 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1166 2009-10-30 Doug Kwan <dougkwan@google.com>
1168 * arm.cc (Stub_addend_reader): New struct template definition
1169 and partial specializations.
1170 (Stub_addend_reader::operator()): New method definition for a
1171 partially specialized template.
1173 2009-10-30 Doug Kwan <dougkwan@google.com>
1175 * arm.cc (Arm_relobj::processor_specific_flags): New method
1177 (Arm_relobj::do_read_symbols): New method declaration.
1178 (Arm_relobj::processor_specific_flags_): New data member declaration.
1179 (Arm_dynobj): New class definition.
1180 (Target_arm::do_finalize_sections): Add input_objects parameter.
1181 (Target_arm::do_adjust_elf_header): New method declaration.
1182 (Target_arm::are_eabi_versions_compatible,
1183 (Target_arm::merge_processor_specific_flags): New method declaration.
1184 (Target_arm::do_make_elf_object): New overloaded method definitions
1186 (Arm_relobj::do_read_symbols): New method definition.
1187 (Arm_dynobj::do_read_symbols): Ditto.
1188 (Target_arm::do_finalize_sections): Add input_objects parameters.
1189 Merge processor-specific flags from all input objects.
1190 (Target_arm::are_eabi_versions_compatible,
1191 Target_arm::merge_processor_specific_flags,
1192 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1193 New method definitions.
1194 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1195 Input_objects pointer type parameter.
1196 * layout.cc (Layout::finalize): Pass input objects to target's.
1197 finalize_sections function.
1198 * output.cc (Output_file_header::do_sized_write): Set ELF file
1199 header's processor-specific flags.
1200 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1201 Input_objects pointer type parameter.
1202 * sparc.cc (Target_sparc::do_finalize_sections): Same.
1203 * target.h (Input_objects): New forward class declaration.
1204 (Target::processor_specific_flags,
1205 Target::are_processor_specific_flags_sect): New method definitions.
1206 (Target::finalize_sections): Add input_objects parameter.
1207 (Target::Target): Initialize processor_specific_flags_ and
1208 are_processor_specific_flags_set_.
1209 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1211 (Target::set_processor_specific_flags): New method definition.
1212 (Target::processor_specific_flags_,
1213 Target::are_processor_specific_flags_set_): New data member
1215 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1216 Input_objects pointer type parameter.
1218 2009-10-30 Doug Kwan <dougkwan@google.com>
1220 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1222 2009-10-28 Ian Lance Taylor <iant@google.com>
1224 * object.h (class Relobj): Drop options parameter from
1225 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1226 do_scan_relocs, do_relocate. Change all callers.
1227 (class Sized_relobj): Drop options parameters from
1228 do_gc_process_relocs, do_scan_relocs, do_relocate,
1229 do_relocate_sections, relocate_sections, emit_relocs_scan,
1230 emit_relocs_scan_reltype. Change all callers.
1231 (struct Relocate_info): Remove options field and all references to
1233 * reloc.h (class Read_relocs): Remove options constructor
1234 parameter and options_ field. Change all callers.
1235 (class Gc_process_relocs, class Scan_relocs): Likewise.
1236 (class Relocate_task): Likewise.
1237 * target-reloc.h (scan_relocs): Remove options parameter. Change
1239 (scan_relocatable_relocs): Likewise.
1240 * target.h (class Sized_target): Remove options parameter from
1241 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
1243 * gc.h (gc_process_relocs): Remove options parameter. Change all
1245 * arm.cc: Update functions to remove options parameters.
1246 * i386.cc: Likewise.
1247 * powerpc.cc: Likewise.
1248 * sparc.cc: Likewise.
1249 * x86_64.cc: Likewise.
1250 * testsuite/testfile.cc: Likewise.
1252 2009-10-28 Doug Kwan <dougkwan@google.com>
1254 * arm.cc (Arm_relobj): New class definition.
1255 (Arm_relobj::scan_sections_for_stubs,
1256 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1257 New method definitions.
1259 2009-10-28 Cary Coutant <ccoutant@google.com>
1261 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1262 (Plugin::cleanup_done_): New member.
1263 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1264 (Plugin_manager::cleanup_done_): Remove.
1265 (Plugin_manager::add_input_file): Edit error message.
1266 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1267 (Plugin_manager::cleanup): Remove use of cleanup_done_.
1269 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
1271 * fileread.cc: (File_read::View::~View): Use the new
1272 data_ownership_ filed.
1273 (File_read::~File_read): Dispose the new whole_file_view_.
1274 (File_read::open): Mmap the whole file if needed.
1275 (File_read::open): Use whole_file_view_ instead of contents_.
1276 (File_read::find_view): Use whole_file_view_ if applicable.
1277 (File_read::do_read): Use whole_file_view_ instead of contents_.
1278 (File_read::make_view): Use whole_file_view_ instead of contents_,
1279 update File_read::View::View call.
1280 (File_read::find_or_make_view): Update File_read::View::View
1282 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1284 (File_read::View::Data_ownership): New enum.
1285 (File_read::View::View): Replace bool mapped_ with Data_ownership
1287 (File_read::View::mapped_): Remove (replaced by data_ownership_).
1288 (File_read::View::data_ownership_): New field.
1289 (File_read::contents_): Remove (replaced by whole_file_view_).
1290 (File_read::whole_file_view_): New field.
1291 * options.h (class General_options): Add --keep-files-mapped.
1293 2009-10-27 Cary Coutant <ccoutant@google.com>
1295 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1296 * testsuite/Makefile.am (plugin_test_5): New test case.
1297 * testsuite/Makefile.in: Regenerate.
1299 2009-10-25 Doug Kwan <dougkwan@google.com>
1301 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1302 from private to protected to allow access by child class.
1303 (Sized_relobj::do_relocate_sections): New method declaration.
1304 (Sized_relobj::relocate_sections): Virtualize.
1305 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
1306 Sized_relobj::relocate_sections. Instantiate template explicitly
1307 for different target sizes and endianity.
1309 2009-10-24 Doug Kwan <dougkwan@google.com>
1311 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1312 (Arm_input_section::as_arm_input_section): New method.
1313 (Arm_output_section): New class definition.
1314 (Arm_output_section::create_stub_group,
1315 Arm_output_section::group_sections): New method definitions.
1317 2009-10-22 Doug Kwan <dougkwan@google.com>
1319 * arm.cc (Arm_input_section): New class definition.
1320 (Arm_input_section::init, Arm_input_section:do_write,
1321 Arm_input_section::set_final_data_size,
1322 Arm_input_section::do_reset_address_and_file_offset): New method
1325 2009-10-21 Doug Kwan <dougkwan@google.com>
1327 * arm.cc (Stub_table, Arm_input_section): New forward class
1329 (Stub_table): New class defintion.
1330 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1331 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1332 New method definition.
1334 2009-10-21 Doug Kwan <dougkwan@google.com>
1336 * arm.cc: Update copyright comments.
1337 (Target_arm): New forward class template declaration.
1338 (Arm_address): New type.
1339 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1340 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1341 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1343 (Insn_template): Same.
1344 (DEF_STUBS): New macro.
1345 (Stub_type): New enum type.
1346 (Stub_template): New class definition.
1349 (Stub_factory): Same.
1350 (Target_arm::Target_arm): Initialize may_use_blx_ and
1351 should_force_pic_veneer_.
1352 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1353 Target_arm::should_force_pic_veneer,
1354 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1355 Target_arm::using_thumb_only, Target_arm:;default_target): New
1357 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1358 New data member declarations.
1359 (Insn_template::size, Insn_template::alignment): New method defintions.
1360 (Stub_template::Stub_template): New method definition.
1361 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1362 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1363 (Stub_factory::Stub_factory): New method definition.
1364 * gold.h (string_hash): New template.
1365 * output.h (Input_section_specifier::hash_value): Use
1367 (Input_section_specifier::string_hash): Remove.
1368 * stringpool.cc (Stringpool_template::string_hash): Use
1371 2009-10-20 Doug Kwan <dougkwan@google.com>
1373 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1374 symbols of relaxed input sections.
1375 * output.h (Output_section::find_relaxed_input_section): Make
1378 2009-10-16 Doug Kwan <dougkwan@google.com>
1380 * dynobj.cc (Versions::Versions): Initialize version_script_.
1381 Only insert base version symbol definition for a shared object
1382 if version script defines any version versions.
1383 (Versions::define_base_version): New method definition.
1384 (Versions::add_def): Check that base version is not needed.
1385 (Versions::add_need): Define base version lazily.
1386 * dynobj.h (Versions::define_base_version): New method declaration.
1387 (Versions::needs_base_version_): New data member declaration.
1388 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1389 (check_DATA): Add no_version_test.stdout.
1390 (libno_version_test.so, no_version_test.o no_version_test.stdout):
1392 * testsuite/Makefile.in: Regenerate.
1393 * testsuite/no_version_test.c: New file.
1394 * testsuite/no_version_test.sh: Ditto.
1396 2009-10-16 Doug Kwan <dougkwan@google.com>
1398 * expression.cc (class Segment_start_expression): New class definition.
1399 (Segment_start_expression::value): New method definition.
1400 (script_exp_function_segment_start): Return a new
1401 Segment_start_expression.
1402 * gold/script-c.h (script_saw_segment_start_expression): New function
1404 * script-sections.cc (Script_sections::Script_sections): Initialize
1405 SAW_SEGMENT_START_EXPRESSION_ to false.
1406 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1407 and -Tbbs options to specify section addresses if given in
1408 command line and no SEGMENT_START expression is seen in a script.
1409 * script-sections.h (Script_sections::saw_segment_start_expression,
1410 Script_sections::set_saw_segment_start_expression): New method
1412 (Script_sections::saw_segment_start_expression_): New data member
1414 * script.cc (script_saw_segment_start_expression): New function.
1415 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1416 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1417 script_test_7.sh and script_test_8.sh.
1418 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1419 script_test_8.stdout.
1420 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1421 (script_test_6, script_test_6.stdout, script_test_7,
1422 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1423 * Makefile.in: Regenerate.
1424 * testsuite/script_test_6.sh: New file.
1425 * testsuite/script_test_6.t: Same.
1426 * testsuite/script_test_7.sh: Same.
1427 * testsuite/script_test_7.t: Same.
1428 * testsuite/script_test_8.sh: Same.
1430 2009-10-16 Doug Kwan <dougkwan@google.com>
1432 * output.cc (Output_segment::set_section_list_address): Cast
1433 expressions to unsigned long long type to avoid format warnings.
1435 2009-10-15 Ian Lance Taylor <iant@google.com>
1437 * script.cc (Script_options::add_symbol_assignment): Always add a
1438 dot assignment to script_sections_.
1439 * script-sections.cc (Script_sections::add_dot_assignment):
1440 Initialize if necessary.
1442 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1443 program headers with no load segment if there is a linker script.
1445 * layout.cc (Layout::set_segment_offsets): Align the file offset
1446 to the segment aligment for -N or -n with no load segment.
1447 * output.cc (Output_segment::add_output_section): Don't crash if
1448 the first section is a TLS section.
1449 (Output_segment::set_section_list_addresses): Print an error
1450 message if the address moves backward in a linker script.
1451 * script-sections.cc
1452 (Output_section_element_input::set_section_addresses): Don't
1453 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1454 (Orphan_output_section::set_section_addresses): Likewise.
1456 2009-10-15 Doug Kwan <dougkwan@google.com>
1458 * layout.cc (Layout::finish_dynamic_section): Generate tags
1459 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1460 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1461 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1463 2009-10-14 Ian Lance Taylor <iant@google.com>
1465 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1467 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1468 data_shdr fields of relinfo.
1469 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1470 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
1471 R_386_TLS_LDO_32, adjust based on section flags.
1472 (Target_i386::Relocate::fix_up_ldo): Remove.
1474 2009-10-13 Ian Lance Taylor <iant@google.com>
1476 Add support for -pie.
1477 * options.h (class General_options): Add -pie and
1479 (General_options::output_is_position_independent): Test -pie.
1480 (General_options::output_is_executable): Return true if not shared
1481 and not relocatable.
1482 (General_options::output_is_pie): Remove.
1483 * options.cc (General_options::finalize): Reject incompatible uses
1485 * gold.cc (queue_middle_tasks): A -pie link is not static.
1486 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1487 * symtab.cc (Symbol::final_value_is_known): Return false if
1488 output_is_position_independent.
1489 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1490 output_is_position_independent.
1491 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1492 output_is_position_independent.
1493 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1494 output_is_position_independent.
1495 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1497 (basic_pie_test.o, basic_pie_test): New targets.
1498 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1499 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1500 (two_file_pie_test): New target.
1501 * testsuite/Makefile.in: Rebuild.
1502 * README: Remove note saying that -pie is not supported.
1504 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
1506 * options.h (class General_options): Add -init and -fini.
1507 * layout.cc (Layout::finish_dynamic_section): Emit
1508 given init and fini functions.
1510 2009-10-13 Sriraman Tallam <tmsriram@google.com>
1512 * gc.h (gc_process_relocs): Check if icf is enabled using new
1514 * gold.cc (queue_initial_tasks): Likewise.
1515 (queue_middle_tasks): Likewise.
1516 * object.cc (do_layout): Likewise.
1517 * symtab.cc (is_section_folded): Likewise.
1518 * main.cc (main): Likewise.
1519 * reloc.cc (Read_relocs::run): Likewise.
1520 (Sized_relobj::do_scan_relocs): Likewise.
1521 * icf.cc (is_function_ctor_or_dtor): New function.
1522 (Icf::find_identical_sections): Check if function is ctor or dtor when
1524 * options.h (General_options::icf): Change option to be an enum.
1525 (Icf_status): New enum.
1526 (icf_enabled): New method.
1527 (icf_safe_folding): New method.
1528 (set_icf_status): New method.
1529 (icf_status_): New variable.
1530 * (options.cc) (General_options::finalize): Set icf_status_.
1531 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
1532 icf_test and icf_keep_unique_test to use the --icf enum flag.
1533 * testsuite/icf_safe_test.sh: New file.
1534 * testsuite/icf_safe_test.cc: New file.
1536 2009-10-12 Sriraman Tallam <tmsriram@google.com>
1538 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
1539 includes to gc.h and icf.h.
1540 * arm.cc: Include gc.h.
1541 * gold.cc: Likewise.
1542 * i386.cc: Likewise.
1543 * powerpc.cc: Likewise.
1544 * sparc.cc: Likewise.
1545 * x86_64.cc: Likewise.
1546 * gc.h: Include icf.h.
1548 2009-10-11 Ian Lance Taylor <iant@google.com>
1550 * plugin.cc: Include "gold.h" before other header files.
1552 2009-10-10 Chris Demetriou <cgd@google.com>
1554 * options.h (Input_file_argument::Input_file_type): New enum.
1555 (Input_file_argument::is_lib_): Replace with...
1556 (Input_file_argument::type_): New member.
1557 (Input_file_argument::Input_file_argument): Take Input_file_type
1558 'type' rather than boolean 'is_lib' as second argument.
1559 (Input_file_argument::is_lib): Use type_.
1560 (Input_file_argument::is_searched_file): New function.
1561 (Input_file_argument::may_need_search): Handle is_searched_file.
1562 * options.cc (General_options::parse_library): Support -l:filename.
1563 (General_options::parse_just_symbols): Update for Input_file_argument
1565 (Command_line::process): Likewise.
1566 * archive.cc (Archive::get_file_and_offset): Likewise.
1567 * plugin.cc (Plugin_manager::release_input_file): Likewise.
1568 * script.cc (read_script_file, script_add_file): Likewise.
1569 * fileread.cc (Input_file::Input_file): Likewise.
1570 (Input_file::will_search_for): Handle is_searched_file.
1571 (Input_file::open): Likewise.
1572 * readsyms.cc (Read_symbols::get_name): Likewise.
1573 * testsuite/Makefile.am (searched_file_test): New test.
1574 * testsuite/Makefile.in: Regenerate.
1575 * testsuite/searched_file_test.cc: New file.
1576 * testsuite/searched_file_test_lib.cc: New file.
1578 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1579 Ian Lance Taylor <iant@google.com>
1581 * descriptor.cc: Include <cstdio> and "binary-io.h".
1582 (Descriptors::open): Open the files in binary mode always.
1583 * script.cc (Lex::get_token): Treat \r as whitespace.
1585 2009-10-09 Ian Lance Taylor <iant@google.com>
1587 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1589 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1590 Ian Lance Taylor <iant@google.com>
1592 * configure.ac: Check for readv function also.
1593 * fileread.cc (readv): Define if not HAVE_READV.
1594 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1596 * config.in: Regenerate.
1597 * configure: Regenerate.
1599 2009-10-09 Doug Kwan <dougkwan@google.com>
1601 * layout.cc (Layout::make_output_section): Call target hook to make
1602 ordinary output section.
1603 (Layout::finalize): Adjust parameter list of call the
1604 Target::may_relax().
1605 * layout.h (class Layout::section_list): New method.
1606 * merge.h (Output_merge_base::entsize): Change visibility to public.
1607 (Output_merge_base::is_string, Output_merge_base::do_is_string):
1609 (Output_merge_string::do_is_string): New method.
1610 * object.cc (Sized_relobj::do_setup): renamed from
1611 Sized_relobj::set_up.
1612 * object.h (Sized_relobj::adjust_shndx,
1613 Sized_relobj::initializ_input_to_output_maps,
1614 Sized_relobj::free_input_to_output_maps): Change visibilities to
1616 (Sized_relobj::setup): Virtualize.
1617 (Sized_relobj::do_setup): New method declaration.
1618 (Sized_relobj::invalidate_section_offset,
1619 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
1620 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
1621 * options.cc (parse_int): New function.
1622 * options.h (parse_int): New declaration.
1623 (DEFINE_int): New macro.
1624 (stub_group_size): New option.
1625 * output.cc (Output_section::Output_section): Initialize memebers
1626 merge_section_map_, merge_section_by_properties_map_,
1627 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
1628 (Output_section::add_input_section): Handled deferred code-fill
1629 generation and remove an old comment.
1630 (Output_section::add_relaxed_input_section): New method definition.
1631 (Output_section::add_merge_input_section): Use merge section by
1632 properties map to speed to search. Update merge section maps
1634 (Output_section::build_relaxation_map): New method definition.
1635 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1637 (Output_section::relax_input_section): Renamed to
1638 Output_section::convert_input_sections_to_relaxed_sections and change
1639 interface to take a vector of pointers to relaxed sections.
1640 (Output_section::find_merge_section,
1641 Output_section::find_relaxed_input_section): New method definitions.
1642 (Output_section::is_input_address_mapped,
1643 Output_section::output_offset, Output_section::output_address):
1644 Use output section data maps to speed up searching.
1645 (Output_section::find_starting_output_address): Add comments.
1646 (Output_section::do_write,
1647 Output_section::write_to_postprocessing_buffer): Do code-fill
1648 generation as appropriate.
1649 (Output_section::get_input_sections): Invalidate relaxed input section
1651 (Output_section::restore_states): Adjust type of checkpoint .
1652 Invalidate relaxed input section map.
1653 * output.h (Output_merge_base): New class declaration.
1654 (Input_section_specifier): New class defintion.
1655 (class Output_relaxed_input_section) Change base class to
1656 Output_section_data_build.
1657 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1658 base class initializer.
1659 (Output_section::add_relaxed_input_section): New method declaration.
1660 (Output_section::Input_section): Change visibility to protected.
1661 (Output_section::Input_section::relobj,
1662 Output_section::Input_section::shndx): Handle relaxed input sections.
1663 Output_section::input_sections) Change visibility to protected. Also
1664 define overload to return a non-const pointer.
1665 (Output_section::Merge_section_properties): New class defintion.
1666 (Output_section::Merge_section_by_properties_map,
1667 Output_section::Output_section_data_by_input_section_map,
1668 Output_section::Relaxation_map): New types.
1669 (Output_section::relax_input_section): Rename method to
1670 Output_section::convert_input_sections_to_relaxed_sections and change
1671 interface to take a vector of relaxed section pointers.
1672 (Output_section::find_merge_section,
1673 Output_section::find_relaxed_input_section,
1674 Output_section::build_relaxation_map,
1675 Output_section::convert_input_sections_in_list_to_relaxed_sections):
1676 New method declarations.
1677 (Output_section::merge_section_map_
1678 Output_section::merge_section_by_properties_map_,
1679 Output_section::relaxed_input_section_map_,
1680 Output_section::is_relaxed_input_section_map_valid_,
1681 Output_section::generate_code_fills_at_write_): New data members.
1682 * script-sections.cc
1683 (Output_section_element_input::set_section_addresses): Call
1684 current_data_size and addralign methods of relaxed input sections.
1685 (Orphan_output_section::set_section_addresses): Call current_data_size
1686 and addralign methods of relaxed input sections.
1687 * symtab.cc (Symbol_table::compute_final_value): Extract template
1688 from the body of Symbol_table::sized_finalize_symbol.
1689 (Symbol_table::sized_finalized_symbol): Call
1690 Symbol_table::compute_final_value.
1691 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1692 (Symbol_table::compute_final_value): New templated method declaration.
1693 * target.cc (Target::do_make_output_section): New method defintion.
1694 * target.h (Target::make_output_section): New method declaration.
1695 (Target::relax): Add more parameters for input objects, symbol table
1696 and layout. Adjust call to do_relax.
1697 (Target::do_make_output_section): New method declaration.
1698 (Target::do_relax): Add parameters for input objects, symbol table
1701 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1703 * pread.c: Include stdio.h.
1705 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1707 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1710 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
1712 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1713 Change read_shndx type to unsigned int.
1714 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1716 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1717 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1718 Change read_shndx type to unsigned int.
1719 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1721 (Sized_dwarf_line_info::read_line_mappings): Likewise.
1722 * layout.cc (Layout::create_symtab_sections): Cast the result of
1723 local_symcount * symsize to off_t in the gold_assert.
1725 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1727 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1728 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1730 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1731 (Arm_relocate_functions::thm_abs5): New function.
1732 (Arm_relocate_functions::abs12): New function.
1733 (Arm_relocate_functions::abs16): New function.
1734 (Arm_relocate_functions::base_abs): New function.
1735 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1736 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
1737 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1739 (Scan::global): Likewise.
1740 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1741 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1742 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1743 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1746 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1748 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1749 (Arm_relocate_functions::movt_prel): New function.
1750 (Arm_relocate_functions::thm_movw_prel_nc): New function.
1751 (Arm_relocate_functions::thm_movt_prel): New function.
1752 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1753 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1754 (Scan::global, Relocate::relocate): Likewise.
1755 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1757 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1759 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1760 Incremental_checker.
1761 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1763 (class Incremental_inputs_header): New class.
1764 (Incremental_inputs_header_writer): Edit comment.
1765 (Incremental_inputs_entry): New class.
1766 (Incremental_inputs_entry_writer): Edit comment.
1767 (Sized_incremental_binary::do_find_incremental_inputs_section):
1768 Add *strtab_shndx parameter, fill it.
1769 (Sized_incremental_binary::do_check_inputs): New method.
1770 (Incremental_checker::can_incrementally_link_output_file): Use
1771 Sized_incremental_binary::check_inputs.
1772 (Incremental_inputs::report_command_line): Save command line in
1775 (Incremental_binary::find_incremental_inputs_section): New
1777 (Incremental_binary::do_find_incremental_inputs_section): Add
1778 strtab_shndx parameter.
1779 (Incremental_binary::do_check_inputs): New pure virtual method.
1780 (Sized_incremental_binary::do_check_inputs): Declare.
1781 (Incremental_checker::Incremental_checker): Add incremental_inputs
1782 parameter, use it to initialize incremental_inputs_.
1783 (Incremental_checker::incremental_inputs_): New field.
1784 (Incremental_checker::command_line): New method.
1785 (Incremental_checker::inputs): New method.
1786 (Incremental_checker::command_line_): New field.
1788 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
1790 * incremental.cc: Include <cstdarg> and "target-select.h".
1791 (vexplain_no_incremental): New function.
1792 (explain_no_incremental): New function.
1793 (Incremental_binary::error): New method.
1794 (Sized_incremental_binary::do_find_incremental_inputs_section): New
1796 (make_sized_incremental_binary): New function.
1797 (open_incremental_binary): New function.
1798 (can_incrementally_link_file): Add checks if output is ELF and has
1800 * incremental.h: Include "elfcpp_file.h" and "output.h".
1801 (Incremental_binary): New class.
1802 (Sized_incremental_binary): New class.
1803 (open_incremental_binary): Declare.
1804 * object.cc (is_elf_object): Use
1805 elfcpp::Elf_recognizer::is_elf_file.
1806 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
1807 * output.h (Output_file::filesize): New method.
1809 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1811 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
1813 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
1814 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
1816 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
1818 (Arm_relocate_functions::movw_abs_nc): New function.
1819 (Arm_relocate_functions::movt_abs): New function.
1820 (Arm_relocate_functions::thm_movw_abs_nc): New function.
1821 (Arm_relocate_functions::thm_movt_abs): New function.
1822 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
1823 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
1824 (Scan::global): Likewise.
1825 (Relocate::relocate): Likewise.
1826 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1828 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1830 * arm.cc (Arm_relocate_functions::got_prel) New function.
1831 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
1832 (Relocate::relocate): Likewise.
1833 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1835 2009-10-06 Ian Lance Taylor <iant@google.com>
1837 * options.h (class General_options): Define
1838 split_stack_adjust_size parameter.
1839 * object.h (class Object): Add uses_split_stack_ and
1840 has_no_split_stack_ fields. Add uses_split_stack and
1841 has_no_split_stack accessor functions. Declare
1842 handle_split_stack_section.
1843 (class Reloc_symbol_changes): Define.
1844 (class Sized_relobj): Define Function_offsets. Declare
1845 split_stack_adjust, split_stack_adjust_reltype, and
1847 * object.cc (Object::handle_split_stack_section): New function.
1848 (Sized_relobj::do_layout): Call handle_split_stack_section.
1849 * dynobj.cc (Sized_dynobj::do_layout): Call
1850 handle_split_stack_section.
1851 * reloc.cc (Sized_relobj::relocate_sections): Call
1852 split_stack_adjust for executable sections in split_stack
1853 objects. Pass reloc_map to relocate_section.
1854 (Sized_relobj::split_stack_adjust): New function.
1855 (Sized_relobj::split_stack_adjust_reltype): New function.
1856 (Sized_relobj::find_functions): New function.
1857 * target-reloc.h: Include "object.h".
1858 (relocate_section): Add reloc_symbol_changes parameter. Change
1860 * target.h (class Target): Add calls_non_split method. Declare
1861 do_calls_non_split virtual method. Declare match_view and
1863 * target.cc: Include "elfcpp.h".
1864 (Target::do_calls_non_split): New function.
1865 (Target::match_view): New function.
1866 (Target::set_view_to_nop): New function.
1867 * gold.cc (queue_middle_tasks): Give an error if mixing
1868 split-stack and non-split-stack objects with -r.
1869 * i386.cc (Target_i386::relocate_section): Add
1870 reloc_symbol_changes parameter.
1871 (Target_i386::do_calls_non_split): New function.
1872 * x86_64.cc (Target_x86_64::relocate_section): Add
1873 reloc_symbol_changes parameter.
1874 (Target_x86_64::do_calls_non_split): New function.
1875 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
1877 * powerpc.cc (Target_powerpc::relocate_section): Add
1878 reloc_symbol_changes parameter.
1879 * sparc.cc (Target_sparc::relocate_section): Add
1880 reloc_symbol_changes parameter.
1881 * configure.ac: Call AM_CONDITIONAL for the default target.
1882 * configure: Rebuild.
1883 * testsuite/Makefile.am (TEST_AS): New variable.
1884 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
1885 (check_DATA): Add split_i386 and split_x86_64 files.
1886 (SPLIT_DEFSYMS): Define.
1887 (split_i386_[1234n].o): New targets.
1888 (split_i386_[124]): New targets.
1889 (split_i386_[1234r].stdout): New targets.
1890 (split_x86_64_[1234n].o): New targets.
1891 (split_x86_64_[124]): New targets.
1892 (split_x86_64_[1234r].stdout): New targets.
1893 (MOSTLYCLEANFILES): Add new executables.
1894 * testsuite/split_i386.sh: New file.
1895 * testsuite/split_x86_64.sh: New file.
1896 * testsuite/split_i386_1.s: New file.
1897 * testsuite/split_i386_2.s: New file.
1898 * testsuite/split_i386_3.s: New file.
1899 * testsuite/split_i386_4.s: New file.
1900 * testsuite/split_i386_n.s: New file.
1901 * testsuite/split_x86_64_1.s: New file.
1902 * testsuite/split_x86_64_2.s: New file.
1903 * testsuite/split_x86_64_3.s: New file.
1904 * testsuite/split_x86_64_4.s: New file.
1905 * testsuite/split_x86_64_n.s: New file.
1906 * testsuite/testfile.cc (Target_test): Update relocation_section
1908 * testsuite/Makefile.in: Rebuild.
1910 2009-10-06 Ian Lance Taylor <iant@google.com>
1912 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
1913 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
1914 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
1915 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
1916 the address on ldo_addrs_.
1917 (Target_i386::Relocate::fix_up_ldo): New function.
1919 2009-10-06 Rafael Espindola <espindola@google.com>
1921 * plugin.cc (add_input_library): New.
1922 (Plugin::load): Add add_input_library to tv.
1923 (Plugin_manager::add_input_file): Add the is_lib argument.
1924 (add_input_file): Update call to Plugin_manager::add_input_file.
1925 (add_input_library): New.
1926 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
1928 2009-09-30 Doug Kwan <dougkwan@google.com>
1930 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
1931 symbol and call Symbol::may_need_copy_reloc to determine if
1932 a copy reloc is needed.
1933 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
1934 nocopyreloc is given in command line.
1935 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
1936 given in command line.
1937 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
1938 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
1939 of the removed Target_i386::may_need_copy_reloc.
1940 * options.h (copyreloc): New option with default value false.
1941 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1942 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
1943 instead of the removed Target_powerpc::may_need_copy_reloc.
1944 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
1945 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
1946 instead of the removed Target_sparc::may_need_copy_reloc.
1947 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
1948 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
1949 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
1950 instead of the removed Target_x86_64::may_need_copy_reloc.
1952 2009-09-30 Ian Lance Taylor <iant@google.com>
1954 * object.h (class Object): Remove target_ field, and target,
1955 sized_target, and set_target methods.
1956 (Object::sized_target): Remove.
1957 (class Sized_relobj): Update declarations. Remove sized_target.
1958 * object.cc (Sized_relobj::setup): Remove target parameter.
1960 (Input_objects::add_object): Don't do anything with the target.
1961 (make_elf_sized_object): Add punconfigured parameter. Change all
1962 callers. Set or test parameter target.
1963 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
1965 * parameters.cc (Parameters::set_target): Change parameter type to
1967 (Parameters::default_target): Remove.
1968 (set_parameters_target): Change parameter type to be non-const.
1969 (parameters_force_valid_target): New function.
1970 (parameters_clear_target): New function.
1971 * parameters.h (class Parameters): Update declarations. Remove
1972 default_target method. Add sized_target and clear_target
1973 methods. Change target_ to be non-const.
1974 (set_parameters_target): Update declaration.
1975 (parameters_force_valid_target): Declare.
1976 (parameters_clear_target): Declare.
1977 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
1978 as NULL if we aren't searching.
1979 (Add_symbols::run): Don't check for compatible target.
1980 * fileread.cc (Input_file::open_binary): Call
1981 parameters_force_valid_target.
1982 * gold.cc (queue_middle_tasks): Likewise.
1983 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
1984 set_target on object.
1985 * dynobj.h (class Sized_dynobj): Update declarations.
1986 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
1987 make_elf_object returns NULL.
1988 (Archive::include_member): Don't check whether object target is
1990 * output.cc (Output_section::add_input_section): Get target from
1992 (Output_section::relax_input_section): Likewise.
1993 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
1995 (Sized_relobj::do_scan_relocs): Likewise.
1996 (Sized_relobj::relocate_sections): Likewise.
1997 * resolve.cc (Symbol_table::resolve): Likewise.
1998 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
1999 parameter. Change all callers.
2000 (Symbol_table::add_from_object): Get target from parameters.
2001 (Symbol_table::add_from_relobj): Don't check object target.
2002 (Symbol_table::add_from_dynobj): Likewise.
2003 (Symbol_table::define_special_symbol): Get target from
2005 * symtab.h (class Symbol_table): Update declaration.
2006 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2007 parameter. Change all callers. Clear parameter target.
2008 (Binary_test): Test target here.
2009 * testsuite/object_unittest.cc (gold_testsuite): Remove
2010 target_test_pointer parameter. Change all callers.
2011 (Object_test): Test target here.
2013 2009-09-26 Ian Lance Taylor <iant@google.com>
2015 * testsuite/initpri1.c: Don't try to use constructor priorities if
2016 compiling with gcc before 4.3.
2018 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
2020 * testsuite/retain_symbols_file_test.sh (check_present): Change
2021 output file name to retain_symbols_file_test.stdout.
2022 (check_absent): Likewise.
2024 2009-09-18 Craig Silverstein <csilvers@google.com>
2026 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2027 * options.cc: Include <cerrno> and <fstream>.
2028 (General_options::finalize): Parse -retain-symbols-file tag.
2029 * options.h: New flag.
2030 (General_options): New method should_retain_symbol, new
2031 variable symbols_to_retain.
2032 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2033 should_retain_symbol map.
2034 * testsuite/Makefile.am (retain_symbols_file_test): New test.
2035 * testsuite/Makefile.in: Regenerate.
2036 * testsuite/retain_symbols_file_test.sh: New file.
2038 2009-09-18 Nick Clifton <nickc@redhat.com>
2040 * po/es.po: Updated Spanish translation.
2042 2009-09-17 Doug Kwan <dougkwan@google.com>
2044 * debug.h (DEBUG_RELAXATION): New constant.
2045 (DEBUG_ALL): Add DEBUG_RELAXATION.
2046 (debug_string_to_enum): Add relaxation debug option.
2048 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2049 Layout::Relaxation_debug_check::read_sections,
2050 Layout::Relaxation_debug_check::read_sections): New method definitions.
2051 (Layout::Layout): Initialize data members
2052 record_output_section_data_from_scrips_,
2053 script_output_section_data_list_ and relaxation_debug_check_.
2054 (Layout::save_segments, Layout::restore_segments,
2055 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2056 Layout::relaxation_loop_body): New method definitions.
2057 (Layout::finalize): Support relaxation. Move section layout code to
2058 Layout::relaxation_loop_body.
2059 (Layout::set_asection_address_from_script): Move code for orphan
2060 section placement out.
2061 (Layout::place_orphan_sections_in_script): New method definition.
2062 * layout.h (Output_segment_headers, Output_file_header):
2063 New forward class declarations.
2064 (Layout::~Layout): Define.
2065 (Layout::new_output_section_data_from_script): New method definition.
2066 (Layout::place_orphan_sections_in_script): New method declaration.
2067 (Layout::Segment_states): New type declaration.
2068 (Layout::save_segments, Layout::restore_segments,
2069 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2070 Layout::relaxation_loop_body): New method declarations.
2071 (Layout::Output_section_data_list): New type declaration.
2072 (Layout::Relaxation_debug_check): New class definition.
2073 (Layout::record_output_section_data_from_script_,
2074 Layout::script_output_section_data_list_, Layout::segment_states_,
2075 Layout::relaxation_debug_check_): New data members.
2076 * output.cc: (Output_section_headers::do_size): New method definition.
2077 (Output_section_headers::Output_section_headers): Move size
2078 computation to Output_section_headers::do_size.
2079 (Output_segment_headers::do_size): New method definition.
2080 (Output_file_header::Output_file_header): Move size computation to
2081 Output_file_header::do_size and call it.
2082 (Output_file_header::do_size): New method definition.
2083 (Output_data_group::Output_data_group): Adjust call to
2084 Output_section_data.
2085 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2086 (Output_symtab_xindex::do_write): Add array bound check.
2087 (Output_section::Input_section::print_to_mapfile): Handle
2088 RELAXED_INPUT_SECTION_CODE.
2089 (Output_section::Output_section): Initialize data member checkpoint_.
2090 (Output_section::~Output_section): Delete checkpoint object pointed
2092 (Output_section::add_input_section): Always add an Input_section if
2094 (Output_section::add_merge_input_section): Add assert.
2095 (Output_section::relax_input_section): New method definition.
2096 (Output_section::set_final_data_size): Set load address to zero for
2097 an unallocated section.
2098 (Output_section::do_address_and_file_offset_have_reset_values):
2099 New method definition.
2100 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2101 Handle relaxed input section.
2102 (Output_section::sort_attached_input_sections): Checkpoint input
2103 section list lazily.
2104 (Output_section::get_input_sections): Change type of input_sections to
2105 list of Simple_input_section pointers. Checkpoint input section list
2106 lazily. Also handle relaxed input sections.
2107 (Output_section::add_input_section_for_script): Take a reference to
2108 a Simple_input_section object instead of Relobj pointer and section
2109 index as parameter. Handle relaxed input sections.
2110 (Output_section::save_states, Output_section::restore_states): New
2112 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2113 (Output_data::is_data_size_fixed): New method definition.
2114 (Output_data::reset_addresss_and_file_offset): Do not reset data size
2116 (Output_data::address_and_file_offset_have_reset_values): New method
2118 (Output_data::do_address_and_file_offset_have_reset_values): New method
2120 (Output_data::set_data_size): Check that data size is not fixed.
2121 (Output_data::fix_data_size): New method definition.
2122 (Output_data::is_data_size_fixed_): New data member.
2123 (Output_section_headers::set_final_data_size): New method definition.
2124 (Output_section_headers::do_size): New method declaration.
2125 (Output_segment_headers::set_final_data_size): New method definition.
2126 (Output_segment_headers::do_size): New method declaration.
2127 (Output_file_header::set_final_data_size)::New method definition.
2128 (Output_file_header::do_size)::New method declaration.
2129 (Output_section_data::Output_section_data): Add new parameter
2130 is_data_size_fixed and use it to fix data size.
2131 (Output_data_const::Output_data_const): Adjust call to base class
2132 constructor and fix data size.
2133 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2134 base class constructor and fix data size.
2135 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2136 base class constructor and fix data size.
2137 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2138 class constructor and fix data size.
2139 (Output_data_group::set_final_data_size): New method definition.
2140 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2141 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2142 class constructor and fix data size.
2143 (Output_relaxed_input_section): New class definition.
2144 (Output_section::Simple_input_section): New class definition.
2145 (Output_section::get_input_sections): Adjust parameter list.
2146 (Output_section::add_input_section_for_script): Same.
2147 (Output_section::save_states, Output_section::restore_states,
2148 Output_section::do_address_and_file_offset_have_reset_values,
2149 (Output_section::Input_section::Input_section): Handle
2150 RELAXED_INPUT_SECTION_CODE. Add new overload for
2151 Output_relaxed_input_section.
2152 (Output_section::Input_section::is_input_section,
2153 Output_section::Input_section::set_output_section): Handle relaxed
2155 (Output_section::Input_section::is_relaxed_input_section,
2156 Output_section::Input_section::output_section_data,
2157 Output_section::Input_section::relaxed_input_section): New method
2159 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2161 (Output_section::Input_section::u1_): Update comments.
2162 (Output_section::Input_section::u2_): Add new union member poris.
2163 (Output_section::Checkpoint_output_section): New classs definition.
2164 (Output_section::relax_input_section): New method declaration.
2165 (Output_section::checkpoint_): New data member.
2166 (Output_segment): Update comments.
2167 (Output_segment::Output_segment): Un-privatize copy constructor.
2168 (Output_segment::operator=): Un-privatize.
2169 * script-sections.cc (Output_section_element::Input_section_list):
2170 Change element type to Output_section::Simple_input_section.
2171 (Output_section_element_dot_assignment::set_section_addresses):
2172 Register output section data for relaxation clean up.
2173 (Output_data_exression::Output_data_expression): Adjust call to base
2174 constructor to fix data size.
2175 (Output_section_element_data::set_section_addresses): Register
2176 Output_data_expression object for relaxation clean up.
2177 (struct Input_section_info): Replace Relobj pointer and section index
2178 pair with Output_section::Simple_input_section and Convert struct to a
2180 (Input_section_sorter::operator()): Adjust access to
2181 Input_section_info data member to use accessors.
2182 (Output_section_element_input::set_section_addresses): Use layout
2183 parameter. Adjust code to use Output_section::Simple_input_section
2184 and Input_secction_info classes. Register filler for relaxation
2186 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2187 and section index pair with Output_section::Simple_input_section
2188 class. Adjust code accordingly.
2189 (Phdrs_element::release_segment): New method definition.
2190 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2192 (Script_sections::release_segments): New method definition.
2193 * gold/script-sections.h (Script_sections::release_segments): New
2195 * gold/target.h (Target::may_relax, Target::relax,
2196 Target::do_may_relax, Target::do_relax): New method definitions.
2198 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2200 * arm.cc (has_signed_unsigned_overflow): New function.
2201 (Arm_relocate_functions::abs8): New function.
2202 (Target_arm::Scan::local): Handle R_ARM_ABS8.
2203 (Target_arm::Scan::global): Likewise.
2204 (Target_arm::relocate::relocate): Likewise.
2205 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2208 2009-09-16 Cary Coutant <ccoutant@google.com>
2210 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2211 * testsuite/Makefile.in: Regenerate.
2213 2009-09-11 Nick Clifton <nickc@redhat.com>
2215 * po/gold.pot: Updated by the Translation project.
2217 2009-09-08 Cary Coutant <ccoutant@google.com>
2219 * output.cc (Output_file::open): Add execute permission to empty file.
2220 * testsuite/Makefile.am (permission_test): New test.
2221 * testsuite/Makefile.in: Regenerate.
2223 2009-09-02 Ian Lance Taylor <iant@google.com>
2225 * output.cc (Output_file::resize): Call map_no_anonymous rather
2228 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
2230 * gold.cc: Include "incremental.h".
2231 (queue_initial_tasks): Call Incremental_checker methods.
2232 * incremental.cc: Include "output.h".
2233 (Incremental_checker::can_incrementally_link_output_file): New
2235 * incremental.h (Incremental_checker): New class.
2237 * output.cc (Output_file::open_for_modification): New method.
2238 (Output_file::map_anonymous): Changed return type to bool. Record
2240 (Output_file::map_no_anonymous): New method, broken out of map.
2241 (Output_file::map): Use map_no_anonymous and map_anonymous.
2242 * output.h (class Output_file): Update declarations.
2244 2009-08-24 Cary Coutant <ccoutant@google.com>
2246 * options.h (Command_line::Pre_options): New class.
2247 (Command_line::pre_options): New member.
2248 * options.cc (gold::options::ready_to_register): New variable.
2249 (One_option::register_option): Do nothing if not registering options.
2250 Assert if same short option registered twice.
2251 (General_options::General_options): Turn off option registration when
2253 (Command_line::Pre_options::Pre_options): New constructor.
2255 2009-08-24 Cary Coutant <ccoutant@google.com>
2257 * options.h (General_options::no_keep_memory): Remove incorrect
2260 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2262 * Makefile.am (am__skiplex, am__skipyacc): New.
2263 * Makefile.in: Regenerate.
2265 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2267 * Makefile.am (AM_CPPFLAGS): Renamed from ...
2268 (INCLUDES): ... this.
2269 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2270 (AM_CPPFLAGS): Renamed from ...
2271 (INCLUDE): ... this.
2272 * Makefile.in, testsuite/Makefile.in: Regenerate.
2274 * Makefile.in: Regenerate.
2275 * aclocal.m4: Likewise.
2276 * config.in: Likewise.
2277 * configure: Likewise.
2278 * testsuite/Makefile.in: Likewise.
2280 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2281 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2282 * Makefile.in: Regenerate.
2283 * testsuite/Makefile.in: Regenerate.
2285 2009-08-19 Cary Coutant <ccoutant@google.com>
2287 * resolve.cc (Symbol_table::resolve): Don't complain about defined
2288 symbols in shared libraries overridden by hidden or internal symbols
2289 in the main program.
2291 2009-08-19 Chris Demetriou <cgd@google.com>
2293 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2294 checking source file names in error messages.
2296 2009-08-18 Doug Kwan <dougkwan@google.com>
2298 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2299 an elcpp::Ehdr as parameter. Adjust call to set_target.
2300 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2301 an elfcpp::Ehdr as parameter.
2302 * object.cc (Object::set_target): Remove the version that looks up
2303 a target and sets it.
2304 (Sized_relobj::setup): Take a Target object instead of
2305 an elfcpp::Ehdr as parameter. Adjust call to set_target.
2306 (make_elf_sized_object): Find target and ask target to
2308 * object.h: (Object::set_target): Remove the version that looks up
2309 a target and sets it.
2310 (Sized_relobj::setup): Take a Target object instead of
2311 an elfcpp:Ehdr as parameter.
2312 * target.cc: Include dynobj.h.
2313 (Target::do_make_elf_object_implementation): New.
2314 (Target::do_make_elf_object): New.
2315 * target.h (Target::make_elf_object): New template declaration.
2316 (Target::do_make_elf_object): New method declarations.
2317 (Target::do_make_elf_object_implementation): New template declaration.
2319 2009-08-14 Ian Lance Taylor <iant@google.com>
2321 * gold.h (FUNCTION_NAME): Define.
2322 (gold_unreachable): Use FUNCTION_NAME.
2324 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2326 * icf.cc (Icf::find_identical_sections): Issue a warning when a
2327 symbol in the --keep-unique list is not found.
2329 2009-08-12 Sriraman Tallam <tmsriram@google.com>
2331 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2332 been maked as --keep-unique.
2333 (Icf::unfold_section): New function.
2334 * icf.h (Icf::unfold_section): New function.
2335 * options.h (General_options::keep_unique): New option.
2336 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2337 * testsuite/Makefile.in: Regenerate.
2338 * testsuite/icf_keep_unique_test.sh: New file.
2339 * testsuite/icf_keep_unique_test.cc: New file.
2341 2009-08-12 Cary Coutant <ccoutant@google.com>
2344 * resolve.cc (Symbol_table::resolve): Check for references from
2345 dynamic objects to hidden and internal symbols.
2346 * testsuite/Makefile.am (hidden_test.sh): New test.
2347 * testsuite/Makefile.in: Regenerate.
2348 * testsuite/hidden_test.sh: New script.
2349 * testsuite/hidden_test_1.c: New test source.
2350 * testsuite/hidden_test_main.c: New test source.
2352 2009-08-11 Doug Kwan <dougkwan@google.com>
2354 * arm.cc: Update comments.
2355 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2356 segment to locate the .ARM.exidx section if present.
2358 2009-08-09 Doug Kwan <dougkwan@google.com>
2360 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2363 2009-08-07 Sriraman Tallam <tmsriram@google.com>
2364 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2367 2009-08-06 Sriraman Tallam <tmsriram@google.com>
2369 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2370 valid tls_segment only for non-debug-section relocations.
2371 * testsuite/Makefile.am: Add gc_tls_test.
2372 * testsuite/Makefile.in: Regenerate.
2373 * testsuite/gc_tls_test.cc: New file.
2374 * testsuite/gc_tls_test.sh: New file.
2376 2009-08-05 Sriraman Tallam <tmsriram@google.com>
2380 * Makefile.am (CCFILES): Add icf.cc.
2382 * Makefile.in: Regenerate.
2383 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2384 * gc.h (gc_process_relocs): Populate lists used by icf to contain
2385 section, symbol and addend information for the relocs.
2386 * gold.cc (queue_middle_tasks): Call identical code folding.
2387 * gold.h: Add defines for multimap.
2388 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2389 to the call of finalize_local_symbols.
2390 * main.cc (main): Create object of class Icf.
2391 * object.cc (Sized_relobj::do_layout): Allow this function to be
2392 called twice during icf.
2393 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2394 to sections marked as identical by icf.
2395 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2397 (Sized_relobj::do_section_entsize): New function.
2398 * object.h (Object::section_entsize): New function.
2399 (Object::do_section_entsize): New pure virtual function.
2400 (Relobj::finalize_local_symbols): Add new parameter.
2401 (Relobj::do_section_entsize): New function.
2402 * options.h (General_options::icf): New option.
2403 (General_options::icf_iterations): New option.
2404 (General_options::print_icf_sections): New option.
2405 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2406 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2407 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2409 * symtab.cc (Symbol_table::is_section_folded): New function.
2410 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
2411 to sections marked as identical by icf.
2412 * symtab.h (Symbol_table::set_icf): New function.
2413 (Symbol_table::icf): New function.
2414 (Symbol_table::is_section_folded): New function.
2415 (Symbol_table::icf_): New data member.
2416 * target-reloc.h (relocate_section): Ignore sections folded by icf.
2417 * testsuite/Makefile.am: Add commands to build icf_test.
2418 * testsuite/Makefile.in: Regenerate.
2419 * testsuite/icf_test.sh: New file.
2420 * testsuite/icf_test.cc: New file.
2422 2009-07-24 Chris Demetriou <cgd@google.com>
2424 * layout.cc (is_compressible_debug_section): Fix incorrect
2425 comment about compressed section names.
2427 2009-07-20 Ian Lance Taylor <ian@airs.com>
2430 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2432 2009-07-16 Ian Lance Taylor <iant@google.com>
2435 * layout.h: #include <map>.
2436 (class Kept_section): Change from struct to class. Add accessors
2437 and setters. Add section size to Comdat_group mapping. Change
2438 Comdat_group to std::map. Add is_comdat_ field. Add
2439 linkonce_size field in union.
2440 (class Layout): Update declaration of find_or_add_kept_section.
2441 Don't declare find_kept_object.
2442 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2443 parameter. Add object, shndx, is_comdat, and is_group_name
2444 parameters. Change all callers. Adjust for new Kept_section.
2445 (Layout::find_kept_object): Remove.
2446 * object.cc (Sized_relobj::include_section_group): Update use of
2447 Kept_section. Rename secnum to shndx. Only record
2448 Kept_comdat_section if sections are the same size.
2449 (Sized_relobj::include_linkonce_section): Update use of
2450 Kept_section. Only record Kept_comdat_section if sections are the
2451 same size. Set size of linkonce section.
2452 (Sized_relobj::map_to_kept_section): Update call to
2453 get_kept_comdat_section.
2454 * object.h (class Sized_relobj): Rename fields in
2455 Kept_comdat_section to drop trailing underscores; change object
2456 field to Relobj*. Change Kept_comdat_section_table to store
2457 struct rather than pointer.
2458 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2459 Add kept_object and kept_shndx parameters. Change all callers.
2460 (Sized_relobj::get_kept_comdat_section): Change return type to
2461 bool. Add kept_object and kept_shndx parameters. Change all
2463 * plugin.cc (Pluginobj::include_comdat_group): Update call to
2464 Layout::find_or_add_kept_section.
2466 2009-07-09 Ian Lance Taylor <iant@google.com>
2468 * merge.cc (Object_merge_map::initialize_input_to_output_map):
2469 Reserve space in the hash table.
2471 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
2473 * fileread.cc (File_read::get_mtime): New method.
2474 * fileread.h (Timespec): New structure.
2475 (File_read::get_mtime): New method.
2476 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2477 Renamed from timestamp_nsec.
2478 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2480 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
2482 (Incremental_inputs::report_archive): Save mtime; style fix.
2483 (Incremental_inputs::report_obejct): Save mtime; style fix.
2484 (Incremental_inputs::report_script): Save mtime; style fix.
2485 (Incremental_inputs::finalize_inputs): Style fix.
2486 (Incremental_inputs::finalize): Style fix.
2487 (Incremental_inputs::create_input_section_data): Store inputs
2489 * incremental.h (Incremental_inputs::report_script): Add mtime
2491 (Incremental_inputs::Input_info::Input_info): Intialize only one
2493 (Incremental_inputs::Input_info::archive): Move to nameless
2495 (Incremental_inputs::Input_info::obejct): Move to nameless union.
2496 (Incremental_inputs::Input_info::script): Move to nameless union.
2497 (Incremental_inputs::mtime): New field.
2498 * script.cc (read_input_script): Pass file mtime to
2500 * script.h (Script_info::inputs): Style fix.
2502 2009-07-01 Ian Lance Taylor <ian@airs.com>
2504 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2507 2009-06-24 Ian Lance Taylor <iant@google.com>
2510 * layout.cc (Layout::choose_output_section): If we find an
2511 existing section, update the flags.
2512 (Layout::create_notes): New function, broken out of
2514 (Layout::finalize): Don't create note sections.
2515 (Layout::create_note): Don't crash if linker script discards
2517 (Layout::create_gold_note): Likewise.
2518 (Layout::create_build_id): Likewise. Don't set
2519 after_input_sections on the section.
2520 (Layout::create_executable_stack_info): Remove target parameter.
2522 * layout.h (class Layout): Declare create_notes. Update
2523 declaration of create_executable_stack_info.
2524 * gold.cc (queue_middle_tasks): Call create_notes.
2525 * output.cc (Output_section::update_flags_for_input_section): Move
2526 here from output.h. If SHF_ALLOC flag is newly set, mark address
2528 * output.h (Output_data::mark_address_invalid): New function.
2529 (class Output_section): Only declare, not define,
2530 update_flags_for_input_section. Remove set_flags.
2532 2009-06-24 Ian Lance Taylor <iant@google.com>
2534 * script-sections.cc (Output_section_definition::
2535 set_section_addresses): Rename shadowing local load_address to
2538 2009-06-24 Ian Lance Taylor <iant@google.com>
2541 * reloc.cc (relocate_sections): Skip empty relocation sections.
2543 2009-06-23 Ian Lance Taylor <iant@google.com>
2546 * layout.cc (Layout::create_note): Use choose_output_section
2547 rather than make_output_section.
2549 2009-06-23 Ian Lance Taylor <iant@google.com>
2552 * options.cc (General_options::parse_V): Set printed_version_.
2553 (General_options::General_options): Initialize printed_version_.
2554 * options.h (class General_options): Add printed_version_ field.
2555 * gold.cc (queue_initial_tasks): If there are no input files,
2556 don't give a fatal error if we printed the version information.
2557 (queue_middle_tasks): If using -r with a shared object, give a
2558 fatal error rather than an ordinary error.
2560 2009-06-23 Ian Lance Taylor <iant@google.com>
2563 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
2564 (Layout::make_output_section): Set have_stabstr_section_ if we see
2565 a .stab*str section.
2566 (Layout::finalize): Call link_stabs_sections.
2567 (Layout::link_stabs_sections): New file.
2568 * layout.h (class Layout): Add have_stabstr_section_ field.
2569 Declare link_stabs_sections.
2571 2009-06-23 Doug Kwan <dougkwan@google.com>
2573 * Makefile.am (libgold_a_LIBADD): New.
2574 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2575 * Makefile.in: Regenerate.
2576 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
2577 * configure: Regenerate.
2578 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
2579 * fileread.cc: Include sys/state.h
2580 * gold.h: Declare memmem and strndup if found missing.
2581 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2583 2009-06-23 Ian Lance Taylor <iant@google.com>
2585 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2586 * configure: Rebuild.
2588 2009-06-23 Ian Lance Taylor <iant@google.com>
2591 * object.cc (Object::section_contents): Don't try to get a view if
2592 the section has length zero.
2593 (Object::handle_gnu_warning_section): If the section is empty, use
2594 the name of the section as the warning.
2596 2009-06-23 Ian Lance Taylor <iant@google.com>
2599 * stringpool.h (class Stringpool_template): Add optimize_ field.
2600 (Stringpool_template::set_optimize): New function.
2601 * stringpool.cc (Stringpool_template::Stringpool_template):
2602 Initialize optimize_ field.
2603 (Stringpool_template::set_string_offsets): Test local optimize
2604 fild rather than parameter.
2605 * layout.cc (Layout::Layout): Call set_optimize on the section
2608 2009-06-22 Ian Lance Taylor <iant@google.com>
2611 * yyscript.y: Parse TARGET.
2612 * script.cc (script_set_target): New function.
2613 * script-c.h (script_set_target): Declare.
2614 * options.cc (General_options::string_to_object_format): Rename
2615 from string_to_object_format in anonymous namespace. Change
2617 * options.h (class General_options): Declare
2618 string_to_object_format.
2620 2009-06-22 Ian Lance Taylor <iant@google.com>
2622 * script-sections.cc (Script_sections::create_segments): Don't put
2623 program headers in a PT_LOAD segment if -n or -N.
2625 2009-06-22 Ian Lance Taylor <iant@google.com>
2628 * options.h (class General_options): Add -z lazy and -z now. Sort
2629 -z options into alphabetical order.
2630 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
2632 2009-06-21 Ian Lance Taylor <iant@google.com>
2634 * layout.cc (Layout::make_output_section): Call
2635 Target::new_output_section.
2636 (Layout::attach_allocated_section_to_segment): Put large section
2637 sections in a separate load segment with the large segment flag
2639 (Layout::segment_precedes): Sort large data segments after other
2641 (align_file_offset): New static function.
2642 (Layout::set_segment_offsets): Use align_file_offset.
2643 * output.h (class Output_section): Add is_small_section_ and
2644 is_large_section_ fields.
2645 (Output_section::is_small_section): New function.
2646 (Output_section::set_is_small_section): New function.
2647 (Output_section::is_large_section): New function.
2648 (Output_section::set_is_large_section): New function.
2649 (Output_section::is_large_data_section): New function.
2650 (class Output_segment): Add is_large_data_segment_ field.
2651 (Output_segment::is_large_data_segment): New function.
2652 (Output_segment::set_is_large_data_segment): New function.
2653 * output.cc (Output_section::Output_section): Initialize new
2655 (Output_segment::Output_segment): Likewise.
2656 (Output_segment::add_output_section): Add assertion that large
2657 data sections always go in large data segments. Force small data
2658 sections to the end of the list of data sections. Force small BSS
2659 sections to the start of the list of BSS sections. For large BSS
2660 sections to the end of the list of BSS sections.
2661 * symtab.h (class Symbol): Declare is_common_shndx.
2662 (Symbol::is_defined): Check Symbol::is_common_shndx.
2663 (Symbol::is_common): Likewise.
2664 (class Symbol_table): Define enum Commons_section_type. Update
2665 declarations. Add small_commons_ and large_commons_ fields.
2666 * symtab.cc (Symbol::is_common_shndx): New function.
2667 (Symbol_table::Symbol_table): Initialize new fields.
2668 (Symbol_table::add_from_object): Put small and large common
2669 symbols in the right list.
2670 (Symbol_table::sized_finalized_symbol): Check
2671 Symbol::is_common_shndx.
2672 (Symbol_table::sized_write_globals): Likewise.
2673 * common.cc (Symbol_table::do_allocate_commons): Allocate new
2674 common symbol lists. Don't call do_allocate_commons_list if the
2676 (Symbol_table::do_allocate_commons_list): Remove is_tls
2677 parameter. Add comons_section_type parameter. Change all
2678 callers. Handle small and large common symbols.
2679 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2680 Symbol::is_common_shndx.
2681 * resolve.cc (symbol_to_bits): Likewise.
2682 * target.h (Target::small_common_shndx): New function.
2683 (Target::small_common_section_flags): New function.
2684 (Target::large_common_shndx): New function.
2685 (Target::large_common_section_flags): New function.
2686 (Target::new_output_section): New function.
2687 (Target::Target_info): Add small_common_shndx, large_common_shndx,
2688 small_common_section_flags, and large_common_section_flags
2690 (Target::do_new_output_section): New virtual function.
2691 * arm.cc (Target_arm::arm_info): Initialize new fields.
2692 * i386.cc (Target_i386::i386_info): Likewise.
2693 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2695 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2696 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2697 (Target_x86_64::do_new_output_section): New function.
2698 * configure.ac: Define conditional MCMODEL_MEDIUM.
2699 * testsuite/Makefile.am (check_PROGRAMS): Add large.
2700 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2701 (large_LDFLAGS): Define.
2702 * testsuite/large.c: New file.
2703 * testsuite/testfile.cc (Target_test::test_target_info):
2704 Initialize new fields.
2705 * configure, testsuite/Makefile.in: Rebuild.
2707 2009-06-05 Doug Kwan <dougkwan@google.com>
2709 * Makefile.am (CCFILES): Add target.cc.
2710 * Makefile.in: Regenerate.
2711 * i386.cc (class Target_i386): Define new virtual method to
2712 override do_is_local_label_name in parent.
2713 * object.cc (Sized_relobj::do_count_local_symbols): Discard
2714 local symbols if --discard-locals or -X is given.
2715 * options.h (class General_options): Declare new options
2716 '--discard-locals' and '-X' for discarding locals.
2717 * target.h (class Target): Define new methods is_local_label_name.
2718 Declare new virtual method do_is_local_label_name.
2719 * target.cc: New file.
2720 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2721 (check_SCRIPTS): Add discard_locals_test.sh.
2722 (check_DATA): Add discard_local_tests.syms.
2723 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2724 (discard_local_tests.syms, discard_locals_test.o): New make rules.
2725 * testsuite/Makefile.in: Regenerate.
2726 * testsuite/discard_locals_test.c: New file.
2727 * testsuite/discard_locals_test.sh: Same.
2729 2009-06-05 Doug Kwan <dougkwan@google.com>
2731 * object.cc (Sized_relobj::Sized_relobj): Initialize
2732 discarded_eh_frame_shndx_ to -1U.
2733 (Sized_relobj::do_layout): Record index of a discard .eh_frame
2735 (Sized_relobj::do_count_local_symbols): Skip local symbols in
2736 a discarded .eh_frame section.
2737 (Sized_relobj::do_finalize_local_symbols): Ditto.
2738 * object.h (class Sized_relobj): Declare new member
2739 discarded_eh_frame_shndx_.
2740 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2741 (local_labels_test.o, local_labels_test): New rules.
2742 * testsuite/Makefile.in: Regenerate.
2744 2009-06-04 Doug Kwan <dougkwan@google.com>
2746 * layout.cc (Layout::section_name_mapping): Add mapping for
2747 special ARM sections.
2749 2009-06-03 Doug Kwan <dougkwan@google.com>
2751 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2752 (utils::has_overflow): Same.
2754 2009-06-03 Ian Lance Taylor <iant@google.com>
2756 * layout.cc (Layout::section_name_mapping): New array, replacing
2757 Layout::linkonce_mapping.
2758 (Layout::section_name_mapping_count): New variable, replacing
2759 Layout::linkonce_mapping_count.
2760 (Layout::linkonce_output_name): Remove.
2761 (Layout::output_section_name): Rewrite.
2762 * layout.h (class Layout): Rename Linkonce_mapping to
2763 Section_name_mapping, linkonce_mapping to section_name_mapping,
2764 linkonce_mapping_count to section_name_mapping_count. Don't
2765 declare linkonce_output_name.
2767 2009-06-03 Doug Kwan <dougkwan@google.com>
2769 * gold/arm.cc (namespace utils): New.
2770 (Target_arm::reloc_is_non_pic): Define new method.
2771 (class Arm_relocate_functions): New.
2772 (Target_arm::Relocate::relocate): Handle relocation types used by
2775 2009-06-03 Ian Lance Taylor <iant@google.com>
2777 * arm.cc (Target_arm::scan::global): Use || instead of |.
2779 2009-06-02 Doug Kwan <dougkwan@google.com>
2781 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
2782 issued_non_pic_error_.
2783 (class Target_arm::Scan): Declare new method check_non_pic.
2784 Define new method symbol_needs_plt_entry.
2785 Declare new data member issued_non_pic_error_.
2786 (class Target_arm::Relocate): Declare new method
2787 should_apply_static_reloc.
2788 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
2789 (Target_arm::Scan::check_non_pic): Define new method.
2790 (Target_arm::Scan::local): Handle a small subset of reloc types used
2792 (Target_arm::Scan::local): Same.
2793 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2795 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
2797 * incremental.cc (Incremental_inputs::report_command_line): Filter
2798 out --incremental-* options.
2800 2009-05-29 Doug Kwan <dougkwan@google.com>
2802 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
2804 (class Target_arm): Update comment.
2805 (Target_arm::Target_arm): Initialize new data members GOT_,
2806 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
2807 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
2808 and Target_arm::rel_dyn_section.
2809 Declare new_enum Target_arm::Got_type.
2810 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
2812 Update commments for member do_dynsym_value.
2813 (Target_arm::got_size, Target_arm::plt_section,
2814 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
2815 new methods inside class defintion.
2816 (Target_arm::got_section): Define new method.
2817 (Target_arm::rel_dyn_section): Same.
2818 (Output_data_plt_arm): New template class.
2819 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
2820 (Output_data_plt_arm:do_adjust_output_section): Define new method.
2821 (Output_data_plt_arm::add_entry): Same.
2822 (Output_data_plt_arm::first_plt_entry): Define new
2823 static data member for PLT instruction template.
2824 (Output_data_plt_arm::plt_entry): Same.
2825 (Output_data_plt_arm::do_write): Define new method.
2826 (Target_arm::make_plt_entry): Same.
2827 (Target_arm::do_finalize_sections): Same.
2828 (Target_arm::do_dynsym_value): Same.
2830 2009-05-28 Doug Kwan <dougkwan@google.com>
2832 * Makefile.am (TARGETSOURCES): Add arm.cc.
2833 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
2834 * Makefile.in: Regenerate.
2836 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2838 2009-05-26 Doug Kwan <dougkwan@google.com>
2840 * options.cc (General_options::parse_exclude_libs). Fix a comment.
2841 (General_options::check_excluded_libs): Strip off directories in
2842 archive name before matching like GNU ld does.
2843 * testsuite/Makefile.am (MOSTLYCLEANFILES,
2844 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
2845 (exclude_libs_test_LDFLAGS): Add linker option
2846 -Wl,--exclude-libs,libexclude_libs_test_3
2847 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
2848 an explicit archive without using -l.
2849 (alt/libexclude_libs_test_3.a): New make rule.
2850 * testsuite/Makefile.in: Regenerate.
2851 * testsuite/exclude_libs_test.c : Declare lib3_default().
2853 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
2854 * exclude_libs_test_3.c: New file.
2856 2009-05-26 Nick Clifton <nickc@redhat.com>
2858 * po/id.po: New Indonesian translation.
2859 * po/gold.pot: Updated template file.
2861 2009-05-22 Sriraman Tallam <tmsriram@google.com>
2863 * testsuite/Makefile.am: Add -ffunction-sections to compile
2864 gc_comdat_test files. Add -Wl,--gc-sections to build
2866 * testsuite/Makefile.in: Regenerate.
2867 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
2869 2009-05-21 Sriraman Tallam <tmsriram@google.com>
2871 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
2872 kept comdat section was garbage collected.
2873 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
2874 * testsuite/Makefile.in: Regenerate.
2875 * testsuite/gc_comdat_test.sh: New file.
2876 * testsuite/gc_comdat_test_1.cc: New file.
2877 * testsuite/gc_comdat_test_2.cc: New file.
2879 2009-05-19 Doug Kwan <dougkwan@google.com>
2881 * archive.cc (Archive::Archive): Move constructor from archive.h
2882 to here. Initialize no_export_.
2883 (Archive::get_elf_object_for_member): Set no_export flag of object.
2884 * archive.h (Archive::Archive): Move constructor body to
2886 (Archive::no_export): New method.
2887 (Archive::no_export_): New field.
2888 * object.h (Object::Object): Initialize no_export_ to false.
2889 (Object::no_export, Object::set_no_export): New methods.
2890 (Object::no_export_): New field.
2891 * options.cc (General_options::parse_exclude_libs): New method.
2892 (General_options::check_excluded_libs) Same.
2893 * options.h (exclude_libs): New option.
2894 (General_options::check_excluded_libs): New method declaration.
2895 (General_options::excluded_libs_): New field.
2896 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
2897 default or protected visibility if an object has no-export flag set.
2898 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
2899 (check_SCRIPTS): Add exclude_libs_test.sh.
2900 (check_DATA): Add exclude_libs_test.syms.
2901 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
2902 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
2903 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
2904 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
2905 (exclude_libs_test.syms, libexclude_libs_test_1.a,
2906 libexclude_libs_test_2.a): New rules.
2907 * testsuite/Makefile.in: Regenerate.
2908 * testsuite/exclude_libs_test.c: New file.
2909 * testsuite/exclude_libs_test.sh: Ditto.
2910 * testsuite/exclude_libs_test_1.c: Ditto.
2911 * testsuite/exclude_libs_test_2.c: Ditto.
2913 2009-05-15 Ian Lance Taylor <iant@google.com>
2915 * configure.ac: Check for declarations for cases where libiberty.h
2916 checks HAVE_DECL_xxx.
2917 * configure, config.in: Rebuild.
2919 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
2921 * gold.h (Incremental_argument_list): Remove (invalid) forward
2923 * incremental.cc (Incremental_inputs::report_achive): New method.
2924 (Incremental_inputs::report_object): New method.
2925 (Incremental_inputs::report_script): New method.
2926 (Incremental_inputs::finalize_inputs): New method.
2927 (Incremental_inputs::finalize): Call finalize_inputs().
2928 (Incremental_inputs::sized_create_incremental_inputs_section_data):
2929 Create inputs entries.
2930 * incremental.h (Incremental_input_type): New enum.
2931 (Incremental_inputs::Incremental_input): Initialize new fields.
2932 (Incremental_inputs::report_inputs): New method.
2933 (Incremental_inputs::report_achive): New method.
2934 (Incremental_inputs::report_object): New method.
2935 (Incremental_inputs::report_script): New method.
2936 (Incremental_inputs::finalize_inputs): New method.
2937 (Incremental_inputs::Input_info): New struct.
2938 (Incremental_inputs::Input_info_map): New typedef.
2939 (Incremental_inputs::lock_): New field.
2940 (Incremental_inputs::Inputs_): New field.
2941 (Incremental_inputs::Inputs_map): New field.
2942 * main.cc (main): Call Incremental_input::report_inputs.
2943 * options.h (Input_argument_list): Typedef moved from
2945 (Input_file_group::Files): Remove, use ::Input_argument_list.
2946 (Input_file_group::Input_argument_list): Remove, use
2947 ::Input_argument_list.
2948 * plugin.cc (Plugin_manager::add_input_file): Add error in
2950 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
2952 * script.cc (read_input_script): Call
2953 Incremental_input::report_script.
2954 * script.h (Script_info): New class.
2956 2009-04-27 Ian Lance Taylor <iant@google.com>
2958 * x86_64.cc (do_adjust_output_section): Set entsize to
2961 2009-04-23 Elliott Hughes <enh@google.com>
2963 * output.cc (Output_file::close): After short writes, continue
2964 writing from the correct offset in the buffer being written.
2966 2009-04-23 Chris Demetriou <cgd@google.com>
2968 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
2969 * configure: Regenerate.
2970 * config.in: Regenerate.
2971 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
2972 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2974 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
2976 * incremental.cc (Incremental_inputs_header_data): Renamed from
2977 Incremental_input_header_data.
2978 (Incremental_inputs_header_data::data_size): New field.
2979 (Incremental_inputs_header_data::put_input_file_count): Renamed
2980 from input_file_count.
2981 (Incremental_inputs_header_data::put_command_line_offset): Renamed
2982 from command_line_offset.
2983 (Incremental_inputs_header_data::put_reserved): Renamed from
2985 (Incremental_inputs_entry_data): Renamed from
2986 Incremental_input_entry_data.
2987 (Incremental_inputs_entry_data::data_size): New field.
2988 (Incremental_inputs::report_command_line): New method.
2989 (Incremental_inputs::finalize): New method.
2990 (Incremental_inputs::create_incremental_inputs_data): New method.
2991 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
2992 * incremental.h: New file.
2993 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
2994 (Layout::finalize): Create incremental inputs section in
2996 (Layout::create_incremental_info_sections): New method.
2997 * layout.h (Layout::incremental_inputs): New method.
2998 (Layout::create_incremental_info_sections): New method.
2999 (Layout::incremental_inputs_): New field.
3000 * main.cc (main): Notify Incremental_input of the command line.
3002 2009-04-01 Ian Lance Taylor <iant@google.com>
3003 Mikolaj Zalewski <mikolajz@google.com>
3005 * gold.h (reserve_unordered_map): Define, three versions, one for
3006 each version of Unordered_map.
3007 * layout.cc (Layout::Layout): Remove options parameter. Add
3008 number_of_input_files parameter. Don't initialize options_.
3009 Initialize number_of_input_files_ and resized_signatures_. Move
3010 sections_are_attached_.
3011 (Layout::layout_group): Reserve space for group_signatures_.
3012 (Layout::find_or_add_kept_section): Change name parameter to be a
3013 reference. Resize signatures_ map when it gets large enough.
3014 (Layout::layout_eh_frame): Use parameters->options() instead of
3016 (Layout::make_output_section): Likewise.
3017 (Layout::attach_allocated_section_to_segment): Likewise.
3018 (Layout::finalize, Layout::create_executable_stack): Likewise.
3019 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3020 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3021 * layout.h (class Layout): Update declarations. Remove options_
3022 field. Add number_of_input_files_ and resized_signatures_
3023 fields. Move sections_are_attached_ field.
3024 * main.cc (main): Pass number of input files to Layout
3025 constructor. Don't pass options.
3027 2009-03-30 Ian Lance Taylor <iant@google.com>
3029 * ffsll.c (ffsll): Correct implementation.
3031 2009-03-27 Ian Lance Taylor <iant@google.com>
3033 * ffsll.c: New file.
3034 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3035 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3036 * ftruncate.c (ftruncate): Declare before definition.
3037 * mremap.c (mremap): Likewise.
3038 * pread.c (pread): Likewise.
3039 * configure, Makefile.in, config.in: Rebuild.
3041 * mremap.c: New file.
3042 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3043 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3044 (mremap): Declare if HAVE_MREMAP is not defined.
3045 * configure, Makefile.in, config.in: Rebuild.
3047 2009-03-27 Cary Coutant <ccoutant@google.com>
3049 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3050 position independent.
3051 * sparc.cc (Target_sparc::check_non_pic): Likewise.
3052 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3054 2009-03-24 Cary Coutant <ccoutant@google.com>
3056 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3058 (needs_dynamic_reloc): Likewise.
3060 2009-03-24 Ian Lance Taylor <iant@google.com>
3062 * yyscript.y (file_cmd): Recognize EXTERN.
3063 (extern_name_list, extern_name_list_body): New nonterminals.
3064 * script.cc (script_add_extern): Define.
3065 * script-c.h (script_add_extern): Declare.
3067 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
3069 * object.cc (is_elf_object): Define.
3070 * object.h (is_elf_object): Declare.
3071 * archive.cc (Archive::get_elf_object_for_member): Call
3073 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3075 2009-03-24 Elliott Hughes <enh@google.com>
3077 * output.cc (Output_file::map_anonymous): Define.
3078 (Output_file::map): Use map_anonymous. If the regular mmap fails,
3079 try an anonymous one. Report the size if the mmap fails.
3080 * output.h (class Output_file): Declare map_anonymous.
3082 2009-03-24 Ian Lance Taylor <iant@google.com>
3084 * target-select.cc (instantiate_target): Don't acquire the lock if
3085 the instantiated_target_ field has already been set.
3087 2009-03-23 Ian Lance Taylor <iant@google.com>
3089 * gold-threads.h (class Initialize_lock): Define.
3090 * gold-threads.cc (class Initialize_lock_once): Define.
3091 (initialize_lock_control): New static variable.
3092 (initialize_lock_pointer): New static variable.
3093 (initialize_lock_once): New static function.
3094 (Initialize_lock::Initialize_lock): Define.
3095 (Initialize_lock::initialize): Define.
3096 * target-select.h: Include "gold-threads.h".
3097 (class Target_selector): Add lock_ and initialize_lock_ fields.
3098 Don't define instantiate_target, just declare it.
3099 * target-select.cc (Target_selector::Target_selector): Initialize
3101 (Target_selector::instantiate_target): Define.
3102 * descriptors.h: Include "gold-threads.h".
3103 (class Descriptors): Add initialize_lock_ field.
3104 * descriptors.cc (Descriptors::Descriptors): Initialize new
3106 (Descriptors::open): Use initialize_lock_ field
3107 * errors.h (class Errors): Add initialize_lock_ field.
3108 * errors.cc (Errors::Errors): Initialize new field.
3109 (Errors::initialize_lock): Use initialize_lock_ field.
3110 * powerpc.cc (class Target_selector_powerpc): Remove
3111 instantiated_target_ field. In do_recognize call
3112 instantiate_target rather than do_instantiate_target. In
3113 do_instantiate_target just allocate a new target.
3114 * sparc.cc (class Target_selector_sparc): Likewise.
3116 * freebsd.h: New file.
3117 * i386.cc: Include "freebsd.h".
3118 (Target_i386): Derive from Target_freebsd rather than
3120 (Target_selector_i386): Derive from Target_selector_freebsd rather
3121 than Target_selector.
3122 * x86_64.cc: Include "freebsd.h".
3123 (Target_x86_64): Derive from Target_freebsd rather than
3125 (Target_selector_x86_64): Derive from Target_selector_freebsd
3126 rather than Target_selector.
3127 * target.h (class Target): Add adjust_elf_header and
3128 do_adjust_elf_header.
3129 * output.cc (Output_file_header:: do_sized_write): Call target
3130 adjust_elf_header routine.
3131 * configure.tgt: Set targ_osabi.
3132 * configure.ac: Define GOLD_DEFAULT_OSABI.
3133 * parameters.cc (Parameters::default_target): Pass
3134 GOLD_DEFAULT_OSABI to select_target.
3135 * target-select.h (class Target_selector): Make instantiate_target
3136 protected rather than private.
3137 * Makefile.am (HFILES): Add freebsd.h.
3138 * configure, Makefile.in, config.in: Rebuild.
3140 * merge.cc (do_add_input_section): Correct pend value. Change
3141 message about last entry not being null terminated from error to
3144 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
3146 * incremental.cc: New file.
3147 * Makefile.am (CCFILES): Add incremental.cc.
3148 * Makefile.in: Rebuild.
3150 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
3152 * layout.cc (Layout::output_section_name): Preserve names
3153 of '.note.' sections.
3155 2009-03-19 Ian Lance Taylor <iant@google.com>
3157 * descriptors.cc (Descriptors::open): Check that the options are
3158 valid before using them.
3160 2009-03-18 Ian Lance Taylor <iant@google.com>
3162 * script-sections.h: Include <list>.
3163 (class Script_sections): Change Sections_elements from std::vector
3164 to std::list. Typedef public Elements_iterator. Add
3165 orphan_section_placement_, data_segment_align_start_, and
3166 saw_data_segment_align_ fields. Remove data_segment_align_index_
3168 * script-sections.cc (class Orphan_section_placement): New class.
3169 (class Sections_element): Add virtual functions is_relro and
3170 orphan_section_init. Remove virtual function place_orphan_here.
3171 (class Output_section_definition): Add is_relro and
3172 orphan_section_init. Remove place_orphan_here.
3173 (class Orphan_output_section): Likewise.
3174 (Script_sections::Script_sections): Update for field changes.
3175 (Script_sections::data_segment_align): Set saw_data_segment_align_
3176 and data_segment_align_start_, not data_segment_align_index.
3177 (Script_sections::data_segment_relro_end): Check
3178 saw_data_segment_align_. Use data_segment_align_start_ rather
3179 than data_segment_align_index_.
3180 (Script_sections::place_orphan): Rewrite to use
3181 Orphan_section_placement.
3183 2009-03-17 Ian Lance Taylor <iant@google.com>
3185 * archive.cc (Archive::add_symbols): Check for a version attached
3186 to the symbol name in the archive map.
3187 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3188 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3189 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3190 (ver_test_11.a): New target.
3191 * testsuite/Makefile.in: Rebuild.
3193 * configure.ac: Check for chsize and posix_fallocate. Replace
3195 * ftruncate.c: New file, from gnulib.
3196 * output.cc (posix_fallocate): Define dummy version if not
3197 HAVE_POSIX_FALLOCATE.
3198 (Output_file::map): Call posix_fallocate rather than lseek and
3200 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3201 * configure, Makefile.in, config.in: Rebuild.
3203 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
3205 * layout.h (Layout::create_note): Add section_name parameter.
3206 * layout.cc (Layout::create_note): Likewise.
3207 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3209 2009-03-17 Ian Lance Taylor <iant@google.com>
3211 * descriptors.cc: Include "options.h".
3212 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3213 (Descriptors::open): Always use O_CLOEXEC when opening a new
3214 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
3215 then set FD_CLOEXEC.
3217 * sparc.cc (class Target_sparc): Add has_got_section.
3218 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3219 make sure we have a GOT section.
3221 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3222 (Target_sparc::Scan::local): Likewise.
3223 (Target_sparc::Scan::global): Likewise.
3224 (Target_sparc::Relocate::relocate): Likewise.
3225 (Target_sparc::Relocate::relocate_tls): Likewise.
3227 * symtab.cc (Symbol_table::define_default_version): New function,
3228 broken out of add_from_object.
3229 (Symbol_table::add_from_object): Call define_default_version.
3230 (Symbol_table::define_special_symbol): Add resolve_oldsym
3231 parameter. Change all callers. If the version for a symbol comes
3232 from a version script, resolve it with the symbol with the same
3233 name with no version. Also add the symbol without a version if
3235 (do_define_in_output_data): If resolving with oldsym, don't delete
3237 (do_define_in_output_segment): Likewise.
3238 (do_define_as_constant): Likewise.
3239 * symtab.h (class Symbol_table): Update declarations.
3241 2009-03-13 Ian Lance Taylor <iant@google.com>
3243 * readsyms.cc (Read_symbols::incompatible_warning): New function.
3244 (Read_symbols::requeue): New function.
3245 (Read_symbols::do_read_symbols): If make_elf_object fails because
3246 the target type is not configured, and the file was searched for,
3247 issue a warning and retry with the next directory.
3248 (Add_symbols::run): If the file has an incompatible format, and
3249 it was searched for, requeue the Read_symbols task. On error,
3251 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
3252 dirindex parameter to constructor. Change all callers. Declare
3253 incompatible_warning and requeue.
3254 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3255 input_argument_ and input_group_ fields. Add them to
3256 constructor. Change all callers.
3257 (class Read_script): Add dirindex_ field. Add it to constructor.
3259 * archive.cc (Archive::setup): Remove input_objects parameter.
3261 (Archive::get_file_and_offset): Likewise.
3262 (Archive::read_all_symbols): Likewise.
3263 (Archive::read_symbols): Likewise.
3264 (Archive::get_elf_object_for_member): Remove input_objects
3265 parameter. Add punconfigured parameter. Change all callers.
3266 (Archive::add_symbols): Change return type to bool. Check return
3267 value of include_member.
3268 (Archive::include_all_members): Likewise.
3269 (Archive::include_member): Change return type to bool. Return
3270 false if first included object has incompatible target. Set
3271 included_member_ field.
3272 (Add_archive_symbols::run): If add_symbols returns false, requeue
3274 * archive.h (class Archive): Add included_member_ field.
3275 Initialize it in constructor. Add input_file and searched_for
3276 methods. Update declarations.
3277 (class Add_archive_symbols): Add dirpath_, dirindex_, and
3278 input_argument_ fields. Add them to constructor. Change all
3280 * script.cc: Include "target-select.h".
3281 (class Parser_closure): Add skip_on_incompatible_target_ and
3282 found_incompatible_target_ fields. Add
3283 skip_on_incompatible_target parameter to constructor. Change all
3284 callers. Add methods skip_on_incompatible_target,
3285 clear_skip_on_incompatible_target, found_incompatible_target, and
3286 set_found_incompatible_target.
3287 (read_input_script): Add dirindex parameter. Change all callers.
3288 If parser finds an incompatible target, requeue Read_symbols
3290 (script_set_symbol): Clear skip_on_incompatible_target in
3292 (script_add_assertion, script_parse_option): Likewise.
3293 (script_start_sections, script_add_phdr): Likewise.
3294 (script_check_output_format): New function.
3295 * script.h (read_input_script): Update declaration.
3296 * script-c.h (script_check_output_format): Declare.
3297 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3298 (ignore_cmd): Remove OUTPUT_FORMAT.
3299 * fileread.cc (Input_file::Input_file): Add explicit this.
3300 (Input_file::will_search_for): New function.
3301 (Input_file::open): Add pindex parameter. Change all callers.
3302 * fileread.h (class Input_file): Add input_file_argument method.
3303 Declare will_search_for. Update declarations.
3304 * object.cc (make_elf_object): Add punconfigured parameter.
3306 * object.h (class Object): Make input_file public. Add
3307 searched_for method.
3308 (make_elf_object): Update declaration.
3309 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
3311 * dirsearch.h (class Dirsearch): Update declaration.
3312 * options.h (class General_options): Add --warn-search-mismatch.
3313 * parameters.cc (Parameters::is_compatible_target): New function.
3314 * parameters.h (class Parameters): Declare is_compatible_target.
3315 * workqueue.cc (Workqueue::add_blocker): New function.
3316 * workqueue.h (class Workqueue): Declare add_blocker.
3318 * fileread.cc (Input_file::open): Remove options parameter.
3320 (Input_file::open_binary): Likewise.
3321 * script.cc (read_input_script): Likewise.
3322 * readsyms.h (class Read_symbols): Remove options_ field. Remove
3323 options parameter from constructor. Change all callers.
3324 (class Read_script): Likewise.
3325 * fileread.h (class Input_file): Update declarations.
3326 * script.h (read_input_script): Update declaration.
3328 2009-03-10 Nick Clifton <nickc@redhat.com>
3330 * po/es.po: New Spanish translation.
3332 2009-03-06 Cary Coutant <ccoutant@google.com>
3334 * options.cc (parse_short_option): Keep dash_z from registering itself.
3336 2009-03-03 Ian Lance Taylor <iant@google.com>
3339 * target-reloc.h (relocate_section): Pass output_section to
3341 * i386.cc (Target_i386::should_apply_static_reloc): Add
3342 output_section parameter. Change all callers.
3343 (Target_i386::Relocate::relocate): Add output_section parameter.
3344 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3345 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3346 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3347 * testsuite/two_file_shared.sh: New script.
3348 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3349 (check_DATA): Add two_file_shared.dbg.
3350 (two_file_shared.dbg): New target.
3351 * testsuite/Makefile.in: Rebuild.
3353 2009-03-01 Ian Lance Taylor <iant@google.com>
3355 * configure.ac: Check for byteswap.h.
3356 * configure: Rebuild.
3357 * config.in: Rebuild.
3359 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
3361 * layout.cc (Layout::find_or_add_kept_section): New function.
3362 (Layout::add_comdat): Removed.
3363 * layout.h (struct Kept_section): Move out of class Layout.
3364 Remove trailing underscores from field names. Add group_sections
3365 field. Rename group_ field to is_group. Change all uses.
3366 (class Layout): Declare find_or_add_kept_section, not add_comdat.
3367 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3368 comdat_groups_ field.
3369 (Sized_relobj::include_section_group): Use
3370 find_or_add_kept_section and Kept_section::group_sections.
3371 (Sized_relobj::include_linkonce_section): Likewise.
3372 * object.cc (class Sized_relobj): Don't define Comdat_group or
3373 Comdat_group_table. Remove find_comdat_group and
3374 add_comdat_group. Remove comdat_groups_ field.
3375 * plugin.cc (include_comdat_group): Use
3376 Layout::find_or_add_kept_section.
3378 2009-02-28 Ian Lance Taylor <iant@google.com>
3380 * README: --gc-sections and map files are now supported. Document
3381 some build requirements.
3384 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3385 relocatable link set the value of the section symbol to zero.
3386 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3387 relocatable link don't include the section address in the local
3390 2009-02-27 Ian Lance Taylor <iant@google.com>
3393 * options.h (class Search_directory): Add is_system_directory.
3394 (class General_options): Declare is_in_system_directory.
3395 * options.cc (get_relative_sysroot): Make static.
3396 (get_default_sysroot): Make static.
3397 (General_optoins::is_in_system_directory): New function.
3398 * fileread.cc (Input_file::is_in_system_directory): New function.
3399 * fileread.h (class Input_file): Declare is_in_system_directory.
3400 * object.h (class Object): Add is_in_system_directory.
3401 (class Input_objects): Remove system_library_directory_ field.
3402 * object.cc (Input_objects::add_object): Don't set
3403 system_library_directory_.
3404 (input_objects::found_in_system_library_directory): Remove.
3405 * symtab.cc (Symbol_table::write_globals): Remove input_objects
3406 parameter. Change all callers.
3407 (Symbol_table::sized_write_globals): Likewise.
3408 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3409 Call Object::is_in_system_directory.
3410 * symtab.h (class Symbol_table): Update declarations.
3413 * descriptors.h (Open_descriptor): Add is_on_stack field.
3414 * descriptors.cc (Descriptors::open): If the descriptor is on the
3415 top of the stack, remove it. Initialize is_on_stack field.
3416 (Descriptors::release): Only add pod to stack if it is not on the
3418 (Descriptors::close_some_descriptor): Clear stack_next and
3422 * output.cc (Output_section::find_starting_output_address): Rename
3423 from starting_output_address; add PADDR parameter; change return
3425 * output.h (class Output_section): Declare
3426 find_starting_output_address instead of starting_output_address.
3427 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3428 section symbol for which we can't find a merge section.
3431 * symtab.cc (Symbol_table::add_from_object): If the visibility is
3432 hidden or internal, force the symbol to be local.
3433 * resolve.cc (Symbol::override_visibility): Define.
3434 (Symbol::override_base): Use override_visibility.
3435 (Symbol_table::resolve): Likewise.
3436 (Symbol::override_base_with_special): Likewise.
3437 (Symbol_table::override_with_special): If the visibility is hidden
3438 or internal, force the symbol to be local.
3439 * symtab.h (class Symbol): Add set_visibility and
3440 override_visibility.
3441 * testsuite/ver_test_1.sh: New file.
3442 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3443 (check_DATA): Add ver_test_1.syms.
3444 (ver_test_1.syms): New target.
3445 * testsuite/Makefile.in: Rebuild.
3447 2009-02-25 Cary Coutant <ccoutant@google.com>
3449 * layout.cc (Layout::choose_output_section): Don't rename sections
3450 when using a linker script that has a SECTIONS clause.
3451 * Makefile.in: Regenerate.
3453 * testsuite/Makefile.am (script_test_5.sh): New test case.
3454 * testsuite/Makefile.in: Regenerate.
3455 * testsuite/script_test_5.cc: New file.
3456 * testsuite/script_test_5.sh: New file.
3457 * testsuite/script_test_5.t: New file.
3459 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
3461 * archive.cc (Archive::include_member): Update calls to add_symbols.
3462 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3463 the Layout argument.
3464 * dynobj.h (do_add_symbols): Add the Layout argument.
3465 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3467 * object.h (Object::add_symbols): Add the Layout argument.
3468 (Object::do_add_symbols): Add the Layout argument.
3469 (Sized_relobj::do_add_symbols): Add the Layout argument.
3470 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3471 Unify the two versions.
3472 (Add_plugin_symbols): Remove.
3473 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3474 (Sized_pluginobj::do_add_symbols): Unify the two versions.
3475 (Add_plugin_symbols): Remove.
3476 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3477 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3478 (Add_symbols::run): Make it work with Pulginobj.
3480 2009-02-06 Ian Lance Taylor <iant@google.com>
3482 * object.cc (Sized_relobj::do_layout): Make info message start
3483 with lower case letter.
3485 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
3487 * binary.cc: Fix file comment.
3489 * options.h (enum Incremental_disposition): Define.
3490 (class General_options): Add new options: --incremental,
3491 --incremental_changed, --incremental_unchanged,
3492 --incremental_unknown. Add incremental_disposition_ and
3493 implicit_incremental_ fields.
3494 (General_options::incremental_disposition): New function.
3495 (class Position_dependent_options): Add incremental_disposition
3497 (Position_dependent_options::copy_from_options): Set incremental
3499 * options.cc (General_options::parse_incremental_changed): New
3501 (General_options::parse_incremental_unchanged): New function.
3502 (General_options::parse_incremental_unknown): New function.
3503 (General_options::General_options): Initialize new fields
3504 incremental_disposition_ and implicit_incremental_.
3505 (General_options::finalize): Check for uasge of --incremental-*
3506 without --incremental.
3508 2009-02-06 Chris Demetriou <cgd@google.com>
3510 * gold.h (gold_undefined_symbol): Change to take only a Symbol
3511 pointer and to report location as the file name associated with
3513 (gold_undefined_symbol_at_location): New function to replace the
3514 old gold_undefined_symbol functionality.
3515 * target-reloc.h (relocate_section): Update to use
3516 gold_undefined_symbol_at_location.
3517 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3518 Call gold_undefined_symbol function rather than gold_error.
3519 * errors.h (Errors::undefined_symbol): Take location as a
3520 string, rather than calculating it from a relocation.
3521 * errors.cc (Errors::fatal): Print "fatal error:" before the
3523 (Errors::error, Errors::error_at_location): Print "error: "
3524 before the formatted message.
3525 (Errors::undefined_symbol): Take location as a string, rather
3526 than calculating it from a relocation.
3527 (gold_undefined_symbol_at_location): New function akin to
3528 old gold_undefined_symbol, calculates location from relocation.
3529 (gold_undefined_symbol): Change to take only a Symbol pointer
3530 and to report location as the file name associated with the symbol.
3531 * testsuite/debug_msg.sh: Update for changed error messages.
3532 * testsuite/undef_symbol.sh: Likewise.
3534 2009-02-04 Duncan Sands <baldrick@free.fr>
3537 * reduced_debug_output.h
3538 (Output_reduced_debug_abbrev_section::failed): Use format for
3540 (Output_reduced_debug_info_section::faild): Likewise.
3542 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
3544 * script.cc (Lazy_demangler): New class.
3545 (Version_script_info::get_symbol_version_helper): Demangle a
3548 2009-01-29 Cary Coutant <ccoutant@google.com>
3550 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
3552 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3554 2009-01-28 Ian Lance Taylor <iant@google.com>
3556 * version.cc (version_string): Bump to 1.9.
3558 * gold.h: Include <cstring> and <stdint.h>.
3559 * version.cc: Include <cstdio>.
3560 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
3562 * reduced_debug_output.cc (insert_into_vector): Rename from
3563 Insert_into_vector; change all callers. Use Swap_unaligned to
3564 avoid aliasing issue; remove union since it is unnecessary.
3566 2009-01-27 Sriraman Tallam <tmsriram@google.com>
3568 * Makefile.am (CCFILES): Add gc.cc.
3570 * Makefile.in: Regenerate.
3571 * gold.cc (Gc_runner): New class.
3572 (queue_initial_tasks): Call garbage collection related tasks
3573 when corresponding options are invoked.
3574 (queue_middle_gc_tasks): New function.
3575 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
3576 processed early before laying out sections during garbage collection.
3577 * gold.h (queue_middle_gc_tasks): New function.
3578 (is_prefix_of): Move from "layout.cc".
3579 * i386.cc (Target_i386::gc_process_relocs): New function.
3580 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
3581 * main.cc (main): Create object of class "Garbage_collection".
3582 * object.cc (Relobj::copy_symbols_data): New function.
3583 (Relobj::is_section_name_included): New function.
3584 (Sized_relobj::do_layout): Allow this function to be called twice
3585 during garbage collection and defer layout of section during the
3587 * object.h (Relobj::get_symbols_data): New function.
3588 (Relobj::is_section_name_included): New function.
3589 (Relobj::copy_symbols_data): New function.
3590 (Relobj::set_symbols_data): New function.
3591 (Relobj::get_relocs_data): New function.
3592 (Relobj::set_relocs_data): New function.
3593 (Relobj::is_output_section_offset_invalid): New pure virtual function.
3594 (Relobj::gc_process_relocs): New function.
3595 (Relobj::do_gc_process_relocs): New pure virtual function.
3596 (Relobj::sd_): New data member.
3597 (Sized_relobj::is_output_section_offset_invalid): New function.
3598 (Sized_relobj::do_gc_process_relocs): New function.
3599 * options.h (General_options::gc_sections): Modify to not be a no-op.
3600 (General_options::print_gc_sections): New option.
3601 * plugin.cc (Plugin_finish::run): Remove function call to
3602 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
3603 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
3604 * reloc.cc (Read_relocs::run): Add task to process relocs and
3605 determine unreferenced sections when doing garbage collection.
3606 (Gc_process_relocs): New class.
3607 (Sized_relobj::do_gc_process_relocs): New function.
3608 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
3609 sections that are garbage collected.
3610 * reloc.h (Gc_process_relocs): New class.
3611 * sparc.cc (Target_sparc::gc_process_relocs): New function.
3612 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
3613 symbols whose corresponding sections are garbage collected.
3614 (Symbol_table::Symbol_table): Add new parameter for the garbage
3616 (Symbol_table::gc_mark_undef_symbols): New function.
3617 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3618 (Symbol_table::gc_mark_dyn_syms): New function.
3619 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
3621 (Symbol_table::add_from_object): Likewise.
3622 (Symbol_table::add_from_relobj): When building shared objects, do not
3623 treat externally visible symbols as garbage.
3624 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
3625 table information for static and relocatable links.
3626 * symtab.h (Symbol_table::set_gc): New function.
3627 (Symbol_table::gc): New function.
3628 (Symbol_table::gc_mark_undef_symbols): New function.
3629 (Symbol_table::gc_mark_symbol_for_shlib): New function.
3630 (Symbol_table::gc_mark_dyn_syms): New function.
3631 (Symbol_table::gc_): New data member.
3632 * target.h (Sized_target::gc_process_relocs): New pure virtual
3634 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
3635 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
3637 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
3639 * options.h (General_options::gc_sections): Define as a no-op for now.
3640 (General_options::no_keep_memory): Ditto.
3641 (General_options::Bshareable): Define.
3642 * options.cc (General_options::finalize): Honor -Bshareable.
3644 2009-01-20 Andreas Schwab <schwab@suse.de>
3646 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
3647 read the value in the contents, since we don't use it. Use the
3648 template endianness when writing.
3649 (Relocate::relocate): Use it for R_PPC_REL16_HA.
3651 2009-01-19 Andreas Schwab <schwab@suse.de>
3653 * configure.tgt (powerpc64-*): Fix targ_obj.
3655 2009-01-15 Ian Lance Taylor <iant@google.com>
3657 * object.cc (Sized_relobj::write_local_symbols): Don't write out
3658 local symbols when stripping all symbols.
3660 2009-01-14 Cary Coutant <ccoutant@google.com>
3662 * output.cc (Output_reloc): Add explicit instantiations.
3664 2009-01-14 Cary Coutant <ccoutant@google.com>
3666 * archive.cc (Archive::get_elf_object_for_member): Remove call
3667 to File_read::claim_for_plugin.
3668 * descriptors.cc (Descriptors::open): Remove reference to
3670 (Descriptors::claim_for_plugin): Remove.
3671 * descriptors.h (Descriptors::claim_for_plugin): Remove.
3672 (Descriptors::is_claimed): Remove.
3673 (claim_descriptor_for_plugin): Remove.
3674 * fileread.cc (File_read::claim_for_plugin): Remove.
3675 * fileread.h (File_read::claim_for_plugin): Remove.
3676 (File_read::descriptor): Reopen descriptor if necessary.
3677 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
3678 (Plugin_manager::all_symbols_read): Add task parameter. Change
3680 (Plugin_manager::get_input_file): New function.
3681 (Plugin_manager::release_input_file): New function.
3682 (Pluginobj::Pluginobj): Add filesize parameter and initialize
3683 corresponding data member.
3684 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3685 and pass to base constructor. Change all callers.
3686 (get_input_file, release_input_file): New functions.
3687 (make_sized_plugin_object): Add filesize parameter. Change all callers.
3688 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3689 (Plugin_manager::all_symbols_read): Add task parameter.
3690 (Plugin_manager::get_input_file): New function.
3691 (Plugin_manager::release_input_file): New function.
3692 (Plugin_manager::task_): New data member.
3693 (Pluginobj::Pluginobj): Add filesize parameter.
3694 (Pluginobj::filename): New function.
3695 (Pluginobj::descriptor): New function.
3696 (Pluginobj::filesize): New function.
3697 (Pluginobj::filesize_): New data member.
3698 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3699 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3700 File_read::claim_for_plugin; use Object::unlock to unlock the file.
3702 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3703 with archive libraries.
3704 * testsuite/Makefile.in: Regenerate.
3705 * testsuite/plugin_test.c (struct sym_info): New type.
3706 (get_input_file, release_input_file): New static variables.
3707 (onload): Capture new transfer vector entries.
3708 (claim_file_hook): Stop reading at end of file according to filesize.
3709 Factor out parsing of readelf output into separate function.
3710 (all_symbols_read_hook): Exercise get_input_file and release_input_file
3711 APIs and get the source file name from the symbol table. Convert
3712 source file name to corresponding object file name. Print info
3713 message when adding new input files.
3714 (parse_readelf_line): New function.
3715 * testsuite/plugin_test_1.sh: Add checks for new info messages.
3716 * testsuite/plugin_test_2.sh: Likewise.
3717 * testsuite/plugin_test_3.sh: Likewise.
3718 * testsuite/plugin_test_4.sh: New test case.
3720 2009-01-07 Ian Lance Taylor <iant@google.com>
3722 * version.cc (version_string): Bump to 1.8.
3724 2008-12-23 Cary Coutant <ccoutant@google.com>
3726 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3727 * plugin.cc (Plugin_manager::finish): Rename as
3728 layout_deferred_objects. Move cleanup to separate function.
3729 (Plugin_manager::cleanup): New function.
3730 (Plugin_finish::run): Call layout_deferred_objects and cleanup
3732 * plugin.h (Plugin_manager::finish): Rename as
3733 layout_deferred_objects.
3734 (Plugin_manager::cleanup): New function.
3735 (Plugin_manager::cleanup_done): New field.
3737 2008-12-23 Cary Coutant <ccoutant@google.com>
3739 * plugin.cc (is_visible_from_outside): New function.
3740 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3741 so we don't return "IR only" status for exported symbols or -r links.
3743 * testsuite/Makefile.am (plugin_test_3): New test case.
3744 * testsuite/Makefile.in: Regenerate.
3745 * testsuite/plugin_test_3.sh: New file.
3747 2008-12-22 Cary Coutant <ccoutant@google.com>
3749 * object.cc (Sized_relobj::layout_section): New function.
3750 (Sized_relobj::do_layout): Defer layout of input sections until after
3751 plugin has provided replacement files.
3752 (Sized_relobj::do_layout_deferred_sections): New function.
3753 * object.h (Relobj::set_section_offset): Remove virtual keyword.
3754 (Relobj::layout_deferred_sections): New function.
3755 (Relobj::do_layout_deferred_sections): New function.
3756 (Sized_relobj::do_layout_deferred_sections): New function.
3757 (Sized_relobj::layout_section): New function.
3758 (Sized_relobj::Deferred_layout): New structure.
3759 (Sized_relobj::deferred_layout_): New field.
3760 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3761 Change all callers. Layout deferred sections.
3762 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
3764 (Plugin_hook::run): Move code from do_plugin_hook inline.
3765 (Plugin_hook::do_plugin_hook): Remove.
3766 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3767 (Plugin_manager::finish): Renamed, was cleanup.
3768 (Plugin_manager::should_defer_layout): New function.
3769 (Plugin_manager::add_deferred_layout_object): New function.
3770 (Plugin_manager::Deferred_layout_list): New type.
3771 (Plugin_manager::deferred_layout_objects_): New field.
3772 (Plugin_hook::do_plugin_hook): Remove.
3774 2008-12-17 Ian Lance Taylor <iant@google.com>
3776 * options.h (class General_options): Add --no case for
3779 2008-12-16 Cary Coutant <ccoutant@google.com>
3781 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3783 (Plugin_manager::claim_file): Create plugin object even if
3784 plugin did not call the add_symbols callback.
3785 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
3786 asking for more symbols than were added.
3787 * testsuite/Makefile.am (plugin_test_1): Add test case with
3789 (empty.syms): New target.
3790 * testsuite/Makefile.in: Regenerate.
3791 * testsuite/plugin_test.c (claim_file_hook): Add new debug
3792 message. Don't call add_symbols if no globals.
3793 (all_symbols_read_hook): Don't provide replacement for empty
3796 2008-12-12 Ian Lance Taylor <iant@google.com>
3798 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
3799 r_type == 0 for a local symbol with r_sym == 0.
3800 (scan_relocatable_relocs): Pass r_sym to
3801 local_non_section_strategy.
3802 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
3805 * configure.ac: Update test for TLS descriptors: they are
3806 supported as of glibc 2.9.
3807 * configure: Rebuild.
3809 2008-12-11 Ian Lance Taylor <iant@google.com>
3812 * target-reloc.h (Default_scan_relocatable_relocs): For each
3813 function, map r_type == 0 to RELOC_DISCARD.
3815 2008-12-10 Cary Coutant <ccoutant@google.com>
3817 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
3818 object to override a kept COMDAT group from a plugin object.
3820 2008-12-09 Ian Lance Taylor <iant@google.com>
3823 * yyscript.y (file_cmd): Handle INPUT.
3825 * testsuite/initpri1.c: Change all declarations to be full
3826 prototypes by adding void, to avoid compiler warnings.
3828 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
3830 * options.cc (General_options::parse_plugin_opt): New.
3831 (General_options::add_plugin): The argument now is just the filename.
3832 (General_options::add_plugin_option): New.
3833 * options.h (plugin_opt): New.
3834 (add_plugin): Change argument name.
3835 (add_plugin_option): New.
3836 * plugin.cc (Plugin::load): Don't parse the plugin option.
3837 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
3838 (Plugin::add_option): New.
3839 (Plugin::args_): Change type.
3840 (Plugin::filename_): New.
3841 (Plugin_manager::add_plugin_option): New.
3842 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
3843 * testsuite/Makefile.in: Regenerate.
3845 2008-12-05 Cary Coutant <ccoutant@google.com>
3847 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
3848 Handle --strip-lto-sections option.
3849 * options.h (strip_lto_sections): New option.
3851 2008-12-01 Cary Coutant <ccoutant@google.com>
3853 * plugin.cc (ld_plugin_message): Change format parameter to const.
3854 Fix mismatch between new[] and delete.
3856 2008-11-14 Cary Coutant <ccoutant@google.com>
3858 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
3861 2008-11-05 Craig Silverstein <csilvers@google.com>
3863 * options.cc (General_options::parse_dynamic_list): New function.
3864 * options.h (General_options): New flags dynamic_list,
3865 dynamic_list_data, dynamic_list_cpp_new, and
3866 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
3867 (General_options::in_dynamic_list): New function.
3868 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
3869 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
3870 (Lex::can_continue_name): Likewise.
3872 (read_script_file): New parameter script_options.
3873 (read_dynamic_list): New function.
3874 (Script_options::define_dynamic_list): New function.
3875 (dynamic_list_keyword_parsecodes): New variable.
3876 (dynamic_list_keywords): New variable.
3877 * script.h (Script_options::define_dynamic_list): New function
3879 (read_dynamic_list): New function prototype.
3880 * symtab.cc (strprefix): New macro.
3881 (Symbol::should_add_dynsym_entry): Support dynamic_list,
3882 dynamic_list_data, dynamic_list_cpp_new, and
3883 dynamic_list_cpp_typeinfo.
3884 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
3885 (dynamic_list_expr): New rule.
3886 (dynamic_list_nodes): Likewise.
3887 (dynamic_list_node): Likewise.
3888 * testsuite/Makefile.am (dynamic_list): New test.
3889 * testsuite/Makefile.in: Regenerated.
3890 * testsuite/dynamic_list.t: New file.
3891 * testsuite/dynamic_list.sh: New file.
3893 2008-11-05 Craig Silverstein <csilvers@google.com>
3895 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
3896 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
3897 (t11_last): Likewise.
3898 * testsuite/ver_test_6.c (main): Likewise.
3900 2008-10-07 Cary Coutant <ccoutant@google.com>
3902 * options.c (General_options::finalize): Add check for -static and
3904 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
3907 2008-10-02 Cary Coutant <ccoutant@google.com>
3909 * plugin.cc (make_sized_plugin_object): Fix conditional
3910 compilation to work when not all targets are enabled.
3912 2008-09-29 Cary Coutant <ccoutant@google.com>
3914 * archive.cc (Archive::get_file_and_offset): Use filename instead
3915 of name to get library path.
3916 (Archive::include_member): Unlock external member of a thin archive.
3918 * testsuite/Makefile.am (TEST_AR): New variable.
3919 (thin_archive_test_1): New test.
3920 (thin_archive_test_2): New test.
3921 * testsuite/Makefile.in: Regenerate.
3922 * testsuite/thin_archive_main.cc: New file.
3923 * testsuite/thin_archive_test_1.cc: New file.
3924 * testsuite/thin_archive_test_2.cc: New file.
3925 * testsuite/thin_archive_test_3.cc: New file.
3926 * testsuite/thin_archive_test_4.cc: New file.
3928 2008-09-29 Cary Coutant <ccoutant@google.com>
3930 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
3931 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
3933 (Sized_relobj::do_finalize_local_symbols): Likewise.
3934 (Sized_relobj::map_to_kept_section): Likewise.
3935 * object.h (Sized_relobj::invalid_address): New constant.
3936 (Sized_relobj::do_output_section_offset): Check for invalid_address
3938 * output.cc (Output_reloc::local_section_offset): Use constant
3939 invalid_address instead of -1U.
3940 (Output_reloc::get_address): Likewise.
3941 (Output_section::output_address): Change -1U to -1ULL.
3942 * output.h (Output_reloc::invalid_address): New constant.
3943 * reloc.cc (Sized_relobj::write_sections): Use constant
3944 invalid_address instead of -1U.
3945 (Sized_relobj::relocate_sections): Likewise.
3946 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
3947 values for merge sections.
3948 * target-reloc.h (relocate_for_relocatable): Use constant
3949 invalid_address instead of -1U.
3951 2008-09-19 Cary Coutant <ccoutant@google.com>
3953 Add plugin functionality for link-time optimization (LTO).
3954 * configure.ac (plugins): Add --enable-plugins option.
3955 * configure: Regenerate.
3956 * config.in: Regenerate.
3957 * Makefile.am (LIBDL): New variable.
3958 (CCFILES): Add plugin.cc.
3959 (HFILES): Add plugin.h.
3960 (ldadd_var): Add LIBDL.
3961 * Makefile.in: Regenerate.
3963 * archive.cc: Include "plugin.h".
3964 (Archive::setup): Don't preread archive symbols when using a plugin.
3965 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
3966 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
3968 (Archive::include_member): Add symbols from plugin objects.
3969 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
3970 * descriptors.cc (Descriptors::open): Check for file descriptors
3971 abandoned by plugins.
3972 (Descriptors::claim_for_plugin): New function.
3973 * descriptors.h (Descriptors::claim_for_plugin): New function.
3974 (Open_descriptor::is_claimed): New field.
3975 (claim_descriptor_for_plugin): New function.
3976 * fileread.cc (File_read::claim_for_plugin): New function.
3977 * fileread.h (File_read::claim_for_plugin): New function.
3978 (File_read::descriptor): New function.
3979 * gold.cc: Include "plugin.h".
3980 (queue_initial_tasks): Add task to call plugin hooks for generating
3982 * main.cc: Include "plugin.h".
3983 (main): Load plugin libraries.
3984 * object.h (Pluginobj): Declare.
3985 (Object::pluginobj): New function.
3986 (Object::do_pluginobj): New function.
3987 (Object::set_target): New function.
3988 * options.cc: Include "plugin.h".
3989 (General_options::parse_plugin): New function.
3990 (General_options::General_options): Initialize plugins_ field.
3991 (General_options::add_plugin): New function.
3992 * options.h (Plugin_manager): Declare.
3993 (General_options): Add --plugin option.
3994 (General_options::has_plugins): New function.
3995 (General_options::plugins): New function.
3996 (General_options::add_plugin): New function.
3997 (General_options::plugins_): New field.
3998 * plugin.cc: New file.
3999 * plugin.h: New file.
4000 * readsyms.cc: Include "plugin.h".
4001 (Read_symbols::do_read_symbols): Check for archive before checking
4002 for ELF file. Call plugin hooks to claim files.
4003 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4004 from a real object file; force override when processing replacement
4006 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4007 (Symbol::init_base_object): Likewise.
4008 (Symbol::init_base_output_data): Likewise.
4009 (Symbol::init_base_output_segment): Likewise.
4010 (Symbol::init_base_constant): Likewise.
4011 (Symbol::init_base_undefined): Likewise.
4012 (Symbol::output_section): Assert that object is not a plugin.
4013 (Symbol_table::add_from_pluginobj): New function.
4014 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4016 (Symbol_table::sized_write_globals): Likewise.
4017 (Symbol_table::add_from_pluginobj): Instantiate template.
4018 * symtab.h (Sized_pluginobj): Declare.
4019 (Symbol::in_real_elf): New function.
4020 (Symbol::set_in_real_elf): New function.
4021 (Symbol::in_real_elf_): New field.
4022 (Symbol_table::add_from_pluginobj): New function.
4024 * testsuite/Makefile.am (AM_CFLAGS): New variable.
4025 (LIBDL): New variable.
4027 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4028 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4029 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4030 (MOSTLYCLEANFILES): Likewise.
4031 * testsuite/Makefile.in: Regenerate.
4032 * testsuite/plugin_test.c: New file.
4033 * testsuite/plugin_test_1.sh: New file.
4034 * testsuite/plugin_test_2.sh: New file.
4036 2008-09-16 Ian Lance Taylor <iant@google.com>
4038 * target-reloc.h (relocate_section): Check whether a symbol is
4039 defined by the ABI before reporting an undefined symbol error.
4040 * target.h (Target::is_defined_by_abi): Make parameter const.
4041 (Target::do_is_defined_by_abi): Likewise.
4042 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4043 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4044 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4045 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4046 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4047 * testsuite/Makefile.in: Rebuild.
4049 * fileread.cc (make_view): Add casts to avoid warning.
4051 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4053 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4054 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4056 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
4058 * options.h (General_options::output_is_executable): New.
4059 (General_options::output_is_pie): New.
4060 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4061 for shared libraries.
4062 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4064 2008-09-11 Chris Demetriou <cgd@google.com>
4066 * options.h (origin): New -z option.
4067 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4068 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4071 2008-09-05 Cary Coutant <ccoutant@google.com>
4073 * fileread.cc (File_read::make_view): Add check for attempt to map
4076 2008-09-05 Cary Coutant <ccoutant@google.com>
4078 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4079 explicit instantiations.
4081 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
4084 * options.cc (General_options::finalize): Allow undefined symbols
4085 in shlibs if linking -shared.
4088 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4089 symbols as not needing a dynsym entry.
4091 2008-08-20 Craig Silverstein <csilvers@google.com>
4093 * fileread.cc (File_read::open): Do not lock the file unless it
4094 was successfully opened.
4096 2008-08-14 Cary Coutant <ccoutant@google.com>
4098 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4099 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4100 * testsuite/tls_test.cc (struct int128): 128-bit struct
4101 for testing TLS relocs with non-zero addend.
4102 (v12): New TLS variable.
4104 (t_last): Add check for v12.
4105 * testsuite/tls_test.h (t12): New function.
4106 * testsuite/tls_test_main.cc (thread_routine): Call new test.
4108 2008-08-13 Ian Lance Taylor <iant@google.com>
4110 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4111 set tls_segment_ or relro_segment_.
4112 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4114 * output.h (Output_section::clear_is_relro): New function.
4115 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4116 sections specially even when output_data_ is empty.
4117 (Output_segment::maximum_alignment): When first section is relro,
4118 only force alignment for PT_LOAD segments.
4119 * script.cc (script_data_segment_align): New function.
4120 (script_data_segment_relro_end): New function.
4121 * script-c.h (script_data_segment_align): Declare.
4122 (script_data_segment_relro_end): Declare.
4123 * script-sections.h (class Script_sections): Declare
4124 data_segment_align and data_segment_relro_end. Add fields
4125 segment_align_index_ and saw_relro_end_.
4126 * script-sections.cc (class Sections_element): Add set_is_relro
4127 virtual function. Add new bool* parameter to place_orphan_here.
4128 Add get_output_section virtual function.
4129 (class Output_section_definition): Add set_is_relro. Add new
4130 bool* parameter to place_orphan_here. Add get_output_section.
4131 Add is_relro_ field.
4132 (Output_section_definition::Output_section_definition): Initialize
4133 evaluated_address_, evaluated_load_address, evaluated_addralign_,
4134 and is_relro_ fields.
4135 (Output_section_definition::place_orphan_here): Add is_relro
4137 (Output_section_definition::set_section_addresses): Set relro for
4139 (Output_section_definition::alternate_constraint): Likewise.
4140 (class Orphan_output_section): Add new bool* parameter to
4141 place_orphan_here. Add get_output_section.
4142 (Orphan_output_section::place_orphan_here): Add is_relro
4144 (Script_sections::Script_sections): Initialize
4145 data_segment_align_index_ and saw_relro_end_.
4146 (Script_sections::data_segment_align): New function.
4147 (Script_sections::data_segment_relro_end): New function.
4148 (Script_sections::place_orphan): Set or clear is_relro.
4149 (Script_sections::set_section_addresses): Force alignment of first
4151 * yyscript.y (exp): Call script_data_segment_align and
4152 script_data_segment_relro_end.
4153 * testsuite/relro_script_test.t: New file.
4154 * testsuite/relro_test.cc (using_script): Declare.
4155 (t1, t2): Test using_script.
4156 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4157 (relro_script_test_SOURCES): Define.
4158 (relro_script_test_DEPENDENCIES): Define.
4159 (relro_script_test_LDFLAGS): Define.
4160 (relro_script_test_LDADD): Define.
4161 (relro_script_test.so): New target.
4162 * testsuite/Makefile.in: Rebuild.
4164 2008-08-06 Cary Coutant <ccoutant@google.com>
4166 * archive.cc (Archive::total_archives, Archive::total_members)
4167 (Archive::total_members_loaded): New variables.
4168 (Archive::setup): Add parameter. Add option to preread
4170 (Archive::read_armap): Add counter.
4171 (Archive::get_file_and_offset): New function.
4172 (Archive::get_elf_object_for_member): New function.
4173 (Archive::read_all_symbols): New function.
4174 (Archive::read_symbols): New function.
4175 (Archive::add_symbols): Add counters.
4176 (Archive::include_all_members): Use armap to find members if it's
4178 (Archive::include_member): Skip reading symbols if already read.
4179 Factored code into Archive::get_file_and_offset and
4180 Archive::get_elf_object_for_member. Changed call to
4181 Mapfile::report_include_archive_member.
4182 (Archive::print_stats): New function.
4183 * archive.h: Declare Object and Read_symbols_data classes.
4184 (Archive::Archive): Add initializers for new members.
4185 (Archive::setup): Add parameter.
4186 (Archive::print_stats): New function.
4187 (Archive::total_archives, Archive::total_members)
4188 (Archive::total_members_loaded): New variables.
4189 (Archive::get_file_and_offset): New function.
4190 (Archive::get_elf_object_for_member): New function.
4191 (Archive::read_all_symbols): New function.
4192 (Archive::read_symbols): New function.
4193 (Archive::Archive_member): New class.
4194 (Archive::members_): New member.
4195 (Archive::num_members_): New member.
4196 * main.cc: Include archive.h.
4197 (main): Call Archive::print_stats.
4198 * mapfile.cc (Mapfile::report_include_archive_member): Delete
4199 archive parameter; member_name is now the fully-decorated name.
4200 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4201 * options.h: (General_options): Add --preread-archive-symbols option.
4202 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4205 2008-08-04 Ian Lance Taylor <iant@google.com>
4207 * symtab.h (Symbol::use_plt_offset): New function.
4208 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4209 * powerpc.cc (Relocate::relocate): Likewise.
4210 * sparc.cc (Relocate::relocate): Likewise.
4211 * x86_64.cc (Relocate::relocate): Likewise.
4212 * testsuite/weak_plt.sh: New test.
4213 * testsuite/weak_plt_main.cc: New test.
4214 * testsuite/weak_plt_shared.cc: New test.
4215 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4216 (check_PROGRAMS): Add weak_plt.
4217 (check_DATA): Add weak_plt_shared.so.
4218 (weak_plt_main_pic.o, weak_plt): New targets.
4219 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4220 * testsuite/Makefile.in: Rebuild.
4222 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4224 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4225 * testsuite/Makefile.in: Rebuild.
4227 2008-08-04 Alan Modra <amodra@bigpond.net.au>
4229 * Makefile.am (POTFILES.in): Set LC_ALL=C.
4230 * Makefile.in: Regenerate.
4231 * po/POTFILES.in: Regenerate.
4233 2008-07-29 Ian Lance Taylor <iant@google.com>
4235 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4236 symbols before other symbols.
4237 * testsuite/script_test_2.cc (test_addr): Declare.
4238 (test_addr_alias): Declare.
4239 (main): Check that test_addr and test_addr_alias have the right
4241 * testsuite/script_test_2.t: Define test_addr_alias and
4244 2008-07-24 Ian Lance Taylor <iant@google.com>
4247 * descriptors.cc: New file.
4248 * descriptors.h: New file.
4249 * gold-threads.h (class Hold_optional_lock): New class.
4250 * fileread.cc: Include "descriptors.h".
4251 (File_read::~File_read): Release descriptor rather than closing
4253 (File_read::open) [file]: Call open_descriptor rather than open.
4254 Set is_descriptor_opened_.
4255 (File_read::open) [memory]: Assert that descriptor is not open.
4256 (File_read::reopen_descriptor): New function.
4257 (File_read::release): Release descriptor.
4258 (File_read::do_read): Make non-const. Reopen descriptor.
4259 (File_read::read): Make non-const.
4260 (File_read::make_view): Reopen descriptor.
4261 (File_read::do_readv): Likewise.
4262 * fileread.h (class File_read): Add is_descriptor_opened_ field.
4263 Update declarations.
4264 * layout.cc: Include "descriptors.h".
4265 (Layout::create_build_id): Use open_descriptor rather than open.
4266 * output.cc: Include "descriptors.h".
4267 (Output_file::open): Use open_descriptor rather than open.
4268 * archive.cc (Archive::const_iterator): Change Archive to be
4270 (Archive::begin, Archive::end): Make non-const.
4271 (Archive::count_members): Likewise.
4272 * archive.h (class Archive): Update declarations.
4273 * object.h (Object::read): Make non-const.
4274 * Makefile.am (CCFILES): Add descriptors.cc.
4275 (HFILES): Add descriptors.h.
4276 * Makefile.in: Rebuild.
4279 * gold.h: Always include <clocale>. Add Solaris workarounds
4280 following code in binutils/sysdep.h.
4283 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4284 this->eh_frame_hdr_ is NULL before using it.
4286 * dynobj.cc (Versions::Versions): Update comment.
4288 * dynobj.cc (Versions::Versions): If there is an soname, use it as
4289 the base version name.
4291 * stringpool.cc (Stringpool_template::add_with_length): Set key to
4292 array size plus one.
4293 (Stringpool_template::set_string_offsets): Subtract one from key
4294 before using it as an array index.
4295 (Stringpool_template::get_offset_with_length): Likewise.
4296 (Stringpool_template::write_to_buffer): Likewise.
4297 * stringpool.h (Stringpool_template::get_offset_from_key):
4300 2008-07-23 Ian Lance Taylor <iant@google.com>
4303 * object.h (Merged_symbol_value::value): Do our best to handle a
4307 * script.cc (Version_script_info::get_versions): Don't add empty
4308 version tag to return value.
4309 (Version_script_info::get_symbol_version_helper): Change return
4310 type to bool. Add pversion parameter. Change all callers.
4311 (script_register_vers_node): Don't require a non-NULL tag.
4312 * script.h (class Version_script_info): Update declarations.
4313 (Version_script_info::get_symbol_version): Change return type to
4314 bool. Add version parameter. Change all callers.
4315 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4316 handling. Handle an empty version from a version script.
4317 (Symbol_table::define_special_symbol): Likewise.
4318 * testsuite/ver_test_10.script: New file.
4319 * testsuite/ver_test_10.sh: New file.
4320 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4321 (check_DATA): Add ver_test_10.syms.
4322 (ver_test_10.syms, ver_test_10.so): New target.
4323 * testsuite/Makefile.in: Rebuild.
4325 2008-07-23 Simon Baldwin <simonb@google.com>
4327 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4328 to zero for undefined symbols from dynamic libraries.
4330 2008-07-23 Ian Lance Taylor <iant@google.com>
4332 * symtab.cc (Symbol_table::resolve): Remove version parameter.
4334 * symtab.h (class Symbol_table): Update declaration.
4335 * testsuite/ver_test_9.cc: New file.
4336 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4337 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4338 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4339 (ver_test_9.so, ver_test_9.o): New targets.
4340 * testsuite/Makefile.in: Rebuild.
4342 2008-07-22 Ian Lance Taylor <iant@google.com>
4344 * options.h (class General_options): Define --check-sections.
4345 * layout.cc (Layout::set_segment_offsets): Handle
4348 * options.h (class General_options): Define -n/--nmagic and
4350 * options.cc (General_options::finalize): For -n/--nmagic or
4351 -N/--omagic, set -static.
4352 * layout.cc (Layout::attach_allocated_section_to_segment): If
4353 -N/--omagic, don't put read-only and read-write sections in
4355 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4356 finding a read-only segment.
4357 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4358 don't set the minimum segment alignment to the common page size,
4359 and don't set the file offset to the address modulo the page size.
4360 * script-sections.cc (Script_sections::create_segments): If
4361 -n/--omagic, don't put read-only and read-write sections in
4364 * cref.cc: New file.
4366 * options.h (class General_options): Add --print-symbol-counts.
4367 * main.cc (main): Issue defined symbol report if requested.
4368 * archive.cc (Archive::interpret_header): Make into a const member
4370 (Archive::add_symbols): Call Input_objects::archive_start and
4372 (Archive::const_iterator): Define new class.
4373 (Archive::begin, Archive::end): New functions.
4374 (Archive::include_all_members): Rewrite to use iterator.
4375 (Archive::count_members): New function.
4376 * archive.h (class Archive): Update declarations.
4377 (Archive::filename): New function.
4378 * object.cc: Include "cref.h".
4379 (Sized_relobj::Sized_relobj): Initialize defined_count_.
4380 (Sized_relobj::do_get_global_symbol_counts): New function.
4381 (Input_objects::add_object): Add object to cross-referencer.
4382 (Input_objects::archive_start): New function.
4383 (Input_objects::archive_stop): New function.
4384 (Input_objects::print_symbol_counts): New function.
4385 * object.h: Declare Cref and Archive.
4386 (Object::get_global_symbol_counts): New function.
4387 (Object::do_get_global_symbol_counts): New pure virtual function.
4388 (class Sized_relobj): Add defined_count_ field. Update
4390 (class Input_objects): Add cref_ field. Update constructor.
4391 Update declarations.
4392 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4394 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4396 (Sized_dynobj::do_get_global_symbol_counts): New function.
4397 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4398 defined_count_. Update declarations. Define Symbols typedef.
4399 * symtab.cc (Symbol_table::add_from_relobj): Add defined
4400 parameter. Change all callers.
4401 (Symbol_table::add_from_dynobj): Add sympointers and defined
4402 parameters. Change all callers.
4403 * symtab.h (class Symbol_table): Update declarations.
4404 * Makefile.am (CCFILES): Add cref.cc.
4405 (HFILES): Add cref.h.
4406 * Makefile.in: Rebuild.
4408 2008-07-22 Simon Baldwin <simonb@google.com>
4410 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4411 to zero when writing undefined symbols.
4413 2008-07-22 Ian Lance Taylor <iant@google.com>
4415 * output.cc (Output_section::add_input_section): Don't try to
4416 merge empty merge sections.
4418 2008-07-21 Craig Silverstein <csilvers@google.com>
4420 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4421 Include symbol version in error message.
4423 2008-07-20 Chris Demetriou <cgd@google.com>
4425 * configure.ac (gold_cv_c_random_seed): New configured variable.
4426 (RANDOM_SEED_CFLAGS): New substituted variable.
4427 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4428 * configure: Rebuild.
4429 * Makefile.in: Likewise.
4430 * testsuite/Makefile.in: Likewise.
4432 2008-07-18 Ian Lance Taylor <iant@google.com>
4434 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4435 where we see NAME/NULL and NAME/VERSION as separate symbols.
4436 * testsuite/ver_test_main.cc (main): Call t4.
4437 (t4, t4_2a): Define.
4438 * testsuite/ver_test_2.cc (t4_2): Define.
4439 * testsuite/ver_test_2.script: Put t4_2a in VER2.
4440 * testsuite/ver_test_4.cc (t4_2a): Define.
4441 * testsuite/ver_test_4.script: Put t4_2a in VER2.
4442 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4444 2008-07-17 Ian Lance Taylor <iant@google.com>
4446 * dynobj.cc (Versions::add_def): If we give an error about a
4447 missing version, go ahead and create the version anyhow.
4449 2008-07-10 Ian Lance Taylor <iant@google.com>
4451 Handle output sections with more than 0x7fffffff bytes.
4452 * object.h (class Relobj): Change map_to_output_ to
4453 output_sections_, and just keep a section pointer. Change all
4454 uses. Move comdat group support to Sized_relobj.
4455 (Relobj::is_section_specially_mapped): Remove.
4456 (Relobj::output_section): Remove poff parameter. Change all
4458 (Relobj::output_section_offset): New function.
4459 (Relobj::set_section_offset): Rewrite.
4460 (Relobj::map_to_output): Remove.
4461 (Relobj::output_sections): New function.
4462 (Relobj::do_output_section_offset): New pure virtual function.
4463 (Relobj::do_set_section_offset): Likewise.
4464 (class Sized_relobj): Add section_offsets_ field. Add comdat
4465 group support from Relobj. Update declarations.
4466 (Sized_relobj::get_output_section_offset): New function.
4467 (Sized_relobj::do_output_section_offset): New function.
4468 (Sized_relobj::do_set_section_offset): New function.
4469 * object.cc (Relobj::output_section_address): Remove.
4470 (Sized_relobj::Sized_relobj): Initialize new fields.
4471 (Sized_relobj::include_section_group): Cast find_kept_object to
4473 (Sized_relobj::include_linkonce_section): Likewise.
4474 (Sized_relobj::do_layout): Use separate arrays for output section
4476 (Sized_relobj::do_count_local_symbols): Change map_to_output to
4478 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4479 output_sections and section_offsets.
4480 (Sized_relobj::write_local_symbols): Likewise.
4481 (map_to_kept_section): Compute output address directly.
4482 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4483 output_sections and section_offsets.
4484 (Sized_relobj::write_sections): Likewise.
4485 (Sized_relobj::relocate_sections): Likewise.
4486 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4487 * output.h (class Output_reloc): Update declarations. Change
4488 u2_.relobj to Sized_relobj*.
4489 (class Output_data_reloc): Change add functions to use
4491 * output.cc (Output_reloc::Output_reloc): Change relobj to
4493 (Output_reloc::local_section_offset): Change return type to
4494 Elf_Addr. Use get_output_section_offset.
4495 (Output_reloc::get_address): Likewise.
4496 (Output_section::is_input_address_mapped): Don't call
4497 is_section_specially_mapped.
4498 (Output_section::output_offset): Likewise.
4499 (Output_section::output_address): Likewise.
4500 (Output_section::starting_output_address): Likewise.
4501 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4502 parameter to Sized_relobj*.
4503 (Copy_relocs::need_copy_reloc): Likewise.
4504 (Copy_relocs::save): Likewise.
4505 * copy-relocs.h (class Copy_relocs): Update declarations.
4506 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4507 Sized_relobj*. Change relobj_ field to Sized_relobj*.
4508 * target-reloc.h (relocate_for_relocatable): Change
4509 offset_in_output_section type to Elf_Addr. Change code that uses
4511 * layout.cc (Layout::layout): Always set *off.
4512 * mapfile.cc (Mapfile::print_input_section): Use
4513 output_section_offset.
4514 * i386.cc (Target_i386::copy_reloc): Change object parameter to
4516 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
4517 * sparc.cc (Target_sparc::copy_reloc): Likewise.
4518 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
4520 2008-07-03 Ian Lance Taylor <iant@google.com>
4522 * layout.cc (Layout::include_section): Do not discard unrecognized
4523 SHT_STRTAB sections.
4525 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
4527 * script.cc (Lex::can_continue_name): Make '?' allowable in
4528 version-script names.
4529 * testsuite/version_script.map: Change glob pattern to use '?'
4531 2008-06-30 Manish Singh <yosh@gimp.org>
4534 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
4537 2008-06-30 Ian Lance Taylor <iant@google.com>
4541 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
4542 versions]: Don't try to read the value in the contents, since we
4543 don't use it. Use the template endianness when writing.
4545 2008-06-25 Cary Coutant <ccoutant@google.com>
4547 * fileread.cc (File_read::make_view): Assert on zero-length view.
4548 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
4549 symbol table when there are no symbols to read.
4551 2008-06-23 Craig Silverstein <csilvers@google.com>
4553 * version.cc (version_string): Bump to 1.7
4555 2008-06-18 Craig Silverstein <csilvers@google.com>
4557 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4558 constant 0xFFFF to type Valtype.
4559 (Powerpc_relocate_functions::rel16_ha): Likewise.
4561 2008-06-17 Ian Lance Taylor <iant@google.com>
4563 * output.h (Output_section::Input_section): Initialize p2align_ to
4564 zero for Output_section_data constructors.
4565 (Output_section::Input_section::addralign): If not an input
4566 section, return the alignment of the Output_section_data.
4567 * testsuite/copy_test.cc: New file.
4568 * testsuite/copy_test_1.cc: New file.
4569 * testsuite/copy_test_2.cc: New file.
4570 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
4571 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
4572 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
4573 (copy_test_1_pic.o, copy_test_1.so): New targets.
4574 (copy_test_2_pic.o, copy_test_2.so): New targets.
4575 * testsuite/Makefile.in: Rebuild.
4577 * script-sections.cc (Script_sections::place_orphan): Initialize
4578 local variable exact.
4580 2008-06-13 David Edelsohn <edelsohn@gnu.org>
4582 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
4584 2008-06-12 David Edelsohn <edelsohn@gnu.org>
4585 David S. Miller <davem@davemloft.net>
4587 * powerpc.cc: New file.
4588 * Makefile.am (TARGETSOURCES): Add powerpc.cc
4589 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4590 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4591 * Makefile.in: Rebuild.
4593 2008-06-09 Ian Lance Taylor <iant@google.com>
4595 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4597 (throwing, orig_terminate): New static variables.
4598 (terminate_handler): New static function.
4599 (t2): Set terminate handler.
4601 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
4604 * binary.cc (Binary_to_elf::sized_convert): Fix .data
4607 2008-05-30 Cary Coutant <ccoutant@google.com>
4609 * archive.cc (Archive::include_all_members) Correct to step
4610 over symbol table and extended name table in thin archives.
4612 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
4615 * target-reloc.h (relocate_for_relocatable): Fix new_offset
4618 2008-05-28 Caleb Howe <cshowe@google.com>
4620 * reduced_debug_output.cc: New file.
4621 * reduced_debug_output.h: New file.
4622 * options.h (class General_options): Add --strip-debug-non-line.
4623 * options.cc (General_options::finalize): Add strip_debug_non_line
4624 to the strip heirarchy.
4625 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
4627 * layout.cc: Include "reduced_debug_output.h".
4628 (Layout::Layout): Initialize new fields.
4629 (line_only_debug_sections): New static array.
4630 (is_lines_only_debug_sections): New static inline function.
4631 (Layout::include_section): Handle --strip-debug-non-line.
4632 (Layout::make_output_section): If --strip-debug-non-line, build
4633 new output sections for .debug_abbrev and .debug_info.
4634 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
4635 gold. Warn about possible overflow.
4636 (read_signed_LEB_128): Likewise.
4637 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
4638 (read_signed_LEB_128): Declare.
4639 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
4640 (HFILES): Add reduced_debug_output.h.
4641 * Makefile.in: Rebuild.
4643 2008-05-21 Ian Lance Taylor <iant@google.com>
4645 * mapfile.cc: New file.
4646 * mapfile.h: New file.
4647 * options.h (class General_options): Add -M/--print-map and -Map.
4648 * options.cc (General_options::finalize): Make -M equivalent to
4650 * main.cc: Include <cstdio> and "mapfile.h".
4651 (main): Open mapfile if requested.
4652 * gold.cc (class Middle_runner): Add mapfile_ field. Update
4653 constructor. Change caller.
4654 (queue_initial_tasks): Add mapfile parameter. Change caller.
4655 (queue_middle_tasks): Likewise.
4656 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4658 * archive.cc: Include "mapfile.h".
4659 (Archive::add_symbols): Add mapfile parameter. Change all
4660 callers. Pass mapfile, symbol, and reason to include_member.
4661 (Archive::include_all_members): Add mapfile parameter. Change all
4663 (Archive::include_member): Add mapfile, sym, and why parameters.
4664 Change all callers. Report inclusion to map file.
4665 * archive.h: Include "fileread.h".
4666 (class Archive): Update declarations.
4667 (Archive::file): New const method.
4668 (class Add_archive_symbols): Add mapfile_ field. Update
4669 constructor. Change all callers.
4670 * readsyms.h (class Read_symbols): Likewise.
4671 (class Finish_group): Likewise.
4672 (class Read_script): Likewise.
4673 * common.cc: Include "mapfile.h".
4674 (Symbol_table::allocate_commons): Add mapfile parameter. Change
4676 (Symbol_table::do_allocate_commons): Likewise.
4677 (Symbol_table::do_allocate_commons_list): Likewise. Report common
4678 symbol allocation to mapfile.
4679 * common.h (class Allocate_commons_task): Add mapfile_ field.
4680 Update constructor. Change all callers.
4681 * symtab.h (class Symbol_table): Update declarations.
4682 * layout.cc: Include "mapfile.h".
4683 (Layout_task_runner::run): Print information to mapfile.
4684 (Layout::create_gold_note): Change Output_data_fixed_space to
4685 Output_data_zero_fill.
4686 (Layout::create_build_id): Likewise.
4687 (Layout::print_to_mapfile): New function.
4688 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
4689 constructor. Change caller.
4690 (class Layout): Declare print_to_mapfile.
4691 * output.cc (Output_section::Input_section::print_to_mapfile): New
4693 (Output_section::add_input_section): If producing a map, always
4694 add to input_sections_ list.
4695 (Output_section::do_print_to_mapfile): New function.
4696 (Output_segment::print_sections_to_mapfile): New function.
4697 (Output_segment::print_section_list_to_mapfile): New function.
4698 * output.h: Include "mapfile.h".
4699 (Output_data::print_to_mapfile): New function.
4700 (Output_data::do_print_to_mapfile): New virtual function.
4701 (Output_segment_headers::do_print_to_mapfile): New function.
4702 (Output_file_header::do_print_to_mapfile): New function.
4703 (Output_data_const::do_print_to_mapfile): New function.
4704 (class Output_data_const_buffer): Add map_name_ field. Update
4705 constructor. Change all callers. Add do_print_to_mapfile
4707 (class Output_data_fixed_space): Likewise.
4708 (class Output_data_space): Likewise.
4709 (class Output_data_zero_fill): New class.
4710 (Output_data_strtab::do_print_to_mapfile): New function.
4711 (Output_data_reloc_base::do_print_to_mapfile): New function.
4712 (Output_relocatable_relocs::do_print_to_mapfile): New function.
4713 (Output_data_group::do_print_to_mapfile): New function.
4714 (Output_data_got::do_print_to_mapfile): New function.
4715 (Output_data_dynamic::do_print_to_mapfile): New function.
4716 (Output_symtab_xindex::do_print_to_mapfile): New function.
4717 (class Output_section): Declare do_print_to_mapflie. Declare
4718 print_to_mapfile in Input_section.
4719 (class Output_segment): Declare new functions.
4720 * object.h (Sized_relobj::symbol_count): New function.
4721 * script-sections.cc
4722 (Output_section_element_dot_assignment::set_section_addresses):
4723 Change Output_data_fixed_space to Output_data_zero_fill.
4724 (Output_data_expression::do_print_to_mapfile): New function.
4725 * script.cc (read_input_script): Add mapfile parameter. Change
4727 * script.h (read_input_script): Update declaration.
4728 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4729 (Eh_frame::do_print_to_mapfile): New function.
4730 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4731 (Output_merge_string::do_print_to_mapfile): New function.
4732 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4734 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4736 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4738 * Makefile.am (CCFILES): Add mapfile.cc.
4739 (HFILES): Add mapfile.h.
4740 * Makefile.in: Rebuild.
4742 2008-05-19 Ian Lance Taylor <iant@google.com>
4744 * options.h (class General_options): Add -z relro.
4745 * layout.cc (Layout::Layout): Initialize relro_segment_.
4746 (Layout::add_output_section_data): Return the output section.
4747 (Layout::make_output_section): Rcognize relro sections and mark
4749 (Layout::attach_allocated_section_to_segment): Put relro sections
4750 in a PT_GNU_RELRO segment.
4751 (Layout::create_initial_dynamic_sections): Mark the .dynamic
4753 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4755 (Layout::linkonce_mapping): Map d.rel.ro.local to
4757 (Layout::output_section_name): Us .data.rel.ro.local for any
4758 section which begins with that.
4759 * layout.h (class Layout): Update add_output_section_data
4760 declaration. Add relro_segment_ field.
4761 * output.cc (Output_section::Output_section): Initialize is_relro_
4762 and is_relro_local_ fields.
4763 (Output_segment::add_output_section): Group relro sections.
4764 (Output_segment::is_first_section_relro): New function.
4765 (Output_segment::maximum_alignment): If there is a relro section,
4766 align the segment to the common page size.
4767 (Output_segment::set_section_addresses): Track whether we are
4768 looking at relro sections. If the last section is a relro
4769 section, align to the common page size.
4770 (Output_segment::set_section_list_addresses): Add in_relro
4771 parameter. Change all callers. Align to the page size when
4772 moving from relro to non-relro section.
4773 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4775 * output.h (class Output_section): Add is_relro_ and
4776 is_relro_local_ fields.
4777 (Output_section::is_relro): New function.
4778 (Output_section::set_is_relro): New function.
4779 (Output_section::is_relro_local): New function.
4780 (Output_section::set_is_relro_local): New function.
4781 (class Output_segment): Update declarations.
4782 * i386.cc (Target_i386::got_section): Mark .got section as relro.
4783 * sparc.cc (Target_sparc::got_section): Likewise.
4784 * x86_64.cc (Target_x86_64::got_section): Likewise.
4785 * testsuite/relro_test_main.cc: New file.
4786 * testsuite/relro_test.cc: New file.
4787 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
4788 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
4789 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
4790 (relro_test.so, relro_test_pic.o): New targets.
4791 * testsuite/Makefile.in: Rebuild.
4793 2008-05-16 Ian Lance Taylor <iant@google.com>
4795 * output.cc (Output_segment::add_output_section): Remove front
4797 * output.h (class Output_segment): Remove
4798 add_initial_output_section and overloaded add_output_section.
4799 Update declaration of remaining add_output_section.
4800 * layout.cc (Layout::create_interp): Call add_output_section
4801 rather than add_initial_output_section.
4802 (Layout::finish_dynamic_section): Likewise.
4804 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
4805 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
4806 know the dynamic type.
4807 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
4808 field. Initialize it in constructor.
4809 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
4810 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
4811 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
4814 * output.cc (Output_reloc::get_address): Change return type to
4816 * output.h (class Output_reloc): Update get_address declaration.
4817 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
4818 for section addresses.
4820 2008-05-09 Ian Lance Taylor <iant@google.com>
4823 * gold.cc (gold_nomem): Use return value of write.
4825 2008-05-08 Ian Lance Taylor <iant@google.com>
4827 * symtab.c (Symbol::init_base_output_data): Add version
4828 parameter. Change all callers.
4829 (Symbol::init_base_output_segment): Likewise.
4830 (Symbol::init_base_constant): Likewise.
4831 (Symbol::init_base_undefined): Likewise.
4832 (Sized_symbol::init_output_data): Likewise.
4833 (Sized_symbol::init_output_segment): Likewise.
4834 (Sized_symbol::init_constant): Likewise.
4835 (Sized_symbol::init_undefined): Likewise.
4836 (Symbol_table::do_define_in_output_data): If the new symbol has a
4837 version, mark it as the default.
4838 (Symbol_table::do_define_in_output_segment): Likewise.
4839 (Symbol_table::do_define_as_constant): Likewise.
4840 * symtab.h (class Symbol): Update declarations.
4841 (class Sized_symbol): Likewise.
4842 * resolve.cc (Symbol::override_version): New function.
4843 (Symbol::override_base): Call override_version.
4844 (Symbol::override_base_with_special): Likewise.
4845 * testsuite/ver_script_8.script: New file.
4846 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
4847 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
4848 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
4849 (ver_test_8_1.so, ver_test_8_2.so): New targets.
4851 2008-05-06 Ian Lance Taylor <iant@google.com>
4854 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
4856 (class General_options): Remove existing --undefined, and add
4857 --no-undefined instead. Add new --undefined as synonym for -u.
4858 * archive.cc (Archive::add_symbols): Check whether symbol was
4860 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
4861 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
4862 all uses. Add IS_UNDEFINED. Update declarations to split
4863 different versions of init_base. Declare init_base_undefined.
4864 (Symbol::is_defined): Handle IS_UNDEFINED.
4865 (Symbol::is_undefined): Likewise.
4866 (Symbol::is_weak_undefined): Call is_undefined.
4867 (Symbol::is_absolute): Handle IS_CONSTANT.
4868 (class Sized_symbol): Update declarations to split different
4869 versions of init. Declare init_undefined.
4870 (class Symbol_table): Declare new functions.
4871 * symtab.cc (Symbol::init_base_object): Rename from init_base.
4873 (Symbol::init_base_output_data): Likewise.
4874 (Symbol::init_base_output_segment): Likewise.
4875 (Symbol::init_base_constant): Likewise.
4876 (Symbol::init_base_undefined): New function.
4877 (Sized_symbol::init_object): Rename from init. Change all
4879 (Sized_symbol::init_output_data): Likewise.
4880 (Sized_symbol::init_output_segment): Likewise.
4881 (Sized_symbol::init_constant): Likewise.
4882 (Sized_symbol::init_undefined): New function.
4883 (Symbol_table::add_undefined_symbols_from_command_line): New
4885 (Symbol_table::do_add_undefined_symbols_from_command_line): New
4887 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
4888 (Symbol::output_section): Likewise.
4889 (Symbol::set_output_section): Likewise.
4890 (Symbol_table::sized_finalize_symbol): Likewise.
4891 (Symbol_table::sized_write_globals): Likewise.
4892 * resolve.cc (Symbol_table::should_override): Likewise.
4893 (Symbol::override_base_with_special): Likewise.
4895 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
4896 symbol, change it to have default visibility.
4897 * testsuite/protected_1.cc: New file.
4898 * testsuite/protected_2.cc: New file.
4899 * testsuite/protected_3.cc: New file.
4900 * testsuite/protected_main_1.cc: New file.
4901 * testsuite/protected_main_2.cc: New file.
4902 * testsuite/protected_main_3.cc: New file.
4903 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
4904 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
4905 (protected_1_LDFLAGS, protected_1_LDADD): Define.
4906 (protected_1.so): New target.
4907 (protected_1_pic.o, protected_2_pic.o): New targets.
4908 (protected_3_pic.o): New target.
4909 (check_PROGRAMS): Add protected_2.
4910 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
4911 (protected_2_LDFLAGS, protected_2_LDADD): Define.
4912 * testsuite/Makefile.in: Rebuild.
4914 * options.h (DEFINE_var): Add set_user_set_##varname__.
4915 (DEFINE_bool_alias): New macro.
4916 (class General_options): Define -Bstatic using DEFINE_bool_alias
4917 rather than DEFINE_special. Add --undefined as an alias for -z
4919 * options.cc (General_options::parse_Bstatic): Remove.
4921 * options.h (class General_options): Add --fatal-warnings.
4922 * main.cc (main): Implement --fatal-warnings.
4923 * errors.h (Errors::warning_count): New function.
4925 * options.h (class General_options): Add -Bsymbolic-functions.
4926 * symtab.h (Symbol::is_preemptible): Check for
4927 -Bsymbolic-functions.
4929 2008-05-05 Ian Lance Taylor <iant@google.com>
4931 * options.h (DEFINE_bool): For DASH_Z, create the negative option
4932 as noVARNAME rather than no-VARNAME.
4933 (class General_options): Add option -z combreloc.
4934 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
4936 (Output_reloc::sort_before) [SHT_REL]: New function.
4937 (Output_reloc::sort_before) [SHT_RELA]: New function.
4938 (class Output_data_reloc_base): Add sort_relocs_ field. Define
4939 Sort_relocs_comparison.
4940 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
4941 parameter. Change all callers.
4942 (Output_data_reloc::Output_data_reloc) [both versions]: Add
4943 sort_relocs parameter. Change all callers.
4944 * output.cc (Output_reloc::get_address): New function, broken out
4946 (Output_reloc::write_rel): Call it.
4947 (Output_reloc::compare): New function.
4948 (Output_data_reloc_base::do_write): Optionally sort relocs.
4950 * configure.ac: If targ_extra_obj is set, link it in.
4951 * configure.tgt: Initialize all variables.
4952 (x86_64*): Set targ_extra_obj and targ_extra_size.
4953 * configure: Rebuild.
4955 * object.cc (Sized_relobj::include_section_group): Adjust section
4956 indexes read from group data. Build vector to pass to
4958 * layout.cc (Layout::layout_group): Add flags and shndxes
4959 parameters. Remove contents parameter. Change caller. Update
4960 explicit instantiations.
4961 * layout.h (class Layout): Update layout_group declaration.
4962 * output.cc (Output_data_group::Output_data_group): Add flags and
4963 input_shndxes parameters. Remove contents parameter. Change
4965 (Output_data_group::do_write): Change input_sections_ to
4967 * output.h (class Output_data_group): Update constructor
4968 declaration. Rename input_sections_ to input_shndxes_.
4969 * testsuite/many_sections_test.cc: Add template.
4971 2008-04-30 Cary Coutant <ccoutant@google.com>
4973 * target-reloc.h (relocate_section): Fix dead-pointer bug.
4975 * layout.cc (Layout::include_section): Refactored check for debug
4977 (Layout::add_comdat): Add new parameters. Change type
4978 of signature parameter. Add object and shndx to signatures table.
4979 (Layout::find_kept_object): New function.
4980 * layout.h: Include <cstring>.
4981 (Layout::is_debug_info_section): New function.
4982 (Layout::add_comdat): Add new parameters.
4983 (Layout::find_kept_object): New function.
4984 (Layout::Kept_section): New struct.
4985 (Layout::Signatures): Change type of map range.
4986 * object.cc (Relobj::output_section_address): New function.
4987 (Sized_relobj::include_section_group): Add new parameters. Change
4988 calls to Layout::add_comdat. Change to build table of kept comdat
4989 groups and table mapping discarded sections to kept sections.
4990 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
4991 (Sized_relobj::do_layout): Change calls to include_section_group and
4992 include_linkonce_section.
4993 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
4994 value to zero when section is discarded.
4995 (Sized_relobj::map_to_kept_section): New function.
4996 * object.h (Relobj::output_section_address): New function.
4997 (Relobj::Comdat_group): New type.
4998 (Relobj::find_comdat_group): New function.
4999 (Relobj::Comdat_group_table): New type.
5000 (Relobj::Kept_comdat_section): New type.
5001 (Relobj::Kept_comdat_section_table): New type.
5002 (Relobj::add_comdat_group): New function.
5003 (Relobj::set_kept_comdat_section): New function.
5004 (Relobj::get_kept_comdat_section): New function.
5005 (Relobj::comdat_groups_): New field.
5006 (Relobj::kept_comdat_sections_): New field.
5007 (Symbol_value::input_value): Update comment.
5008 (Sized_relobj::map_to_kept_section) New function.
5009 (Sized_relobj::include_linkonce_section): Add new parameter.
5010 * target-reloc.h (Comdat_behavior): New type.
5011 (get_comdat_behavior): New function.
5012 (relocate_section): Add code to map a discarded section to the
5013 corresponding kept section when applying a relocation.
5015 2008-04-30 Craig Silverstein <csilvers@google.com>
5017 * dwarf_reader.cc (next_generation_count): New static var.
5018 (Addr2line_cache_entry): New struct.
5019 (addr2line_cache): New static var.
5020 (Dwarf_line_info::one_addr2line): Added caching.
5021 (Dwarf_line_info::clear_addr2line_cache): New function.
5022 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5023 cache-size parameter.
5024 (Dwarf_line_info::one_addr2line_cache): New function.
5025 * symtab.cc (Symbol_table::detect_odr_violations): Pass
5026 new cache-size argument to one_addr2line(), and clear cache.
5028 2008-04-28 Cary Coutant <ccoutant@google.com>
5030 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5031 R_386_PC8 relocations.
5033 2008-04-23 Ian Lance Taylor <iant@google.com>
5035 * object.cc (Sized_relobj::include_section_group): Check for
5036 invalid section group.
5038 * object.cc (make_elf_object): Correct test for 64-bit ELF file
5041 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5042 than read for file header.
5043 * archive.cc (Archive::include_member): Likewise.
5045 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
5047 * aclocal.m4: Regenerate.
5048 * configure: Regenerate.
5050 2008-04-19 Ian Lance Taylor <iant@google.com>
5052 * version.cc (version_string): Bump to 1.6.
5054 * testsuite/Makefile.am (many_sections_r_test): New target.
5055 (many_sections_r_test_SOURCES): Remove.
5056 (many_sections_r_test_DEPENDENCIES): Remove.
5057 (many_sections_r_test_LDFLAGS): Remove.
5058 (many_sections_r_test_LDADD): Remove.
5060 * object.cc (Sized_relobj::do_add_symbols): Always pass
5061 local_symbol_count_ to add_from_relobj.
5063 * testsuite/Makefile.am (many_sections_check.h): Only check one in
5064 every thousand variables.
5065 * testsuite/Makefile.in: Rebuild.
5067 * object.cc (Xindex::initialize_symtab_xindex): New function.
5068 (Xindex::read_symtab_xindex): New function.
5069 (Xindex::sym_xindex_to_shndx): New function.
5070 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5072 (Sized_relobj::do_initialize_xindex): New function.
5073 (Sized_relobj::do_read_symbols): Adjust section links.
5074 (Sized_relobj::symbol_section_and_value): Add is_ordinary
5075 parameter. Change all callers.
5076 (Sized_relobj::include_section_group): Adjust section links and
5077 symbol section indexes.
5078 (Sized_relobj::do_layout): Adjust section links.
5079 (Sized_relobj::do_count_local_symbols): Adjust section links and
5080 symbol section indexes.
5081 (Sized_relobj::do_finalize_local_symbols): Distinguish between
5082 ordinary and special symbols.
5083 (Sized_relobj::write_local_symbols): Add symtab_xindex and
5084 dynsym_xindex parameters. Change all callers. Adjust section
5085 links. Use SHN_XINDEX when needed.
5086 (Sized_relobj::get_symbol_location_info): Adjust section links.
5087 Don't get fooled by special symbols.
5088 * object.h (class Xindex): Define.
5089 (class Object): Add xindex_ parameter. Declare virtual functoin
5090 do_initialize_xindex.
5091 (Object::adjust_sym_shndx): New function.
5092 (Object::set_xindex): New protected function.
5093 (class Symbol_value): Add is_ordinary_shndx_ field.
5094 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5095 (Symbol_value::value): Assert ordinary section.
5096 (Symbol_value::initialize_input_to_output_map): Likewise.
5097 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5099 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
5101 (class Sized_relobj): Update declarations.
5102 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5103 parameter. Change all callers.
5104 (Sized_relobj::adjust_shndx): New function.
5105 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5107 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5108 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
5109 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
5110 (Sized_dynobj::read_dynsym_section): Adjust section links.
5111 (Sized_dynobj::read_dynamic): Likewise.
5112 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
5114 (Sized_dynobj::do_initialize_xindex): New function.
5115 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
5116 do_initialize_xindex.
5117 (Sized_dynobj::adjust_shndx): New function.
5118 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5119 dynsym_xindex_ fields.
5120 (Layout::finalize): Add a call to set_section_indexes before
5121 creating the symtab sections.
5122 (Layout::set_section_indexes): Don't do anything if the section
5123 already has a section index.
5124 (Layout::create_symtab_sections): Add shnum parameter. Change
5125 caller. Create .symtab_shndx section if needed.
5126 (Layout::create_shdrs): Add shstrtab_section parameter. Change
5128 (Layout::allocated_output_section_count): New function.
5129 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5131 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5132 fields. Update declarations.
5133 (Layout::symtab_xindex): New function.
5134 (Layout::dynsym_xindex): New function.
5135 (class Write_symbols_task): Add layout_ field.
5136 (Write_symbols_task::Write_symbols_task): Add layout parameter.
5138 * output.cc (Output_section_headers::Output_section_headers): Add
5139 shstrtab_section parameter. Change all callers.
5140 (Output_section_headers::do_sized_write): Store overflow values
5141 for section count and section string table section index in
5142 section header zero.
5143 (Output_file_header::do_sized_write): Check for overflow of
5144 section count and section string table section index.
5145 (Output_symtab_xindex::do_write): New function.
5146 (Output_symtab_xindex::endian_do_write): New function.
5147 * output.h (class Output_section_headers): Add shstrtab_section_.
5148 Update declarations.
5149 (class Output_symtab_xindex): Define.
5150 (Output_section::has_out_shndx): New function.
5151 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5153 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5155 (Sized_symbol::init): Likewise.
5156 (Symbol::output_section): Check for ordinary symbol.
5157 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
5158 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
5160 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5161 Change all callers. Simplify handling of symbols from sections
5162 not included in the link.
5163 (Symbol_table::add_from_dynobj): Handle ordinary symbol
5165 (Weak_alias_sorter::operator()): Assert that symbols are
5167 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5169 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5170 parameters. Change all callers.
5171 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
5172 symbol distinction. Use SHN_XINDEX when needed.
5173 (Symbol_table::write_section_symbol): Add symtab_xindex
5174 parameter. Change all callers.
5175 (Symbol_table::sized_write_section_symbol): Likewise. Use
5176 SHN_XINDEX when needed.
5177 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
5179 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
5180 (Symbol::is_defined): Check is_ordinary.
5181 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5182 (Symbol::is_absolute, Symbol::is_common): Likewise.
5183 (class Sized_symbol): Update declarations.
5184 (class Symbol_table): Update declarations.
5185 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5186 parameters. Change all callers.
5187 (Sized_symbol::override): Likewise.
5188 (Symbol_table::override): Likewise.
5189 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
5190 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
5191 is_ordinary, and orig_st_shndx parameters. Change all callers.
5192 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5193 to be in an ordinary section.
5194 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5195 object and is_ordinary parameters. Change all callers.
5196 (Sized_dwarf_line_info::read_relocs): Add object parameter.
5197 Change all callers. Don't add undefined or non-ordinary symbols
5199 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5201 * dwarf_reader.h (class Sized_dwarf_line_info): Update
5203 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5204 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5205 (Sized_relobj::relocate_sections): Likewise.
5206 * target-reloc.h (scan_relocs): Adjust section symbol index.
5207 (scan_relocatable_relocs): Likewise.
5208 * i386.cc (Scan::local): Check for ordinary symbols.
5209 * sparc.cc (Scan::local): Likewise.
5210 * x86_64.cc (Scan::local): Likewise.
5211 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5212 to symbol_section_and_value.
5213 * testsuite/many_sections_test.cc: New file.
5214 * testsuite/Makefile.am (BUILT_SOURCES): Define.
5215 (check_PROGRAMS): Add many_sections_test.
5216 (many_sections_test_SOURCES): Define.
5217 (many_sections_test_DEPENDENCIES): Define.
5218 (many_sections_test_LDFLAGS): Define.
5219 (BUILT_SOURCES): Add many_sections_define.h.
5220 (many_sections_define.h): New target.
5221 (BUILT_SOURCES): Add many_sections_check.h.
5222 (many_sections_check.h): New target.
5223 (check_PROGRAMS): Add many_sections_r_test.
5224 (many_sections_r_test_SOURCES): Define.
5225 (many_sections_r_test_DEPENDENCIES): Define.
5226 (many_sections_r_test_LDFLAGS): Define.
5227 (many_sections_r_test_LDADD): Define.
5228 (many_sections_r_test.o): New target.
5229 * testsuite/Makefile.in: Rebuild.
5231 2008-04-17 Cary Coutant <ccoutant@google.com>
5233 * errors.cc (Errors::info): New function.
5234 (gold_info): New function.
5235 * errors.h (Errors::info): New function.
5236 * gold.h (gold_info): New function.
5237 * object.cc (Input_objects::add_object): Print trace output.
5238 * options.cc (options::parse_set): New function.
5239 (General_options::parse_wrap): Deleted.
5240 (General_options::General_options): Deleted initializer.
5241 * options.h (options::String_set): New typedef.
5242 (options::parse_set): New function.
5243 (DEFINE_set): New macro.
5244 (General_options::wrap): Changed to use DEFINE_set. Changed
5245 callers of any_wrap_symbols and is_wrap_symbol.
5246 (General_options::trace, General_options::trace_symbol):
5248 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5249 (General_options::wrap_symbols_): Deleted.
5250 * symtab.cc (Symbol_table::add_from_object): Print trace output.
5252 2008-04-17 David S. Miller <davem@davemloft.net>
5254 * options.cc (General_options::parse_V): New function.
5255 * options.h: Add entries for -V and -Qy.
5257 2008-04-17 Ian Lance Taylor <iant@google.com>
5259 * common.cc (Symbol_table::allocate_commons): Remove options
5260 parameter. Change caller.
5261 (Symbol_table::do_allocate_commons): Remove options parameter.
5262 Change caller. Just call do_allocate_commons_list twice.
5263 (Symbol_table::do_allocate_commons_list): New function, broken out
5264 of do_allocate_commons.
5265 * common.h (class Allocate_commons_task): Remove options_ field.
5267 * symtab.cc (Symbol_table::Symbol_table): Initialize
5269 (Symbol_table::add_from_object): Put TLS common symbols on
5271 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5272 which are IN_OUTPUT_DATA.
5273 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
5274 allocate_commons and do_allocate_commons declarations. Declare
5275 do_allocate_commons_list.
5276 * gold.cc (queue_middle_tasks): Update creation of
5277 Allocate_commons_task to not pass options.
5278 * testsuite/Makefile.am (INCLUDES): Add -I.. .
5279 (TLS_TEST_C_FLAGS): New variable.
5280 (tls_test_c_pic.o): New target.
5281 (tls_test_shared.so): Link in tls_test_c_pic.o.
5282 (tls_test_c_pic_ie.o): New target.
5283 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5284 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5285 (tls_test_c.o): New target.
5286 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5287 (tls_pic_test_LDADD): Likewise.
5288 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5289 (tls_shared_gd_to_ie_test_LDADD): Likewise.
5290 (tls_test_c_gnu2.o): New target.
5291 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5293 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5294 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5295 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5296 * testsuite/tls_test.cc: Include "config.h".
5297 (t_last): Call t11_last.
5298 * testsuite/tls_test.h (t11, t11_last): Declare.
5299 * testsuite/tls_test_c.c: New file.
5300 * testsuite/tls_test_main.cc (thread_routine): Call t11.
5301 * configure.ac: Check for OpenMP support.
5302 * configure, config.in, Makefile.in: Rebuild.
5303 * testsuite/Makefile.in: Rebuild.
5305 2008-04-16 Cary Coutant <ccoutant@google.com>
5307 * i386.cc (Target_i386::define_tls_base_symbol): New function.
5308 (Target_i386::tls_base_symbol_defined_): New field.
5309 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5310 (Target_i386::Scan::global): Likewise.
5311 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5312 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5313 (Target_x86_64::tls_base_symbol_defined_): New field.
5314 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5315 (Target_x86_64::Scan::global): Likewise.
5317 2008-04-16 Cary Coutant <ccoutant@google.com>
5319 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5320 (Symbol::needs_plt_entry): Allow weak undefined symbols.
5321 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5322 building shared libraries.
5323 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5324 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5325 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5326 * testsuite/Makefile.in: Rebuild.
5327 * testsuite/weak_undef.h: New file.
5328 * testsuite/weak_undef_file1.cc: Add extra test cases.
5329 * testsuite/weak_undef_file2.cc: Likewise.
5330 * testsuite/weak_undef_test.cc: Likewise.
5332 2008-04-16 David S. Miller <davem@davemloft.net>
5334 * sparc.cc (Target_sparc::Scan): Change from struct to class.
5335 Add issued_non_pic_error_ field. Declare check_non_pic.
5336 (Target_sparc::Scan::check_non_pic): New function.
5337 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5338 (Target_sparc::Scan::global): Likewise.
5340 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5341 * configure: Rebuild.
5343 * options.h (DEFINE_enable): New macro.
5344 (new_dtags): New enable option.
5345 (initfirst, interpose, loadfltr, nodefaultlib,
5346 nodelete, nodlopen, nodump): New -z options.
5347 * layout.cc (Layout:finish_dynamic_section): If new
5348 dtags enabled, emit DT_RUNPATH. Also, emit a
5349 DT_FLAGS_1 containing any specified -z flags.
5351 2008-04-16 Ian Lance Taylor <iant@google.com>
5353 * copy-relocs.cc: New file.
5354 * copy-relocs.h: New file.
5355 * reloc.cc: Remove Copy_relocs code.
5356 * reloc.h: Likewise.
5357 * reloc-types.h (struct Reloc_types) [both versions]: Add
5358 get_reloc_addend_noerror.
5359 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5360 variants of add_global which take an addend which must be zero.
5361 * i386.cc: Include "copy-relocs.h".
5362 (class Target_i386): Change type of copy_relocs_ to variable,
5364 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5366 (Target_i386::do_finalize_sections): Change handling of
5368 * sparc.cc: Include "copy-relocs.h".
5369 (class Target_sparc): Change type of copy_relocs_ to variable,
5371 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5373 (Target_sparc::do_finalize_sections): Change handling of
5375 * x86_64.cc: Include "copy-relocs.h".
5376 (class Target_x86_64): Change type of copy_relocs_ to variable,
5378 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5379 class. Change all callers.
5380 (Target_x86_64::do_finalize_sections): Change handling of
5382 * Makefile.am (CCFILES): Add copy-relocs.cc.
5383 (HFILES): Add copy-relocs.h.
5385 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5387 * testsuite/script_test_4.sh: Permit leading zeroes.
5389 2008-04-15 Ian Lance Taylor <iant@google.com>
5391 * script-sections.cc (Script_sections::create_segments): Use
5392 header_size_adjustment even when there is enough room for the
5394 * testsuite/script_test_4.sh: New file.
5395 * testsuite/script_test_4.t: New file.
5396 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5397 (check_DATA): Add script_test_4.stdout.
5398 (MOSTLYCLEANFILES): Likewise.
5399 (script_test_4): New target.
5400 (script_test_4.stdout): New target.
5401 * testsuite/Makefile.in: Rebuild.
5403 * sparc.cc: Add definitions for Output_data_plt_sparc class
5406 2008-04-14 David S. Miller <davem@davemloft.net>
5408 * sparc.cc: New file.
5409 * Makefile.am (TARGETSOURCES): Add sparc.cc
5410 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5411 * configure.tgt: Document targ_extra_size and
5412 targ_extra_big_endian. Add entries for sparc-* and
5414 * configure.ac: Handle targ_extra_size and
5415 targ_extra_big_endian.
5416 * Makefile.in: Rebuild.
5417 * configure: Likewise.
5418 * po/POTFILES.in: Likewise.
5419 * po/gold.pot: Likewise.
5421 2008-04-14 Ian Lance Taylor <iant@google.com>
5423 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5424 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5425 in the name/type/flags to section mapping. Don't call
5426 allocate_output_section.
5427 (Layout::choose_output_section): Change parameter from adjust_name
5428 to is_input_section. Don't permit input sections after sections
5429 are attached to segments. Don't call allocate_output_section.
5430 (Layout::layout_eh_frame): Call update_flags_for_input_section,
5431 not write_enable_output_section.
5432 (Layout::make_output_section): Don't push to
5433 unattached_section_list_ nor call attach_to_segment. Call
5434 attach_section_to_segment if sections are attached.
5435 (Layout::attach_sections_to_segments): New function.
5436 (Layout::attach_section_to_segment): New function.
5437 (Layout::attach_allocated_section_to_segment): Rename from
5438 attach_to_segment. Remove flags parameter.
5439 (Layout::allocate_output_section): Remove function.
5440 (Layout::write_enable_output_section): Remove function.
5441 * layout.h (class Layout): Update for above changes. Add new
5442 field sections_are_attached_.
5443 * output.h (Output_section::update_flags_for_input_section): New
5445 * output.cc (Output_section::add_input_section): Call
5446 update_flags_for_input_section.
5447 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5449 2008-04-11 Cary Coutant <ccoutant@google.com>
5451 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5452 thought unnecessary.
5453 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5455 2008-04-11 Ian Lance Taylor <iant@google.com>
5457 * output.h (class Output_section_data): Remove inline definition
5459 * output.cc (Output_section_data::set_addralign): New function.
5461 2008-04-11 Cary Coutant <ccoutant@google.com>
5463 Add support for TLS descriptors for i386 and x86_64.
5464 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5465 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5466 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5468 (Target_i386::got_mod_index_entry): Remove unnecessary code.
5469 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5470 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
5472 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5473 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5474 Fix problem with initial-exec relocations.
5475 (Target_i386::Relocate::relocate_tls): Likewise.
5476 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5478 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5479 support for section-plus-offset dynamic table entries.
5480 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5481 (Output_data_dynamic::Dynamic_entry): Add support for
5482 section-plus-offset dynamic table entries.
5483 (Output_data_dynamic::Classification): Likewise.
5484 (Output_data_dynamic::classification_): Renamed offset_.
5485 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5486 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5487 (Target_x86_64::make_plt_section): New function.
5488 (Target_x86_64::reserve_tlsdesc_entries): New function.
5489 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5490 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5491 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5492 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5493 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5494 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5495 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5496 add extra PLT entry for TLS descriptors.
5497 (Output_data_plt_x86_64::got_): New field.
5498 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5499 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5501 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5503 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5504 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5505 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5506 R_386_TLS_DESC_CALL relocations.
5507 (Target_x86_64::Scan::global): Likewise.
5508 (Target_x86_64::do_finalize_sections): Add dynamic table entries
5509 for TLS descriptors.
5510 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
5511 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
5512 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
5513 GD-to-IE relaxation.
5514 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
5515 and TLS_DESCRIPTORS.
5516 * Makefile.in: Rebuild.
5517 * configure: Rebuild.
5518 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
5519 (tls_test_shared2.so): New target.
5520 (tls_shared_gd_to_ie_test_SOURCES): New variable.
5521 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
5522 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
5523 (tls_shared_gd_to_ie_test_LDADD): New variable.
5524 (tls_shared_gnu2_gd_to_ie_test): New target.
5525 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
5527 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
5528 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
5529 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
5530 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
5531 (tls_shared_gnu2_test): New target.
5532 (tls_test_gnu2_shared.so): New target.
5533 (tls_shared_gnu2_test_SOURCES): New variable.
5534 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
5535 (tls_shared_gnu2_test_LDFLAGS): New variable.
5536 (tls_shared_gnu2_test_LDADD): New variable.
5537 * testsuite/Makefile.in: Rebuild.
5538 * testsuite/Makefile.
5540 2008-04-11 Ian Lance Taylor <iant@google.com>
5542 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
5544 * testsuite/Makefile.in: Rebuild.
5546 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
5548 * testsuite/script_test_2.cc (main): Adjust test.
5550 2008-04-11 David S. Miller <davem@davemloft.net>
5551 Ian Lance Taylor <iant@google.com>
5553 * options.h (General_options): Add entries for '-Y' and
5555 * options.cc (General_options:finalize): If -Y was used, add those
5556 entries to the library path instead of the default "/lib" and
5559 2008-04-11 David S. Miller <davem@davemloft.net>
5561 * testsuite/justsyms.t: Start at 0x100.
5562 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
5563 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
5565 * testsuite/script_test_2.cc: Adjust string and section length
5568 2008-04-09 Ian Lance Taylor <iant@google.com>
5571 * script-sections.cc (Sections_element::allocate_to_segment): Add
5573 (Output_section_definition::allocate_to_segment): Likewise.
5574 (Orphan_output_section::allocate_to_segment): Likewise.
5575 (Script_sections::attach_sections_using_phdrs_clause): Don't
5576 propagate non-PT_LOAD segments to orphan sections.
5577 * testsuite/Makefile.am (script_test_3.stdout): Generate using
5578 readelf rather than objdump.
5579 * testsuite/script_test_3.sh: Adjust accordingly. Test that
5580 .interp section and PT_INTERP segment are the same size.
5581 * testsuite/Makefile.in: Rebuild.
5583 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
5584 aliases for symbols defined in the same object.
5585 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5586 (weak_alias_test_SOURCES): New variable.
5587 (weak_alias_test_DEPENDENCIES): New variable.
5588 (weak_alias_test_LDFLAGS): New variable.
5589 (weak_alias_test_LDADD): New variable.
5590 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5591 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5592 (weak_alias_test_3.o): New target.
5593 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5594 * testsuite/weak_alias_test_main.cc: New file.
5595 * testsuite/weak_alias_test_1.cc: New file.
5596 * testsuite/weak_alias_test_2.cc: New file.
5597 * testsuite/weak_alias_test_3.cc: New file.
5599 2008-04-08 Ian Lance Taylor <iant@google.com>
5601 * options.h (class General_options): Add --noinhibit-exec option.
5602 * main.cc (main): Check --noinhibit-exec.
5604 * options.h (class General_options): Define --wrap as a special
5605 option. Add wrap_symbols_ field.
5606 (General_options::any_wrap_symbols): New function.
5607 (General_options::is_wrap_symbol): New function.
5608 * options.cc (General_options::parse_wrap): New function.
5609 (General_options::General_options): Initialize wrap_symbols_.
5610 * symtab.cc (Symbol_table::wrap_symbol): New function.
5611 (Symbol_table::add_from_object): Handle --wrap.
5612 * symtab.h (class Symbol_table): Declare wrap_symbol.
5613 * target.h (Target::wrap_char): New function.
5614 (Target::Target_info): Add wrap_char field.
5615 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
5616 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5617 * testsuite/testfile.cc (Target_test::test_target_info):
5620 * errors.cc (Errors::undefined_symbol): Mention symbol version if
5623 * layout.h (class Layout): Add added_eh_frame_data_ field.
5624 * layout.cc (Layout::Layout): Initialize new field.
5625 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
5626 output section until we find a section we merged successfully.
5627 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
5628 that the size be non-zero.
5630 * merge.cc (Object_merge_map::get_output_offset): Remove inline
5633 2008-04-08 Craig Silverstein <csilvers@google.com>
5635 * configure.ac: Export new conditional variable HAVE_ZLIB.
5636 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
5638 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
5639 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5641 2008-04-07 Ian Lance Taylor <iant@google.com>
5643 * version.cc (version_string): Set to "1.5".
5645 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
5646 Add issued_non_pic_error_ field. Declare check_non_pic.
5647 (Target_x86_64::Scan::check_non_pic): New function.
5648 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
5649 (Target_x86_64::Scan::global): Likewise.
5651 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
5652 addend parameter. Change caller. Handle merge sections.
5653 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5654 Address to Addend. Don't add in the result of
5655 local_section_offset, pass down the addend and use the returned
5657 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5658 Update declarations of local_section_offset and symbol_value.
5659 * testsuite/two_file_test_1.cc (t18): New function.
5660 * testsuite/two_file_test_2.cc (f18): New function.
5661 * testsuite/two_file_test_main.cc (main): Call t18.
5662 * testsuite/two_file_test.h (t18, f18): Declare.
5664 * configure.ac: Don't test for objdump, c++filt, or readelf.
5665 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5667 (TEST_READELF): New variable.
5668 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5669 (check_PROGRAMS): Add two_file_strip_test.
5670 (two_file_strip_test): New target.
5671 (check_PROGRAMS): Add two_file_same_shared_strip_test.
5672 (two_file_same_shared_strip_test_SOURCES): New variable.
5673 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5674 (two_file_same_shared_strip_test_LDFLAGS): New variable.
5675 (two_file_same_shared_strip_test_LDADD): New variable.
5676 (two_file_shared_strip.so): New target.
5677 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5678 (ver_test_5.syms, ver_test_7.syms): Likewise.
5679 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5680 (strip_test_3.stdout): Use TEST_OBJDUMP.
5681 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5683 2008-04-04 Cary Coutant <ccoutant@google.com>
5685 * symtab.h (Symbol::is_weak_undefined): New function.
5686 (Symbol::is_strong_undefined): New function.
5687 (Symbol::is_absolute): New function.
5688 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5689 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5691 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5692 (weak_undef_test): New target.
5693 * testsuite/Makefile.in: Rebuild.
5694 * testsuite/weak_undef_file1.cc: New file.
5695 * testsuite/weak_undef_file2.cc: New file.
5696 * testsuite/weak_undef_test.cc: New file.
5698 2008-04-03 Craig Silverstein <csilvers@google.com>
5700 * compressed_output.h (class Output_compressed_section): Use
5702 * compressed_output.cc (zlib_compress): Use unsigned buffers,
5704 (zlib_compressed_suffix): Removed.
5705 (Output_compressed_section::set_final_data_size): Use unsigned
5707 * testsuite/Makefile.am (flagstest_compress_debug_sections):
5708 Fix linker invocation.
5709 (flagstest_o_specialfile_and_compress_debug_sections):
5711 * testsuite/Makefile.in: Regenerated.
5713 2008-04-02 David S. Miller <davem@davemloft.net>
5715 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5716 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5718 2008-04-02 Craig Silverstein <csilvers@google.com>
5722 2008-04-02 Ian Lance Taylor <iant@google.com>
5724 * fileread.cc (File_read::find_view): Add byteshift and vshifted
5725 parameters. Update for new key type to views_. Change all
5727 (File_read::read): Adjust for byteshift in returned view.
5728 (File_read::add_view): New function, broken out of
5730 (File_read::make_view): New function, broken out of
5732 (File_read::find_or_make_view): Add offset and aligned
5733 parameters. Rewrite accordingly. Change all callers.
5734 (File_read::get_view): Add offset and aligned parameters. Adjust
5735 for byteshift in return value.
5736 (File_read::get_lasting_view): Likewise.
5737 * fileread.h (class File_read): Update declarations.
5738 (class File_read::View): Add byteshift_ field. Add byteshift to
5739 constructor. Add byteshift method.
5740 * archive.h (Archive::clear_uncached_views): New function.
5741 (Archive::get_view): Add aligned parameter. Change all callers.
5742 * object.h (Object::get_view): Add aligned parameter. Change all
5744 (Object::get_lasting_view): Likewise.
5746 * fileread.cc (File_read::release): Don't call clear_views if
5747 there are multiple objects.
5748 * fileread.h (File_read::clear_uncached_views): New function.
5749 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5752 2008-03-31 Cary Coutant <ccoutant@google.com>
5754 Add thin archive support.
5755 * archive.cc (Archive::armagt): New const.
5756 (Archive::setup): Remove task parameter and calls to unlock.
5757 (Archive::unlock_nested_archives): New function.
5758 (Archive::read_header): Add nested_off parameter. Change
5760 (Archive::interpret_header): Likewise.
5761 (Archive::include_all_members): Change to handle thin
5763 (Archive::include_member): Likewise.
5764 * archive.h (Archive::Archive): Add new parameters and
5766 (Archive::armagt): New const.
5767 (Archive::setup): Remove task parameter.
5768 (Archive::unlock_nested_archives): New function.
5769 (Archive::read_header): Add nested_off parameter.
5770 (Archive::interpret_header): Likewise.
5771 (Archive::Nested_archive_table): New typedef.
5772 (Archive::is_thin_archive_): New field.
5773 (Archive::nested_archives_): New field.
5774 (Archive::options_): New field.
5775 (Archive::dirpath_): New field.
5776 (Archive::task_): New field.
5777 * readsyms.cc (Read_symbols::do_read_symbols): Add check
5778 for thin archives. Pass additional parameters to
5779 Archive::Archive. Unlock the archive file after calling
5782 2008-03-29 Ian Lance Taylor <iant@google.com>
5784 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
5785 version symbol to be local.
5786 * testsuite/ver_test_4.sh: New file.
5787 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
5788 (check_DATA): Add ver_test_4.syms.
5789 (ver_test_4.syms): New target.
5790 * testsuite/Makefile.in: Rebuild.
5793 (Output_section::Input_section_sort_entry::has_priority): New
5795 (Output_section::Input_section_sort_entry::match_file_name): New
5797 (Output_section::Input_section_sort_entry::match_section_name):
5799 (Output_section::Input_section_sort_entry::match_section_name_prefix):
5801 (Output_section::Input_section_sort_entry::match_section_file):
5803 (Output_section::Input_section_sort_compare::operator()): Rewrite
5804 using new Input_section_sort_entry functions. Sort crtbegin and
5805 crtend first. Sort sections with no priority before sections with
5807 * testsuite/initpri1.c (d3): Check j != 4.
5808 (cd5): New constructor/destructor function.
5809 (main): Check j != 2.
5811 * symtab.cc (Symbol_table::add_from_object): If we don't use the
5812 new symbol when resolving, don't call set_is_default.
5813 * testsuite/ver_test_7.cc: New file.
5814 * testsuite/ver_test_7.sh: New file.
5815 * testsuite/Makefile.am (ver_test_7.so): New target.
5816 (ver_test_7.o): New target.
5817 (check_SCRIPTS): Add ver_test_7.sh.
5818 (check_DATA): Add ver_test_7.syms.
5819 (ver_test_7.syms): New target.
5821 2008-03-28 Ian Lance Taylor <iant@google.com>
5823 * layout.cc (Layout::layout): If we see an input section with a
5824 name that needs sorting, set the must_sort flag for the output
5826 (Layout::make_output_section): If the name of the output section
5827 indicates that it might require sorting, set the may_sort flag.
5828 * output.h (Output_section::may_sort_attached_input_sections): New
5830 (Output_section::set_may_sort_attached_input_sections): New
5832 (Output_section::must_sort_attached_input_sections): New
5834 (Output_section::set_must_sort_attached_input_sections): New
5836 (class Output_section): Declare Input_section_sort_entry. Define
5837 Input_section_sort_compare. Declare
5838 sort_attached_input_sections. Add new fields:
5839 may_sort_attached_input_sections_,
5840 must_sort_attached_input_sections_,
5841 attached_input_sections_are_sorted_.
5842 * output.cc (Output_section::Output_section): Initialize new
5844 (Output_section::add_input_section): Add an entry to
5845 input_sections_ if may_sort or must_sort are true.
5846 (Output_section::set_final_data_size): Call
5847 sort_attached_input_sections if necessary.
5848 (Output_section::Input_section_sort_entry): Define new class.
5849 (Output_section::Input_section_sort_compare::operator()): New
5851 (Output_section::sort_attached_input_sections): New function.
5852 * configure.ac: Check whether the compiler supports constructor
5853 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
5854 * testsuite/initpri1.c: New file.
5855 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
5856 CONSTRUCTOR_PRIORITY.
5857 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
5858 (initpri1_LDFLAGS): New variable.
5859 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5861 2008-03-27 Ian Lance Taylor <iant@google.com>
5863 * common.cc (Sort_commons::operator): Correct sorting algorithm.
5864 * testsuite/common_test_1.c: New file.
5865 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
5866 (common_test_1_SOURCES): New variable.
5867 (common_test_1_DEPENDENCIES): New variable.
5868 (common_test_1_LDFLAGS): New variable.
5870 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
5871 and commons_ correctly when NAME/VERSION does not override
5873 * testsuite/ver_test_6.c: New file.
5874 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
5875 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
5876 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
5878 2008-03-26 Ian Lance Taylor <iant@google.com>
5880 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
5881 of an undefined symbol from a version script.
5882 * testsuite/Makefile.am (ver_test_5.so): New target.
5883 (ver_test_5.o): New target.
5884 (check_SCRIPTS): Add ver_test_5.sh.
5885 (check_DATA): Add ver_test_5.syms.
5886 (ver_test_5.syms): New target.
5887 * testsuite/ver_test_5.cc: New file.
5888 * testsuite/ver_test_5.script: New file.
5889 * testsuite/ver_test_5.sh: New file.
5890 * Makefile.in, testsuite/Makefile.in: Rebuild.
5893 Fix problems building gold with gcc 4.3.0.
5894 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
5895 (gold_error_at_location, gold_warning_at_location): Use it.
5896 * configure.ac: Check whether we can compile and use a template
5897 function with a printf attribute.
5898 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
5899 when jumping over bytes.
5900 * object.cc: Instantiate Object::read_section_data.
5901 * debug.h: Include <cstring>
5902 * dwarf_reader.cc: Include <algorithm>
5903 * main.cc: Include <cstring>.
5904 * options.cc: Include <cstring>.
5905 * output.cc: Include <cstring>.
5906 * script.cc: Include <cstring>.
5907 * script.h: Include <string>.
5908 * symtab.cc: Include <cstring> and <algorithm>.
5909 * target-select.cc: Include <cstring>.
5910 * version.cc: Include <string>.
5911 * testsuite/testmain.cc: Include <cstdlib>.
5912 * configure, config.in: Rebuild.
5914 2008-03-25 Ian Lance Taylor <iant@google.com>
5916 * options.cc: Include "../bfd/bfdver.h".
5917 (options::help): Print bug reporting address.
5919 * version.cc (print_version): Adjust output for current value of
5924 * options.cc (options::help): Print list of supported targets.
5925 * target-select.h: Include <vector>.
5926 (class Target_selector): Make machine_, size_, and is_big_endian_
5927 fields const. Add bfd_name_ and instantiated_target_ fields.
5928 (Target_selector::Target_selector): Add bfd_name parameter.
5929 (Target_selector::recognize): Make non-virtual, call
5931 (Target_selector::recognize_by_name): Make non-virtual, call
5932 do_recognize_by_name.
5933 (Target_selector::supported_names): New function.
5934 (Target_selector::bfd_name): New function.
5935 (Target_selector::do_instantiate_target): New pure virtual
5937 (Target_selector::do_recognize): New virtual function.
5938 (Target_selector::do_recognize_by_name): New virtual function.
5939 (Target_selector::instantiate_target): New private function.
5940 (supported_target_names): Declare.
5941 * target-select.cc (Target_selector::Target_selector): Update for
5942 new parameter and fields.
5943 (select_target_by_name): Check that the name matches before
5944 calling recognize_by_name.
5945 (supported_target_names): New function.
5946 * i386.cc (class Target_selector_i386): Update Target_selector
5947 constructor call. Remove recognize and recognize_by_name. Add
5948 do_instantiate_target.
5949 * x86_64.cc (class Target_selector_x86_64): Likewise.
5950 * testsuite/testfile.cc (class Target_selector_test): Update for
5951 changes to Target_selector.
5953 * README: Rewrite, with some notes on unsupported features.
5955 2008-03-24 Cary Coutant <ccoutant@google.com>
5957 * i386.cc (Target_i386::Got_type): New enum declaration.
5958 (Target_i386::Scan::local): Updated callers of Output_data_got
5960 (Target_i386::Scan::global): Likewise.
5961 (Target_i386::Relocate::relocate): Likewise.
5962 (Target_i386::Relocate::relocate_tls): Likewise.
5963 * object.h (Got_offset_list): New class.
5964 (Sized_relobj::local_has_got_offset): Added got_type parameter.
5965 (Sized_relobj::local_got_offset): Likewise.
5966 (Sized_relobj::set_local_got_offset): Likewise.
5967 (Sized_relobj::local_has_tls_got_offset): Removed.
5968 (Sized_relobj::local_tls_got_offset): Removed.
5969 (Sized_relobj::set_local_tls_got_offset): Removed.
5970 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
5971 * output.cc (Output_data_got::add_global): Added got_type parameter.
5972 (Output_data_got::add_global_with_rel): Likewise.
5973 (Output_data_got::add_global_with_rela): Likewise.
5974 (Output_data_got::add_global_pair_with_rel): New function.
5975 (Output_data_got::add_global_pair_with_rela): New function.
5976 (Output_data_got::add_local): Added got_type parameter.
5977 (Output_data_got::add_local_with_rel): Likewise.
5978 (Output_data_got::add_local_with_rela): Likewise.
5979 (Output_data_got::add_local_pair_with_rel): New function.
5980 (Output_data_got::add_local_pair_with_rela): New function.
5981 (Output_data_got::add_global_tls): Removed.
5982 (Output_data_got::add_global_tls_with_rel): Removed.
5983 (Output_data_got::add_global_tls_with_rela): Removed.
5984 (Output_data_got::add_local_tls): Removed.
5985 (Output_data_got::add_local_tls_with_rel): Removed.
5986 (Output_data_got::add_local_tls_with_rela): Removed.
5987 * output.h (Output_data_got::add_global): Added got_type parameter.
5988 (Output_data_got::add_global_with_rel): Likewise.
5989 (Output_data_got::add_global_with_rela): Likewise.
5990 (Output_data_got::add_global_pair_with_rel): New function.
5991 (Output_data_got::add_global_pair_with_rela): New function.
5992 (Output_data_got::add_local): Added got_type parameter.
5993 (Output_data_got::add_local_with_rel): Likewise.
5994 (Output_data_got::add_local_with_rela): Likewise.
5995 (Output_data_got::add_local_pair_with_rel): New function.
5996 (Output_data_got::add_local_pair_with_rela): New function.
5997 (Output_data_got::add_global_tls): Removed.
5998 (Output_data_got::add_global_tls_with_rel): Removed.
5999 (Output_data_got::add_global_tls_with_rela): Removed.
6000 (Output_data_got::add_local_tls): Removed.
6001 (Output_data_got::add_local_tls_with_rel): Removed.
6002 (Output_data_got::add_local_tls_with_rela): Removed.
6003 * resolve.cc (Symbol::override_base_with_special): Removed
6004 reference to has_got_offset_ field.
6005 * symtab.cc (Symbol::init_fields): Replaced initialization
6006 of got_offset_ with got_offsets_. Removed initialization
6008 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6009 (Symbol::got_offset): Likewise.
6010 (Symbol::set_got_offset): Likewise.
6011 (Symbol::has_tls_got_offset): Removed.
6012 (Symbol::tls_got_offset): Removed.
6013 (Symbol::set_tls_got_offset): Removed.
6014 (Symbol::got_offset_): Removed.
6015 (Symbol::tls_mod_got_offset_): Removed.
6016 (Symbol::tls_pair_got_offset_): Removed.
6017 (Symbol::got_offsets_): New field.
6018 (Symbol::has_got_offset): Removed.
6019 (Symbol::has_tls_mod_got_offset): Removed.
6020 (Symbol::has_tls_pair_got_offset): Removed.
6021 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6022 (Target_x86_64::Scan::local): Updated callers of Output_data_got
6024 (Target_x86_64::Scan::global): Likewise.
6025 (Target_x86_64::Relocate::relocate): Likewise.
6026 (Target_x86_64::Relocate::relocate_tls): Likewise.
6028 2008-03-25 Ben Elliston <bje@au.ibm.com>
6030 * yyscript.y: Fix spelling error in comment.
6032 2008-03-24 Ian Lance Taylor <iant@google.com>
6034 * options.h (class General_options): Define build_id option.
6035 * layout.h (class Layout): Declare write_build_id, create_note,
6036 create_build_id. Add build_id_note_ member.
6037 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6038 "libiberty.h", "md5.h", "sha1.h".
6039 (Layout::Layout): Initialize eh_frame_data_,
6040 eh_frame_hdr_section_, and build_id_note_.
6041 (Layout::finalize): Call create_build_id.
6042 (Layout::create_note): New function, broken out of
6043 Layout::create_gold_note.
6044 (Layout::create_gold_note): Call create_note.
6045 (Layout::create_build_id): New function.
6046 (Layout::write_build_id): New function.
6047 (Close_task_runner::run): Call write_build_id.
6049 * x86_64.cc: Correct license to GPLv3.
6051 2008-03-23 Ian Lance Taylor <iant@google.com>
6053 * options.cc: Include "demangle.h".
6054 (parse_optional_string): New function.
6055 (parse_long_option): Handle takes_optional_argument.
6056 (parse_short_option): Update dash_z initializer. Handle
6057 takes_optional_argument.
6058 (General_options::General_options): Initialize do_demangle_.
6059 (General_options::finalize): Set do_demangle_. Handle demangling
6061 * options.h (parse_optional_string): Declare.
6062 (struct One_option): Add optional_arg field. Update constructor.
6063 Update call constructor calls. Add takes_optional_argument
6065 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
6066 (DEFINE_optional_string): Define.
6067 (General_options::demangle): Change from DEFINE_bool to
6068 DEFINE_optional_string.
6069 (General_options::no_demangle): New function.
6070 (General_options::do_demangle): New function.
6071 (General_options::set_do_demangle): New function.
6072 (General_options::execstack_status_): Move definition to end of
6074 (General_options::static_): Likewise.
6075 (General_options::do_demangle_): New field.
6076 * object.cc (big_endian>::get_symbol_location_info): Call
6077 Options::do_demangle, not Options::demangle.
6078 * symtab.cc (demangle): Likewise.
6080 2008-03-22 Ian Lance Taylor <iant@google.com>
6082 * gold.h: Include <cstddef> and <sys/types.h>
6083 * options.h: Include <cstring>.
6085 2008-03-21 Ian Lance Taylor <iant@google.com>
6087 * Added source code to GNU binutils.