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