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