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