OSDN Git Service

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