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