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