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