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