OSDN Git Service

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