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