OSDN Git Service

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