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