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