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