OSDN Git Service

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