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