I forgot to commit this.
[binutils.git] / gold / ChangeLog
blob7015ea252529fef487fd433e8c0879803821f18f
1 2010-01-12  Ian Lance Taylor  <iant@google.com>
3         * target-reloc.h (visibility_error): New inline function.
4         (relocate_section): Call visibility_error.
5         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6         (MOSTLYCLEANFILES): Likewise.
7         (protected_4_pic.o, protected_3.err): New targets.
8         * testsuite/protected_4.cc: New file.
10 2010-01-12  Doug Kwan  <dougkwan@google.com>
12         * arm.cc (Cortex_a8_reloc): New class.
13         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
14         and cortex_a8_relocs_info_.
15         (Target_arm::fix_cortex_a8): New method definition.
16         (Target_arm::Cortex_a8_relocs_info): New type.
17         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
18         New data member declarations.
19         (Target_arm::scan_reloc_for_stub): Record information about
20         relocations for THUMB branches that might be exempted from the
21         Cortex-A8 workaround.
22         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
23         at the beginning of a relaxation pass.
25 2010-01-12  Doug Kwan  <dougkwan@google.com>
27         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
28         (Arm_relobj::Mapping_symbol_position,
29          Arm_reloj::Mapping_symbol_position_less,
30          Arm_relobj::Mapping_symbols_info): New types.
31         (Target_arm::is_mapping_symbol_name): New method definition.
32         (Arm_relobj::do_count_local_symbols): Save information about mapping
33         symbols.
35 2010-01-11  Doug Kwan  <dougkwan@google.com>
37         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
38         Arm_relocate_functions::thumb32_branch_upper,
39         Arm_relocate_functions::thumb32_branch_lower,
40         Arm_relocate_functions::thumb32_cond_branch_offset,
41         Arm_relocate_functions::thumb32_cond_branch_upper,
42         Arm_relocate_functions::thumb32_cond_branch_lower,
43         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
44         branch offset encoding.
45         (Arm_relocate_functions::thumb_branch_common): Use new branch
46         offset encoding methods to avoid code duplication.
47         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
48         (Stub_addend_reader::operator()): Use new branch encoding method
49         to avoid code duplication.
51 2010-01-11  Doug Kwan  <dougkwan@google.com>
53         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
54         (Target_arm::do_finalize_sections): Define special EXIDX section
55         symbols only if referenced.
56         * gc.h (Garbage_collection::add_reference): New method.
57         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
58         code duplication.
60 2010-01-11  Ian Lance Taylor  <iant@google.com>
62         * script.cc (Version_script_info::build_expression_list_lookup):
63         Change complaing about duplicate wildcard match from error to
64         warning.
66         * script.cc (class Lazy_demangler): Recreate--revert part of patch
67         of 2009-12-30.
68         (Version_script_info::Version_script_info): Initialize globs_,
69         default_version_, default_is_global_, and exact_.  Don't
70         initialize globals_ or locals_.
71         (Version_script_info::build_lookup_tables): Build local symbols
72         first.
73         (Version_script_info::unquote): New function.
74         (Version_script_info::add_exact_match): New function.
75         (Version_script_info::build_expression_list_lookup): Remove lookup
76         parameter.  Add is_global parameter.  Change all callers.  Handle
77         wildcard pattern specially.  Unquote pattern.  Call
78         add_exact_match.
79         (Version_script_info::get_name_to_match): New function.
80         (Version_script_info::get_symbol_version): New function.
81         (Version_script_info::get_symbol_version_helper): Remove.
82         (Version_script_info::check_unmatched_names): Call unquote.
83         * script.h (class Version_script_info): Change get_symbol_version
84         to be non-inline and add is_global parameter; change all callers.
85         Rewrite symbol_is_local.  Update declarations.  Define struct
86         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
87         Remove globals_ and locals_ members.  Add exact_, globs_,
88         default_version_, is_global_.
89         (Version_script_info::Glob): Remove pattern, add expression and
90         is_global.  Update constructor.  Change all callers.
91         * dynobj.cc (Versions::finalize): Mark the version symbol as the
92         default version.
93         (Versions::symbol_section_contents): If a symbol is undefined, or
94         defined in a dynamic object, set the version index to
95         VER_NDX_LOCAL.
96         * symtab.cc (Symbol_table::add_from_relobj): Don't call
97         symbol_is_local.
98         (Symbol_table::add_from_pluginobj): Likewise.
99         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
101 2010-01-11  Doug Kwan  <dougkwan@google.com>
103         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
104         (incremental_dump_LDADD): Add linking option for libintl.
105         * Makefile.in: Regenerate.
107 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
109         PR gold/11144
110         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
111         instead of -Ds.
112         * testsuite/Makefile.in: Regenerated.
114 2010-01-10  Doug Kwan  <dougkwan@google.com>
116         * options.h (DEFINE_var): Use parentheses around argument varname__
117         in macro body to avoid any unintended subsequent substitutions.
119 2010-01-10  Ian Lance Taylor  <iant@google.com>
121         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
122         candidates before doing symbol resolution.
124         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
125         ODR candidates if only one is weak.
127 2010-01-08  Ian Lance Taylor  <iant@google.com>
129         * script.cc (Version_script_info::build_expression_list_lookup):
130         Don't warn about ambiguous version, just record the ambiguity.
131         (Version_script_info::get_symbol_version_helper): Give error if
132         version is ambiguous.
134 2010-01-08  Doug Kwan  <dougkwan@google.com>
136         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
137           prev_data_size_ and prev_addralign_.  Remove initializer for
138           deleted data member has_been_changed_.
139           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
140           to determine if the table is empty.
141           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
142           Remove.
143           (Stub_table::add_reloc_stub): Define method in class definition
144           instead of just declaring it there.
145           (Stub_table::add_cortex_a8_stub): New method definition.
146           (Stub_table::update_data_size_and_addralign): Ditto.
147           (Stub_table::finalize_stubs): Ditto.
148           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
149           (Stub_table::do_addralign_): Return address alignment in the
150           (Stub_table::do_reset_address_and_file_offset): Define method in
151           class definition instead of declaring it there.  Set current data
152           size to be the data size of the previous pass.
153           (Stub_table::set_final_data_size): Use current data size as the
154           final data size.
155           (Stub_table::relocate_stub): Change parameter type of stub from
156           Reloc_stub pointer to Stub pointer.
157           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
158           (Stub_table::Cortex_a8_stub_list): New typedef.
159           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
160            Stub_table::prev_addralign_): New data member.
161           (Arm_relobj::Arm_relobj): Initialize data member
162           section_has_cortex_a8_workaround_.
163           (Arm_relobj::section_has_cortex_a8_workaround,
164            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
165            definitions.
166           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
167           declarations.
168           (Target_arm::relocate_stub): Change parameter type of stub from
169           Reloc_stub pointer to Stub pointer.
170           (Insn_template::size, Insn_template::alignment): Handle
171           THUMB16_SPECIAL_TYPE.
172           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
173            Stub_table::update_data_size_and_addralign,
174            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
175           definitions.
176           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
177           (Stub_table::do_write): Ditto.
178           (Target_arm::do_relax): Adjust code for changes in Stub_table.
180 2010-01-08  Ian Lance Taylor  <iant@google.com>
182         PR 11108
183         * symtab.h (class Symbol): Remove fields is_target_special_ and
184         has_plt_offset_.  Add field is_defined_in_discarded_section_.
185         (Symbol::is_defined_in_discarded_section): New function.
186         (Symbol::set_is_defined_in_discarded_section): New function.
187         (Symbol::has_plt_offset): Rewrite.
188         (Symbol::set_plt_offset): Verify that new offset is not -1U.
189         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
190         Don't initialize is_target_special_ or has_plt_offset_.
191         Initialize is_defined_in_discarded_section_.
192         (Symbol_table::add_from_relobj): If appropriate, set
193         is_defined_in_discarded_section.
194         * resolve.cc (Symbol::override_base_with_special): Don't test
195         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
196         * target-reloc.h (relocate_section): Do special handling for
197         symbols defined in discarded sections for global symbols as well
198         as local symbols.
200 2010-01-08  Ian Lance Taylor  <iant@google.com>
202         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
203         the SHT_SYMTAB case.
205 2010-01-08  Ian Lance Taylor  <iant@google.com>
207         * object.cc (Sized_relobj::do_layout): Don't get confused if
208         layout_eh_frame returns NULL.
210 2010-01-08  Ian Lance Taylor  <iant@google.com>
212         PR 11084
213         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
214         dynamic symbol table, use the normal symbol table.
215         (Sized_dynobj::do_read_symbols): Remove assertion about type of
216         symbol table.
218 2010-01-08  Ian Lance Taylor  <iant@google.com>
220         PR 11072
221         * layout.cc (Layout::include_section): Remove .gnu_debuglink
222         sections.
224 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
226         * version.cc (print_version): Change to "Copyright 2010".
228 2010-01-08  Ian Lance Taylor  <iant@google.com>
230         PR 10287
231         PR 11063
232         * i386.cc (class Target_i386): Change return type of plt_section
233         to be non-const.
234         (class Output_data_plt_i386): Add tls_desc_rel_ field.
235         (Output_data_plt_i386::Output_data_plt_i386): Initialize
236         tls_desc_rel_ field.
237         (Output_data_plt_i386::rel_tls_desc): New function.
238         (Target_i386::rel_tls_desc_section): New function.
239         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
240         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
241         R_386_TLS_DESC reloc in rel_tls_desc_section.
242         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
243         Define struct Tlsdesc_info.
244         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
245         (Target_x86_64::do_reloc_symbol_index): New function.
246         (Target_x86_64::add_tlsdesc_info): New function.
247         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
248         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
249         tlsdesc_rel_ field.
250         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
251         all callers.
252         (Output_data_plt_x86_64::rela_tlsdesc): New function.
253         (Target_x86_64::rela_tlsdesc_section): New function.
254         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
255         handling.
256         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
257         (Target_x86_64::do_reloc_addend): New function.
258         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
259         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
260         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
261         (Output_reloc::type): New function.
262         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
263         (Output_reloc::is_target_specific): New function.
264         (Output_reloc::target_arg): New function.
265         (class Output_reloc) [SHT_RELA]: Add four new constructors for
266         absolute relocs and target specific relocs.
267         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
268         add_target_specific.
269         (class Output_data_reloc) [SHT_RELA]: Likewise.
270         * output.cc (Output_reloc::Output_reloc): Add four new versions
271         for absolute relocs and target specific relocs.
272         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
273         (Output_reloc::get_symbol_index): Likewise.
274         (Output_reloc::local_section_offset): Check that local_sym_index_
275         is not TARGET_CODE or 0.
276         (Output_reloc::symbol_value): Likewise.
277         (Output_reloc::write) [SHT_RELA]: Call target for target specific
278         reloc.
279         * target.h (class Target): Add reloc_symbol_index and reloc_addend
280         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
281         functions.
282         * layout.cc (add_target_dynamic_tags): Use output section for
283         DT_PLTRELSZ and DT_JMPREL.
285 2010-01-07  Ian Lance Taylor  <iant@google.com>
287         PR 11061
288         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
289         function.
290         (class Output_data_reloc_generic): Define.
291         (class Output_data_reloc_base): Change base class to
292         Output_data_reloc_generic.  Change add() method to call
293         bump_relative_reloc_count for a relative reloc.  Remove
294         sort_relocs_ field.
295         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
296         to sort_relocs().
297         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
298         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
299         appropriate.
300         * layout.h (class Layout): Update declaration.
302 2010-01-07  Ian Lance Taylor  <iant@google.com>
304         * output.h (class Output_data): Add const version of
305         output_section and do_output_section.
306         (class Output_section_data): Add const version of
307         do_output_section.
308         (class Output_section): Likewise.
309         * layout.cc (Layout::add_target_dynamic_tags): New function.
310         * layout.h (class Layout): Update declarations.
311         * arm.cc (Target_arm::do_finalize_sections): Use
312         add_target_dynamic_tags.
313         * i386.cc (Target_i386::do_finalize_sections): Likewise.
314         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
315         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
316         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
318 2010-01-07  Ian Lance Taylor  <iant@google.com>
320         PR 11042
321         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
322         object as needed.
324 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
325             Ian Lance Taylor  <iant@google.com>
327         PR 11019
328         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
329         Xindex::read_symtab_xindex.
331 2010-01-07  Doug Kwan  <dougkwan@google.com>
333         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
334         (Insn_template::thumb16_bcond_insn): New method declaration.
335         (Insn_template): Fix spelling.
336         (Stub::thumb16_special): New method declaration.
337         (Stub::do_write): Define virtual method which was previously pure
338         virtual.
339         (Stub::do_thumb16_special): New method declaration.
340         (Stub::do_fixed_endian_write): New template member.
341         (Reloc_stub::do_write): Remove.
342         (Reloc_stub::do_fixed_endian_write): Remove.
343         (Cortex_a8_stub): New class definition.
344         (Stub_factory::make_cortex_a8_stub): New method definition.
345         (Stub_factory::Stub_factory): Add missing static storage class
346         qualifier for elf32_arm_stub_a8_veneer_blx.
348 2010-01-07  Ian Lance Taylor  <iant@google.com>
350         PR 10980
351         * options.h (class General_options): Add --warn-unresolved-symbols
352         and --error-unresolved-symbols.
353         * errors.cc (Errors::undefined_symbol): Implement
354         --warn-unresolved-symbols.
356         * options.h (class General_options): Add -z text and -z textoff.
357         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
359 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
361         * gc.h (Garbage_collection::Cident_section_map): New typedef.
362         (Garbage_collection::cident_sections): New function.
363         (Garbage_collection::add_cident_section): New function.
364         (Garbage_collection::cident_sections_): New member.
365         (gc_process_relocs): Add references to sections whose names are C
366         identifiers.
367         * gold.h (cident_section_start_prefix): New constant.
368         (cident_section_stop_prefix): New constant.
369         (is_cident): New function.
370         * layout.cc (Layout::define_section_symbols): Replace string constants
371         with the newly defined constants.
372         * object.cc (Sized_relobj::do_layout): Track sections whose names are
373         C identifiers.
374         * testsuite/Makefile.am: Add gc_orphan_section_test.
375         * testsuite/Makefile.in: Regenerate.
376         * testsuite/gc_orphan_section_test.cc: New file.
377         * testsuite/gc_orphan_section_test.sh: New file.
379 2010-01-06  Ian Lance Taylor  <iant@google.com>
381         PR 10980
382         * options.h (class General_options): Add --warn-shared-textrel.
383         * layout.cc (Layout::finish_dynamic_section): Implement
384         --warn-shared-textrel.
386         PR 10980
387         * options.h (class General_options): Add --warn-multiple-gp.
389 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
391         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
392         $(THREADSLIB) and $(LIBDL).
393         * Makefile.in: Rebuild.
395 2010-01-06  Ian Lance Taylor  <iant@google.com>
397         PR 10980
398         * options.cc (General_options::parse_section_start): New function.
399         (General_options::section_start): New function.
400         (General_options::General_options): Initialize all members.
401         * options.h: Include <map>
402         (class General_options): Add --section-start.  Add section_starts_
403         member.
404         * layout.cc (Layout::attach_allocated_section_to_segment): If
405         --section-start was used, set the address of the segment.  Remove
406         local sort_sections.
407         (Layout::relaxation_loop_body): If the address of the load segment
408         has been set by --section-start, don't use it.
409         * output.h (Output_segment::update_flags_for_output_section): New
410         function.
411         * output.cc (Output_segment::add_output_section): Call
412         update_flags_for_output_section.
414 2010-01-05  Ian Lance Taylor  <iant@google.com>
416         PR 10980
417         * options.h (class General_options): Add --undefined-version.
418         * script.cc (struct Version_expression): Add was_matched_by_symbol
419         field.
420         (Version_script_info::matched_symbol): New function.
421         (Version_script_info::get_symbol_version_helper): Call
422         matched_symbol.
423         (Version_script_info::check_unmatched_names): New function.
424         * script.h (class Version_script_info): Update declarations.
425         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
427         * options.h (class General_options): Use DEFINE_bool_alias for
428         allow_multiple_definition.
429         * resolve.cc (Symbol_table::should_override): Don't test
430         allow_multiple_definition.
432         PR 10980
433         * options.h (class General_options): Add --cref.
434         * main.cc (main): Print cref table if --cref.  Don't close mapfile
435         until after printing cref table.
436         * cref.cc: Include "symtab.h".
437         (class Cref_inputs): Define Cref_table_compare and Cref_table.
438         (Cref_table_compare::operator()): New function.
439         (Cref_inputs::gather_cref): New function.
440         (filecol): New static const.
441         (Cref_inputs::print_cref): New function.
442         (Cref::print_cref): New function.
443         * cref.h: Include <cstdio>.
444         (class Cref): Update declarations.
445         * mapfile.h (Mapfile::file): New function.
446         * object.h (class Object): Define Symbols.  Declare virtual
447         do_get_global_symbols.
448         (Object::get_global_symbols): New function.
449         * object.cc (Input_objects::add_object): Pass object to cref_ if
450         --cref.
451         (Input_objects::archive_start): Likewise.
452         (Input_objects::archive_stop): Likewise.
453         (Input_objects::print_cref): New function.
454         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
455         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
456         --cref.
457         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
458         function.
459         * plugin.h (class Sized_pluginobj): Update declarations.
461 2010-01-05  Ian Lance Taylor  <iant@google.com>
463         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
464         to is_default_version.  Rename insdef to insdefault.
465         (Symbol_table::add_from_relobj): Rename def to is_default_version
466         and local to is_forced_local.
467         (Symbol_table::add_from_pluginobj): Likewise.
468         (Symbol_table::add_from_dynobj): Likewise.
469         (Symbol_table::define_special_symbol): Rename insdef to
470         insdefault.
472 2010-01-04  Ian Lance Taylor  <iant@google.com>
474         PR 10980
475         * options.h (class General_options): Add
476         --allow-multiple-definition and -z muldefs.
477         * resolve.cc (Symbol_table::should_override): Don't warn about a
478         multiple symbol definition if --allow-multiple-definition or -z
479         muldefs.
481         PR 10980
482         * options.h (class General_options): Add --add-needed and
483         --copy-dt-needed-entries.  Tweak --as-needed help entry.
484         * object.cc (Input_objects::check_dynamic_dependencies): Give an
485         error if --copy-dt-needed-entries aka --add-needed is used and
486         would cause a change in behaviour.
488         PR 10980
489         * options.h (class General_options): Add -G as a short version of
490         --shared.  Add no-op options -assert, -g, and -i.
492 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
494         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
495         check for .text or .gnu.linkonce.t sections.
496         * icf.cc (Icf::find_identical_sections): Ditto.
497         Change the detection for mangled function name within the section
498         name.
499         * icf.h (is_section_foldable_candidate): New function.
501 2009-12-30  Ian Lance Taylor  <iant@google.com>
503         PR 10980
504         * options.h (class General_options): Permit two dashes with
505         --retain-symbols-file.
507 2009-12-30  Ian Lance Taylor  <iant@google.com>
509         PR 10979
510         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
511         don't put the file header and segment headers in the text
512         segment.
514         PR 10979
515         * common.cc (Sort_commons::operator()): Stabilize sort when both
516         entries are NULL.
517         (Symbol_table::do_allocate_commons_list): When allocating common
518         symbols, skip a symbol which is no longer common.
519         * symtab.h (Symbol::is_common): Test whether the symbol comes from
520         an object before checking its type.
521         * testsuite/common_test_2.c: New file.
522         * testsuite/common_test_3.c: New file.
523         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
524         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
525         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
526         (common_test_2_pic.o, common_test_2.so): New targets.
527         (common_test_3_pic.o, common_test_3.so): New targets.
528         * testsuite/Makefile.in: Rebuild.
530         PR 10979
531         * script.cc (read_input_script): If we see a new SECTIONS clause,
532         and we have added an input section, give an error.
533         * layout.h (class Layout): Add have_added_input_section function.
534         Add have_added_input_section_ field.
535         * layout.cc (Layout::Layout): Initialize
536         have_added_input_section_.
537         (Layout::layout): Set have_added_input_section_.
538         (Layout::layout_eh_frame): Likewise.
540 2009-12-30  Ian Lance Taylor  <iant@google.com>
542         PR 10931
543         * options.h (class General_options): Add --sort-common option.
544         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
545         * common.cc (Sort_common): Add sort_order parameter to
546         constructor.  Add sort_order_ field.
547         (Sort_commons::operator): Check sort_order_.
548         (Symbol_table::allocate_commons): Determine the sort order.
549         (Symbol_table::do_allocate_commons): Add sort_order parameter.
550         Change all callers.
551         (Symbol_table::do_allocate_commons_list): Likewise.
553 2009-12-30  Ian Lance Taylor  <iant@google.com>
555         PR 10916
556         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
557         symbols from this object, don't change the visibility of an
558         undefined symbol.
559         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
561 2009-12-30  Ian Lance Taylor  <iant@google.com>
563         PR 10861
564         * script.h (class Version_script_info): Define Language enum.
565         Update declarations.  Define Glob, Exact, and Lookup types.  Add
566         new fields globals_, locals_, and is_finalized_.
567         * script.cc: Various formatting fixes.
568         (class Parser_closure): Change language_stack_ from a vector of
569         std::string to one of Version_script_info::Language.  Adjust all
570         uses accordingly.
571         (class Lazy_demangler): Remove.
572         (struct Version_expression): Change language from std::string to
573         Version_script_info::Language.
574         (Version_script_info::Version_script_info): New function.
575         (Version_script_info::~Version_script_info): Don't call clear.
576         (Version_script_info::finalize): New function.
577         (Version_script_info::build_lookup_tables): New function.
578         (Version_script_info::build_expression_list_lookup): New
579         function.
580         (Version_script_info::get_symbol_version_helper): Rewrite to use
581         lookup tables.
582         (Version_script_info::print_expression_list): Adjust to use
583         Version_script_info::Language.
584         (script_push_lex_into_version_mode): Check that the version script
585         has not been finalized.
586         (version_script_push_lang): Change language string to
587         Version_script_info::Language.
588         * options.cc (Command_line::version_script): New function.
589         * options.h (class General_options): Add finalize_dynamic_list
590         function.  Change version_script from declaration to definition.
591         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
592         * testsuite/version_script.map: Remove duplicate def of foo.
593         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
594         version_script.map.
595         * testsuite/Makefile.in: Rebuild.
597 2009-12-30  Ian Lance Taylor  <iant@google.com>
599         PR 10843
600         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
601         if the input symbol index is 0, make the output symbol index 0.
603 2009-12-30  Ian Lance Taylor  <iant@google.com>
605         PR 10670
606         * options.h (class General_options): Add -x/--discard-all.
607         * object.cc (Sized_relobj::do_count_local_symbols): Handle
608         --discard-all.  If the local symbol needs a dynamic entry, check
609         that before handling --discard-locals.
611 2009-12-30  Ian Lance Taylor  <iant@google.com>
613         PR 10450
614         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
615         flags to PF_R.
616         (Output_segment::add_output_section): Don't change the flags if
617         the type is PT_TLS.
619         PR 10450
620         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
621         GNU hash table if they need a dynamic value.  Otherwise, don't add
622         them if they are defined in a dynamic object or are forced local.
624 2009-12-29  Ian Lance Taylor  <iant@google.com>
626         PR 10450
627         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
628         .gnu.hash table for a 32-bit target.
630         PR 10450
631         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
632         regular and a dynamic object only needs a dynamic symbol table
633         entry if it is externally visible.
635         PR 10450
636         * i386.cc (class Target_i386): Initialize global_offset_table_ in
637         constructor.  Add global_offset_table_ field.
638         (Target_i386::got_section): Set global_offset_table_.
639         (Target_i386::do_finalize_sections): Set global_offset_table_
640         size.
641         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
642         in constructor.  Add global_offset_table_ field.
643         (Target_x86_64::got_section): Set global_offset_table_.
644         (Target_x86_64::do_finalize_sections): Set global_offset_table_
645         size.
647         * layout.cc (Layout::Layout): Initialize increase_relro_.
648         (Layout::get_output_section): Add is_relro, is_last_relro, and
649         is_first_non_relro parameters.  Change all callers.
650         (Layout::choose_output_section): Likewise.
651         (Layout::add_output_section_data): Likewise.
652         (Layout::make_output_section): Likewise.
653         (Layout::set_segment_offsets): Clear increase_relro when using a
654         linker script.
655         * layout.h (class Layout): Add increase_relro method.  Add
656         increase_relro_ field.  Update declarations.
657         * output.cc (Output_section::Output_section): Initialize
658         is_last_relro_ and is_first_non_relro_.
659         (Output_segment::add_output_section): Group relro sections is
660         do_sort is true.  Handle is_last_relro and is_first_non_relro.
661         (Output_segment::maximum_alignment): Remove relro handling.
662         (Output_segment::set_section_addresses): Add increase_relro
663         parameter.  Change all callers.  Add initial alignment to align
664         relro sections on separate page.  Remove old relro handling.
665         (Output_segment::set_section_list_addresses): Remove in_relro
666         parameter.  Change all callers.
667         (Output_segment::set_offset): Add increase parameter.  Change all
668         callers.  Remove old relro handling.
669         * output.h (class Output_section): Add new methods: is_last_relro,
670         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
671         Add is_last_relro_ and is_first_non_relro_ fields.
672         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
673         Create separate .got.plt section.  Call increase_relro.
674         * x86_64.cc (Target_x86_64::got_section): Likewise.
675         * testsuite/relro_script_test.t: Add .got.plt.
677         PR 10450
678         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
679         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
680         (Layout::finalize): Call set_dynamic_symbol_size.
681         (Layout::set_dynamic_symbol_size): New function.
682         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
683         set_dynamic_symbol_size.
685         PR 10450
686         * output.h (class Output_section): Add is_entsize_zero_ field.
687         * output.cc (Output_section::Output_section): Initialize
688         is_entsize_zero_.
689         (Output_section::set_entsize): If two different entsizes are
690         requested, force it to zero.
691         (Output_section::add_input_section): Set flags for .debug_str
692         before updating section flags.  Set entsize.
693         (Output_section::update_flags_for_input_section): Set SHF_MERGE
694         and SHF_STRING if all input sections have those flags.
696 2009-12-29   Rafael Espindola  <espindola@google.com>
698         * main.cc (main): Fix the sys time reporting.
699         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
700         reporting.
702 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
704         * options.cc (General_options::parse_version): Allow -v to exit
705         without an error if there is nothing to link.
707 2009-12-29  Ian Lance Taylor  <iant@google.com>
709         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
710         using a version of gcc before 4.1.
711         * configure: Rebuild.
713 2009-12-28  Chris Demetriou  <cgd@google.com>
715         * attributes.cc (Output_attributes_section_data::do_write): Use
716         std::vector::front rather than std::vector::data.
718 2009-12-28  Ian Lance Taylor  <iant@google.com>
720         * symtab.h (class Symbol_table): Add enum Defined.
721         * resolve.cc (Symbol_table::should_override): Add defined
722         parameter.  Change all callers.  Test whether object is NULL
723         before calling a method on it.
724         (Symbol_table::report_resolve_problem): Add defined parameter.
725         Change all callers.
726         (Symbol_table::should_override_with_special): Likewise.
727         * symtab.cc (Symbol_table::define_in_output_data): Add defined
728         parameter.  Change all callers.
729         (Symbol_table::do_define_in_output_data): Likewise.
730         (Symbol_table::define_in_output_segment): Likewise.
731         (Symbol_table::do_define_in_output_segment): Likewise.
732         (Symbol_table::define_as_constant): Likewise.
733         (Symbol_table::do_define_as_constant): Likewise.
734         * script.h (class Symbol_assignment): Add is_defsym parameter to
735         constructor; change all callers.
736         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
737         parameter.  Change all callers.  Add is_defsym_ field.
738         (class Parser_closure): Add parsing_defsym parameter to
739         constructor; change all callers.  Add parsing_defsym accessor
740         function.  Add parsing_defsym_ field.
742 2009-12-28  Ian Lance Taylor  <iant@google.com>
744         * gold.cc (queue_middle_tasks): Fix formatting.
745         * object.cc (Relobj::is_section_name_included): Likewise.
747 2009-12-23  Ian Lance Taylor  <iant@google.com>
749         * i386.cc (Target_i386::do_calls_non_split): Recognize
750         -fsplit-stack prologue for a function with a static chain.
751         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
752         -fsplit-stack prologue when using %r11.
754 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
756         * options.cc (General_options::parse_version): Make -v continue and do
757         the link like GNU ld does.
759 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
761         * Makefile.am (CCFILES): Add timer.cc.
762         (HFILES): Add timer.h.
763         * configure.ac: Check for sysconf and times.
764         * main.cc: include timer.h.
765         (main): Use Timer instead of get_run_time.
766         * timer.cc: New.
767         * timer.h: New.
768         * workqueue.cc: include timer.h.
769         (Workqueue::find_and_run_task):
770         Report user, sys and wall time.
771         * Makefile.in: Regenerate.
772         * config.in: Regenerate.
773         * configure: Regenerate.
775 2009-12-16  Doug Kwan  <dougkwan@google.com>
777         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
778         sections.
779         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
780         relaxed input sections.
781         * output.cc (Output_section::find_relaxed_input_section): Change
782         return type to Output_relaxed_input_section pointer.  Adjust code
783         for new type of relaxed_input_section_map_.
784         * output.h (Output_section::find_relaxed_input_section): Change
785         return type to Output_relaxed_input_section pointer.
786         (Output_section::Output_relaxed_input_section_by_input_section_map):
787         New type.
788         (Output_section::relaxed_input_section_map_): Change type to
789         Output_section::Output_relaxed_input_section_by_input_section_map.
790         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
791         input section.
793 2009-12-15  Ian Lance Taylor  <iant@google.com>
795         * layout.cc (Layout::create_shstrtab): Only write out after input
796         sections if we are compressing debug sections.
798 2009-12-15  Ian Lance Taylor  <iant@google.com>
800         * archive.cc (Archive::add_symbols): Only look up a symbol without
801         a version if there is, in fact, a version.
803 2009-12-14  Ian Lance Taylor  <iant@google.com>
805         Revert -Wshadow changes, all changes from:
806         2009-12-11  Doug Kwan  <dougkwan@google.com>
807         2009-12-11  Nick Clifton  <nickc@redhat.com>
808         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
810 2009-12-11  Doug Kwan  <dougkwan@google.com>
812         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
813         due to -Wshadow.
814         * attributes.cc (Object_attribute::size): Ditto.
815         (Attributes_section_data::size): Ditto.
816         (Attributes_section_data::Attributes_section_data): Ditto.
817         (Output_attributes_section_data::do_write): Ditto.
818         * attributes.h (Object_attribute::set_type): Ditto.
819         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
821 2009-12-11  Nick Clifton  <nickc@redhat.com>
823         * archive.cc: Fix shadowed variable warnings.
824         * arm.cc: Likewise.
825         * compressed_output.cc: Likewise.
826         * compressed_output.h: Likewise.
827         * configure: Likewise.
828         * dwarf_reader.cc: Likewise.
829         * dynobj.cc: Likewise.
830         * dynobj.h: Likewise.
831         * ehframe.cc: Likewise.
832         * ehframe.h: Likewise.
833         * errors.cc: Likewise.
834         * expression.cc: Likewise.
835         * fileread.cc: Likewise.
836         * fileread.h: Likewise.
837         * freebsd.h: Likewise.
838         * i386.cc: Likewise.
839         * icf.cc: Likewise.
840         * incremental.h: Likewise.
841         * layout.cc: Likewise.
842         * layout.h: Likewise.
843         * mapfile.cc: Likewise.
844         * merge.cc: Likewise.
845         * merge.h: Likewise.
846         * object.cc: Likewise.
847         * object.h: Likewise.
848         * options.h: Likewise.
849         * output.cc: Likewise.
850         * output.h: Likewise.
851         * parameters.cc: Likewise.
852         * plugin.cc: Likewise.
853         * powerpc.cc: Likewise.
854         * reduced_debug_output.cc: Likewise.
855         * reduced_debug_output.h: Likewise.
856         * reloc.cc: Likewise.
857         * reloc.h: Likewise.
858         * resolve.cc: Likewise.
859         * script-sections.cc: Likewise.
860         * script.cc: Likewise.
861         * script.h: Likewise.
862         * sparc.cc: Likewise.
863         * symtab.cc: Likewise.
864         * symtab.h: Likewise.
865         * target-select.cc: Likewise.
866         * target-select.h: Likewise.
867         * token.h: Likewise.
868         * workqueue.cc: Likewise.
869         * workqueue.h: Likewise.
870         * x86_64.cc: Likewise.
872 2009-12-10  Doug Kwan  <dougkwan@google.com>
874         * arm.cc (attributes.h): New include.
875         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
876         (Arm_relobj::~Arm_relobj): Delete object pointed by
877         attributes_section_data_.
878         (Arm_relobj::attributes_section_data): New method definition.
879         (Arm_relobj::attributes_section_data_): New data member declaration.
880         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
881         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
882         attributes_section_data_.
883         (Arm_dynobj::attributes_section_data): New method definition.
884         (Arm_dynobj::attributes_section_data_): New data member declaration.
885         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
886         initialization value of may_use_blx_ to false.
887         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
888         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
889         object attributes to compute results instead of hard-coding.
890         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
891         Target_arm::get_secondary_compatible_arch,
892         Target_arm::set_secondary_compatible_arch
893         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
894         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
895         New method declarations.
896         (Target_arm::get_aeabi_object_attribute): New method definition.
897         (Target_arm::attributes_section_data_): New data member declaration.
898         (read_arm_attributes_section): New template definition.
899         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
900         (Arm_dynobj::do_read_symbols): Ditto.
901         (Target_arm::do_finalize_sections): Merge attributes sections from
902         input.  Check for BLX use after attributes section merging.
903         Fix __exidx_start and __exidx_end visibility.  Create an
904         .ARM.attributes section if necessary.
905         (Target_arm::get_secondary_compatible_arch,
906         Target_arm::set_secondary_compatible_arch,
907         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
908         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
909         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order): 
910         New method definitions.
912 2009-12-09  Ian Lance Taylor  <iant@google.com>
914         * plugin.cc (Plugin::load): Don't cast from void* to a function
915         pointer.
917 2009-12-09  Ian Lance Taylor  <iant@google.com>
919         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
920         information fields.
922 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
924         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
925         Replace two_file_shared_1.so with two_file_shared_2.so.
926         * testsuite/Makefile.in: Regenerated.
928 2009-12-08  Doug Kwan  <dougkwan@google.com>
930         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
931         (HFILES): Add attributes.h and int_encoding.h.
932         * Makefile.in: Regenerate.
933         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
934         function definitions to int_encoding.cc
935         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
936         prototypes to int_encoding.h
937         * reduced_debug_output.cc (int_encoding.h): New include.
938         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
939         function definitions to int_encoding.cc
940         (insert_into_vector, read_from_pointer): Move template definitions to
941         int_encoding.h
942         * attributes.cc: New file.
943         * attributes.h: New file.
944         * int_encoding.cc: New file.
945         * int_encoding.h: New file.
947 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
949         PR gold/11055
950         * incremental-dump.cc (dump_incremental_inputs): New.
951         (main): Use dump_incremental_inputs.
953 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
955         PR gold/10893
956         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
957         checking elfcpp::STT_FUNC.
958         (Target_i386::Relocate::relocate): Likewise.
959         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
961         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
962         symbols from shared libraries into normal FUNC symbols.
964         * symtab.h (Symbol): Add is_func and use it.
966 2009-12-05  Doug Kwan  <dougkwan@google.com>
968         * arm.cc (Target_arm::arm_info): Initialize new fields
969         attributes_section and attributes_vendor.
970         * i386.cc (Target_i386::i386_info): Same.
971         * object.cc (Sized_relobj::do_layout): Skip attribute section.
972         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
973         fields attributes_section and attributes_vendor.
974         * sparc.cc (Target_sparc::sparc_info): Same.
975         * target.h (Target::attributes_section, Target::attributes_vendor,
976         Target::is_attributes_section, Target::attribute_arg_type,
977         Target::attributes_order): New method definitions.
978         (Target::Target_info::attributes_section,
979         Target::Target_info::attributes_vendor): New fields.
980         (Target::do_attribute_arg_type, Target::do_attributes_order): New
981         virtual method definitions.
982         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
983         attributes_section and attributes_vendor.
984         * testsuite/testfile.cc (Target_test::test_target_info): Same.
986 2009-12-05  Doug Kwan  <dougkwan@google.com>
988         * arm.cc: Update comments about interworking and stub generation.
989         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
990         considered as non-PIC.
991         (Arm_relocate_functions::base_abs): Fix formatting.
992         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
993         of function to use GOT entry address instead of offset.
994         (Target_arm::Scan::global): Issue an error if a symbol would need a
995         PLT does not get one because it is untyped.  Remove code to create
996         dynamic symbols for relative branches.
997         (Target_arm::Relocate::relocate: Use 0 instead of false since function
998         takes unsigned integer instead of boolean.
1000 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
1002         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
1003         (two_file_test_LDADD): Likewise.
1004         (common_test_1_LDADD): Likewise.
1005         (exception_test_LDADD) Likewise.
1006         (weak_test_LDADD): Likewise.
1007         (many_sections_test_LDADD): Likewise.
1008         (initpri1_LDADD): Likewise.
1009         (script_test_1_LDADD): Likewise.
1010         (script_test_2_LDADD): Likewise.
1011         (justsyms_LDADD): Likewise.
1012         (binary_test_LDADD): Likewise.
1013         (large_LDADD): Likewise.
1014         * testsuite/Makefile.in: Regenerated.
1016 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
1018         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
1019         (Symbol_table::override_with_special): Likewise.
1020         (Symbol_table::add_from_object): Likewise.
1022 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
1024         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1025         Don't set the data_offset twice.
1027 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
1029         * testsuite/Makefile.in: Regenerate.
1031 2009-12-03  Doug Kwan  <dougkwan@google.com>
1033         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
1034         (Target_arm::do_finalize_sections): Add parameter for symbol table
1035         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
1036         * i386.cc (Target_i386::do_finalize_sections): Add an additional
1037         parameter for symbol table pointer.
1038         * layout.cc (Layout::finalize): Call Target::finalize_sections with
1039         an additional parameter for a pointer to symbol table.
1040         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
1041         parameter for a symbol table pointer.
1042         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
1043         * target.h (Target::finalize_sections, Target::do_finalize_sections):
1044         Ditto.
1045         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
1046         parameter for a symbol table pointer.
1048 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
1050         * incremental.cc (Incremental_inputs_header)
1051         (Incremental_inputs_header_write, Incremental_inputs_entry)
1052         (Incremental_inputs_entry_write): Move ...
1053         * incremental.h (Incremental_inputs_header)
1054         (Incremental_inputs_header_write, Incremental_inputs_entry)
1055         (Incremental_inputs_entry_write): here.
1057 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
1059         * incremental.cc (make_sized_incremental_binary): Set the target.
1060         Error if it is incompatible.
1061         * output.h (Output_file): Add filename method.
1063 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
1065         * incremental.cc (Incremental_inputs_entry): Remove unused argument
1066         from the get_* methods.
1068 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
1070         * incremental-dump.cc (main): Check that the offeset of a script is 0.
1071         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
1072         Write 0 for the data_offset of scripts.
1074 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
1076         * testsuite/Makefile.am: Add the incremental_test.sh test.
1077         * testsuite/incremental_test.sh: New.
1078         * testsuite/incremental_test_1.c: New.
1079         * testsuite/incremental_test_2.c: New.
1081 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
1083        * incremental-dump.cc (main): Fix typos.
1085 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
1087         PR gold/11025
1088         * incremental-dump.cc (main): Use llu to print 64 bit values.
1090 2009-11-26  Per Ã˜yvind Karlsen <peroyvind@mandriva.org>
1091             H.J. Lu  <hongjiu.lu@intel.com>
1093         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
1094         $(LIBDL).
1095         (incremental_dump_LDADD): Likewise.
1096         * Makefile.in: Regenerated.
1098 2009-11-25  Doug Kwan  <dougkwan@google.com>
1099         
1100         Revert:
1102         2009-11-25  Doug Kwan  <dougkwan@google.com>
1104                 * arm.cc (Target_arm::Target_arm): Move method definition
1105                 outside of class definition.  Add code to handle
1106                 --target1-rel, --target1-abs and --target2= options.
1107                 (Target_arm::get_reloc_reloc_type): Change method to be
1108                 non-static and const.
1109                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
1110                 New data member declaration.
1111                 (Target_arm::Scan::local, Target_arm::Scan::global,
1112                 Target_arm::Relocate::relocate,
1113                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1114                 Adjust call to Target_arm::get_real_reloc_type.
1115                 (Target_arm::get_real_reloc_type): Use command line options
1116                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1117                 * options.h (--target1-rel, --target1-abs, --target2): New
1118                 ARM-only options.
1120 2009-11-25  Doug Kwan  <dougkwan@google.com>
1122         * arm.cc (Target_arm::Target_arm): Move method definition outside of
1123         class definition.  Add code to handle --target1-rel, --target1-abs
1124         and --target2= options.
1125         (Target_arm::get_reloc_reloc_type): Change method to be non-static
1126         and const.
1127         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
1128         member declaration.
1129         (Target_arm::Scan::local, Target_arm::Scan::global,
1130         Target_arm::Relocate::relocate,
1131         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
1132         call to Target_arm::get_real_reloc_type.
1133         (Target_arm::get_real_reloc_type): Use command line options to
1134         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
1135         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
1136         options.
1138 2009-11-25  Doug Kwan  <dougkwan@google.com>
1140         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
1141         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
1142         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
1143         formatting.
1144         (Arm_relocate_functions::thm_call): Replace body with a call to
1145         Arm_relocate_functions::thumb_branch_common.
1146         (Arm_relocate_functions::thm_jump24,
1147         Arm_relocate_functions::thm_xpc22): New method definitions.
1148         (Arm_relocate_functions::thumb_branch_common): New method definition.
1149         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
1150         operator.
1151         (Target_arm::Relocate::relocate): Adjust call to thm_call.
1152         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
1154 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
1156         * Makefile.am: Build incremental-dump
1157         * Makefile.in: Regenerate.
1158         * incremental-dump.cc: New.
1159         * incremental.cc (Incremental_inputs_header_data,
1160         Incremental_inputs_entry_data): Move to incremental.h
1161         * incremental.h: (Incremental_inputs_header_data,
1162         Incremental_inputs_entry_data): Move from incremental.cc
1164 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
1166         * incremental.cc (Incremental_inputs_header,
1167         Incremental_inputs_header_write, Incremental_inputs_entry,
1168         Incremental_inputs_entry_write): Add a typedef with the data type.
1170 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
1172         * incremental.cc (Incremental_inputs_header,
1173         Incremental_inputs_header_write, Incremental_inputs_entry,
1174         Incremental_inputs_entry_write): Update comment about which
1175         type has the filed descriptions.
1177 2009-11-15  Doug Kwan  <dougkwan@google.com>
1179         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
1180         (Arm_relocate_functions::arm_branch_common): Change method defintion
1181         in class definition to a method declaration and update list of formal
1182         parameters.
1183         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
1184         Arm_relocation_functions::jump24): Adjust call to
1185         Arm_relocate_functions::arm_branch_common.  Update list of formal
1186         parameters.
1187         (Arm_relocate_functions::xpc25): New method definition.
1188         (Arm_relocate_functions::arm_branch_common): Move method defintion
1189         out from class definition.  Use stubs for mode-switching and extending
1190         branch ranges.
1191         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
1192         specially.  Change code to enable use of stubs in ARM branches.
1194 2009-11-10  Doug Kwan  <dougkwan@google.com>
1196         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
1197         in method declaration.
1198         (Target_arm::relocate_stub): New method declaration.
1199         (Target_arm::default_target): Change to return a pointer instead of
1200         a const reference.
1201         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
1202         Target_arm::default_target.
1203         (Arm_Relobj::do_relocate_sections): Remove options paramater in
1204         method definition.
1205         (Target_arm::relocate_section): Adjust view.
1206         (Target_arm::relocate_stub): New method definition.
1208 2009-11-10  Doug Kwan  <dougkwan@google.com>
1210         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
1211         a format warning.
1212         * incremental.cc (open_incremental_binary): Initialized local
1213         variables to avoid warnings.
1214         * object.cc (make_elf_object): Ditto.
1215         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
1216         a format warning.
1218 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
1220         PR gold/10930
1221         * testsuite/plugin_test.c: Include "config.h".
1223 2009-11-09  Doug Kwan  <dougkwan@google.com>
1225         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
1226         (arm_symbol_value): Remove.
1227         (Arm_relocate_functions::arm_branch_common,
1228         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
1229         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
1230         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
1231         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
1232         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
1233         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
1234         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
1235         Arm_relocate_functions::thm_mobw_abs_nc,
1236         Arm_relocate_functions::thm_mov_abs,
1237         Arm_relocate_functions::movw_prel_nc,
1238         Arm_relocate_functions::thm_movt_abs,
1239         Arm_relocate_functions::movt_prel,
1240         Arm_relocate_functions::thm_movw_prel_nc,
1241         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
1242         (Target_arm::Relocate::relocate): Only decompose address into two
1243         parts if relocation type uses the thumb-bit and pass the actual
1244         bit instead of a flag indicating that the thumb-bit is used.  Adjust
1245         calls to methods in Arm_relocate_functions for this change.
1247 2009-11-08  Ian Lance Taylor  <iant@google.com>
1249         PR 10925
1250         * reloc.cc: Instantiate
1251         Sized_relobj::initialize_input_to_output_maps and
1252         Sized_relobj:free_input_to_output_maps.
1254 2009-11-06  Ian Lance Taylor  <iant@google.com>
1256         PR 10876
1257         * defstd.cc (in_segment): Set only_if_ref true for "end".
1259 2009-11-06  Doug Kwan  <dougkwan@google.com>
1261         * arm.cc (class Reloc_stub): Correct a comment.
1262         (Target_arm::Target_arm): Initialize arm_input_section_map_.
1263         (Target_arm::scan_section_for_stubs): New method declaration.
1264         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
1265         Change methods from private to protected.
1266         (Target_arm::do_may_relax): New method definition.
1267         (Target_arm::do_relax, Target_arm::group_sections,
1268         Target_arm::scan_reloc_for_stub,
1269         Target_arm::scan_reloc_section_for_stubs): New method declarations.
1270         (Target_arm::arm_input_section_map_): New data member declaration.
1271         (Target_arm::scan_reloc_for_stub,
1272         Target_arm::scan_reloc_section_for_stubs,
1273         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
1274         Target_arm::do_relax): New method definitions.
1276 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
1278         * configure.ac: Check for (struct stat)::st_mtim
1279         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
1280         * config.in: Regenerate.
1281         * configure: Regenerate.
1283 2009-11-05  Ian Lance Taylor  <iant@google.com>
1285         PR 10910
1286         * output.cc (Output_segment::add_output_section): Add missing
1287         return statement.
1289 2009-11-04  Ian Lance Taylor  <iant@google.com>
1291         PR 10880
1292         * object.h (class Object): Add is_needed and set_is_needed
1293         methods.  Add is_needed_ field.  Make bool fields into bitfields.
1294         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
1295         defined in a dynamic object and referenced by a regular object,
1296         set is_needed for the dynamic object.
1297         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
1298         if the file is marked with as_needed and it is not needed.
1300 2009-11-04  Ian Lance Taylor  <iant@google.com>
1302         PR 10887
1303         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
1304         tags if data is discarded by linker script.
1305         * i386.cc (Target_i386::do_finalize_sections): Likewise.
1306         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
1307         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
1308         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1310 2009-11-04  Ian Lance Taylor  <iant@google.com>
1312         * layout.cc (Layout::get_output_section): Add is_interp and
1313         is_dynamic_linker_section parameters.  Change all callers.
1314         (Layout::choose_output_section): Likewise.
1315         (Layout::make_output_section): Likewise.
1316         (Layout::add_output_section_data): Add is_dynamic_linker_section
1317         parameter.  Change all callers.
1318         * layout.h (class Layout): Update declarations.
1319         * output.h (class Output_section): Add is_interp, set_is_interp,
1320         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
1321         Add is_interp_, is_dynamic_linker_section_ fields.  Change
1322         generate_code_fills_at_write_ to a bitfield.
1323         * output.cc (Output_section::Output_sections): Initialize new
1324         fields.
1325         (Output_segment::add_output_section): Add do_sort parameter.
1326         Change all callers.
1328 2009-11-03  Ian Lance Taylor  <iant@google.com>
1330         PR 10860
1331         * options.h (class General_options): Add --warn-common.
1332         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
1333         merging two common symbols.
1334         (Symbol_table::should_override): Handle --warn-common when merging
1335         a common symbol with a defined symbol.  Use report_resolve_problem
1336         for multiple definitions.
1337         (Symbol_table::report_resolve_problem): New function.
1338         * symtab.h (class Symbol_table): Declare report_resolve_problem.
1340 2009-11-03  Doug Kwan  <dougkwan@google.com>
1342         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
1343         stub_factory_.
1344         (Target_arm::stub_factory): New method definition.
1345         (Target_arm::new_arm_input_section,
1346         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
1347         Target_arm::reloc_uses_thumb_bit): New method declarations.
1348         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map): 
1349         New type definitions.
1350         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
1351         member declarations.
1352         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
1353         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
1354         New method definitions.
1356 2009-11-03  Ian Lance Taylor  <iant@google.com>
1358         * options.h (class General_options): Add --warn_constructors.
1360 2009-11-03  Ian Lance Taylor  <iant@google.com>
1362         PR 10893
1363         * defstd.cc (in_section): Add entries for __rel_iplt_start,
1364         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
1366 2009-11-03  Ian Lance Taylor  <iant@google.com>
1368         PR 10895
1369         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
1370         --msgid-bugs-address.
1371         (install-pdf): New target.
1372         (install-data_yes): Look up one directory to find mkinstalldirs.
1374 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
1376         * po/Make-in (.po.gmo): Don't generate .gmo files in source
1377         tree.
1379 2009-10-30  Doug Kwan  <dougkwan@google.com>
1381         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
1383 2009-10-30  Doug Kwan  <dougkwan@google.com>
1385         * arm.cc (Stub_addend_reader): New struct template definition
1386         and partial specializations.
1387         (Stub_addend_reader::operator()): New method definition for a
1388         partially specialized template.
1390 2009-10-30  Doug Kwan  <dougkwan@google.com>
1392         * arm.cc (Arm_relobj::processor_specific_flags): New method
1393         definition.
1394         (Arm_relobj::do_read_symbols): New method declaration.
1395         (Arm_relobj::processor_specific_flags_): New data member declaration.
1396         (Arm_dynobj): New class definition.
1397         (Target_arm::do_finalize_sections): Add input_objects parameter.
1398         (Target_arm::do_adjust_elf_header): New method declaration.
1399         (Target_arm::are_eabi_versions_compatible,
1400         (Target_arm::merge_processor_specific_flags): New method declaration.
1401         (Target_arm::do_make_elf_object): New overloaded method definitions
1402         and declaration.
1403         (Arm_relobj::do_read_symbols): New method definition.
1404         (Arm_dynobj::do_read_symbols): Ditto.
1405         (Target_arm::do_finalize_sections): Add input_objects parameters.
1406         Merge processor-specific flags from all input objects.
1407         (Target_arm::are_eabi_versions_compatible,
1408         Target_arm::merge_processor_specific_flags,
1409         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
1410         New method definitions.
1411         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
1412         Input_objects pointer type parameter.
1413         * layout.cc (Layout::finalize): Pass input objects to target's.
1414         finalize_sections function.
1415         * output.cc (Output_file_header::do_sized_write): Set ELF file
1416         header's processor-specific flags.
1417         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
1418         Input_objects pointer type parameter.
1419         * sparc.cc (Target_sparc::do_finalize_sections): Same.
1420         * target.h (Input_objects): New forward class declaration.
1421         (Target::processor_specific_flags,
1422         Target::are_processor_specific_flags_sect): New method definitions.
1423         (Target::finalize_sections): Add input_objects parameter.
1424         (Target::Target): Initialize processor_specific_flags_ and
1425         are_processor_specific_flags_set_.
1426         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
1427         parameter.
1428         (Target::set_processor_specific_flags): New method definition.
1429         (Target::processor_specific_flags_,
1430         Target::are_processor_specific_flags_set_): New data member
1431         declarations.
1432         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
1433         Input_objects pointer type parameter.
1435 2009-10-30  Doug Kwan  <dougkwan@google.com>
1437         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
1439 2009-10-28  Ian Lance Taylor  <iant@google.com>
1441         * object.h (class Relobj): Drop options parameter from
1442         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
1443         do_scan_relocs, do_relocate.  Change all callers.
1444         (class Sized_relobj): Drop options parameters from
1445         do_gc_process_relocs, do_scan_relocs, do_relocate,
1446         do_relocate_sections, relocate_sections, emit_relocs_scan,
1447         emit_relocs_scan_reltype.  Change all callers.
1448         (struct Relocate_info): Remove options field and all references to
1449         it.
1450         * reloc.h (class Read_relocs): Remove options constructor
1451         parameter and options_ field.  Change all callers.
1452         (class Gc_process_relocs, class Scan_relocs): Likewise.
1453         (class Relocate_task): Likewise.
1454         * target-reloc.h (scan_relocs): Remove options parameter.  Change
1455         all callers.
1456         (scan_relocatable_relocs): Likewise.
1457         * target.h (class Sized_target): Remove options parameter from
1458         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
1459         all callers.
1460         * gc.h (gc_process_relocs): Remove options parameter.  Change all
1461         callers.
1462         * arm.cc: Update functions to remove options parameters.
1463         * i386.cc: Likewise.
1464         * powerpc.cc: Likewise.
1465         * sparc.cc: Likewise.
1466         * x86_64.cc: Likewise.
1467         * testsuite/testfile.cc: Likewise.
1469 2009-10-28  Doug Kwan  <dougkwan@google.com>
1471         * arm.cc (Arm_relobj): New class definition.
1472         (Arm_relobj::scan_sections_for_stubs, 
1473         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
1474         New method definitions.
1476 2009-10-28  Cary Coutant  <ccoutant@google.com>
1478         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
1479         (Plugin::cleanup_done_): New member.
1480         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
1481         (Plugin_manager::cleanup_done_): Remove.
1482         (Plugin_manager::add_input_file): Edit error message.
1483         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
1484         (Plugin_manager::cleanup): Remove use of cleanup_done_.
1486 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
1488         * fileread.cc: (File_read::View::~View): Use the new
1489         data_ownership_ filed.
1490         (File_read::~File_read): Dispose the new whole_file_view_.
1491         (File_read::open): Mmap the whole file if needed.
1492         (File_read::open): Use whole_file_view_ instead of contents_.
1493         (File_read::find_view): Use whole_file_view_ if applicable.
1494         (File_read::do_read): Use whole_file_view_ instead of contents_.
1495         (File_read::make_view): Use whole_file_view_ instead of contents_,
1496         update File_read::View::View call.
1497         (File_read::find_or_make_view): Update File_read::View::View
1498         call.
1499         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
1500         remove contents_
1501         (File_read::View::Data_ownership): New enum.
1502         (File_read::View::View): Replace bool mapped_ with Data_ownership
1503         argument.
1504         (File_read::View::mapped_): Remove (replaced by data_ownership_).
1505         (File_read::View::data_ownership_): New field.
1506         (File_read::contents_): Remove (replaced by whole_file_view_).
1507         (File_read::whole_file_view_): New field.
1508         * options.h (class General_options): Add --keep-files-mapped.
1510 2009-10-27  Cary Coutant  <ccoutant@google.com>
1512         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
1513         * testsuite/Makefile.am (plugin_test_5): New test case.
1514         * testsuite/Makefile.in: Regenerate.
1516 2009-10-25  Doug Kwan  <dougkwan@google.com>
1518         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
1519         from private to protected to allow access by child class.
1520         (Sized_relobj::do_relocate_sections): New method declaration.
1521         (Sized_relobj::relocate_sections): Virtualize.
1522         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from 
1523         Sized_relobj::relocate_sections.  Instantiate template explicitly
1524         for different target sizes and endianity.
1526 2009-10-24  Doug Kwan  <dougkwan@google.com>
1528         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
1529         (Arm_input_section::as_arm_input_section): New method.
1530         (Arm_output_section): New class definition.
1531         (Arm_output_section::create_stub_group,
1532         Arm_output_section::group_sections): New method definitions.
1534 2009-10-22  Doug Kwan  <dougkwan@google.com>
1536         * arm.cc (Arm_input_section): New class definition.
1537         (Arm_input_section::init, Arm_input_section:do_write,
1538         Arm_input_section::set_final_data_size,
1539         Arm_input_section::do_reset_address_and_file_offset): New method
1540         definitions.
1542 2009-10-21  Doug Kwan  <dougkwan@google.com>
1544         * arm.cc (Stub_table, Arm_input_section): New forward class
1545         declarations.
1546         (Stub_table): New class defintion.
1547         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
1548         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
1549         New method definition.
1551 2009-10-21  Doug Kwan  <dougkwan@google.com>
1553         * arm.cc: Update copyright comments.
1554         (Target_arm): New forward class template declaration.
1555         (Arm_address): New type.
1556         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
1557         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
1558         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
1559         constants.
1560         (Insn_template): Same.
1561         (DEF_STUBS): New macro.
1562         (Stub_type): New enum type.
1563         (Stub_template): New class definition.
1564         (Stub): Same.
1565         (Reloc_stub): Same.
1566         (Stub_factory): Same.
1567         (Target_arm::Target_arm): Initialize may_use_blx_ and
1568         should_force_pic_veneer_.
1569         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
1570         Target_arm::should_force_pic_veneer,
1571         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
1572         Target_arm::using_thumb_only, Target_arm:;default_target): New
1573         method defintions.
1574         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
1575         New data member declarations.
1576         (Insn_template::size, Insn_template::alignment): New method defintions.
1577         (Stub_template::Stub_template): New method definition.
1578         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
1579         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
1580         (Stub_factory::Stub_factory): New method definition.
1581         * gold.h (string_hash): New template.
1582         * output.h (Input_section_specifier::hash_value): Use
1583         gold::string_hash.
1584         (Input_section_specifier::string_hash): Remove.
1585         * stringpool.cc (Stringpool_template::string_hash): Use
1586         gold::string_hash.
1588 2009-10-20  Doug Kwan  <dougkwan@google.com>
1590         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
1591         symbols of relaxed input sections.
1592         * output.h (Output_section::find_relaxed_input_section): Make
1593         method public.
1595 2009-10-16  Doug Kwan  <dougkwan@google.com>
1597         * dynobj.cc (Versions::Versions): Initialize version_script_.
1598         Only insert base version symbol definition for a shared object
1599         if version script defines any version versions.
1600         (Versions::define_base_version): New method definition.
1601         (Versions::add_def): Check that base version is not needed.
1602         (Versions::add_need): Define base version lazily.
1603         * dynobj.h (Versions::define_base_version): New method declaration.
1604         (Versions::needs_base_version_): New data member declaration.
1605         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
1606         (check_DATA): Add no_version_test.stdout.
1607         (libno_version_test.so, no_version_test.o no_version_test.stdout):
1608         New make rules.
1609         * testsuite/Makefile.in: Regenerate.
1610         * testsuite/no_version_test.c: New file.
1611         * testsuite/no_version_test.sh: Ditto.
1613 2009-10-16  Doug Kwan  <dougkwan@google.com>
1615         * expression.cc (class Segment_start_expression): New class definition.
1616         (Segment_start_expression::value): New method definition.
1617         (script_exp_function_segment_start): Return a new
1618         Segment_start_expression.
1619         * gold/script-c.h (script_saw_segment_start_expression): New function
1620         prototype.
1621         * script-sections.cc (Script_sections::Script_sections): Initialize
1622         SAW_SEGMENT_START_EXPRESSION_ to false.
1623         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
1624         and -Tbbs options to specify section addresses if given in
1625         command line and no SEGMENT_START expression is seen in a script.
1626         * script-sections.h (Script_sections::saw_segment_start_expression,
1627         Script_sections::set_saw_segment_start_expression): New method
1628         definition.
1629         (Script_sections::saw_segment_start_expression_): New data member
1630         declaration.
1631         * script.cc (script_saw_segment_start_expression): New function.
1632         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
1633         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
1634         script_test_7.sh and script_test_8.sh.
1635         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
1636         script_test_8.stdout.
1637         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
1638         (script_test_6, script_test_6.stdout, script_test_7,
1639         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
1640         * Makefile.in: Regenerate.
1641         * testsuite/script_test_6.sh: New file.
1642         * testsuite/script_test_6.t: Same.
1643         * testsuite/script_test_7.sh: Same.
1644         * testsuite/script_test_7.t: Same.
1645         * testsuite/script_test_8.sh: Same.
1647 2009-10-16  Doug Kwan  <dougkwan@google.com>
1649         * output.cc (Output_segment::set_section_list_address): Cast
1650         expressions to unsigned long long type to avoid format warnings.
1652 2009-10-15  Ian Lance Taylor  <iant@google.com>
1654         * script.cc (Script_options::add_symbol_assignment): Always add a
1655         dot assignment to script_sections_.
1656         * script-sections.cc (Script_sections::add_dot_assignment):
1657         Initialize if necessary.
1659         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
1660         program headers with no load segment if there is a linker script.
1662         * layout.cc (Layout::set_segment_offsets): Align the file offset
1663         to the segment aligment for -N or -n with no load segment.
1664         * output.cc (Output_segment::add_output_section): Don't crash if
1665         the first section is a TLS section.
1666         (Output_segment::set_section_list_addresses): Print an error
1667         message if the address moves backward in a linker script.
1668         * script-sections.cc
1669         (Output_section_element_input::set_section_addresses): Don't
1670         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
1671         (Orphan_output_section::set_section_addresses): Likewise.
1673 2009-10-15  Doug Kwan  <dougkwan@google.com>
1675         * layout.cc (Layout::finish_dynamic_section): Generate tags
1676         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
1677         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
1678         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
1680 2009-10-14  Ian Lance Taylor  <iant@google.com>
1682         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
1683         fields.
1684         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
1685         data_shdr fields of relinfo.
1686         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
1687         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
1688         R_386_TLS_LDO_32, adjust based on section flags.
1689         (Target_i386::Relocate::fix_up_ldo): Remove.
1691 2009-10-13  Ian Lance Taylor  <iant@google.com>
1693         Add support for -pie.
1694         * options.h (class General_options): Add -pie and
1695         --pic-executable.
1696         (General_options::output_is_position_independent): Test -pie.
1697         (General_options::output_is_executable): Return true if not shared
1698         and not relocatable.
1699         (General_options::output_is_pie): Remove.
1700         * options.cc (General_options::finalize): Reject incompatible uses
1701         of -pie.
1702         * gold.cc (queue_middle_tasks): A -pie link is not static.
1703         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
1704         * symtab.cc (Symbol::final_value_is_known): Return false if
1705         output_is_position_independent.
1706         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
1707         output_is_position_independent.
1708         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
1709         output_is_position_independent.
1710         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
1711         output_is_position_independent.
1712         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
1713         two_file_pie_test.
1714         (basic_pie_test.o, basic_pie_test): New targets.
1715         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
1716         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
1717         (two_file_pie_test): New target.
1718         * testsuite/Makefile.in: Rebuild.
1719         * README: Remove note saying that -pie is not supported.
1721 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
1723         * options.h (class General_options): Add -init and -fini.
1724         * layout.cc (Layout::finish_dynamic_section): Emit
1725         given init and fini functions.
1727 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
1729         * gc.h (gc_process_relocs): Check if icf is enabled using new
1730         function.
1731         * gold.cc (queue_initial_tasks): Likewise.
1732         (queue_middle_tasks): Likewise.
1733         * object.cc (do_layout): Likewise.
1734         * symtab.cc (is_section_folded): Likewise.
1735         * main.cc (main): Likewise.
1736         * reloc.cc (Read_relocs::run): Likewise.
1737         (Sized_relobj::do_scan_relocs): Likewise.
1738         * icf.cc (is_function_ctor_or_dtor): New function.
1739         (Icf::find_identical_sections): Check if function is ctor or dtor when
1740         safe icf is chosen.
1741         * options.h (General_options::icf): Change option to be an enum.
1742         (Icf_status): New enum.
1743         (icf_enabled): New method.
1744         (icf_safe_folding): New method.
1745         (set_icf_status): New method.
1746         (icf_status_): New variable.
1747         * (options.cc) (General_options::finalize): Set icf_status_.
1748         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
1749         icf_test and icf_keep_unique_test to use the --icf enum flag.
1750         * testsuite/icf_safe_test.sh: New file.
1751         * testsuite/icf_safe_test.cc: New file. 
1753 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
1755         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
1756         includes to gc.h and icf.h.
1757         * arm.cc: Include gc.h.
1758         * gold.cc: Likewise.
1759         * i386.cc: Likewise.
1760         * powerpc.cc: Likewise.
1761         * sparc.cc: Likewise.
1762         * x86_64.cc: Likewise.
1763         * gc.h: Include icf.h.
1765 2009-10-11  Ian Lance Taylor  <iant@google.com>
1767         * plugin.cc: Include "gold.h" before other header files.
1769 2009-10-10  Chris Demetriou  <cgd@google.com>
1771         * options.h (Input_file_argument::Input_file_type): New enum.
1772         (Input_file_argument::is_lib_): Replace with...
1773         (Input_file_argument::type_): New member.
1774         (Input_file_argument::Input_file_argument): Take Input_file_type
1775         'type' rather than boolean 'is_lib' as second argument.
1776         (Input_file_argument::is_lib): Use type_.
1777         (Input_file_argument::is_searched_file): New function.
1778         (Input_file_argument::may_need_search): Handle is_searched_file.
1779         * options.cc (General_options::parse_library): Support -l:filename.
1780         (General_options::parse_just_symbols): Update for Input_file_argument
1781         changes.
1782         (Command_line::process): Likewise.
1783         * archive.cc (Archive::get_file_and_offset): Likewise.
1784         * plugin.cc (Plugin_manager::release_input_file): Likewise.
1785         * script.cc (read_script_file, script_add_file): Likewise.
1786         * fileread.cc (Input_file::Input_file): Likewise.
1787         (Input_file::will_search_for): Handle is_searched_file.
1788         (Input_file::open): Likewise.
1789         * readsyms.cc (Read_symbols::get_name): Likewise.
1790         * testsuite/Makefile.am (searched_file_test): New test.
1791         * testsuite/Makefile.in: Regenerate.
1792         * testsuite/searched_file_test.cc: New file.
1793         * testsuite/searched_file_test_lib.cc: New file.
1795 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
1796             Ian Lance Taylor  <iant@google.com>
1798         * descriptor.cc: Include <cstdio> and "binary-io.h".
1799         (Descriptors::open): Open the files in binary mode always.
1800         * script.cc (Lex::get_token): Treat \r as whitespace.
1802 2009-10-09  Ian Lance Taylor  <iant@google.com>
1804         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
1806 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
1807             Ian Lance Taylor  <iant@google.com>
1809         * configure.ac: Check for readv function also.
1810         * fileread.cc (readv): Define if not HAVE_READV.
1811         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
1812         does not exist.
1813         * config.in: Regenerate.
1814         * configure: Regenerate.
1816 2009-10-09  Doug Kwan  <dougkwan@google.com>
1818         * layout.cc (Layout::make_output_section): Call target hook to make
1819         ordinary output section.
1820         (Layout::finalize): Adjust parameter list of call the
1821         Target::may_relax().
1822         * layout.h (class Layout::section_list): New method.
1823         * merge.h (Output_merge_base::entsize): Change visibility to public.
1824         (Output_merge_base::is_string, Output_merge_base::do_is_string):
1825         New methods.
1826         (Output_merge_string::do_is_string): New method.
1827         * object.cc (Sized_relobj::do_setup): renamed from
1828         Sized_relobj::set_up.
1829         * object.h (Sized_relobj::adjust_shndx,
1830         Sized_relobj::initializ_input_to_output_maps,
1831         Sized_relobj::free_input_to_output_maps): Change visibilities to
1832         protected.
1833         (Sized_relobj::setup): Virtualize.
1834         (Sized_relobj::do_setup): New method declaration.
1835         (Sized_relobj::invalidate_section_offset,
1836         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
1837         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
1838         * options.cc (parse_int): New function.
1839         * options.h (parse_int): New declaration.
1840         (DEFINE_int): New macro.
1841         (stub_group_size): New option.
1842         * output.cc (Output_section::Output_section): Initialize memebers
1843         merge_section_map_, merge_section_by_properties_map_,
1844         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
1845         (Output_section::add_input_section): Handled deferred code-fill
1846         generation and remove an old comment.
1847         (Output_section::add_relaxed_input_section): New method definition.
1848         (Output_section::add_merge_input_section): Use merge section by
1849         properties map to speed to search.  Update merge section maps
1850         as appropriate.
1851         (Output_section::build_relaxation_map): New method definition.
1852         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
1853         Same.
1854         (Output_section::relax_input_section): Renamed to
1855         Output_section::convert_input_sections_to_relaxed_sections and change
1856         interface to take a vector of pointers to relaxed sections.
1857         (Output_section::find_merge_section,
1858         Output_section::find_relaxed_input_section): New method definitions.
1859         (Output_section::is_input_address_mapped,
1860         Output_section::output_offset, Output_section::output_address):
1861         Use output section data maps to speed up searching.
1862         (Output_section::find_starting_output_address): Add comments.
1863         (Output_section::do_write,
1864         Output_section::write_to_postprocessing_buffer): Do code-fill
1865         generation as appropriate.
1866         (Output_section::get_input_sections): Invalidate relaxed input section
1867         map.
1868         (Output_section::restore_states): Adjust type of checkpoint .
1869         Invalidate relaxed input section map.
1870         * output.h (Output_merge_base): New class declaration.
1871         (Input_section_specifier): New class defintion.
1872         (class Output_relaxed_input_section) Change base class to
1873         Output_section_data_build.
1874         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
1875         base class initializer.
1876         (Output_section::add_relaxed_input_section): New method declaration.
1877         (Output_section::Input_section): Change visibility to protected.
1878         (Output_section::Input_section::relobj,
1879         Output_section::Input_section::shndx): Handle relaxed input sections.
1880         Output_section::input_sections) Change visibility to protected.  Also
1881         define overload to return a non-const pointer.
1882         (Output_section::Merge_section_properties): New class defintion.
1883         (Output_section::Merge_section_by_properties_map,
1884         Output_section::Output_section_data_by_input_section_map,
1885         Output_section::Relaxation_map): New types.
1886         (Output_section::relax_input_section): Rename method to
1887         Output_section::convert_input_sections_to_relaxed_sections and change
1888         interface to take a vector of relaxed section pointers.
1889         (Output_section::find_merge_section,
1890         Output_section::find_relaxed_input_section,
1891         Output_section::build_relaxation_map,
1892         Output_section::convert_input_sections_in_list_to_relaxed_sections):
1893         New method declarations.
1894         (Output_section::merge_section_map_
1895         Output_section::merge_section_by_properties_map_,
1896         Output_section::relaxed_input_section_map_,
1897         Output_section::is_relaxed_input_section_map_valid_,
1898         Output_section::generate_code_fills_at_write_): New data members.
1899         * script-sections.cc
1900         (Output_section_element_input::set_section_addresses): Call
1901         current_data_size and addralign methods of relaxed input sections.
1902         (Orphan_output_section::set_section_addresses): Call current_data_size
1903         and addralign methods of relaxed input sections.
1904         * symtab.cc (Symbol_table::compute_final_value): Extract template
1905         from the body of Symbol_table::sized_finalize_symbol.
1906         (Symbol_table::sized_finalized_symbol): Call
1907         Symbol_table::compute_final_value.
1908         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
1909         (Symbol_table::compute_final_value): New templated method declaration.
1910         * target.cc (Target::do_make_output_section): New method defintion.
1911         * target.h (Target::make_output_section): New method declaration.
1912         (Target::relax): Add more parameters for input objects, symbol table
1913         and layout.  Adjust call to do_relax.
1914         (Target::do_make_output_section): New method declaration.
1915         (Target::do_relax): Add parameters for input objects, symbol table
1916         and layout.
1918 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
1920         * pread.c: Include stdio.h.
1922 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
1924         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
1925         defined.
1927 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
1929         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1930         Change read_shndx type to unsigned int.
1931         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1932         int.
1933         (Sized_dwarf_line_info::read_line_mappings): Likewise.
1934         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
1935         Change read_shndx type to unsigned int.
1936         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
1937         int.
1938         (Sized_dwarf_line_info::read_line_mappings): Likewise.
1939         * layout.cc (Layout::create_symtab_sections): Cast the result of
1940         local_symcount * symsize to off_t in the gold_assert.
1942 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1944         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
1945         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
1946         R_ARM_BASE_ABS.
1947         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
1948         (Arm_relocate_functions::thm_abs5): New function.
1949         (Arm_relocate_functions::abs12): New function.
1950         (Arm_relocate_functions::abs16): New function.
1951         (Arm_relocate_functions::base_abs): New function.
1952         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
1953         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
1954         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
1955         R_ARM_BASE_ABS.
1956         (Scan::global): Likewise.
1957         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
1958         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
1959         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
1960         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
1961         R_ARM_BASE_ABS.
1963 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1965         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
1966         (Arm_relocate_functions::movt_prel): New function.
1967         (Arm_relocate_functions::thm_movw_prel_nc): New function.
1968         (Arm_relocate_functions::thm_movt_prel): New function.
1969         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
1970         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
1971         (Scan::global, Relocate::relocate): Likewise.
1972         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1974 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
1976         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
1977         Incremental_checker.
1978         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
1979         unsigned int.
1980         (class Incremental_inputs_header): New class.
1981         (Incremental_inputs_header_writer): Edit comment.
1982         (Incremental_inputs_entry): New class.
1983         (Incremental_inputs_entry_writer): Edit comment.
1984         (Sized_incremental_binary::do_find_incremental_inputs_section):
1985         Add *strtab_shndx parameter, fill it.
1986         (Sized_incremental_binary::do_check_inputs): New method.
1987         (Incremental_checker::can_incrementally_link_output_file): Use
1988         Sized_incremental_binary::check_inputs.
1989         (Incremental_inputs::report_command_line): Save command line in
1990         command_line_.
1991         * incremental.h:
1992         (Incremental_binary::find_incremental_inputs_section): New
1993         method.
1994         (Incremental_binary::do_find_incremental_inputs_section): Add
1995         strtab_shndx parameter.
1996         (Incremental_binary::do_check_inputs): New pure virtual method.
1997         (Sized_incremental_binary::do_check_inputs): Declare.
1998         (Incremental_checker::Incremental_checker): Add incremental_inputs
1999         parameter, use it to initialize incremental_inputs_.
2000         (Incremental_checker::incremental_inputs_): New field.
2001         (Incremental_checker::command_line): New method.
2002         (Incremental_checker::inputs): New method.
2003         (Incremental_checker::command_line_): New field.
2005 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
2007         * incremental.cc: Include <cstdarg> and "target-select.h".
2008         (vexplain_no_incremental): New function.
2009         (explain_no_incremental): New function.
2010         (Incremental_binary::error): New method.
2011         (Sized_incremental_binary::do_find_incremental_inputs_section): New
2012         method.
2013         (make_sized_incremental_binary): New function.
2014         (open_incremental_binary): New function.
2015         (can_incrementally_link_file): Add checks if output is ELF and has
2016         inputs section.
2017         * incremental.h: Include "elfcpp_file.h" and "output.h".
2018         (Incremental_binary): New class.
2019         (Sized_incremental_binary): New class.
2020         (open_incremental_binary): Declare.
2021         * object.cc (is_elf_object): Use
2022         elfcpp::Elf_recognizer::is_elf_file.
2023         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
2024         * output.h (Output_file::filesize): New method.
2026 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2028         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
2029         New function.
2030         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
2031         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
2032         function.
2033         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
2034         function.
2035         (Arm_relocate_functions::movw_abs_nc): New function.
2036         (Arm_relocate_functions::movt_abs): New function.
2037         (Arm_relocate_functions::thm_movw_abs_nc): New function.
2038         (Arm_relocate_functions::thm_movt_abs): New function.
2039         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
2040         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
2041         (Scan::global): Likewise.
2042         (Relocate::relocate): Likewise.
2043         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2045 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2047         * arm.cc (Arm_relocate_functions::got_prel) New function.
2048         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
2049         (Relocate::relocate): Likewise.
2050         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2052 2009-10-06  Ian Lance Taylor  <iant@google.com>
2054         * options.h (class General_options): Define
2055         split_stack_adjust_size parameter.
2056         * object.h (class Object): Add uses_split_stack_ and
2057         has_no_split_stack_ fields.  Add uses_split_stack and
2058         has_no_split_stack accessor functions.  Declare
2059         handle_split_stack_section.
2060         (class Reloc_symbol_changes): Define.
2061         (class Sized_relobj): Define Function_offsets.  Declare
2062         split_stack_adjust, split_stack_adjust_reltype, and
2063         find_functions.
2064         * object.cc (Object::handle_split_stack_section): New function.
2065         (Sized_relobj::do_layout): Call handle_split_stack_section.
2066         * dynobj.cc (Sized_dynobj::do_layout): Call
2067         handle_split_stack_section.
2068         * reloc.cc (Sized_relobj::relocate_sections): Call
2069         split_stack_adjust for executable sections in split_stack
2070         objects.  Pass reloc_map to relocate_section.
2071         (Sized_relobj::split_stack_adjust): New function.
2072         (Sized_relobj::split_stack_adjust_reltype): New function.
2073         (Sized_relobj::find_functions): New function.
2074         * target-reloc.h: Include "object.h".
2075         (relocate_section): Add reloc_symbol_changes parameter.  Change
2076         all callers.
2077         * target.h (class Target): Add calls_non_split method.  Declare
2078         do_calls_non_split virtual method.  Declare match_view and
2079         set_view_to_nop.
2080         * target.cc: Include "elfcpp.h".
2081         (Target::do_calls_non_split): New function.
2082         (Target::match_view): New function.
2083         (Target::set_view_to_nop): New function.
2084         * gold.cc (queue_middle_tasks): Give an error if mixing
2085         split-stack and non-split-stack objects with -r.
2086         * i386.cc (Target_i386::relocate_section): Add
2087         reloc_symbol_changes parameter.
2088         (Target_i386::do_calls_non_split): New function.
2089         * x86_64.cc (Target_x86_64::relocate_section): Add
2090         reloc_symbol_changes parameter.
2091         (Target_x86_64::do_calls_non_split): New function.
2092         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
2093         parameter.
2094         * powerpc.cc (Target_powerpc::relocate_section): Add
2095         reloc_symbol_changes parameter.
2096         * sparc.cc (Target_sparc::relocate_section): Add
2097         reloc_symbol_changes parameter.
2098         * configure.ac: Call AM_CONDITIONAL for the default target.
2099         * configure: Rebuild.
2100         * testsuite/Makefile.am (TEST_AS): New variable.
2101         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
2102         (check_DATA): Add split_i386 and split_x86_64 files.
2103         (SPLIT_DEFSYMS): Define.
2104         (split_i386_[1234n].o): New targets.
2105         (split_i386_[124]): New targets.
2106         (split_i386_[1234r].stdout): New targets.
2107         (split_x86_64_[1234n].o): New targets.
2108         (split_x86_64_[124]): New targets.
2109         (split_x86_64_[1234r].stdout): New targets.
2110         (MOSTLYCLEANFILES): Add new executables.
2111         * testsuite/split_i386.sh: New file.
2112         * testsuite/split_x86_64.sh: New file.
2113         * testsuite/split_i386_1.s: New file.
2114         * testsuite/split_i386_2.s: New file.
2115         * testsuite/split_i386_3.s: New file.
2116         * testsuite/split_i386_4.s: New file.
2117         * testsuite/split_i386_n.s: New file.
2118         * testsuite/split_x86_64_1.s: New file.
2119         * testsuite/split_x86_64_2.s: New file.
2120         * testsuite/split_x86_64_3.s: New file.
2121         * testsuite/split_x86_64_4.s: New file.
2122         * testsuite/split_x86_64_n.s: New file.
2123         * testsuite/testfile.cc (Target_test): Update relocation_section
2124         function.
2125         * testsuite/Makefile.in: Rebuild.
2127 2009-10-06  Ian Lance Taylor  <iant@google.com>
2129         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
2130         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
2131         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
2132         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
2133         the address on ldo_addrs_.
2134         (Target_i386::Relocate::fix_up_ldo): New function.
2136 2009-10-06   Rafael Espindola  <espindola@google.com>
2138         * plugin.cc (add_input_library): New.
2139         (Plugin::load): Add add_input_library to tv.
2140         (Plugin_manager::add_input_file): Add the is_lib argument.
2141         (add_input_file): Update call to Plugin_manager::add_input_file.
2142         (add_input_library): New.
2143         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2145 2009-09-30  Doug Kwan  <dougkwan@google.com>
2147         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
2148         symbol and call Symbol::may_need_copy_reloc to determine if
2149         a copy reloc is needed.
2150         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
2151         nocopyreloc is given in command line.
2152         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
2153         given in command line.
2154         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
2155         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
2156         of the removed Target_i386::may_need_copy_reloc.
2157         * options.h (copyreloc): New option with default value false.
2158         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2159         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
2160         instead of the removed Target_powerpc::may_need_copy_reloc.
2161         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
2162         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
2163         instead of the removed Target_sparc::may_need_copy_reloc.
2164         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
2165         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
2166         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
2167         instead of the removed Target_x86_64::may_need_copy_reloc.
2169 2009-09-30  Ian Lance Taylor  <iant@google.com>
2171         * object.h (class Object): Remove target_ field, and target,
2172         sized_target, and set_target methods.
2173         (Object::sized_target): Remove.
2174         (class Sized_relobj): Update declarations.  Remove sized_target.
2175         * object.cc (Sized_relobj::setup): Remove target parameter.
2176         Change all callers.
2177         (Input_objects::add_object): Don't do anything with the target.
2178         (make_elf_sized_object): Add punconfigured parameter.  Change all
2179         callers.  Set or test parameter target.
2180         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
2181         Change all callers.
2182         * parameters.cc (Parameters::set_target): Change parameter type to
2183         be non-const.
2184         (Parameters::default_target): Remove.
2185         (set_parameters_target): Change parameter type to be non-const.
2186         (parameters_force_valid_target): New function.
2187         (parameters_clear_target): New function.
2188         * parameters.h (class Parameters): Update declarations.  Remove
2189         default_target method.  Add sized_target and clear_target
2190         methods.  Change target_ to be non-const.
2191         (set_parameters_target): Update declaration.
2192         (parameters_force_valid_target): Declare.
2193         (parameters_clear_target): Declare.
2194         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
2195         as NULL if we aren't searching.
2196         (Add_symbols::run): Don't check for compatible target.
2197         * fileread.cc (Input_file::open_binary): Call
2198         parameters_force_valid_target.
2199         * gold.cc (queue_middle_tasks): Likewise.
2200         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
2201         set_target on object.
2202         * dynobj.h (class Sized_dynobj): Update declarations.
2203         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
2204         make_elf_object returns NULL.
2205         (Archive::include_member): Don't check whether object target is
2206         compatible.
2207         * output.cc (Output_section::add_input_section): Get target from
2208         parameters.
2209         (Output_section::relax_input_section): Likewise.
2210         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
2211         parameters.
2212         (Sized_relobj::do_scan_relocs): Likewise.
2213         (Sized_relobj::relocate_sections): Likewise.
2214         * resolve.cc (Symbol_table::resolve): Likewise.
2215         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
2216         parameter.  Change all callers.
2217         (Symbol_table::add_from_object): Get target from parameters.
2218         (Symbol_table::add_from_relobj): Don't check object target.
2219         (Symbol_table::add_from_dynobj): Likewise.
2220         (Symbol_table::define_special_symbol): Get target from
2221         parameters.
2222         * symtab.h (class Symbol_table): Update declaration.
2223         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
2224         parameter.  Change all callers.  Clear parameter target.
2225         (Binary_test): Test target here.
2226         * testsuite/object_unittest.cc (gold_testsuite): Remove
2227         target_test_pointer parameter.  Change all callers.
2228         (Object_test): Test target here.
2230 2009-09-26  Ian Lance Taylor  <iant@google.com>
2232         * testsuite/initpri1.c: Don't try to use constructor priorities if
2233         compiling with gcc before 4.3.
2235 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
2237         * testsuite/retain_symbols_file_test.sh (check_present): Change
2238         output file name to retain_symbols_file_test.stdout.
2239         (check_absent): Likewise.
2241 2009-09-18  Craig Silverstein  <csilvers@google.com>
2243         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
2244         * options.cc: Include <cerrno> and <fstream>.
2245         (General_options::finalize): Parse -retain-symbols-file tag.
2246         * options.h: New flag.
2247         (General_options): New method should_retain_symbol, new
2248         variable symbols_to_retain.
2249         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
2250         should_retain_symbol map.
2251         * testsuite/Makefile.am (retain_symbols_file_test): New test.
2252         * testsuite/Makefile.in: Regenerate.
2253         * testsuite/retain_symbols_file_test.sh: New file.
2255 2009-09-18  Nick Clifton  <nickc@redhat.com>
2257         * po/es.po: Updated Spanish translation.
2259 2009-09-17  Doug Kwan  <dougkwan@google.com>
2261         * debug.h (DEBUG_RELAXATION): New constant.
2262         (DEBUG_ALL): Add DEBUG_RELAXATION.
2263         (debug_string_to_enum): Add relaxation debug option.
2264         * layout.cc
2265         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
2266         Layout::Relaxation_debug_check::read_sections,
2267         Layout::Relaxation_debug_check::read_sections): New method definitions.
2268         (Layout::Layout): Initialize data members
2269         record_output_section_data_from_scrips_,
2270         script_output_section_data_list_ and relaxation_debug_check_.
2271         (Layout::save_segments, Layout::restore_segments,
2272         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2273         Layout::relaxation_loop_body): New method definitions.
2274         (Layout::finalize): Support relaxation.  Move section layout code to
2275         Layout::relaxation_loop_body.
2276         (Layout::set_asection_address_from_script): Move code for orphan
2277         section placement out.
2278         (Layout::place_orphan_sections_in_script): New method definition.
2279         * layout.h (Output_segment_headers, Output_file_header):
2280         New forward class declarations.
2281         (Layout::~Layout): Define.
2282         (Layout::new_output_section_data_from_script): New method definition.
2283         (Layout::place_orphan_sections_in_script): New method declaration.
2284         (Layout::Segment_states): New type declaration.
2285         (Layout::save_segments, Layout::restore_segments,
2286         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
2287         Layout::relaxation_loop_body): New method declarations.
2288         (Layout::Output_section_data_list): New type declaration.
2289         (Layout::Relaxation_debug_check): New class definition.
2290         (Layout::record_output_section_data_from_script_,
2291         Layout::script_output_section_data_list_, Layout::segment_states_,
2292         Layout::relaxation_debug_check_): New data members.
2293         * output.cc: (Output_section_headers::do_size): New method definition.
2294         (Output_section_headers::Output_section_headers): Move size
2295         computation to Output_section_headers::do_size.
2296         (Output_segment_headers::do_size): New method definition.
2297         (Output_file_header::Output_file_header): Move size computation to 
2298         Output_file_header::do_size and call it.
2299         (Output_file_header::do_size): New method definition.
2300         (Output_data_group::Output_data_group): Adjust call to
2301         Output_section_data.
2302         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
2303         (Output_symtab_xindex::do_write): Add array bound check.
2304         (Output_section::Input_section::print_to_mapfile): Handle
2305         RELAXED_INPUT_SECTION_CODE.
2306         (Output_section::Output_section): Initialize data member checkpoint_.
2307         (Output_section::~Output_section): Delete checkpoint object pointed
2308         by checkpoint_.
2309         (Output_section::add_input_section): Always add an Input_section if
2310         relaxing.
2311         (Output_section::add_merge_input_section): Add assert.
2312         (Output_section::relax_input_section): New method definition.
2313         (Output_section::set_final_data_size): Set load address to zero for
2314         an unallocated section.
2315         (Output_section::do_address_and_file_offset_have_reset_values):
2316         New method definition.
2317         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
2318         Handle relaxed input section.
2319         (Output_section::sort_attached_input_sections): Checkpoint input
2320         section list lazily.
2321         (Output_section::get_input_sections): Change type of input_sections to
2322         list of Simple_input_section pointers.  Checkpoint input section list
2323         lazily.  Also handle relaxed input sections.
2324         (Output_section::add_input_section_for_script): Take a reference to
2325         a Simple_input_section object instead of Relobj pointer and section
2326         index as parameter.  Handle relaxed input sections.
2327         (Output_section::save_states, Output_section::restore_states): New
2328         method definitions.
2329         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
2330         (Output_data::is_data_size_fixed): New method definition.
2331         (Output_data::reset_addresss_and_file_offset): Do not reset data size
2332         if it is fixed.
2333         (Output_data::address_and_file_offset_have_reset_values): New method
2334         definition.
2335         (Output_data::do_address_and_file_offset_have_reset_values): New method
2336         definition.
2337         (Output_data::set_data_size): Check that data size is not fixed.
2338         (Output_data::fix_data_size): New method definition.
2339         (Output_data::is_data_size_fixed_): New data member.
2340         (Output_section_headers::set_final_data_size): New method definition.
2341         (Output_section_headers::do_size): New method declaration.
2342         (Output_segment_headers::set_final_data_size): New method definition.
2343         (Output_segment_headers::do_size): New method declaration.
2344         (Output_file_header::set_final_data_size)::New method definition.
2345         (Output_file_header::do_size)::New method declaration.
2346         (Output_section_data::Output_section_data): Add new parameter
2347         is_data_size_fixed and use it to fix data size.
2348         (Output_data_const::Output_data_const): Adjust call to base class
2349         constructor and fix data size.
2350         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
2351         base class constructor and fix data size.
2352         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
2353         base class constructor and fix data size.
2354         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
2355         class constructor and fix data size.
2356         (Output_data_group::set_final_data_size): New method definition.
2357         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
2358         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
2359         class constructor and fix data size.
2360         (Output_relaxed_input_section): New class definition.
2361         (Output_section::Simple_input_section): New class definition.
2362         (Output_section::get_input_sections): Adjust parameter list.
2363         (Output_section::add_input_section_for_script): Same.
2364         (Output_section::save_states, Output_section::restore_states,
2365         Output_section::do_address_and_file_offset_have_reset_values,
2366         (Output_section::Input_section::Input_section): Handle
2367         RELAXED_INPUT_SECTION_CODE.  Add new overload for
2368         Output_relaxed_input_section.
2369         (Output_section::Input_section::is_input_section,
2370         Output_section::Input_section::set_output_section): Handle relaxed
2371         input section.
2372         (Output_section::Input_section::is_relaxed_input_section,
2373         Output_section::Input_section::output_section_data,
2374         Output_section::Input_section::relaxed_input_section): New method
2375         definitions.
2376         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
2377         value.
2378         (Output_section::Input_section::u1_): Update comments.
2379         (Output_section::Input_section::u2_): Add new union member poris.
2380         (Output_section::Checkpoint_output_section): New classs definition.
2381         (Output_section::relax_input_section): New method declaration.
2382         (Output_section::checkpoint_): New data member.
2383         (Output_segment): Update comments.
2384         (Output_segment::Output_segment): Un-privatize copy constructor.
2385         (Output_segment::operator=): Un-privatize.
2386         * script-sections.cc (Output_section_element::Input_section_list):
2387         Change element type to Output_section::Simple_input_section.
2388         (Output_section_element_dot_assignment::set_section_addresses):
2389         Register output section data for relaxation clean up.
2390         (Output_data_exression::Output_data_expression): Adjust call to base
2391         constructor to fix data size.
2392         (Output_section_element_data::set_section_addresses): Register
2393         Output_data_expression object for relaxation clean up.
2394         (struct Input_section_info): Replace Relobj pointer and section index
2395         pair with Output_section::Simple_input_section and Convert struct to a
2396         class.
2397         (Input_section_sorter::operator()): Adjust access to
2398         Input_section_info data member to use accessors. 
2399         (Output_section_element_input::set_section_addresses): Use layout
2400         parameter.  Adjust code to use Output_section::Simple_input_section
2401         and Input_secction_info classes.  Register filler for relaxation
2402         clean up.
2403         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
2404         and section index pair with Output_section::Simple_input_section
2405         class.  Adjust code accordingly.
2406         (Phdrs_element::release_segment): New method definition.
2407         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
2408         segment list.
2409         (Script_sections::release_segments): New method definition.
2410         * gold/script-sections.h (Script_sections::release_segments): New
2411         method declaration.
2412         * gold/target.h (Target::may_relax, Target::relax,
2413         Target::do_may_relax, Target::do_relax): New method definitions.
2415 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2417         * arm.cc (has_signed_unsigned_overflow): New function.
2418         (Arm_relocate_functions::abs8): New function.
2419         (Target_arm::Scan::local): Handle R_ARM_ABS8.
2420         (Target_arm::Scan::global): Likewise.
2421         (Target_arm::relocate::relocate): Likewise.
2422         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2423         Likewise.
2425 2009-09-16  Cary Coutant  <ccoutant@google.com>
2427         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
2428         * testsuite/Makefile.in: Regenerate.
2430 2009-09-11  Nick Clifton  <nickc@redhat.com>
2432         * po/gold.pot: Updated by the Translation project.
2434 2009-09-08  Cary Coutant  <ccoutant@google.com>
2436         * output.cc (Output_file::open): Add execute permission to empty file.
2437         * testsuite/Makefile.am (permission_test): New test.
2438         * testsuite/Makefile.in: Regenerate.
2440 2009-09-02  Ian Lance Taylor  <iant@google.com>
2442         * output.cc (Output_file::resize): Call map_no_anonymous rather
2443         than map.
2445 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
2447         * gold.cc: Include "incremental.h".
2448         (queue_initial_tasks): Call Incremental_checker methods.
2449         * incremental.cc: Include "output.h".
2450         (Incremental_checker::can_incrementally_link_output_file): New
2451         method.
2452         * incremental.h (Incremental_checker): New class.
2454         * output.cc (Output_file::open_for_modification): New method.
2455         (Output_file::map_anonymous): Changed return type to bool.  Record
2456         map in base_ field.
2457         (Output_file::map_no_anonymous): New method, broken out of map.
2458         (Output_file::map): Use map_no_anonymous and map_anonymous.
2459         * output.h (class Output_file): Update declarations.
2461 2009-08-24  Cary Coutant  <ccoutant@google.com>
2463         * options.h (Command_line::Pre_options): New class.
2464         (Command_line::pre_options): New member.
2465         * options.cc (gold::options::ready_to_register): New variable.
2466         (One_option::register_option): Do nothing if not registering options.
2467         Assert if same short option registered twice.
2468         (General_options::General_options): Turn off option registration when
2469         done constructing.
2470         (Command_line::Pre_options::Pre_options): New constructor.
2472 2009-08-24  Cary Coutant  <ccoutant@google.com>
2474         * options.h (General_options::no_keep_memory): Remove incorrect
2475         short option.
2477 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2479         * Makefile.am (am__skiplex, am__skipyacc): New.
2480         * Makefile.in: Regenerate.
2482 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
2484         * Makefile.am (AM_CPPFLAGS): Renamed from ...
2485         (INCLUDES): ... this.
2486         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
2487         (AM_CPPFLAGS): Renamed from ...
2488         (INCLUDE): ... this.
2489         * Makefile.in, testsuite/Makefile.in: Regenerate.
2491         * Makefile.in: Regenerate.
2492         * aclocal.m4: Likewise.
2493         * config.in: Likewise.
2494         * configure: Likewise.
2495         * testsuite/Makefile.in: Likewise.
2497         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2498         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
2499         * Makefile.in: Regenerate.
2500         * testsuite/Makefile.in: Regenerate.
2502 2009-08-19  Cary Coutant  <ccoutant@google.com>
2504         * resolve.cc (Symbol_table::resolve): Don't complain about defined
2505         symbols in shared libraries overridden by hidden or internal symbols
2506         in the main program.
2508 2009-08-19  Chris Demetriou  <cgd@google.com>
2510         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
2511         checking source file names in error messages.
2513 2009-08-18  Doug Kwan  <dougkwan@google.com>
2515         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
2516         an elcpp::Ehdr as parameter.  Adjust call to set_target.
2517         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
2518         an elfcpp::Ehdr as parameter.
2519         * object.cc (Object::set_target): Remove the version that looks up
2520         a target and sets it.
2521         (Sized_relobj::setup): Take a Target object instead of
2522         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
2523         (make_elf_sized_object): Find target and ask target to
2524         make an ELF object.
2525         * object.h: (Object::set_target): Remove the version that looks up
2526         a target and sets it.
2527         (Sized_relobj::setup): Take a Target object instead of
2528         an elfcpp:Ehdr as parameter.
2529         * target.cc: Include dynobj.h.
2530         (Target::do_make_elf_object_implementation): New.
2531         (Target::do_make_elf_object): New.
2532         * target.h (Target::make_elf_object): New template declaration.
2533         (Target::do_make_elf_object): New method declarations.
2534         (Target::do_make_elf_object_implementation): New template declaration.
2536 2009-08-14  Ian Lance Taylor  <iant@google.com>
2538         * gold.h (FUNCTION_NAME): Define.
2539         (gold_unreachable): Use FUNCTION_NAME.
2541 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
2543         * icf.cc (Icf::find_identical_sections): Issue a warning when a
2544         symbol in the --keep-unique list is not found.
2546 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
2548         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
2549         been maked as --keep-unique.
2550         (Icf::unfold_section): New function.
2551         * icf.h (Icf::unfold_section): New function.
2552         * options.h (General_options::keep_unique): New option.
2553         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
2554         * testsuite/Makefile.in: Regenerate.
2555         * testsuite/icf_keep_unique_test.sh: New file.
2556         * testsuite/icf_keep_unique_test.cc: New file.
2558 2009-08-12  Cary Coutant  <ccoutant@google.com>
2560         PR 10471
2561         * resolve.cc (Symbol_table::resolve): Check for references from
2562         dynamic objects to hidden and internal symbols.
2563         * testsuite/Makefile.am (hidden_test.sh): New test.
2564         * testsuite/Makefile.in: Regenerate.
2565         * testsuite/hidden_test.sh: New script.
2566         * testsuite/hidden_test_1.c: New test source.
2567         * testsuite/hidden_test_main.c: New test source.
2569 2009-08-11  Doug Kwan  <dougkwan@google.com>
2571         * arm.cc: Update comments.
2572         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
2573         segment to locate the .ARM.exidx section if present.
2575 2009-08-09  Doug Kwan  <dougkwan@google.com>
2577         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
2578         patch.
2580 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
2581         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
2582         compiler warnings.
2584 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
2586         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
2587         valid tls_segment only for non-debug-section relocations.
2588         * testsuite/Makefile.am: Add gc_tls_test.
2589         * testsuite/Makefile.in: Regenerate.
2590         * testsuite/gc_tls_test.cc: New file.
2591         * testsuite/gc_tls_test.sh: New file.
2593 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
2594         
2595         * icf.cc: New file.
2596         * icf.h: New file.
2597         * Makefile.am (CCFILES): Add icf.cc.
2598         (HFILES): Add icf.h
2599         * Makefile.in: Regenerate.
2600         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
2601         * gc.h (gc_process_relocs): Populate lists used by icf to contain
2602         section, symbol and addend information for the relocs.
2603         * gold.cc (queue_middle_tasks): Call identical code folding.
2604         * gold.h: Add defines for multimap.
2605         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
2606         to the call of finalize_local_symbols.
2607         * main.cc (main): Create object of class Icf.
2608         * object.cc (Sized_relobj::do_layout): Allow this function to be
2609         called twice during icf.
2610         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
2611         to sections marked as identical by icf.
2612         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
2613         when available.
2614         (Sized_relobj::do_section_entsize): New function.
2615         * object.h (Object::section_entsize): New function.
2616         (Object::do_section_entsize): New pure virtual function.
2617         (Relobj::finalize_local_symbols): Add new parameter.
2618         (Relobj::do_section_entsize): New function.
2619         * options.h (General_options::icf): New option.
2620         (General_options::icf_iterations): New option.
2621         (General_options::print_icf_sections): New option.
2622         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
2623         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
2624         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
2625         icf.
2626         * symtab.cc (Symbol_table::is_section_folded): New function.
2627         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
2628         to sections marked as identical by icf.
2629         * symtab.h (Symbol_table::set_icf): New function.
2630         (Symbol_table::icf): New function.
2631         (Symbol_table::is_section_folded): New function.
2632         (Symbol_table::icf_): New data member.
2633         * target-reloc.h (relocate_section): Ignore sections folded by icf.
2634         * testsuite/Makefile.am: Add commands to build icf_test.
2635         * testsuite/Makefile.in: Regenerate.
2636         * testsuite/icf_test.sh: New file.
2637         * testsuite/icf_test.cc: New file.
2639 2009-07-24  Chris Demetriou  <cgd@google.com>
2641         * layout.cc (is_compressible_debug_section): Fix incorrect
2642         comment about compressed section names.
2644 2009-07-20  Ian Lance Taylor  <ian@airs.com>
2646         PR 10419
2647         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2649 2009-07-16  Ian Lance Taylor  <iant@google.com>
2651         PR 10400
2652         * layout.h: #include <map>.
2653         (class Kept_section): Change from struct to class.  Add accessors
2654         and setters.  Add section size to Comdat_group mapping.  Change
2655         Comdat_group to std::map.  Add is_comdat_ field.  Add
2656         linkonce_size field in union.
2657         (class Layout): Update declaration of find_or_add_kept_section.
2658         Don't declare find_kept_object.
2659         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
2660         parameter.  Add object, shndx, is_comdat, and is_group_name
2661         parameters.  Change all callers.  Adjust for new Kept_section.
2662         (Layout::find_kept_object): Remove.
2663         * object.cc (Sized_relobj::include_section_group): Update use of
2664         Kept_section.  Rename secnum to shndx.  Only record
2665         Kept_comdat_section if sections are the same size.
2666         (Sized_relobj::include_linkonce_section): Update use of
2667         Kept_section.  Only record Kept_comdat_section if sections are the
2668         same size.  Set size of linkonce section.
2669         (Sized_relobj::map_to_kept_section): Update call to
2670         get_kept_comdat_section.
2671         * object.h (class Sized_relobj): Rename fields in
2672         Kept_comdat_section to drop trailing underscores; change object
2673         field to Relobj*.  Change Kept_comdat_section_table to store
2674         struct rather than pointer.
2675         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
2676         Add kept_object and kept_shndx parameters.  Change all callers.
2677         (Sized_relobj::get_kept_comdat_section): Change return type to
2678         bool.  Add kept_object and kept_shndx parameters.  Change all
2679         callers.
2680         * plugin.cc (Pluginobj::include_comdat_group): Update call to
2681         Layout::find_or_add_kept_section.
2683 2009-07-09  Ian Lance Taylor  <iant@google.com>
2685         * merge.cc (Object_merge_map::initialize_input_to_output_map):
2686         Reserve space in the hash table.
2688 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
2690         * fileread.cc (File_read::get_mtime): New method.
2691         * fileread.h (Timespec): New structure.
2692         (File_read::get_mtime): New method.
2693         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
2694         Renamed from timestamp_nsec.
2695         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
2696         Elf_Xword.
2697         (Incremental_inputs_entry_write::timestamp_usec): Renamed from 
2698         timestamp_nsec.
2699         (Incremental_inputs::report_archive): Save mtime; style fix. 
2700         (Incremental_inputs::report_obejct): Save mtime; style fix.
2701         (Incremental_inputs::report_script): Save mtime; style fix.
2702         (Incremental_inputs::finalize_inputs): Style fix.
2703         (Incremental_inputs::finalize): Style fix.
2704         (Incremental_inputs::create_input_section_data): Store inputs
2705         mtime.
2706         * incremental.h (Incremental_inputs::report_script): Add mtime
2707         argument.
2708         (Incremental_inputs::Input_info::Input_info): Intialize only one
2709         union member.
2710         (Incremental_inputs::Input_info::archive): Move to nameless
2711         union.
2712         (Incremental_inputs::Input_info::obejct): Move to nameless union.
2713         (Incremental_inputs::Input_info::script): Move to nameless union.
2714         (Incremental_inputs::mtime): New field.
2715         * script.cc (read_input_script): Pass file mtime to
2716         Incremental_input.
2717         * script.h (Script_info::inputs): Style fix.
2719 2009-07-01  Ian Lance Taylor  <ian@airs.com>
2721         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
2722         instead of 32.
2724 2009-06-24  Ian Lance Taylor  <iant@google.com>
2726         PR 10156
2727         * layout.cc (Layout::choose_output_section): If we find an
2728         existing section, update the flags.
2729         (Layout::create_notes): New function, broken out of
2730         Layout::finalize.
2731         (Layout::finalize): Don't create note sections.
2732         (Layout::create_note): Don't crash if linker script discards
2733         section.
2734         (Layout::create_gold_note): Likewise.
2735         (Layout::create_build_id): Likewise.  Don't set
2736         after_input_sections on the section.
2737         (Layout::create_executable_stack_info): Remove target parameter.
2738         Change caller.
2739         * layout.h (class Layout): Declare create_notes.  Update
2740         declaration of create_executable_stack_info.
2741         * gold.cc (queue_middle_tasks): Call create_notes.
2742         * output.cc (Output_section::update_flags_for_input_section): Move
2743         here from output.h.  If SHF_ALLOC flag is newly set, mark address
2744         invalid.
2745         * output.h (Output_data::mark_address_invalid): New function.
2746         (class Output_section): Only declare, not define,
2747         update_flags_for_input_section.  Remove set_flags.
2749 2009-06-24  Ian Lance Taylor  <iant@google.com>
2751         * script-sections.cc (Output_section_definition::
2752         set_section_addresses): Rename shadowing local load_address to
2753         laddr.
2755 2009-06-24  Ian Lance Taylor  <iant@google.com>
2757         PR 10244
2758         * reloc.cc (relocate_sections): Skip empty relocation sections.
2760 2009-06-23  Ian Lance Taylor  <iant@google.com>
2762         PR 10156
2763         * layout.cc (Layout::create_note): Use choose_output_section
2764         rather than make_output_section.
2766 2009-06-23  Ian Lance Taylor  <iant@google.com>
2768         PR 10237
2769         * options.cc (General_options::parse_V): Set printed_version_.
2770         (General_options::General_options): Initialize printed_version_.
2771         * options.h (class General_options): Add printed_version_ field.
2772         * gold.cc (queue_initial_tasks): If there are no input files,
2773         don't give a fatal error if we printed the version information.
2774         (queue_middle_tasks): If using -r with a shared object, give a
2775         fatal error rather than an ordinary error.
2777 2009-06-23  Ian Lance Taylor  <iant@google.com>
2779         PR 10219
2780         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
2781         (Layout::make_output_section): Set have_stabstr_section_ if we see
2782         a .stab*str section.
2783         (Layout::finalize): Call link_stabs_sections.
2784         (Layout::link_stabs_sections): New file.
2785         * layout.h (class Layout): Add have_stabstr_section_ field.
2786         Declare link_stabs_sections.
2788 2009-06-23  Doug Kwan  <dougkwan@google.com>
2790         * Makefile.am (libgold_a_LIBADD): New.
2791         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2792         * Makefile.in: Regenerate.
2793         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
2794         * configure: Regenerate.
2795         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
2796         * fileread.cc: Include sys/state.h
2797         * gold.h: Declare memmem and strndup if found missing.
2798         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2800 2009-06-23  Ian Lance Taylor  <iant@google.com>
2802         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
2803         * configure: Rebuild.
2805 2009-06-23  Ian Lance Taylor  <iant@google.com>
2807         PR 10147
2808         * object.cc (Object::section_contents): Don't try to get a view if
2809         the section has length zero.
2810         (Object::handle_gnu_warning_section): If the section is empty, use
2811         the name of the section as the warning.
2813 2009-06-23  Ian Lance Taylor  <iant@google.com>
2815         PR 10133
2816         * stringpool.h (class Stringpool_template): Add optimize_ field.
2817         (Stringpool_template::set_optimize): New function.
2818         * stringpool.cc (Stringpool_template::Stringpool_template):
2819         Initialize optimize_ field.
2820         (Stringpool_template::set_string_offsets): Test local optimize
2821         fild rather than parameter.
2822         * layout.cc (Layout::Layout): Call set_optimize on the section
2823         name stringpool.
2825 2009-06-22  Ian Lance Taylor  <iant@google.com>
2827         PR 10030
2828         * yyscript.y: Parse TARGET.
2829         * script.cc (script_set_target): New function.
2830         * script-c.h (script_set_target): Declare.
2831         * options.cc (General_options::string_to_object_format): Rename
2832         from string_to_object_format in anonymous namespace.  Change
2833         callers.
2834         * options.h (class General_options): Declare
2835         string_to_object_format.
2837 2009-06-22  Ian Lance Taylor  <iant@google.com>
2839         * script-sections.cc (Script_sections::create_segments): Don't put
2840         program headers in a PT_LOAD segment if -n or -N.
2842 2009-06-22  Ian Lance Taylor  <iant@google.com>
2844         PR 10141
2845         * options.h (class General_options): Add -z lazy and -z now.  Sort
2846         -z options into alphabetical order.
2847         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
2849 2009-06-21  Ian Lance Taylor  <iant@google.com>
2851         * layout.cc (Layout::make_output_section): Call
2852         Target::new_output_section.
2853         (Layout::attach_allocated_section_to_segment): Put large section
2854         sections in a separate load segment with the large segment flag
2855         set.
2856         (Layout::segment_precedes): Sort large data segments after other
2857         load segments.
2858         (align_file_offset): New static function.
2859         (Layout::set_segment_offsets): Use align_file_offset.
2860         * output.h (class Output_section): Add is_small_section_ and
2861         is_large_section_ fields.
2862         (Output_section::is_small_section): New function.
2863         (Output_section::set_is_small_section):  New function.
2864         (Output_section::is_large_section): New function.
2865         (Output_section::set_is_large_section): New function.
2866         (Output_section::is_large_data_section): New function.
2867         (class Output_segment): Add is_large_data_segment_ field.
2868         (Output_segment::is_large_data_segment): New function.
2869         (Output_segment::set_is_large_data_segment): New function.
2870         * output.cc (Output_section::Output_section): Initialize new
2871         fields.
2872         (Output_segment::Output_segment): Likewise.
2873         (Output_segment::add_output_section): Add assertion that large
2874         data sections always go in large data segments.  Force small data
2875         sections to the end of the list of data sections.  Force small BSS
2876         sections to the start of the list of BSS sections.  For large BSS
2877         sections to the end of the list of BSS sections.
2878         * symtab.h (class Symbol): Declare is_common_shndx.
2879         (Symbol::is_defined): Check Symbol::is_common_shndx.
2880         (Symbol::is_common): Likewise.
2881         (class Symbol_table): Define enum Commons_section_type.  Update
2882         declarations.  Add small_commons_ and large_commons_ fields.
2883         * symtab.cc (Symbol::is_common_shndx): New function.
2884         (Symbol_table::Symbol_table): Initialize new fields.
2885         (Symbol_table::add_from_object): Put small and large common
2886         symbols in the right list.
2887         (Symbol_table::sized_finalized_symbol): Check
2888         Symbol::is_common_shndx.
2889         (Symbol_table::sized_write_globals): Likewise.
2890         * common.cc (Symbol_table::do_allocate_commons): Allocate new
2891         common symbol lists.  Don't call do_allocate_commons_list if the
2892         list is empty.
2893         (Symbol_table::do_allocate_commons_list): Remove is_tls
2894         parameter.  Add comons_section_type parameter.  Change all
2895         callers.  Handle small and large common symbols.
2896         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
2897         Symbol::is_common_shndx.
2898         * resolve.cc (symbol_to_bits): Likewise.
2899         * target.h (Target::small_common_shndx): New function.
2900         (Target::small_common_section_flags): New function.
2901         (Target::large_common_shndx): New function.
2902         (Target::large_common_section_flags): New function.
2903         (Target::new_output_section): New function.
2904         (Target::Target_info): Add small_common_shndx, large_common_shndx,
2905         small_common_section_flags, and large_common_section_flags
2906         fields.
2907         (Target::do_new_output_section): New virtual function.
2908         * arm.cc (Target_arm::arm_info): Initialize new fields.
2909         * i386.cc (Target_i386::i386_info): Likewise.
2910         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2911         Likewise.
2912         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
2913         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2914         (Target_x86_64::do_new_output_section): New function.
2915         * configure.ac: Define conditional MCMODEL_MEDIUM.
2916         * testsuite/Makefile.am (check_PROGRAMS): Add large.
2917         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
2918         (large_LDFLAGS): Define.
2919         * testsuite/large.c: New file.
2920         * testsuite/testfile.cc (Target_test::test_target_info):
2921         Initialize new fields.
2922         * configure, testsuite/Makefile.in: Rebuild.
2924 2009-06-05  Doug Kwan  <dougkwan@google.com>
2926         * Makefile.am (CCFILES): Add target.cc.
2927         * Makefile.in: Regenerate. 
2928         * i386.cc (class Target_i386): Define new virtual method to
2929         override do_is_local_label_name in parent.
2930         * object.cc (Sized_relobj::do_count_local_symbols): Discard
2931         local symbols if --discard-locals or -X is given.
2932         * options.h (class General_options): Declare new options
2933         '--discard-locals' and '-X' for discarding locals.
2934         * target.h (class Target): Define new methods is_local_label_name.
2935         Declare new virtual method do_is_local_label_name.
2936         * target.cc: New file.
2937         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
2938         (check_SCRIPTS): Add discard_locals_test.sh.
2939         (check_DATA): Add discard_local_tests.syms.
2940         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
2941         (discard_local_tests.syms, discard_locals_test.o): New make rules.
2942         * testsuite/Makefile.in: Regenerate.
2943         * testsuite/discard_locals_test.c: New file.
2944         * testsuite/discard_locals_test.sh: Same.
2946 2009-06-05  Doug Kwan  <dougkwan@google.com>
2948         * object.cc (Sized_relobj::Sized_relobj): Initialize
2949         discarded_eh_frame_shndx_ to -1U.
2950         (Sized_relobj::do_layout): Record index of a discard .eh_frame
2951         section.
2952         (Sized_relobj::do_count_local_symbols): Skip local symbols in
2953         a discarded .eh_frame section.
2954         (Sized_relobj::do_finalize_local_symbols): Ditto.
2955         * object.h (class Sized_relobj): Declare new member
2956         discarded_eh_frame_shndx_.
2957         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
2958         (local_labels_test.o, local_labels_test): New rules.
2959         * testsuite/Makefile.in: Regenerate.
2961 2009-06-04  Doug Kwan  <dougkwan@google.com>
2963         * layout.cc (Layout::section_name_mapping): Add mapping for
2964         special ARM sections.
2966 2009-06-03  Doug Kwan  <dougkwan@google.com>
2968         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
2969         (utils::has_overflow): Same.
2971 2009-06-03  Ian Lance Taylor  <iant@google.com>
2973         * layout.cc (Layout::section_name_mapping): New array, replacing
2974         Layout::linkonce_mapping.
2975         (Layout::section_name_mapping_count): New variable, replacing
2976         Layout::linkonce_mapping_count.
2977         (Layout::linkonce_output_name): Remove.
2978         (Layout::output_section_name): Rewrite.
2979         * layout.h (class Layout): Rename Linkonce_mapping to
2980         Section_name_mapping, linkonce_mapping to section_name_mapping,
2981         linkonce_mapping_count to section_name_mapping_count.  Don't
2982         declare linkonce_output_name.
2984 2009-06-03  Doug Kwan  <dougkwan@google.com>
2986         * gold/arm.cc (namespace utils): New.
2987         (Target_arm::reloc_is_non_pic): Define new method.
2988         (class Arm_relocate_functions): New.
2989         (Target_arm::Relocate::relocate): Handle relocation types used by
2990         Android.
2992 2009-06-03  Ian Lance Taylor  <iant@google.com>
2994         * arm.cc (Target_arm::scan::global): Use || instead of |.
2996 2009-06-02  Doug Kwan  <dougkwan@google.com>
2998         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
2999         issued_non_pic_error_.
3000         (class Target_arm::Scan): Declare new method check_non_pic.
3001         Define new method symbol_needs_plt_entry.
3002         Declare new data member issued_non_pic_error_.
3003         (class Target_arm::Relocate): Declare new method
3004         should_apply_static_reloc.
3005         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
3006         (Target_arm::Scan::check_non_pic): Define new method.
3007         (Target_arm::Scan::local): Handle a small subset of reloc types used
3008         by Android.
3009         (Target_arm::Scan::local): Same.
3010         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
3012 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
3014         * incremental.cc (Incremental_inputs::report_command_line): Filter
3015         out --incremental-* options.
3017 2009-05-29  Doug Kwan  <dougkwan@google.com>
3019         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
3020         template class.
3021         (class Target_arm): Update comment.
3022         (Target_arm::Target_arm): Initialize new data members GOT_,
3023         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
3024         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
3025         and Target_arm::rel_dyn_section.
3026         Declare new_enum Target_arm::Got_type.
3027         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
3028         and DYNBSS_.
3029         Update commments for member do_dynsym_value.
3030         (Target_arm::got_size, Target_arm::plt_section,
3031         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
3032         new methods inside class defintion.
3033         (Target_arm::got_section): Define new method.
3034         (Target_arm::rel_dyn_section): Same.
3035         (Output_data_plt_arm): New template class.
3036         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
3037         (Output_data_plt_arm:do_adjust_output_section): Define new method.
3038         (Output_data_plt_arm::add_entry): Same.
3039         (Output_data_plt_arm::first_plt_entry): Define new
3040         static data member for PLT instruction template.
3041         (Output_data_plt_arm::plt_entry): Same.
3042         (Output_data_plt_arm::do_write): Define new method.
3043         (Target_arm::make_plt_entry): Same.
3044         (Target_arm::do_finalize_sections): Same.
3045         (Target_arm::do_dynsym_value): Same.
3047 2009-05-28  Doug Kwan  <dougkwan@google.com>
3049         * Makefile.am (TARGETSOURCES): Add arm.cc.
3050         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
3051         * Makefile.in: Regenerate.
3052         * arm.cc: New file.
3053         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
3055 2009-05-26  Doug Kwan  <dougkwan@google.com>
3057         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
3058         (General_options::check_excluded_libs): Strip off directories in
3059         archive name before matching like GNU ld does.
3060         * testsuite/Makefile.am (MOSTLYCLEANFILES,
3061         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
3062         (exclude_libs_test_LDFLAGS): Add linker option
3063         -Wl,--exclude-libs,libexclude_libs_test_3
3064         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
3065         an explicit archive without using -l.
3066         (alt/libexclude_libs_test_3.a): New make rule.
3067         * testsuite/Makefile.in: Regenerate.
3068         * testsuite/exclude_libs_test.c : Declare lib3_default().
3069         (main): Call it.
3070         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
3071         * exclude_libs_test_3.c: New file.
3073 2009-05-26  Nick Clifton  <nickc@redhat.com>
3075         * po/id.po: New Indonesian translation.
3076         * po/gold.pot: Updated template file.
3078 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
3080         * testsuite/Makefile.am: Add -ffunction-sections to compile 
3081         gc_comdat_test files.  Add -Wl,--gc-sections to build
3082         gc_comdat_test.
3083         * testsuite/Makefile.in: Regenerate.
3084         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
3086 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
3088         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
3089         kept comdat section was garbage collected.
3090         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
3091         * testsuite/Makefile.in: Regenerate.
3092         * testsuite/gc_comdat_test.sh: New file.
3093         * testsuite/gc_comdat_test_1.cc: New file.
3094         * testsuite/gc_comdat_test_2.cc: New file.
3096 2009-05-19  Doug Kwan  <dougkwan@google.com>
3098         * archive.cc (Archive::Archive): Move constructor from archive.h
3099         to here.  Initialize no_export_.
3100         (Archive::get_elf_object_for_member): Set no_export flag of object.
3101         * archive.h (Archive::Archive): Move constructor body to
3102         archive.cc.
3103         (Archive::no_export): New method.
3104         (Archive::no_export_): New field.
3105         * object.h (Object::Object): Initialize no_export_ to false.
3106         (Object::no_export, Object::set_no_export): New methods.
3107         (Object::no_export_): New field.
3108         * options.cc (General_options::parse_exclude_libs): New method.
3109         (General_options::check_excluded_libs) Same.
3110         * options.h (exclude_libs): New option.
3111         (General_options::check_excluded_libs): New method declaration.
3112         (General_options::excluded_libs_): New field.
3113         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
3114         default or protected visibility if an object has no-export flag set.
3115         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
3116         (check_SCRIPTS): Add exclude_libs_test.sh.
3117         (check_DATA): Add exclude_libs_test.syms.
3118         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
3119         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
3120         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
3121         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
3122         (exclude_libs_test.syms, libexclude_libs_test_1.a,
3123         libexclude_libs_test_2.a): New rules.
3124         * testsuite/Makefile.in: Regenerate.
3125         * testsuite/exclude_libs_test.c: New file.
3126         * testsuite/exclude_libs_test.sh: Ditto.
3127         * testsuite/exclude_libs_test_1.c: Ditto.
3128         * testsuite/exclude_libs_test_2.c: Ditto.
3130 2009-05-15  Ian Lance Taylor  <iant@google.com>
3132         * configure.ac: Check for declarations for cases where libiberty.h
3133         checks HAVE_DECL_xxx.
3134         * configure, config.in: Rebuild.
3136 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
3138         * gold.h (Incremental_argument_list): Remove (invalid) forward
3139         declaration.
3140         * incremental.cc (Incremental_inputs::report_achive): New method.
3141         (Incremental_inputs::report_object): New method.
3142         (Incremental_inputs::report_script): New method.
3143         (Incremental_inputs::finalize_inputs): New method.
3144         (Incremental_inputs::finalize): Call finalize_inputs().
3145         (Incremental_inputs::sized_create_incremental_inputs_section_data):
3146         Create inputs entries.
3147         * incremental.h (Incremental_input_type): New enum.
3148         (Incremental_inputs::Incremental_input): Initialize new fields.
3149         (Incremental_inputs::report_inputs): New method.
3150         (Incremental_inputs::report_achive): New method.
3151         (Incremental_inputs::report_object): New method.
3152         (Incremental_inputs::report_script): New method.
3153         (Incremental_inputs::finalize_inputs): New method.
3154         (Incremental_inputs::Input_info): New struct.
3155         (Incremental_inputs::Input_info_map): New typedef.
3156         (Incremental_inputs::lock_): New field.
3157         (Incremental_inputs::Inputs_): New field.
3158         (Incremental_inputs::Inputs_map): New field.
3159         * main.cc (main): Call Incremental_input::report_inputs.
3160         * options.h (Input_argument_list): Typedef moved from
3161         Input_arguments.
3162         (Input_file_group::Files): Remove, use ::Input_argument_list.
3163         (Input_file_group::Input_argument_list): Remove, use
3164         ::Input_argument_list.
3165         * plugin.cc (Plugin_manager::add_input_file): Add error in
3166         incremental build.
3167         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
3168         functions.
3169         * script.cc (read_input_script): Call
3170         Incremental_input::report_script.
3171         * script.h (Script_info): New class.
3173 2009-04-27  Ian Lance Taylor  <iant@google.com>
3175         * x86_64.cc (do_adjust_output_section): Set entsize to
3176         plt_entry_size.
3178 2009-04-23  Elliott Hughes  <enh@google.com>
3180         * output.cc (Output_file::close): After short writes, continue
3181         writing from the correct offset in the buffer being written.
3183 2009-04-23  Chris Demetriou  <cgd@google.com>
3185         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
3186         * configure: Regenerate.
3187         * config.in: Regenerate.
3188         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
3189         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
3191 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
3193         * incremental.cc (Incremental_inputs_header_data): Renamed from
3194         Incremental_input_header_data.
3195         (Incremental_inputs_header_data::data_size): New field.
3196         (Incremental_inputs_header_data::put_input_file_count): Renamed
3197         from input_file_count.
3198         (Incremental_inputs_header_data::put_command_line_offset): Renamed
3199         from command_line_offset.
3200         (Incremental_inputs_header_data::put_reserved): Renamed from
3201         put_reserved.
3202         (Incremental_inputs_entry_data): Renamed from
3203         Incremental_input_entry_data.
3204         (Incremental_inputs_entry_data::data_size): New field.
3205         (Incremental_inputs::report_command_line): New method.
3206         (Incremental_inputs::finalize): New method.
3207         (Incremental_inputs::create_incremental_inputs_data): New method.
3208         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
3209         * incremental.h: New file.
3210         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
3211        (Layout::finalize): Create incremental inputs section in
3212         incremental builds.
3213        (Layout::create_incremental_info_sections): New method.
3214         * layout.h (Layout::incremental_inputs): New method.
3215        (Layout::create_incremental_info_sections): New method.
3216        (Layout::incremental_inputs_): New field.
3217         * main.cc (main): Notify Incremental_input of the command line.
3219 2009-04-01  Ian Lance Taylor  <iant@google.com>
3220             Mikolaj Zalewski  <mikolajz@google.com>
3222         * gold.h (reserve_unordered_map): Define, three versions, one for
3223         each version of Unordered_map.
3224         * layout.cc (Layout::Layout): Remove options parameter.  Add
3225         number_of_input_files parameter.  Don't initialize options_.
3226         Initialize number_of_input_files_ and resized_signatures_.  Move
3227         sections_are_attached_.
3228         (Layout::layout_group): Reserve space for group_signatures_.
3229         (Layout::find_or_add_kept_section): Change name parameter to be a
3230         reference.  Resize signatures_ map when it gets large enough.
3231         (Layout::layout_eh_frame): Use parameters->options() instead of
3232         this->options_.
3233         (Layout::make_output_section): Likewise.
3234         (Layout::attach_allocated_section_to_segment): Likewise.
3235         (Layout::finalize, Layout::create_executable_stack): Likewise.
3236         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
3237         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
3238         * layout.h (class Layout): Update declarations.  Remove options_
3239         field.  Add number_of_input_files_ and resized_signatures_
3240         fields.  Move sections_are_attached_ field.
3241         * main.cc (main): Pass number of input files to Layout
3242         constructor.  Don't pass options.
3244 2009-03-30  Ian Lance Taylor  <iant@google.com>
3246         * ffsll.c (ffsll): Correct implementation.
3248 2009-03-27  Ian Lance Taylor  <iant@google.com>
3250         * ffsll.c: New file.
3251         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
3252         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
3253         * ftruncate.c (ftruncate): Declare before definition.
3254         * mremap.c (mremap): Likewise.
3255         * pread.c (pread): Likewise.
3256         * configure, Makefile.in, config.in: Rebuild.
3258         * mremap.c: New file.
3259         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
3260         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
3261         (mremap): Declare if HAVE_MREMAP is not defined.
3262         * configure, Makefile.in, config.in: Rebuild.
3264 2009-03-27  Cary Coutant  <ccoutant@google.com>
3266         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
3267         position independent.
3268         * sparc.cc (Target_sparc::check_non_pic): Likewise.
3269         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
3271 2009-03-24  Cary Coutant  <ccoutant@google.com>
3273         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
3274         an executable.
3275         (needs_dynamic_reloc): Likewise.
3277 2009-03-24  Ian Lance Taylor  <iant@google.com>
3279         * yyscript.y (file_cmd): Recognize EXTERN.
3280         (extern_name_list, extern_name_list_body): New nonterminals.
3281         * script.cc (script_add_extern): Define.
3282         * script-c.h (script_add_extern): Declare.
3284 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
3286         * object.cc (is_elf_object): Define.
3287         * object.h (is_elf_object): Declare.
3288         * archive.cc (Archive::get_elf_object_for_member): Call
3289         is_elf_object.
3290         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
3292 2009-03-24  Elliott Hughes  <enh@google.com>
3294         * output.cc (Output_file::map_anonymous): Define.
3295         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
3296         try an anonymous one.  Report the size if the mmap fails.
3297         * output.h (class Output_file): Declare map_anonymous.
3299 2009-03-24  Ian Lance Taylor  <iant@google.com>
3301         * target-select.cc (instantiate_target): Don't acquire the lock if
3302         the instantiated_target_ field has already been set.
3304 2009-03-23  Ian Lance Taylor  <iant@google.com>
3306         * gold-threads.h (class Initialize_lock): Define.
3307         * gold-threads.cc (class Initialize_lock_once): Define.
3308         (initialize_lock_control): New static variable.
3309         (initialize_lock_pointer): New static variable.
3310         (initialize_lock_once): New static function.
3311         (Initialize_lock::Initialize_lock): Define.
3312         (Initialize_lock::initialize): Define.
3313         * target-select.h: Include "gold-threads.h".
3314         (class Target_selector): Add lock_ and initialize_lock_ fields.
3315         Don't define instantiate_target, just declare it.
3316         * target-select.cc (Target_selector::Target_selector): Initialize
3317         new fields.
3318         (Target_selector::instantiate_target): Define.
3319         * descriptors.h: Include "gold-threads.h".
3320         (class Descriptors): Add initialize_lock_ field.
3321         * descriptors.cc (Descriptors::Descriptors): Initialize new
3322         field.
3323         (Descriptors::open): Use initialize_lock_ field
3324         * errors.h (class Errors): Add initialize_lock_ field.
3325         * errors.cc (Errors::Errors): Initialize new field.
3326         (Errors::initialize_lock): Use initialize_lock_ field.
3327         * powerpc.cc (class Target_selector_powerpc): Remove
3328         instantiated_target_ field.  In do_recognize call
3329         instantiate_target rather than do_instantiate_target.  In
3330         do_instantiate_target just allocate a new target.
3331         * sparc.cc (class Target_selector_sparc): Likewise.
3333         * freebsd.h: New file.
3334         * i386.cc: Include "freebsd.h".
3335         (Target_i386): Derive from Target_freebsd rather than
3336         Sized_target.
3337         (Target_selector_i386): Derive from Target_selector_freebsd rather
3338         than Target_selector.
3339         * x86_64.cc: Include "freebsd.h".
3340         (Target_x86_64): Derive from Target_freebsd rather than
3341         Sized_target.
3342         (Target_selector_x86_64): Derive from Target_selector_freebsd
3343         rather than Target_selector.
3344         * target.h (class Target): Add adjust_elf_header and
3345         do_adjust_elf_header.
3346         * output.cc (Output_file_header:: do_sized_write): Call target
3347         adjust_elf_header routine.
3348         * configure.tgt: Set targ_osabi.
3349         * configure.ac: Define GOLD_DEFAULT_OSABI.
3350         * parameters.cc (Parameters::default_target): Pass
3351         GOLD_DEFAULT_OSABI to select_target.
3352         * target-select.h (class Target_selector): Make instantiate_target
3353         protected rather than private.
3354         * Makefile.am (HFILES): Add freebsd.h.
3355         * configure, Makefile.in, config.in: Rebuild.
3357         * merge.cc (do_add_input_section): Correct pend value.  Change
3358         message about last entry not being null terminated from error to
3359         warning.
3361 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
3363         * incremental.cc: New file.
3364         * Makefile.am (CCFILES): Add incremental.cc.
3365         * Makefile.in: Rebuild.
3367 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
3369         * layout.cc (Layout::output_section_name): Preserve names
3370         of '.note.' sections.
3371         
3372 2009-03-19  Ian Lance Taylor  <iant@google.com>
3374         * descriptors.cc (Descriptors::open): Check that the options are
3375         valid before using them.
3377 2009-03-18  Ian Lance Taylor  <iant@google.com>
3379         * script-sections.h: Include <list>.
3380         (class Script_sections): Change Sections_elements from std::vector
3381         to std::list.  Typedef public Elements_iterator.  Add
3382         orphan_section_placement_, data_segment_align_start_, and
3383         saw_data_segment_align_ fields.  Remove data_segment_align_index_
3384         field.
3385         * script-sections.cc (class Orphan_section_placement): New class.
3386         (class Sections_element): Add virtual functions is_relro and
3387         orphan_section_init.  Remove virtual function place_orphan_here.
3388         (class Output_section_definition): Add is_relro and
3389         orphan_section_init.  Remove place_orphan_here.
3390         (class Orphan_output_section): Likewise.
3391         (Script_sections::Script_sections): Update for field changes.
3392         (Script_sections::data_segment_align): Set saw_data_segment_align_
3393         and data_segment_align_start_, not data_segment_align_index.
3394         (Script_sections::data_segment_relro_end): Check
3395         saw_data_segment_align_.  Use data_segment_align_start_ rather
3396         than data_segment_align_index_.
3397         (Script_sections::place_orphan): Rewrite to use
3398         Orphan_section_placement.
3400 2009-03-17  Ian Lance Taylor  <iant@google.com>
3402         * archive.cc (Archive::add_symbols): Check for a version attached
3403         to the symbol name in the archive map.
3404         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
3405         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
3406         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
3407         (ver_test_11.a): New target.
3408         * testsuite/Makefile.in: Rebuild.
3410         * configure.ac: Check for chsize and posix_fallocate.  Replace
3411         ftruncate.
3412         * ftruncate.c: New file, from gnulib.
3413         * output.cc (posix_fallocate): Define dummy version if not
3414         HAVE_POSIX_FALLOCATE.
3415         (Output_file::map): Call posix_fallocate rather than lseek and
3416         write.
3417         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
3418         * configure, Makefile.in, config.in: Rebuild.
3420 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
3421         
3422         * layout.h (Layout::create_note): Add section_name parameter.
3423         * layout.cc (Layout::create_note): Likewise.
3424         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
3425         
3426 2009-03-17  Ian Lance Taylor  <iant@google.com>
3428         * descriptors.cc: Include "options.h".
3429         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
3430         (Descriptors::open): Always use O_CLOEXEC when opening a new
3431         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
3432         then set FD_CLOEXEC.
3434         * sparc.cc (class Target_sparc): Add has_got_section.
3435         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
3436         make sure we have a GOT section.
3438         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
3439         (Target_sparc::Scan::local): Likewise.
3440         (Target_sparc::Scan::global): Likewise.
3441         (Target_sparc::Relocate::relocate): Likewise.
3442         (Target_sparc::Relocate::relocate_tls): Likewise.
3444         * symtab.cc (Symbol_table::define_default_version): New function,
3445         broken out of add_from_object.
3446         (Symbol_table::add_from_object): Call define_default_version.
3447         (Symbol_table::define_special_symbol): Add resolve_oldsym
3448         parameter.  Change all callers.  If the version for a symbol comes
3449         from a version script, resolve it with the symbol with the same
3450         name with no version.  Also add the symbol without a version if
3451         appropriate.
3452         (do_define_in_output_data): If resolving with oldsym, don't delete
3453         sym.
3454         (do_define_in_output_segment): Likewise.
3455         (do_define_as_constant): Likewise.
3456         * symtab.h (class Symbol_table): Update declarations.
3458 2009-03-13  Ian Lance Taylor  <iant@google.com>
3460         * readsyms.cc (Read_symbols::incompatible_warning): New function.
3461         (Read_symbols::requeue): New function.
3462         (Read_symbols::do_read_symbols): If make_elf_object fails because
3463         the target type is not configured, and the file was searched for,
3464         issue a warning and retry with the next directory.
3465         (Add_symbols::run): If the file has an incompatible format, and
3466         it was searched for, requeue the Read_symbols task.  On error,
3467         release the object.
3468         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
3469         dirindex parameter to constructor.  Change all callers.  Declare
3470         incompatible_warning and requeue.
3471         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
3472         input_argument_ and input_group_ fields.  Add them to
3473         constructor.  Change all callers.
3474         (class Read_script): Add dirindex_ field.  Add it to constructor.
3475         Change all callers.
3476         * archive.cc (Archive::setup): Remove input_objects parameter.
3477         Change all callers.
3478         (Archive::get_file_and_offset): Likewise.
3479         (Archive::read_all_symbols): Likewise.
3480         (Archive::read_symbols): Likewise.
3481         (Archive::get_elf_object_for_member): Remove input_objects
3482         parameter.  Add punconfigured parameter.  Change all callers.
3483         (Archive::add_symbols): Change return type to bool.  Check return
3484         value of include_member.
3485         (Archive::include_all_members): Likewise.
3486         (Archive::include_member): Change return type to bool.  Return
3487         false if first included object has incompatible target.  Set
3488         included_member_ field.
3489         (Add_archive_symbols::run): If add_symbols returns false, requeue
3490         Read_symbols task.
3491         * archive.h (class Archive): Add included_member_ field.
3492         Initialize it in constructor.  Add input_file and searched_for
3493         methods.  Update declarations.
3494         (class Add_archive_symbols): Add dirpath_, dirindex_, and
3495         input_argument_ fields.  Add them to constructor.  Change all
3496         callers.
3497         * script.cc: Include "target-select.h".
3498         (class Parser_closure): Add skip_on_incompatible_target_ and
3499         found_incompatible_target_ fields.  Add
3500         skip_on_incompatible_target parameter to constructor.  Change all
3501         callers.  Add methods skip_on_incompatible_target,
3502         clear_skip_on_incompatible_target, found_incompatible_target, and
3503         set_found_incompatible_target.
3504         (read_input_script): Add dirindex parameter.  Change all callers.
3505         If parser finds an incompatible target, requeue Read_symbols
3506         task.
3507         (script_set_symbol): Clear skip_on_incompatible_target in
3508         closure.
3509         (script_add_assertion, script_parse_option): Likewise.
3510         (script_start_sections, script_add_phdr): Likewise.
3511         (script_check_output_format): New function.
3512         * script.h (read_input_script): Update declaration.
3513         * script-c.h (script_check_output_format): Declare.
3514         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
3515         (ignore_cmd): Remove OUTPUT_FORMAT.
3516         * fileread.cc (Input_file::Input_file): Add explicit this.
3517         (Input_file::will_search_for): New function.
3518         (Input_file::open): Add pindex parameter.  Change all callers.
3519         * fileread.h (class Input_file): Add input_file_argument method.
3520         Declare will_search_for.  Update declarations.
3521         * object.cc (make_elf_object): Add punconfigured parameter.
3522         Change all callers.
3523         * object.h (class Object): Make input_file public.  Add
3524         searched_for method.
3525         (make_elf_object): Update declaration.
3526         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
3527         restart search.
3528         * dirsearch.h (class Dirsearch): Update declaration.
3529         * options.h (class General_options): Add --warn-search-mismatch.
3530         * parameters.cc (Parameters::is_compatible_target): New function.
3531         * parameters.h (class Parameters): Declare is_compatible_target.
3532         * workqueue.cc (Workqueue::add_blocker): New function.
3533         * workqueue.h (class Workqueue): Declare add_blocker.
3535         * fileread.cc (Input_file::open): Remove options parameter.
3536         Change all callers.
3537         (Input_file::open_binary): Likewise.
3538         * script.cc (read_input_script): Likewise.
3539         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
3540         options parameter from constructor.  Change all callers.
3541         (class Read_script): Likewise.
3542         * fileread.h (class Input_file): Update declarations.
3543         * script.h (read_input_script): Update declaration.
3545 2009-03-10  Nick Clifton  <nickc@redhat.com>
3547         * po/es.po: New Spanish translation.
3549 2009-03-06  Cary Coutant  <ccoutant@google.com>
3551         * options.cc (parse_short_option): Keep dash_z from registering itself.
3553 2009-03-03  Ian Lance Taylor  <iant@google.com>
3555         PR 9918
3556         * target-reloc.h (relocate_section): Pass output_section to
3557         relocate.
3558         * i386.cc (Target_i386::should_apply_static_reloc): Add
3559         output_section parameter.  Change all callers.
3560         (Target_i386::Relocate::relocate): Add output_section parameter.
3561         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3562         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3563         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3564         * testsuite/two_file_shared.sh: New script.
3565         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
3566         (check_DATA): Add two_file_shared.dbg.
3567         (two_file_shared.dbg): New target.
3568         * testsuite/Makefile.in: Rebuild.
3570 2009-03-01  Ian Lance Taylor  <iant@google.com>
3572         * configure.ac: Check for byteswap.h.
3573         * configure: Rebuild.
3574         * config.in: Rebuild.
3576 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
3578         * layout.cc (Layout::find_or_add_kept_section): New function.
3579         (Layout::add_comdat): Removed.
3580         * layout.h (struct Kept_section): Move out of class Layout.
3581         Remove trailing underscores from field names.  Add group_sections
3582         field.  Rename group_ field to is_group.  Change all uses.
3583         (class Layout): Declare find_or_add_kept_section, not add_comdat.
3584         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
3585         comdat_groups_ field.
3586         (Sized_relobj::include_section_group): Use
3587         find_or_add_kept_section and Kept_section::group_sections.
3588         (Sized_relobj::include_linkonce_section): Likewise.
3589         * object.cc (class Sized_relobj): Don't define Comdat_group or
3590         Comdat_group_table.  Remove find_comdat_group and
3591         add_comdat_group.  Remove comdat_groups_ field.
3592         * plugin.cc (include_comdat_group): Use
3593         Layout::find_or_add_kept_section.
3595 2009-02-28  Ian Lance Taylor  <iant@google.com>
3597         * README: --gc-sections and map files are now supported.  Document
3598         some build requirements.
3600         PR 6992
3601         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
3602         relocatable link set the value of the section symbol to zero.
3603         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
3604         relocatable link don't include the section address in the local
3605         symbol value.
3607 2009-02-27  Ian Lance Taylor  <iant@google.com>
3609         PR 6811
3610         * options.h (class Search_directory): Add is_system_directory.
3611         (class General_options): Declare is_in_system_directory.
3612         * options.cc (get_relative_sysroot): Make static.
3613         (get_default_sysroot): Make static.
3614         (General_optoins::is_in_system_directory): New function.
3615         * fileread.cc (Input_file::is_in_system_directory): New function.
3616         * fileread.h (class Input_file): Declare is_in_system_directory.
3617         * object.h (class Object): Add is_in_system_directory.
3618         (class Input_objects): Remove system_library_directory_ field.
3619         * object.cc (Input_objects::add_object): Don't set
3620         system_library_directory_.
3621         (input_objects::found_in_system_library_directory): Remove.
3622         * symtab.cc (Symbol_table::write_globals): Remove input_objects
3623         parameter.  Change all callers.
3624         (Symbol_table::sized_write_globals): Likewise.
3625         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
3626         Call Object::is_in_system_directory.
3627         * symtab.h (class Symbol_table): Update declarations.
3629         PR 5990
3630         * descriptors.h (Open_descriptor): Add is_on_stack field.
3631         * descriptors.cc (Descriptors::open): If the descriptor is on the
3632         top of the stack, remove it.  Initialize is_on_stack field.
3633         (Descriptors::release): Only add pod to stack if it is not on the
3634         stack already.
3635         (Descriptors::close_some_descriptor): Clear stack_next and
3636         is_on_stack fields.
3638         PR 7091
3639         * output.cc (Output_section::find_starting_output_address): Rename
3640         from starting_output_address; add PADDR parameter; change return
3641         type.
3642         * output.h (class Output_section): Declare
3643         find_starting_output_address instead of starting_output_address.
3644         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
3645         section symbol for which we can't find a merge section.
3647         PR 9836
3648         * symtab.cc (Symbol_table::add_from_object): If the visibility is
3649         hidden or internal, force the symbol to be local.
3650         * resolve.cc (Symbol::override_visibility): Define.
3651         (Symbol::override_base): Use override_visibility.
3652         (Symbol_table::resolve): Likewise.
3653         (Symbol::override_base_with_special): Likewise.
3654         (Symbol_table::override_with_special): If the visibility is hidden
3655         or internal, force the symbol to be local.
3656         * symtab.h (class Symbol): Add set_visibility and
3657         override_visibility.
3658         * testsuite/ver_test_1.sh: New file.
3659         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
3660         (check_DATA): Add ver_test_1.syms.
3661         (ver_test_1.syms): New target.
3662         * testsuite/Makefile.in: Rebuild.
3664 2009-02-25  Cary Coutant  <ccoutant@google.com>
3666         * layout.cc (Layout::choose_output_section): Don't rename sections
3667         when using a linker script that has a SECTIONS clause.
3668         * Makefile.in: Regenerate.
3670         * testsuite/Makefile.am (script_test_5.sh): New test case.
3671         * testsuite/Makefile.in: Regenerate.
3672         * testsuite/script_test_5.cc: New file.
3673         * testsuite/script_test_5.sh: New file.
3674         * testsuite/script_test_5.t: New file.
3676 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
3678         * archive.cc (Archive::include_member): Update calls to add_symbols.
3679         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
3680         the Layout argument.
3681         * dynobj.h (do_add_symbols): Add the Layout argument.
3682         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
3683         Layout argument.
3684         * object.h (Object::add_symbols): Add the Layout argument.
3685         (Object::do_add_symbols): Add the Layout argument.
3686         (Sized_relobj::do_add_symbols): Add the Layout argument.
3687         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
3688         Unify the two versions.
3689         (Add_plugin_symbols): Remove.
3690         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
3691         (Sized_pluginobj::do_add_symbols): Unify the two versions.
3692         (Add_plugin_symbols): Remove.
3693         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
3694         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
3695         (Add_symbols::run): Make it work with Pulginobj.
3697 2009-02-06  Ian Lance Taylor  <iant@google.com>
3699         * object.cc (Sized_relobj::do_layout): Make info message start
3700         with lower case letter.
3702 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
3704         * binary.cc: Fix file comment.
3706         * options.h (enum Incremental_disposition): Define.
3707         (class General_options): Add new options: --incremental,
3708         --incremental_changed, --incremental_unchanged,
3709         --incremental_unknown.  Add incremental_disposition_ and
3710         implicit_incremental_ fields.
3711         (General_options::incremental_disposition): New function.
3712         (class Position_dependent_options): Add incremental_disposition
3713         option.
3714         (Position_dependent_options::copy_from_options): Set incremental
3715         dispositions.
3716         * options.cc (General_options::parse_incremental_changed): New
3717         function.
3718         (General_options::parse_incremental_unchanged): New function.
3719         (General_options::parse_incremental_unknown): New function.
3720         (General_options::General_options): Initialize new fields
3721         incremental_disposition_ and implicit_incremental_.
3722         (General_options::finalize): Check for uasge of --incremental-*
3723         without --incremental.
3725 2009-02-06  Chris Demetriou  <cgd@google.com>
3727         * gold.h (gold_undefined_symbol): Change to take only a Symbol
3728         pointer and to report location as the file name associated with
3729         the symbol.
3730         (gold_undefined_symbol_at_location): New function to replace the
3731         old gold_undefined_symbol functionality.
3732         * target-reloc.h (relocate_section): Update to use
3733         gold_undefined_symbol_at_location.
3734         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
3735         Call gold_undefined_symbol function rather than gold_error.
3736         * errors.h (Errors::undefined_symbol): Take location as a
3737         string, rather than calculating it from a relocation.
3738         * errors.cc (Errors::fatal): Print "fatal error:" before the
3739         formatted message.
3740         (Errors::error, Errors::error_at_location): Print "error: "
3741         before the formatted message.
3742         (Errors::undefined_symbol): Take location as a string, rather
3743         than calculating it from a relocation.
3744         (gold_undefined_symbol_at_location): New function akin to
3745         old gold_undefined_symbol, calculates location from relocation.
3746         (gold_undefined_symbol): Change to take only a Symbol pointer
3747         and to report location as the file name associated with the symbol.
3748         * testsuite/debug_msg.sh: Update for changed error messages.
3749         * testsuite/undef_symbol.sh: Likewise.
3751 2009-02-04  Duncan Sands  <baldrick@free.fr>
3753         PR 9812
3754         * reduced_debug_output.h
3755         (Output_reduced_debug_abbrev_section::failed): Use format for
3756         gold_warning.
3757         (Output_reduced_debug_info_section::faild): Likewise.
3759 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
3761         * script.cc (Lazy_demangler): New class.
3762         (Version_script_info::get_symbol_version_helper): Demangle a
3763         symbol only once.
3765 2009-01-29  Cary Coutant  <ccoutant@google.com>
3767         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
3768         to __tls_get_addr.
3769         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3771 2009-01-28  Ian Lance Taylor  <iant@google.com>
3773         * version.cc (version_string): Bump to 1.9.
3775         * gold.h: Include <cstring> and <stdint.h>.
3776         * version.cc: Include <cstdio>.
3777         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
3778         warning.
3779         * reduced_debug_output.cc (insert_into_vector): Rename from
3780         Insert_into_vector; change all callers.  Use Swap_unaligned to
3781         avoid aliasing issue; remove union since it is unnecessary.
3783 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
3785         * Makefile.am (CCFILES): Add gc.cc.
3786         (HFILES): Add gc.h.
3787         * Makefile.in: Regenerate.
3788         * gold.cc (Gc_runner): New class.
3789         (queue_initial_tasks): Call garbage collection related tasks
3790         when corresponding options are invoked.
3791         (queue_middle_gc_tasks): New function.
3792         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
3793         processed early before laying out sections during garbage collection.
3794         * gold.h (queue_middle_gc_tasks): New function.
3795         (is_prefix_of): Move from "layout.cc".
3796         * i386.cc (Target_i386::gc_process_relocs): New function.
3797         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
3798         * main.cc (main): Create object of class "Garbage_collection".
3799         * object.cc (Relobj::copy_symbols_data): New function.
3800         (Relobj::is_section_name_included): New function.
3801         (Sized_relobj::do_layout): Allow this function to be called twice 
3802         during garbage collection and defer layout of section during the 
3803         first call.
3804         * object.h (Relobj::get_symbols_data): New function.
3805         (Relobj::is_section_name_included): New function.
3806         (Relobj::copy_symbols_data): New function.
3807         (Relobj::set_symbols_data): New function.
3808         (Relobj::get_relocs_data): New function.
3809         (Relobj::set_relocs_data): New function.
3810         (Relobj::is_output_section_offset_invalid): New pure virtual function.
3811         (Relobj::gc_process_relocs): New function.
3812         (Relobj::do_gc_process_relocs): New pure virtual function.
3813         (Relobj::sd_): New data member.
3814         (Sized_relobj::is_output_section_offset_invalid): New function.
3815         (Sized_relobj::do_gc_process_relocs): New function.
3816         * options.h (General_options::gc_sections): Modify to not be a no-op.
3817         (General_options::print_gc_sections): New option.
3818         * plugin.cc (Plugin_finish::run): Remove function call to
3819         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
3820         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
3821         * reloc.cc (Read_relocs::run): Add task to process relocs and
3822         determine unreferenced sections when doing garbage collection.
3823         (Gc_process_relocs): New class.
3824         (Sized_relobj::do_gc_process_relocs): New function.
3825         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
3826         sections that are garbage collected.
3827         * reloc.h (Gc_process_relocs): New class.
3828         * sparc.cc (Target_sparc::gc_process_relocs): New function.
3829         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
3830         symbols whose corresponding sections are garbage collected.
3831         (Symbol_table::Symbol_table): Add new parameter for the garbage
3832         collection object.
3833         (Symbol_table::gc_mark_undef_symbols): New function.
3834         (Symbol_table::gc_mark_symbol_for_shlib): New function.
3835         (Symbol_table::gc_mark_dyn_syms): New function.
3836         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
3837         as garbage.
3838         (Symbol_table::add_from_object): Likewise.
3839         (Symbol_table::add_from_relobj): When building shared objects, do not
3840         treat externally visible symbols as garbage.
3841         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
3842         table information for static and relocatable links.
3843         * symtab.h (Symbol_table::set_gc): New function.
3844         (Symbol_table::gc): New function.
3845         (Symbol_table::gc_mark_undef_symbols): New function.
3846         (Symbol_table::gc_mark_symbol_for_shlib): New function.
3847         (Symbol_table::gc_mark_dyn_syms): New function.
3848         (Symbol_table::gc_): New data member.
3849         * target.h (Sized_target::gc_process_relocs): New pure virtual 
3850         function.
3851         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
3852         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
3854 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
3856         * options.h (General_options::gc_sections): Define as a no-op for now.
3857         (General_options::no_keep_memory): Ditto.
3858         (General_options::Bshareable): Define.
3859         * options.cc (General_options::finalize): Honor -Bshareable.
3861 2009-01-20  Andreas Schwab  <schwab@suse.de>
3863         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
3864         read the value in the contents, since we don't use it.  Use the
3865         template endianness when writing.
3866         (Relocate::relocate): Use it for R_PPC_REL16_HA.
3868 2009-01-19  Andreas Schwab  <schwab@suse.de>
3870         * configure.tgt (powerpc64-*): Fix targ_obj.
3872 2009-01-15  Ian Lance Taylor  <iant@google.com>
3874         * object.cc (Sized_relobj::write_local_symbols): Don't write out
3875         local symbols when stripping all symbols.
3877 2009-01-14  Cary Coutant  <ccoutant@google.com>
3879         * output.cc (Output_reloc): Add explicit instantiations.
3881 2009-01-14  Cary Coutant  <ccoutant@google.com>
3883         * archive.cc (Archive::get_elf_object_for_member): Remove call
3884         to File_read::claim_for_plugin.
3885         * descriptors.cc (Descriptors::open): Remove reference to
3886         is_claimed.
3887         (Descriptors::claim_for_plugin): Remove.
3888         * descriptors.h (Descriptors::claim_for_plugin): Remove.
3889         (Descriptors::is_claimed): Remove.
3890         (claim_descriptor_for_plugin): Remove.
3891         * fileread.cc (File_read::claim_for_plugin): Remove.
3892         * fileread.h (File_read::claim_for_plugin): Remove.
3893         (File_read::descriptor): Reopen descriptor if necessary.
3894         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
3895         (Plugin_manager::all_symbols_read): Add task parameter. Change
3896         all callers.
3897         (Plugin_manager::get_input_file): New function.
3898         (Plugin_manager::release_input_file): New function.
3899         (Pluginobj::Pluginobj): Add filesize parameter and initialize
3900         corresponding data member.
3901         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
3902         and pass to base constructor. Change all callers.
3903         (get_input_file, release_input_file): New functions.
3904         (make_sized_plugin_object): Add filesize parameter. Change all callers.
3905         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
3906         (Plugin_manager::all_symbols_read): Add task parameter.
3907         (Plugin_manager::get_input_file): New function.
3908         (Plugin_manager::release_input_file): New function.
3909         (Plugin_manager::task_): New data member.
3910         (Pluginobj::Pluginobj): Add filesize parameter.
3911         (Pluginobj::filename): New function.
3912         (Pluginobj::descriptor): New function.
3913         (Pluginobj::filesize): New function.
3914         (Pluginobj::filesize_): New data member.
3915         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
3916         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
3917         File_read::claim_for_plugin; use Object::unlock to unlock the file.
3919         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
3920         with archive libraries.
3921         * testsuite/Makefile.in: Regenerate.
3922         * testsuite/plugin_test.c (struct sym_info): New type.
3923         (get_input_file, release_input_file): New static variables.
3924         (onload): Capture new transfer vector entries.
3925         (claim_file_hook): Stop reading at end of file according to filesize.
3926         Factor out parsing of readelf output into separate function.
3927         (all_symbols_read_hook): Exercise get_input_file and release_input_file
3928         APIs and get the source file name from the symbol table.  Convert
3929         source file name to corresponding object file name.  Print info
3930         message when adding new input files.
3931         (parse_readelf_line): New function.
3932         * testsuite/plugin_test_1.sh: Add checks for new info messages.
3933         * testsuite/plugin_test_2.sh: Likewise.
3934         * testsuite/plugin_test_3.sh: Likewise.
3935         * testsuite/plugin_test_4.sh: New test case.
3937 2009-01-07  Ian Lance Taylor  <iant@google.com>
3939         * version.cc (version_string): Bump to 1.8.
3941 2008-12-23  Cary Coutant  <ccoutant@google.com>
3943         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
3944         * plugin.cc (Plugin_manager::finish): Rename as
3945         layout_deferred_objects.  Move cleanup to separate function.
3946         (Plugin_manager::cleanup): New function.
3947         (Plugin_finish::run): Call layout_deferred_objects and cleanup
3948         separately.
3949         * plugin.h (Plugin_manager::finish): Rename as
3950         layout_deferred_objects.
3951         (Plugin_manager::cleanup): New function.
3952         (Plugin_manager::cleanup_done): New field.
3954 2008-12-23  Cary Coutant  <ccoutant@google.com>
3956         * plugin.cc (is_visible_from_outside): New function.
3957         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
3958         so we don't return "IR only" status for exported symbols or -r links.
3960         * testsuite/Makefile.am (plugin_test_3): New test case.
3961         * testsuite/Makefile.in: Regenerate.
3962         * testsuite/plugin_test_3.sh: New file.
3964 2008-12-22  Cary Coutant  <ccoutant@google.com>
3966         * object.cc (Sized_relobj::layout_section): New function.
3967         (Sized_relobj::do_layout): Defer layout of input sections until after
3968         plugin has provided replacement files.
3969         (Sized_relobj::do_layout_deferred_sections): New function.
3970         * object.h (Relobj::set_section_offset): Remove virtual keyword.
3971         (Relobj::layout_deferred_sections): New function.
3972         (Relobj::do_layout_deferred_sections): New function.
3973         (Sized_relobj::do_layout_deferred_sections): New function.
3974         (Sized_relobj::layout_section): New function.
3975         (Sized_relobj::Deferred_layout): New structure.
3976         (Sized_relobj::deferred_layout_): New field.
3977         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
3978         Change all callers.  Layout deferred sections.
3979         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
3980         references.
3981         (Plugin_hook::run): Move code from do_plugin_hook inline.
3982         (Plugin_hook::do_plugin_hook): Remove.
3983         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
3984         (Plugin_manager::finish): Renamed, was cleanup.
3985         (Plugin_manager::should_defer_layout): New function.
3986         (Plugin_manager::add_deferred_layout_object): New function.
3987         (Plugin_manager::Deferred_layout_list): New type.
3988         (Plugin_manager::deferred_layout_objects_): New field.
3989         (Plugin_hook::do_plugin_hook): Remove.
3991 2008-12-17  Ian Lance Taylor  <iant@google.com>
3993         * options.h (class General_options): Add --no case for
3994         --export-dynamic.
3996 2008-12-16  Cary Coutant  <ccoutant@google.com>
3998         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
3999         vector.
4000         (Plugin_manager::claim_file): Create plugin object even if
4001         plugin did not call the add_symbols callback.
4002         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
4003         asking for more symbols than were added.
4004         * testsuite/Makefile.am (plugin_test_1): Add test case with
4005         no global symbols.
4006         (empty.syms): New target.
4007         * testsuite/Makefile.in: Regenerate.
4008         * testsuite/plugin_test.c (claim_file_hook): Add new debug
4009         message. Don't call add_symbols if no globals.
4010         (all_symbols_read_hook): Don't provide replacement for empty
4011         claimed file.
4013 2008-12-12  Ian Lance Taylor  <iant@google.com>
4015         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
4016         r_type == 0 for a local symbol with r_sym == 0.
4017         (scan_relocatable_relocs): Pass r_sym to
4018         local_non_section_strategy.
4019         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
4020         r_sym parameter.
4022         * configure.ac: Update test for TLS descriptors: they are
4023         supported as of glibc 2.9.
4024         * configure: Rebuild.
4026 2008-12-11  Ian Lance Taylor  <iant@google.com>
4028         PR 7091
4029         * target-reloc.h (Default_scan_relocatable_relocs): For each
4030         function, map r_type == 0 to RELOC_DISCARD.
4032 2008-12-10  Cary Coutant  <ccoutant@google.com>
4034         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
4035         object to override a kept COMDAT group from a plugin object.
4037 2008-12-09  Ian Lance Taylor  <iant@google.com>
4039         PR 7088
4040         * yyscript.y (file_cmd): Handle INPUT.
4042         * testsuite/initpri1.c: Change all declarations to be full
4043         prototypes by adding void, to avoid compiler warnings.
4045 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
4047         * options.cc (General_options::parse_plugin_opt): New.
4048         (General_options::add_plugin): The argument now is just the filename.
4049         (General_options::add_plugin_option): New.
4050         * options.h (plugin_opt): New.
4051         (add_plugin): Change argument name.
4052         (add_plugin_option): New.
4053         * plugin.cc (Plugin::load): Don't parse the plugin option.
4054         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
4055         (Plugin::add_option): New.
4056         (Plugin::args_): Change type.
4057         (Plugin::filename_): New.
4058         (Plugin_manager::add_plugin_option): New.
4059         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
4060         * testsuite/Makefile.in: Regenerate.
4062 2008-12-05  Cary Coutant  <ccoutant@google.com>
4064         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
4065         Handle --strip-lto-sections option.
4066         * options.h (strip_lto_sections): New option.
4068 2008-12-01  Cary Coutant  <ccoutant@google.com>
4070         * plugin.cc (ld_plugin_message): Change format parameter to const.
4071         Fix mismatch between new[] and delete.
4073 2008-11-14  Cary Coutant  <ccoutant@google.com>
4075         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
4076         instead of -1U.
4078 2008-11-05  Craig Silverstein  <csilvers@google.com>
4080         * options.cc (General_options::parse_dynamic_list): New function.
4081         * options.h (General_options): New flags dynamic_list,
4082         dynamic_list_data, dynamic_list_cpp_new, and
4083         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
4084         (General_options::in_dynamic_list): New function.
4085         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
4086         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
4087         (Lex::can_continue_name): Likewise.
4088         (yylex): Likewise.
4089         (read_script_file): New parameter script_options.
4090         (read_dynamic_list): New function.
4091         (Script_options::define_dynamic_list): New function.
4092         (dynamic_list_keyword_parsecodes): New variable.
4093         (dynamic_list_keywords): New variable.
4094         * script.h (Script_options::define_dynamic_list): New function
4095         prototype.
4096         (read_dynamic_list): New function prototype.
4097         * symtab.cc (strprefix): New macro.
4098         (Symbol::should_add_dynsym_entry): Support dynamic_list,
4099         dynamic_list_data, dynamic_list_cpp_new, and
4100         dynamic_list_cpp_typeinfo.
4101         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
4102         (dynamic_list_expr): New rule.
4103         (dynamic_list_nodes): Likewise.
4104         (dynamic_list_node): Likewise.
4105         * testsuite/Makefile.am (dynamic_list): New test.
4106         * testsuite/Makefile.in: Regenerated.
4107         * testsuite/dynamic_list.t: New file.
4108         * testsuite/dynamic_list.sh: New file.
4110 2008-11-05  Craig Silverstein  <csilvers@google.com>
4112         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
4113         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
4114         (t11_last): Likewise.
4115         * testsuite/ver_test_6.c (main): Likewise.
4117 2008-10-07  Cary Coutant  <ccoutant@google.com>
4119         * options.c (General_options::finalize): Add check for -static and
4120         -shared.
4121         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
4122         is not empty.
4124 2008-10-02  Cary Coutant  <ccoutant@google.com>
4126         * plugin.cc (make_sized_plugin_object): Fix conditional
4127         compilation to work when not all targets are enabled.
4129 2008-09-29  Cary Coutant  <ccoutant@google.com>
4131         * archive.cc (Archive::get_file_and_offset): Use filename instead
4132         of name to get library path.
4133         (Archive::include_member): Unlock external member of a thin archive.
4135         * testsuite/Makefile.am (TEST_AR): New variable.
4136         (thin_archive_test_1): New test.
4137         (thin_archive_test_2): New test.
4138         * testsuite/Makefile.in: Regenerate.
4139         * testsuite/thin_archive_main.cc: New file.
4140         * testsuite/thin_archive_test_1.cc: New file.
4141         * testsuite/thin_archive_test_2.cc: New file.
4142         * testsuite/thin_archive_test_3.cc: New file.
4143         * testsuite/thin_archive_test_4.cc: New file.
4145 2008-09-29  Cary Coutant  <ccoutant@google.com>
4147         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
4148         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
4149         instead of -1U.
4150         (Sized_relobj::do_finalize_local_symbols): Likewise.
4151         (Sized_relobj::map_to_kept_section): Likewise.
4152         * object.h (Sized_relobj::invalid_address): New constant.
4153         (Sized_relobj::do_output_section_offset): Check for invalid_address
4154         and return -1ULL.
4155         * output.cc (Output_reloc::local_section_offset): Use constant
4156         invalid_address instead of -1U.
4157         (Output_reloc::get_address): Likewise.
4158         (Output_section::output_address): Change -1U to -1ULL.
4159         * output.h (Output_reloc::invalid_address): New constant.
4160         * reloc.cc (Sized_relobj::write_sections): Use constant
4161         invalid_address instead of -1U.
4162         (Sized_relobj::relocate_sections): Likewise.
4163         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
4164         values for merge sections.
4165         * target-reloc.h (relocate_for_relocatable): Use constant
4166         invalid_address instead of -1U.
4168 2008-09-19  Cary Coutant  <ccoutant@google.com>
4170         Add plugin functionality for link-time optimization (LTO).
4171         * configure.ac (plugins): Add --enable-plugins option.
4172         * configure: Regenerate.
4173         * config.in: Regenerate.
4174         * Makefile.am (LIBDL): New variable.
4175         (CCFILES): Add plugin.cc.
4176         (HFILES): Add plugin.h.
4177         (ldadd_var): Add LIBDL.
4178         * Makefile.in: Regenerate.
4180         * archive.cc: Include "plugin.h".
4181         (Archive::setup): Don't preread archive symbols when using a plugin.
4182         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
4183         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
4184         files.
4185         (Archive::include_member): Add symbols from plugin objects.
4186         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
4187         * descriptors.cc (Descriptors::open): Check for file descriptors
4188         abandoned by plugins.
4189         (Descriptors::claim_for_plugin): New function.
4190         * descriptors.h (Descriptors::claim_for_plugin): New function.
4191         (Open_descriptor::is_claimed): New field.
4192         (claim_descriptor_for_plugin): New function.
4193         * fileread.cc (File_read::claim_for_plugin): New function.
4194         * fileread.h (File_read::claim_for_plugin): New function.
4195         (File_read::descriptor): New function.
4196         * gold.cc: Include "plugin.h".
4197         (queue_initial_tasks): Add task to call plugin hooks for generating
4198         new object files.
4199         * main.cc: Include "plugin.h".
4200         (main): Load plugin libraries.
4201         * object.h (Pluginobj): Declare.
4202         (Object::pluginobj): New function.
4203         (Object::do_pluginobj): New function.
4204         (Object::set_target): New function.
4205         * options.cc: Include "plugin.h".
4206         (General_options::parse_plugin): New function.
4207         (General_options::General_options): Initialize plugins_ field.
4208         (General_options::add_plugin): New function.
4209         * options.h (Plugin_manager): Declare.
4210         (General_options): Add --plugin option.
4211         (General_options::has_plugins): New function.
4212         (General_options::plugins): New function.
4213         (General_options::add_plugin): New function.
4214         (General_options::plugins_): New field.
4215         * plugin.cc: New file.
4216         * plugin.h: New file.
4217         * readsyms.cc: Include "plugin.h".
4218         (Read_symbols::do_read_symbols): Check for archive before checking
4219         for ELF file.  Call plugin hooks to claim files.
4220         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
4221         from a real object file; force override when processing replacement
4222         files.
4223         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
4224         (Symbol::init_base_object): Likewise.
4225         (Symbol::init_base_output_data): Likewise.
4226         (Symbol::init_base_output_segment): Likewise.
4227         (Symbol::init_base_constant): Likewise.
4228         (Symbol::init_base_undefined): Likewise.
4229         (Symbol::output_section): Assert that object is not a plugin.
4230         (Symbol_table::add_from_pluginobj): New function.
4231         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
4232         undefined.
4233         (Symbol_table::sized_write_globals): Likewise.
4234         (Symbol_table::add_from_pluginobj): Instantiate template.
4235         * symtab.h (Sized_pluginobj): Declare.
4236         (Symbol::in_real_elf): New function.
4237         (Symbol::set_in_real_elf): New function.
4238         (Symbol::in_real_elf_): New field.
4239         (Symbol_table::add_from_pluginobj): New function.
4241         * testsuite/Makefile.am (AM_CFLAGS): New variable.
4242         (LIBDL): New variable.
4243         (LDADD): Add LIBDL.
4244         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
4245         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
4246         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
4247         (MOSTLYCLEANFILES): Likewise.
4248         * testsuite/Makefile.in: Regenerate.
4249         * testsuite/plugin_test.c: New file.
4250         * testsuite/plugin_test_1.sh: New file.
4251         * testsuite/plugin_test_2.sh: New file.
4253 2008-09-16  Ian Lance Taylor  <iant@google.com>
4255         * target-reloc.h (relocate_section): Check whether a symbol is
4256         defined by the ABI before reporting an undefined symbol error.
4257         * target.h (Target::is_defined_by_abi): Make parameter const.
4258         (Target::do_is_defined_by_abi): Likewise.
4259         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
4260         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
4261         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
4262         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
4263         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
4264         * testsuite/Makefile.in: Rebuild.
4266         * fileread.cc (make_view): Add casts to avoid warning.
4268 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
4270         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
4271         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4273 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
4275         * options.h (General_options::output_is_executable): New.
4276         (General_options::output_is_pie): New.
4277         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
4278         for shared libraries.
4279         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
4281 2008-09-11  Chris Demetriou  <cgd@google.com>
4283         * options.h (origin): New -z option.
4284         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
4285         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
4286         in DT_FLAGS_1.
4288 2008-09-05  Cary Coutant  <ccoutant@google.com>
4290         * fileread.cc (File_read::make_view): Add check for attempt to map
4291         beyond end of file.
4293 2008-09-05  Cary Coutant  <ccoutant@google.com>
4295         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
4296         explicit instantiations.
4298 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
4300         PR gold/6858
4301         * options.cc (General_options::finalize): Allow undefined symbols
4302         in shlibs if linking -shared.
4304         PR gold/6859
4305         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
4306         symbols as not needing a dynsym entry.
4308 2008-08-20  Craig Silverstein  <csilvers@google.com>
4310         * fileread.cc (File_read::open): Do not lock the file unless it
4311         was successfully opened.
4313 2008-08-14  Cary Coutant  <ccoutant@google.com>
4315         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
4316         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
4317         * testsuite/tls_test.cc (struct int128): 128-bit struct
4318         for testing TLS relocs with non-zero addend.
4319         (v12): New TLS variable.
4320         (t12): New test.
4321         (t_last): Add check for v12.
4322         * testsuite/tls_test.h (t12): New function.
4323         * testsuite/tls_test_main.cc (thread_routine): Call new test.
4325 2008-08-13  Ian Lance Taylor  <iant@google.com>
4327         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
4328         set tls_segment_ or relro_segment_.
4329         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
4330         when appropriate.
4331         * output.h (Output_section::clear_is_relro): New function.
4332         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
4333         sections specially even when output_data_ is empty.
4334         (Output_segment::maximum_alignment): When first section is relro,
4335         only force alignment for PT_LOAD segments.
4336         * script.cc (script_data_segment_align): New function.
4337         (script_data_segment_relro_end): New function.
4338         * script-c.h (script_data_segment_align): Declare.
4339         (script_data_segment_relro_end): Declare.
4340         * script-sections.h (class Script_sections): Declare
4341         data_segment_align and data_segment_relro_end.  Add fields
4342         segment_align_index_ and saw_relro_end_.
4343         * script-sections.cc (class Sections_element): Add set_is_relro
4344         virtual function.  Add new bool* parameter to place_orphan_here.
4345         Add get_output_section virtual function.
4346         (class Output_section_definition): Add set_is_relro.  Add new
4347         bool* parameter to place_orphan_here.  Add get_output_section.
4348         Add is_relro_ field.
4349         (Output_section_definition::Output_section_definition): Initialize
4350         evaluated_address_, evaluated_load_address, evaluated_addralign_,
4351         and is_relro_ fields.
4352         (Output_section_definition::place_orphan_here): Add is_relro
4353         parameter.
4354         (Output_section_definition::set_section_addresses): Set relro for
4355         output section.
4356         (Output_section_definition::alternate_constraint): Likewise.
4357         (class Orphan_output_section): Add new bool* parameter to
4358         place_orphan_here.  Add get_output_section.
4359         (Orphan_output_section::place_orphan_here): Add is_relro
4360         parameter.
4361         (Script_sections::Script_sections): Initialize
4362         data_segment_align_index_ and saw_relro_end_.
4363         (Script_sections::data_segment_align): New function.
4364         (Script_sections::data_segment_relro_end): New function.
4365         (Script_sections::place_orphan): Set or clear is_relro.
4366         (Script_sections::set_section_addresses): Force alignment of first
4367         TLS section.
4368         * yyscript.y (exp): Call script_data_segment_align and
4369         script_data_segment_relro_end.
4370         * testsuite/relro_script_test.t: New file.
4371         * testsuite/relro_test.cc (using_script): Declare.
4372         (t1, t2): Test using_script.
4373         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
4374         (relro_script_test_SOURCES): Define.
4375         (relro_script_test_DEPENDENCIES): Define.
4376         (relro_script_test_LDFLAGS): Define.
4377         (relro_script_test_LDADD): Define.
4378         (relro_script_test.so): New target.
4379         * testsuite/Makefile.in: Rebuild.
4381 2008-08-06  Cary Coutant <ccoutant@google.com>
4383         * archive.cc (Archive::total_archives, Archive::total_members)
4384         (Archive::total_members_loaded): New variables.
4385         (Archive::setup): Add parameter.  Add option to preread
4386         archive symbols.
4387         (Archive::read_armap): Add counter.
4388         (Archive::get_file_and_offset): New function.
4389         (Archive::get_elf_object_for_member): New function.
4390         (Archive::read_all_symbols): New function.
4391         (Archive::read_symbols): New function.
4392         (Archive::add_symbols): Add counters.
4393         (Archive::include_all_members): Use armap to find members if it's
4394         already built.
4395         (Archive::include_member): Skip reading symbols if already read.
4396         Factored code into Archive::get_file_and_offset and
4397         Archive::get_elf_object_for_member.  Changed call to
4398         Mapfile::report_include_archive_member.
4399         (Archive::print_stats): New function.
4400         * archive.h: Declare Object and Read_symbols_data classes.
4401         (Archive::Archive): Add initializers for new members.
4402         (Archive::setup): Add parameter.
4403         (Archive::print_stats): New function.
4404         (Archive::total_archives, Archive::total_members)
4405         (Archive::total_members_loaded): New variables.
4406         (Archive::get_file_and_offset): New function.
4407         (Archive::get_elf_object_for_member): New function.
4408         (Archive::read_all_symbols): New function.
4409         (Archive::read_symbols): New function.
4410         (Archive::Archive_member): New class.
4411         (Archive::members_): New member.
4412         (Archive::num_members_): New member.
4413         * main.cc: Include archive.h.
4414         (main): Call Archive::print_stats.
4415         * mapfile.cc (Mapfile::report_include_archive_member): Delete
4416         archive parameter; member_name is now the fully-decorated name.
4417         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
4418         * options.h: (General_options): Add --preread-archive-symbols option.
4419         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
4420         Archive::setup.
4422 2008-08-04  Ian Lance Taylor  <iant@google.com>
4424         * symtab.h (Symbol::use_plt_offset): New function.
4425         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
4426         * powerpc.cc (Relocate::relocate): Likewise.
4427         * sparc.cc (Relocate::relocate): Likewise.
4428         * x86_64.cc (Relocate::relocate): Likewise.
4429         * testsuite/weak_plt.sh: New test.
4430         * testsuite/weak_plt_main.cc: New test.
4431         * testsuite/weak_plt_shared.cc: New test.
4432         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
4433         (check_PROGRAMS): Add weak_plt.
4434         (check_DATA): Add weak_plt_shared.so.
4435         (weak_plt_main_pic.o, weak_plt): New targets.
4436         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
4437         * testsuite/Makefile.in: Rebuild.
4439         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
4440         gcctestdir/ld.
4441         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
4442         * testsuite/Makefile.in: Rebuild.
4444 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
4446         * Makefile.am (POTFILES.in): Set LC_ALL=C.
4447         * Makefile.in: Regenerate.
4448         * po/POTFILES.in: Regenerate.
4450 2008-07-29  Ian Lance Taylor  <iant@google.com>
4452         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
4453         symbols before other symbols.
4454         * testsuite/script_test_2.cc (test_addr): Declare.
4455         (test_addr_alias): Declare.
4456         (main): Check that test_addr and test_addr_alias have the right
4457         values.
4458         * testsuite/script_test_2.t: Define test_addr_alias and
4459         test_addr.
4461 2008-07-24  Ian Lance Taylor  <iant@google.com>
4463         PR 5990
4464         * descriptors.cc: New file.
4465         * descriptors.h: New file.
4466         * gold-threads.h (class Hold_optional_lock): New class.
4467         * fileread.cc: Include "descriptors.h".
4468         (File_read::~File_read): Release descriptor rather than closing
4469         it.
4470         (File_read::open) [file]: Call open_descriptor rather than open.
4471         Set is_descriptor_opened_.
4472         (File_read::open) [memory]: Assert that descriptor is not open.
4473         (File_read::reopen_descriptor): New function.
4474         (File_read::release): Release descriptor.
4475         (File_read::do_read): Make non-const.  Reopen descriptor.
4476         (File_read::read): Make non-const.
4477         (File_read::make_view): Reopen descriptor.
4478         (File_read::do_readv): Likewise.
4479         * fileread.h (class File_read): Add is_descriptor_opened_ field.
4480         Update declarations.
4481         * layout.cc: Include "descriptors.h".
4482         (Layout::create_build_id): Use open_descriptor rather than open.
4483         * output.cc: Include "descriptors.h".
4484         (Output_file::open): Use open_descriptor rather than open.
4485         * archive.cc (Archive::const_iterator): Change Archive to be
4486         non-const.
4487         (Archive::begin, Archive::end): Make non-const.
4488         (Archive::count_members): Likewise.
4489         * archive.h (class Archive): Update declarations.
4490         * object.h (Object::read): Make non-const.
4491         * Makefile.am (CCFILES): Add descriptors.cc.
4492         (HFILES): Add descriptors.h.
4493         * Makefile.in: Rebuild.
4495         PR 6716
4496         * gold.h: Always include <clocale>.  Add Solaris workarounds
4497         following code in binutils/sysdep.h.
4499         PR 6048
4500         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
4501         this->eh_frame_hdr_ is NULL before using it.
4503         * dynobj.cc (Versions::Versions): Update comment.
4505         * dynobj.cc (Versions::Versions): If there is an soname, use it as
4506         the base version name.
4508         * stringpool.cc (Stringpool_template::add_with_length): Set key to
4509         array size plus one.
4510         (Stringpool_template::set_string_offsets): Subtract one from key
4511         before using it as an array index.
4512         (Stringpool_template::get_offset_with_length): Likewise.
4513         (Stringpool_template::write_to_buffer): Likewise.
4514         * stringpool.h (Stringpool_template::get_offset_from_key):
4515         Likewise.
4517 2008-07-23  Ian Lance Taylor  <iant@google.com>
4519         PR 6658
4520         * object.h (Merged_symbol_value::value): Do our best to handle a
4521         negative addend.
4523         PR 6647
4524         * script.cc (Version_script_info::get_versions): Don't add empty
4525         version tag to return value.
4526         (Version_script_info::get_symbol_version_helper): Change return
4527         type to bool.  Add pversion parameter.  Change all callers.
4528         (script_register_vers_node): Don't require a non-NULL tag.
4529         * script.h (class Version_script_info): Update declarations.
4530         (Version_script_info::get_symbol_version): Change return type to
4531         bool.  Add version parameter.  Change all callers.
4532         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
4533         handling.  Handle an empty version from a version script.
4534         (Symbol_table::define_special_symbol): Likewise.
4535         * testsuite/ver_test_10.script: New file.
4536         * testsuite/ver_test_10.sh: New file.
4537         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
4538         (check_DATA): Add ver_test_10.syms.
4539         (ver_test_10.syms, ver_test_10.so): New target.
4540         * testsuite/Makefile.in: Rebuild.
4542 2008-07-23  Simon Baldwin  <simonb@google.com>
4544         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
4545         to zero for undefined symbols from dynamic libraries.
4547 2008-07-23  Ian Lance Taylor  <iant@google.com>
4549         * symtab.cc (Symbol_table::resolve): Remove version parameter.
4550         Change all callers.
4551         * symtab.h (class Symbol_table): Update declaration.
4552         * testsuite/ver_test_9.cc: New file.
4553         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
4554         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
4555         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
4556         (ver_test_9.so, ver_test_9.o): New targets.
4557         * testsuite/Makefile.in: Rebuild.
4559 2008-07-22  Ian Lance Taylor  <iant@google.com>
4561         * options.h (class General_options): Define --check-sections.
4562         * layout.cc (Layout::set_segment_offsets): Handle
4563         --check-sections.
4565         * options.h (class General_options): Define -n/--nmagic and
4566         -N/--omagic.
4567         * options.cc (General_options::finalize): For -n/--nmagic or
4568         -N/--omagic, set -static.
4569         * layout.cc (Layout::attach_allocated_section_to_segment): If
4570         -N/--omagic, don't put read-only and read-write sections in
4571         different segments.
4572         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
4573         finding a read-only segment.
4574         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
4575         don't set the minimum segment alignment to the common page size,
4576         and don't set the file offset to the address modulo the page size.
4577         * script-sections.cc (Script_sections::create_segments): If
4578         -n/--omagic, don't put read-only and read-write sections in
4579         different segments.
4581         * cref.cc: New file.
4582         * cref.h: New file.
4583         * options.h (class General_options): Add --print-symbol-counts.
4584         * main.cc (main): Issue defined symbol report if requested.
4585         * archive.cc (Archive::interpret_header): Make into a const member
4586         function.
4587         (Archive::add_symbols): Call Input_objects::archive_start and
4588         archive_stop.
4589         (Archive::const_iterator): Define new class.
4590         (Archive::begin, Archive::end): New functions.
4591         (Archive::include_all_members): Rewrite to use iterator.
4592         (Archive::count_members): New function.
4593         * archive.h (class Archive): Update declarations.
4594         (Archive::filename): New function.
4595         * object.cc: Include "cref.h".
4596         (Sized_relobj::Sized_relobj): Initialize defined_count_.
4597         (Sized_relobj::do_get_global_symbol_counts): New function.
4598         (Input_objects::add_object): Add object to cross-referencer.
4599         (Input_objects::archive_start): New function.
4600         (Input_objects::archive_stop): New function.
4601         (Input_objects::print_symbol_counts): New function.
4602         * object.h: Declare Cref and Archive.
4603         (Object::get_global_symbol_counts): New function.
4604         (Object::do_get_global_symbol_counts): New pure virtual function.
4605         (class Sized_relobj): Add defined_count_ field.  Update
4606         declarations.
4607         (class Input_objects): Add cref_ field.  Update constructor.
4608         Update declarations.
4609         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
4610         defined_count_.
4611         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
4612         symbol counts.
4613         (Sized_dynobj::do_get_global_symbol_counts): New function.
4614         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
4615         defined_count_.  Update declarations.  Define Symbols typedef.
4616         * symtab.cc (Symbol_table::add_from_relobj): Add defined
4617         parameter.  Change all callers.
4618         (Symbol_table::add_from_dynobj): Add sympointers and defined
4619         parameters.  Change all callers.
4620         * symtab.h (class Symbol_table): Update declarations.
4621         * Makefile.am (CCFILES): Add cref.cc.
4622         (HFILES): Add cref.h.
4623         * Makefile.in: Rebuild.
4625 2008-07-22  Simon Baldwin  <simonb@google.com>
4627         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
4628         to zero when writing undefined symbols.
4630 2008-07-22  Ian Lance Taylor  <iant@google.com>
4632         * output.cc (Output_section::add_input_section): Don't try to
4633         merge empty merge sections.
4635 2008-07-21  Craig Silverstein  <csilvers@google.com>
4637         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
4638         Include symbol version in error message.
4640 2008-07-20  Chris Demetriou  <cgd@google.com>
4642         * configure.ac (gold_cv_c_random_seed): New configured variable.
4643         (RANDOM_SEED_CFLAGS): New substituted variable.
4644         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
4645         * configure: Rebuild.
4646         * Makefile.in: Likewise.
4647         * testsuite/Makefile.in: Likewise.
4649 2008-07-18  Ian Lance Taylor  <iant@google.com>
4651         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
4652         where we see NAME/NULL and NAME/VERSION  as separate symbols.
4653         * testsuite/ver_test_main.cc (main): Call t4.
4654         (t4, t4_2a): Define.
4655         * testsuite/ver_test_2.cc (t4_2): Define.
4656         * testsuite/ver_test_2.script: Put t4_2a in VER2.
4657         * testsuite/ver_test_4.cc (t4_2a): Define.
4658         * testsuite/ver_test_4.script: Put t4_2a in VER2.
4659         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
4661 2008-07-17  Ian Lance Taylor  <iant@google.com>
4663         * dynobj.cc (Versions::add_def): If we give an error about a
4664         missing version, go ahead and create the version anyhow.
4666 2008-07-10  Ian Lance Taylor  <iant@google.com>
4668         Handle output sections with more than 0x7fffffff bytes.
4669         * object.h (class Relobj): Change map_to_output_ to
4670         output_sections_, and just keep a section pointer.  Change all
4671         uses.  Move comdat group support to Sized_relobj.
4672         (Relobj::is_section_specially_mapped): Remove.
4673         (Relobj::output_section): Remove poff parameter.  Change all
4674         callers.
4675         (Relobj::output_section_offset): New function.
4676         (Relobj::set_section_offset): Rewrite.
4677         (Relobj::map_to_output): Remove.
4678         (Relobj::output_sections): New function.
4679         (Relobj::do_output_section_offset): New pure virtual function.
4680         (Relobj::do_set_section_offset): Likewise.
4681         (class Sized_relobj): Add section_offsets_ field.  Add comdat
4682         group support from Relobj.  Update declarations.
4683         (Sized_relobj::get_output_section_offset): New function.
4684         (Sized_relobj::do_output_section_offset): New function.
4685         (Sized_relobj::do_set_section_offset): New function.
4686         * object.cc (Relobj::output_section_address): Remove.
4687         (Sized_relobj::Sized_relobj): Initialize new fields.
4688         (Sized_relobj::include_section_group): Cast find_kept_object to
4689         Sized_relobj.
4690         (Sized_relobj::include_linkonce_section): Likewise.
4691         (Sized_relobj::do_layout): Use separate arrays for output section
4692         and output offset.
4693         (Sized_relobj::do_count_local_symbols): Change map_to_output to
4694         output_sections.
4695         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
4696         output_sections and section_offsets.
4697         (Sized_relobj::write_local_symbols): Likewise.
4698         (map_to_kept_section): Compute output address directly.
4699         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
4700         output_sections and section_offsets.
4701         (Sized_relobj::write_sections): Likewise.
4702         (Sized_relobj::relocate_sections): Likewise.
4703         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
4704         * output.h (class Output_reloc): Update declarations.  Change
4705         u2_.relobj to Sized_relobj*.
4706         (class Output_data_reloc): Change add functions to use
4707         Sized_relobj*.
4708         * output.cc (Output_reloc::Output_reloc): Change relobj to
4709         Sized_relobj*.
4710         (Output_reloc::local_section_offset): Change return type to
4711         Elf_Addr.  Use get_output_section_offset.
4712         (Output_reloc::get_address): Likewise.
4713         (Output_section::is_input_address_mapped): Don't call
4714         is_section_specially_mapped.
4715         (Output_section::output_offset): Likewise.
4716         (Output_section::output_address): Likewise.
4717         (Output_section::starting_output_address): Likewise.
4718         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
4719         parameter to Sized_relobj*.
4720         (Copy_relocs::need_copy_reloc): Likewise.
4721         (Copy_relocs::save): Likewise.
4722         * copy-relocs.h (class Copy_relocs): Update declarations.
4723         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
4724         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
4725         * target-reloc.h (relocate_for_relocatable): Change
4726         offset_in_output_section type to Elf_Addr.  Change code that uses
4727         it as well.
4728         * layout.cc (Layout::layout): Always set *off.
4729         * mapfile.cc (Mapfile::print_input_section): Use
4730         output_section_offset.
4731         * i386.cc (Target_i386::copy_reloc): Change object parameter to
4732         Sized_relobj*.
4733         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
4734         * sparc.cc (Target_sparc::copy_reloc): Likewise.
4735         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
4737 2008-07-03  Ian Lance Taylor  <iant@google.com>
4739         * layout.cc (Layout::include_section): Do not discard unrecognized
4740         SHT_STRTAB sections.
4742 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
4744         * script.cc (Lex::can_continue_name): Make '?' allowable in
4745         version-script names.
4746         * testsuite/version_script.map: Change glob pattern to use '?'
4748 2008-06-30  Manish Singh  <yosh@gimp.org>
4750         PR 6585
4751         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
4752         Correct typo.
4754 2008-06-30  Ian Lance Taylor  <iant@google.com>
4756         PR 6660
4757         PR 6682
4758         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
4759         versions]: Don't try to read the value in the contents, since we
4760         don't use it.  Use the template endianness when writing.
4762 2008-06-25  Cary Coutant  <ccoutant@google.com>
4764         * fileread.cc (File_read::make_view): Assert on zero-length view.
4765         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
4766         symbol table when there are no symbols to read.
4768 2008-06-23  Craig Silverstein  <csilvers@google.com>
4770         * version.cc (version_string): Bump to 1.7
4772 2008-06-18  Craig Silverstein  <csilvers@google.com>
4774         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
4775         constant 0xFFFF to type Valtype.
4776         (Powerpc_relocate_functions::rel16_ha): Likewise.
4778 2008-06-17  Ian Lance Taylor  <iant@google.com>
4780         * output.h (Output_section::Input_section): Initialize p2align_ to
4781         zero for Output_section_data constructors.
4782         (Output_section::Input_section::addralign): If not an input
4783         section, return the alignment of the Output_section_data.
4784         * testsuite/copy_test.cc: New file.
4785         * testsuite/copy_test_1.cc: New file.
4786         * testsuite/copy_test_2.cc: New file.
4787         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
4788         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
4789         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
4790         (copy_test_1_pic.o, copy_test_1.so): New targets.
4791         (copy_test_2_pic.o, copy_test_2.so): New targets.
4792         * testsuite/Makefile.in: Rebuild.
4794         * script-sections.cc (Script_sections::place_orphan): Initialize
4795         local variable exact.
4797 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
4799         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
4801 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
4802             David S. Miller  <davem@davemloft.net>
4804         * powerpc.cc: New file.
4805         * Makefile.am (TARGETSOURCES): Add powerpc.cc
4806         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
4807         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
4808         * Makefile.in: Rebuild.
4810 2008-06-09  Ian Lance Taylor  <iant@google.com>
4812         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
4813         <exception>.
4814         (throwing, orig_terminate): New static variables.
4815         (terminate_handler): New static function.
4816         (t2): Set terminate handler.
4818 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
4820         PR 6584
4821         * binary.cc (Binary_to_elf::sized_convert): Fix .data
4822         alignment.
4824 2008-05-30  Cary Coutant  <ccoutant@google.com>
4826         * archive.cc (Archive::include_all_members) Correct to step
4827         over symbol table and extended name table in thin archives.
4829 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
4831         PR 6407
4832         * target-reloc.h (relocate_for_relocatable): Fix new_offset
4833         calculation.
4835 2008-05-28  Caleb Howe  <cshowe@google.com>
4837         * reduced_debug_output.cc: New file.
4838         * reduced_debug_output.h: New file.
4839         * options.h (class General_options): Add --strip-debug-non-line.
4840         * options.cc (General_options::finalize): Add strip_debug_non_line
4841         to the strip heirarchy.
4842         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
4843         fields.
4844         * layout.cc: Include "reduced_debug_output.h".
4845         (Layout::Layout): Initialize new fields.
4846         (line_only_debug_sections): New static array.
4847         (is_lines_only_debug_sections): New static inline function.
4848         (Layout::include_section): Handle --strip-debug-non-line.
4849         (Layout::make_output_section): If --strip-debug-non-line, build
4850         new output sections for .debug_abbrev and .debug_info.
4851         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
4852         gold.  Warn about possible overflow.
4853         (read_signed_LEB_128): Likewise.
4854         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
4855         (read_signed_LEB_128): Declare.
4856         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
4857         (HFILES): Add reduced_debug_output.h.
4858         * Makefile.in: Rebuild.
4860 2008-05-21  Ian Lance Taylor  <iant@google.com>
4862         * mapfile.cc: New file.
4863         * mapfile.h: New file.
4864         * options.h (class General_options): Add -M/--print-map and -Map.
4865         * options.cc (General_options::finalize): Make -M equivalent to
4866         -Map -.
4867         * main.cc: Include <cstdio> and "mapfile.h".
4868         (main): Open mapfile if requested.
4869         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
4870         constructor.  Change caller.
4871         (queue_initial_tasks): Add mapfile parameter.  Change caller.
4872         (queue_middle_tasks): Likewise.
4873         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
4874         declarations.
4875         * archive.cc: Include "mapfile.h".
4876         (Archive::add_symbols): Add mapfile parameter.  Change all
4877         callers.  Pass mapfile, symbol, and reason to include_member.
4878         (Archive::include_all_members): Add mapfile parameter.  Change all
4879         callers.
4880         (Archive::include_member): Add mapfile, sym, and why parameters.
4881         Change all callers.  Report inclusion to map file.
4882         * archive.h: Include "fileread.h".
4883         (class Archive): Update declarations.
4884         (Archive::file): New const method.
4885         (class Add_archive_symbols): Add mapfile_ field.  Update
4886         constructor.  Change all callers.
4887         * readsyms.h (class Read_symbols): Likewise.
4888         (class Finish_group): Likewise.
4889         (class Read_script): Likewise.
4890         * common.cc: Include "mapfile.h".
4891         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
4892         all callers.
4893         (Symbol_table::do_allocate_commons): Likewise.
4894         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
4895         symbol allocation to mapfile.
4896         * common.h (class Allocate_commons_task): Add mapfile_ field.
4897         Update constructor.  Change all callers.
4898         * symtab.h (class Symbol_table): Update declarations.
4899         * layout.cc: Include "mapfile.h".
4900         (Layout_task_runner::run): Print information to mapfile.
4901         (Layout::create_gold_note): Change Output_data_fixed_space to
4902         Output_data_zero_fill.
4903         (Layout::create_build_id): Likewise.
4904         (Layout::print_to_mapfile): New function.
4905         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
4906         constructor.  Change caller.
4907         (class Layout): Declare print_to_mapfile.
4908         * output.cc (Output_section::Input_section::print_to_mapfile): New
4909         function.
4910         (Output_section::add_input_section): If producing a map, always
4911         add to input_sections_ list.
4912         (Output_section::do_print_to_mapfile): New function.
4913         (Output_segment::print_sections_to_mapfile): New function.
4914         (Output_segment::print_section_list_to_mapfile): New function.
4915         * output.h: Include "mapfile.h".
4916         (Output_data::print_to_mapfile): New function.
4917         (Output_data::do_print_to_mapfile): New virtual function.
4918         (Output_segment_headers::do_print_to_mapfile): New function.
4919         (Output_file_header::do_print_to_mapfile): New function.
4920         (Output_data_const::do_print_to_mapfile): New function.
4921         (class Output_data_const_buffer): Add map_name_ field.  Update
4922         constructor.  Change all callers.  Add do_print_to_mapfile
4923         function.
4924         (class Output_data_fixed_space): Likewise.
4925         (class Output_data_space): Likewise.
4926         (class Output_data_zero_fill): New class.
4927         (Output_data_strtab::do_print_to_mapfile): New function.
4928         (Output_data_reloc_base::do_print_to_mapfile): New function.
4929         (Output_relocatable_relocs::do_print_to_mapfile): New function.
4930         (Output_data_group::do_print_to_mapfile): New function.
4931         (Output_data_got::do_print_to_mapfile): New function.
4932         (Output_data_dynamic::do_print_to_mapfile): New function.
4933         (Output_symtab_xindex::do_print_to_mapfile): New function.
4934         (class Output_section): Declare do_print_to_mapflie.  Declare
4935         print_to_mapfile in Input_section.
4936         (class Output_segment): Declare new functions.
4937         * object.h (Sized_relobj::symbol_count): New function.
4938         * script-sections.cc
4939         (Output_section_element_dot_assignment::set_section_addresses):
4940         Change Output_data_fixed_space to Output_data_zero_fill.
4941         (Output_data_expression::do_print_to_mapfile): New function.
4942         * script.cc (read_input_script): Add mapfile parameter.  Change
4943         all callers.
4944         * script.h (read_input_script): Update declaration.
4945         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
4946         (Eh_frame::do_print_to_mapfile): New function.
4947         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
4948         (Output_merge_string::do_print_to_mapfile): New function.
4949         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
4950         function.
4951         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
4952         function.
4953         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
4954         function.
4955         * Makefile.am (CCFILES): Add mapfile.cc.
4956         (HFILES): Add mapfile.h.
4957         * Makefile.in: Rebuild.
4959 2008-05-19  Ian Lance Taylor  <iant@google.com>
4961         * options.h (class General_options): Add -z relro.
4962         * layout.cc (Layout::Layout): Initialize relro_segment_.
4963         (Layout::add_output_section_data): Return the output section.
4964         (Layout::make_output_section): Rcognize relro sections and mark
4965         them appropriately.
4966         (Layout::attach_allocated_section_to_segment): Put relro sections
4967         in a PT_GNU_RELRO segment.
4968         (Layout::create_initial_dynamic_sections): Mark the .dynamic
4969         section as relro.
4970         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
4971         PT_TLS segments.
4972         (Layout::linkonce_mapping): Map d.rel.ro.local to
4973         .data.rel.ro.local.
4974         (Layout::output_section_name): Us .data.rel.ro.local for any
4975         section which begins with that.
4976         * layout.h (class Layout): Update add_output_section_data
4977         declaration.  Add relro_segment_ field.
4978         * output.cc (Output_section::Output_section): Initialize is_relro_
4979         and is_relro_local_ fields.
4980         (Output_segment::add_output_section): Group relro sections.
4981         (Output_segment::is_first_section_relro): New function.
4982         (Output_segment::maximum_alignment): If there is a relro section,
4983         align the segment to the common page size.
4984         (Output_segment::set_section_addresses): Track whether we are
4985         looking at relro sections.  If the last section is a relro
4986         section, align to the common page size.
4987         (Output_segment::set_section_list_addresses): Add in_relro
4988         parameter.  Change all callers.  Align to the page size when
4989         moving from relro to non-relro section.
4990         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
4991         segment.
4992         * output.h (class Output_section): Add is_relro_ and
4993         is_relro_local_ fields.
4994         (Output_section::is_relro): New function.
4995         (Output_section::set_is_relro): New function.
4996         (Output_section::is_relro_local): New function.
4997         (Output_section::set_is_relro_local): New function.
4998         (class Output_segment): Update declarations.
4999         * i386.cc (Target_i386::got_section): Mark .got section as relro.
5000         * sparc.cc (Target_sparc::got_section): Likewise.
5001         * x86_64.cc (Target_x86_64::got_section): Likewise.
5002         * testsuite/relro_test_main.cc: New file.
5003         * testsuite/relro_test.cc: New file.
5004         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
5005         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
5006         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
5007         (relro_test.so, relro_test_pic.o): New targets.
5008         * testsuite/Makefile.in: Rebuild.
5010 2008-05-16  Ian Lance Taylor  <iant@google.com>
5012         * output.cc (Output_segment::add_output_section): Remove front
5013         parameter.
5014         * output.h (class Output_segment): Remove
5015         add_initial_output_section and overloaded add_output_section.
5016         Update declaration of remaining add_output_section.
5017         * layout.cc (Layout::create_interp): Call add_output_section
5018         rather than add_initial_output_section.
5019         (Layout::finish_dynamic_section): Likewise.
5021         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
5022         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
5023         know the dynamic type.
5024         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
5025         field.  Initialize it in constructor.
5026         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
5027         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
5028         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
5029         reloc.
5031         * output.cc (Output_reloc::get_address): Change return type to
5032         Elf_Addr.
5033         * output.h (class Output_reloc): Update get_address declaration.
5034         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
5035         for section addresses.
5037 2008-05-09  Ian Lance Taylor  <iant@google.com>
5039         PR 6493
5040         * gold.cc (gold_nomem): Use return value of write.
5042 2008-05-08  Ian Lance Taylor  <iant@google.com>
5044         * symtab.c (Symbol::init_base_output_data): Add version
5045         parameter.  Change all callers.
5046         (Symbol::init_base_output_segment): Likewise.
5047         (Symbol::init_base_constant): Likewise.
5048         (Symbol::init_base_undefined): Likewise.
5049         (Sized_symbol::init_output_data): Likewise.
5050         (Sized_symbol::init_output_segment): Likewise.
5051         (Sized_symbol::init_constant): Likewise.
5052         (Sized_symbol::init_undefined): Likewise.
5053         (Symbol_table::do_define_in_output_data): If the new symbol has a
5054         version, mark it as the default.
5055         (Symbol_table::do_define_in_output_segment): Likewise.
5056         (Symbol_table::do_define_as_constant): Likewise.
5057         * symtab.h (class Symbol): Update declarations.
5058         (class Sized_symbol): Likewise.
5059         * resolve.cc (Symbol::override_version): New function.
5060         (Symbol::override_base): Call override_version.
5061         (Symbol::override_base_with_special): Likewise.
5062         * testsuite/ver_script_8.script: New file.
5063         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
5064         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
5065         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
5066         (ver_test_8_1.so, ver_test_8_2.so): New targets.
5068 2008-05-06  Ian Lance Taylor  <iant@google.com>
5070         PR 6049
5071         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
5072         functions.
5073         (class General_options): Remove existing --undefined, and add
5074         --no-undefined instead.  Add new --undefined as synonym for -u.
5075         * archive.cc (Archive::add_symbols): Check whether symbol was
5076         named with -u.
5077         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
5078         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
5079         all uses.  Add IS_UNDEFINED.  Update declarations to split
5080         different versions of init_base.  Declare init_base_undefined.
5081         (Symbol::is_defined): Handle IS_UNDEFINED.
5082         (Symbol::is_undefined): Likewise.
5083         (Symbol::is_weak_undefined): Call is_undefined.
5084         (Symbol::is_absolute): Handle IS_CONSTANT.
5085         (class Sized_symbol): Update declarations to split different
5086         versions of init.  Declare init_undefined.
5087         (class Symbol_table): Declare new functions.
5088         * symtab.cc (Symbol::init_base_object): Rename from init_base.
5089         Change all callers.
5090         (Symbol::init_base_output_data): Likewise.
5091         (Symbol::init_base_output_segment): Likewise.
5092         (Symbol::init_base_constant): Likewise.
5093         (Symbol::init_base_undefined): New function.
5094         (Sized_symbol::init_object): Rename from init.  Change all
5095         callers.
5096         (Sized_symbol::init_output_data): Likewise.
5097         (Sized_symbol::init_output_segment): Likewise.
5098         (Sized_symbol::init_constant): Likewise.
5099         (Sized_symbol::init_undefined): New function.
5100         (Symbol_table::add_undefined_symbols_from_command_line): New
5101         function.
5102         (Symbol_table::do_add_undefined_symbols_from_command_line): New
5103         function.
5104         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
5105         (Symbol::output_section): Likewise.
5106         (Symbol::set_output_section): Likewise.
5107         (Symbol_table::sized_finalize_symbol): Likewise.
5108         (Symbol_table::sized_write_globals): Likewise.
5109         * resolve.cc (Symbol_table::should_override): Likewise.
5110         (Symbol::override_base_with_special): Likewise.
5112         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
5113         symbol, change it to have default visibility.
5114         * testsuite/protected_1.cc: New file.
5115         * testsuite/protected_2.cc: New file.
5116         * testsuite/protected_3.cc: New file.
5117         * testsuite/protected_main_1.cc: New file.
5118         * testsuite/protected_main_2.cc: New file.
5119         * testsuite/protected_main_3.cc: New file.
5120         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
5121         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
5122         (protected_1_LDFLAGS, protected_1_LDADD): Define.
5123         (protected_1.so): New target.
5124         (protected_1_pic.o, protected_2_pic.o): New targets.
5125         (protected_3_pic.o): New target.
5126         (check_PROGRAMS): Add protected_2.
5127         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
5128         (protected_2_LDFLAGS, protected_2_LDADD): Define.
5129         * testsuite/Makefile.in: Rebuild.
5131         * options.h (DEFINE_var): Add set_user_set_##varname__.
5132         (DEFINE_bool_alias): New macro.
5133         (class General_options): Define -Bstatic using DEFINE_bool_alias
5134         rather than DEFINE_special.  Add --undefined as an alias for -z
5135         defs.
5136         * options.cc (General_options::parse_Bstatic): Remove.
5138         * options.h (class General_options): Add --fatal-warnings.
5139         * main.cc (main): Implement --fatal-warnings.
5140         * errors.h (Errors::warning_count): New function.
5142         * options.h (class General_options): Add -Bsymbolic-functions.
5143         * symtab.h (Symbol::is_preemptible): Check for
5144         -Bsymbolic-functions.
5146 2008-05-05  Ian Lance Taylor  <iant@google.com>
5148         * options.h (DEFINE_bool): For DASH_Z, create the negative option
5149         as noVARNAME rather than no-VARNAME.
5150         (class General_options): Add option -z combreloc.
5151         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
5152         get_address.
5153         (Output_reloc::sort_before) [SHT_REL]: New function.
5154         (Output_reloc::sort_before) [SHT_RELA]: New function.
5155         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
5156         Sort_relocs_comparison.
5157         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
5158         parameter.  Change all callers.
5159         (Output_data_reloc::Output_data_reloc) [both versions]: Add
5160         sort_relocs parameter.  Change all callers.
5161         * output.cc (Output_reloc::get_address): New function, broken out
5162         of write_rel.
5163         (Output_reloc::write_rel): Call it.
5164         (Output_reloc::compare): New function.
5165         (Output_data_reloc_base::do_write): Optionally sort relocs.
5167         * configure.ac: If targ_extra_obj is set, link it in.
5168         * configure.tgt: Initialize all variables.
5169         (x86_64*): Set targ_extra_obj and targ_extra_size.
5170         * configure: Rebuild.
5172         * object.cc (Sized_relobj::include_section_group): Adjust section
5173         indexes read from group data.  Build vector to pass to
5174         layout_group.
5175         * layout.cc (Layout::layout_group): Add flags and shndxes
5176         parameters.  Remove contents parameter.  Change caller.  Update
5177         explicit instantiations.
5178         * layout.h (class Layout): Update layout_group declaration.
5179         * output.cc (Output_data_group::Output_data_group): Add flags and
5180         input_shndxes parameters.  Remove contents parameter.  Change
5181         caller.
5182         (Output_data_group::do_write): Change input_sections_ to
5183         input_shndxes_.
5184         * output.h (class Output_data_group): Update constructor
5185         declaration.  Rename input_sections_ to input_shndxes_.
5186         * testsuite/many_sections_test.cc: Add template.
5188 2008-04-30  Cary Coutant  <ccoutant@google.com>
5190         * target-reloc.h (relocate_section): Fix dead-pointer bug.
5192         * layout.cc (Layout::include_section): Refactored check for debug
5193         info section.
5194         (Layout::add_comdat): Add new parameters.  Change type
5195         of signature parameter.  Add object and shndx to signatures table.
5196         (Layout::find_kept_object): New function.
5197         * layout.h: Include <cstring>.
5198         (Layout::is_debug_info_section): New function.
5199         (Layout::add_comdat): Add new parameters.
5200         (Layout::find_kept_object): New function.
5201         (Layout::Kept_section): New struct.
5202         (Layout::Signatures): Change type of map range.
5203         * object.cc (Relobj::output_section_address): New function.
5204         (Sized_relobj::include_section_group): Add new parameters.  Change
5205         calls to Layout::add_comdat.  Change to build table of kept comdat
5206         groups and table mapping discarded sections to kept sections.
5207         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
5208         (Sized_relobj::do_layout): Change calls to include_section_group and
5209         include_linkonce_section.
5210         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
5211         value to zero when section is discarded.
5212         (Sized_relobj::map_to_kept_section): New function.
5213         * object.h (Relobj::output_section_address): New function.
5214         (Relobj::Comdat_group): New type.
5215         (Relobj::find_comdat_group): New function.
5216         (Relobj::Comdat_group_table): New type.
5217         (Relobj::Kept_comdat_section): New type.
5218         (Relobj::Kept_comdat_section_table): New type.
5219         (Relobj::add_comdat_group): New function.
5220         (Relobj::set_kept_comdat_section): New function.
5221         (Relobj::get_kept_comdat_section): New function.
5222         (Relobj::comdat_groups_): New field.
5223         (Relobj::kept_comdat_sections_): New field.
5224         (Symbol_value::input_value): Update comment.
5225         (Sized_relobj::map_to_kept_section) New function.
5226         (Sized_relobj::include_linkonce_section): Add new parameter.
5227         * target-reloc.h (Comdat_behavior): New type.
5228         (get_comdat_behavior): New function.
5229         (relocate_section): Add code to map a discarded section to the
5230         corresponding kept section when applying a relocation.
5232 2008-04-30  Craig Silverstein  <csilvers@google.com>
5234         * dwarf_reader.cc (next_generation_count): New static var.
5235         (Addr2line_cache_entry): New struct.
5236         (addr2line_cache): New static var.
5237         (Dwarf_line_info::one_addr2line): Added caching.
5238         (Dwarf_line_info::clear_addr2line_cache): New function.
5239         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
5240         cache-size parameter.
5241         (Dwarf_line_info::one_addr2line_cache): New function.
5242         * symtab.cc (Symbol_table::detect_odr_violations): Pass
5243         new cache-size argument to one_addr2line(), and clear cache.
5245 2008-04-28  Cary Coutant  <ccoutant@google.com>
5247         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
5248         R_386_PC8 relocations.
5250 2008-04-23  Ian Lance Taylor  <iant@google.com>
5252         * object.cc (Sized_relobj::include_section_group): Check for
5253         invalid section group.
5255         * object.cc (make_elf_object): Correct test for 64-bit ELF file
5256         header size.
5258         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
5259         than read for file header.
5260         * archive.cc (Archive::include_member): Likewise.
5262 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
5264         * aclocal.m4: Regenerate.
5265         * configure: Regenerate.
5267 2008-04-19  Ian Lance Taylor  <iant@google.com>
5269         * version.cc (version_string): Bump to 1.6.
5271         * testsuite/Makefile.am (many_sections_r_test): New target.
5272         (many_sections_r_test_SOURCES): Remove.
5273         (many_sections_r_test_DEPENDENCIES): Remove.
5274         (many_sections_r_test_LDFLAGS): Remove.
5275         (many_sections_r_test_LDADD): Remove.
5277         * object.cc (Sized_relobj::do_add_symbols): Always pass
5278         local_symbol_count_ to add_from_relobj.
5280         * testsuite/Makefile.am (many_sections_check.h): Only check one in
5281         every thousand variables.
5282         * testsuite/Makefile.in: Rebuild.
5284         * object.cc (Xindex::initialize_symtab_xindex): New function.
5285         (Xindex::read_symtab_xindex): New function.
5286         (Xindex::sym_xindex_to_shndx): New function.
5287         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
5288         available.
5289         (Sized_relobj::do_initialize_xindex): New function.
5290         (Sized_relobj::do_read_symbols): Adjust section links.
5291         (Sized_relobj::symbol_section_and_value): Add is_ordinary
5292         parameter.  Change all callers.
5293         (Sized_relobj::include_section_group): Adjust section links and
5294         symbol section indexes.
5295         (Sized_relobj::do_layout): Adjust section links.
5296         (Sized_relobj::do_count_local_symbols): Adjust section links and
5297         symbol section indexes.
5298         (Sized_relobj::do_finalize_local_symbols): Distinguish between
5299         ordinary and special symbols.
5300         (Sized_relobj::write_local_symbols): Add symtab_xindex and
5301         dynsym_xindex parameters.  Change all callers.  Adjust section
5302         links.  Use SHN_XINDEX when needed.
5303         (Sized_relobj::get_symbol_location_info): Adjust section links.
5304         Don't get fooled by special symbols.
5305         * object.h (class Xindex): Define.
5306         (class Object): Add xindex_ parameter.  Declare virtual functoin
5307         do_initialize_xindex.
5308         (Object::adjust_sym_shndx): New function.
5309         (Object::set_xindex): New protected function.
5310         (class Symbol_value): Add is_ordinary_shndx_ field.
5311         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
5312         (Symbol_value::value): Assert ordinary section.
5313         (Symbol_value::initialize_input_to_output_map): Likewise.
5314         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
5315         Change all callers.
5316         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
5317         all callers.
5318         (class Sized_relobj): Update declarations.
5319         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
5320         parameter.  Change all callers.
5321         (Sized_relobj::adjust_shndx): New function.
5322         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
5323         field.
5324         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
5325         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
5326         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
5327         (Sized_dynobj::read_dynsym_section): Adjust section links.
5328         (Sized_dynobj::read_dynamic): Likewise.
5329         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
5330         section links.
5331         (Sized_dynobj::do_initialize_xindex): New function.
5332         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
5333         do_initialize_xindex.
5334         (Sized_dynobj::adjust_shndx): New function.
5335         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
5336         dynsym_xindex_ fields.
5337         (Layout::finalize): Add a call to set_section_indexes before
5338         creating the symtab sections.
5339         (Layout::set_section_indexes): Don't do anything if the section
5340         already has a section index.
5341         (Layout::create_symtab_sections): Add shnum parameter.  Change
5342         caller.  Create .symtab_shndx section if needed.
5343         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
5344         caller.
5345         (Layout::allocated_output_section_count): New function.
5346         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
5347         needed.
5348         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
5349         fields.  Update declarations.
5350         (Layout::symtab_xindex): New function.
5351         (Layout::dynsym_xindex): New function.
5352         (class Write_symbols_task): Add layout_ field.
5353         (Write_symbols_task::Write_symbols_task): Add layout parameter.
5354         Change caller.
5355         * output.cc (Output_section_headers::Output_section_headers): Add
5356         shstrtab_section parameter.  Change all callers.
5357         (Output_section_headers::do_sized_write): Store overflow values
5358         for section count and section string table section index in
5359         section header zero.
5360         (Output_file_header::do_sized_write): Check for overflow of
5361         section count and section string table section index.
5362         (Output_symtab_xindex::do_write): New function.
5363         (Output_symtab_xindex::endian_do_write): New function.
5364         * output.h (class Output_section_headers): Add shstrtab_section_.
5365         Update declarations.
5366         (class Output_symtab_xindex): Define.
5367         (Output_section::has_out_shndx): New function.
5368         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
5369         field.
5370         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
5371         Change all callers.
5372         (Sized_symbol::init): Likewise.
5373         (Symbol::output_section): Check for ordinary symbol.
5374         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
5375         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
5376         callers.
5377         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
5378         Change all callers.  Simplify handling of symbols from sections
5379         not included in the link.
5380         (Symbol_table::add_from_dynobj): Handle ordinary symbol
5381         distinction.
5382         (Weak_alias_sorter::operator()): Assert that symbols are
5383         ordinary.
5384         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
5385         distinction.
5386         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
5387         parameters.  Change all callers.
5388         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
5389         symbol distinction.  Use SHN_XINDEX when needed.
5390         (Symbol_table::write_section_symbol): Add symtab_xindex
5391         parameter.  Change all callers.
5392         (Symbol_table::sized_write_section_symbol): Likewise.  Use
5393         SHN_XINDEX when needed.
5394         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
5395         declarations.
5396         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
5397         (Symbol::is_defined): Check is_ordinary.
5398         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
5399         (Symbol::is_absolute, Symbol::is_common): Likewise.
5400         (class Sized_symbol): Update declarations.
5401         (class Symbol_table): Update declarations.
5402         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
5403         parameters.  Change all callers.
5404         (Sized_symbol::override): Likewise.
5405         (Symbol_table::override): Likewise.
5406         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
5407         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
5408         is_ordinary, and orig_st_shndx parameters.  Change all callers.
5409         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
5410         to be in an ordinary section.
5411         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
5412         object and is_ordinary parameters.  Change all callers.
5413         (Sized_dwarf_line_info::read_relocs): Add object parameter.
5414         Change all callers.  Don't add undefined or non-ordinary symbols
5415         to reloc_map_.
5416         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
5417         Change all callers.
5418         * dwarf_reader.h (class Sized_dwarf_line_info): Update
5419         declarations.
5420         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
5421         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
5422         (Sized_relobj::relocate_sections): Likewise.
5423         * target-reloc.h (scan_relocs): Adjust section symbol index.
5424         (scan_relocatable_relocs): Likewise.
5425         * i386.cc (Scan::local): Check for ordinary symbols.
5426         * sparc.cc (Scan::local): Likewise.
5427         * x86_64.cc (Scan::local): Likewise.
5428         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
5429         to symbol_section_and_value.
5430         * testsuite/many_sections_test.cc: New file.
5431         * testsuite/Makefile.am (BUILT_SOURCES): Define.
5432         (check_PROGRAMS): Add many_sections_test.
5433         (many_sections_test_SOURCES): Define.
5434         (many_sections_test_DEPENDENCIES): Define.
5435         (many_sections_test_LDFLAGS): Define.
5436         (BUILT_SOURCES): Add many_sections_define.h.
5437         (many_sections_define.h): New target.
5438         (BUILT_SOURCES): Add many_sections_check.h.
5439         (many_sections_check.h): New target.
5440         (check_PROGRAMS): Add many_sections_r_test.
5441         (many_sections_r_test_SOURCES): Define.
5442         (many_sections_r_test_DEPENDENCIES): Define.
5443         (many_sections_r_test_LDFLAGS): Define.
5444         (many_sections_r_test_LDADD): Define.
5445         (many_sections_r_test.o): New target.
5446         * testsuite/Makefile.in: Rebuild.
5448 2008-04-17  Cary Coutant  <ccoutant@google.com>
5450         * errors.cc (Errors::info): New function.
5451         (gold_info): New function.
5452         * errors.h (Errors::info): New function.
5453         * gold.h (gold_info): New function.
5454         * object.cc (Input_objects::add_object): Print trace output.
5455         * options.cc (options::parse_set): New function.
5456         (General_options::parse_wrap): Deleted.
5457         (General_options::General_options): Deleted initializer.
5458         * options.h (options::String_set): New typedef.
5459         (options::parse_set): New function.
5460         (DEFINE_set): New macro.
5461         (General_options::wrap): Changed to use DEFINE_set. Changed
5462         callers of any_wrap_symbols and is_wrap_symbol.
5463         (General_options::trace, General_options::trace_symbol):
5464         New options.
5465         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
5466         (General_options::wrap_symbols_): Deleted.
5467         * symtab.cc (Symbol_table::add_from_object): Print trace output.
5469 2008-04-17  David S. Miller  <davem@davemloft.net>
5471         * options.cc (General_options::parse_V): New function.
5472         * options.h: Add entries for -V and -Qy.
5474 2008-04-17  Ian Lance Taylor  <iant@google.com>
5476         * common.cc (Symbol_table::allocate_commons): Remove options
5477         parameter.  Change caller.
5478         (Symbol_table::do_allocate_commons): Remove options parameter.
5479         Change caller.  Just call do_allocate_commons_list twice.
5480         (Symbol_table::do_allocate_commons_list): New function, broken out
5481         of do_allocate_commons.
5482         * common.h (class Allocate_commons_task): Remove options_ field.
5483         Update constructor.
5484         * symtab.cc (Symbol_table::Symbol_table): Initialize
5485         tls_commons_.
5486         (Symbol_table::add_from_object): Put TLS common symbols on
5487         tls_commons_ list.
5488         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
5489         which are IN_OUTPUT_DATA.
5490         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
5491         allocate_commons and do_allocate_commons declarations.  Declare
5492         do_allocate_commons_list.
5493         * gold.cc (queue_middle_tasks): Update creation of
5494         Allocate_commons_task to not pass options.
5495         * testsuite/Makefile.am (INCLUDES): Add -I.. .
5496         (TLS_TEST_C_FLAGS): New variable.
5497         (tls_test_c_pic.o): New target.
5498         (tls_test_shared.so): Link in tls_test_c_pic.o.
5499         (tls_test_c_pic_ie.o): New target.
5500         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
5501         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
5502         (tls_test_c.o): New target.
5503         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
5504         (tls_pic_test_LDADD): Likewise.
5505         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
5506         (tls_shared_gd_to_ie_test_LDADD): Likewise.
5507         (tls_test_c_gnu2.o): New target.
5508         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
5509         tls_test_c_gnu2.o.
5510         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
5511         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
5512         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
5513         * testsuite/tls_test.cc: Include "config.h".
5514         (t_last): Call t11_last.
5515         * testsuite/tls_test.h (t11, t11_last): Declare.
5516         * testsuite/tls_test_c.c: New file.
5517         * testsuite/tls_test_main.cc (thread_routine): Call t11.
5518         * configure.ac: Check for OpenMP support.
5519         * configure, config.in, Makefile.in: Rebuild.
5520         * testsuite/Makefile.in: Rebuild.
5522 2008-04-16  Cary Coutant  <ccoutant@google.com>
5524         * i386.cc (Target_i386::define_tls_base_symbol): New function.
5525         (Target_i386::tls_base_symbol_defined_): New field.
5526         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5527         (Target_i386::Scan::global): Likewise.
5528         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
5529         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
5530         (Target_x86_64::tls_base_symbol_defined_): New field.
5531         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
5532         (Target_x86_64::Scan::global): Likewise.
5534 2008-04-16  Cary Coutant  <ccoutant@google.com>
5536         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
5537         (Symbol::needs_plt_entry): Allow weak undefined symbols.
5538         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
5539         building shared libraries.
5540         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
5541         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
5542         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
5543         * testsuite/Makefile.in: Rebuild.
5544         * testsuite/weak_undef.h: New file.
5545         * testsuite/weak_undef_file1.cc: Add extra test cases.
5546         * testsuite/weak_undef_file2.cc: Likewise.
5547         * testsuite/weak_undef_test.cc: Likewise.
5549 2008-04-16  David S. Miller  <davem@davemloft.net>
5551         * sparc.cc (Target_sparc::Scan): Change from struct to class.
5552         Add issued_non_pic_error_ field.  Declare check_non_pic.
5553         (Target_sparc::Scan::check_non_pic): New function.
5554         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
5555         (Target_sparc::Scan::global): Likewise.
5557         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
5558         * configure: Rebuild.
5560         * options.h (DEFINE_enable): New macro.
5561         (new_dtags): New enable option.
5562         (initfirst, interpose, loadfltr, nodefaultlib,
5563         nodelete, nodlopen, nodump): New -z options.
5564         * layout.cc (Layout:finish_dynamic_section): If new
5565         dtags enabled, emit DT_RUNPATH.  Also, emit a
5566         DT_FLAGS_1 containing any specified -z flags.
5568 2008-04-16  Ian Lance Taylor  <iant@google.com>
5570         * copy-relocs.cc: New file.
5571         * copy-relocs.h: New file.
5572         * reloc.cc: Remove Copy_relocs code.
5573         * reloc.h: Likewise.
5574         * reloc-types.h (struct Reloc_types) [both versions]: Add
5575         get_reloc_addend_noerror.
5576         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
5577         variants of add_global which take an addend which must be zero.
5578         * i386.cc: Include "copy-relocs.h".
5579         (class Target_i386): Change type of copy_relocs_ to variable,
5580         update initializer.
5581         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
5582         Change all callers.
5583         (Target_i386::do_finalize_sections): Change handling of
5584         copy_relocs_.
5585         * sparc.cc: Include "copy-relocs.h".
5586         (class Target_sparc): Change type of copy_relocs_ to variable,
5587         update initializer.
5588         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
5589         Change all callers.
5590         (Target_sparc::do_finalize_sections): Change handling of
5591         copy_relocs_.
5592         * x86_64.cc: Include "copy-relocs.h".
5593         (class Target_x86_64): Change type of copy_relocs_ to variable,
5594         update initializer.
5595         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
5596         class.  Change all callers.
5597         (Target_x86_64::do_finalize_sections): Change handling of
5598         copy_relocs_.
5599         * Makefile.am (CCFILES): Add copy-relocs.cc.
5600         (HFILES): Add copy-relocs.h.
5602         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
5604         * testsuite/script_test_4.sh: Permit leading zeroes.
5606 2008-04-15  Ian Lance Taylor  <iant@google.com>
5608         * script-sections.cc (Script_sections::create_segments): Use
5609         header_size_adjustment even when there is enough room for the
5610         headers.
5611         * testsuite/script_test_4.sh: New file.
5612         * testsuite/script_test_4.t: New file.
5613         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
5614         (check_DATA): Add script_test_4.stdout.
5615         (MOSTLYCLEANFILES): Likewise.
5616         (script_test_4): New target.
5617         (script_test_4.stdout): New target.
5618         * testsuite/Makefile.in: Rebuild.
5620         * sparc.cc: Add definitions for Output_data_plt_sparc class
5621         constants.
5623 2008-04-14  David S. Miller  <davem@davemloft.net>
5625         * sparc.cc: New file.
5626         * Makefile.am (TARGETSOURCES): Add sparc.cc
5627         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
5628         * configure.tgt: Document targ_extra_size and
5629         targ_extra_big_endian.  Add entries for sparc-* and
5630         sparc64-*.
5631         * configure.ac: Handle targ_extra_size and
5632         targ_extra_big_endian.
5633         * Makefile.in: Rebuild.
5634         * configure: Likewise.
5635         * po/POTFILES.in: Likewise.
5636         * po/gold.pot: Likewise.
5638 2008-04-14  Ian Lance Taylor  <iant@google.com>
5640         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
5641         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
5642         in the name/type/flags to section mapping.  Don't call
5643         allocate_output_section.
5644         (Layout::choose_output_section): Change parameter from adjust_name
5645         to is_input_section.  Don't permit input sections after sections
5646         are attached to segments.  Don't call allocate_output_section.
5647         (Layout::layout_eh_frame): Call update_flags_for_input_section,
5648         not write_enable_output_section.
5649         (Layout::make_output_section): Don't push to
5650         unattached_section_list_ nor call attach_to_segment.  Call
5651         attach_section_to_segment if sections are attached.
5652         (Layout::attach_sections_to_segments): New function.
5653         (Layout::attach_section_to_segment): New function.
5654         (Layout::attach_allocated_section_to_segment): Rename from
5655         attach_to_segment.  Remove flags parameter.
5656         (Layout::allocate_output_section): Remove function.
5657         (Layout::write_enable_output_section): Remove function.
5658         * layout.h (class Layout): Update for above changes.  Add new
5659         field sections_are_attached_.
5660         * output.h (Output_section::update_flags_for_input_section): New
5661         function.
5662         * output.cc (Output_section::add_input_section): Call
5663         update_flags_for_input_section.
5664         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
5666 2008-04-11  Cary Coutant  <ccoutant@google.com>
5668         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
5669         thought unnecessary.
5670         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
5672 2008-04-11  Ian Lance Taylor  <iant@google.com>
5674         * output.h (class Output_section_data): Remove inline definition
5675         of set_addralign.
5676         * output.cc (Output_section_data::set_addralign): New function.
5678 2008-04-11  Cary Coutant  <ccoutant@google.com>
5680         Add support for TLS descriptors for i386 and x86_64.
5681         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
5682         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
5683         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
5684         GOT_TYPE_TLS_DESC.
5685         (Target_i386::got_mod_index_entry): Remove unnecessary code.
5686         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
5687         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
5688         relocations.
5689         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
5690         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
5691         Fix problem with initial-exec relocations.
5692         (Target_i386::Relocate::relocate_tls): Likewise.
5693         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
5694         relaxation.
5695         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
5696         support for section-plus-offset dynamic table entries.
5697         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
5698         (Output_data_dynamic::Dynamic_entry): Add support for
5699         section-plus-offset dynamic table entries.
5700         (Output_data_dynamic::Classification): Likewise.
5701         (Output_data_dynamic::classification_): Renamed offset_.
5702         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
5703         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
5704         (Target_x86_64::make_plt_section): New function.
5705         (Target_x86_64::reserve_tlsdesc_entries): New function.
5706         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
5707         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
5708         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
5709         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
5710         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
5711         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
5712         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
5713         add extra PLT entry for TLS descriptors.
5714         (Output_data_plt_x86_64::got_): New field.
5715         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
5716         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
5717         fields.
5718         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
5719         descriptors.
5720         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
5721         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
5722         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
5723         R_386_TLS_DESC_CALL relocations.
5724         (Target_x86_64::Scan::global): Likewise.
5725         (Target_x86_64::do_finalize_sections): Add dynamic table entries
5726         for TLS descriptors.
5727         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
5728         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
5729         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
5730         GD-to-IE relaxation.
5731         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
5732         and TLS_DESCRIPTORS.
5733         * Makefile.in: Rebuild.
5734         * configure: Rebuild.
5735         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
5736         (tls_test_shared2.so): New target.
5737         (tls_shared_gd_to_ie_test_SOURCES): New variable.
5738         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
5739         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
5740         (tls_shared_gd_to_ie_test_LDADD): New variable.
5741         (tls_shared_gnu2_gd_to_ie_test): New target.
5742         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
5743         New targets.
5744         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
5745         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
5746         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
5747         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
5748         (tls_shared_gnu2_test): New target.
5749         (tls_test_gnu2_shared.so): New target.
5750         (tls_shared_gnu2_test_SOURCES): New variable.
5751         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
5752         (tls_shared_gnu2_test_LDFLAGS): New variable.
5753         (tls_shared_gnu2_test_LDADD): New variable.
5754         * testsuite/Makefile.in: Rebuild.
5755         * testsuite/Makefile.
5757 2008-04-11  Ian Lance Taylor  <iant@google.com>
5759         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
5760         justsyms.t.
5761         * testsuite/Makefile.in: Rebuild.
5763         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
5764         long.
5765         * testsuite/script_test_2.cc (main): Adjust test.
5767 2008-04-11  David S. Miller  <davem@davemloft.net>
5768             Ian Lance Taylor  <iant@google.com>
5770         * options.h (General_options): Add entries for '-Y' and
5771         '-relax'.
5772         * options.cc (General_options:finalize): If -Y was used, add those
5773         entries to the library path instead of the default "/lib" and
5774         "/usr/lib".
5776 2008-04-11  David S. Miller  <davem@davemloft.net>
5778         * testsuite/justsyms.t: Start at 0x100.
5779         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
5780         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
5781         long.
5782         * testsuite/script_test_2.cc: Adjust string and section length
5783         checks.
5785 2008-04-09  Ian Lance Taylor  <iant@google.com>
5787         PR gold/5996
5788         * script-sections.cc (Sections_element::allocate_to_segment): Add
5789         orphan parameter.
5790         (Output_section_definition::allocate_to_segment): Likewise.
5791         (Orphan_output_section::allocate_to_segment): Likewise.
5792         (Script_sections::attach_sections_using_phdrs_clause): Don't
5793         propagate non-PT_LOAD segments to orphan sections.
5794         * testsuite/Makefile.am (script_test_3.stdout): Generate using
5795         readelf rather than objdump.
5796         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
5797         .interp section and PT_INTERP segment are the same size.
5798         * testsuite/Makefile.in: Rebuild.
5800         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
5801         aliases for symbols defined in the same object.
5802         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
5803         (weak_alias_test_SOURCES): New variable.
5804         (weak_alias_test_DEPENDENCIES): New variable.
5805         (weak_alias_test_LDFLAGS): New variable.
5806         (weak_alias_test_LDADD): New variable.
5807         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
5808         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
5809         (weak_alias_test_3.o): New target.
5810         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
5811         * testsuite/weak_alias_test_main.cc: New file.
5812         * testsuite/weak_alias_test_1.cc: New file.
5813         * testsuite/weak_alias_test_2.cc: New file.
5814         * testsuite/weak_alias_test_3.cc: New file.
5816 2008-04-08  Ian Lance Taylor  <iant@google.com>
5818         * options.h (class General_options): Add --noinhibit-exec option.
5819         * main.cc (main): Check --noinhibit-exec.
5821         * options.h (class General_options): Define --wrap as a special
5822         option.  Add wrap_symbols_ field.
5823         (General_options::any_wrap_symbols): New function.
5824         (General_options::is_wrap_symbol): New function.
5825         * options.cc (General_options::parse_wrap): New function.
5826         (General_options::General_options): Initialize wrap_symbols_.
5827         * symtab.cc (Symbol_table::wrap_symbol): New function.
5828         (Symbol_table::add_from_object): Handle --wrap.
5829         * symtab.h (class Symbol_table): Declare wrap_symbol.
5830         * target.h (Target::wrap_char): New function.
5831         (Target::Target_info): Add wrap_char field.
5832         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
5833         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5834         * testsuite/testfile.cc (Target_test::test_target_info):
5835         Likewise.
5837         * errors.cc (Errors::undefined_symbol): Mention symbol version if
5838         there is one.
5840         * layout.h (class Layout): Add added_eh_frame_data_ field.
5841         * layout.cc (Layout::Layout): Initialize new field.
5842         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
5843         output section until we find a section we merged successfully.
5844         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
5845         that the size be non-zero.
5847         * merge.cc (Object_merge_map::get_output_offset): Remove inline
5848         qualifier.
5850 2008-04-08  Craig Silverstein  <csilvers@google.com>
5852         * configure.ac: Export new conditional variable HAVE_ZLIB.
5853         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
5854         on HAVE_ZLIB.
5855         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
5856         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5858 2008-04-07  Ian Lance Taylor  <iant@google.com>
5860         * version.cc (version_string): Set to "1.5".
5862         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
5863         Add issued_non_pic_error_ field.  Declare check_non_pic.
5864         (Target_x86_64::Scan::check_non_pic): New function.
5865         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
5866         (Target_x86_64::Scan::global): Likewise.
5868         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
5869         addend parameter.  Change caller.  Handle merge sections.
5870         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
5871         Address to Addend.  Don't add in the result of
5872         local_section_offset, pass down the addend and use the returned
5873         value.
5874         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
5875         Update declarations of local_section_offset and symbol_value.
5876         * testsuite/two_file_test_1.cc (t18): New function.
5877         * testsuite/two_file_test_2.cc (f18): New function.
5878         * testsuite/two_file_test_main.cc (main): Call t18.
5879         * testsuite/two_file_test.h (t18, f18): Declare.
5881         * configure.ac: Don't test for objdump, c++filt, or readelf.
5882         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
5883         conditionals.
5884         (TEST_READELF): New variable.
5885         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
5886         (check_PROGRAMS): Add two_file_strip_test.
5887         (two_file_strip_test): New target.
5888         (check_PROGRAMS): Add two_file_same_shared_strip_test.
5889         (two_file_same_shared_strip_test_SOURCES): New variable.
5890         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
5891         (two_file_same_shared_strip_test_LDFLAGS): New variable.
5892         (two_file_same_shared_strip_test_LDADD): New variable.
5893         (two_file_shared_strip.so): New target.
5894         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
5895         (ver_test_5.syms, ver_test_7.syms): Likewise.
5896         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
5897         (strip_test_3.stdout): Use TEST_OBJDUMP.
5898         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
5900 2008-04-04  Cary Coutant  <ccoutant@google.com>
5902         * symtab.h (Symbol::is_weak_undefined): New function.
5903         (Symbol::is_strong_undefined): New function.
5904         (Symbol::is_absolute): New function.
5905         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
5906         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
5907         absolute symbols.
5908         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
5909         (weak_undef_test): New target.
5910         * testsuite/Makefile.in: Rebuild.
5911         * testsuite/weak_undef_file1.cc: New file.
5912         * testsuite/weak_undef_file2.cc: New file.
5913         * testsuite/weak_undef_test.cc: New file.
5915 2008-04-03  Craig Silverstein  <csilvers@google.com>
5917         * compressed_output.h (class Output_compressed_section): Use
5918         unsigned buffer.
5919         * compressed_output.cc (zlib_compress): Use unsigned buffers,
5920         add zlib header.
5921         (zlib_compressed_suffix): Removed.
5922         (Output_compressed_section::set_final_data_size): Use unsigned
5923         buffers.
5924         * testsuite/Makefile.am (flagstest_compress_debug_sections):
5925         Fix linker invocation.
5926         (flagstest_o_specialfile_and_compress_debug_sections):
5927         Likewise.
5928         * testsuite/Makefile.in: Regenerated.
5930 2008-04-02  David S. Miller  <davem@davemloft.net>
5932         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
5933         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
5935 2008-04-02  Craig Silverstein  <csilvers@google.com>
5937         * TODO: New file.
5939 2008-04-02  Ian Lance Taylor  <iant@google.com>
5941         * fileread.cc (File_read::find_view): Add byteshift and vshifted
5942         parameters.  Update for new key type to views_.  Change all
5943         callers.
5944         (File_read::read): Adjust for byteshift in returned view.
5945         (File_read::add_view): New function, broken out of
5946         find_and_make_view.
5947         (File_read::make_view): New function, broken out of
5948         find_and_make_view.
5949         (File_read::find_or_make_view): Add offset and aligned
5950         parameters.  Rewrite accordingly.  Change all callers.
5951         (File_read::get_view): Add offset and aligned parameters.  Adjust
5952         for byteshift in return value.
5953         (File_read::get_lasting_view): Likewise.
5954         * fileread.h (class File_read): Update declarations.
5955         (class File_read::View): Add byteshift_ field.  Add byteshift to
5956         constructor.  Add byteshift method.
5957         * archive.h (Archive::clear_uncached_views): New function.
5958         (Archive::get_view): Add aligned parameter.  Change all callers.
5959         * object.h (Object::get_view): Add aligned parameter.  Change all
5960         callers.
5961         (Object::get_lasting_view): Likewise.
5963         * fileread.cc (File_read::release): Don't call clear_views if
5964         there are multiple objects.
5965         * fileread.h (File_read::clear_uncached_views): New function.
5966         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
5967         on the archive.
5969 2008-03-31  Cary Coutant  <ccoutant@google.com>
5971         Add thin archive support.
5972         * archive.cc (Archive::armagt): New const.
5973         (Archive::setup): Remove task parameter and calls to unlock.
5974         (Archive::unlock_nested_archives): New function.
5975         (Archive::read_header): Add nested_off parameter. Change
5976         all callers.
5977         (Archive::interpret_header): Likewise.
5978         (Archive::include_all_members): Change to handle thin
5979         archives.
5980         (Archive::include_member): Likewise.
5981         * archive.h (Archive::Archive): Add new parameters and
5982         initializers.
5983         (Archive::armagt): New const.
5984         (Archive::setup): Remove task parameter.
5985         (Archive::unlock_nested_archives): New function.
5986         (Archive::read_header): Add nested_off parameter.
5987         (Archive::interpret_header): Likewise.
5988         (Archive::Nested_archive_table): New typedef.
5989         (Archive::is_thin_archive_): New field.
5990         (Archive::nested_archives_): New field.
5991         (Archive::options_): New field.
5992         (Archive::dirpath_): New field.
5993         (Archive::task_): New field.
5994         * readsyms.cc (Read_symbols::do_read_symbols): Add check
5995         for thin archives.  Pass additional parameters to
5996         Archive::Archive.  Unlock the archive file after calling
5997         Archive::setup.
5999 2008-03-29  Ian Lance Taylor  <iant@google.com>
6001         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
6002         version symbol to be local.
6003         * testsuite/ver_test_4.sh: New file.
6004         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
6005         (check_DATA): Add ver_test_4.syms.
6006         (ver_test_4.syms): New target.
6007         * testsuite/Makefile.in: Rebuild.
6009         * output.cc
6010         (Output_section::Input_section_sort_entry::has_priority): New
6011         function.
6012         (Output_section::Input_section_sort_entry::match_file_name): New
6013         function.
6014         (Output_section::Input_section_sort_entry::match_section_name):
6015         Remove.
6016         (Output_section::Input_section_sort_entry::match_section_name_prefix):
6017         Remove.
6018         (Output_section::Input_section_sort_entry::match_section_file):
6019         Remove.
6020         (Output_section::Input_section_sort_compare::operator()): Rewrite
6021         using new Input_section_sort_entry functions.  Sort crtbegin and
6022         crtend first.  Sort sections with no priority before sections with
6023         a priority.
6024         * testsuite/initpri1.c (d3): Check j != 4.
6025         (cd5): New constructor/destructor function.
6026         (main): Check j != 2.
6028         * symtab.cc (Symbol_table::add_from_object): If we don't use the
6029         new symbol when resolving, don't call set_is_default.
6030         * testsuite/ver_test_7.cc: New file.
6031         * testsuite/ver_test_7.sh: New file.
6032         * testsuite/Makefile.am (ver_test_7.so): New target.
6033         (ver_test_7.o): New target.
6034         (check_SCRIPTS): Add ver_test_7.sh.
6035         (check_DATA): Add ver_test_7.syms.
6036         (ver_test_7.syms): New target.
6038 2008-03-28  Ian Lance Taylor  <iant@google.com>
6040         * layout.cc (Layout::layout): If we see an input section with a
6041         name that needs sorting, set the must_sort flag for the output
6042         section.
6043         (Layout::make_output_section): If the name of the output section
6044         indicates that it might require sorting, set the may_sort flag.
6045         * output.h (Output_section::may_sort_attached_input_sections): New
6046         function.
6047         (Output_section::set_may_sort_attached_input_sections): New
6048         function.
6049         (Output_section::must_sort_attached_input_sections): New
6050         function.
6051         (Output_section::set_must_sort_attached_input_sections): New
6052         function.
6053         (class Output_section): Declare Input_section_sort_entry.  Define
6054         Input_section_sort_compare.  Declare
6055         sort_attached_input_sections.  Add new fields:
6056         may_sort_attached_input_sections_,
6057         must_sort_attached_input_sections_,
6058         attached_input_sections_are_sorted_.
6059         * output.cc (Output_section::Output_section): Initialize new
6060         fields.
6061         (Output_section::add_input_section): Add an entry to
6062         input_sections_ if may_sort or must_sort are true.
6063         (Output_section::set_final_data_size): Call
6064         sort_attached_input_sections if necessary.
6065         (Output_section::Input_section_sort_entry): Define new class.
6066         (Output_section::Input_section_sort_compare::operator()): New
6067         function.
6068         (Output_section::sort_attached_input_sections): New function.
6069         * configure.ac: Check whether the compiler supports constructor
6070         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
6071         * testsuite/initpri1.c: New file.
6072         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
6073         CONSTRUCTOR_PRIORITY.
6074         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
6075         (initpri1_LDFLAGS): New variable.
6076         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
6078 2008-03-27  Ian Lance Taylor  <iant@google.com>
6080         * common.cc (Sort_commons::operator): Correct sorting algorithm.
6081         * testsuite/common_test_1.c: New file.
6082         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
6083         (common_test_1_SOURCES): New variable.
6084         (common_test_1_DEPENDENCIES): New variable.
6085         (common_test_1_LDFLAGS): New variable.
6087         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
6088         and commons_ correctly when NAME/VERSION does not override
6089         NAME/NULL.
6090         * testsuite/ver_test_6.c: New file.
6091         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
6092         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
6093         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
6095 2008-03-26  Ian Lance Taylor  <iant@google.com>
6097         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
6098         of an undefined symbol from a version script.
6099         * testsuite/Makefile.am (ver_test_5.so): New target.
6100         (ver_test_5.o): New target.
6101         (check_SCRIPTS): Add ver_test_5.sh.
6102         (check_DATA): Add ver_test_5.syms.
6103         (ver_test_5.syms): New target.
6104         * testsuite/ver_test_5.cc: New file.
6105         * testsuite/ver_test_5.script: New file.
6106         * testsuite/ver_test_5.sh: New file.
6107         * Makefile.in, testsuite/Makefile.in: Rebuild.
6109         PR gold/5986
6110         Fix problems building gold with gcc 4.3.0.
6111         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
6112         (gold_error_at_location, gold_warning_at_location): Use it.
6113         * configure.ac: Check whether we can compile and use a template
6114         function with a printf attribute.
6115         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
6116         when jumping over bytes.
6117         * object.cc: Instantiate Object::read_section_data.
6118         * debug.h: Include <cstring>
6119         * dwarf_reader.cc: Include <algorithm>
6120         * main.cc: Include <cstring>.
6121         * options.cc: Include <cstring>.
6122         * output.cc: Include <cstring>.
6123         * script.cc: Include <cstring>.
6124         * script.h: Include <string>.
6125         * symtab.cc: Include <cstring> and <algorithm>.
6126         * target-select.cc: Include <cstring>.
6127         * version.cc: Include <string>.
6128         * testsuite/testmain.cc: Include <cstdlib>.
6129         * configure, config.in: Rebuild.
6131 2008-03-25  Ian Lance Taylor  <iant@google.com>
6133         * options.cc: Include "../bfd/bfdver.h".
6134         (options::help): Print bug reporting address.
6136         * version.cc (print_version): Adjust output for current value of
6137         BFD_VERSION_STRING.
6139         * NEWS: New file.
6141         * options.cc (options::help): Print list of supported targets.
6142         * target-select.h: Include <vector>.
6143         (class Target_selector): Make machine_, size_, and is_big_endian_
6144         fields const.  Add bfd_name_ and instantiated_target_ fields.
6145         (Target_selector::Target_selector): Add bfd_name parameter.
6146         (Target_selector::recognize): Make non-virtual, call
6147         do_recognize.
6148         (Target_selector::recognize_by_name): Make non-virtual, call
6149         do_recognize_by_name.
6150         (Target_selector::supported_names): New function.
6151         (Target_selector::bfd_name): New function.
6152         (Target_selector::do_instantiate_target): New pure virtual
6153         function.
6154         (Target_selector::do_recognize): New virtual function.
6155         (Target_selector::do_recognize_by_name): New virtual function.
6156         (Target_selector::instantiate_target): New private function.
6157         (supported_target_names): Declare.
6158         * target-select.cc (Target_selector::Target_selector): Update for
6159         new parameter and fields.
6160         (select_target_by_name): Check that the name matches before
6161         calling recognize_by_name.
6162         (supported_target_names): New function.
6163         * i386.cc (class Target_selector_i386): Update Target_selector
6164         constructor call.  Remove recognize and recognize_by_name.  Add
6165         do_instantiate_target.
6166         * x86_64.cc (class Target_selector_x86_64): Likewise.
6167         * testsuite/testfile.cc (class Target_selector_test): Update for
6168         changes to Target_selector.
6170         * README: Rewrite, with some notes on unsupported features.
6172 2008-03-24  Cary Coutant  <ccoutant@google.com>
6174         * i386.cc (Target_i386::Got_type): New enum declaration.
6175         (Target_i386::Scan::local): Updated callers of Output_data_got
6176         member functions.
6177         (Target_i386::Scan::global): Likewise.
6178         (Target_i386::Relocate::relocate): Likewise.
6179         (Target_i386::Relocate::relocate_tls): Likewise.
6180         * object.h (Got_offset_list): New class.
6181         (Sized_relobj::local_has_got_offset): Added got_type parameter.
6182         (Sized_relobj::local_got_offset): Likewise.
6183         (Sized_relobj::set_local_got_offset): Likewise.
6184         (Sized_relobj::local_has_tls_got_offset): Removed.
6185         (Sized_relobj::local_tls_got_offset): Removed.
6186         (Sized_relobj::set_local_tls_got_offset): Removed.
6187         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
6188         * output.cc (Output_data_got::add_global): Added got_type parameter.
6189         (Output_data_got::add_global_with_rel): Likewise.
6190         (Output_data_got::add_global_with_rela): Likewise.
6191         (Output_data_got::add_global_pair_with_rel): New function.
6192         (Output_data_got::add_global_pair_with_rela): New function.
6193         (Output_data_got::add_local): Added got_type parameter.
6194         (Output_data_got::add_local_with_rel): Likewise.
6195         (Output_data_got::add_local_with_rela): Likewise.
6196         (Output_data_got::add_local_pair_with_rel): New function.
6197         (Output_data_got::add_local_pair_with_rela): New function.
6198         (Output_data_got::add_global_tls): Removed.
6199         (Output_data_got::add_global_tls_with_rel): Removed.
6200         (Output_data_got::add_global_tls_with_rela): Removed.
6201         (Output_data_got::add_local_tls): Removed.
6202         (Output_data_got::add_local_tls_with_rel): Removed.
6203         (Output_data_got::add_local_tls_with_rela): Removed.
6204         * output.h (Output_data_got::add_global): Added got_type parameter.
6205         (Output_data_got::add_global_with_rel): Likewise.
6206         (Output_data_got::add_global_with_rela): Likewise.
6207         (Output_data_got::add_global_pair_with_rel): New function.
6208         (Output_data_got::add_global_pair_with_rela): New function.
6209         (Output_data_got::add_local): Added got_type parameter.
6210         (Output_data_got::add_local_with_rel): Likewise.
6211         (Output_data_got::add_local_with_rela): Likewise.
6212         (Output_data_got::add_local_pair_with_rel): New function.
6213         (Output_data_got::add_local_pair_with_rela): New function.
6214         (Output_data_got::add_global_tls): Removed.
6215         (Output_data_got::add_global_tls_with_rel): Removed.
6216         (Output_data_got::add_global_tls_with_rela): Removed.
6217         (Output_data_got::add_local_tls): Removed.
6218         (Output_data_got::add_local_tls_with_rel): Removed.
6219         (Output_data_got::add_local_tls_with_rela): Removed.
6220         * resolve.cc (Symbol::override_base_with_special): Removed
6221         reference to has_got_offset_ field.
6222         * symtab.cc (Symbol::init_fields): Replaced initialization
6223         of got_offset_ with got_offsets_.  Removed initialization
6224         of has_got_offset_
6225         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
6226         (Symbol::got_offset): Likewise.
6227         (Symbol::set_got_offset): Likewise.
6228         (Symbol::has_tls_got_offset): Removed.
6229         (Symbol::tls_got_offset): Removed.
6230         (Symbol::set_tls_got_offset): Removed.
6231         (Symbol::got_offset_): Removed.
6232         (Symbol::tls_mod_got_offset_): Removed.
6233         (Symbol::tls_pair_got_offset_): Removed.
6234         (Symbol::got_offsets_): New field.
6235         (Symbol::has_got_offset): Removed.
6236         (Symbol::has_tls_mod_got_offset): Removed.
6237         (Symbol::has_tls_pair_got_offset): Removed.
6238         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
6239         (Target_x86_64::Scan::local): Updated callers of Output_data_got
6240         member functions.
6241         (Target_x86_64::Scan::global): Likewise.
6242         (Target_x86_64::Relocate::relocate): Likewise.
6243         (Target_x86_64::Relocate::relocate_tls): Likewise.
6245 2008-03-25  Ben Elliston  <bje@au.ibm.com>
6247         * yyscript.y: Fix spelling error in comment.
6249 2008-03-24  Ian Lance Taylor  <iant@google.com>
6251         * options.h (class General_options): Define build_id option.
6252         * layout.h (class Layout): Declare write_build_id, create_note,
6253         create_build_id.  Add build_id_note_ member.
6254         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
6255         "libiberty.h", "md5.h", "sha1.h".
6256         (Layout::Layout): Initialize eh_frame_data_,
6257         eh_frame_hdr_section_, and build_id_note_.
6258         (Layout::finalize): Call create_build_id.
6259         (Layout::create_note): New function, broken out of
6260         Layout::create_gold_note.
6261         (Layout::create_gold_note): Call create_note.
6262         (Layout::create_build_id): New function.
6263         (Layout::write_build_id): New function.
6264         (Close_task_runner::run): Call write_build_id.
6266         * x86_64.cc: Correct license to GPLv3.
6268 2008-03-23  Ian Lance Taylor  <iant@google.com>
6270         * options.cc: Include "demangle.h".
6271         (parse_optional_string): New function.
6272         (parse_long_option): Handle takes_optional_argument.
6273         (parse_short_option): Update dash_z initializer.  Handle
6274         takes_optional_argument.
6275         (General_options::General_options): Initialize do_demangle_.
6276         (General_options::finalize): Set do_demangle_.  Handle demangling
6277         style.
6278         * options.h (parse_optional_string): Declare.
6279         (struct One_option): Add optional_arg field.  Update constructor.
6280         Update call constructor calls.  Add takes_optional_argument
6281         function.
6282         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
6283         (DEFINE_optional_string): Define.
6284         (General_options::demangle): Change from DEFINE_bool to
6285         DEFINE_optional_string.
6286         (General_options::no_demangle): New function.
6287         (General_options::do_demangle): New function.
6288         (General_options::set_do_demangle): New function.
6289         (General_options::execstack_status_): Move definition to end of
6290         class definition.
6291         (General_options::static_): Likewise.
6292         (General_options::do_demangle_): New field.
6293         * object.cc (big_endian>::get_symbol_location_info): Call
6294         Options::do_demangle, not Options::demangle.
6295         * symtab.cc (demangle): Likewise.
6297 2008-03-22  Ian Lance Taylor  <iant@google.com>
6299         * gold.h: Include <cstddef> and <sys/types.h>
6300         * options.h: Include <cstring>.
6302 2008-03-21  Ian Lance Taylor  <iant@google.com>
6304         * Added source code to GNU binutils.